diff --git a/.eslintrc.js b/.eslintrc.js index 9e0e749e74e51..2c55dd2528ef1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -470,11 +470,6 @@ module.exports = { errorMessage: 'Server modules cannot be imported into client modules or shared modules.', }, - { - target: ['src/**/*'], - from: ['x-pack/**/*'], - errorMessage: 'OSS cannot import x-pack files.', - }, { target: ['src/core/**/*'], from: ['plugins/**/*', 'src/plugins/**/*'], @@ -1573,6 +1568,7 @@ module.exports = { files: [ 'src/plugins/security_oss/**/*.{js,mjs,ts,tsx}', 'src/plugins/spaces_oss/**/*.{js,mjs,ts,tsx}', + 'src/plugins/interactive_setup/**/*.{js,mjs,ts,tsx}', 'x-pack/plugins/encrypted_saved_objects/**/*.{js,mjs,ts,tsx}', 'x-pack/plugins/security/**/*.{js,mjs,ts,tsx}', 'x-pack/plugins/spaces/**/*.{js,mjs,ts,tsx}', diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0744112650c23..5c54fb6ef1ce4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -69,6 +69,24 @@ #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 + +# Logs and Metrics (Infra) +/x-pack/plugins/infra/ @elastic/logs-metrics-ui +/x-pack/plugins/infra/server/routes/log* @elastic/logs-metrics-ui @elastic/logs-ui +/x-pack/plugins/infra/public/pages/logs/ @elastic/logs-metrics-ui @elastic/logs-ui +/x-pack/plugins/infra/server/routes/metrics* @elastic/logs-metrics-ui @elastic/metrics-ui +/x-pack/plugins/infra/public/pages/metrics/ @elastic/logs-metrics-ui @elastic/metrics-ui + +# Stack Monitoring +/x-pack/plugins/monitoring/ @elastic/stack-monitoring-ui @elastic/logs-metrics-ui @elastic/metrics-ui + +# Fleet +/x-pack/plugins/fleet/ @elastic/fleet + # APM /x-pack/plugins/apm/ @elastic/apm-ui /x-pack/test/functional/apps/apm/ @elastic/apm-ui @@ -97,6 +115,7 @@ /x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts @elastic/uptime /x-pack/test/apm_api_integration/tests/csm/ @elastic/uptime +### END Observability Plugins # Presentation /src/plugins/dashboard/ @elastic/kibana-presentation @@ -110,13 +129,6 @@ #CC# /src/plugins/kibana_react/public/code_editor/ @elastic/kibana-presentation #CC# /x-pack/plugins/dashboard_mode @elastic/kibana-presentation - -# Observability UIs -/x-pack/plugins/infra/ @elastic/logs-metrics-ui -/x-pack/plugins/fleet/ @elastic/fleet -/x-pack/plugins/observability/ @elastic/observability-ui -/x-pack/plugins/monitoring/ @elastic/stack-monitoring-ui - # Machine Learning /x-pack/plugins/ml/ @elastic/ml-ui /x-pack/test/accessibility/apps/ml.ts @elastic/ml-ui @@ -252,7 +264,7 @@ /src/core/server/csp/ @elastic/kibana-security @elastic/kibana-core /src/plugins/security_oss/ @elastic/kibana-security /src/plugins/spaces_oss/ @elastic/kibana-security -/src/plugins/user_setup/ @elastic/kibana-security +/src/plugins/interactive_setup/ @elastic/kibana-security /test/security_functional/ @elastic/kibana-security /x-pack/plugins/spaces/ @elastic/kibana-security /x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security @@ -351,7 +363,7 @@ /x-pack/test/case_api_integration @elastic/security-threat-hunting /x-pack/plugins/lists @elastic/security-detections-response -## Security Solution sub teams - security-onboarding-and-lifecycle-mgt +## Security Solution sub teams - security-onboarding-and-lifecycle-mgt /x-pack/plugins/security_solution/public/management/ @elastic/security-onboarding-and-lifecycle-mgt /x-pack/plugins/security_solution/public/common/lib/endpoint*/ @elastic/security-onboarding-and-lifecycle-mgt /x-pack/plugins/security_solution/public/common/components/endpoint/ @elastic/security-onboarding-and-lifecycle-mgt diff --git a/.i18nrc.json b/.i18nrc.json index 2709d5ad7a671..235b65d7502f4 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -9,6 +9,7 @@ "data": "src/plugins/data", "embeddableApi": "src/plugins/embeddable", "embeddableExamples": "examples/embeddable_examples", + "fieldFormats": "src/plugins/field_formats", "uiActionsExamples": "examples/ui_action_examples", "share": "src/plugins/share", "home": "src/plugins/home", @@ -35,8 +36,10 @@ "monaco": "packages/kbn-monaco/src", "esQuery": "packages/kbn-es-query/src", "presentationUtil": "src/plugins/presentation_util", + "indexPatternEditor": "src/plugins/index_pattern_editor", "indexPatternFieldEditor": "src/plugins/index_pattern_field_editor", "indexPatternManagement": "src/plugins/index_pattern_management", + "interactiveSetup": "src/plugins/interactive_setup", "advancedSettings": "src/plugins/advanced_settings", "kibana_legacy": "src/plugins/kibana_legacy", "kibanaOverview": "src/plugins/kibana_overview", diff --git a/api_docs/actions.json b/api_docs/actions.json index 9e511bce4ca3a..450b0f0e7f632 100644 --- a/api_docs/actions.json +++ b/api_docs/actions.json @@ -214,8 +214,8 @@ ], "path": "x-pack/plugins/actions/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "actions", @@ -1838,6 +1838,22 @@ ], "path": "x-pack/plugins/actions/common/rewrite_request_case.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "actions", + "id": "def-common.requested", + "type": "Object", + "tags": [], + "label": "requested", + "description": [], + "signature": [ + "{ [K in keyof T as CamelToSnake>>]: T[K]; }" + ], + "path": "x-pack/plugins/actions/common/rewrite_request_case.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1868,6 +1884,22 @@ ], "path": "x-pack/plugins/actions/common/rewrite_request_case.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "actions", + "id": "def-common.responded", + "type": "Uncategorized", + "tags": [], + "label": "responded", + "description": [], + "signature": [ + "T" + ], + "path": "x-pack/plugins/actions/common/rewrite_request_case.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/actions.mdx b/api_docs/actions.mdx index 1020fa063d1c0..a713c7da04e0f 100644 --- a/api_docs/actions.mdx +++ b/api_docs/actions.mdx @@ -18,7 +18,7 @@ import actionsObj from './actions.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 117 | 0 | 117 | 7 | +| 119 | 0 | 119 | 7 | ## Server diff --git a/api_docs/alerting.json b/api_docs/alerting.json index 8e956c5cb36d3..bd245c1ae0b64 100644 --- a/api_docs/alerting.json +++ b/api_docs/alerting.json @@ -29,6 +29,48 @@ ], "path": "x-pack/plugins/alerting/public/alert_navigation_registry/types.ts", "deprecated": false, + "returnComment": [ + "A URL that is meant to be relative to your application id, or a state object that your application uses to render\nthe rule. This information is intended to be used with cores NavigateToApp function, along with the application id that was\noriginally registered to {@link PluginSetupContract.registerNavigation}." + ], + "children": [ + { + "parentPluginId": "alerting", + "id": "def-public.alert", + "type": "Object", + "tags": [], + "label": "alert", + "description": [], + "signature": [ + "{ enabled: boolean; id: string; name: string; params: never; actions: ", + { + "pluginId": "alerting", + "scope": "common", + "docId": "kibAlertingPluginApi", + "section": "def-common.AlertAction", + "text": "AlertAction" + }, + "[]; throttle: string | null; tags: string[]; alertTypeId: string; consumer: string; schedule: ", + { + "pluginId": "alerting", + "scope": "common", + "docId": "kibAlertingPluginApi", + "section": "def-common.IntervalSchedule", + "text": "IntervalSchedule" + }, + "; scheduledTaskId?: string | undefined; createdBy: string | null; updatedBy: string | null; createdAt: Date; updatedAt: Date; apiKeyOwner: string | null; notifyWhen: \"onActionGroupChange\" | \"onActiveAlert\" | \"onThrottleInterval\" | null; muteAll: boolean; mutedInstanceIds: string[]; executionStatus: ", + { + "pluginId": "alerting", + "scope": "common", + "docId": "kibAlertingPluginApi", + "section": "def-common.AlertExecutionStatus", + "text": "AlertExecutionStatus" + }, + "; }" + ], + "path": "x-pack/plugins/alerting/public/alert_navigation_registry/types.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -67,35 +109,42 @@ ], "path": "x-pack/plugins/alerting/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "alerting", - "id": "def-public.applicationId", + "id": "def-public.PluginSetupContract.registerNavigation.$1", "type": "string", "tags": [], "label": "applicationId", "description": [ "The application id that the user should be navigated to, to view a particular alert in a custom way." ], + "signature": [ + "string" + ], "path": "x-pack/plugins/alerting/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "alerting", - "id": "def-public.ruleType", + "id": "def-public.PluginSetupContract.registerNavigation.$2", "type": "string", "tags": [], "label": "ruleType", "description": [ "The rule type that has been registered with Alerting.Server.PluginSetupContract.registerType. If\nno such rule with that id exists, a warning is output to the console log. It used to throw an error, but that was temporarily moved\nbecause it was causing flaky test failures with https://github.com/elastic/kibana/issues/59229 and needs to be\ninvestigated more." ], + "signature": [ + "string" + ], "path": "x-pack/plugins/alerting/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "alerting", - "id": "def-public.handler", + "id": "def-public.PluginSetupContract.registerNavigation.$3", "type": "Function", "tags": [], "label": "handler", @@ -103,21 +152,20 @@ "The navigation handler should return either a relative URL, or a state object. This information can be used,\nin conjunction with the consumer id, to navigate the user to a custom URL to view a rule's details." ], "signature": [ - "(alert: Pick<", { "pluginId": "alerting", - "scope": "common", + "scope": "public", "docId": "kibAlertingPluginApi", - "section": "def-common.Alert", - "text": "Alert" - }, - ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"throttle\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"notifyWhen\" | \"muteAll\" | \"mutedInstanceIds\" | \"executionStatus\">) => string | ", - "JsonObject" + "section": "def-public.AlertNavigationHandler", + "text": "AlertNavigationHandler" + } ], "path": "x-pack/plugins/alerting/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "alerting", @@ -141,23 +189,26 @@ ], "path": "x-pack/plugins/alerting/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "alerting", - "id": "def-public.applicationId", + "id": "def-public.PluginSetupContract.registerDefaultNavigation.$1", "type": "string", "tags": [], "label": "applicationId", "description": [ "The application id that the user should be navigated to, to view a particular alert in a custom way." ], + "signature": [ + "string" + ], "path": "x-pack/plugins/alerting/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "alerting", - "id": "def-public.handler", + "id": "def-public.PluginSetupContract.registerDefaultNavigation.$2", "type": "Function", "tags": [], "label": "handler", @@ -165,21 +216,20 @@ "The navigation handler should return either a relative URL, or a state object. This information can be used,\nin conjunction with the consumer id, to navigate the user to a custom URL to view a rule's details." ], "signature": [ - "(alert: Pick<", { "pluginId": "alerting", - "scope": "common", + "scope": "public", "docId": "kibAlertingPluginApi", - "section": "def-common.Alert", - "text": "Alert" - }, - ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"throttle\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"notifyWhen\" | \"muteAll\" | \"mutedInstanceIds\" | \"executionStatus\">) => string | ", - "JsonObject" + "section": "def-public.AlertNavigationHandler", + "text": "AlertNavigationHandler" + } ], "path": "x-pack/plugins/alerting/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", @@ -223,19 +273,23 @@ ], "path": "x-pack/plugins/alerting/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "alerting", - "id": "def-public.alertId", + "id": "def-public.PluginStartContract.getNavigation.$1", "type": "string", "tags": [], "label": "alertId", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/alerting/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "start", @@ -955,8 +1009,8 @@ ], "path": "x-pack/plugins/alerting/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "alerting", @@ -995,8 +1049,8 @@ ], "path": "x-pack/plugins/alerting/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "alerting", @@ -1010,8 +1064,8 @@ ], "path": "x-pack/plugins/alerting/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1102,19 +1156,23 @@ ], "path": "x-pack/plugins/alerting/server/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "alerting", - "id": "def-server.id", + "id": "def-server.AlertServices.alertInstanceFactory.$1", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/alerting/server/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1660,8 +1718,8 @@ ], "path": "x-pack/plugins/alerting/server/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/alerting.mdx b/api_docs/alerting.mdx index 252a3b45c6c12..6ef427d452ec4 100644 --- a/api_docs/alerting.mdx +++ b/api_docs/alerting.mdx @@ -18,7 +18,7 @@ import alertingObj from './alerting.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 242 | 0 | 234 | 16 | +| 243 | 0 | 235 | 16 | ## Client diff --git a/api_docs/apm.json b/api_docs/apm.json index 3aa6d7709309c..db8eb663da613 100644 --- a/api_docs/apm.json +++ b/api_docs/apm.json @@ -3928,8 +3928,8 @@ ], "path": "x-pack/plugins/apm/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "apm", @@ -3959,32 +3959,67 @@ ], "path": "x-pack/plugins/apm/server/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "apm", - "id": "def-server.params", + "id": "def-server.APMPluginSetup.createApmEventClient.$1.params", "type": "Object", "tags": [], "label": "params", "description": [], - "signature": [ - "{ debug?: boolean | undefined; request: ", + "path": "x-pack/plugins/apm/server/types.ts", + "deprecated": false, + "children": [ { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" + "parentPluginId": "apm", + "id": "def-server.APMPluginSetup.createApmEventClient.$1.params.debug", + "type": "CompoundType", + "tags": [], + "label": "debug", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "x-pack/plugins/apm/server/types.ts", + "deprecated": false }, - "; context: ", - "ApmPluginRequestHandlerContext", - "; }" - ], - "path": "x-pack/plugins/apm/server/types.ts", - "deprecated": false + { + "parentPluginId": "apm", + "id": "def-server.APMPluginSetup.createApmEventClient.$1.params.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "x-pack/plugins/apm/server/types.ts", + "deprecated": false + }, + { + "parentPluginId": "apm", + "id": "def-server.APMPluginSetup.createApmEventClient.$1.params.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "ApmPluginRequestHandlerContext" + ], + "path": "x-pack/plugins/apm/server/types.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/apm.mdx b/api_docs/apm.mdx index b2aabfd4b4214..c241ea2376f26 100644 --- a/api_docs/apm.mdx +++ b/api_docs/apm.mdx @@ -18,7 +18,7 @@ Contact APM UI for questions regarding this plugin. | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 39 | 0 | 39 | 30 | +| 42 | 0 | 42 | 30 | ## Client diff --git a/api_docs/bfetch.json b/api_docs/bfetch.json index d5ed18b9fdab0..2e42ea6066eee 100644 --- a/api_docs/bfetch.json +++ b/api_docs/bfetch.json @@ -56,6 +56,35 @@ ], "path": "src/plugins/bfetch/public/batching/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "bfetch", + "id": "def-public.payload", + "type": "Uncategorized", + "tags": [], + "label": "payload", + "description": [], + "signature": [ + "Payload" + ], + "path": "src/plugins/bfetch/public/batching/types.ts", + "deprecated": false + }, + { + "parentPluginId": "bfetch", + "id": "def-public.signal", + "type": "Object", + "tags": [], + "label": "signal", + "description": [], + "signature": [ + "AbortSignal | undefined" + ], + "path": "src/plugins/bfetch/public/batching/types.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -86,11 +115,10 @@ ], "path": "src/plugins/bfetch/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-public.params", + "id": "def-public.BfetchPublicContract.fetchStreaming.$1", "type": "Object", "tags": [], "label": "params", @@ -99,9 +127,11 @@ "FetchStreamingParams" ], "path": "src/plugins/bfetch/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "bfetch", @@ -125,11 +155,10 @@ ], "path": "src/plugins/bfetch/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-public.params", + "id": "def-public.BfetchPublicContract.batchedFunction.$1", "type": "Object", "tags": [], "label": "params", @@ -139,9 +168,11 @@ "" ], "path": "src/plugins/bfetch/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "start", @@ -184,11 +215,10 @@ ], "path": "src/plugins/bfetch/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-server.data", + "id": "def-server.BatchProcessingRouteParams.onBatchItem.$1", "type": "Uncategorized", "tags": [], "label": "data", @@ -197,9 +227,11 @@ "BatchItemData" ], "path": "src/plugins/bfetch/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -241,6 +273,48 @@ ], "path": "src/plugins/bfetch/server/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "bfetch", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.RequestHandlerContext", + "text": "RequestHandlerContext" + } + ], + "path": "src/plugins/bfetch/server/types.ts", + "deprecated": false + }, + { + "parentPluginId": "bfetch", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/plugins/bfetch/server/types.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -283,21 +357,24 @@ ], "path": "src/plugins/bfetch/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-server.path", + "id": "def-server.BfetchServerSetup.addBatchProcessingRoute.$1", "type": "string", "tags": [], "label": "path", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/bfetch/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "bfetch", - "id": "def-server.handler", + "id": "def-server.BfetchServerSetup.addBatchProcessingRoute.$2", "type": "Function", "tags": [], "label": "handler", @@ -322,9 +399,11 @@ "" ], "path": "src/plugins/bfetch/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "bfetch", @@ -354,21 +433,24 @@ ], "path": "src/plugins/bfetch/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-server.path", + "id": "def-server.BfetchServerSetup.addStreamingResponseRoute.$1", "type": "string", "tags": [], "label": "path", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/bfetch/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "bfetch", - "id": "def-server.params", + "id": "def-server.BfetchServerSetup.addStreamingResponseRoute.$2", "type": "Function", "tags": [], "label": "params", @@ -393,9 +475,11 @@ "" ], "path": "src/plugins/bfetch/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "bfetch", @@ -625,42 +709,30 @@ ], "path": "src/plugins/bfetch/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-server.streamHandler", + "id": "def-server.BfetchServerSetup.createStreamingRequestHandler.$1", "type": "Function", "tags": [], "label": "streamHandler", "description": [], "signature": [ - "(context: ", { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, - ", request: ", - { - "pluginId": "core", + "pluginId": "bfetch", "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" + "docId": "kibBfetchPluginApi", + "section": "def-server.StreamingRequestHandler", + "text": "StreamingRequestHandler" }, - ") => ", - "Observable", - " | Promise<", - "Observable", - ">" + "" ], "path": "src/plugins/bfetch/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", @@ -1118,22 +1190,23 @@ ], "path": "src/plugins/bfetch/common/buffer/create_batched_function.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-common.args", + "id": "def-common.BatchedFunctionParams.onCall.$1", "type": "Uncategorized", "tags": [], "label": "args", "description": [], "signature": [ - "Func extends (...args: infer P) => any ? P : never" + "Parameters" ], "path": "src/plugins/bfetch/common/buffer/create_batched_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "bfetch", @@ -1147,11 +1220,10 @@ ], "path": "src/plugins/bfetch/common/buffer/create_batched_function.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-common.items", + "id": "def-common.BatchedFunctionParams.onBatch.$1", "type": "Array", "tags": [], "label": "items", @@ -1160,9 +1232,11 @@ "BatchEntry[]" ], "path": "src/plugins/bfetch/common/buffer/create_batched_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "bfetch", @@ -1393,11 +1467,10 @@ ], "path": "src/plugins/bfetch/common/buffer/item_buffer.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "bfetch", - "id": "def-common.items", + "id": "def-common.ItemBufferParams.onFlush.$1", "type": "Array", "tags": [], "label": "items", @@ -1406,9 +1479,11 @@ "Item[]" ], "path": "src/plugins/bfetch/common/buffer/item_buffer.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/bfetch.mdx b/api_docs/bfetch.mdx index 113cf589fde00..d7f42be45a29a 100644 --- a/api_docs/bfetch.mdx +++ b/api_docs/bfetch.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 73 | 1 | 62 | 2 | +| 77 | 1 | 66 | 2 | ## Client diff --git a/api_docs/cases.json b/api_docs/cases.json index e2dd6ffe5fd69..09c05ba433a52 100644 --- a/api_docs/cases.json +++ b/api_docs/cases.json @@ -444,11 +444,10 @@ ], "path": "x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "cases", - "id": "def-public.theCase", + "id": "def-public.AllCasesSelectorModalProps.onRowClick.$1", "type": "CompoundType", "tags": [], "label": "theCase", @@ -472,9 +471,11 @@ " | undefined" ], "path": "x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -495,7 +496,30 @@ ") => void) | undefined" ], "path": "x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "cases", + "id": "def-public.AllCasesSelectorModalProps.updateCase.$1", + "type": "Object", + "tags": [], + "label": "newCase", + "description": [], + "signature": [ + { + "pluginId": "cases", + "scope": "common", + "docId": "kibCasesPluginApi", + "section": "def-common.Case", + "text": "Case" + } + ], + "path": "x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -550,7 +574,30 @@ ") => void) | undefined" ], "path": "x-pack/plugins/cases/public/components/case_view/index.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "cases", + "id": "def-public.CaseViewProps.onCaseDataSuccess.$1", + "type": "Object", + "tags": [], + "label": "data", + "description": [], + "signature": [ + { + "pluginId": "cases", + "scope": "common", + "docId": "kibCasesPluginApi", + "section": "def-common.Case", + "text": "Case" + } + ], + "path": "x-pack/plugins/cases/public/components/case_view/index.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -643,7 +690,44 @@ ", postComment: (args: PostComment) => Promise) => Promise) | undefined" ], "path": "x-pack/plugins/cases/public/components/create/index.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "cases", + "id": "def-public.CreateCaseProps.afterCaseCreated.$1", + "type": "Object", + "tags": [], + "label": "theCase", + "description": [], + "signature": [ + { + "pluginId": "cases", + "scope": "common", + "docId": "kibCasesPluginApi", + "section": "def-common.Case", + "text": "Case" + } + ], + "path": "x-pack/plugins/cases/public/components/create/index.tsx", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "cases", + "id": "def-public.CreateCaseProps.afterCaseCreated.$2", + "type": "Function", + "tags": [], + "label": "postComment", + "description": [], + "signature": [ + "(args: PostComment) => Promise" + ], + "path": "x-pack/plugins/cases/public/components/create/index.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -703,8 +787,8 @@ ], "path": "x-pack/plugins/cases/public/components/create/index.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "cases", @@ -726,11 +810,10 @@ ], "path": "x-pack/plugins/cases/public/components/create/index.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "cases", - "id": "def-public.theCase", + "id": "def-public.CreateCaseProps.onSuccess.$1", "type": "Object", "tags": [], "label": "theCase", @@ -745,9 +828,11 @@ } ], "path": "x-pack/plugins/cases/public/components/create/index.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -911,13 +996,10 @@ ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, - "returnComment": [ - "A react component that displays all cases" - ], "children": [ { "parentPluginId": "cases", - "id": "def-public.props", + "id": "def-public.CasesUiStart.getAllCases.$1", "type": "Object", "tags": [], "label": "props", @@ -934,8 +1016,12 @@ } ], "path": "x-pack/plugins/cases/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A react component that displays all cases" ] }, { @@ -968,13 +1054,10 @@ ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, - "returnComment": [ - "A react component that is a modal for selecting a case" - ], "children": [ { "parentPluginId": "cases", - "id": "def-public.props", + "id": "def-public.CasesUiStart.getAllCasesSelectorModal.$1", "type": "Object", "tags": [], "label": "props", @@ -991,8 +1074,12 @@ } ], "path": "x-pack/plugins/cases/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A react component that is a modal for selecting a case" ] }, { @@ -1025,13 +1112,10 @@ ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, - "returnComment": [ - "A react component for viewing a specific case" - ], "children": [ { "parentPluginId": "cases", - "id": "def-public.props", + "id": "def-public.CasesUiStart.getCaseView.$1", "type": "Object", "tags": [], "label": "props", @@ -1048,8 +1132,12 @@ } ], "path": "x-pack/plugins/cases/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A react component for viewing a specific case" ] }, { @@ -1082,13 +1170,10 @@ ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, - "returnComment": [ - "A react component for configuring a specific case" - ], "children": [ { "parentPluginId": "cases", - "id": "def-public.props", + "id": "def-public.CasesUiStart.getConfigureCases.$1", "type": "Object", "tags": [], "label": "props", @@ -1105,8 +1190,12 @@ } ], "path": "x-pack/plugins/cases/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A react component for configuring a specific case" ] }, { @@ -1139,13 +1228,10 @@ ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, - "returnComment": [ - "A react component for creating a new case" - ], "children": [ { "parentPluginId": "cases", - "id": "def-public.props", + "id": "def-public.CasesUiStart.getCreateCase.$1", "type": "Object", "tags": [], "label": "props", @@ -1162,8 +1248,12 @@ } ], "path": "x-pack/plugins/cases/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A react component for creating a new case" ] }, { @@ -1196,13 +1286,10 @@ ], "path": "x-pack/plugins/cases/public/types.ts", "deprecated": false, - "returnComment": [ - "A react component for showing recent cases" - ], "children": [ { "parentPluginId": "cases", - "id": "def-public.props", + "id": "def-public.CasesUiStart.getRecentCases.$1", "type": "Object", "tags": [], "label": "props", @@ -1219,8 +1306,12 @@ } ], "path": "x-pack/plugins/cases/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A react component for showing recent cases" ] } ], @@ -3941,7 +4032,52 @@ "((caseId: string, caseConnectorId: string, subCaseId?: string | undefined) => void) | undefined" ], "path": "x-pack/plugins/cases/common/ui/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "cases", + "id": "def-common.UpdateByKey.fetchCaseUserActions.$1", + "type": "string", + "tags": [], + "label": "caseId", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/cases/common/ui/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "cases", + "id": "def-common.UpdateByKey.fetchCaseUserActions.$2", + "type": "string", + "tags": [], + "label": "caseConnectorId", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/cases/common/ui/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "cases", + "id": "def-common.UpdateByKey.fetchCaseUserActions.$3", + "type": "string", + "tags": [], + "label": "subCaseId", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "x-pack/plugins/cases/common/ui/types.ts", + "deprecated": false, + "isRequired": false + } + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -3962,7 +4098,30 @@ ") => void) | undefined" ], "path": "x-pack/plugins/cases/common/ui/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "cases", + "id": "def-common.UpdateByKey.updateCase.$1", + "type": "Object", + "tags": [], + "label": "newCase", + "description": [], + "signature": [ + { + "pluginId": "cases", + "scope": "common", + "docId": "kibCasesPluginApi", + "section": "def-common.Case", + "text": "Case" + } + ], + "path": "x-pack/plugins/cases/common/ui/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "cases", @@ -3994,7 +4153,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/cases/common/ui/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "cases", @@ -4007,7 +4168,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/cases/common/ui/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/cases.mdx b/api_docs/cases.mdx index 4358b94d4bf6f..f70eb15482103 100644 --- a/api_docs/cases.mdx +++ b/api_docs/cases.mdx @@ -18,7 +18,7 @@ Contact [Security Solution Threat Hunting](https://github.com/orgs/elastic/teams | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 451 | 0 | 409 | 14 | +| 459 | 0 | 417 | 14 | ## Client diff --git a/api_docs/charts.json b/api_docs/charts.json index ca9c53e55a0d3..177a63556d59b 100644 --- a/api_docs/charts.json +++ b/api_docs/charts.json @@ -1354,11 +1354,10 @@ ], "path": "src/plugins/charts/public/services/palettes/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "charts", - "id": "def-public.state", + "id": "def-public.PaletteDefinition.toExpression.$1", "type": "Uncategorized", "tags": [], "label": "state", @@ -1369,9 +1368,11 @@ "T | undefined" ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "charts", @@ -1403,11 +1404,10 @@ ], "path": "src/plugins/charts/public/services/palettes/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "charts", - "id": "def-public.series", + "id": "def-public.PaletteDefinition.getCategoricalColor.$1", "type": "Array", "tags": [], "label": "series", @@ -1425,11 +1425,12 @@ "[]" ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "charts", - "id": "def-public.chartConfiguration", + "id": "def-public.PaletteDefinition.getCategoricalColor.$2", "type": "Object", "tags": [], "label": "chartConfiguration", @@ -1445,11 +1446,12 @@ " | undefined" ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "charts", - "id": "def-public.state", + "id": "def-public.PaletteDefinition.getCategoricalColor.$3", "type": "Uncategorized", "tags": [], "label": "state", @@ -1460,9 +1462,11 @@ "T | undefined" ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "charts", @@ -1478,21 +1482,24 @@ ], "path": "src/plugins/charts/public/services/palettes/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "charts", - "id": "def-public.size", + "id": "def-public.PaletteDefinition.getCategoricalColors.$1", "type": "number", "tags": [], "label": "size", "description": [], + "signature": [ + "number" + ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "charts", - "id": "def-public.state", + "id": "def-public.PaletteDefinition.getCategoricalColors.$2", "type": "Uncategorized", "tags": [], "label": "state", @@ -1501,9 +1508,11 @@ "T | undefined" ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "charts", @@ -1533,7 +1542,70 @@ "((value: number | undefined, state: T, { min, max }: { min: number; max: number; }) => string | undefined) | undefined" ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "charts", + "id": "def-public.PaletteDefinition.getColorForValue.$1", + "type": "number", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "number | undefined" + ], + "path": "src/plugins/charts/public/services/palettes/types.ts", + "deprecated": false, + "isRequired": false + }, + { + "parentPluginId": "charts", + "id": "def-public.PaletteDefinition.getColorForValue.$2", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/charts/public/services/palettes/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "charts", + "id": "def-public.PaletteDefinition.getColorForValue.$3.minmax", + "type": "Object", + "tags": [], + "label": "{ min, max }", + "description": [], + "path": "src/plugins/charts/public/services/palettes/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "charts", + "id": "def-public.PaletteDefinition.getColorForValue.$3.minmax.min", + "type": "number", + "tags": [], + "label": "min", + "description": [], + "path": "src/plugins/charts/public/services/palettes/types.ts", + "deprecated": false + }, + { + "parentPluginId": "charts", + "id": "def-public.PaletteDefinition.getColorForValue.$3.minmax.max", + "type": "number", + "tags": [], + "label": "max", + "description": [], + "path": "src/plugins/charts/public/services/palettes/types.ts", + "deprecated": false + } + ] + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1627,19 +1699,23 @@ ], "path": "src/plugins/charts/public/services/palettes/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "charts", - "id": "def-public.name", + "id": "def-public.PaletteRegistry.get.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/charts/public/services/palettes/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "charts", @@ -1661,8 +1737,8 @@ ], "path": "src/plugins/charts/public/services/palettes/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/charts.mdx b/api_docs/charts.mdx index 5a8c7838f7d9a..55490f4c3d3c5 100644 --- a/api_docs/charts.mdx +++ b/api_docs/charts.mdx @@ -18,7 +18,7 @@ Contact [Kibana App](https://github.com/orgs/elastic/teams/kibana-app) for quest | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 190 | 2 | 159 | 1 | +| 195 | 2 | 164 | 1 | ## Client diff --git a/api_docs/core.json b/api_docs/core.json index 9ca4fa24806dd..eb40f8706ca4a 100644 --- a/api_docs/core.json +++ b/api_docs/core.json @@ -1453,8 +1453,8 @@ ], "path": "src/core/public/deprecations/deprecations_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -1472,19 +1472,23 @@ ], "path": "src/core/public/deprecations/deprecations_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.domainId", + "id": "def-public.DeprecationsServiceStart.getDeprecations.$1", "type": "string", "tags": [], "label": "domainId", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/deprecations/deprecations_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -1502,11 +1506,10 @@ ], "path": "src/core/public/deprecations/deprecations_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.details", + "id": "def-public.DeprecationsServiceStart.isDeprecationResolvable.$1", "type": "Object", "tags": [], "label": "details", @@ -1515,9 +1518,11 @@ "DomainDeprecationDetails" ], "path": "src/core/public/deprecations/deprecations_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -1543,11 +1548,10 @@ ], "path": "src/core/public/deprecations/deprecations_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.details", + "id": "def-public.DeprecationsServiceStart.resolveDeprecation.$1", "type": "Object", "tags": [], "label": "details", @@ -1556,9 +1560,11 @@ "DomainDeprecationDetails" ], "path": "src/core/public/deprecations/deprecations_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1784,11 +1790,10 @@ ], "path": "src/core/public/execution_context/execution_context_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.context", + "id": "def-public.ExecutionContextServiceStart.create.$1", "type": "Object", "tags": [], "label": "context", @@ -1797,9 +1802,11 @@ "KibanaExecutionContext" ], "path": "src/core/public/execution_context/execution_context_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1868,11 +1875,10 @@ ], "path": "src/core/public/fatal_errors/fatal_errors_service.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.error", + "id": "def-public.FatalErrorsSetup.add.$1", "type": "CompoundType", "tags": [], "label": "error", @@ -1883,11 +1889,12 @@ "string | Error" ], "path": "src/core/public/fatal_errors/fatal_errors_service.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-public.source", + "id": "def-public.FatalErrorsSetup.add.$2", "type": "string", "tags": [], "label": "source", @@ -1898,9 +1905,11 @@ "string | undefined" ], "path": "src/core/public/fatal_errors/fatal_errors_service.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -1926,8 +1935,8 @@ ], "path": "src/core/public/fatal_errors/fatal_errors_service.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1958,22 +1967,34 @@ ], "path": "src/core/public/i18n/i18n_service.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.__0", + "id": "def-public.I18nStart.Context.$1.children", "type": "Object", "tags": [], - "label": "__0", + "label": "{ children }", "description": [], - "signature": [ - "{ children: React.ReactNode; }" - ], "path": "src/core/public/i18n/i18n_service.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-public.I18nStart.Context.$1.children.children", + "type": "CompoundType", + "tags": [], + "label": "children", + "description": [], + "signature": [ + "string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | null | undefined" + ], + "path": "src/core/public/i18n/i18n_service.tsx", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -2000,8 +2021,8 @@ ], "path": "src/core/public/execution_context/execution_context_container.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -2017,8 +2038,8 @@ ], "path": "src/core/public/execution_context/execution_context_container.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -2106,21 +2127,24 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.get.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-public.defaultOverride", + "id": "def-public.IUiSettingsClient.get.$2", "type": "Uncategorized", "tags": [], "label": "defaultOverride", @@ -2129,9 +2153,11 @@ "T | undefined" ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2149,21 +2175,24 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.get$.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-public.defaultOverride", + "id": "def-public.IUiSettingsClient.get$.$2", "type": "Uncategorized", "tags": [], "label": "defaultOverride", @@ -2172,9 +2201,11 @@ "T | undefined" ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2194,8 +2225,8 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -2211,21 +2242,24 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.set.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-public.value", + "id": "def-public.IUiSettingsClient.set.$2", "type": "Any", "tags": [], "label": "value", @@ -2234,9 +2268,11 @@ "any" ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2252,19 +2288,23 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.remove.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2280,19 +2320,23 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.isDeclared.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2308,19 +2352,23 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.isDefault.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2336,19 +2384,23 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.isCustom.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2364,19 +2416,23 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.key", + "id": "def-public.IUiSettingsClient.isOverridden.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2394,8 +2450,8 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -2413,8 +2469,8 @@ ], "path": "src/core/public/ui_settings/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -3753,7 +3809,23 @@ } ], "path": "src/core/public/overlays/flyout/flyout_service.tsx", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.element", + "type": "Uncategorized", + "tags": [], + "label": "element", + "description": [], + "signature": [ + "T" + ], + "path": "src/core/public/types.ts", + "deprecated": false + } + ] }, { "parentPluginId": "core", @@ -3834,7 +3906,23 @@ } ], "path": "src/core/public/overlays/modal/modal_service.tsx", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.element", + "type": "Uncategorized", + "tags": [], + "label": "element", + "description": [], + "signature": [ + "T" + ], + "path": "src/core/public/types.ts", + "deprecated": false + } + ] }, { "parentPluginId": "core", @@ -6444,6 +6532,26 @@ ], "path": "src/core/public/types.ts", "deprecated": false, + "returnComment": [ + "a {@link UnmountCallback} that unmount the element on call." + ], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.element", + "type": "Uncategorized", + "tags": [], + "label": "element", + "description": [ + "the container element to render into" + ], + "signature": [ + "T" + ], + "path": "src/core/public/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -6484,6 +6592,29 @@ ], "path": "src/core/public/plugins/plugin.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.core", + "type": "Object", + "tags": [], + "label": "core", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.PluginInitializerContext", + "text": "PluginInitializerContext" + }, + "" + ], + "path": "src/core/public/plugins/plugin.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -6640,6 +6771,8 @@ ], "path": "src/core/public/index.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -7085,6 +7218,8 @@ ], "path": "src/core/public/types.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -7944,24 +8079,7 @@ "path": "src/core/server/elasticsearch/legacy/scoped_cluster_client.ts", "deprecated": true, "removeBy": "7.16", - "references": [ - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/types.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/types.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/target/types/server/types.d.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/target/types/server/types.d.ts" - } - ], + "references": [], "children": [ { "parentPluginId": "core", @@ -8150,121 +8268,8 @@ "path": "src/core/server/elasticsearch/legacy/scoped_cluster_client.ts", "deprecated": true, "removeBy": "7.16", - "references": [ - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/data_streams/register_delete_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_clear_cache_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_close_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_flush_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_forcemerge_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_list_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_open_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_refresh_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_reload_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_delete_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_freeze_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/indices/register_unfreeze_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/templates/register_get_routes.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/templates/register_get_routes.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/templates/register_delete_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/templates/register_create_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/templates/register_update_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/templates/register_simulate_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/mapping/register_mapping_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/settings/register_load_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/settings/register_update_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/stats/register_stats_route.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/component_templates/get.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/component_templates/get.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/component_templates/create.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/component_templates/update.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts" - } - ], - "children": [ + "references": [], + "children": [ { "parentPluginId": "core", "id": "def-server.LegacyScopedClusterClient.callAsCurrentUser.$1", @@ -10377,11 +10382,10 @@ ], "path": "src/core/server/deprecations/deprecations_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.deprecationContext", + "id": "def-server.DeprecationsServiceSetup.registerDeprecations.$1", "type": "Object", "tags": [], "label": "deprecationContext", @@ -10396,9 +10400,11 @@ } ], "path": "src/core/server/deprecations/deprecations_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -10607,23 +10613,26 @@ ], "path": "src/core/server/elasticsearch/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.type", + "id": "def-server.ElasticsearchServicePreboot.createClient.$1", "type": "string", "tags": [], "label": "type", "description": [ "Unique identifier of the client" ], + "signature": [ + "string" + ], "path": "src/core/server/elasticsearch/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.clientConfig", + "id": "def-server.ElasticsearchServicePreboot.createClient.$2", "type": "Object", "tags": [], "label": "clientConfig", @@ -10642,9 +10651,11 @@ "> | undefined" ], "path": "src/core/server/elasticsearch/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -10772,23 +10783,26 @@ ], "path": "src/core/server/elasticsearch/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.type", + "id": "def-server.ElasticsearchServiceStart.createClient.$1", "type": "string", "tags": [], "label": "type", "description": [ "Unique identifier of the client" ], + "signature": [ + "string" + ], "path": "src/core/server/elasticsearch/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.clientConfig", + "id": "def-server.ElasticsearchServiceStart.createClient.$2", "type": "Object", "tags": [], "label": "clientConfig", @@ -10807,9 +10821,11 @@ "> | undefined" ], "path": "src/core/server/elasticsearch/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -10860,10 +10876,6 @@ "path": "src/core/server/elasticsearch/types.ts", "deprecated": true, "references": [ - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/plugin.ts" - }, { "plugin": "globalSearch", "path": "x-pack/plugins/global_search/server/services/context.ts" @@ -11802,11 +11814,10 @@ ], "path": "src/core/server/http_resources/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.route", + "id": "def-server.HttpResources.register.$1", "type": "Object", "tags": [], "label": "route", @@ -11822,25 +11833,25 @@ "" ], "path": "src/core/server/http_resources/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.handler", + "id": "def-server.HttpResources.register.$2", "type": "Function", "tags": [], "label": "handler", "description": [], "signature": [ - "(context: Context, request: ", { "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" + "section": "def-server.RequestHandler", + "text": "RequestHandler" }, - ", response: { custom: | Error | { message: string | Error; attributes?: Record | undefined; } | Buffer | ", + " | Error | { message: string | Error; attributes?: Record | undefined; } | Buffer | ", "Stream", " | undefined>(options: ", { @@ -12022,28 +12033,14 @@ "section": "def-server.HttpResourcesServiceToolkit", "text": "HttpResourcesServiceToolkit" }, - ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - " | Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - ">" + ">" ], "path": "src/core/server/http_resources/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -12120,11 +12117,10 @@ ], "path": "src/core/server/http_resources/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.options", + "id": "def-server.HttpResourcesServiceToolkit.renderCoreApp.$1", "type": "Object", "tags": [], "label": "options", @@ -12140,9 +12136,11 @@ " | undefined" ], "path": "src/core/server/http_resources/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12174,11 +12172,10 @@ ], "path": "src/core/server/http_resources/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.options", + "id": "def-server.HttpResourcesServiceToolkit.renderAnonymousCoreApp.$1", "type": "Object", "tags": [], "label": "options", @@ -12194,9 +12191,11 @@ " | undefined" ], "path": "src/core/server/http_resources/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12228,11 +12227,10 @@ ], "path": "src/core/server/http_resources/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.options", + "id": "def-server.HttpResourcesServiceToolkit.renderHtml.$1", "type": "Object", "tags": [], "label": "options", @@ -12247,9 +12245,11 @@ } ], "path": "src/core/server/http_resources/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12281,11 +12281,10 @@ ], "path": "src/core/server/http_resources/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.options", + "id": "def-server.HttpResourcesServiceToolkit.renderJs.$1", "type": "Object", "tags": [], "label": "options", @@ -12300,9 +12299,11 @@ } ], "path": "src/core/server/http_resources/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -12420,44 +12421,29 @@ ], "path": "src/core/server/elasticsearch/client/cluster_client.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.request", + "id": "def-server.IClusterClient.asScoped.$1", "type": "CompoundType", "tags": [], "label": "request", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.LegacyRequest", - "text": "LegacyRequest" - }, - " | ", { "pluginId": "core", "scope": "server", "docId": "kibCorePluginApi", - "section": "def-server.FakeRequest", - "text": "FakeRequest" + "section": "def-server.ScopeableRequest", + "text": "ScopeableRequest" } ], "path": "src/core/server/elasticsearch/client/cluster_client.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -13310,8 +13296,8 @@ ], "path": "src/core/server/elasticsearch/client/cluster_client.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -13612,8 +13598,8 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -13629,19 +13615,23 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.key", + "id": "def-server.IUiSettingsClient.get.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13657,8 +13647,8 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -13676,8 +13666,8 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -13693,22 +13683,23 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.changes", + "id": "def-server.IUiSettingsClient.setMany.$1", "type": "Object", "tags": [], "label": "changes", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13724,21 +13715,24 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.key", + "id": "def-server.IUiSettingsClient.set.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.value", + "id": "def-server.IUiSettingsClient.set.$2", "type": "Any", "tags": [], "label": "value", @@ -13747,9 +13741,11 @@ "any" ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13765,19 +13761,23 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.key", + "id": "def-server.IUiSettingsClient.remove.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13793,11 +13793,10 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.keys", + "id": "def-server.IUiSettingsClient.removeMany.$1", "type": "Array", "tags": [], "label": "keys", @@ -13806,9 +13805,11 @@ "string[]" ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13824,19 +13825,23 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.key", + "id": "def-server.IUiSettingsClient.isOverridden.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13852,19 +13857,23 @@ ], "path": "src/core/server/ui_settings/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.key", + "id": "def-server.IUiSettingsClient.isSensitive.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/ui_settings/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -13992,25 +14001,8 @@ "path": "src/core/server/elasticsearch/legacy/api_types.ts", "deprecated": true, "removeBy": "7.16", - "references": [ - { - "plugin": "crossClusterReplication", - "path": "x-pack/plugins/cross_cluster_replication/server/plugin.ts" - }, - { - "plugin": "crossClusterReplication", - "path": "x-pack/plugins/cross_cluster_replication/server/plugin.ts" - }, - { - "plugin": "indexLifecycleManagement", - "path": "x-pack/plugins/index_lifecycle_management/server/plugin.ts" - }, - { - "plugin": "indexLifecycleManagement", - "path": "x-pack/plugins/index_lifecycle_management/server/plugin.ts" - } - ], - "children": [ + "references": [], + "children": [ { "parentPluginId": "core", "id": "def-server.LegacyAPICaller.Unnamed", @@ -16264,8 +16256,8 @@ ], "path": "src/core/server/metrics/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -17497,8 +17489,8 @@ ], "path": "src/core/server/preboot/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -17514,23 +17506,26 @@ ], "path": "src/core/server/preboot/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.reason", + "id": "def-server.PrebootServicePreboot.holdSetupUntilResolved.$1", "type": "string", "tags": [], "label": "reason", "description": [ "A string that explains the reason why this promise should hold `setup`. It's supposed to be a human\nreadable string that will be recorded in the logs or standard output." ], + "signature": [ + "string" + ], "path": "src/core/server/preboot/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.promise", + "id": "def-server.PrebootServicePreboot.holdSetupUntilResolved.$2", "type": "Object", "tags": [], "label": "promise", @@ -17541,9 +17536,11 @@ "Promise<{ shouldReloadConfig: boolean; } | undefined>" ], "path": "src/core/server/preboot/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -17586,11 +17583,10 @@ ], "path": "src/core/server/deprecations/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.context", + "id": "def-server.RegisterDeprecationsConfig.getDeprecations.$1", "type": "Object", "tags": [], "label": "context", @@ -17605,9 +17601,11 @@ } ], "path": "src/core/server/deprecations/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -18527,8 +18525,8 @@ ], "path": "src/core/server/status/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -18965,6 +18963,22 @@ ], "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.details", + "type": "Object", + "tags": [], + "label": "details", + "description": [], + "signature": [ + "DeprecatedConfigDetails" + ], + "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19021,6 +19035,8 @@ ], "path": "src/core/server/capabilities/types.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -19051,6 +19067,52 @@ ], "path": "src/core/server/capabilities/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/capabilities/types.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.uiCapabilities", + "type": "Object", + "tags": [], + "label": "uiCapabilities", + "description": [], + "signature": [ + "Capabilities" + ], + "path": "src/core/server/capabilities/types.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.useDefaultCapabilities", + "type": "boolean", + "tags": [], + "label": "useDefaultCapabilities", + "description": [], + "path": "src/core/server/capabilities/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19071,6 +19133,22 @@ ], "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.factory", + "type": "Object", + "tags": [], + "label": "factory", + "description": [], + "signature": [ + "ConfigDeprecationFactory" + ], + "path": "node_modules/@kbn/config/target/deprecation/types.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19332,6 +19410,35 @@ ], "path": "src/core/server/context/container/context.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "T" + ], + "path": "src/core/server/context/container/context.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.args", + "type": "Array", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "any[]" + ], + "path": "src/core/server/context/container/context.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19572,6 +19679,55 @@ ], "path": "src/core/server/http_resources/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19792,6 +19948,223 @@ ], "path": "src/core/server/context/container/context.ts", "deprecated": false, + "returnComment": [ + "The context value associated with this key. May also return a Promise which will be resolved before\nattaching to the context object." + ], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [ + "- A partial context object containing only the keys for values provided by plugin dependencies" + ], + "signature": [ + "{ [P in Exclude]: Context[P]; }" + ], + "path": "src/core/server/context/container/context.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.rest", + "type": "Object", + "tags": [], + "label": "rest", + "description": [ + "- Additional parameters provided by the service owner of this context" + ], + "signature": [ + "[request: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + ", response: { custom: | Error | { message: string | Error; attributes?: Record | undefined; } | Buffer | ", + "Stream", + " | undefined>(options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "; badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; ok: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; accepted: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; noContent: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "; }]" + ], + "path": "src/core/server/context/container/context.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19911,16 +20284,7 @@ "path": "src/core/server/elasticsearch/legacy/cluster_client.ts", "deprecated": true, "removeBy": "7.16", - "references": [ - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/plugin.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/plugin.ts" - } - ], + "references": [], "initialIsOpen": false }, { @@ -19957,18 +20321,6 @@ "deprecated": true, "removeBy": "7.16", "references": [ - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/types.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/types.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/server/types.ts" - }, { "plugin": "globalSearch", "path": "x-pack/plugins/global_search/server/types.ts" @@ -19984,18 +20336,6 @@ { "plugin": "globalSearch", "path": "x-pack/plugins/global_search/target/types/server/types.d.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/target/types/server/types.d.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/target/types/server/types.d.ts" - }, - { - "plugin": "indexManagement", - "path": "x-pack/plugins/index_management/target/types/server/types.d.ts" } ], "initialIsOpen": false @@ -20271,6 +20611,29 @@ ], "path": "src/core/server/plugins/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.core", + "type": "Object", + "tags": [], + "label": "core", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.PluginInitializerContext", + "text": "PluginInitializerContext" + }, + "" + ], + "path": "src/core/server/plugins/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -20457,6 +20820,8 @@ ], "path": "src/core/server/index.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { diff --git a/api_docs/core.mdx b/api_docs/core.mdx index 7dbeb6f4c05c1..7f97d7caea57f 100644 --- a/api_docs/core.mdx +++ b/api_docs/core.mdx @@ -18,7 +18,7 @@ import coreObj from './core.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2363 | 148 | 1081 | 31 | +| 2450 | 149 | 1165 | 31 | ## Client diff --git a/api_docs/core_application.json b/api_docs/core_application.json index 91b21b0669123..b5db33f2e6e5c 100644 --- a/api_docs/core_application.json +++ b/api_docs/core_application.json @@ -871,7 +871,9 @@ "(() => void) | undefined" ], "path": "src/core/public/application/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1495,31 +1497,29 @@ "path": "x-pack/plugins/maps/target/types/public/routes/map_page/map_app/map_app.d.ts" } ], - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.handler", + "id": "def-public.AppMountParameters.onAppLeave.$1", "type": "Function", "tags": [], "label": "handler", "description": [], "signature": [ - "(factory: ", - "AppLeaveActionFactory", - ", nextAppId?: string | undefined) => ", { "pluginId": "core", "scope": "public", "docId": "kibCoreApplicationPluginApi", - "section": "def-public.AppLeaveAction", - "text": "AppLeaveAction" + "section": "def-public.AppLeaveHandler", + "text": "AppLeaveHandler" } ], "path": "src/core/public/application/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -1543,11 +1543,10 @@ ], "path": "src/core/public/application/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.menuMount", + "id": "def-public.AppMountParameters.setHeaderActionMenu.$1", "type": "Function", "tags": [], "label": "menuMount", @@ -1563,9 +1562,11 @@ " | undefined" ], "path": "src/core/public/application/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1951,6 +1952,35 @@ "path": "x-pack/plugins/security_solution/public/app/app.tsx" } ], + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.factory", + "type": "Object", + "tags": [], + "label": "factory", + "description": [], + "signature": [ + "AppLeaveActionFactory" + ], + "path": "src/core/public/application/types.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-public.nextAppId", + "type": "string", + "tags": [], + "label": "nextAppId", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/core/public/application/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1991,6 +2021,31 @@ ], "path": "src/core/public/application/types.ts", "deprecated": false, + "returnComment": [ + "An unmounting function that will be called to unmount the application. See {@link AppUnmount}." + ], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "public", + "docId": "kibCoreApplicationPluginApi", + "section": "def-public.AppMountParameters", + "text": "AppMountParameters" + }, + "" + ], + "path": "src/core/public/application/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -2007,6 +2062,8 @@ ], "path": "src/core/public/application/types.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -2079,6 +2136,29 @@ ], "path": "src/core/public/application/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-public.app", + "type": "Object", + "tags": [], + "label": "app", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "public", + "docId": "kibCoreApplicationPluginApi", + "section": "def-public.App", + "text": "App" + }, + "" + ], + "path": "src/core/public/application/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/core_application.mdx b/api_docs/core_application.mdx index 9ce48ced2d738..9baa6247dc194 100644 --- a/api_docs/core_application.mdx +++ b/api_docs/core_application.mdx @@ -18,7 +18,7 @@ import coreApplicationObj from './core_application.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2363 | 148 | 1081 | 31 | +| 2450 | 149 | 1165 | 31 | ## Client diff --git a/api_docs/core_chrome.json b/api_docs/core_chrome.json index 873543cf4de41..dc1f3c7b89cc3 100644 --- a/api_docs/core_chrome.json +++ b/api_docs/core_chrome.json @@ -212,7 +212,24 @@ "((element: HTMLDivElement) => () => void) | undefined" ], "path": "src/core/public/chrome/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-public.ChromeHelpExtension.content.$1", + "type": "Object", + "tags": [], + "label": "element", + "description": [], + "signature": [ + "HTMLDivElement" + ], + "path": "src/core/public/chrome/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/core_chrome.mdx b/api_docs/core_chrome.mdx index d8c9cb76483c5..32be6b8894aa4 100644 --- a/api_docs/core_chrome.mdx +++ b/api_docs/core_chrome.mdx @@ -18,7 +18,7 @@ import coreChromeObj from './core_chrome.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2363 | 148 | 1081 | 31 | +| 2450 | 149 | 1165 | 31 | ## Client diff --git a/api_docs/core_http.json b/api_docs/core_http.json index 2c5b3b0dc2b1a..c4f2272ec1e1b 100644 --- a/api_docs/core_http.json +++ b/api_docs/core_http.json @@ -1592,8 +1592,8 @@ ], "path": "src/core/public/http/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -1609,19 +1609,23 @@ ], "path": "src/core/public/http/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.url", + "id": "def-public.IBasePath.prepend.$1", "type": "string", "tags": [], "label": "url", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -1637,19 +1641,23 @@ ], "path": "src/core/public/http/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-public.url", + "id": "def-public.IBasePath.remove.$1", "type": "string", "tags": [], "label": "url", "description": [], + "signature": [ + "string" + ], "path": "src/core/public/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2826,11 +2834,10 @@ ], "path": "src/core/server/http/lifecycle/auth.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.data", + "id": "def-server.AuthToolkit.authenticated.$1", "type": "Object", "tags": [], "label": "data", @@ -2846,9 +2853,11 @@ " | undefined" ], "path": "src/core/server/http/lifecycle/auth.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -2871,8 +2880,8 @@ ], "path": "src/core/server/http/lifecycle/auth.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -2895,11 +2904,10 @@ ], "path": "src/core/server/http/lifecycle/auth.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.headers", + "id": "def-server.AuthToolkit.redirected.$1", "type": "CompoundType", "tags": [], "label": "headers", @@ -2908,9 +2916,11 @@ "({ location: string; } & Record<\"accept\" | \"accept-language\" | \"accept-patch\" | \"accept-ranges\" | \"access-control-allow-credentials\" | \"access-control-allow-headers\" | \"access-control-allow-methods\" | \"access-control-allow-origin\" | \"access-control-expose-headers\" | \"access-control-max-age\" | \"access-control-request-headers\" | \"access-control-request-method\" | \"age\" | \"allow\" | \"alt-svc\" | \"authorization\" | \"cache-control\" | \"connection\" | \"content-disposition\" | \"content-encoding\" | \"content-language\" | \"content-length\" | \"content-location\" | \"content-range\" | \"content-type\" | \"cookie\" | \"date\" | \"expect\" | \"expires\" | \"forwarded\" | \"from\" | \"host\" | \"if-match\" | \"if-modified-since\" | \"if-none-match\" | \"if-unmodified-since\" | \"last-modified\" | \"location\" | \"origin\" | \"pragma\" | \"proxy-authenticate\" | \"proxy-authorization\" | \"public-key-pins\" | \"range\" | \"referer\" | \"retry-after\" | \"sec-websocket-accept\" | \"sec-websocket-extensions\" | \"sec-websocket-key\" | \"sec-websocket-protocol\" | \"sec-websocket-version\" | \"set-cookie\" | \"strict-transport-security\" | \"tk\" | \"trailer\" | \"transfer-encoding\" | \"upgrade\" | \"user-agent\" | \"vary\" | \"via\" | \"warning\" | \"www-authenticate\", string | string[]>) | ({ location: string; } & Record)" ], "path": "src/core/server/http/lifecycle/auth.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -3493,11 +3503,10 @@ ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.cookieOptions", + "id": "def-server.HttpServiceSetup.createCookieSessionStorageFactory.$1", "type": "Object", "tags": [], "label": "cookieOptions", @@ -3513,9 +3522,11 @@ "" ], "path": "src/core/server/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -3539,170 +3550,29 @@ ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.handler", + "id": "def-server.HttpServiceSetup.registerOnPreRouting.$1", "type": "Function", "tags": [], "label": "handler", "description": [], "signature": [ - "(request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ", response: { badRequest: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; unauthorized: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; forbidden: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; notFound: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; conflict: (options?: ", { "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; customError: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.CustomHttpResponseOptions", - "text": "CustomHttpResponseOptions" - }, - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">) => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; redirected: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.RedirectResponseOptions", - "text": "RedirectResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; }, toolkit: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreRoutingToolkit", - "text": "OnPreRoutingToolkit" - }, - ") => Next | RewriteUrl | ", - "KibanaResponse", - " | Promise>" + "section": "def-server.OnPreRoutingHandler", + "text": "OnPreRoutingHandler" + } ], "path": "src/core/server/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -3726,179 +3596,84 @@ ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.handler", + "id": "def-server.HttpServiceSetup.registerOnPreAuth.$1", "type": "Function", "tags": [], "label": "handler", "description": [], "signature": [ - "(request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ", response: { badRequest: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", { "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; unauthorized: (options?: ", + "section": "def-server.OnPreAuthHandler", + "text": "OnPreAuthHandler" + } + ], + "path": "src/core/server/http/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "core", + "id": "def-server.HttpServiceSetup.registerAuth", + "type": "Function", + "tags": [], + "label": "registerAuth", + "description": [ + "\nTo define custom authentication and/or authorization mechanism for incoming requests.\n" + ], + "signature": [ + "(handler: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.AuthenticationHandler", + "text": "AuthenticationHandler" + }, + ") => void" + ], + "path": "src/core/server/http/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.HttpServiceSetup.registerAuth.$1", + "type": "Function", + "tags": [], + "label": "handler", + "description": [], + "signature": [ { "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; forbidden: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; notFound: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; conflict: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; customError: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.CustomHttpResponseOptions", - "text": "CustomHttpResponseOptions" - }, - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">) => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; redirected: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.RedirectResponseOptions", - "text": "RedirectResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; }, toolkit: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreAuthToolkit", - "text": "OnPreAuthToolkit" - }, - ") => ", - "KibanaResponse", - " | Next | Promise<", - "KibanaResponse", - " | Next>" + "section": "def-server.AuthenticationHandler", + "text": "AuthenticationHandler" + } ], "path": "src/core/server/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", - "id": "def-server.HttpServiceSetup.registerAuth", + "id": "def-server.HttpServiceSetup.registerOnPostAuth", "type": "Function", "tags": [], - "label": "registerAuth", + "label": "registerOnPostAuth", "description": [ - "\nTo define custom authentication and/or authorization mechanism for incoming requests.\n" + "\nTo define custom logic after Auth interceptor did make sure a user has access to the requested resource.\n" ], "signature": [ "(handler: ", @@ -3906,487 +3681,82 @@ "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.AuthenticationHandler", - "text": "AuthenticationHandler" + "section": "def-server.OnPostAuthHandler", + "text": "OnPostAuthHandler" }, ") => void" ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.handler", + "id": "def-server.HttpServiceSetup.registerOnPostAuth.$1", "type": "Function", "tags": [], "label": "handler", "description": [], "signature": [ - "(request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ", response: { badRequest: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; unauthorized: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; forbidden: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; notFound: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; conflict: (options?: ", { "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", + "section": "def-server.OnPostAuthHandler", + "text": "OnPostAuthHandler" + } + ], + "path": "src/core/server/http/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "core", + "id": "def-server.HttpServiceSetup.registerOnPreResponse", + "type": "Function", + "tags": [], + "label": "registerOnPreResponse", + "description": [ + "\nTo define custom logic to perform for the server response.\n" + ], + "signature": [ + "(handler: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreResponseHandler", + "text": "OnPreResponseHandler" + }, + ") => void" + ], + "path": "src/core/server/http/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.HttpServiceSetup.registerOnPreResponse.$1", + "type": "Function", + "tags": [], + "label": "handler", + "description": [], + "signature": [ { "pluginId": "core", "scope": "server", "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; customError: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.CustomHttpResponseOptions", - "text": "CustomHttpResponseOptions" - }, - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">) => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; redirected: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.RedirectResponseOptions", - "text": "RedirectResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; }, toolkit: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.AuthToolkit", - "text": "AuthToolkit" - }, - ") => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.Authenticated", - "text": "Authenticated" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.AuthNotHandled", - "text": "AuthNotHandled" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.AuthRedirected", - "text": "AuthRedirected" - }, - " | Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.IKibanaResponse", - "text": "IKibanaResponse" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.Authenticated", - "text": "Authenticated" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.AuthNotHandled", - "text": "AuthNotHandled" - }, - " | ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.AuthRedirected", - "text": "AuthRedirected" - }, - ">" - ], - "path": "src/core/server/http/types.ts", - "deprecated": false - } - ] - }, - { - "parentPluginId": "core", - "id": "def-server.HttpServiceSetup.registerOnPostAuth", - "type": "Function", - "tags": [], - "label": "registerOnPostAuth", - "description": [ - "\nTo define custom logic after Auth interceptor did make sure a user has access to the requested resource.\n" - ], - "signature": [ - "(handler: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPostAuthHandler", - "text": "OnPostAuthHandler" - }, - ") => void" - ], - "path": "src/core/server/http/types.ts", - "deprecated": false, - "returnComment": [], - "children": [ - { - "parentPluginId": "core", - "id": "def-server.handler", - "type": "Function", - "tags": [], - "label": "handler", - "description": [], - "signature": [ - "(request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ", response: { badRequest: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; unauthorized: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; forbidden: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; notFound: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; conflict: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; customError: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.CustomHttpResponseOptions", - "text": "CustomHttpResponseOptions" - }, - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">) => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; redirected: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.RedirectResponseOptions", - "text": "RedirectResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; }, toolkit: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPostAuthToolkit", - "text": "OnPostAuthToolkit" - }, - ") => ", - "KibanaResponse", - " | Next | Promise<", - "KibanaResponse", - " | Next>" - ], - "path": "src/core/server/http/types.ts", - "deprecated": false - } - ] - }, - { - "parentPluginId": "core", - "id": "def-server.HttpServiceSetup.registerOnPreResponse", - "type": "Function", - "tags": [], - "label": "registerOnPreResponse", - "description": [ - "\nTo define custom logic to perform for the server response.\n" - ], - "signature": [ - "(handler: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreResponseHandler", - "text": "OnPreResponseHandler" - }, - ") => void" - ], - "path": "src/core/server/http/types.ts", - "deprecated": false, - "returnComment": [], - "children": [ - { - "parentPluginId": "core", - "id": "def-server.handler", - "type": "Function", - "tags": [], - "label": "handler", - "description": [], - "signature": [ - "(request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ", preResponse: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreResponseInfo", - "text": "OnPreResponseInfo" - }, - ", toolkit: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreResponseToolkit", - "text": "OnPreResponseToolkit" - }, - ") => Render | Next | Promise" + "section": "def-server.OnPreResponseHandler", + "text": "OnPreResponseHandler" + } ], "path": "src/core/server/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -4518,8 +3888,8 @@ ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -4554,221 +3924,48 @@ "docId": "kibCorePluginApi", "section": "def-server.IContextContainer", "text": "IContextContainer" - } - ], - "path": "src/core/server/http/types.ts", - "deprecated": false, - "returnComment": [], - "children": [ - { - "parentPluginId": "core", - "id": "def-server.contextName", - "type": "Uncategorized", - "tags": [], - "label": "contextName", - "description": [], - "signature": [ - "ContextName" - ], - "path": "src/core/server/http/types.ts", - "deprecated": false - }, - { - "parentPluginId": "core", - "id": "def-server.provider", - "type": "Function", - "tags": [], - "label": "provider", - "description": [], - "signature": [ - "(context: Pick>, request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ", response: { custom: | Error | { message: string | Error; attributes?: Record | undefined; } | Buffer | ", - "Stream", - " | undefined>(options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.CustomHttpResponseOptions", - "text": "CustomHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "; badRequest: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; unauthorized: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; forbidden: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; notFound: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; conflict: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ErrorHttpResponseOptions", - "text": "ErrorHttpResponseOptions" - }, - ") => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; customError: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.CustomHttpResponseOptions", - "text": "CustomHttpResponseOptions" - }, - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">) => ", - "KibanaResponse", - "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.ResponseError", - "text": "ResponseError" - }, - ">; redirected: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.RedirectResponseOptions", - "text": "RedirectResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; ok: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.HttpResponseOptions", - "text": "HttpResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; accepted: (options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.HttpResponseOptions", - "text": "HttpResponseOptions" - }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; noContent: (options?: ", + } + ], + "path": "src/core/server/http/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.HttpServiceSetup.registerRouteHandlerContext.$1", + "type": "Uncategorized", + "tags": [], + "label": "contextName", + "description": [], + "signature": [ + "ContextName" + ], + "path": "src/core/server/http/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "core", + "id": "def-server.HttpServiceSetup.registerRouteHandlerContext.$2", + "type": "Function", + "tags": [], + "label": "provider", + "description": [], + "signature": [ { "pluginId": "core", "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.HttpResponseOptions", - "text": "HttpResponseOptions" + "docId": "kibCorePluginApi", + "section": "def-server.IContextProvider", + "text": "IContextProvider" }, - ") => ", - "KibanaResponse", - "; }) => Context[ContextName] | Promise" + "" ], "path": "src/core/server/http/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -4791,8 +3988,8 @@ ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -4896,8 +4093,8 @@ ], "path": "src/core/server/http/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -5678,7 +4875,56 @@ ">" ], "path": "src/core/server/http/router/router.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] } ] }, @@ -6117,7 +5363,56 @@ ">" ], "path": "src/core/server/http/router/router.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] } ] }, @@ -6556,7 +5851,56 @@ ">" ], "path": "src/core/server/http/router/router.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] } ] }, @@ -6995,7 +6339,56 @@ ">" ], "path": "src/core/server/http/router/router.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] } ] }, @@ -7434,7 +6827,56 @@ ">" ], "path": "src/core/server/http/router/router.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] } ] }, @@ -7877,7 +7319,56 @@ ">" ], "path": "src/core/server/http/router/router.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] } ] } @@ -8075,8 +7566,8 @@ ], "path": "src/core/server/http/lifecycle/on_post_auth.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -8105,8 +7596,8 @@ ], "path": "src/core/server/http/lifecycle/on_pre_auth.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -8242,11 +7733,10 @@ ], "path": "src/core/server/http/lifecycle/on_pre_response.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.responseRender", + "id": "def-server.OnPreResponseToolkit.render.$1", "type": "Object", "tags": [], "label": "responseRender", @@ -8261,9 +7751,11 @@ } ], "path": "src/core/server/http/lifecycle/on_pre_response.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -8287,11 +7779,10 @@ ], "path": "src/core/server/http/lifecycle/on_pre_response.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.responseExtensions", + "id": "def-server.OnPreResponseToolkit.next.$1", "type": "Object", "tags": [], "label": "responseExtensions", @@ -8307,9 +7798,11 @@ " | undefined" ], "path": "src/core/server/http/lifecycle/on_pre_response.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -8338,8 +7831,8 @@ ], "path": "src/core/server/http/lifecycle/on_pre_routing.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -8355,19 +7848,23 @@ ], "path": "src/core/server/http/lifecycle/on_pre_routing.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.url", + "id": "def-server.OnPreRoutingToolkit.rewriteUrl.$1", "type": "string", "tags": [], "label": "url", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/http/lifecycle/on_pre_routing.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -8685,11 +8182,10 @@ ], "path": "src/core/server/http/router/validator/validator.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.value", + "id": "def-server.RouteValidationResultFactory.ok.$1", "type": "Uncategorized", "tags": [], "label": "value", @@ -8698,9 +8194,11 @@ "T" ], "path": "src/core/server/http/router/validator/validator.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -8722,11 +8220,10 @@ ], "path": "src/core/server/http/router/validator/validator.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.error", + "id": "def-server.RouteValidationResultFactory.badRequest.$1", "type": "CompoundType", "tags": [], "label": "error", @@ -8735,11 +8232,12 @@ "string | Error" ], "path": "src/core/server/http/router/validator/validator.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.path", + "id": "def-server.RouteValidationResultFactory.badRequest.$2", "type": "Array", "tags": [], "label": "path", @@ -8748,9 +8246,11 @@ "string[] | undefined" ], "path": "src/core/server/http/router/validator/validator.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -9090,11 +8590,10 @@ ], "path": "src/core/server/http/cookie_session_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.sessionValue", + "id": "def-server.SessionStorageCookieOptions.validate.$1", "type": "CompoundType", "tags": [], "label": "sessionValue", @@ -9103,9 +8602,11 @@ "T | T[]" ], "path": "src/core/server/http/cookie_session_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -9187,11 +8688,10 @@ ], "path": "src/core/server/http/session_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.request", + "id": "def-server.SessionStorageFactory.asScoped.$1", "type": "Object", "tags": [], "label": "request", @@ -9207,9 +8707,11 @@ "" ], "path": "src/core/server/http/session_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -9464,6 +8966,189 @@ ], "path": "src/core/server/http/lifecycle/auth.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/lifecycle/auth.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Object", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "{ badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; }" + ], + "path": "src/core/server/http/lifecycle/auth.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.toolkit", + "type": "Object", + "tags": [], + "label": "toolkit", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.AuthToolkit", + "text": "AuthToolkit" + } + ], + "path": "src/core/server/http/lifecycle/auth.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -9566,6 +9251,38 @@ ], "path": "src/core/server/http/auth_headers_storage.ts", "deprecated": false, + "returnComment": [ + "authentication headers {@link AuthHeaders} for - an incoming request." + ], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "CompoundType", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + " | ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.LegacyRequest", + "text": "LegacyRequest" + } + ], + "path": "src/core/server/http/auth_headers_storage.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -9606,6 +9323,36 @@ ], "path": "src/core/server/http/auth_state_storage.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "CompoundType", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + " | ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.LegacyRequest", + "text": "LegacyRequest" + } + ], + "path": "src/core/server/http/auth_state_storage.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -9718,8 +9465,38 @@ }, ") => boolean" ], - "path": "src/core/server/http/auth_state_storage.ts", - "deprecated": false, + "path": "src/core/server/http/auth_state_storage.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "CompoundType", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + " | ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.LegacyRequest", + "text": "LegacyRequest" + } + ], + "path": "src/core/server/http/auth_state_storage.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10274,6 +10051,189 @@ ], "path": "src/core/server/http/lifecycle/on_post_auth.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/lifecycle/on_post_auth.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Object", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "{ badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; }" + ], + "path": "src/core/server/http/lifecycle/on_post_auth.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.toolkit", + "type": "Object", + "tags": [], + "label": "toolkit", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPostAuthToolkit", + "text": "OnPostAuthToolkit" + } + ], + "path": "src/core/server/http/lifecycle/on_post_auth.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10418,26 +10378,209 @@ "section": "def-server.RedirectResponseOptions", "text": "RedirectResponseOptions" }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; }, toolkit: ", + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; }, toolkit: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreAuthToolkit", + "text": "OnPreAuthToolkit" + }, + ") => ", + "KibanaResponse", + " | Next | Promise<", + "KibanaResponse", + " | Next>" + ], + "path": "src/core/server/http/lifecycle/on_pre_auth.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/lifecycle/on_pre_auth.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Object", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "{ badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; }" + ], + "path": "src/core/server/http/lifecycle/on_pre_auth.ts", + "deprecated": false + }, { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreAuthToolkit", - "text": "OnPreAuthToolkit" - }, - ") => ", - "KibanaResponse", - " | Next | Promise<", - "KibanaResponse", - " | Next>" + "parentPluginId": "core", + "id": "def-server.toolkit", + "type": "Object", + "tags": [], + "label": "toolkit", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreAuthToolkit", + "text": "OnPreAuthToolkit" + } + ], + "path": "src/core/server/http/lifecycle/on_pre_auth.ts", + "deprecated": false + } ], - "path": "src/core/server/http/lifecycle/on_pre_auth.ts", - "deprecated": false, "initialIsOpen": false }, { @@ -10478,6 +10621,67 @@ ], "path": "src/core/server/http/lifecycle/on_pre_response.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/lifecycle/on_pre_response.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.preResponse", + "type": "Object", + "tags": [], + "label": "preResponse", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreResponseInfo", + "text": "OnPreResponseInfo" + } + ], + "path": "src/core/server/http/lifecycle/on_pre_response.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.toolkit", + "type": "Object", + "tags": [], + "label": "toolkit", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreResponseToolkit", + "text": "OnPreResponseToolkit" + } + ], + "path": "src/core/server/http/lifecycle/on_pre_response.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10622,26 +10826,209 @@ "section": "def-server.RedirectResponseOptions", "text": "RedirectResponseOptions" }, - ") => ", - "KibanaResponse", - " | Buffer | ", - "Stream", - ">; }, toolkit: ", + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; }, toolkit: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreRoutingToolkit", + "text": "OnPreRoutingToolkit" + }, + ") => Next | RewriteUrl | ", + "KibanaResponse", + " | Promise>" + ], + "path": "src/core/server/http/lifecycle/on_pre_routing.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/lifecycle/on_pre_routing.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Object", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "{ badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; }" + ], + "path": "src/core/server/http/lifecycle/on_pre_routing.ts", + "deprecated": false + }, { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.OnPreRoutingToolkit", - "text": "OnPreRoutingToolkit" - }, - ") => Next | RewriteUrl | ", - "KibanaResponse", - " | Promise>" + "parentPluginId": "core", + "id": "def-server.toolkit", + "type": "Object", + "tags": [], + "label": "toolkit", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.OnPreRoutingToolkit", + "text": "OnPreRoutingToolkit" + } + ], + "path": "src/core/server/http/lifecycle/on_pre_routing.ts", + "deprecated": false + } ], - "path": "src/core/server/http/lifecycle/on_pre_routing.ts", - "deprecated": false, "initialIsOpen": false }, { @@ -10705,6 +11092,55 @@ ], "path": "src/core/server/http/router/router.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10923,8 +11359,219 @@ "KibanaResponse", "; }) => Context[ContextName] | Promise" ], - "path": "src/core/server/http/types.ts", - "deprecated": false, + "path": "src/core/server/http/types.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "{ [P in Exclude]: Context[P]; }" + ], + "path": "src/core/server/context/container/context.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.rest", + "type": "Object", + "tags": [], + "label": "rest", + "description": [], + "signature": [ + "[request: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + ", response: { custom: | Error | { message: string | Error; attributes?: Record | undefined; } | Buffer | ", + "Stream", + " | undefined>(options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "; badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; ok: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; accepted: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; noContent: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "; }]" + ], + "path": "src/core/server/context/container/context.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -11329,6 +11976,95 @@ ], "path": "src/core/server/http/router/router.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.handler", + "type": "Function", + "tags": [], + "label": "handler", + "description": [], + "signature": [ + "(context: Context, request: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + ", response: ResponseFactory) => ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.IKibanaResponse", + "text": "IKibanaResponse" + }, + " | Promise<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.IKibanaResponse", + "text": "IKibanaResponse" + }, + ">" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] + } + ], "initialIsOpen": false }, { @@ -11613,8 +12349,291 @@ "KibanaResponse", "; }>) => void" ], - "path": "src/core/server/http/router/router.ts", - "deprecated": false, + "path": "src/core/server/http/router/router.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.route", + "type": "Object", + "tags": [], + "label": "route", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RouteConfig", + "text": "RouteConfig" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.handler", + "type": "Function", + "tags": [], + "label": "handler", + "description": [], + "signature": [ + "(context: Context, request: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + ", response: { custom: | Error | { message: string | Error; attributes?: Record | undefined; } | Buffer | ", + "Stream", + " | undefined>(options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "; badRequest: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; unauthorized: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; forbidden: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; notFound: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; conflict: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ErrorHttpResponseOptions", + "text": "ErrorHttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; customError: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.CustomHttpResponseOptions", + "text": "CustomHttpResponseOptions" + }, + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">) => ", + "KibanaResponse", + "<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.ResponseError", + "text": "ResponseError" + }, + ">; redirected: (options: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RedirectResponseOptions", + "text": "RedirectResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; ok: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; accepted: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + " | Buffer | ", + "Stream", + ">; noContent: (options?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.HttpResponseOptions", + "text": "HttpResponseOptions" + }, + ") => ", + "KibanaResponse", + "; }) => ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.IKibanaResponse", + "text": "IKibanaResponse" + }, + " | Promise<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.IKibanaResponse", + "text": "IKibanaResponse" + }, + ">" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Uncategorized", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "Context" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.response", + "type": "Uncategorized", + "tags": [], + "label": "response", + "description": [], + "signature": [ + "ResponseFactory" + ], + "path": "src/core/server/http/router/router.ts", + "deprecated": false + } + ] + } + ], "initialIsOpen": false }, { @@ -11647,6 +12666,41 @@ ], "path": "src/core/server/http/router/validator/validator.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.data", + "type": "Any", + "tags": [], + "label": "data", + "description": [], + "signature": [ + "any" + ], + "path": "src/core/server/http/router/validator/validator.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.validationResult", + "type": "Object", + "tags": [], + "label": "validationResult", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.RouteValidationResultFactory", + "text": "RouteValidationResultFactory" + } + ], + "path": "src/core/server/http/router/validator/validator.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/core_http.mdx b/api_docs/core_http.mdx index 99f0cdfbd708e..dabbf58dc339f 100644 --- a/api_docs/core_http.mdx +++ b/api_docs/core_http.mdx @@ -18,7 +18,7 @@ import coreHttpObj from './core_http.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2363 | 148 | 1081 | 31 | +| 2450 | 149 | 1165 | 31 | ## Client diff --git a/api_docs/core_saved_objects.json b/api_docs/core_saved_objects.json index e5f0119c2efc5..1712e35614408 100644 --- a/api_docs/core_saved_objects.json +++ b/api_docs/core_saved_objects.json @@ -9107,8 +9107,8 @@ ], "path": "src/core/server/saved_objects/service/lib/point_in_time_finder.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -9124,8 +9124,8 @@ ], "path": "src/core/server/saved_objects/service/lib/point_in_time_finder.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -12748,19 +12748,23 @@ ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.msg", + "id": "def-server.SavedObjectsMigrationLogger.debug.$1", "type": "string", "tags": [], "label": "msg", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12774,19 +12778,23 @@ ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.msg", + "id": "def-server.SavedObjectsMigrationLogger.info.$1", "type": "string", "tags": [], "label": "msg", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12820,19 +12828,23 @@ "path": "x-pack/plugins/lens/server/migrations/saved_object_migrations.ts" } ], - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.msg", + "id": "def-server.SavedObjectsMigrationLogger.warning.$1", "type": "string", "tags": [], "label": "msg", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12846,19 +12858,23 @@ ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.msg", + "id": "def-server.SavedObjectsMigrationLogger.warn.$1", "type": "string", "tags": [], "label": "msg", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -12876,21 +12892,24 @@ ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.msg", + "id": "def-server.SavedObjectsMigrationLogger.error.$1", "type": "string", "tags": [], "label": "msg", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.meta", + "id": "def-server.SavedObjectsMigrationLogger.error.$2", "type": "Uncategorized", "tags": [], "label": "meta", @@ -12899,9 +12918,11 @@ "Meta" ], "path": "src/core/server/saved_objects/migrations/core/migration_logger.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -13254,11 +13275,10 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.req", + "id": "def-server.SavedObjectsRepositoryFactory.createScopedRepository.$1", "type": "Object", "tags": [], "label": "req", @@ -13274,11 +13294,12 @@ "" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.includedHiddenTypes", + "id": "def-server.SavedObjectsRepositoryFactory.createScopedRepository.$2", "type": "Array", "tags": [], "label": "includedHiddenTypes", @@ -13289,9 +13310,11 @@ "string[] | undefined" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13315,11 +13338,10 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.includedHiddenTypes", + "id": "def-server.SavedObjectsRepositoryFactory.createInternalRepository.$1", "type": "Array", "tags": [], "label": "includedHiddenTypes", @@ -13330,9 +13352,11 @@ "string[] | undefined" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -13521,37 +13545,29 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.clientFactoryProvider", + "id": "def-server.SavedObjectsServiceSetup.setClientFactoryProvider.$1", "type": "Function", "tags": [], "label": "clientFactoryProvider", "description": [], "signature": [ - "(repositoryFactory: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsRepositoryFactory", - "text": "SavedObjectsRepositoryFactory" - }, - ") => ", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsClientFactory", - "text": "SavedObjectsClientFactory" + "section": "def-server.SavedObjectsClientFactoryProvider", + "text": "SavedObjectsClientFactoryProvider" } ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13575,58 +13591,57 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.priority", + "id": "def-server.SavedObjectsServiceSetup.addClientWrapper.$1", "type": "number", "tags": [], "label": "priority", "description": [], + "signature": [ + "number" + ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.id", + "id": "def-server.SavedObjectsServiceSetup.addClientWrapper.$2", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.factory", + "id": "def-server.SavedObjectsServiceSetup.addClientWrapper.$3", "type": "Function", "tags": [], "label": "factory", "description": [], "signature": [ - "(options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsClientWrapperOptions", - "text": "SavedObjectsClientWrapperOptions" - }, - ") => Pick<", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsClient", - "text": "SavedObjectsClient" - }, - ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"collectMultiNamespaceReferences\" | \"updateObjectsSpaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" + "section": "def-server.SavedObjectsClientWrapperFactory", + "text": "SavedObjectsClientWrapperFactory" + } ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13650,11 +13665,10 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.type", + "id": "def-server.SavedObjectsServiceSetup.registerType.$1", "type": "Object", "tags": [], "label": "type", @@ -13670,9 +13684,11 @@ "" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -13727,11 +13743,10 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.req", + "id": "def-server.SavedObjectsServiceStart.getScopedClient.$1", "type": "Object", "tags": [], "label": "req", @@ -13747,11 +13762,12 @@ "" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.options", + "id": "def-server.SavedObjectsServiceStart.getScopedClient.$2", "type": "Object", "tags": [], "label": "options", @@ -13767,9 +13783,11 @@ " | undefined" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13801,11 +13819,10 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.req", + "id": "def-server.SavedObjectsServiceStart.createScopedRepository.$1", "type": "Object", "tags": [], "label": "req", @@ -13823,11 +13840,12 @@ "" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "core", - "id": "def-server.includedHiddenTypes", + "id": "def-server.SavedObjectsServiceStart.createScopedRepository.$2", "type": "Array", "tags": [], "label": "includedHiddenTypes", @@ -13838,9 +13856,11 @@ "string[] | undefined" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13864,11 +13884,10 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.includedHiddenTypes", + "id": "def-server.SavedObjectsServiceStart.createInternalRepository.$1", "type": "Array", "tags": [], "label": "includedHiddenTypes", @@ -13879,9 +13898,11 @@ "string[] | undefined" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -13904,8 +13925,8 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "core", @@ -13937,669 +13958,87 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "core", - "id": "def-server.client", + "id": "def-server.SavedObjectsServiceStart.createExporter.$1", "type": "Object", "tags": [], "label": "client", "description": [], "signature": [ - "{ get: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - "SavedObject", - ">; delete: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsDeleteOptions", - "text": "SavedObjectsDeleteOptions" - }, - ") => Promise<{}>; create: (type: string, attributes: T, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCreateOptions", - "text": "SavedObjectsCreateOptions" - }, - " | undefined) => Promise<", - "SavedObject", - ">; bulkCreate: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkCreateObject", - "text": "SavedObjectsBulkCreateObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCreateOptions", - "text": "SavedObjectsCreateOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkResponse", - "text": "SavedObjectsBulkResponse" - }, - ">; checkConflicts: (objects?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCheckConflictsObject", - "text": "SavedObjectsCheckConflictsObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCheckConflictsResponse", - "text": "SavedObjectsCheckConflictsResponse" - }, - ">; find: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindOptions", - "text": "SavedObjectsFindOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindResponse", - "text": "SavedObjectsFindResponse" - }, - ">; bulkGet: (objects?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkGetObject", - "text": "SavedObjectsBulkGetObject" - }, - "[], options?: ", + "Pick<", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" + "section": "def-server.SavedObjectsClient", + "text": "SavedObjectsClient" }, - ") => Promise<", + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"collectMultiNamespaceReferences\" | \"updateObjectsSpaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" + ], + "path": "src/core/server/saved_objects/saved_objects_service.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "core", + "id": "def-server.SavedObjectsServiceStart.createImporter", + "type": "Function", + "tags": [], + "label": "createImporter", + "description": [ + "\nCreates an {@link ISavedObjectsImporter | importer} bound to given client." + ], + "signature": [ + "(client: Pick<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsClient", + "text": "SavedObjectsClient" + }, + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"collectMultiNamespaceReferences\" | \"updateObjectsSpaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => Pick<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsImporter", + "text": "SavedObjectsImporter" + }, + ", \"import\" | \"resolveImportErrors\">" + ], + "path": "src/core/server/saved_objects/saved_objects_service.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.SavedObjectsServiceStart.createImporter.$1", + "type": "Object", + "tags": [], + "label": "client", + "description": [], + "signature": [ + "Pick<", { "pluginId": "core", "scope": "server", "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkResponse", - "text": "SavedObjectsBulkResponse" + "section": "def-server.SavedObjectsClient", + "text": "SavedObjectsClient" }, - ">; resolve: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsResolveResponse", - "text": "SavedObjectsResolveResponse" - }, - ">; update: (type: string, id: string, attributes: Partial, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateOptions", - "text": "SavedObjectsUpdateOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateResponse", - "text": "SavedObjectsUpdateResponse" - }, - ">; collectMultiNamespaceReferences: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCollectMultiNamespaceReferencesObject", - "text": "SavedObjectsCollectMultiNamespaceReferencesObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCollectMultiNamespaceReferencesOptions", - "text": "SavedObjectsCollectMultiNamespaceReferencesOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCollectMultiNamespaceReferencesResponse", - "text": "SavedObjectsCollectMultiNamespaceReferencesResponse" - }, - ">; updateObjectsSpaces: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateObjectsSpacesObject", - "text": "SavedObjectsUpdateObjectsSpacesObject" - }, - "[], spacesToAdd: string[], spacesToRemove: string[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateObjectsSpacesOptions", - "text": "SavedObjectsUpdateObjectsSpacesOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateObjectsSpacesResponse", - "text": "SavedObjectsUpdateObjectsSpacesResponse" - }, - ">; bulkUpdate: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkUpdateObject", - "text": "SavedObjectsBulkUpdateObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkUpdateOptions", - "text": "SavedObjectsBulkUpdateOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkUpdateResponse", - "text": "SavedObjectsBulkUpdateResponse" - }, - ">; removeReferencesTo: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsRemoveReferencesToOptions", - "text": "SavedObjectsRemoveReferencesToOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsRemoveReferencesToResponse", - "text": "SavedObjectsRemoveReferencesToResponse" - }, - ">; openPointInTimeForType: (type: string | string[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsOpenPointInTimeOptions", - "text": "SavedObjectsOpenPointInTimeOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsOpenPointInTimeResponse", - "text": "SavedObjectsOpenPointInTimeResponse" - }, - ">; closePointInTime: (id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsClosePointInTimeResponse", - "text": "SavedObjectsClosePointInTimeResponse" - }, - ">; createPointInTimeFinder: (findOptions: Pick<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindOptions", - "text": "SavedObjectsFindOptions" - }, - ", \"type\" | \"filter\" | \"aggs\" | \"fields\" | \"perPage\" | \"sortField\" | \"sortOrder\" | \"search\" | \"searchFields\" | \"rootSearchFields\" | \"hasReference\" | \"hasReferenceOperator\" | \"defaultSearchOperator\" | \"namespaces\" | \"typeToNamespacesMap\" | \"preference\">, dependencies?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCreatePointInTimeFinderDependencies", - "text": "SavedObjectsCreatePointInTimeFinderDependencies" - }, - " | undefined) => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.ISavedObjectsPointInTimeFinder", - "text": "ISavedObjectsPointInTimeFinder" - }, - "; errors: typeof ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsErrorHelpers", - "text": "SavedObjectsErrorHelpers" - }, - "; }" - ], - "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false - } - ] - }, - { - "parentPluginId": "core", - "id": "def-server.SavedObjectsServiceStart.createImporter", - "type": "Function", - "tags": [], - "label": "createImporter", - "description": [ - "\nCreates an {@link ISavedObjectsImporter | importer} bound to given client." - ], - "signature": [ - "(client: Pick<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsClient", - "text": "SavedObjectsClient" - }, - ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"collectMultiNamespaceReferences\" | \"updateObjectsSpaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">) => Pick<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsImporter", - "text": "SavedObjectsImporter" - }, - ", \"import\" | \"resolveImportErrors\">" - ], - "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false, - "returnComment": [], - "children": [ - { - "parentPluginId": "core", - "id": "def-server.client", - "type": "Object", - "tags": [], - "label": "client", - "description": [], - "signature": [ - "{ get: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - "SavedObject", - ">; delete: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsDeleteOptions", - "text": "SavedObjectsDeleteOptions" - }, - ") => Promise<{}>; create: (type: string, attributes: T, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCreateOptions", - "text": "SavedObjectsCreateOptions" - }, - " | undefined) => Promise<", - "SavedObject", - ">; bulkCreate: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkCreateObject", - "text": "SavedObjectsBulkCreateObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCreateOptions", - "text": "SavedObjectsCreateOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkResponse", - "text": "SavedObjectsBulkResponse" - }, - ">; checkConflicts: (objects?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCheckConflictsObject", - "text": "SavedObjectsCheckConflictsObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCheckConflictsResponse", - "text": "SavedObjectsCheckConflictsResponse" - }, - ">; find: (options: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindOptions", - "text": "SavedObjectsFindOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindResponse", - "text": "SavedObjectsFindResponse" - }, - ">; bulkGet: (objects?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkGetObject", - "text": "SavedObjectsBulkGetObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkResponse", - "text": "SavedObjectsBulkResponse" - }, - ">; resolve: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsResolveResponse", - "text": "SavedObjectsResolveResponse" - }, - ">; update: (type: string, id: string, attributes: Partial, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateOptions", - "text": "SavedObjectsUpdateOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateResponse", - "text": "SavedObjectsUpdateResponse" - }, - ">; collectMultiNamespaceReferences: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCollectMultiNamespaceReferencesObject", - "text": "SavedObjectsCollectMultiNamespaceReferencesObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCollectMultiNamespaceReferencesOptions", - "text": "SavedObjectsCollectMultiNamespaceReferencesOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCollectMultiNamespaceReferencesResponse", - "text": "SavedObjectsCollectMultiNamespaceReferencesResponse" - }, - ">; updateObjectsSpaces: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateObjectsSpacesObject", - "text": "SavedObjectsUpdateObjectsSpacesObject" - }, - "[], spacesToAdd: string[], spacesToRemove: string[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateObjectsSpacesOptions", - "text": "SavedObjectsUpdateObjectsSpacesOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsUpdateObjectsSpacesResponse", - "text": "SavedObjectsUpdateObjectsSpacesResponse" - }, - ">; bulkUpdate: (objects: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkUpdateObject", - "text": "SavedObjectsBulkUpdateObject" - }, - "[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkUpdateOptions", - "text": "SavedObjectsBulkUpdateOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBulkUpdateResponse", - "text": "SavedObjectsBulkUpdateResponse" - }, - ">; removeReferencesTo: (type: string, id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsRemoveReferencesToOptions", - "text": "SavedObjectsRemoveReferencesToOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsRemoveReferencesToResponse", - "text": "SavedObjectsRemoveReferencesToResponse" - }, - ">; openPointInTimeForType: (type: string | string[], options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsOpenPointInTimeOptions", - "text": "SavedObjectsOpenPointInTimeOptions" - }, - ") => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsOpenPointInTimeResponse", - "text": "SavedObjectsOpenPointInTimeResponse" - }, - ">; closePointInTime: (id: string, options?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsBaseOptions", - "text": "SavedObjectsBaseOptions" - }, - " | undefined) => Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsClosePointInTimeResponse", - "text": "SavedObjectsClosePointInTimeResponse" - }, - ">; createPointInTimeFinder: (findOptions: Pick<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsFindOptions", - "text": "SavedObjectsFindOptions" - }, - ", \"type\" | \"filter\" | \"aggs\" | \"fields\" | \"perPage\" | \"sortField\" | \"sortOrder\" | \"search\" | \"searchFields\" | \"rootSearchFields\" | \"hasReference\" | \"hasReferenceOperator\" | \"defaultSearchOperator\" | \"namespaces\" | \"typeToNamespacesMap\" | \"preference\">, dependencies?: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsCreatePointInTimeFinderDependencies", - "text": "SavedObjectsCreatePointInTimeFinderDependencies" - }, - " | undefined) => ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.ISavedObjectsPointInTimeFinder", - "text": "ISavedObjectsPointInTimeFinder" - }, - "; errors: typeof ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreSavedObjectsPluginApi", - "section": "def-server.SavedObjectsErrorHelpers", - "text": "SavedObjectsErrorHelpers" - }, - "; }" + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"collectMultiNamespaceReferences\" | \"updateObjectsSpaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">" ], "path": "src/core/server/saved_objects/saved_objects_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -14623,8 +14062,8 @@ ], "path": "src/core/server/saved_objects/saved_objects_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -14941,7 +14380,25 @@ ") => string) | undefined" ], "path": "src/core/server/saved_objects/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.SavedObjectsTypeManagementDefinition.getTitle.$1", + "type": "Object", + "tags": [], + "label": "savedObject", + "description": [], + "signature": [ + "SavedObject", + "" + ], + "path": "src/core/server/saved_objects/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -14958,7 +14415,25 @@ ") => string) | undefined" ], "path": "src/core/server/saved_objects/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.SavedObjectsTypeManagementDefinition.getEditUrl.$1", + "type": "Object", + "tags": [], + "label": "savedObject", + "description": [], + "signature": [ + "SavedObject", + "" + ], + "path": "src/core/server/saved_objects/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "core", @@ -14975,7 +14450,27 @@ ") => { path: string; uiCapabilitiesPath: string; }) | undefined" ], "path": "src/core/server/saved_objects/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.SavedObjectsTypeManagementDefinition.getInAppUrl.$1", + "type": "Object", + "tags": [], + "label": "savedObject", + "description": [], + "signature": [ + "SavedObject", + "" + ], + "path": "src/core/server/saved_objects/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [ + "an object containing a `path` and `uiCapabilitiesPath` properties. the `path` is the path to\nthe object page, relative to the base path. `uiCapabilitiesPath` is the path to check in the\n{@link Capabilities | uiCapabilities} to check if the user has permission to access the object." + ] }, { "parentPluginId": "core", @@ -15948,6 +15443,41 @@ ], "path": "src/core/server/saved_objects/migrations/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.doc", + "type": "CompoundType", + "tags": [], + "label": "doc", + "description": [], + "signature": [ + "SavedObjectDoc & Partial" + ], + "path": "src/core/server/saved_objects/migrations/types.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectMigrationContext", + "text": "SavedObjectMigrationContext" + } + ], + "path": "src/core/server/saved_objects/migrations/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -16312,6 +15842,30 @@ ], "path": "src/core/server/saved_objects/service/lib/scoped_client_provider.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ request: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "; includedHiddenTypes?: string[] | undefined; }" + ], + "path": "src/core/server/saved_objects/service/lib/scoped_client_provider.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -16343,6 +15897,28 @@ ], "path": "src/core/server/saved_objects/service/lib/scoped_client_provider.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.repositoryFactory", + "type": "Object", + "tags": [], + "label": "repositoryFactory", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsRepositoryFactory", + "text": "SavedObjectsRepositoryFactory" + } + ], + "path": "src/core/server/saved_objects/service/lib/scoped_client_provider.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -16375,6 +15951,28 @@ ], "path": "src/core/server/saved_objects/service/lib/scoped_client_provider.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsClientWrapperOptions", + "text": "SavedObjectsClientWrapperOptions" + } + ], + "path": "src/core/server/saved_objects/service/lib/scoped_client_provider.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -16457,6 +16055,42 @@ ], "path": "src/core/server/saved_objects/export/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsExportTransformContext", + "text": "SavedObjectsExportTransformContext" + } + ], + "path": "src/core/server/saved_objects/export/types.ts", + "deprecated": false + }, + { + "parentPluginId": "core", + "id": "def-server.objects", + "type": "Array", + "tags": [], + "label": "objects", + "description": [], + "signature": [ + "SavedObject", + "[]" + ], + "path": "src/core/server/saved_objects/export/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -16577,6 +16211,23 @@ ], "path": "src/core/server/saved_objects/import/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.objects", + "type": "Array", + "tags": [], + "label": "objects", + "description": [], + "signature": [ + "SavedObject", + "[]" + ], + "path": "src/core/server/saved_objects/import/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -16653,6 +16304,30 @@ ], "path": "src/core/server/saved_objects/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "core", + "id": "def-server.toolkit", + "type": "Object", + "tags": [], + "label": "toolkit", + "description": [], + "signature": [ + "{ readonlyEsClient: Pick<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.ElasticsearchClient", + "text": "ElasticsearchClient" + }, + ", \"search\">; }" + ], + "path": "src/core/server/saved_objects/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/core_saved_objects.mdx b/api_docs/core_saved_objects.mdx index bed2039941ed9..a138b077840f0 100644 --- a/api_docs/core_saved_objects.mdx +++ b/api_docs/core_saved_objects.mdx @@ -18,7 +18,7 @@ import coreSavedObjectsObj from './core_saved_objects.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2363 | 148 | 1081 | 31 | +| 2450 | 149 | 1165 | 31 | ## Client diff --git a/api_docs/dashboard.json b/api_docs/dashboard.json index 7254f3477a003..656364b835af5 100644 --- a/api_docs/dashboard.json +++ b/api_docs/dashboard.json @@ -1222,7 +1222,8 @@ "\nOptionally apply filers. NOTE: if given and used in conjunction with `dashboardId`, and the\nsaved dashboard has filters saved with it, this will _replace_ those filters." ], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/dashboard/public/locator.ts", "deprecated": false @@ -1230,14 +1231,15 @@ { "parentPluginId": "dashboard", "id": "def-public.DashboardAppLocatorParams.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [ "\nOptionally set a query. NOTE: if given and used in conjunction with `dashboardId`, and the\nsaved dashboard has a query saved with it, this will _replace_ that query." ], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/dashboard/public/locator.ts", "deprecated": false @@ -1532,7 +1534,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/dashboard/public/types.ts", "deprecated": false @@ -1550,12 +1553,12 @@ { "parentPluginId": "dashboard", "id": "def-public.DashboardContainerInput.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [], "signature": [ - "any" + "{ query: string | { [key: string]: any; }; language: string; }" ], "path": "src/plugins/dashboard/public/types.ts", "deprecated": false @@ -1961,7 +1964,8 @@ "label": "getQuery", "description": [], "signature": [ - "() => any" + "() => ", + "Query" ], "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", "deprecated": false, @@ -1976,7 +1980,9 @@ "label": "getFilters", "description": [], "signature": [ - "() => any[]" + "() => ", + "Filter", + "[]" ], "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", "deprecated": false, @@ -1995,11 +2001,10 @@ ], "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "dashboard", - "id": "def-public.editMode", + "id": "def-public.DashboardSavedObject.getFullEditPath.$1", "type": "CompoundType", "tags": [], "label": "editMode", @@ -2008,9 +2013,11 @@ "boolean | undefined" ], "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -2097,7 +2104,8 @@ "\nOptionally apply filers. NOTE: if given and used in conjunction with `dashboardId`, and the\nsaved dashboard has filters saved with it, this will _replace_ those filters." ], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/dashboard/public/url_generator.ts", "deprecated": false @@ -2105,14 +2113,15 @@ { "parentPluginId": "dashboard", "id": "def-public.DashboardUrlGeneratorState.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [ "\nOptionally set a query. NOTE: if given and used in conjunction with `dashboardId`, and the\nsaved dashboard has a query saved with it, this will _replace_ that query." ], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/dashboard/public/url_generator.ts", "deprecated": false @@ -2508,8 +2517,8 @@ ], "path": "src/plugins/dashboard/public/plugin.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "dashboard", @@ -2523,8 +2532,8 @@ ], "path": "src/plugins/dashboard/public/plugin.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "dashboard", diff --git a/api_docs/dashboard.mdx b/api_docs/dashboard.mdx index 1ada2f7a695bd..2adae80a02061 100644 --- a/api_docs/dashboard.mdx +++ b/api_docs/dashboard.mdx @@ -18,7 +18,7 @@ import dashboardObj from './dashboard.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 160 | 4 | 137 | 9 | +| 160 | 1 | 137 | 9 | ## Client diff --git a/api_docs/data.json b/api_docs/data.json index 79656ada252c3..e4f94168f50be 100644 --- a/api_docs/data.json +++ b/api_docs/data.json @@ -1973,7 +1973,9 @@ "label": "getSearchSourceTimeFilter", "description": [], "signature": [ - "(forceNow?: Date | undefined) => any[]" + "(forceNow?: Date | undefined) => ", + "RangeFilter", + "[] | { meta: { index: string | undefined; params: {}; alias: string; disabled: boolean; negate: boolean; }; query: { bool: { should: { bool: { filter: { range: { [x: string]: { gte: string; lte: string; }; }; }[]; }; }[]; minimum_should_match: number; }; }; }[]" ], "path": "src/plugins/data/common/search/aggs/agg_configs.ts", "deprecated": false, @@ -7554,7 +7556,9 @@ "section": "def-common.TimeRange", "text": "TimeRange" }, - ", options: { forceNow?: Date | undefined; fieldName?: string | undefined; } | undefined) => any" + ", options: { forceNow?: Date | undefined; fieldName?: string | undefined; } | undefined) => ", + "RangeFilter", + " | undefined" ], "path": "src/plugins/data/common/query/timefilter/get_time.ts", "deprecated": false, @@ -7818,7 +7822,8 @@ "label": "isFilter", "description": [], "signature": [ - "(x: unknown) => x is any" + "(x: unknown) => x is ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -7851,7 +7856,9 @@ "label": "isFilters", "description": [], "signature": [ - "(x: unknown) => x is any[]" + "(x: unknown) => x is ", + "Filter", + "[]" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -7939,7 +7946,8 @@ "label": "isQuery", "description": [], "signature": [ - "(x: unknown) => x is any" + "(x: unknown) => x is ", + "Query" ], "path": "src/plugins/data/common/query/is_query.ts", "deprecated": false, @@ -8109,7 +8117,17 @@ "section": "def-common.GeoPoint", "text": "GeoPoint" }, - "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: any; }, \"filter\" | \"geo_bounding_box\"> & Pick<{ geo_bounding_box?: ({ type: \"geo_bounding_box\"; } & GeoBox) | ({ type: \"geo_bounding_box\"; } & { top_left: ", + "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + "> | undefined; }, \"filter\" | \"geo_bounding_box\"> & Pick<{ geo_bounding_box?: ({ type: \"geo_bounding_box\"; } & GeoBox) | ({ type: \"geo_bounding_box\"; } & { top_left: ", { "pluginId": "data", "scope": "common", @@ -8141,7 +8159,17 @@ "section": "def-common.GeoPoint", "text": "GeoPoint" }, - "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: any; }, never>, \"enabled\" | \"id\" | \"filter\" | \"customLabel\" | \"schema\" | \"geo_bounding_box\" | \"json\" | \"timeShift\">, ", + "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + "> | undefined; }, never>, \"enabled\" | \"id\" | \"filter\" | \"customLabel\" | \"schema\" | \"geo_bounding_box\" | \"json\" | \"timeShift\">, ", "AggExpressionType", ", ", { @@ -10294,7 +10322,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/actions/apply_filter_action.ts", "deprecated": false @@ -10363,7 +10392,9 @@ "signature": [ "({ data, negate, }: ", "ValueClickDataContext", - ") => Promise" + ") => Promise<", + "Filter", + "[]>" ], "path": "src/plugins/data/public/types.ts", "deprecated": false, @@ -10394,7 +10425,9 @@ "signature": [ "(event: ", "RangeSelectDataContext", - ") => Promise" + ") => Promise<", + "Filter", + "[]>" ], "path": "src/plugins/data/public/types.ts", "deprecated": false, @@ -11767,7 +11800,67 @@ ") | undefined" ], "path": "src/plugins/data/common/index_patterns/fields/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.IFieldType.toSpec.$1.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "path": "src/plugins/data/common/index_patterns/fields/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.IFieldType.toSpec.$1.options.getFormatterForField", + "type": "Function", + "tags": [], + "label": "getFormatterForField", + "description": [], + "signature": [ + "((field: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IFieldType", + "text": "IFieldType" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IndexPatternField", + "text": "IndexPatternField" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.FieldSpec", + "text": "FieldSpec" + }, + ") => ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataFieldFormatsPluginApi", + "section": "def-common.FieldFormat", + "text": "FieldFormat" + }, + ") | undefined" + ], + "path": "src/plugins/data/common/index_patterns/fields/types.ts", + "deprecated": false + } + ] + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -11795,18 +11888,6 @@ "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": true, "references": [ - { - "plugin": "savedObjects", - "path": "src/plugins/saved_objects/public/types.ts" - }, - { - "plugin": "savedObjects", - "path": "src/plugins/saved_objects/public/types.ts" - }, - { - "plugin": "savedObjects", - "path": "src/plugins/saved_objects/public/types.ts" - }, { "plugin": "observability", "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts" @@ -12527,14 +12608,6 @@ "plugin": "observability", "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts" }, - { - "plugin": "maps", - "path": "x-pack/plugins/maps/public/embeddable/types.ts" - }, - { - "plugin": "maps", - "path": "x-pack/plugins/maps/public/embeddable/types.ts" - }, { "plugin": "ml", "path": "x-pack/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts" @@ -12796,7 +12869,46 @@ ") | undefined" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.IIndexPattern.getFormatterForField.$1", + "type": "CompoundType", + "tags": [], + "label": "field", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IFieldType", + "text": "IFieldType" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IndexPatternField", + "text": "IndexPatternField" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.FieldSpec", + "text": "FieldSpec" + } + ], + "path": "src/plugins/data/common/index_patterns/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -14002,11 +14114,10 @@ ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.fields", + "id": "def-public.ISearchStartSearchSource.create.$1", "type": "Object", "tags": [], "label": "fields", @@ -14022,9 +14133,11 @@ " | undefined" ], "path": "src/plugins/data/common/search/search_source/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -14048,8 +14161,8 @@ ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -14117,11 +14230,10 @@ ], "path": "src/plugins/data/common/search/aggs/param_types/optioned.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.agg", + "id": "def-public.OptionedValueProp.isCompatible.$1", "type": "Object", "tags": [], "label": "agg", @@ -14136,9 +14248,11 @@ } ], "path": "src/plugins/data/common/search/aggs/param_types/optioned.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -14277,14 +14391,15 @@ { "parentPluginId": "data", "id": "def-public.SearchSourceFields.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [ "\n{@link Query}" ], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false @@ -14292,14 +14407,21 @@ { "parentPluginId": "data", "id": "def-public.SearchSourceFields.filter", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filter", "description": [ "\n{@link Filter}" ], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[] | (() => ", + "Filter", + " | ", + "Filter", + "[] | undefined) | undefined" ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false @@ -14955,7 +15077,8 @@ "label": "CustomFilter", "description": [], "signature": [ - "any" + "Filter", + " & { query: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -15171,7 +15294,13 @@ "label": "ExecutionContextSearch", "description": [], "signature": [ - "{ filters?: any[] | undefined; query?: any; timeRange?: ", + "{ filters?: ", + "Filter", + "[] | undefined; query?: ", + "Query", + " | ", + "Query", + "[] | undefined; timeRange?: ", { "pluginId": "data", "scope": "common", @@ -15195,7 +15324,10 @@ "label": "ExistsFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "FilterMeta", + "; exists?: { field: string; } | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -15408,6 +15540,32 @@ ], "path": "src/plugins/data/common/field_formats/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.key", + "type": "string", + "tags": [], + "label": "key", + "description": [], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.defaultOverride", + "type": "Uncategorized", + "tags": [], + "label": "defaultOverride", + "description": [], + "signature": [ + "T | undefined" + ], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -15420,7 +15578,11 @@ "label": "Filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -17737,6 +17899,42 @@ ], "path": "src/plugins/data/common/search/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.request", + "type": "Uncategorized", + "tags": [], + "label": "request", + "description": [], + "signature": [ + "SearchStrategyRequest" + ], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ISearchOptions", + "text": "ISearchOptions" + }, + " | undefined" + ], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -18284,7 +18482,10 @@ "label": "MatchAllFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "MatchAllFilterMeta", + "; match_all: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -18326,7 +18527,10 @@ "label": "PhraseFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "PhraseFilterMeta", + "; script?: { script: { source?: string | undefined; lang?: \"painless\" | \"expression\" | \"mustache\" | \"java\" | undefined; params: { [key: string]: PhraseFilterValue; }; }; } | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -18343,13 +18547,30 @@ "label": "PhrasesFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "PhrasesFilterMeta", + "; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, "references": [], "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-public.Query", + "type": "Type", + "tags": [], + "label": "Query", + "description": [], + "signature": [ + "{ query: string | { [key: string]: any; }; language: string; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/types.d.ts", + "deprecated": false, + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-public.RangeFilter", @@ -18360,7 +18581,14 @@ "label": "RangeFilter", "description": [], "signature": [ - "any" + "Filter", + " & ", + "EsRangeFilter", + " & { meta: ", + "RangeFilterMeta", + "; script?: { script: { params: any; lang: ", + "ScriptLanguage", + "; source: string; }; } | undefined; match_all?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -18386,7 +18614,10 @@ "label": "RangeFilterMeta", "description": [], "signature": [ - "any" + "FilterMeta", + " & { params: ", + "RangeFilterParams", + "; field?: string | undefined; formattedValue?: string | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -18403,7 +18634,7 @@ "label": "RangeFilterParams", "description": [], "signature": [ - "any" + "RangeFilterParams" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -19036,171 +19267,755 @@ { "parentPluginId": "data", "id": "def-public.esFilters.buildEmptyFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildEmptyFilter", "description": [], "signature": [ - "any" + "(isPinned: boolean, index?: string | undefined) => ", + "Filter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.isPinned", + "type": "boolean", + "tags": [], + "label": "isPinned", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_empty_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.index", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_empty_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.buildPhrasesFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildPhrasesFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", params: string[], indexPattern: ", + "IndexPatternBase", + ") => ", + "PhrasesFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.params", + "type": "Array", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "string[]" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.buildExistsFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildExistsFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", indexPattern: ", + "IndexPatternBase", + ") => ", + "ExistsFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.buildPhraseFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildPhraseFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", value: PhraseFilterValue, indexPattern: ", + "IndexPatternBase", + ") => ", + "PhraseFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.value", + "type": "CompoundType", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "string | number | boolean" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.buildQueryFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildQueryFilter", "description": [], "signature": [ - "any" + "(query: any, index: string, alias: string) => ", + "QueryStringFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.query", + "type": "Any", + "tags": [], + "label": "query", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.index", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.alias", + "type": "string", + "tags": [], + "label": "alias", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.buildRangeFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildRangeFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", params: ", + "RangeFilterParams", + ", indexPattern: ", + "IndexPatternBase", + ", formattedValue?: string | undefined) => ", + "RangeFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "RangeFilterParams" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-public.formattedValue", + "type": "string", + "tags": [], + "label": "formattedValue", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isPhraseFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isPhraseFilter", "description": [], "signature": [ - "any" + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "PhraseFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isExistsFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isExistsFilter", "description": [], "signature": [ - "any" + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "ExistsFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isPhrasesFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isPhrasesFilter", "description": [], "signature": [ - "any" + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "PhrasesFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isRangeFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isRangeFilter", "description": [], "signature": [ - "any" + "(filter?: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + " | undefined) => filter is ", + "RangeFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + " | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isMatchAllFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isMatchAllFilter", "description": [], "signature": [ - "any" + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "MatchAllFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/match_all_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isMissingFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isMissingFilter", "description": [], "signature": [ - "any" + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "MissingFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/missing_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.isQueryStringFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "isQueryStringFilter", "description": [], "signature": [ - "any" + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "QueryStringFilter" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", @@ -19210,7 +20025,9 @@ "label": "isFilterPinned", "description": [], "signature": [ - "(filter: any) => boolean | undefined" + "(filter: ", + "Filter", + ") => boolean | undefined" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19219,12 +20036,16 @@ { "parentPluginId": "data", "id": "def-public.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -19239,7 +20060,11 @@ "label": "toggleFilterNegated", "description": [], "signature": [ - "(filter: any) => { meta: { negate: boolean; alias: string | null; disabled: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }; $state?: { store: any; } | undefined; query?: any; }" + "(filter: ", + "Filter", + ") => { meta: { negate: boolean; alias: string | null; disabled: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }; $state?: { store: ", + "FilterStateStore", + "; } | undefined; query?: any; }" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19248,12 +20073,16 @@ { "parentPluginId": "data", "id": "def-public.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -19268,7 +20097,10 @@ "label": "disableFilter", "description": [], "signature": [ - "(filter: any) => any" + "(filter: ", + "Filter", + ") => ", + "Filter" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19277,12 +20109,16 @@ { "parentPluginId": "data", "id": "def-public.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -19292,28 +20128,70 @@ { "parentPluginId": "data", "id": "def-public.esFilters.getPhraseFilterField", - "type": "Any", + "type": "Function", "tags": [], "label": "getPhraseFilterField", "description": [], "signature": [ - "any" + "(filter: ", + "PhraseFilter", + ") => string" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "Filter", + " & { meta: ", + "PhraseFilterMeta", + "; script?: { script: { source?: string | undefined; lang?: \"painless\" | \"expression\" | \"mustache\" | \"java\" | undefined; params: { [key: string]: PhraseFilterValue; }; }; } | undefined; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-public.esFilters.getPhraseFilterValue", - "type": "Any", + "type": "Function", "tags": [], "label": "getPhraseFilterValue", "description": [], "signature": [ - "any" + "(filter: ", + "PhraseFilter", + ") => PhraseFilterValue" ], "path": "src/plugins/data/public/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "Filter", + " & { meta: ", + "PhraseFilterMeta", + "; script?: { script: { source?: string | undefined; lang?: \"painless\" | \"expression\" | \"mustache\" | \"java\" | undefined; params: { [key: string]: PhraseFilterValue; }; }; } | undefined; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", @@ -19323,7 +20201,9 @@ "label": "getDisplayValueFromFilter", "description": [], "signature": [ - "(filter: any, indexPatterns: ", + "(filter: ", + "Filter", + ", indexPatterns: ", { "pluginId": "data", "scope": "common", @@ -19340,12 +20220,16 @@ { "parentPluginId": "data", "id": "def-public.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "src/plugins/data/public/query/filter_manager/lib/get_display_value.ts", "deprecated": false @@ -19380,7 +20264,15 @@ "label": "compareFilters", "description": [], "signature": [ - "(first: any, second: any, comparatorOptions?: ", + "(first: ", + "Filter", + " | ", + "Filter", + "[], second: ", + "Filter", + " | ", + "Filter", + "[], comparatorOptions?: ", "FilterCompareOptions", " | undefined) => boolean" ], @@ -19391,12 +20283,15 @@ { "parentPluginId": "data", "id": "def-public.first", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "first", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/compare_filters.d.ts", "deprecated": false @@ -19404,12 +20299,15 @@ { "parentPluginId": "data", "id": "def-public.second", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "second", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/compare_filters.d.ts", "deprecated": false @@ -19467,7 +20365,9 @@ "section": "def-common.IFieldType", "text": "IFieldType" }, - ", values: any, operation: string, index: string) => any[]" + ", values: any, operation: string, index: string) => ", + "Filter", + "[]" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19555,7 +20455,11 @@ "label": "onlyDisabledFiltersChanged", "description": [], "signature": [ - "(newFilters?: any[] | undefined, oldFilters?: any[] | undefined) => boolean" + "(newFilters?: ", + "Filter", + "[] | undefined, oldFilters?: ", + "Filter", + "[] | undefined) => boolean" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19569,7 +20473,8 @@ "label": "newFilters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/only_disabled.d.ts", "deprecated": false @@ -19582,7 +20487,8 @@ "label": "oldFilters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/only_disabled.d.ts", "deprecated": false @@ -19599,7 +20505,9 @@ "signature": [ "(timeFilter: Pick<", "Timefilter", - ", \"isTimeRangeSelectorEnabled\" | \"isAutoRefreshSelectorEnabled\" | \"isTimeTouched\" | \"getEnabledUpdated$\" | \"getTimeUpdate$\" | \"getRefreshIntervalUpdate$\" | \"getAutoRefreshFetch$\" | \"getFetch$\" | \"getTime\" | \"getAbsoluteTime\" | \"setTime\" | \"getRefreshInterval\" | \"setRefreshInterval\" | \"createFilter\" | \"getBounds\" | \"calculateBounds\" | \"getActiveBounds\" | \"enableTimeRangeSelector\" | \"disableTimeRangeSelector\" | \"enableAutoRefreshSelector\" | \"disableAutoRefreshSelector\" | \"getTimeDefaults\" | \"getRefreshIntervalDefaults\">, filter: any) => void" + ", \"isTimeRangeSelectorEnabled\" | \"isAutoRefreshSelectorEnabled\" | \"isTimeTouched\" | \"getEnabledUpdated$\" | \"getTimeUpdate$\" | \"getRefreshIntervalUpdate$\" | \"getAutoRefreshFetch$\" | \"getFetch$\" | \"getTime\" | \"getAbsoluteTime\" | \"setTime\" | \"getRefreshInterval\" | \"setRefreshInterval\" | \"createFilter\" | \"getBounds\" | \"calculateBounds\" | \"getActiveBounds\" | \"enableTimeRangeSelector\" | \"disableTimeRangeSelector\" | \"enableAutoRefreshSelector\" | \"disableAutoRefreshSelector\" | \"getTimeDefaults\" | \"getRefreshIntervalDefaults\">, filter: ", + "RangeFilter", + ") => void" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19687,7 +20595,9 @@ "section": "def-common.TimeRange", "text": "TimeRange" }, - " | undefined) => any; getBounds: () => ", + " | undefined) => ", + "RangeFilter", + " | undefined; getBounds: () => ", { "pluginId": "data", "scope": "common", @@ -19743,12 +20653,19 @@ { "parentPluginId": "data", "id": "def-public.filter", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "Filter", + " & ", + "EsRangeFilter", + " & { meta: ", + "RangeFilterMeta", + "; script?: { script: { params: any; lang: ", + "ScriptLanguage", + "; source: string; }; } | undefined; match_all?: any; }" ], "path": "src/plugins/data/public/query/timefilter/lib/change_time_filter.ts", "deprecated": false @@ -19763,7 +20680,9 @@ "label": "convertRangeFilterToTimeRangeString", "description": [], "signature": [ - "(filter: any) => ", + "(filter: ", + "RangeFilter", + ") => ", { "pluginId": "data", "scope": "common", @@ -19779,12 +20698,19 @@ { "parentPluginId": "data", "id": "def-public.filter", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "Filter", + " & ", + "EsRangeFilter", + " & { meta: ", + "RangeFilterMeta", + "; script?: { script: { params: any; lang: ", + "ScriptLanguage", + "; source: string; }; } | undefined; match_all?: any; }" ], "path": "src/plugins/data/public/query/timefilter/lib/change_time_filter.ts", "deprecated": false @@ -19799,7 +20725,11 @@ "label": "mapAndFlattenFilters", "description": [], "signature": [ - "(filters: any[]) => any[]" + "(filters: ", + "Filter", + "[]) => ", + "Filter", + "[]" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19813,7 +20743,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/lib/map_and_flatten_filters.ts", "deprecated": false @@ -19828,7 +20759,13 @@ "label": "extractTimeFilter", "description": [], "signature": [ - "(timeFieldName: string, filters: any[]) => { restOfFilters: any[]; timeRangeFilter: any; }" + "(timeFieldName: string, filters: ", + "Filter", + "[]) => { restOfFilters: ", + "Filter", + "[]; timeRangeFilter: ", + "RangeFilter", + " | undefined; }" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -19852,7 +20789,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts", "deprecated": false @@ -19867,7 +20805,11 @@ "label": "extractTimeRange", "description": [], "signature": [ - "(filters: any[], timeFieldName?: string | undefined) => { restOfFilters: any[]; timeRange?: ", + "(filters: ", + "Filter", + "[], timeFieldName?: string | undefined) => { restOfFilters: ", + "Filter", + "[]; timeRange?: ", { "pluginId": "data", "scope": "common", @@ -19889,7 +20831,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts", "deprecated": false @@ -20751,11 +21694,23 @@ "signature": [ "(indexPattern: ", "IndexPatternBase", - " | undefined, queries: any, filters: any, config?: ", + " | undefined, queries: ", + "Query", + " | ", + "Query", + "[], filters: ", + "Filter", + " | ", + "Filter", + "[], config?: ", "EsQueryConfig", " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }" + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -20778,12 +21733,15 @@ { "parentPluginId": "data", "id": "def-public.queries", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "queries", "description": [], "signature": [ - "any" + "Query", + " | ", + "Query", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/es_query/build_es_query.d.ts", "deprecated": false @@ -20791,12 +21749,15 @@ { "parentPluginId": "data", "id": "def-public.filters", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filters", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/es_query/build_es_query.d.ts", "deprecated": false @@ -20855,9 +21816,15 @@ "label": "buildQueryFromFilters", "description": [], "signature": [ - "(filters: any[] | undefined, indexPattern: ", + "(filters: ", + "Filter", + "[] | undefined, indexPattern: ", "IndexPatternBase", - " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: any[]; should: never[]; must_not: any[]; }" + " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }" ], "path": "src/plugins/data/public/deprecated.ts", "deprecated": false, @@ -20871,7 +21838,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/es_query/from_filters.d.ts", "deprecated": false @@ -23191,7 +24159,9 @@ "\nquery service\n{@link QueryStart}" ], "signature": [ - "{ addToQueryLog: (appName: string, { language, query }: any) => void; filterManager: ", + "{ addToQueryLog: (appName: string, { language, query }: ", + "Query", + ") => void; filterManager: ", { "pluginId": "data", "scope": "public", @@ -23247,7 +24217,11 @@ }, " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }; }" + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }; }" ], "path": "src/plugins/data/public/types.ts", "deprecated": false @@ -27350,9 +28324,15 @@ "label": "buildQueryFromFilters", "description": [], "signature": [ - "(filters: any[] | undefined, indexPattern: ", + "(filters: ", + "Filter", + "[] | undefined, indexPattern: ", "IndexPatternBase", - " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: any[]; should: never[]; must_not: any[]; }" + " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -27367,7 +28347,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/es_query/from_filters.d.ts", "deprecated": false @@ -27507,7 +28488,9 @@ "section": "def-common.TimeRange", "text": "TimeRange" }, - ", options: { forceNow?: Date | undefined; fieldName?: string | undefined; } | undefined) => any" + ", options: { forceNow?: Date | undefined; fieldName?: string | undefined; } | undefined) => ", + "RangeFilter", + " | undefined" ], "path": "src/plugins/data/common/query/timefilter/get_time.ts", "deprecated": false, @@ -27697,7 +28680,17 @@ "section": "def-common.GeoPoint", "text": "GeoPoint" }, - "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: any; }, \"filter\" | \"geo_bounding_box\"> & Pick<{ geo_bounding_box?: ({ type: \"geo_bounding_box\"; } & GeoBox) | ({ type: \"geo_bounding_box\"; } & { top_left: ", + "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + "> | undefined; }, \"filter\" | \"geo_bounding_box\"> & Pick<{ geo_bounding_box?: ({ type: \"geo_bounding_box\"; } & GeoBox) | ({ type: \"geo_bounding_box\"; } & { top_left: ", { "pluginId": "data", "scope": "common", @@ -27729,7 +28722,17 @@ "section": "def-common.GeoPoint", "text": "GeoPoint" }, - "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: any; }, never>, \"enabled\" | \"id\" | \"filter\" | \"customLabel\" | \"schema\" | \"geo_bounding_box\" | \"json\" | \"timeShift\">, ", + "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + "> | undefined; }, never>, \"enabled\" | \"id\" | \"filter\" | \"customLabel\" | \"schema\" | \"geo_bounding_box\" | \"json\" | \"timeShift\">, ", "AggExpressionType", ", ", { @@ -30964,7 +31967,67 @@ ") | undefined" ], "path": "src/plugins/data/common/index_patterns/fields/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-server.IFieldType.toSpec.$1.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "path": "src/plugins/data/common/index_patterns/fields/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-server.IFieldType.toSpec.$1.options.getFormatterForField", + "type": "Function", + "tags": [], + "label": "getFormatterForField", + "description": [], + "signature": [ + "((field: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IFieldType", + "text": "IFieldType" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IndexPatternField", + "text": "IndexPatternField" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.FieldSpec", + "text": "FieldSpec" + }, + ") => ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataFieldFormatsPluginApi", + "section": "def-common.FieldFormat", + "text": "FieldFormat" + }, + ") | undefined" + ], + "path": "src/plugins/data/common/index_patterns/fields/types.ts", + "deprecated": false + } + ] + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -31341,11 +32404,10 @@ ], "path": "src/plugins/data/common/search/aggs/param_types/optioned.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-server.agg", + "id": "def-server.OptionedValueProp.isCompatible.$1", "type": "Object", "tags": [], "label": "agg", @@ -31360,9 +32422,11 @@ } ], "path": "src/plugins/data/common/search/aggs/param_types/optioned.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -31616,7 +32680,13 @@ "label": "ExecutionContextSearch", "description": [], "signature": [ - "{ filters?: any[] | undefined; query?: any; timeRange?: ", + "{ filters?: ", + "Filter", + "[] | undefined; query?: ", + "Query", + " | ", + "Query", + "[] | undefined; timeRange?: ", { "pluginId": "data", "scope": "common", @@ -31785,6 +32855,32 @@ ], "path": "src/plugins/data/common/field_formats/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.key", + "type": "string", + "tags": [], + "label": "key", + "description": [], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.defaultOverride", + "type": "Uncategorized", + "tags": [], + "label": "defaultOverride", + "description": [], + "signature": [ + "T | undefined" + ], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -31797,7 +32893,11 @@ "label": "Filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -34217,6 +35317,20 @@ "deprecated": false, "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-server.Query", + "type": "Type", + "tags": [], + "label": "Query", + "description": [], + "signature": [ + "{ query: string | { [key: string]: any; }; language: string; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/types.d.ts", + "deprecated": false, + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-server.TimeRange", @@ -34303,15 +35417,52 @@ { "parentPluginId": "data", "id": "def-server.esFilters.buildQueryFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildQueryFilter", "description": [], "signature": [ - "any" + "(query: any, index: string, alias: string) => ", + "QueryStringFilter" ], "path": "src/plugins/data/server/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.query", + "type": "Any", + "tags": [], + "label": "query", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.index", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.alias", + "type": "string", + "tags": [], + "label": "alias", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", @@ -34323,7 +35474,8 @@ "signature": [ "(indexPatternString: string, queryDsl: any, disabled: boolean, negate: boolean, alias: string | null, store: ", "FilterStateStore", - ") => any" + ") => ", + "Filter" ], "path": "src/plugins/data/server/deprecated.ts", "deprecated": false, @@ -34336,7 +35488,7 @@ "tags": [], "label": "indexPatternString", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -34349,7 +35501,7 @@ "signature": [ "any" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -34359,7 +35511,7 @@ "tags": [], "label": "disabled", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -34369,7 +35521,7 @@ "tags": [], "label": "negate", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -34382,7 +35534,7 @@ "signature": [ "string | null" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -34395,7 +35547,7 @@ "signature": [ "FilterStateStore" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false } ] @@ -34403,28 +35555,89 @@ { "parentPluginId": "data", "id": "def-server.esFilters.buildEmptyFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildEmptyFilter", "description": [], "signature": [ - "any" + "(isPinned: boolean, index?: string | undefined) => ", + "Filter" ], "path": "src/plugins/data/server/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.isPinned", + "type": "boolean", + "tags": [], + "label": "isPinned", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_empty_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.index", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_empty_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-server.esFilters.buildExistsFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildExistsFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", indexPattern: ", + "IndexPatternBase", + ") => ", + "ExistsFilter" ], "path": "src/plugins/data/server/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", @@ -34442,7 +35655,8 @@ "FILTERS", ", negate: boolean, disabled: boolean, params: any, alias: string | null, store?: ", "FilterStateStore", - " | undefined) => any" + " | undefined) => ", + "Filter" ], "path": "src/plugins/data/server/deprecated.ts", "deprecated": false, @@ -34458,7 +35672,7 @@ "signature": [ "IndexPatternBase" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34471,7 +35685,7 @@ "signature": [ "IndexPatternFieldBase" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34484,7 +35698,7 @@ "signature": [ "FILTERS" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34494,7 +35708,7 @@ "tags": [], "label": "negate", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34504,7 +35718,7 @@ "tags": [], "label": "disabled", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34517,7 +35731,7 @@ "signature": [ "any" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34530,7 +35744,7 @@ "signature": [ "string | null" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -34544,7 +35758,7 @@ "FilterStateStore", " | undefined" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false } ] @@ -34552,41 +35766,197 @@ { "parentPluginId": "data", "id": "def-server.esFilters.buildPhraseFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildPhraseFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", value: PhraseFilterValue, indexPattern: ", + "IndexPatternBase", + ") => ", + "PhraseFilter" ], "path": "src/plugins/data/server/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.value", + "type": "CompoundType", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "string | number | boolean" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-server.esFilters.buildPhrasesFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildPhrasesFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", params: string[], indexPattern: ", + "IndexPatternBase", + ") => ", + "PhrasesFilter" ], "path": "src/plugins/data/server/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.params", + "type": "Array", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "string[]" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", "id": "def-server.esFilters.buildRangeFilter", - "type": "Any", + "type": "Function", "tags": [], "label": "buildRangeFilter", "description": [], "signature": [ - "any" + "(field: ", + "IndexPatternFieldBase", + ", params: ", + "RangeFilterParams", + ", indexPattern: ", + "IndexPatternBase", + ", formattedValue?: string | undefined) => ", + "RangeFilter" ], "path": "src/plugins/data/server/deprecated.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-server.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "RangeFilterParams" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-server.formattedValue", + "type": "string", + "tags": [], + "label": "formattedValue", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + } + ] }, { "parentPluginId": "data", @@ -34596,7 +35966,9 @@ "label": "isFilterDisabled", "description": [], "signature": [ - "(filter: any) => boolean" + "(filter: ", + "Filter", + ") => boolean" ], "path": "src/plugins/data/server/deprecated.ts", "deprecated": false, @@ -34605,12 +35977,16 @@ { "parentPluginId": "data", "id": "def-server.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -34785,9 +36161,15 @@ "label": "buildQueryFromFilters", "description": [], "signature": [ - "(filters: any[] | undefined, indexPattern: ", + "(filters: ", + "Filter", + "[] | undefined, indexPattern: ", "IndexPatternBase", - " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: any[]; should: never[]; must_not: any[]; }" + " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }" ], "path": "src/plugins/data/server/deprecated.ts", "deprecated": false, @@ -34801,7 +36183,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/es_query/from_filters.d.ts", "deprecated": false @@ -34875,11 +36258,23 @@ "signature": [ "(indexPattern: ", "IndexPatternBase", - " | undefined, queries: any, filters: any, config?: ", + " | undefined, queries: ", + "Query", + " | ", + "Query", + "[], filters: ", + "Filter", + " | ", + "Filter", + "[], config?: ", "EsQueryConfig", " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }" + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }" ], "path": "src/plugins/data/server/deprecated.ts", "deprecated": false, @@ -34902,12 +36297,15 @@ { "parentPluginId": "data", "id": "def-server.queries", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "queries", "description": [], "signature": [ - "any" + "Query", + " | ", + "Query", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/es_query/build_es_query.d.ts", "deprecated": false @@ -34915,12 +36313,15 @@ { "parentPluginId": "data", "id": "def-server.filters", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filters", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/es_query/build_es_query.d.ts", "deprecated": false @@ -36385,7 +37786,8 @@ "signature": [ "(indexPatternString: string, queryDsl: any, disabled: boolean, negate: boolean, alias: string | null, store: ", "FilterStateStore", - ") => any" + ") => ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -36399,7 +37801,7 @@ "tags": [], "label": "indexPatternString", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -36412,7 +37814,7 @@ "signature": [ "any" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -36422,7 +37824,7 @@ "tags": [], "label": "disabled", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -36432,7 +37834,7 @@ "tags": [], "label": "negate", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -36445,7 +37847,7 @@ "signature": [ "string | null" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", "deprecated": false }, { @@ -36458,7 +37860,51 @@ "signature": [ "FilterStateStore" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/custom_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.buildEmptyFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "buildEmptyFilter", + "description": [], + "signature": [ + "(isPinned: boolean, index?: string | undefined) => ", + "Filter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.isPinned", + "type": "boolean", + "tags": [], + "label": "isPinned", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_empty_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.index", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_empty_filter.d.ts", "deprecated": false } ], @@ -36476,11 +37922,23 @@ "signature": [ "(indexPattern: ", "IndexPatternBase", - " | undefined, queries: any, filters: any, config?: ", + " | undefined, queries: ", + "Query", + " | ", + "Query", + "[], filters: ", + "Filter", + " | ", + "Filter", + "[], config?: ", "EsQueryConfig", " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }" + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -36504,12 +37962,15 @@ { "parentPluginId": "data", "id": "def-common.queries", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "queries", "description": [], "signature": [ - "any" + "Query", + " | ", + "Query", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/es_query/build_es_query.d.ts", "deprecated": false @@ -36517,12 +37978,15 @@ { "parentPluginId": "data", "id": "def-common.filters", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filters", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/es_query/build_es_query.d.ts", "deprecated": false @@ -36544,6 +38008,57 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-common.buildExistsFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "buildExistsFilter", + "description": [], + "signature": [ + "(field: ", + "IndexPatternFieldBase", + ", indexPattern: ", + "IndexPatternBase", + ") => ", + "ExistsFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-common.buildFilter", @@ -36562,7 +38077,8 @@ "FILTERS", ", negate: boolean, disabled: boolean, params: any, alias: string | null, store?: ", "FilterStateStore", - " | undefined) => any" + " | undefined) => ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -36579,7 +38095,7 @@ "signature": [ "IndexPatternBase" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36592,7 +38108,7 @@ "signature": [ "IndexPatternFieldBase" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36605,7 +38121,7 @@ "signature": [ "FILTERS" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36615,7 +38131,7 @@ "tags": [], "label": "negate", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36625,7 +38141,7 @@ "tags": [], "label": "disabled", "description": [], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36638,7 +38154,7 @@ "signature": [ "any" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36651,7 +38167,7 @@ "signature": [ "string | null" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", "deprecated": false }, { @@ -36665,7 +38181,189 @@ "FilterStateStore", " | undefined" ], - "path": "node_modules/@kbn/es-query/target_types/filters/build_filters.d.ts", + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/build_filters.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.buildPhraseFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "buildPhraseFilter", + "description": [], + "signature": [ + "(field: ", + "IndexPatternFieldBase", + ", value: PhraseFilterValue, indexPattern: ", + "IndexPatternBase", + ") => ", + "PhraseFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.value", + "type": "CompoundType", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "string | number | boolean" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.buildPhrasesFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "buildPhrasesFilter", + "description": [], + "signature": [ + "(field: ", + "IndexPatternFieldBase", + ", params: string[], indexPattern: ", + "IndexPatternBase", + ") => ", + "PhrasesFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.params", + "type": "Array", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "string[]" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.buildQueryFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "buildQueryFilter", + "description": [], + "signature": [ + "(query: any, index: string, alias: string) => ", + "QueryStringFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.query", + "type": "Any", + "tags": [], + "label": "query", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.index", + "type": "string", + "tags": [], + "label": "index", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.alias", + "type": "string", + "tags": [], + "label": "alias", + "description": [], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", "deprecated": false } ], @@ -36681,9 +38379,15 @@ "label": "buildQueryFromFilters", "description": [], "signature": [ - "(filters: any[] | undefined, indexPattern: ", + "(filters: ", + "Filter", + "[] | undefined, indexPattern: ", "IndexPatternBase", - " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: any[]; should: never[]; must_not: any[]; }" + " | undefined, ignoreFilterIfFieldNotInIndex?: boolean | undefined) => { must: never[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -36698,7 +38402,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/es_query/from_filters.d.ts", "deprecated": false @@ -36733,6 +38438,85 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-common.buildRangeFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "buildRangeFilter", + "description": [], + "signature": [ + "(field: ", + "IndexPatternFieldBase", + ", params: ", + "RangeFilterParams", + ", indexPattern: ", + "IndexPatternBase", + ", formattedValue?: string | undefined) => ", + "RangeFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.field", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "IndexPatternFieldBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "RangeFilterParams" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.indexPattern", + "type": "Object", + "tags": [], + "label": "indexPattern", + "description": [], + "signature": [ + "IndexPatternBase" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.formattedValue", + "type": "string", + "tags": [], + "label": "formattedValue", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-common.castEsToKbnFieldTypeName", @@ -36823,7 +38607,15 @@ "label": "compareFilters", "description": [], "signature": [ - "(first: any, second: any, comparatorOptions?: ", + "(first: ", + "Filter", + " | ", + "Filter", + "[], second: ", + "Filter", + " | ", + "Filter", + "[], comparatorOptions?: ", "FilterCompareOptions", " | undefined) => boolean" ], @@ -36835,12 +38627,15 @@ { "parentPluginId": "data", "id": "def-common.first", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "first", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/compare_filters.d.ts", "deprecated": false @@ -36848,12 +38643,15 @@ { "parentPluginId": "data", "id": "def-common.second", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "second", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/compare_filters.d.ts", "deprecated": false @@ -37059,9 +38857,15 @@ "label": "dedupFilters", "description": [], "signature": [ - "(existingFilters: any[], filters: any[], comparatorOptions?: ", + "(existingFilters: ", + "Filter", + "[], filters: ", + "Filter", + "[], comparatorOptions?: ", "FilterCompareOptions", - " | undefined) => any[]" + " | undefined) => ", + "Filter", + "[]" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37076,7 +38880,8 @@ "label": "existingFilters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/dedup_filters.d.ts", "deprecated": false @@ -37089,7 +38894,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/dedup_filters.d.ts", "deprecated": false @@ -37121,7 +38927,10 @@ "label": "disableFilter", "description": [], "signature": [ - "(filter: any) => any" + "(filter: ", + "Filter", + ") => ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37131,12 +38940,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37154,7 +38967,10 @@ "label": "enableFilter", "description": [], "signature": [ - "(filter: any) => any" + "(filter: ", + "Filter", + ") => ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37164,12 +38980,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37332,6 +39152,146 @@ "children": [], "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-common.getPhraseFilterField", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "getPhraseFilterField", + "description": [], + "signature": [ + "(filter: ", + "PhraseFilter", + ") => string" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "Filter", + " & { meta: ", + "PhraseFilterMeta", + "; script?: { script: { source?: string | undefined; lang?: \"painless\" | \"expression\" | \"mustache\" | \"java\" | undefined; params: { [key: string]: PhraseFilterValue; }; }; } | undefined; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.getPhraseFilterValue", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "getPhraseFilterValue", + "description": [], + "signature": [ + "(filter: ", + "PhraseFilter", + ") => PhraseFilterValue" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "Filter", + " & { meta: ", + "PhraseFilterMeta", + "; script?: { script: { source?: string | undefined; lang?: \"painless\" | \"expression\" | \"mustache\" | \"java\" | undefined; params: { [key: string]: PhraseFilterValue; }; }; } | undefined; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isExistsFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isExistsFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "ExistsFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/exists_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-common.isFilter", @@ -37342,7 +39302,8 @@ "label": "isFilter", "description": [], "signature": [ - "(x: unknown) => x is any" + "(x: unknown) => x is ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37375,7 +39336,9 @@ "label": "isFilterDisabled", "description": [], "signature": [ - "(filter: any) => boolean" + "(filter: ", + "Filter", + ") => boolean" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37385,12 +39348,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37408,7 +39375,9 @@ "label": "isFilterPinned", "description": [], "signature": [ - "(filter: any) => boolean | undefined" + "(filter: ", + "Filter", + ") => boolean | undefined" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37418,12 +39387,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37441,7 +39414,9 @@ "label": "isFilters", "description": [], "signature": [ - "(x: unknown) => x is any[]" + "(x: unknown) => x is ", + "Filter", + "[]" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37473,6 +39448,519 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-common.isGeoBoundingBoxFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isGeoBoundingBoxFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "GeoBoundingBoxFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/geo_bounding_box_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isGeoPolygonFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isGeoPolygonFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "GeoPolygonFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/geo_polygon_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isMatchAllFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isMatchAllFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "MatchAllFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/match_all_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isMissingFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isMissingFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "MissingFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/missing_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isPhraseFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isPhraseFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "PhraseFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrase_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isPhrasesFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isPhrasesFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "PhrasesFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/phrases_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isQueryStringFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isQueryStringFilter", + "description": [], + "signature": [ + "(filter: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + ") => filter is ", + "QueryStringFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/query_string_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "data", + "id": "def-common.isRangeFilter", + "type": "Function", + "tags": [ + "deprecated" + ], + "label": "isRangeFilter", + "description": [], + "signature": [ + "(filter?: ", + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + " | undefined) => filter is ", + "RangeFilter" + ], + "path": "src/plugins/data/common/es_query/index.ts", + "deprecated": true, + "references": [], + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.filter", + "type": "CompoundType", + "tags": [], + "label": "filter", + "description": [], + "signature": [ + "RangeFilter", + " | ", + "ExistsFilter", + " | ", + "GeoBoundingBoxFilter", + " | ", + "GeoPolygonFilter", + " | ", + "PhraseFilter", + " | ", + "PhrasesFilter", + " | ", + "MatchAllFilter", + " | ", + "MissingFilter", + " | undefined" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/range_filter.d.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-common.luceneStringToDsl", @@ -37517,7 +40005,11 @@ "label": "onlyDisabledFiltersChanged", "description": [], "signature": [ - "(newFilters?: any[] | undefined, oldFilters?: any[] | undefined) => boolean" + "(newFilters?: ", + "Filter", + "[] | undefined, oldFilters?: ", + "Filter", + "[] | undefined) => boolean" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37532,7 +40024,8 @@ "label": "newFilters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/only_disabled.d.ts", "deprecated": false @@ -37545,7 +40038,8 @@ "label": "oldFilters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/only_disabled.d.ts", "deprecated": false @@ -37563,7 +40057,10 @@ "label": "pinFilter", "description": [], "signature": [ - "(filter: any) => any" + "(filter: ", + "Filter", + ") => ", + "Filter" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37573,12 +40070,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37769,7 +40270,11 @@ "label": "toggleFilterDisabled", "description": [], "signature": [ - "(filter: any) => { meta: { disabled: boolean; alias: string | null; negate: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }; $state?: { store: any; } | undefined; query?: any; }" + "(filter: ", + "Filter", + ") => { meta: { disabled: boolean; alias: string | null; negate: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }; $state?: { store: ", + "FilterStateStore", + "; } | undefined; query?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37779,12 +40284,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37802,7 +40311,11 @@ "label": "toggleFilterNegated", "description": [], "signature": [ - "(filter: any) => { meta: { negate: boolean; alias: string | null; disabled: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }; $state?: { store: any; } | undefined; query?: any; }" + "(filter: ", + "Filter", + ") => { meta: { negate: boolean; alias: string | null; disabled: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }; $state?: { store: ", + "FilterStateStore", + "; } | undefined; query?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37812,12 +40325,16 @@ { "parentPluginId": "data", "id": "def-common.filter", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/meta_filter.d.ts", "deprecated": false @@ -37835,7 +40352,11 @@ "label": "uniqFilters", "description": [], "signature": [ - "(filters: any[], comparatorOptions?: any) => any[]" + "(filters: ", + "Filter", + "[], comparatorOptions?: any) => ", + "Filter", + "[]" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -37850,7 +40371,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "node_modules/@kbn/es-query/target_types/filters/helpers/uniq_filters.d.ts", "deprecated": false @@ -37924,19 +40446,23 @@ ], "path": "src/plugins/data/common/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.type", + "id": "def-common.FilterValueFormatter.getConverterFor.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -38226,108 +40752,6 @@ } ], "misc": [ - { - "parentPluginId": "data", - "id": "def-common.buildEmptyFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "buildEmptyFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.buildExistsFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "buildExistsFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.buildPhraseFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "buildPhraseFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.buildPhrasesFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "buildPhrasesFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.buildQueryFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "buildQueryFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.buildRangeFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "buildRangeFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, { "parentPluginId": "data", "id": "def-common.CSV_FORMULA_CHARS", @@ -38366,7 +40790,8 @@ "label": "CustomFilter", "description": [], "signature": [ - "any" + "Filter", + " & { query: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -38431,7 +40856,10 @@ "label": "ExistsFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "FilterMeta", + "; exists?: { field: string; } | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -38469,7 +40897,11 @@ "label": "Filter", "description": [], "signature": [ - "any" + "{ $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40219,7 +42651,7 @@ "label": "FilterMeta", "description": [], "signature": [ - "any" + "{ alias: string | null; disabled: boolean; negate: boolean; controlledBy?: string | undefined; index?: string | undefined; isMultiIndex?: boolean | undefined; type?: string | undefined; key?: string | undefined; params?: any; value?: string | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40245,7 +42677,10 @@ "label": "GeoBoundingBoxFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "GeoBoundingBoxFilterMeta", + "; geo_bounding_box: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40262,7 +42697,10 @@ "label": "GeoPolygonFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "GeoPolygonFilterMeta", + "; geo_polygon: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40283,40 +42721,32 @@ ], "path": "src/plugins/data/common/types.ts", "deprecated": false, - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.getPhraseFilterField", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "getPhraseFilterField", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.getPhraseFilterValue", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "getPhraseFilterValue", - "description": [], - "signature": [ - "any" + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.key", + "type": "string", + "tags": [], + "label": "key", + "description": [], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.defaultOverride", + "type": "Uncategorized", + "tags": [], + "label": "defaultOverride", + "description": [], + "signature": [ + "T | undefined" + ], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + } ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], "initialIsOpen": false }, { @@ -40359,159 +42789,6 @@ "deprecated": false, "initialIsOpen": false }, - { - "parentPluginId": "data", - "id": "def-common.isExistsFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isExistsFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isGeoBoundingBoxFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isGeoBoundingBoxFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isGeoPolygonFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isGeoPolygonFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isMatchAllFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isMatchAllFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isMissingFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isMissingFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isPhraseFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isPhraseFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isPhrasesFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isPhrasesFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isQueryStringFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isQueryStringFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, - { - "parentPluginId": "data", - "id": "def-common.isRangeFilter", - "type": "Any", - "tags": [ - "deprecated" - ], - "label": "isRangeFilter", - "description": [], - "signature": [ - "any" - ], - "path": "src/plugins/data/common/es_query/index.ts", - "deprecated": true, - "references": [], - "initialIsOpen": false - }, { "parentPluginId": "data", "id": "def-common.KIBANA_USER_QUERY_LANGUAGE_KEY", @@ -40858,7 +43135,10 @@ "label": "MatchAllFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "MatchAllFilterMeta", + "; match_all: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40884,7 +43164,10 @@ "label": "MissingFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "FilterMeta", + "; missing: { field: string; }; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40901,7 +43184,10 @@ "label": "PhraseFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "PhraseFilterMeta", + "; script?: { script: { source?: string | undefined; lang?: \"painless\" | \"expression\" | \"mustache\" | \"java\" | undefined; params: { [key: string]: PhraseFilterValue; }; }; } | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40918,13 +43204,30 @@ "label": "PhrasesFilter", "description": [], "signature": [ - "any" + "Filter", + " & { meta: ", + "PhrasesFilterMeta", + "; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, "references": [], "initialIsOpen": false }, + { + "parentPluginId": "data", + "id": "def-common.Query", + "type": "Type", + "tags": [], + "label": "Query", + "description": [], + "signature": [ + "{ query: string | { [key: string]: any; }; language: string; }" + ], + "path": "node_modules/@kbn/es-query/target_types/filters/build_filters/types.d.ts", + "deprecated": false, + "initialIsOpen": false + }, { "parentPluginId": "data", "id": "def-common.RangeFilter", @@ -40935,7 +43238,14 @@ "label": "RangeFilter", "description": [], "signature": [ - "any" + "Filter", + " & ", + "EsRangeFilter", + " & { meta: ", + "RangeFilterMeta", + "; script?: { script: { params: any; lang: ", + "ScriptLanguage", + "; source: string; }; } | undefined; match_all?: any; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40961,7 +43271,10 @@ "label": "RangeFilterMeta", "description": [], "signature": [ - "any" + "FilterMeta", + " & { params: ", + "RangeFilterParams", + "; field?: string | undefined; formattedValue?: string | undefined; }" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, @@ -40978,7 +43291,7 @@ "label": "RangeFilterParams", "description": [], "signature": [ - "any" + "RangeFilterParams" ], "path": "src/plugins/data/common/es_query/index.ts", "deprecated": true, diff --git a/api_docs/data.mdx b/api_docs/data.mdx index d8d9fd6dcb7f8..201d4a23cd9c2 100644 --- a/api_docs/data.mdx +++ b/api_docs/data.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Client diff --git a/api_docs/data_autocomplete.json b/api_docs/data_autocomplete.json index 178d949732bbf..57fe5efbde55a 100644 --- a/api_docs/data_autocomplete.json +++ b/api_docs/data_autocomplete.json @@ -381,6 +381,28 @@ ], "path": "src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-public.args", + "type": "Object", + "tags": [], + "label": "args", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "public", + "docId": "kibDataAutocompletePluginApi", + "section": "def-public.QuerySuggestionGetFnArgs", + "text": "QuerySuggestionGetFnArgs" + } + ], + "path": "src/plugins/data/public/autocomplete/providers/query_suggestion_provider.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/data_autocomplete.mdx b/api_docs/data_autocomplete.mdx index 7127cef253d07..b637beec7a273 100644 --- a/api_docs/data_autocomplete.mdx +++ b/api_docs/data_autocomplete.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Client diff --git a/api_docs/data_field_formats.json b/api_docs/data_field_formats.json index 5e0e4b244d4de..acab018231ec5 100644 --- a/api_docs/data_field_formats.json +++ b/api_docs/data_field_formats.json @@ -3598,6 +3598,32 @@ ], "path": "src/plugins/data/common/field_formats/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.key", + "type": "string", + "tags": [], + "label": "key", + "description": [], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.defaultOverride", + "type": "Uncategorized", + "tags": [], + "label": "defaultOverride", + "description": [], + "signature": [ + "T | undefined" + ], + "path": "src/plugins/data/common/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/data_field_formats.mdx b/api_docs/data_field_formats.mdx index f15408a709240..7aebda56c0461 100644 --- a/api_docs/data_field_formats.mdx +++ b/api_docs/data_field_formats.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Client diff --git a/api_docs/data_index_patterns.json b/api_docs/data_index_patterns.json index 8aca3f6d7f1ec..3badbb04ce527 100644 --- a/api_docs/data_index_patterns.json +++ b/api_docs/data_index_patterns.json @@ -5712,7 +5712,67 @@ ") | undefined" ], "path": "src/plugins/data/common/index_patterns/fields/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.IFieldType.toSpec.$1.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "path": "src/plugins/data/common/index_patterns/fields/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.IFieldType.toSpec.$1.options.getFormatterForField", + "type": "Function", + "tags": [], + "label": "getFormatterForField", + "description": [], + "signature": [ + "((field: ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IFieldType", + "text": "IFieldType" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IndexPatternField", + "text": "IndexPatternField" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.FieldSpec", + "text": "FieldSpec" + }, + ") => ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataFieldFormatsPluginApi", + "section": "def-common.FieldFormat", + "text": "FieldFormat" + }, + ") | undefined" + ], + "path": "src/plugins/data/common/index_patterns/fields/types.ts", + "deprecated": false + } + ] + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -5740,18 +5800,6 @@ "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": true, "references": [ - { - "plugin": "savedObjects", - "path": "src/plugins/saved_objects/public/types.ts" - }, - { - "plugin": "savedObjects", - "path": "src/plugins/saved_objects/public/types.ts" - }, - { - "plugin": "savedObjects", - "path": "src/plugins/saved_objects/public/types.ts" - }, { "plugin": "observability", "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts" @@ -6472,14 +6520,6 @@ "plugin": "observability", "path": "x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts" }, - { - "plugin": "maps", - "path": "x-pack/plugins/maps/public/embeddable/types.ts" - }, - { - "plugin": "maps", - "path": "x-pack/plugins/maps/public/embeddable/types.ts" - }, { "plugin": "ml", "path": "x-pack/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts" @@ -6741,7 +6781,46 @@ ") | undefined" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.IIndexPattern.getFormatterForField.$1", + "type": "CompoundType", + "tags": [], + "label": "field", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IFieldType", + "text": "IFieldType" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IndexPatternField", + "text": "IndexPatternField" + }, + " | ", + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.FieldSpec", + "text": "FieldSpec" + } + ], + "path": "src/plugins/data/common/index_patterns/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -7211,11 +7290,10 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.options", + "id": "def-common.IIndexPatternsApiClient.getFieldsForTimePattern.$1", "type": "Object", "tags": [], "label": "options", @@ -7230,9 +7308,11 @@ } ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -7254,11 +7334,10 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.options", + "id": "def-common.IIndexPatternsApiClient.getFieldsForWildcard.$1", "type": "Object", "tags": [], "label": "options", @@ -7273,9 +7352,11 @@ } ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -7780,11 +7861,10 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.options", + "id": "def-common.SavedObjectsClientCommon.find.$1", "type": "Object", "tags": [], "label": "options", @@ -7799,9 +7879,11 @@ } ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -7817,29 +7899,37 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.type", + "id": "def-common.SavedObjectsClientCommon.get.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.id", + "id": "def-common.SavedObjectsClientCommon.get.$2", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -7855,55 +7945,65 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.type", + "id": "def-common.SavedObjectsClientCommon.update.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.id", + "id": "def-common.SavedObjectsClientCommon.update.$2", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.attributes", + "id": "def-common.SavedObjectsClientCommon.update.$3", "type": "Object", "tags": [], "label": "attributes", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.options", + "id": "def-common.SavedObjectsClientCommon.update.$4", "type": "Object", "tags": [], "label": "options", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -7919,45 +8019,51 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.type", + "id": "def-common.SavedObjectsClientCommon.create.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.attributes", + "id": "def-common.SavedObjectsClientCommon.create.$2", "type": "Object", "tags": [], "label": "attributes", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.options", + "id": "def-common.SavedObjectsClientCommon.create.$3", "type": "Object", "tags": [], "label": "options", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -7971,29 +8077,37 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.type", + "id": "def-common.SavedObjectsClientCommon.delete.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.id", + "id": "def-common.SavedObjectsClientCommon.delete.$2", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -8160,19 +8274,23 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.UiSettingsCommon.get.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -8186,8 +8304,8 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -8201,21 +8319,24 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.UiSettingsCommon.set.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.value", + "id": "def-common.UiSettingsCommon.set.$2", "type": "Any", "tags": [], "label": "value", @@ -8224,9 +8345,11 @@ "any" ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -8240,19 +8363,23 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.UiSettingsCommon.remove.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/index_patterns/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -8585,6 +8712,41 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.error", + "type": "Object", + "tags": [], + "label": "error", + "description": [], + "signature": [ + "Error" + ], + "path": "src/plugins/data/common/index_patterns/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.toastInputFields", + "type": "Object", + "tags": [], + "label": "toastInputFields", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.ErrorToastOptions", + "text": "ErrorToastOptions" + } + ], + "path": "src/plugins/data/common/index_patterns/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -8607,6 +8769,40 @@ ], "path": "src/plugins/data/common/index_patterns/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.toastInputFields", + "type": "CompoundType", + "tags": [], + "label": "toastInputFields", + "description": [], + "signature": [ + "Pick<", + "Toast", + ", \"children\" | \"onClick\" | \"onChange\" | \"color\" | \"onKeyDown\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"className\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"hidden\" | \"lang\" | \"placeholder\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"security\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onError\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"toastLifeTimeMs\" | \"iconType\" | \"onClose\" | \"data-test-subj\"> & { title?: string | ", + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.MountPoint", + "text": "MountPoint" + }, + " | undefined; text?: string | ", + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.MountPoint", + "text": "MountPoint" + }, + " | undefined; }" + ], + "path": "src/plugins/data/common/index_patterns/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/data_index_patterns.mdx b/api_docs/data_index_patterns.mdx index 25465d70f5e2a..e4430947ed163 100644 --- a/api_docs/data_index_patterns.mdx +++ b/api_docs/data_index_patterns.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Server diff --git a/api_docs/data_query.json b/api_docs/data_query.json index 597775b540df3..3ed8cc6ab9f02 100644 --- a/api_docs/data_query.json +++ b/api_docs/data_query.json @@ -82,7 +82,9 @@ "label": "getFilters", "description": [], "signature": [ - "() => any[]" + "() => ", + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -97,7 +99,9 @@ "label": "getAppFilters", "description": [], "signature": [ - "() => any[]" + "() => ", + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -112,7 +116,9 @@ "label": "getGlobalFilters", "description": [], "signature": [ - "() => any[]" + "() => ", + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -177,7 +183,11 @@ "label": "addFilters", "description": [], "signature": [ - "(filters: any, pinFilterStatus?: boolean) => void" + "(filters: ", + "Filter", + " | ", + "Filter", + "[], pinFilterStatus?: boolean) => void" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -185,12 +195,15 @@ { "parentPluginId": "data", "id": "def-public.FilterManager.addFilters.$1", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filters", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -221,7 +234,9 @@ "label": "setFilters", "description": [], "signature": [ - "(newFilters: any[], pinFilterStatus?: boolean) => void" + "(newFilters: ", + "Filter", + "[], pinFilterStatus?: boolean) => void" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -234,7 +249,8 @@ "label": "newFilters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -267,7 +283,9 @@ "\nSets new global filters and leaves app filters untouched,\nRemoves app filters for which there is a duplicate within new global filters" ], "signature": [ - "(newGlobalFilters: any[]) => void" + "(newGlobalFilters: ", + "Filter", + "[]) => void" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -280,7 +298,8 @@ "label": "newGlobalFilters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -299,7 +318,9 @@ "\nSets new app filters and leaves global filters untouched,\nRemoves app filters for which there is a duplicate within new global filters" ], "signature": [ - "(newAppFilters: any[]) => void" + "(newAppFilters: ", + "Filter", + "[]) => void" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -312,7 +333,8 @@ "label": "newAppFilters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -329,7 +351,9 @@ "label": "removeFilter", "description": [], "signature": [ - "(filter: any) => void" + "(filter: ", + "Filter", + ") => void" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -337,12 +361,12 @@ { "parentPluginId": "data", "id": "def-public.FilterManager.removeFilter.$1", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "Filter" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -374,7 +398,9 @@ "label": "setFiltersStore", "description": [], "signature": [ - "(filters: any[], store: ", + "(filters: ", + "Filter", + "[], store: ", "FilterStateStore", ", shouldOverrideStore?: boolean) => void" ], @@ -389,7 +415,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/filter_manager.ts", "deprecated": false, @@ -678,7 +705,9 @@ "section": "def-public.QueryState", "text": "QueryState" }, - ">({ timefilter: { timefilter }, filterManager, queryString, state$, }: Pick<{ addToQueryLog: (appName: string, { language, query }: any) => void; filterManager: ", + ">({ timefilter: { timefilter }, filterManager, queryString, state$, }: Pick<{ addToQueryLog: (appName: string, { language, query }: ", + "Query", + ") => void; filterManager: ", { "pluginId": "data", "scope": "public", @@ -734,7 +763,11 @@ }, " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }; } | { filterManager: ", + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }; } | { filterManager: ", { "pluginId": "data", "scope": "public", @@ -787,7 +820,9 @@ "label": "{\n timefilter: { timefilter },\n filterManager,\n queryString,\n state$,\n }", "description": [], "signature": [ - "Pick<{ addToQueryLog: (appName: string, { language, query }: any) => void; filterManager: ", + "Pick<{ addToQueryLog: (appName: string, { language, query }: ", + "Query", + ") => void; filterManager: ", { "pluginId": "data", "scope": "public", @@ -843,7 +878,11 @@ }, " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }; } | { filterManager: ", + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }; } | { filterManager: ", { "pluginId": "data", "scope": "public", @@ -1034,7 +1073,11 @@ "label": "extractTimeRange", "description": [], "signature": [ - "(filters: any[], timeFieldName: string | undefined) => { restOfFilters: any[]; timeRange?: ", + "(filters: ", + "Filter", + "[], timeFieldName: string | undefined) => { restOfFilters: ", + "Filter", + "[]; timeRange?: ", { "pluginId": "data", "scope": "common", @@ -1055,7 +1098,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "src/plugins/data/public/query/timefilter/lib/extract_time_filter.ts", "deprecated": false, @@ -1105,7 +1149,9 @@ "section": "def-common.IFieldType", "text": "IFieldType" }, - ", values: any, operation: string, index: string) => any[]" + ", values: any, operation: string, index: string) => ", + "Filter", + "[]" ], "path": "src/plugins/data/public/query/filter_manager/lib/generate_filters.ts", "deprecated": false, @@ -1252,7 +1298,9 @@ "label": "getDisplayValueFromFilter", "description": [], "signature": [ - "(filter: any, indexPatterns: ", + "(filter: ", + "Filter", + ", indexPatterns: ", { "pluginId": "data", "scope": "common", @@ -1268,12 +1316,12 @@ { "parentPluginId": "data", "id": "def-public.getDisplayValueFromFilter.$1", - "type": "Any", + "type": "Object", "tags": [], "label": "filter", "description": [], "signature": [ - "any" + "Filter" ], "path": "src/plugins/data/public/query/filter_manager/lib/get_display_value.ts", "deprecated": false, @@ -1314,7 +1362,9 @@ "\nHelper to setup syncing of global data with the URL" ], "signature": [ - "(query: Pick<{ addToQueryLog: (appName: string, { language, query }: any) => void; filterManager: ", + "(query: Pick<{ addToQueryLog: (appName: string, { language, query }: ", + "Query", + ") => void; filterManager: ", { "pluginId": "data", "scope": "public", @@ -1370,7 +1420,11 @@ }, " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }; } | { filterManager: ", + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }; } | { filterManager: ", { "pluginId": "data", "scope": "public", @@ -1421,7 +1475,9 @@ "label": "query", "description": [], "signature": [ - "Pick<{ addToQueryLog: (appName: string, { language, query }: any) => void; filterManager: ", + "Pick<{ addToQueryLog: (appName: string, { language, query }: ", + "Query", + ") => void; filterManager: ", { "pluginId": "data", "scope": "public", @@ -1477,7 +1533,11 @@ }, " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }; } | { filterManager: ", + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }; } | { filterManager: ", { "pluginId": "data", "scope": "public", @@ -1601,7 +1661,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/data/public/query/state_sync/types.ts", "deprecated": false @@ -1609,12 +1670,13 @@ { "parentPluginId": "data", "id": "def-public.QueryState.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/data/public/query/state_sync/types.ts", "deprecated": false @@ -1739,11 +1801,10 @@ ], "path": "src/plugins/data/public/query/saved_query/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.attributes", + "id": "def-public.SavedQueryService.saveQuery.$1", "type": "Object", "tags": [], "label": "attributes", @@ -1752,22 +1813,33 @@ "SavedQueryAttributes" ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-public.config", + "id": "def-public.SavedQueryService.saveQuery.$2.config", "type": "Object", "tags": [], "label": "config", "description": [], - "signature": [ - "{ overwrite: boolean; } | undefined" - ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.SavedQueryService.saveQuery.$2.config.overwrite", + "type": "boolean", + "tags": [], + "label": "overwrite", + "description": [], + "path": "src/plugins/data/public/query/saved_query/types.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -1789,8 +1861,8 @@ ], "path": "src/plugins/data/public/query/saved_query/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -1812,11 +1884,10 @@ ], "path": "src/plugins/data/public/query/saved_query/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.searchText", + "id": "def-public.SavedQueryService.findSavedQueries.$1", "type": "string", "tags": [], "label": "searchText", @@ -1825,11 +1896,12 @@ "string | undefined" ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "data", - "id": "def-public.perPage", + "id": "def-public.SavedQueryService.findSavedQueries.$2", "type": "number", "tags": [], "label": "perPage", @@ -1838,11 +1910,12 @@ "number | undefined" ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "data", - "id": "def-public.activePage", + "id": "def-public.SavedQueryService.findSavedQueries.$3", "type": "number", "tags": [], "label": "activePage", @@ -1851,9 +1924,11 @@ "number | undefined" ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -1875,19 +1950,23 @@ ], "path": "src/plugins/data/public/query/saved_query/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.id", + "id": "def-public.SavedQueryService.getSavedQuery.$1", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -1901,19 +1980,23 @@ ], "path": "src/plugins/data/public/query/saved_query/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.id", + "id": "def-public.SavedQueryService.deleteSavedQuery.$1", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/public/query/saved_query/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -1927,8 +2010,8 @@ ], "path": "src/plugins/data/public/query/saved_query/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1948,6 +2031,8 @@ ], "path": "src/plugins/data/public/query/timefilter/lib/auto_refresh_loop.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -1979,7 +2064,9 @@ "label": "QueryStart", "description": [], "signature": [ - "{ addToQueryLog: (appName: string, { language, query }: any) => void; filterManager: ", + "{ addToQueryLog: (appName: string, { language, query }: ", + "Query", + ") => void; filterManager: ", { "pluginId": "data", "scope": "public", @@ -2035,7 +2122,11 @@ }, " | undefined) => { bool: { must: ", "DslQuery", - "[]; filter: any[]; should: never[]; must_not: any[]; }; }; }" + "[]; filter: ", + "Filter", + "[]; should: never[]; must_not: ", + "Filter", + "[]; }; }; }" ], "path": "src/plugins/data/public/query/query_service.ts", "deprecated": false, @@ -2152,7 +2243,9 @@ "section": "def-common.TimeRange", "text": "TimeRange" }, - " | undefined) => any; getBounds: () => ", + " | undefined) => ", + "RangeFilter", + " | undefined; getBounds: () => ", { "pluginId": "data", "scope": "common", @@ -2417,7 +2510,9 @@ "section": "def-common.TimeRange", "text": "TimeRange" }, - ", options: { forceNow?: Date | undefined; fieldName?: string | undefined; } | undefined) => any" + ", options: { forceNow?: Date | undefined; fieldName?: string | undefined; } | undefined) => ", + "RangeFilter", + " | undefined" ], "path": "src/plugins/data/common/query/timefilter/get_time.ts", "deprecated": false, @@ -2513,7 +2608,8 @@ "label": "isQuery", "description": [], "signature": [ - "(x: unknown) => x is any" + "(x: unknown) => x is ", + "Query" ], "path": "src/plugins/data/common/query/is_query.ts", "deprecated": false, diff --git a/api_docs/data_query.mdx b/api_docs/data_query.mdx index 2c58a8895cc27..f920798fd8b93 100644 --- a/api_docs/data_query.mdx +++ b/api_docs/data_query.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Client diff --git a/api_docs/data_search.json b/api_docs/data_search.json index 2ff9a049552aa..d6006dc315db1 100644 --- a/api_docs/data_search.json +++ b/api_docs/data_search.json @@ -1055,11 +1055,10 @@ ], "path": "src/plugins/data/public/search/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-public.e", + "id": "def-public.ISearchStart.showError.$1", "type": "Object", "tags": [], "label": "e", @@ -1068,9 +1067,11 @@ "Error" ], "path": "src/plugins/data/public/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -1681,8 +1682,8 @@ ], "path": "src/plugins/data/public/search/session/session_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -1727,8 +1728,8 @@ ], "path": "src/plugins/data/public/search/session/session_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -2788,11 +2789,10 @@ ], "path": "src/plugins/data/server/search/session/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-server.core", + "id": "def-server.ISearchSessionService.asScopedProvider.$1", "type": "Object", "tags": [], "label": "core", @@ -2807,9 +2807,11 @@ } ], "path": "src/plugins/data/server/search/session/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -2891,21 +2893,24 @@ ], "path": "src/plugins/data/server/search/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-server.name", + "id": "def-server.ISearchSetup.registerSearchStrategy.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-server.strategy", + "id": "def-server.ISearchSetup.registerSearchStrategy.$2", "type": "Object", "tags": [], "label": "strategy", @@ -2921,9 +2926,11 @@ "" ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -3043,11 +3050,10 @@ ], "path": "src/plugins/data/server/search/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-server.name", + "id": "def-server.ISearchStart.getSearchStrategy.$1", "type": "string", "tags": [], "label": "name", @@ -3056,9 +3062,11 @@ "string | undefined" ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -3087,11 +3095,10 @@ ], "path": "src/plugins/data/server/search/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-server.request", + "id": "def-server.ISearchStart.asScoped.$1", "type": "Object", "tags": [], "label": "request", @@ -3107,9 +3114,11 @@ "" ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -3195,11 +3204,10 @@ ], "path": "src/plugins/data/server/search/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-server.request", + "id": "def-server.ISearchStrategy.search.$1", "type": "Uncategorized", "tags": [], "label": "request", @@ -3208,11 +3216,12 @@ "SearchStrategyRequest" ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-server.options", + "id": "def-server.ISearchStrategy.search.$2", "type": "Object", "tags": [], "label": "options", @@ -3227,11 +3236,12 @@ } ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-server.deps", + "id": "def-server.ISearchStrategy.search.$3", "type": "Object", "tags": [], "label": "deps", @@ -3246,9 +3256,11 @@ } ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -3277,7 +3289,64 @@ ") => Promise) | undefined" ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.cancel.$1", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.cancel.$2", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ISearchOptions", + "text": "ISearchOptions" + } + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.cancel.$3", + "type": "Object", + "tags": [], + "label": "deps", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "server", + "docId": "kibDataSearchPluginApi", + "section": "def-server.SearchStrategyDependencies", + "text": "SearchStrategyDependencies" + } + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -3306,7 +3375,78 @@ ") => Promise) | undefined" ], "path": "src/plugins/data/server/search/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.extend.$1", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.extend.$2", + "type": "string", + "tags": [], + "label": "keepAlive", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.extend.$3", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ISearchOptions", + "text": "ISearchOptions" + } + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-server.ISearchStrategy.extend.$4", + "type": "Object", + "tags": [], + "label": "deps", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "server", + "docId": "kibDataSearchPluginApi", + "section": "def-server.SearchStrategyDependencies", + "text": "SearchStrategyDependencies" + } + ], + "path": "src/plugins/data/server/search/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -5766,7 +5906,9 @@ "label": "getSearchSourceTimeFilter", "description": [], "signature": [ - "(forceNow?: Date | undefined) => any[]" + "(forceNow?: Date | undefined) => ", + "RangeFilter", + "[] | { meta: { index: string | undefined; params: {}; alias: string; disabled: boolean; negate: boolean; }; query: { bool: { should: { bool: { filter: { range: { [x: string]: { gte: string; lte: string; }; }; }[]; }; }[]; minimum_should_match: number; }; }; }[]" ], "path": "src/plugins/data/common/search/aggs/agg_configs.ts", "deprecated": false, @@ -11032,7 +11174,11 @@ "label": "filtersToAst", "description": [], "signature": [ - "(filters: any) => ", + "(filters: ", + "Filter", + " | ", + "Filter", + "[]) => ", { "pluginId": "expressions", "scope": "common", @@ -11048,12 +11194,15 @@ { "parentPluginId": "data", "id": "def-common.filtersToAst.$1", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filters", "description": [], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[]" ], "path": "src/plugins/data/common/search/expressions/filters_to_ast.ts", "deprecated": false, @@ -11782,11 +11931,10 @@ ], "path": "src/plugins/data/common/search/expressions/esdsl.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.getKibanaRequest", + "id": "def-common.getEsdslFn.$1.getStartDependencies.getStartDependencies.$1", "type": "Any", "tags": [], "label": "getKibanaRequest", @@ -11795,9 +11943,11 @@ "any" ], "path": "src/plugins/data/common/search/expressions/esdsl.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ] } @@ -11856,19 +12006,23 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/filter.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.getFilterBucketAgg.$1.getConfig.getConfig.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/search/aggs/buckets/filter.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ] } @@ -14185,7 +14339,9 @@ "label": "queryToAst", "description": [], "signature": [ - "(query: any) => ", + "(query: ", + "Query", + ") => ", { "pluginId": "expressions", "scope": "common", @@ -14200,12 +14356,12 @@ { "parentPluginId": "data", "id": "def-common.queryToAst.$1", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [], "signature": [ - "any" + "Query" ], "path": "src/plugins/data/common/search/expressions/query_to_ast.ts", "deprecated": false, @@ -14695,7 +14851,17 @@ "section": "def-common.GeoPoint", "text": "GeoPoint" }, - "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: any; }, \"filter\" | \"geo_bounding_box\"> & Pick<{ geo_bounding_box?: ({ type: \"geo_bounding_box\"; } & GeoBox) | ({ type: \"geo_bounding_box\"; } & { top_left: ", + "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + "> | undefined; }, \"filter\" | \"geo_bounding_box\"> & Pick<{ geo_bounding_box?: ({ type: \"geo_bounding_box\"; } & GeoBox) | ({ type: \"geo_bounding_box\"; } & { top_left: ", { "pluginId": "data", "scope": "common", @@ -14727,7 +14893,17 @@ "section": "def-common.GeoPoint", "text": "GeoPoint" }, - "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: any; }, never>, \"enabled\" | \"id\" | \"filter\" | \"customLabel\" | \"schema\" | \"geo_bounding_box\" | \"json\" | \"timeShift\">, ", + "; }) | ({ type: \"geo_bounding_box\"; } & WellKnownText) | undefined; filter?: ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + "> | undefined; }, never>, \"enabled\" | \"id\" | \"filter\" | \"customLabel\" | \"schema\" | \"geo_bounding_box\" | \"json\" | \"timeShift\">, ", "AggExpressionType", ", ", { @@ -19101,36 +19277,81 @@ "((aggConfig: TAggConfig, key: any, params?: any) => any) | undefined" ], "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.createFilter.$1", + "type": "Uncategorized", + "tags": [], + "label": "aggConfig", + "description": [], + "signature": [ + "TAggConfig" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.createFilter.$2", + "type": "Any", + "tags": [], + "label": "key", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.createFilter.$3", + "type": "Any", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.type", + "type": "string", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.dslName", + "type": "string", + "tags": [], + "label": "dslName", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", "deprecated": false }, { "parentPluginId": "data", - "id": "def-common.AggTypeConfig.type", - "type": "string", - "tags": [], - "label": "type", - "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false - }, - { - "parentPluginId": "data", - "id": "def-common.AggTypeConfig.dslName", - "type": "string", - "tags": [], - "label": "dslName", - "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false - }, - { - "parentPluginId": "data", "id": "def-common.AggTypeConfig.expressionName", "type": "string", "tags": [], @@ -19280,7 +19501,9 @@ "(() => any) | undefined" ], "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -19314,7 +19537,24 @@ ">) | undefined" ], "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getSerializedFormat.$1", + "type": "Uncategorized", + "tags": [], + "label": "agg", + "description": [], + "signature": [ + "TAggConfig" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -19327,7 +19567,38 @@ "((agg: TAggConfig, bucket: any) => any) | undefined" ], "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getValue.$1", + "type": "Uncategorized", + "tags": [], + "label": "agg", + "description": [], + "signature": [ + "TAggConfig" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getValue.$2", + "type": "Any", + "tags": [], + "label": "bucket", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -19340,7 +19611,52 @@ "((bucket: any, key: any, agg: TAggConfig) => any) | undefined" ], "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getKey.$1", + "type": "Any", + "tags": [], + "label": "bucket", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getKey.$2", + "type": "Any", + "tags": [], + "label": "key", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getKey.$3", + "type": "Uncategorized", + "tags": [], + "label": "agg", + "description": [], + "signature": [ + "TAggConfig" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -19353,7 +19669,24 @@ "((agg: TAggConfig) => string) | undefined" ], "path": "src/plugins/data/common/search/aggs/agg_type.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-common.AggTypeConfig.getValueBucketPath.$1", + "type": "Uncategorized", + "tags": [], + "label": "agg", + "description": [], + "signature": [ + "TAggConfig" + ], + "path": "src/plugins/data/common/search/aggs/agg_type.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -19576,8 +19909,8 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -19591,19 +19924,23 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.DateHistogramBucketAggDependencies.getConfig.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/search/aggs/buckets/date_histogram.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -19669,8 +20006,8 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/date_range.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -19684,19 +20021,23 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/date_range.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.DateRangeBucketAggDependencies.getConfig.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/search/aggs/buckets/date_range.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -19922,24 +20263,24 @@ ], "path": "src/plugins/data/common/search/search_source/fetch/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.request", + "id": "def-common.FetchHandlers.onResponse.$1", "type": "Object", "tags": [], "label": "request", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/data/common/search/search_source/fetch/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.response", + "id": "def-common.FetchHandlers.onResponse.$2", "type": "Object", "tags": [], "label": "response", @@ -19955,9 +20296,11 @@ "" ], "path": "src/plugins/data/common/search/search_source/fetch/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -19984,19 +20327,23 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/filters.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.FiltersBucketAggDependencies.getConfig.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/search/aggs/buckets/filters.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -20023,19 +20370,23 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/histogram.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.key", + "id": "def-common.HistogramBucketAggDependencies.getConfig.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/search/aggs/buckets/histogram.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -20256,11 +20607,10 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/histogram.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.bounds", + "id": "def-common.IBucketHistogramAggConfig.setAutoBounds.$1", "type": "Object", "tags": [], "label": "bounds", @@ -20275,9 +20625,11 @@ } ], "path": "src/plugins/data/common/search/aggs/buckets/histogram.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -20298,8 +20650,8 @@ ], "path": "src/plugins/data/common/search/aggs/buckets/histogram.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -21124,11 +21476,10 @@ ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.fields", + "id": "def-common.ISearchStartSearchSource.create.$1", "type": "Object", "tags": [], "label": "fields", @@ -21144,9 +21495,11 @@ " | undefined" ], "path": "src/plugins/data/common/search/search_source/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -21170,8 +21523,8 @@ ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -21209,21 +21562,24 @@ ], "path": "src/plugins/data/common/search/aggs/metrics/std_deviation.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.customLabel", + "id": "def-common.IStdDevAggConfig.keyedDetails.$1", "type": "string", "tags": [], "label": "customLabel", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/data/common/search/aggs/metrics/std_deviation.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "data", - "id": "def-common.fieldDisplayName", + "id": "def-common.IStdDevAggConfig.keyedDetails.$2", "type": "string", "tags": [], "label": "fieldDisplayName", @@ -21232,9 +21588,11 @@ "string | undefined" ], "path": "src/plugins/data/common/search/aggs/metrics/std_deviation.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -21248,8 +21606,8 @@ ], "path": "src/plugins/data/common/search/aggs/metrics/std_deviation.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -21484,11 +21842,10 @@ ], "path": "src/plugins/data/common/search/aggs/param_types/optioned.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "data", - "id": "def-common.agg", + "id": "def-common.OptionedValueProp.isCompatible.$1", "type": "Object", "tags": [], "label": "agg", @@ -21503,9 +21860,11 @@ } ], "path": "src/plugins/data/common/search/aggs/param_types/optioned.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -21559,12 +21918,12 @@ { "parentPluginId": "data", "id": "def-common.QueryFilter.input", - "type": "Any", + "type": "Object", "tags": [], "label": "input", "description": [], "signature": [ - "any" + "{ query: string | { [key: string]: any; }; language: string; }" ], "path": "src/plugins/data/common/search/expressions/query_filter.ts", "deprecated": false @@ -22414,14 +22773,15 @@ { "parentPluginId": "data", "id": "def-common.SearchSourceFields.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [ "\n{@link Query}" ], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false @@ -22429,14 +22789,21 @@ { "parentPluginId": "data", "id": "def-common.SearchSourceFields.filter", - "type": "Any", + "type": "CompoundType", "tags": [], "label": "filter", "description": [ "\n{@link Filter}" ], "signature": [ - "any" + "Filter", + " | ", + "Filter", + "[] | (() => ", + "Filter", + " | ", + "Filter", + "[] | undefined) | undefined" ], "path": "src/plugins/data/common/search/search_source/types.ts", "deprecated": false @@ -24132,7 +24499,13 @@ "label": "ExecutionContextSearch", "description": [], "signature": [ - "{ filters?: any[] | undefined; query?: any; timeRange?: ", + "{ filters?: ", + "Filter", + "[] | undefined; query?: ", + "Query", + " | ", + "Query", + "[] | undefined; timeRange?: ", { "pluginId": "data", "scope": "common", @@ -24287,7 +24660,17 @@ "section": "def-common.ExpressionFunctionDefinition", "text": "ExpressionFunctionDefinition" }, - "<\"existsFilter\", null, Arguments, any, ", + "<\"existsFilter\", null, Arguments, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_filter\", ", + "Filter", + ">, ", { "pluginId": "expressions", "scope": "common", @@ -24739,7 +25122,17 @@ "section": "def-common.ExpressionFunctionDefinition", "text": "ExpressionFunctionDefinition" }, - "<\"kibanaFilter\", null, Arguments, any, ", + "<\"kibanaFilter\", null, Arguments, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_filter\", ", + "Filter", + ">, ", { "pluginId": "expressions", "scope": "common", @@ -24841,7 +25234,17 @@ "section": "def-common.ExpressionFunctionDefinition", "text": "ExpressionFunctionDefinition" }, - "<\"kql\", null, Arguments, any, ", + "<\"kql\", null, Arguments, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + ">, ", { "pluginId": "expressions", "scope": "common", @@ -24880,7 +25283,17 @@ "section": "def-common.ExpressionFunctionDefinition", "text": "ExpressionFunctionDefinition" }, - "<\"lucene\", null, Arguments, any, ", + "<\"lucene\", null, Arguments, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_query\", ", + "Query", + ">, ", { "pluginId": "expressions", "scope": "common", @@ -24982,7 +25395,17 @@ "section": "def-common.ExpressionFunctionDefinition", "text": "ExpressionFunctionDefinition" }, - "<\"rangeFilter\", null, Arguments, any, ", + "<\"rangeFilter\", null, Arguments, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_filter\", ", + "Filter", + ">, ", { "pluginId": "expressions", "scope": "common", @@ -25123,7 +25546,17 @@ "section": "def-common.ExpressionFunctionDefinition", "text": "ExpressionFunctionDefinition" }, - "<\"rangeFilter\", null, Arguments, any, ", + "<\"rangeFilter\", null, Arguments, ", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueBoxed", + "text": "ExpressionValueBoxed" + }, + "<\"kibana_filter\", ", + "Filter", + ">, ", { "pluginId": "expressions", "scope": "common", @@ -25673,6 +26106,39 @@ ], "path": "src/plugins/data/common/search/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.id", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ISearchOptions", + "text": "ISearchOptions" + }, + " | undefined" + ], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -25695,6 +26161,49 @@ ], "path": "src/plugins/data/common/search/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.id", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.keepAlive", + "type": "string", + "tags": [], + "label": "keepAlive", + "description": [], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ISearchOptions", + "text": "ISearchOptions" + }, + " | undefined" + ], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -25751,6 +26260,42 @@ ], "path": "src/plugins/data/common/search/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "data", + "id": "def-common.request", + "type": "Uncategorized", + "tags": [], + "label": "request", + "description": [], + "signature": [ + "SearchStrategyRequest" + ], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + }, + { + "parentPluginId": "data", + "id": "def-common.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataSearchPluginApi", + "section": "def-common.ISearchOptions", + "text": "ISearchOptions" + }, + " | undefined" + ], + "path": "src/plugins/data/common/search/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -26042,7 +26587,8 @@ "label": "KibanaFilter", "description": [], "signature": [ - "any" + "{ type: \"kibana_filter\"; } & ", + "Filter" ], "path": "src/plugins/data/common/search/expressions/kibana_context_type.ts", "deprecated": false, @@ -26056,7 +26602,8 @@ "label": "KibanaQueryOutput", "description": [], "signature": [ - "any" + "{ type: \"kibana_query\"; } & ", + "Query" ], "path": "src/plugins/data/common/search/expressions/kibana_context_type.ts", "deprecated": false, @@ -26787,6 +27334,9 @@ "tags": [], "label": "type", "description": [], + "signature": [ + "\"kibana_filter\"" + ], "path": "src/plugins/data/common/search/expressions/exists_filter.ts", "deprecated": false }, @@ -26929,7 +27479,11 @@ "label": "fn", "description": [], "signature": [ - "(input: null, args: Arguments) => any" + "(input: null, args: Arguments) => { $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; type: \"kibana_filter\"; }" ], "path": "src/plugins/data/common/search/expressions/exists_filter.ts", "deprecated": false, @@ -28678,6 +29232,9 @@ "tags": [], "label": "type", "description": [], + "signature": [ + "\"kibana_filter\"" + ], "path": "src/plugins/data/common/search/expressions/kibana_filter.ts", "deprecated": false }, @@ -29226,6 +29783,9 @@ "tags": [], "label": "type", "description": [], + "signature": [ + "\"kibana_query\"" + ], "path": "src/plugins/data/common/search/expressions/kql.ts", "deprecated": false }, @@ -29333,7 +29893,7 @@ "label": "fn", "description": [], "signature": [ - "(input: null, args: Arguments) => { type: string; language: string; query: string; }" + "(input: null, args: Arguments) => { type: \"kibana_query\"; language: string; query: string; }" ], "path": "src/plugins/data/common/search/expressions/kql.ts", "deprecated": false, @@ -29402,6 +29962,9 @@ "tags": [], "label": "type", "description": [], + "signature": [ + "\"kibana_query\"" + ], "path": "src/plugins/data/common/search/expressions/lucene.ts", "deprecated": false }, @@ -29509,7 +30072,7 @@ "label": "fn", "description": [], "signature": [ - "(input: null, args: Arguments) => { type: string; language: string; query: any; }" + "(input: null, args: Arguments) => { type: \"kibana_query\"; language: string; query: any; }" ], "path": "src/plugins/data/common/search/expressions/lucene.ts", "deprecated": false, @@ -30037,6 +30600,9 @@ "tags": [], "label": "type", "description": [], + "signature": [ + "\"kibana_filter\"" + ], "path": "src/plugins/data/common/search/expressions/phrase_filter.ts", "deprecated": false }, @@ -30240,7 +30806,11 @@ "label": "fn", "description": [], "signature": [ - "(input: null, args: Arguments) => any" + "(input: null, args: Arguments) => { $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; type: \"kibana_filter\"; }" ], "path": "src/plugins/data/common/search/expressions/phrase_filter.ts", "deprecated": false, @@ -30539,6 +31109,9 @@ "tags": [], "label": "type", "description": [], + "signature": [ + "\"kibana_filter\"" + ], "path": "src/plugins/data/common/search/expressions/range_filter.ts", "deprecated": false }, @@ -30729,7 +31302,11 @@ "label": "fn", "description": [], "signature": [ - "(input: null, args: Arguments) => any" + "(input: null, args: Arguments) => { $state?: { store: ", + "FilterStateStore", + "; } | undefined; meta: ", + "FilterMeta", + "; query?: any; type: \"kibana_filter\"; }" ], "path": "src/plugins/data/common/search/expressions/range_filter.ts", "deprecated": false, diff --git a/api_docs/data_search.mdx b/api_docs/data_search.mdx index e8afc4da7cce2..16970fe094d46 100644 --- a/api_docs/data_search.mdx +++ b/api_docs/data_search.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Client diff --git a/api_docs/data_ui.json b/api_docs/data_ui.json index b46ad04dd1e87..35a017b2bd592 100644 --- a/api_docs/data_ui.json +++ b/api_docs/data_ui.json @@ -150,12 +150,12 @@ { "parentPluginId": "data", "id": "def-public.QueryStringInputProps.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [], "signature": [ - "any" + "{ query: string | { [key: string]: any; }; language: string; }" ], "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", "deprecated": false @@ -276,7 +276,9 @@ "(() => void) | undefined" ], "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "data", @@ -286,10 +288,29 @@ "label": "onChange", "description": [], "signature": [ - "((query: any) => void) | undefined" + "((query: ", + "Query", + ") => void) | undefined" ], "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.QueryStringInputProps.onChange.$1", + "type": "Object", + "tags": [], + "label": "query", + "description": [], + "signature": [ + "Query" + ], + "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -302,7 +323,24 @@ "((isFocused: boolean) => void) | undefined" ], "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.QueryStringInputProps.onChangeQueryInputFocus.$1", + "type": "boolean", + "tags": [], + "label": "isFocused", + "description": [], + "signature": [ + "boolean" + ], + "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", @@ -312,10 +350,29 @@ "label": "onSubmit", "description": [], "signature": [ - "((query: any) => void) | undefined" + "((query: ", + "Query", + ") => void) | undefined" ], "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "data", + "id": "def-public.QueryStringInputProps.onSubmit.$1", + "type": "Object", + "tags": [], + "label": "query", + "description": [], + "signature": [ + "Query" + ], + "path": "src/plugins/data/public/ui/query_string_input/query_string_input.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "data", diff --git a/api_docs/data_ui.mdx b/api_docs/data_ui.mdx index bd419a0a5ea11..d39b9c3ea55d4 100644 --- a/api_docs/data_ui.mdx +++ b/api_docs/data_ui.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 3870 | 151 | 3322 | 63 | +| 3994 | 85 | 3446 | 63 | ## Client diff --git a/api_docs/data_visualizer.json b/api_docs/data_visualizer.json index 393181a4987d9..458674d4f93e4 100644 --- a/api_docs/data_visualizer.json +++ b/api_docs/data_visualizer.json @@ -230,6 +230,35 @@ ], "path": "x-pack/plugins/data_visualizer/public/application/file_data_visualizer/file_data_visualizer.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "dataVisualizer", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "dataVisualizer", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -252,6 +281,35 @@ ], "path": "x-pack/plugins/data_visualizer/public/application/index_data_visualizer/index_data_visualizer.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "dataVisualizer", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "dataVisualizer", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/data_visualizer.mdx b/api_docs/data_visualizer.mdx index df666753ecbae..428d1cd518b33 100644 --- a/api_docs/data_visualizer.mdx +++ b/api_docs/data_visualizer.mdx @@ -18,7 +18,7 @@ Contact [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) for q | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 104 | 3 | 104 | 0 | +| 108 | 5 | 108 | 0 | ## Client diff --git a/api_docs/deprecations_by_api.mdx b/api_docs/deprecations_by_api.mdx index f9a137ba576b0..dac08687437c9 100644 --- a/api_docs/deprecations_by_api.mdx +++ b/api_docs/deprecations_by_api.mdx @@ -14,17 +14,14 @@ warning: This document is auto-generated and is meant to be viewed inside our ex | | indexPatternFieldEditor, savedObjectsManagement | 8.0 | | | indexPatternFieldEditor, savedObjectsManagement | 8.0 | | | indexPatternFieldEditor, savedObjectsManagement | 8.0 | -| | indexManagement | 7.16 | -| | indexManagement | 7.16 | -| | indexManagement, globalSearch | 7.16 | -| | crossClusterReplication, indexLifecycleManagement | 7.16 | -| | savedObjects, observability, timelines, infra, ml, securitySolution, maps, stackAlerts, transform | - | -| | savedObjects, observability, timelines, infra, ml, securitySolution, maps, stackAlerts, transform | - | +| | globalSearch | 7.16 | +| | observability, timelines, infra, ml, securitySolution, stackAlerts, transform | - | | | discover, visualizations, dashboard, lens, observability, maps, canvas, dashboardEnhanced, discoverEnhanced, securitySolution | - | | | observability | - | | | canvas, discover, visualizations, dashboard, lens, observability, timelines, maps, infra, dashboardEnhanced, discoverEnhanced, securitySolution, urlDrilldown, lists, ml, visTypeTimeseries | - | | | canvas, discover, visualizations, dashboard, lens, observability, timelines, maps, infra, dashboardEnhanced, discoverEnhanced, securitySolution, urlDrilldown, lists, ml, visTypeTimeseries | - | | | observability | - | +| | observability, timelines, infra, ml, securitySolution, stackAlerts, transform | - | | | canvas, discover, visualizations, dashboard, lens, observability, timelines, maps, infra, dashboardEnhanced, discoverEnhanced, securitySolution, urlDrilldown, lists, ml, visTypeTimeseries | - | | | timelines | - | | | fleet, lens, timelines, infra, dataVisualizer, ml, apm, securitySolution, stackAlerts, transform, uptime | - | diff --git a/api_docs/deprecations_by_plugin.mdx b/api_docs/deprecations_by_plugin.mdx index bd85224ef8973..5937c2e439bd4 100644 --- a/api_docs/deprecations_by_plugin.mdx +++ b/api_docs/deprecations_by_plugin.mdx @@ -177,16 +177,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex -## crossClusterReplication - -| Deprecated API | Reference location(s) | Remove By | -| ---------------|-----------|-----------| -| | [plugin.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/cross_cluster_replication/server/plugin.ts#:~:text=LegacyAPICaller), [plugin.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/cross_cluster_replication/server/plugin.ts#:~:text=LegacyAPICaller) | 7.16 | - - - ## dashboard | Deprecated API | Reference location(s) | Remove By | @@ -572,38 +562,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex -## indexLifecycleManagement - -| Deprecated API | Reference location(s) | Remove By | -| ---------------|-----------|-----------| -| | [plugin.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_lifecycle_management/server/plugin.ts#:~:text=LegacyAPICaller), [plugin.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_lifecycle_management/server/plugin.ts#:~:text=LegacyAPICaller) | 7.16 | - - - -## indexManagement - -| Deprecated API | Reference location(s) | Remove By | -| ---------------|-----------|-----------| -| | [plugin.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/plugin.ts#:~:text=ILegacyCustomClusterClient), [plugin.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/plugin.ts#:~:text=ILegacyCustomClusterClient) | 7.16 | -| | [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#:~:text=LegacyScopedClusterClient), [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#:~:text=LegacyScopedClusterClient), [types.d.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#:~:text=LegacyScopedClusterClient), [types.d.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#:~:text=LegacyScopedClusterClient) | 7.16 | -| | [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#:~:text=ILegacyScopedClusterClient), [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#:~:text=ILegacyScopedClusterClient), [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#:~:text=ILegacyScopedClusterClient), [types.d.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#:~:text=ILegacyScopedClusterClient), [types.d.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#:~:text=ILegacyScopedClusterClient), [types.d.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#:~:text=ILegacyScopedClusterClient) | 7.16 | - - - ## indexPatternFieldEditor | Deprecated API | Reference location(s) | Remove By | @@ -829,9 +787,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex | Deprecated API | Reference location(s) | Remove By | | ---------------|-----------|-----------| -| | [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#:~:text=IIndexPattern), [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#:~:text=IIndexPattern) | - | | | [es_doc_field.ts ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#:~:text=IFieldType), [es_doc_field.ts ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#:~:text=IFieldType), [es_source.ts @@ -887,9 +842,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/index_pattern_util.ts#:~:text=IFieldType), [index_pattern_util.ts ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/index_pattern_util.ts#:~:text=IFieldType), [index_pattern_util.ts ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/index_pattern_util.ts#:~:text=IFieldType)+ 84 more | - | -| | [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#:~:text=IIndexPattern), [types.ts - ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#:~:text=IIndexPattern) | - | | | [es_doc_field.ts ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#:~:text=IFieldType), [es_doc_field.ts ](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#:~:text=IFieldType), [es_source.ts @@ -1078,21 +1030,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex -## savedObjects - -| Deprecated API | Reference location(s) | Remove By | -| ---------------|-----------|-----------| -| | [types.ts - ](https://github.com/elastic/kibana/tree/master/src/plugins/saved_objects/public/types.ts#:~:text=IIndexPattern), [types.ts - ](https://github.com/elastic/kibana/tree/master/src/plugins/saved_objects/public/types.ts#:~:text=IIndexPattern), [types.ts - ](https://github.com/elastic/kibana/tree/master/src/plugins/saved_objects/public/types.ts#:~:text=IIndexPattern) | - | -| | [types.ts - ](https://github.com/elastic/kibana/tree/master/src/plugins/saved_objects/public/types.ts#:~:text=IIndexPattern), [types.ts - ](https://github.com/elastic/kibana/tree/master/src/plugins/saved_objects/public/types.ts#:~:text=IIndexPattern), [types.ts - ](https://github.com/elastic/kibana/tree/master/src/plugins/saved_objects/public/types.ts#:~:text=IIndexPattern) | - | - - - ## savedObjectsManagement | Deprecated API | Reference location(s) | Remove By | diff --git a/api_docs/dev_tools.json b/api_docs/dev_tools.json index 3b8ee18eb9897..bab8b4a9a999e 100644 --- a/api_docs/dev_tools.json +++ b/api_docs/dev_tools.json @@ -178,11 +178,10 @@ ], "path": "src/plugins/dev_tools/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "devTools", - "id": "def-public.devTool", + "id": "def-public.DevToolsSetup.register.$1", "type": "CompoundType", "tags": [], "label": "devTool", @@ -190,14 +189,14 @@ "The dev tools descriptor" ], "signature": [ - "Pick<", - "DevToolApp", - ", \"title\" | \"id\" | \"order\" | \"mount\" | \"tooltipContent\" | \"enableRouting\"> & { disabled?: boolean | undefined; }" + "CreateDevToolArgs" ], "path": "src/plugins/dev_tools/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/discover.json b/api_docs/discover.json index 4af8487f4f2dd..ec94f42df2a0e 100644 --- a/api_docs/discover.json +++ b/api_docs/discover.json @@ -181,7 +181,8 @@ "\nOptionally apply filters." ], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/discover/public/locator.ts", "deprecated": false @@ -189,14 +190,15 @@ { "parentPluginId": "discover", "id": "def-public.DiscoverAppLocatorParams.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [ "\nOptionally set a query." ], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/discover/public/locator.ts", "deprecated": false @@ -396,7 +398,8 @@ "\nOptionally apply filters." ], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/discover/public/url_generator.ts", "deprecated": false @@ -404,14 +407,15 @@ { "parentPluginId": "discover", "id": "def-public.DiscoverUrlGeneratorState.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [ "\nOptionally set a query. NOTE: if given and used in conjunction with `dashboardId`, and the\nsaved dashboard has a query saved with it, this will _replace_ that query." ], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/discover/public/url_generator.ts", "deprecated": false @@ -686,8 +690,8 @@ ], "path": "src/plugins/discover/public/saved_searches/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "discover", @@ -709,11 +713,10 @@ ], "path": "src/plugins/discover/public/saved_searches/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "discover", - "id": "def-public.saveOptions", + "id": "def-public.SavedSearch.save.$1", "type": "Object", "tags": [], "label": "saveOptions", @@ -728,9 +731,11 @@ } ], "path": "src/plugins/discover/public/saved_searches/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "discover", @@ -804,19 +809,23 @@ ], "path": "src/plugins/discover/public/saved_searches/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "discover", - "id": "def-public.id", + "id": "def-public.SavedSearchLoader.get.$1", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/discover/public/saved_searches/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "discover", @@ -830,19 +839,23 @@ ], "path": "src/plugins/discover/public/saved_searches/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "discover", - "id": "def-public.id", + "id": "def-public.SavedSearchLoader.urlFor.$1", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/discover/public/saved_searches/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -890,12 +903,13 @@ { "parentPluginId": "discover", "id": "def-public.SearchInput.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/discover/public/application/embeddable/types.ts", "deprecated": false @@ -908,7 +922,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/discover/public/application/embeddable/types.ts", "deprecated": false diff --git a/api_docs/discover.mdx b/api_docs/discover.mdx index 9e3ae166da774..610ec5d90f267 100644 --- a/api_docs/discover.mdx +++ b/api_docs/discover.mdx @@ -18,7 +18,7 @@ Contact [Kibana App](https://github.com/orgs/elastic/teams/kibana-app) for quest | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 81 | 3 | 55 | 6 | +| 81 | 0 | 55 | 6 | ## Client diff --git a/api_docs/embeddable.json b/api_docs/embeddable.json index e328448161d7d..44c5ecbe0c063 100644 --- a/api_docs/embeddable.json +++ b/api_docs/embeddable.json @@ -5797,8 +5797,8 @@ ], "path": "src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -7783,11 +7783,10 @@ ], "path": "src/plugins/embeddable/public/lib/reference_or_value_embeddable/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.input", + "id": "def-public.ReferenceOrValueEmbeddable.inputIsRefType.$1", "type": "CompoundType", "tags": [], "label": "input", @@ -7796,9 +7795,11 @@ "ValTypeInput | RefTypeInput" ], "path": "src/plugins/embeddable/public/lib/reference_or_value_embeddable/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -7814,8 +7815,8 @@ ], "path": "src/plugins/embeddable/public/lib/reference_or_value_embeddable/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -7831,8 +7832,8 @@ ], "path": "src/plugins/embeddable/public/lib/reference_or_value_embeddable/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -8139,6 +8140,35 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "embeddable", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "embeddable", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -8419,52 +8449,46 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.id", + "id": "def-public.EmbeddableSetup.registerEmbeddableFactory.$1", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "embeddable", - "id": "def-public.factory", + "id": "def-public.EmbeddableSetup.registerEmbeddableFactory.$2", "type": "CompoundType", "tags": [], "label": "factory", "description": [], "signature": [ - "Pick<", { "pluginId": "embeddable", "scope": "public", "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactory", - "text": "EmbeddableFactory" - }, - ", \"type\" | \"create\" | \"isEditable\" | \"getDisplayName\"> & Partial, \"createFromSavedObject\" | \"isContainerType\" | \"getExplicitInput\" | \"savedObjectMetaData\" | \"canCreateNew\" | \"getDefaultInput\" | \"telemetry\" | \"extract\" | \"inject\" | \"migrations\" | \"grouping\" | \"getIconType\" | \"getDescription\">>" + ">" ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -8494,11 +8518,10 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.enhancement", + "id": "def-public.EmbeddableSetup.registerEnhancement.$1", "type": "Object", "tags": [], "label": "enhancement", @@ -8522,9 +8545,11 @@ ">" ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -8540,90 +8565,23 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.customProvider", + "id": "def-public.EmbeddableSetup.setCustomEmbeddableFactoryProvider.$1", "type": "Function", "tags": [], "label": "customProvider", "description": [], "signature": [ - " = ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.IEmbeddable", - "text": "IEmbeddable" - }, - ", T extends ", - "SavedObjectAttributes", - " = ", - "SavedObjectAttributes", - ">(def: ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactoryDefinition", - "text": "EmbeddableFactoryDefinition" - }, - ") => ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactory", - "text": "EmbeddableFactory" - }, - "" + "EmbeddableFactoryProvider" ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", @@ -8735,19 +8693,23 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.embeddableFactoryId", + "id": "def-public.EmbeddableStart.getEmbeddableFactory.$1", "type": "string", "tags": [], "label": "embeddableFactoryId", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -8811,8 +8773,8 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -8907,11 +8869,10 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.storage", + "id": "def-public.EmbeddableStart.getStateTransfer.$1", "type": "Object", "tags": [], "label": "storage", @@ -8927,9 +8888,11 @@ " | undefined" ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -8985,21 +8948,24 @@ ], "path": "src/plugins/embeddable/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-public.type", + "id": "def-public.EmbeddableStart.getAttributeService.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "embeddable", - "id": "def-public.options", + "id": "def-public.EmbeddableStart.getAttributeService.$2", "type": "Object", "tags": [], "label": "options", @@ -9009,9 +8975,11 @@ "" ], "path": "src/plugins/embeddable/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "start", @@ -9172,11 +9140,10 @@ ], "path": "src/plugins/embeddable/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-server.factory", + "id": "def-server.EmbeddableSetup.registerEmbeddableFactory.$1", "type": "Object", "tags": [], "label": "factory", @@ -9200,9 +9167,11 @@ ">" ], "path": "src/plugins/embeddable/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -9232,11 +9201,10 @@ ], "path": "src/plugins/embeddable/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-server.enhancement", + "id": "def-server.EmbeddableSetup.registerEnhancement.$1", "type": "Object", "tags": [], "label": "enhancement", @@ -9260,9 +9228,11 @@ ">" ], "path": "src/plugins/embeddable/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -9283,8 +9253,8 @@ ], "path": "src/plugins/embeddable/server/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "setup", @@ -9822,19 +9792,23 @@ ], "path": "src/plugins/embeddable/common/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-common.embeddableFactoryId", + "id": "def-common.CommonEmbeddableStartContract.getEmbeddableFactory.$1", "type": "string", "tags": [], "label": "embeddableFactoryId", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/embeddable/common/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "embeddable", @@ -9848,19 +9822,23 @@ ], "path": "src/plugins/embeddable/common/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "embeddable", - "id": "def-common.enhancementId", + "id": "def-common.CommonEmbeddableStartContract.getEnhancement.$1", "type": "string", "tags": [], "label": "enhancementId", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/embeddable/common/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -10073,6 +10051,40 @@ ], "path": "src/plugins/embeddable/common/lib/migrate.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "embeddable", + "id": "def-common.state", + "type": "Object", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "{ [key: string]: ", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.Serializable", + "text": "Serializable" + }, + "; }" + ], + "path": "src/plugins/embeddable/common/lib/migrate.ts", + "deprecated": false + }, + { + "parentPluginId": "embeddable", + "id": "def-common.version", + "type": "string", + "tags": [], + "label": "version", + "description": [], + "path": "src/plugins/embeddable/common/lib/migrate.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/embeddable.mdx b/api_docs/embeddable.mdx index 0568d6b8ddeb6..e004c73b7e04c 100644 --- a/api_docs/embeddable.mdx +++ b/api_docs/embeddable.mdx @@ -18,7 +18,7 @@ import embeddableObj from './embeddable.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 456 | 4 | 384 | 3 | +| 460 | 5 | 388 | 3 | ## Client diff --git a/api_docs/encrypted_saved_objects.json b/api_docs/encrypted_saved_objects.json index 7f382c9b32787..9bd91501c23dd 100644 --- a/api_docs/encrypted_saved_objects.json +++ b/api_docs/encrypted_saved_objects.json @@ -155,31 +155,38 @@ ], "path": "x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "encryptedSavedObjects", - "id": "def-server.type", + "id": "def-server.EncryptedSavedObjectsClient.getDecryptedAsInternalUser.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "encryptedSavedObjects", - "id": "def-server.id", + "id": "def-server.EncryptedSavedObjectsClient.getDecryptedAsInternalUser.$2", "type": "string", "tags": [], "label": "id", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "encryptedSavedObjects", - "id": "def-server.options", + "id": "def-server.EncryptedSavedObjectsClient.getDecryptedAsInternalUser.$3", "type": "Object", "tags": [], "label": "options", @@ -195,9 +202,11 @@ " | undefined" ], "path": "x-pack/plugins/encrypted_saved_objects/server/saved_objects/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -294,6 +303,37 @@ ], "path": "x-pack/plugins/encrypted_saved_objects/server/create_migration.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "encryptedSavedObjects", + "id": "def-server.encryptedDoc", + "type": "CompoundType", + "tags": [], + "label": "encryptedDoc", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectUnsanitizedDoc", + "text": "SavedObjectUnsanitizedDoc" + }, + " | ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectUnsanitizedDoc", + "text": "SavedObjectUnsanitizedDoc" + }, + "" + ], + "path": "x-pack/plugins/encrypted_saved_objects/server/create_migration.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -340,11 +380,10 @@ ], "path": "x-pack/plugins/encrypted_saved_objects/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "encryptedSavedObjects", - "id": "def-server.typeRegistration", + "id": "def-server.EncryptedSavedObjectsPluginSetup.registerType.$1", "type": "Object", "tags": [], "label": "typeRegistration", @@ -359,9 +398,11 @@ } ], "path": "x-pack/plugins/encrypted_saved_objects/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "encryptedSavedObjects", @@ -421,11 +462,10 @@ ], "path": "x-pack/plugins/encrypted_saved_objects/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "encryptedSavedObjects", - "id": "def-server.error", + "id": "def-server.EncryptedSavedObjectsPluginStart.isEncryptionError.$1", "type": "Object", "tags": [], "label": "error", @@ -434,9 +474,11 @@ "Error" ], "path": "x-pack/plugins/encrypted_saved_objects/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "encryptedSavedObjects", diff --git a/api_docs/encrypted_saved_objects.mdx b/api_docs/encrypted_saved_objects.mdx index d274500438ba5..c872427012c2d 100644 --- a/api_docs/encrypted_saved_objects.mdx +++ b/api_docs/encrypted_saved_objects.mdx @@ -18,7 +18,7 @@ Contact [Platform Security](https://github.com/orgs/elastic/teams/kibana-securit | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 28 | 0 | 26 | 4 | +| 29 | 0 | 27 | 4 | ## Server diff --git a/api_docs/es_ui_shared.json b/api_docs/es_ui_shared.json index 83e4a2aff394b..053844e545872 100644 --- a/api_docs/es_ui_shared.json +++ b/api_docs/es_ui_shared.json @@ -1065,7 +1065,24 @@ "((data: any) => any) | undefined" ], "path": "src/plugins/es_ui_shared/public/request/use_request.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "esUiShared", + "id": "def-public.UseRequestConfig.deserializer.$1", + "type": "Any", + "tags": [], + "label": "data", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/es_ui_shared/public/request/use_request.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1148,8 +1165,8 @@ ], "path": "src/plugins/es_ui_shared/public/request/use_request.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1191,6 +1208,29 @@ ], "path": "src/plugins/es_ui_shared/public/components/json_editor/use_json.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "esUiShared", + "id": "def-public.arg", + "type": "Object", + "tags": [], + "label": "arg", + "description": [], + "signature": [ + { + "pluginId": "esUiShared", + "scope": "public", + "docId": "kibEsUiSharedPluginApi", + "section": "def-public.JsonEditorState", + "text": "JsonEditorState" + }, + "" + ], + "path": "src/plugins/es_ui_shared/public/components/json_editor/use_json.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -1364,37 +1404,6 @@ "returnComment": [], "initialIsOpen": false }, - { - "parentPluginId": "esUiShared", - "id": "def-server.isEsError", - "type": "Function", - "tags": [], - "label": "isEsError", - "description": [], - "signature": [ - "(err: RequestError) => boolean" - ], - "path": "src/plugins/es_ui_shared/__packages_do_not_import__/errors/is_es_error.ts", - "deprecated": false, - "children": [ - { - "parentPluginId": "esUiShared", - "id": "def-server.isEsError.$1", - "type": "Object", - "tags": [], - "label": "err", - "description": [], - "signature": [ - "RequestError" - ], - "path": "src/plugins/es_ui_shared/__packages_do_not_import__/errors/is_es_error.ts", - "deprecated": false, - "isRequired": true - } - ], - "returnComment": [], - "initialIsOpen": false - }, { "parentPluginId": "esUiShared", "id": "def-server.parseEsError", diff --git a/api_docs/es_ui_shared.mdx b/api_docs/es_ui_shared.mdx index 0db5869f46abf..84687d60931da 100644 --- a/api_docs/es_ui_shared.mdx +++ b/api_docs/es_ui_shared.mdx @@ -18,7 +18,7 @@ import esUiSharedObj from './es_ui_shared.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 92 | 4 | 90 | 1 | +| 92 | 5 | 90 | 1 | ## Client diff --git a/api_docs/expression_repeat_image.json b/api_docs/expression_repeat_image.json index f401d231d11c2..4917dc1f62205 100644 --- a/api_docs/expression_repeat_image.json +++ b/api_docs/expression_repeat_image.json @@ -355,6 +355,8 @@ ], "path": "src/plugins/expression_repeat_image/common/types/expression_functions.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { diff --git a/api_docs/expression_shape.json b/api_docs/expression_shape.json index 16e2e9eee30af..607c10fb38240 100644 --- a/api_docs/expression_shape.json +++ b/api_docs/expression_shape.json @@ -596,8 +596,8 @@ ], "path": "src/plugins/expression_shape/public/components/reusable/types.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -896,6 +896,8 @@ ], "path": "src/plugins/expression_shape/common/types/expression_functions.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -1408,6 +1410,8 @@ ], "path": "src/plugins/expression_shape/common/types/expression_functions.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { diff --git a/api_docs/expressions.json b/api_docs/expressions.json index 5c9e86bc9119f..6185466a02cc8 100644 --- a/api_docs/expressions.json +++ b/api_docs/expressions.json @@ -6404,8 +6404,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -6489,8 +6489,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -6513,7 +6513,9 @@ ") | undefined" ], "path": "src/plugins/expressions/common/execution/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -6528,7 +6530,9 @@ "(() => boolean) | undefined" ], "path": "src/plugins/expressions/common/execution/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -6552,8 +6556,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -6921,13 +6925,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, - "returnComment": [ - "`ExpressionAstFunctionBuilder[]`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-public.fnName", + "id": "def-public.ExpressionAstExpressionBuilder.findFunction.$1", "type": "Uncategorized", "tags": [], "label": "fnName", @@ -6945,8 +6946,12 @@ "[\"name\"]" ], "path": "src/plugins/expressions/common/ast/build_expression.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`ExpressionAstFunctionBuilder[]`" ] }, { @@ -6972,10 +6977,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, + "children": [], "returnComment": [ "`ExpressionAstExpression`" - ], - "children": [] + ] }, { "parentPluginId": "expressions", @@ -6993,10 +6998,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, + "children": [], "returnComment": [ "`string`" - ], - "children": [] + ] } ], "initialIsOpen": false @@ -7097,13 +7102,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionAstFunctionBuilder.addArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -7114,11 +7116,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.value", + "id": "def-public.ExpressionAstFunctionBuilder.addArgument.$2", "type": "CompoundType", "tags": [], "label": "value", @@ -7136,8 +7139,12 @@ " | FunctionArgs[A]" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -7164,13 +7171,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`ExpressionAstFunctionBuilderArgument[] | undefined`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionAstFunctionBuilder.getArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -7181,8 +7185,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`ExpressionAstFunctionBuilderArgument[] | undefined`" ] }, { @@ -7209,13 +7217,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionAstFunctionBuilder.replaceArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -7226,11 +7231,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.value", + "id": "def-public.ExpressionAstFunctionBuilder.replaceArgument.$2", "type": "Array", "tags": [], "label": "value", @@ -7249,8 +7255,12 @@ " | FunctionArgs[A])[]" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -7269,13 +7279,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionAstFunctionBuilder.removeArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -7286,8 +7293,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -7313,10 +7324,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, + "children": [], "returnComment": [ "`ExpressionAstFunction`" - ], - "children": [] + ] }, { "parentPluginId": "expressions", @@ -7334,10 +7345,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, + "children": [], "returnComment": [ "`string`" - ], - "children": [] + ] } ], "initialIsOpen": false @@ -8236,7 +8247,9 @@ "(() => Error | undefined) | undefined" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8272,11 +8285,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.domNode", + "id": "def-public.ExpressionRenderDefinition.render.$1", "type": "Object", "tags": [], "label": "domNode", @@ -8285,11 +8297,12 @@ "HTMLElement" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.config", + "id": "def-public.ExpressionRenderDefinition.render.$2", "type": "Uncategorized", "tags": [], "label": "config", @@ -8298,11 +8311,12 @@ "Config" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.handlers", + "id": "def-public.ExpressionRenderDefinition.render.$3", "type": "Object", "tags": [], "label": "handlers", @@ -8317,9 +8331,11 @@ } ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -8443,19 +8459,23 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionsServiceStart.getFunction.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8479,19 +8499,23 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionsServiceStart.getRenderer.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8515,19 +8539,23 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.name", + "id": "def-public.ExpressionsServiceStart.getType.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8593,11 +8621,10 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.ast", + "id": "def-public.ExpressionsServiceStart.run.$1", "type": "CompoundType", "tags": [], "label": "ast", @@ -8613,11 +8640,12 @@ } ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.input", + "id": "def-public.ExpressionsServiceStart.run.$2", "type": "Uncategorized", "tags": [], "label": "input", @@ -8626,11 +8654,12 @@ "Input" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.params", + "id": "def-public.ExpressionsServiceStart.run.$3", "type": "Object", "tags": [], "label": "params", @@ -8646,9 +8675,11 @@ " | undefined" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8688,11 +8719,10 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.ast", + "id": "def-public.ExpressionsServiceStart.execute.$1", "type": "CompoundType", "tags": [], "label": "ast", @@ -8708,11 +8738,12 @@ } ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.input", + "id": "def-public.ExpressionsServiceStart.execute.$2", "type": "Uncategorized", "tags": [], "label": "input", @@ -8721,11 +8752,12 @@ "Input" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-public.params", + "id": "def-public.ExpressionsServiceStart.execute.$3", "type": "Object", "tags": [], "label": "params", @@ -8741,9 +8773,11 @@ " | undefined" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8766,8 +8800,8 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -8818,7 +8852,24 @@ "((type: any) => void | Error) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.ExpressionTypeDefinition.validate.$1", + "type": "Any", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8831,7 +8882,24 @@ "((type: Value) => SerializedType) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.ExpressionTypeDefinition.serialize.$1", + "type": "Uncategorized", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "Value" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -8844,7 +8912,24 @@ "((type: SerializedType) => Value) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.ExpressionTypeDefinition.deserialize.$1", + "type": "Uncategorized", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "SerializedType" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9288,8 +9373,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9303,11 +9388,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.fn", + "id": "def-public.IInterpreterRenderHandlers.onDestroy.$1", "type": "Function", "tags": [], "label": "fn", @@ -9316,9 +9400,11 @@ "() => void" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9332,8 +9418,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9347,11 +9433,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.params", + "id": "def-public.IInterpreterRenderHandlers.update.$1", "type": "Any", "tags": [], "label": "params", @@ -9360,9 +9445,11 @@ "any" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9376,11 +9463,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-public.event", + "id": "def-public.IInterpreterRenderHandlers.event.$1", "type": "Any", "tags": [], "label": "event", @@ -9389,9 +9475,11 @@ "any" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9403,8 +9491,25 @@ "signature": [ "((event: any) => Promise) | undefined" ], - "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "path": "src/plugins/expressions/common/expression_renderers/types.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.IInterpreterRenderHandlers.hasCompatibleActions.$1", + "type": "Any", + "tags": [], + "label": "event", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/expressions/common/expression_renderers/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9425,8 +9530,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9440,8 +9545,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9746,7 +9851,45 @@ " | null | undefined) => React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)>[]) | undefined" ], "path": "src/plugins/expressions/public/react_expression_renderer.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.ReactExpressionRendererProps.renderError.$1", + "type": "CompoundType", + "tags": [], + "label": "message", + "description": [], + "signature": [ + "string | null | undefined" + ], + "path": "src/plugins/expressions/public/react_expression_renderer.tsx", + "deprecated": false, + "isRequired": false + }, + { + "parentPluginId": "expressions", + "id": "def-public.ReactExpressionRendererProps.renderError.$2", + "type": "CompoundType", + "tags": [], + "label": "error", + "description": [], + "signature": [ + { + "pluginId": "expressions", + "scope": "public", + "docId": "kibExpressionsPluginApi", + "section": "def-public.ExpressionRenderError", + "text": "ExpressionRenderError" + }, + " | null | undefined" + ], + "path": "src/plugins/expressions/public/react_expression_renderer.tsx", + "deprecated": false, + "isRequired": false + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9780,7 +9923,30 @@ ") => void) | undefined" ], "path": "src/plugins/expressions/public/react_expression_renderer.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.ReactExpressionRendererProps.onEvent.$1", + "type": "Object", + "tags": [], + "label": "event", + "description": [], + "signature": [ + { + "pluginId": "expressions", + "scope": "public", + "docId": "kibExpressionsPluginApi", + "section": "def-public.ExpressionRendererEvent", + "text": "ExpressionRendererEvent" + } + ], + "path": "src/plugins/expressions/public/react_expression_renderer.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -9793,7 +9959,52 @@ "((data: TData, adapters?: TInspectorAdapters | undefined, partial?: boolean | undefined) => void) | undefined" ], "path": "src/plugins/expressions/public/react_expression_renderer.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.ReactExpressionRendererProps.onData$.$1", + "type": "Uncategorized", + "tags": [], + "label": "data", + "description": [], + "signature": [ + "TData" + ], + "path": "src/plugins/expressions/public/react_expression_renderer.tsx", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "expressions", + "id": "def-public.ReactExpressionRendererProps.onData$.$2", + "type": "Uncategorized", + "tags": [], + "label": "adapters", + "description": [], + "signature": [ + "TInspectorAdapters | undefined" + ], + "path": "src/plugins/expressions/public/react_expression_renderer.tsx", + "deprecated": false, + "isRequired": false + }, + { + "parentPluginId": "expressions", + "id": "def-public.ReactExpressionRendererProps.onData$.$3", + "type": "CompoundType", + "tags": [], + "label": "partial", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/expressions/public/react_expression_renderer.tsx", + "deprecated": false, + "isRequired": false + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -10304,6 +10515,35 @@ ], "path": "src/plugins/expressions/public/react_expression_renderer.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "expressions", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10346,6 +10586,35 @@ ], "path": "src/plugins/expressions/common/expression_types/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "expressions", + "id": "def-public.input", + "type": "Uncategorized", + "tags": [], + "label": "input", + "description": [], + "signature": [ + "I" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false + }, + { + "parentPluginId": "expressions", + "id": "def-public.availableTypes", + "type": "Object", + "tags": [], + "label": "availableTypes", + "description": [], + "signature": [ + "{ [x: string]: any; }" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -15898,8 +16167,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -15983,8 +16252,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -16007,7 +16276,9 @@ ") | undefined" ], "path": "src/plugins/expressions/common/execution/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -16022,7 +16293,9 @@ "(() => boolean) | undefined" ], "path": "src/plugins/expressions/common/execution/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -16046,8 +16319,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -16415,13 +16688,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, - "returnComment": [ - "`ExpressionAstFunctionBuilder[]`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-server.fnName", + "id": "def-server.ExpressionAstExpressionBuilder.findFunction.$1", "type": "Uncategorized", "tags": [], "label": "fnName", @@ -16439,8 +16709,12 @@ "[\"name\"]" ], "path": "src/plugins/expressions/common/ast/build_expression.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`ExpressionAstFunctionBuilder[]`" ] }, { @@ -16466,10 +16740,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, + "children": [], "returnComment": [ "`ExpressionAstExpression`" - ], - "children": [] + ] }, { "parentPluginId": "expressions", @@ -16487,10 +16761,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, + "children": [], "returnComment": [ "`string`" - ], - "children": [] + ] } ], "initialIsOpen": false @@ -16591,13 +16865,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-server.name", + "id": "def-server.ExpressionAstFunctionBuilder.addArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -16608,11 +16879,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-server.value", + "id": "def-server.ExpressionAstFunctionBuilder.addArgument.$2", "type": "CompoundType", "tags": [], "label": "value", @@ -16630,8 +16902,12 @@ " | FunctionArgs[A]" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -16658,13 +16934,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`ExpressionAstFunctionBuilderArgument[] | undefined`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-server.name", + "id": "def-server.ExpressionAstFunctionBuilder.getArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -16675,8 +16948,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`ExpressionAstFunctionBuilderArgument[] | undefined`" ] }, { @@ -16703,13 +16980,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-server.name", + "id": "def-server.ExpressionAstFunctionBuilder.replaceArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -16720,11 +16994,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-server.value", + "id": "def-server.ExpressionAstFunctionBuilder.replaceArgument.$2", "type": "Array", "tags": [], "label": "value", @@ -16743,8 +17018,12 @@ " | FunctionArgs[A])[]" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -16763,13 +17042,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-server.name", + "id": "def-server.ExpressionAstFunctionBuilder.removeArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -16780,8 +17056,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -16807,10 +17087,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, + "children": [], "returnComment": [ "`ExpressionAstFunction`" - ], - "children": [] + ] }, { "parentPluginId": "expressions", @@ -16828,10 +17108,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, + "children": [], "returnComment": [ "`string`" - ], - "children": [] + ] } ], "initialIsOpen": false @@ -17701,7 +17981,9 @@ "(() => Error | undefined) | undefined" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -17737,11 +18019,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-server.domNode", + "id": "def-server.ExpressionRenderDefinition.render.$1", "type": "Object", "tags": [], "label": "domNode", @@ -17750,11 +18031,12 @@ "HTMLElement" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-server.config", + "id": "def-server.ExpressionRenderDefinition.render.$2", "type": "Uncategorized", "tags": [], "label": "config", @@ -17763,11 +18045,12 @@ "Config" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-server.handlers", + "id": "def-server.ExpressionRenderDefinition.render.$3", "type": "Object", "tags": [], "label": "handlers", @@ -17782,9 +18065,11 @@ } ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -17835,7 +18120,24 @@ "((type: any) => void | Error) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-server.ExpressionTypeDefinition.validate.$1", + "type": "Any", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -17848,7 +18150,24 @@ "((type: Value) => SerializedType) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-server.ExpressionTypeDefinition.serialize.$1", + "type": "Uncategorized", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "Value" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -17861,7 +18180,24 @@ "((type: SerializedType) => Value) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-server.ExpressionTypeDefinition.deserialize.$1", + "type": "Uncategorized", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "SerializedType" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18043,8 +18379,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18058,11 +18394,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-server.fn", + "id": "def-server.IInterpreterRenderHandlers.onDestroy.$1", "type": "Function", "tags": [], "label": "fn", @@ -18071,9 +18406,11 @@ "() => void" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18087,8 +18424,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18102,11 +18439,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-server.params", + "id": "def-server.IInterpreterRenderHandlers.update.$1", "type": "Any", "tags": [], "label": "params", @@ -18115,9 +18451,11 @@ "any" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18131,11 +18469,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-server.event", + "id": "def-server.IInterpreterRenderHandlers.event.$1", "type": "Any", "tags": [], "label": "event", @@ -18144,9 +18481,11 @@ "any" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18159,7 +18498,24 @@ "((event: any) => Promise) | undefined" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-server.IInterpreterRenderHandlers.hasCompatibleActions.$1", + "type": "Any", + "tags": [], + "label": "event", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/expressions/common/expression_renderers/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18180,8 +18536,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18195,8 +18551,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -18906,6 +19262,35 @@ ], "path": "src/plugins/expressions/common/expression_types/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "expressions", + "id": "def-server.input", + "type": "Uncategorized", + "tags": [], + "label": "input", + "description": [], + "signature": [ + "I" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false + }, + { + "parentPluginId": "expressions", + "id": "def-server.availableTypes", + "type": "Object", + "tags": [], + "label": "availableTypes", + "description": [], + "signature": [ + "{ [x: string]: any; }" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -26585,8 +26970,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -26670,8 +27055,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -26694,7 +27079,9 @@ ") | undefined" ], "path": "src/plugins/expressions/common/execution/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -26709,7 +27096,9 @@ "(() => boolean) | undefined" ], "path": "src/plugins/expressions/common/execution/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -26733,8 +27122,8 @@ ], "path": "src/plugins/expressions/common/execution/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -26872,11 +27261,10 @@ ], "path": "src/plugins/expressions/common/execution/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutionPureTransitions.start.$1", "type": "Object", "tags": [], "label": "state", @@ -26892,9 +27280,11 @@ "" ], "path": "src/plugins/expressions/common/execution/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -26924,11 +27314,10 @@ ], "path": "src/plugins/expressions/common/execution/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutionPureTransitions.setResult.$1", "type": "Object", "tags": [], "label": "state", @@ -26944,9 +27333,11 @@ "" ], "path": "src/plugins/expressions/common/execution/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -26976,11 +27367,10 @@ ], "path": "src/plugins/expressions/common/execution/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutionPureTransitions.setError.$1", "type": "Object", "tags": [], "label": "state", @@ -26996,9 +27386,11 @@ "" ], "path": "src/plugins/expressions/common/execution/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -27190,11 +27582,10 @@ ], "path": "src/plugins/expressions/common/executor/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutorPureSelectors.getFunction.$1", "type": "Object", "tags": [], "label": "state", @@ -27210,9 +27601,11 @@ ">" ], "path": "src/plugins/expressions/common/executor/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -27242,11 +27635,10 @@ ], "path": "src/plugins/expressions/common/executor/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutorPureSelectors.getType.$1", "type": "Object", "tags": [], "label": "state", @@ -27262,9 +27654,11 @@ ">" ], "path": "src/plugins/expressions/common/executor/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -27286,11 +27680,10 @@ ], "path": "src/plugins/expressions/common/executor/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutorPureSelectors.getContext.$1", "type": "Object", "tags": [], "label": "state", @@ -27306,9 +27699,11 @@ ">" ], "path": "src/plugins/expressions/common/executor/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -27359,11 +27754,10 @@ ], "path": "src/plugins/expressions/common/executor/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutorPureTransitions.addFunction.$1", "type": "Object", "tags": [], "label": "state", @@ -27379,9 +27773,11 @@ ">" ], "path": "src/plugins/expressions/common/executor/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -27419,11 +27815,10 @@ ], "path": "src/plugins/expressions/common/executor/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutorPureTransitions.addType.$1", "type": "Object", "tags": [], "label": "state", @@ -27439,9 +27834,11 @@ ">" ], "path": "src/plugins/expressions/common/executor/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -27471,11 +27868,10 @@ ], "path": "src/plugins/expressions/common/executor/container.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.state", + "id": "def-common.ExecutorPureTransitions.extendContext.$1", "type": "Object", "tags": [], "label": "state", @@ -27491,9 +27887,11 @@ ">" ], "path": "src/plugins/expressions/common/executor/container.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -27679,13 +28077,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, - "returnComment": [ - "`ExpressionAstFunctionBuilder[]`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-common.fnName", + "id": "def-common.ExpressionAstExpressionBuilder.findFunction.$1", "type": "Uncategorized", "tags": [], "label": "fnName", @@ -27703,8 +28098,12 @@ "[\"name\"]" ], "path": "src/plugins/expressions/common/ast/build_expression.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`ExpressionAstFunctionBuilder[]`" ] }, { @@ -27730,10 +28129,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, + "children": [], "returnComment": [ "`ExpressionAstExpression`" - ], - "children": [] + ] }, { "parentPluginId": "expressions", @@ -27751,10 +28150,10 @@ ], "path": "src/plugins/expressions/common/ast/build_expression.ts", "deprecated": false, + "children": [], "returnComment": [ "`string`" - ], - "children": [] + ] } ], "initialIsOpen": false @@ -27855,13 +28254,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionAstFunctionBuilder.addArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -27872,11 +28268,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.value", + "id": "def-common.ExpressionAstFunctionBuilder.addArgument.$2", "type": "CompoundType", "tags": [], "label": "value", @@ -27894,8 +28291,12 @@ " | FunctionArgs[A]" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -27922,13 +28323,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`ExpressionAstFunctionBuilderArgument[] | undefined`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionAstFunctionBuilder.getArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -27939,8 +28337,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`ExpressionAstFunctionBuilderArgument[] | undefined`" ] }, { @@ -27967,13 +28369,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionAstFunctionBuilder.replaceArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -27984,11 +28383,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.value", + "id": "def-common.ExpressionAstFunctionBuilder.replaceArgument.$2", "type": "Array", "tags": [], "label": "value", @@ -28007,8 +28407,12 @@ " | FunctionArgs[A])[]" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -28027,13 +28431,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, - "returnComment": [ - "`this`" - ], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionAstFunctionBuilder.removeArgument.$1", "type": "Uncategorized", "tags": [], "label": "name", @@ -28044,8 +28445,12 @@ "A" ], "path": "src/plugins/expressions/common/ast/build_function.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "`this`" ] }, { @@ -28071,10 +28476,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, + "children": [], "returnComment": [ "`ExpressionAstFunction`" - ], - "children": [] + ] }, { "parentPluginId": "expressions", @@ -28092,10 +28497,10 @@ ], "path": "src/plugins/expressions/common/ast/build_function.ts", "deprecated": false, + "children": [], "returnComment": [ "`string`" - ], - "children": [] + ] } ], "initialIsOpen": false @@ -29142,7 +29547,9 @@ "(() => Error | undefined) | undefined" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29178,11 +29585,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.domNode", + "id": "def-common.ExpressionRenderDefinition.render.$1", "type": "Object", "tags": [], "label": "domNode", @@ -29191,11 +29597,12 @@ "HTMLElement" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.config", + "id": "def-common.ExpressionRenderDefinition.render.$2", "type": "Uncategorized", "tags": [], "label": "config", @@ -29204,11 +29611,12 @@ "Config" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.handlers", + "id": "def-common.ExpressionRenderDefinition.render.$3", "type": "Object", "tags": [], "label": "handlers", @@ -29223,9 +29631,11 @@ } ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -29317,19 +29727,23 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionsServiceStart.getFunction.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29353,19 +29767,23 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionsServiceStart.getRenderer.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29389,19 +29807,23 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.name", + "id": "def-common.ExpressionsServiceStart.getType.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29467,11 +29889,10 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.ast", + "id": "def-common.ExpressionsServiceStart.run.$1", "type": "CompoundType", "tags": [], "label": "ast", @@ -29487,11 +29908,12 @@ } ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.input", + "id": "def-common.ExpressionsServiceStart.run.$2", "type": "Uncategorized", "tags": [], "label": "input", @@ -29500,11 +29922,12 @@ "Input" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.params", + "id": "def-common.ExpressionsServiceStart.run.$3", "type": "Object", "tags": [], "label": "params", @@ -29520,9 +29943,11 @@ " | undefined" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29562,11 +29987,10 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.ast", + "id": "def-common.ExpressionsServiceStart.execute.$1", "type": "CompoundType", "tags": [], "label": "ast", @@ -29582,11 +30006,12 @@ } ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.input", + "id": "def-common.ExpressionsServiceStart.execute.$2", "type": "Uncategorized", "tags": [], "label": "input", @@ -29595,11 +30020,12 @@ "Input" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "expressions", - "id": "def-common.params", + "id": "def-common.ExpressionsServiceStart.execute.$3", "type": "Object", "tags": [], "label": "params", @@ -29615,9 +30041,11 @@ " | undefined" ], "path": "src/plugins/expressions/common/service/expressions_services.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29640,8 +30068,8 @@ ], "path": "src/plugins/expressions/common/service/expressions_services.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -29692,7 +30120,24 @@ "((type: any) => void | Error) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-common.ExpressionTypeDefinition.validate.$1", + "type": "Any", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29705,7 +30150,24 @@ "((type: Value) => SerializedType) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-common.ExpressionTypeDefinition.serialize.$1", + "type": "Uncategorized", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "Value" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29718,7 +30180,24 @@ "((type: SerializedType) => Value) | undefined" ], "path": "src/plugins/expressions/common/expression_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-common.ExpressionTypeDefinition.deserialize.$1", + "type": "Uncategorized", + "tags": [], + "label": "type", + "description": [], + "signature": [ + "SerializedType" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29900,8 +30379,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29915,11 +30394,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.fn", + "id": "def-common.IInterpreterRenderHandlers.onDestroy.$1", "type": "Function", "tags": [], "label": "fn", @@ -29928,9 +30406,11 @@ "() => void" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29944,8 +30424,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29959,11 +30439,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.params", + "id": "def-common.IInterpreterRenderHandlers.update.$1", "type": "Any", "tags": [], "label": "params", @@ -29972,9 +30451,11 @@ "any" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -29988,11 +30469,10 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "expressions", - "id": "def-common.event", + "id": "def-common.IInterpreterRenderHandlers.event.$1", "type": "Any", "tags": [], "label": "event", @@ -30001,9 +30481,11 @@ "any" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -30016,7 +30498,24 @@ "((event: any) => Promise) | undefined" ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "expressions", + "id": "def-common.IInterpreterRenderHandlers.hasCompatibleActions.$1", + "type": "Any", + "tags": [], + "label": "event", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/expressions/common/expression_renderers/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -30037,8 +30536,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -30052,8 +30551,8 @@ ], "path": "src/plugins/expressions/common/expression_renderers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "expressions", @@ -31829,6 +32328,35 @@ ], "path": "src/plugins/expressions/common/expression_types/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "expressions", + "id": "def-common.input", + "type": "Uncategorized", + "tags": [], + "label": "input", + "description": [], + "signature": [ + "I" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false + }, + { + "parentPluginId": "expressions", + "id": "def-common.availableTypes", + "type": "Object", + "tags": [], + "label": "availableTypes", + "description": [], + "signature": [ + "{ [x: string]: any; }" + ], + "path": "src/plugins/expressions/common/expression_types/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/expressions.mdx b/api_docs/expressions.mdx index abac2ad5cd8b9..ffc13bfdff967 100644 --- a/api_docs/expressions.mdx +++ b/api_docs/expressions.mdx @@ -18,7 +18,7 @@ import expressionsObj from './expressions.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2004 | 58 | 1569 | 5 | +| 2030 | 65 | 1595 | 5 | ## Client diff --git a/api_docs/features.json b/api_docs/features.json index 0e57b3618ddf6..982c88d5f626c 100644 --- a/api_docs/features.json +++ b/api_docs/features.json @@ -2143,7 +2143,23 @@ "(licenseType: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\") => boolean | undefined" ], "path": "x-pack/plugins/features/server/feature_privilege_iterator/sub_feature_privilege_iterator.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "features", + "id": "def-server.licenseType", + "type": "CompoundType", + "tags": [], + "label": "licenseType", + "description": [], + "signature": [ + "\"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\"" + ], + "path": "x-pack/plugins/features/server/feature_privilege_iterator/sub_feature_privilege_iterator.ts", + "deprecated": false + } + ] } ] } diff --git a/api_docs/features.mdx b/api_docs/features.mdx index 6bead616a2913..6b44744e68dd8 100644 --- a/api_docs/features.mdx +++ b/api_docs/features.mdx @@ -18,7 +18,7 @@ import featuresObj from './features.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 215 | 0 | 97 | 2 | +| 216 | 0 | 98 | 2 | ## Client diff --git a/api_docs/file_upload.json b/api_docs/file_upload.json index 1c67c9c89c392..0c935915a9eee 100644 --- a/api_docs/file_upload.json +++ b/api_docs/file_upload.json @@ -102,11 +102,10 @@ ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fileUpload", - "id": "def-public.geojsonFile", + "id": "def-public.FileUploadComponentProps.onFileSelect.$1", "type": "Object", "tags": [], "label": "geojsonFile", @@ -115,29 +114,39 @@ "GeoJSON.FeatureCollection" ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "fileUpload", - "id": "def-public.name", + "id": "def-public.FileUploadComponentProps.onFileSelect.$2", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "fileUpload", - "id": "def-public.previewCoverage", + "id": "def-public.FileUploadComponentProps.onFileSelect.$3", "type": "number", "tags": [], "label": "previewCoverage", "description": [], + "signature": [ + "number" + ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -151,8 +160,8 @@ ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -166,8 +175,8 @@ ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -181,8 +190,8 @@ ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -204,11 +213,10 @@ ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fileUpload", - "id": "def-public.results", + "id": "def-public.FileUploadComponentProps.onUploadComplete.$1", "type": "Object", "tags": [], "label": "results", @@ -223,9 +231,11 @@ } ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -239,8 +249,8 @@ ], "path": "x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -791,21 +801,24 @@ ], "path": "x-pack/plugins/file_upload/public/components/geojson_upload_form/index_name_form.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fileUpload", - "id": "def-public.name", + "id": "def-public.Props.onIndexNameChange.$1", "type": "string", "tags": [], "label": "name", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/file_upload/public/components/geojson_upload_form/index_name_form.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "fileUpload", - "id": "def-public.error", + "id": "def-public.Props.onIndexNameChange.$2", "type": "string", "tags": [], "label": "error", @@ -814,9 +827,11 @@ "string | undefined" ], "path": "x-pack/plugins/file_upload/public/components/geojson_upload_form/index_name_form.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -830,8 +845,8 @@ ], "path": "x-pack/plugins/file_upload/public/components/geojson_upload_form/index_name_form.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "fileUpload", @@ -845,8 +860,8 @@ ], "path": "x-pack/plugins/file_upload/public/components/geojson_upload_form/index_name_form.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/fleet.json b/api_docs/fleet.json index e8efeff2da9b5..a50bc0bb78063 100644 --- a/api_docs/fleet.json +++ b/api_docs/fleet.json @@ -962,30 +962,54 @@ ], "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fleet", - "id": "def-public.opts", + "id": "def-public.PackagePolicyCreateExtensionComponentProps.onChange.$1.opts", "type": "Object", "tags": [], "label": "opts", "description": [], - "signature": [ - "{ isValid: boolean; updatedPolicy: ", + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false, + "children": [ { - "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.NewPackagePolicy", - "text": "NewPackagePolicy" + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyCreateExtensionComponentProps.onChange.$1.opts.isValid", + "type": "boolean", + "tags": [], + "label": "isValid", + "description": [ + "is current form state is valid" + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false }, - "; }" - ], - "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", - "deprecated": false + { + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyCreateExtensionComponentProps.onChange.$1.opts.updatedPolicy", + "type": "Object", + "tags": [], + "label": "updatedPolicy", + "description": [ + "The updated Integration Policy to be merged back and included in the API call" + ], + "signature": [ + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.NewPackagePolicy", + "text": "NewPackagePolicy" + } + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1163,30 +1187,131 @@ ], "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fleet", - "id": "def-public.opts", + "id": "def-public.PackagePolicyEditExtensionComponentProps.onChange.$1.opts", "type": "Object", "tags": [], "label": "opts", "description": [], - "signature": [ - "{ isValid: boolean; updatedPolicy: Partial<", + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false, + "children": [ { - "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.NewPackagePolicy", - "text": "NewPackagePolicy" + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyEditExtensionComponentProps.onChange.$1.opts.isValid", + "type": "boolean", + "tags": [], + "label": "isValid", + "description": [ + "is current form state is valid" + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false }, - ">; }" - ], - "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", - "deprecated": false + { + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyEditExtensionComponentProps.onChange.$1.opts.updatedPolicy", + "type": "Object", + "tags": [], + "label": "updatedPolicy", + "description": [ + "The updated Integration Policy to be merged back and included in the API call" + ], + "signature": [ + "{ name?: string | undefined; description?: string | undefined; namespace?: string | undefined; enabled?: boolean | undefined; policy_id?: string | undefined; output_id?: string | undefined; package?: ", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.PackagePolicyPackage", + "text": "PackagePolicyPackage" + }, + " | undefined; inputs?: ", + { + "pluginId": "fleet", + "scope": "common", + "docId": "kibFleetPluginApi", + "section": "def-common.NewPackagePolicyInput", + "text": "NewPackagePolicyInput" + }, + "[] | undefined; vars?: Record | undefined; }" + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyEditTabsExtension", + "type": "Interface", + "tags": [], + "label": "PackagePolicyEditTabsExtension", + "description": [ + "Extension point registration contract for Integration Policy Edit tabs views" + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyEditTabsExtension.package", + "type": "string", + "tags": [], + "label": "package", + "description": [], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false + }, + { + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyEditTabsExtension.view", + "type": "string", + "tags": [], + "label": "view", + "description": [], + "signature": [ + "\"package-policy-edit-tabs\"" + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false + }, + { + "parentPluginId": "fleet", + "id": "def-public.PackagePolicyEditTabsExtension.tabs", + "type": "Array", + "tags": [], + "label": "tabs", + "description": [], + "signature": [ + "{ title: string; Component: React.LazyExoticComponent>; }[]" + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false } ], "initialIsOpen": false @@ -1390,6 +1515,14 @@ "text": "PackagePolicyEditExtension" }, " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackagePolicyEditTabsExtension", + "text": "PackagePolicyEditTabsExtension" + }, + " | ", { "pluginId": "fleet", "scope": "public", @@ -1448,6 +1581,68 @@ ], "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "fleet", + "id": "def-public.extensionPoint", + "type": "CompoundType", + "tags": [], + "label": "extensionPoint", + "description": [], + "signature": [ + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackagePolicyEditExtension", + "text": "PackagePolicyEditExtension" + }, + " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackagePolicyEditTabsExtension", + "text": "PackagePolicyEditTabsExtension" + }, + " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackageCustomExtension", + "text": "PackageCustomExtension" + }, + " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackagePolicyCreateExtension", + "text": "PackagePolicyCreateExtension" + }, + " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackageAssetsExtension", + "text": "PackageAssetsExtension" + }, + " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.AgentEnrollmentFlyoutFinalStepExtension", + "text": "AgentEnrollmentFlyoutFinalStepExtension" + } + ], + "path": "x-pack/plugins/fleet/public/types/ui_extensions.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -2082,6 +2277,14 @@ "text": "PackagePolicyEditExtension" }, " | ", + { + "pluginId": "fleet", + "scope": "public", + "docId": "kibFleetPluginApi", + "section": "def-public.PackagePolicyEditTabsExtension", + "text": "PackagePolicyEditTabsExtension" + }, + " | ", { "pluginId": "fleet", "scope": "public", @@ -2131,8 +2334,8 @@ ], "path": "x-pack/plugins/fleet/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "start", @@ -5079,8 +5282,8 @@ ], "path": "x-pack/plugins/fleet/server/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "fleet", @@ -5195,86 +5398,29 @@ ], "path": "x-pack/plugins/fleet/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fleet", - "id": "def-server.args", + "id": "def-server.FleetStartContract.registerExternalCallback.$1", "type": "CompoundType", "tags": [], "label": "args", "description": [], "signature": [ - "[\"packagePolicyCreate\", (newPackagePolicy: ", - { - "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.NewPackagePolicy", - "text": "NewPackagePolicy" - }, - ", context: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, - ", request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ") => Promise<", - { - "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.NewPackagePolicy", - "text": "NewPackagePolicy" - }, - ">] | [\"packagePolicyUpdate\", (newPackagePolicy: ", { "pluginId": "fleet", - "scope": "common", - "docId": "kibFleetPluginApi", - "section": "def-common.UpdatePackagePolicy", - "text": "UpdatePackagePolicy" - }, - ", context: ", - { - "pluginId": "core", "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, - ", request: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCoreHttpPluginApi", - "section": "def-server.KibanaRequest", - "text": "KibanaRequest" - }, - ") => Promise<", - { - "pluginId": "fleet", - "scope": "common", "docId": "kibFleetPluginApi", - "section": "def-common.UpdatePackagePolicy", - "text": "UpdatePackagePolicy" - }, - ">]" + "section": "def-server.ExternalCallback", + "text": "ExternalCallback" + } ], "path": "x-pack/plugins/fleet/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "fleet", @@ -5291,19 +5437,23 @@ ], "path": "x-pack/plugins/fleet/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "fleet", - "id": "def-server.packageName", + "id": "def-server.FleetStartContract.createArtifactsClient.$1", "type": "string", "tags": [], "label": "packageName", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/fleet/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "start", diff --git a/api_docs/fleet.mdx b/api_docs/fleet.mdx index c02764f5b94fe..39f2921cf9234 100644 --- a/api_docs/fleet.mdx +++ b/api_docs/fleet.mdx @@ -18,7 +18,7 @@ import fleetObj from './fleet.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 1140 | 15 | 1045 | 8 | +| 1149 | 15 | 1049 | 8 | ## Client diff --git a/api_docs/global_search.json b/api_docs/global_search.json index ae8a7b4ea74af..87c7e1e1a0a8c 100644 --- a/api_docs/global_search.json +++ b/api_docs/global_search.json @@ -398,8 +398,8 @@ ], "path": "x-pack/plugins/global_search/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -948,11 +948,10 @@ ], "path": "x-pack/plugins/global_search/server/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "globalSearch", - "id": "def-server.context", + "id": "def-server.GlobalSearchResultProvider.getSearchableTypes.$1", "type": "Object", "tags": [], "label": "context", @@ -967,9 +966,11 @@ } ], "path": "x-pack/plugins/global_search/server/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1066,8 +1067,8 @@ ], "path": "x-pack/plugins/global_search/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/home.json b/api_docs/home.json index 4e6e7e84561ad..c30afaa4a024c 100644 --- a/api_docs/home.json +++ b/api_docs/home.json @@ -241,7 +241,9 @@ "(() => boolean) | undefined" ], "path": "src/plugins/home/public/services/feature_catalogue/feature_catalogue_registry.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "home", @@ -461,6 +463,35 @@ ], "path": "src/plugins/home/public/services/tutorials/tutorial_service.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "home", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "home", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -475,6 +506,35 @@ ], "path": "src/plugins/home/public/services/tutorials/tutorial_service.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "home", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "home", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -489,6 +549,35 @@ ], "path": "src/plugins/home/public/services/tutorials/tutorial_service.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "home", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "home", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -951,6 +1040,8 @@ ], "path": "src/plugins/home/server/services/sample_data/lib/sample_dataset_registry_types.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -967,6 +1058,22 @@ ], "path": "src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "home", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "TutorialContext" + ], + "path": "src/plugins/home/server/services/tutorials/lib/tutorials_registry_types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/home.mdx b/api_docs/home.mdx index e6ddbfa5c95aa..f84e5a228a76e 100644 --- a/api_docs/home.mdx +++ b/api_docs/home.mdx @@ -18,7 +18,7 @@ import homeObj from './home.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 94 | 0 | 70 | 5 | +| 101 | 3 | 77 | 5 | ## Client diff --git a/api_docs/index_pattern_field_editor.json b/api_docs/index_pattern_field_editor.json index 38ab5859f86c8..430110f239414 100644 --- a/api_docs/index_pattern_field_editor.json +++ b/api_docs/index_pattern_field_editor.json @@ -314,22 +314,34 @@ ], "path": "src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "indexPatternFieldEditor", - "id": "def-public.newParams", + "id": "def-public.FormatEditorProps.onChange.$1.newParams", "type": "Object", "tags": [], "label": "newParams", "description": [], - "signature": [ - "{ [key: string]: any; }" - ], "path": "src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "indexPatternFieldEditor", + "id": "def-public.FormatEditorProps.onChange.$1.newParams.Unnamed", + "type": "Any", + "tags": [], + "label": "Unnamed", + "description": [], + "signature": [ + "any" + ], + "path": "src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "indexPatternFieldEditor", @@ -405,7 +417,24 @@ "((fieldNames: string[]) => void) | undefined" ], "path": "src/plugins/index_pattern_field_editor/public/open_delete_modal.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "indexPatternFieldEditor", + "id": "def-public.OpenFieldDeleteModalOptions.onDelete.$1", + "type": "Array", + "tags": [], + "label": "fieldNames", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/index_pattern_field_editor/public/open_delete_modal.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "indexPatternFieldEditor", @@ -473,7 +502,30 @@ ") => void) | undefined" ], "path": "src/plugins/index_pattern_field_editor/public/open_editor.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "indexPatternFieldEditor", + "id": "def-public.OpenFieldEditorOptions.onSave.$1", + "type": "Object", + "tags": [], + "label": "field", + "description": [], + "signature": [ + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataIndexPatternsPluginApi", + "section": "def-common.IndexPatternField", + "text": "IndexPatternField" + } + ], + "path": "src/plugins/index_pattern_field_editor/public/open_editor.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "indexPatternFieldEditor", @@ -548,6 +600,8 @@ ], "path": "src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false } ], diff --git a/api_docs/index_pattern_field_editor.mdx b/api_docs/index_pattern_field_editor.mdx index a231ac79bd77b..f35b78a4d8195 100644 --- a/api_docs/index_pattern_field_editor.mdx +++ b/api_docs/index_pattern_field_editor.mdx @@ -18,7 +18,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 41 | 1 | 36 | 3 | +| 44 | 2 | 39 | 3 | ## Client diff --git a/api_docs/infra.json b/api_docs/infra.json index 86bad7fb6f783..5e40eab3a0c0f 100644 --- a/api_docs/infra.json +++ b/api_docs/infra.json @@ -358,21 +358,24 @@ ], "path": "x-pack/plugins/infra/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "infra", - "id": "def-server.sourceId", + "id": "def-server.InfraPluginSetup.defineInternalSourceConfiguration.$1", "type": "string", "tags": [], "label": "sourceId", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/infra/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "infra", - "id": "def-server.sourceProperties", + "id": "def-server.InfraPluginSetup.defineInternalSourceConfiguration.$2", "type": "Object", "tags": [], "label": "sourceProperties", @@ -381,9 +384,11 @@ "InfraStaticSourceConfiguration" ], "path": "x-pack/plugins/infra/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/inspector.json b/api_docs/inspector.json index 4b246e5dfc0dc..a664d83be259b 100644 --- a/api_docs/inspector.json +++ b/api_docs/inspector.json @@ -881,7 +881,30 @@ ") => boolean) | undefined" ], "path": "src/plugins/inspector/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "inspector", + "id": "def-public.InspectorViewDescription.shouldShow.$1", + "type": "Object", + "tags": [], + "label": "adapters", + "description": [], + "signature": [ + { + "pluginId": "inspector", + "scope": "common", + "docId": "kibInspectorPluginApi", + "section": "def-common.Adapters", + "text": "Adapters" + } + ], + "path": "src/plugins/inspector/public/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "inspector", @@ -1181,13 +1204,10 @@ ], "path": "src/plugins/inspector/public/plugin.tsx", "deprecated": false, - "returnComment": [ - "True, if a call to `open` with the same adapters\nwould have shown the inspector panel, false otherwise." - ], "children": [ { "parentPluginId": "inspector", - "id": "def-public.adapters", + "id": "def-public.Start.isAvailable.$1", "type": "Object", "tags": [], "label": "adapters", @@ -1205,8 +1225,12 @@ " | undefined" ], "path": "src/plugins/inspector/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } + ], + "returnComment": [ + "True, if a call to `open` with the same adapters\nwould have shown the inspector panel, false otherwise." ] }, { @@ -1249,13 +1273,10 @@ ], "path": "src/plugins/inspector/public/plugin.tsx", "deprecated": false, - "returnComment": [ - "The session instance for the opened inspector." - ], "children": [ { "parentPluginId": "inspector", - "id": "def-public.adapters", + "id": "def-public.Start.open.$1", "type": "Object", "tags": [], "label": "adapters", @@ -1272,11 +1293,12 @@ } ], "path": "src/plugins/inspector/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "inspector", - "id": "def-public.options", + "id": "def-public.Start.open.$2", "type": "Object", "tags": [], "label": "options", @@ -1294,8 +1316,12 @@ " | undefined" ], "path": "src/plugins/inspector/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } + ], + "returnComment": [ + "The session instance for the opened inspector." ] } ], diff --git a/api_docs/inspector.mdx b/api_docs/inspector.mdx index e89f1a98fb493..33fb9823ba592 100644 --- a/api_docs/inspector.mdx +++ b/api_docs/inspector.mdx @@ -18,7 +18,7 @@ import inspectorObj from './inspector.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 101 | 6 | 78 | 4 | +| 102 | 6 | 79 | 4 | ## Client diff --git a/api_docs/kibana_legacy.json b/api_docs/kibana_legacy.json index de011fadbcbea..9c05836b3fc2a 100644 --- a/api_docs/kibana_legacy.json +++ b/api_docs/kibana_legacy.json @@ -919,7 +919,24 @@ "((...args: any[]) => void) | undefined" ], "path": "src/plugins/kibana_legacy/public/angular/angular_config.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaLegacy", + "id": "def-public.RouteConfiguration.resolveRedirectTo.$1", + "type": "Array", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "any[]" + ], + "path": "src/plugins/kibana_legacy/public/angular/angular_config.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "kibanaLegacy", @@ -999,7 +1016,24 @@ "[]) | undefined" ], "path": "src/plugins/kibana_legacy/public/angular/angular_config.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaLegacy", + "id": "def-public.RouteConfiguration.k7Breadcrumbs.$1", + "type": "Array", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "any[]" + ], + "path": "src/plugins/kibana_legacy/public/angular/angular_config.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "kibanaLegacy", @@ -1060,6 +1094,38 @@ ], "path": "src/plugins/kibana_legacy/public/utils/private.d.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaLegacy", + "id": "def-public.provider", + "type": "Function", + "tags": [], + "label": "provider", + "description": [], + "signature": [ + "(...injectable: any[]) => T" + ], + "path": "src/plugins/kibana_legacy/public/utils/private.d.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaLegacy", + "id": "def-public.injectable", + "type": "Array", + "tags": [], + "label": "injectable", + "description": [], + "signature": [ + "any[]" + ], + "path": "src/plugins/kibana_legacy/public/utils/private.d.ts", + "deprecated": false + } + ] + } + ], "initialIsOpen": false }, { diff --git a/api_docs/kibana_legacy.mdx b/api_docs/kibana_legacy.mdx index 0cd1ce47b6b88..e3253990a134a 100644 --- a/api_docs/kibana_legacy.mdx +++ b/api_docs/kibana_legacy.mdx @@ -18,7 +18,7 @@ Contact [Kibana App](https://github.com/orgs/elastic/teams/kibana-app) for quest | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 66 | 3 | 62 | 1 | +| 70 | 3 | 66 | 1 | ## Client diff --git a/api_docs/kibana_react.json b/api_docs/kibana_react.json index f54de84490de5..9c1390cdba8c6 100644 --- a/api_docs/kibana_react.json +++ b/api_docs/kibana_react.json @@ -892,6 +892,35 @@ ], "path": "src/plugins/kibana_react/public/context/context.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaReact", + "id": "def-public.props", + "type": "CompoundType", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P & { children?: React.ReactNode; }" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaReact", + "id": "def-public.context", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1835,8 +1864,8 @@ ], "path": "src/plugins/kibana_react/public/exit_full_screen_button/exit_full_screen_button.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1992,7 +2021,9 @@ "(() => void) | undefined" ], "path": "src/plugins/kibana_react/public/field_button/field_button.tsx", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "kibanaReact", @@ -2381,24 +2412,24 @@ ], "path": "src/plugins/kibana_react/public/overlays/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaReact", - "id": "def-public.node", + "id": "def-public.KibanaReactOverlays.openFlyout.$1", "type": "CompoundType", "tags": [], "label": "node", "description": [], "signature": [ - "string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | null | undefined" + "React.ReactNode" ], "path": "src/plugins/kibana_react/public/overlays/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "kibanaReact", - "id": "def-public.options", + "id": "def-public.KibanaReactOverlays.openFlyout.$2", "type": "Object", "tags": [], "label": "options", @@ -2414,9 +2445,11 @@ " | undefined" ], "path": "src/plugins/kibana_react/public/overlays/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaReact", @@ -2445,24 +2478,24 @@ ], "path": "src/plugins/kibana_react/public/overlays/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaReact", - "id": "def-public.node", + "id": "def-public.KibanaReactOverlays.openModal.$1", "type": "CompoundType", "tags": [], "label": "node", "description": [], "signature": [ - "string | number | boolean | {} | React.ReactElement React.ReactElement React.Component)> | null) | (new (props: any) => React.Component)> | React.ReactNodeArray | React.ReactPortal | null | undefined" + "React.ReactNode" ], "path": "src/plugins/kibana_react/public/overlays/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "kibanaReact", - "id": "def-public.options", + "id": "def-public.KibanaReactOverlays.openModal.$2", "type": "Object", "tags": [], "label": "options", @@ -2478,9 +2511,11 @@ " | undefined" ], "path": "src/plugins/kibana_react/public/overlays/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -3199,7 +3234,25 @@ ".IStandaloneCodeEditor) => void) | undefined" ], "path": "src/plugins/kibana_react/public/url_template_editor/url_template_editor.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaReact", + "id": "def-public.UrlTemplateEditorProps.onEditor.$1", + "type": "Object", + "tags": [], + "label": "editor", + "description": [], + "signature": [ + "editor", + ".IStandaloneCodeEditor" + ], + "path": "src/plugins/kibana_react/public/url_template_editor/url_template_editor.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "kibanaReact", @@ -4198,6 +4251,43 @@ ], "path": "src/plugins/kibana_react/common/eui_styled_components.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaReact", + "id": "def-common.first", + "type": "CompoundType", + "tags": [], + "label": "first", + "description": [], + "signature": [ + "CSSObject", + " | ", + "InterpolationFunction", + "<", + "ThemedStyledProps", + "> | TemplateStringsArray" + ], + "path": "node_modules/@types/styled-components/ts3.7/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaReact", + "id": "def-common.interpolations", + "type": "Array", + "tags": [], + "label": "interpolations", + "description": [], + "signature": [ + "Interpolation", + "<", + "ThemedStyledProps", + ">[]" + ], + "path": "node_modules/@types/styled-components/ts3.7/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -4374,6 +4464,37 @@ ], "path": "src/plugins/kibana_react/common/eui_styled_components.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaReact", + "id": "def-common.strings", + "type": "CompoundType", + "tags": [], + "label": "strings", + "description": [], + "signature": [ + "TemplateStringsArray | ", + "CSSKeyframes" + ], + "path": "node_modules/@types/styled-components/ts3.7/index.d.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaReact", + "id": "def-common.interpolations", + "type": "Array", + "tags": [], + "label": "interpolations", + "description": [], + "signature": [ + "SimpleInterpolation", + "[]" + ], + "path": "node_modules/@types/styled-components/ts3.7/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -4404,6 +4525,22 @@ ], "path": "src/plugins/kibana_react/common/eui_styled_components.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaReact", + "id": "def-common.component", + "type": "Uncategorized", + "tags": [], + "label": "component", + "description": [], + "signature": [ + "React.ComponentProps extends { theme?: T | undefined; } ? C : never" + ], + "path": "node_modules/@types/styled-components/ts3.7/index.d.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/kibana_react.mdx b/api_docs/kibana_react.mdx index 3a89efb7af28c..95aa1fb017ea5 100644 --- a/api_docs/kibana_react.mdx +++ b/api_docs/kibana_react.mdx @@ -18,7 +18,7 @@ import kibanaReactObj from './kibana_react.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 258 | 5 | 228 | 4 | +| 266 | 6 | 236 | 4 | ## Client diff --git a/api_docs/kibana_utils.json b/api_docs/kibana_utils.json index 4c9a86ba830de..fa59e31712129 100644 --- a/api_docs/kibana_utils.json +++ b/api_docs/kibana_utils.json @@ -1673,7 +1673,24 @@ "((error: Error) => void) | undefined" ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError.onGetError.$1", + "type": "Object", + "tags": [], + "label": "error", + "description": [], + "signature": [ + "Error" + ], + "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -1686,7 +1703,24 @@ "((error: Error) => void) | undefined" ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.createKbnUrlStateStorage.$1.useHashfalsehistoryonGetErroronSetError.onSetError.$1", + "type": "Object", + "tags": [], + "label": "error", + "description": [], + "signature": [ + "Error" + ], + "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ] } @@ -2015,7 +2049,9 @@ ") | undefined" ], "path": "src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -2045,7 +2081,26 @@ "((pathname: string) => boolean) | undefined" ], "path": "src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.shouldTrackUrlUpdate.$1", + "type": "string", + "tags": [], + "label": "pathname", + "description": [ + "A location's pathname which comes to history listener" + ], + "signature": [ + "string" + ], + "path": "src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -2060,7 +2115,24 @@ "((newNavLink: string) => string) | undefined" ], "path": "src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.createKbnUrlTracker.$1.baseUrldefaultSubUrlstorageKeystateParamsnavLinkUpdater$toastNotificationshistorygetHistorystorageshouldTrackUrlUpdatereturntrueonBeforeNavLinkSavednewNavLinknewNavLink.onBeforeNavLinkSaved.$1", + "type": "string", + "tags": [], + "label": "newNavLink", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ] } @@ -3513,7 +3585,30 @@ ") => void) | undefined" ], "path": "src/plugins/kibana_utils/public/history/redirect_when_missing.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.redirectWhenMissing.$1.historynavigateToAppbasePathmappingtoastNotificationsonBeforeRedirect.onBeforeRedirect.$1", + "type": "Object", + "tags": [], + "label": "error", + "description": [], + "signature": [ + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.SavedObjectNotFound", + "text": "SavedObjectNotFound" + } + ], + "path": "src/plugins/kibana_utils/public/history/redirect_when_missing.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ] } @@ -4260,10 +4355,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "children": [], "returnComment": [ "current state" - ], - "children": [] + ] }, { "parentPluginId": "kibanaUtils", @@ -4279,11 +4374,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.state", + "id": "def-public.BaseStateContainer.set.$1", "type": "Uncategorized", "tags": [], "label": "state", @@ -4294,9 +4388,11 @@ "State" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4368,11 +4464,10 @@ ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.config", + "id": "def-public.CollectConfigProps.onConfig.$1", "type": "Uncategorized", "tags": [], "label": "config", @@ -4381,9 +4476,11 @@ "Config" ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4439,11 +4536,10 @@ ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.context", + "id": "def-public.Configurable.createConfig.$1", "type": "Uncategorized", "tags": [], "label": "context", @@ -4452,9 +4548,11 @@ "Context" ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4470,11 +4568,10 @@ ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.config", + "id": "def-public.Configurable.isConfigValid.$1", "type": "Uncategorized", "tags": [], "label": "config", @@ -4483,11 +4580,12 @@ "Config" ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-public.context", + "id": "def-public.Configurable.isConfigValid.$2", "type": "Uncategorized", "tags": [], "label": "context", @@ -4496,9 +4594,11 @@ "Context" ], "path": "src/plugins/kibana_utils/public/ui/configurable.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4561,7 +4661,24 @@ "((state: T) => T) | undefined" ], "path": "src/plugins/kibana_utils/common/state_containers/create_state_container.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.CreateStateContainerOptions.freeze.$1", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/state_containers/create_state_container.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -4601,21 +4718,24 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IKbnUrlStateStorage.set.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-public.state", + "id": "def-public.IKbnUrlStateStorage.set.$2", "type": "Uncategorized", "tags": [], "label": "state", @@ -4624,22 +4744,33 @@ "State" ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-public.opts", + "id": "def-public.IKbnUrlStateStorage.set.$3.opts", "type": "Object", "tags": [], "label": "opts", "description": [], - "signature": [ - "{ replace: boolean; } | undefined" - ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.IKbnUrlStateStorage.set.$3.opts.replace", + "type": "boolean", + "tags": [], + "label": "replace", + "description": [], + "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4653,19 +4784,23 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IKbnUrlStateStorage.get.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4681,19 +4816,23 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IKbnUrlStateStorage.change$.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4709,8 +4848,8 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_kbn_url_state_storage.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4772,11 +4911,10 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.state", + "id": "def-public.INullableBaseStateContainer.set.$1", "type": "CompoundType", "tags": [], "label": "state", @@ -4785,9 +4923,11 @@ "State | null" ], "path": "src/plugins/kibana_utils/public/state_sync/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -4827,21 +4967,24 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.ISessionStorageStateStorage.set.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-public.state", + "id": "def-public.ISessionStorageStateStorage.set.$2", "type": "Uncategorized", "tags": [], "label": "state", @@ -4850,9 +4993,11 @@ "State" ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -4866,19 +5011,23 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.ISessionStorageStateStorage.get.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -4989,19 +5138,23 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IStorage.getItem.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5015,21 +5168,24 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IStorage.setItem.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-public.value", + "id": "def-public.IStorage.setItem.$2", "type": "Uncategorized", "tags": [], "label": "value", @@ -5038,9 +5194,11 @@ "T" ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5054,19 +5212,23 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IStorage.removeItem.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5080,8 +5242,8 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -5118,19 +5280,23 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IStorageWrapper.get.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5144,21 +5310,24 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IStorageWrapper.set.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-public.value", + "id": "def-public.IStorageWrapper.set.$2", "type": "Uncategorized", "tags": [], "label": "value", @@ -5167,9 +5336,11 @@ "T" ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5183,19 +5354,23 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.key", + "id": "def-public.IStorageWrapper.remove.$1", "type": "string", "tags": [], "label": "key", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/kibana_utils/public/storage/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5209,8 +5384,8 @@ ], "path": "src/plugins/kibana_utils/public/storage/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -5370,8 +5545,8 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5438,24 +5613,30 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.nextReducer", + "id": "def-public.ReduxLikeStateContainer.replaceReducer.$1", "type": "Function", "tags": [], "label": "nextReducer", "description": [], "signature": [ - "(state: State, action: ", - "TransitionDescription", - ") => State" + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.Reducer", + "text": "Reducer" + }, + "" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5471,11 +5652,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.action", + "id": "def-public.ReduxLikeStateContainer.dispatch.$1", "type": "Object", "tags": [], "label": "action", @@ -5485,9 +5665,11 @@ "" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5509,42 +5691,30 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.middleware", + "id": "def-public.ReduxLikeStateContainer.addMiddleware.$1", "type": "Function", "tags": [], "label": "middleware", "description": [], "signature": [ - "(store: Pick<", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.ReduxLikeStateContainer", - "text": "ReduxLikeStateContainer" - }, - ", \"getState\" | \"dispatch\">) => (next: (action: ", - "TransitionDescription", - ") => any) => ", { "pluginId": "kibanaUtils", "scope": "common", "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.Dispatch", - "text": "Dispatch" + "section": "def-common.Middleware", + "text": "Middleware" }, - "<", - "TransitionDescription", - ">" + "" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -5558,11 +5728,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-public.listener", + "id": "def-public.ReduxLikeStateContainer.subscribe.$1", "type": "Function", "tags": [], "label": "listener", @@ -5571,9 +5740,11 @@ "(state: State) => void" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -5844,6 +6015,35 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.previous", + "type": "Uncategorized", + "tags": [], + "label": "previous", + "description": [], + "signature": [ + "Result" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-public.current", + "type": "Uncategorized", + "tags": [], + "label": "current", + "description": [], + "signature": [ + "Result" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -5868,6 +6068,38 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.mapStateToProp", + "type": "Function", + "tags": [], + "label": "mapStateToProp", + "description": [], + "signature": [ + "(state: State) => Pick" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ] + } + ], "initialIsOpen": false }, { @@ -5884,6 +6116,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.action", + "type": "Uncategorized", + "tags": [], + "label": "action", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -5906,6 +6154,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -5922,6 +6186,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -5936,6 +6216,8 @@ ], "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -5952,6 +6234,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -5988,6 +6286,24 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.store", + "type": "Object", + "tags": [], + "label": "store", + "description": [], + "signature": [ + "{ getState: () => State; dispatch: (action: ", + "TransitionDescription", + ") => void; }" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -6010,6 +6326,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -6067,6 +6399,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.args", + "type": "Uncategorized", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "Args" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -6085,34 +6433,96 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "initialIsOpen": false - }, - { - "parentPluginId": "kibanaUtils", - "id": "def-public.Selector", - "type": "Type", - "tags": [], - "label": "Selector", - "description": [], - "signature": [ - "(...args: Args) => Result" - ], - "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false, - "initialIsOpen": false - }, - { - "parentPluginId": "kibanaUtils", - "id": "def-public.Set", - "type": "Type", - "tags": [], - "label": "Set", - "description": [], - "signature": [ - "(value: T) => void" + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-public.action", + "type": "Object", + "tags": [], + "label": "action", + "description": [], + "signature": [ + "TransitionDescription", + "" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-public.Selector", + "type": "Type", + "tags": [], + "label": "Selector", + "description": [], + "signature": [ + "(...args: Args) => Result" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.args", + "type": "Uncategorized", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "Args" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-public.Set", + "type": "Type", + "tags": [], + "label": "Set", + "description": [], + "signature": [ + "(value: T) => void" ], "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.value", + "type": "Uncategorized", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -6143,6 +6553,8 @@ ], "path": "src/plugins/kibana_utils/public/core/create_start_service_getter.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -6157,6 +6569,8 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -6171,6 +6585,8 @@ ], "path": "src/plugins/kibana_utils/public/state_sync/state_sync.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -6195,6 +6611,8 @@ ], "path": "src/plugins/kibana_utils/common/ui/ui_component.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -6296,7 +6714,33 @@ "(val: string, pctEncodeSpaces?: boolean | undefined) => string" ], "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-public.val", + "type": "string", + "tags": [], + "label": "val", + "description": [], + "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-public.pctEncodeSpaces", + "type": "CompoundType", + "tags": [], + "label": "pctEncodeSpaces", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", + "deprecated": false + } + ] }, { "parentPluginId": "kibanaUtils", @@ -7213,6 +7657,8 @@ ], "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -7227,6 +7673,22 @@ ], "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-server.value", + "type": "Uncategorized", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], @@ -7284,7 +7746,33 @@ "(val: string, pctEncodeSpaces?: boolean | undefined) => string" ], "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-server.val", + "type": "string", + "tags": [], + "label": "val", + "description": [], + "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-server.pctEncodeSpaces", + "type": "CompoundType", + "tags": [], + "label": "pctEncodeSpaces", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", + "deprecated": false + } + ] }, { "parentPluginId": "kibanaUtils", @@ -8975,10 +9463,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "children": [], "returnComment": [ "current state" - ], - "children": [] + ] }, { "parentPluginId": "kibanaUtils", @@ -8994,11 +9482,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.state", + "id": "def-common.BaseStateContainer.set.$1", "type": "Uncategorized", "tags": [], "label": "state", @@ -9009,9 +9496,11 @@ "State" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -9057,7 +9546,24 @@ "((state: T) => T) | undefined" ], "path": "src/plugins/kibana_utils/common/state_containers/create_state_container.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.CreateStateContainerOptions.freeze.$1", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/state_containers/create_state_container.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -9156,13 +9662,10 @@ ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", "deprecated": false, - "returnComment": [ - "A new stats object augmented with new telemetry information." - ], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.state", + "id": "def-common.PersistableState.telemetry.$1", "type": "Uncategorized", "tags": [], "label": "state", @@ -9173,11 +9676,12 @@ "P" ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-common.stats", + "id": "def-common.PersistableState.telemetry.$2", "type": "Object", "tags": [], "label": "stats", @@ -9185,11 +9689,15 @@ "Stats object containing the stats which were already\ncollected. This `stats` object shall not be mutated in-line." ], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "A new stats object augmented with new telemetry information." ] }, { @@ -9208,13 +9716,10 @@ ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", "deprecated": false, - "returnComment": [ - "Persistable state object with references injected." - ], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.state", + "id": "def-common.PersistableState.inject.$1", "type": "Uncategorized", "tags": [], "label": "state", @@ -9225,11 +9730,12 @@ "P" ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "kibanaUtils", - "id": "def-common.references", + "id": "def-common.PersistableState.inject.$2", "type": "Array", "tags": [], "label": "references", @@ -9241,8 +9747,12 @@ "[]" ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "Persistable state object with references injected." ] }, { @@ -9261,13 +9771,10 @@ ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", "deprecated": false, - "returnComment": [ - "Persistable state object with references extracted and a list of\nreferences." - ], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.state", + "id": "def-common.PersistableState.extract.$1", "type": "Uncategorized", "tags": [], "label": "state", @@ -9278,8 +9785,12 @@ "P" ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "Persistable state object with references extracted and a list of\nreferences." ] }, { @@ -9502,7 +10013,43 @@ ">) => P) | undefined" ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.PersistableStateService.migrateToLatest.$1", + "type": "Object", + "tags": [], + "label": "state", + "description": [ + "The persistable state serializable state object." + ], + "signature": [ + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.VersionedState", + "text": "VersionedState" + }, + "<", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.SerializableState", + "text": "SerializableState" + }, + ">" + ], + "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [ + "A serializable state object migrated to the latest state." + ] }, { "parentPluginId": "kibanaUtils", @@ -9525,8 +10072,8 @@ ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -9573,8 +10120,8 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -9641,24 +10188,30 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.nextReducer", + "id": "def-common.ReduxLikeStateContainer.replaceReducer.$1", "type": "Function", "tags": [], "label": "nextReducer", "description": [], "signature": [ - "(state: State, action: ", - "TransitionDescription", - ") => State" - ], - "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false - } - ] + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.Reducer", + "text": "Reducer" + }, + "" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -9674,11 +10227,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.action", + "id": "def-common.ReduxLikeStateContainer.dispatch.$1", "type": "Object", "tags": [], "label": "action", @@ -9688,9 +10240,11 @@ "" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -9712,42 +10266,30 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.middleware", + "id": "def-common.ReduxLikeStateContainer.addMiddleware.$1", "type": "Function", "tags": [], "label": "middleware", "description": [], "signature": [ - "(store: Pick<", - { - "pluginId": "kibanaUtils", - "scope": "common", - "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.ReduxLikeStateContainer", - "text": "ReduxLikeStateContainer" - }, - ", \"getState\" | \"dispatch\">) => (next: (action: ", - "TransitionDescription", - ") => any) => ", { "pluginId": "kibanaUtils", "scope": "common", "docId": "kibKibanaUtilsPluginApi", - "section": "def-common.Dispatch", - "text": "Dispatch" + "section": "def-common.Middleware", + "text": "Middleware" }, - "<", - "TransitionDescription", - ">" + "" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "kibanaUtils", @@ -9761,11 +10303,10 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "kibanaUtils", - "id": "def-common.listener", + "id": "def-common.ReduxLikeStateContainer.subscribe.$1", "type": "Function", "tags": [], "label": "listener", @@ -9774,9 +10315,11 @@ "(state: State) => void" ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -10033,6 +10576,35 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.previous", + "type": "Uncategorized", + "tags": [], + "label": "previous", + "description": [], + "signature": [ + "Result" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-common.current", + "type": "Uncategorized", + "tags": [], + "label": "current", + "description": [], + "signature": [ + "Result" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10057,6 +10629,38 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.mapStateToProp", + "type": "Function", + "tags": [], + "label": "mapStateToProp", + "description": [], + "signature": [ + "(state: State) => Pick" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ] + } + ], "initialIsOpen": false }, { @@ -10073,6 +10677,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.action", + "type": "Uncategorized", + "tags": [], + "label": "action", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10095,6 +10715,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10111,6 +10747,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10125,6 +10777,8 @@ ], "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -10141,6 +10795,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10177,6 +10847,24 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.store", + "type": "Object", + "tags": [], + "label": "store", + "description": [], + "signature": [ + "{ getState: () => State; dispatch: (action: ", + "TransitionDescription", + ") => void; }" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10191,6 +10879,22 @@ ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "FromVersion" + ], + "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10274,6 +10978,40 @@ ], "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Object", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "{ [key: string]: ", + { + "pluginId": "kibanaUtils", + "scope": "common", + "docId": "kibKibanaUtilsPluginApi", + "section": "def-common.Serializable", + "text": "Serializable" + }, + "; }" + ], + "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-common.version", + "type": "string", + "tags": [], + "label": "version", + "description": [], + "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10296,6 +11034,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10353,6 +11107,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.args", + "type": "Uncategorized", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "Args" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10371,6 +11141,36 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.state", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "State" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-common.action", + "type": "Object", + "tags": [], + "label": "action", + "description": [], + "signature": [ + "TransitionDescription", + "" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10385,6 +11185,22 @@ ], "path": "src/plugins/kibana_utils/common/state_containers/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.args", + "type": "Uncategorized", + "tags": [], + "label": "args", + "description": [], + "signature": [ + "Args" + ], + "path": "src/plugins/kibana_utils/common/state_containers/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10475,6 +11291,22 @@ ], "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.value", + "type": "Uncategorized", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/kibana_utils/common/create_getter_setter.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -10499,6 +11331,8 @@ ], "path": "src/plugins/kibana_utils/common/ui/ui_component.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -10580,7 +11414,33 @@ "(val: string, pctEncodeSpaces?: boolean | undefined) => string" ], "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", - "deprecated": false + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "kibanaUtils", + "id": "def-common.val", + "type": "string", + "tags": [], + "label": "val", + "description": [], + "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", + "deprecated": false + }, + { + "parentPluginId": "kibanaUtils", + "id": "def-common.pctEncodeSpaces", + "type": "CompoundType", + "tags": [], + "label": "pctEncodeSpaces", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/kibana_utils/common/url/encode_uri_query.ts", + "deprecated": false + } + ] }, { "parentPluginId": "kibanaUtils", diff --git a/api_docs/kibana_utils.mdx b/api_docs/kibana_utils.mdx index 26abebb3442d6..d3b81d90994b4 100644 --- a/api_docs/kibana_utils.mdx +++ b/api_docs/kibana_utils.mdx @@ -18,7 +18,7 @@ import kibanaUtilsObj from './kibana_utils.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 551 | 3 | 359 | 8 | +| 600 | 3 | 406 | 8 | ## Client diff --git a/api_docs/lens.json b/api_docs/lens.json index f936a7a91e85a..34408d962cead 100644 --- a/api_docs/lens.json +++ b/api_docs/lens.json @@ -627,26 +627,30 @@ ], "path": "x-pack/plugins/lens/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "lens", - "id": "def-public.input", + "id": "def-public.LensPublicStart.navigateToPrefilledEditor.$1", "type": "CompoundType", "tags": [], "label": "input", "description": [], "signature": [ - "LensByValueInput", - " | ", - "LensByReferenceInput" + { + "pluginId": "lens", + "scope": "public", + "docId": "kibLensPluginApi", + "section": "def-public.LensEmbeddableInput", + "text": "LensEmbeddableInput" + } ], "path": "x-pack/plugins/lens/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "lens", - "id": "def-public.openInNewTab", + "id": "def-public.LensPublicStart.navigateToPrefilledEditor.$2", "type": "CompoundType", "tags": [], "label": "openInNewTab", @@ -655,9 +659,11 @@ "boolean | undefined" ], "path": "x-pack/plugins/lens/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "lens", @@ -673,8 +679,8 @@ ], "path": "x-pack/plugins/lens/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "lens", @@ -692,8 +698,8 @@ ], "path": "x-pack/plugins/lens/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -3459,7 +3465,8 @@ "section": "def-common.PersistableFilter", "text": "PersistableFilter" }, - " extends any" + " extends ", + "Filter" ], "path": "x-pack/plugins/lens/common/types.ts", "deprecated": false, @@ -3501,7 +3508,8 @@ "section": "def-common.PersistableFilterMeta", "text": "PersistableFilterMeta" }, - " extends any" + " extends ", + "FilterMeta" ], "path": "x-pack/plugins/lens/common/types.ts", "deprecated": false, @@ -3637,6 +3645,29 @@ ], "path": "x-pack/plugins/lens/common/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "lens", + "id": "def-common.mapping", + "type": "Object", + "tags": [], + "label": "mapping", + "description": [], + "signature": [ + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.SerializedFieldFormat", + "text": "SerializedFieldFormat" + }, + "> | undefined" + ], + "path": "x-pack/plugins/lens/common/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/lens.mdx b/api_docs/lens.mdx index c7e65c3036e7a..eec8be6fa3824 100644 --- a/api_docs/lens.mdx +++ b/api_docs/lens.mdx @@ -18,7 +18,7 @@ Contact [Kibana App](https://github.com/orgs/elastic/teams/kibana-app) for quest | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 207 | 0 | 191 | 23 | +| 208 | 0 | 192 | 23 | ## Client diff --git a/api_docs/licensing.json b/api_docs/licensing.json index 27a4b9248f0bf..7c115d73327bd 100644 --- a/api_docs/licensing.json +++ b/api_docs/licensing.json @@ -143,8 +143,8 @@ ], "path": "x-pack/plugins/licensing/common/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "licensing", @@ -175,8 +175,8 @@ ], "path": "x-pack/plugins/licensing/common/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "licensing", @@ -764,11 +764,7 @@ }, { "plugin": "reporting", - "path": "x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx" - }, - { - "plugin": "reporting", - "path": "x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx" + "path": "x-pack/plugins/reporting/public/share_context_menu/index.ts" }, { "plugin": "reporting", @@ -1849,8 +1845,8 @@ ], "path": "x-pack/plugins/licensing/common/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "licensing", @@ -1881,8 +1877,8 @@ ], "path": "x-pack/plugins/licensing/common/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "licensing", @@ -2409,6 +2405,22 @@ ], "path": "x-pack/plugins/licensing/server/wrap_route_with_license_check.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "licensing", + "id": "def-server.license", + "type": "Object", + "tags": [], + "label": "license", + "description": [], + "signature": [ + "ILicense" + ], + "path": "x-pack/plugins/licensing/server/wrap_route_with_license_check.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -2739,11 +2751,10 @@ ], "path": "x-pack/plugins/licensing/server/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "licensing", - "id": "def-server.clusterClient", + "id": "def-server.LicensingPluginStart.createLicensePoller.$1", "type": "Object", "tags": [], "label": "clusterClient", @@ -2758,19 +2769,25 @@ } ], "path": "x-pack/plugins/licensing/server/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "licensing", - "id": "def-server.pollingFrequency", + "id": "def-server.LicensingPluginStart.createLicensePoller.$2", "type": "number", "tags": [], "label": "pollingFrequency", "description": [], + "signature": [ + "number" + ], "path": "x-pack/plugins/licensing/server/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "licensing", diff --git a/api_docs/licensing.mdx b/api_docs/licensing.mdx index 84cba56ea87d2..4b378e9773b11 100644 --- a/api_docs/licensing.mdx +++ b/api_docs/licensing.mdx @@ -18,7 +18,7 @@ import licensingObj from './licensing.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 117 | 0 | 42 | 8 | +| 118 | 0 | 43 | 8 | ## Client diff --git a/api_docs/lists.json b/api_docs/lists.json index 9e18c73ec444f..db65a52a8e4c5 100644 --- a/api_docs/lists.json +++ b/api_docs/lists.json @@ -2551,8 +2551,8 @@ ], "path": "x-pack/plugins/lists/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "lists", @@ -2573,8 +2573,8 @@ ], "path": "x-pack/plugins/lists/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/management.json b/api_docs/management.json index 44482a9a6dda2..5ec2da0cdf204 100644 --- a/api_docs/management.json +++ b/api_docs/management.json @@ -499,11 +499,10 @@ ], "path": "src/plugins/management/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "management", - "id": "def-public.crumbs", + "id": "def-public.ManagementAppMountParams.setBreadcrumbs.$1", "type": "Array", "tags": [], "label": "crumbs", @@ -513,9 +512,11 @@ "[]" ], "path": "src/plugins/management/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "management", diff --git a/api_docs/maps.json b/api_docs/maps.json index 6ea34d19528ad..cb21f32f58a27 100644 --- a/api_docs/maps.json +++ b/api_docs/maps.json @@ -373,7 +373,9 @@ "label": "_getFilters", "description": [], "signature": [ - "() => any[]" + "() => ", + "Filter", + "[]" ], "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", "deprecated": false, @@ -608,7 +610,9 @@ "label": "addFilters", "description": [], "signature": [ - "(filters: any[], actionId?: string) => Promise" + "(filters: ", + "Filter", + "[], actionId?: string) => Promise" ], "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", "deprecated": false, @@ -621,7 +625,8 @@ "label": "filters", "description": [], "signature": [ - "any[]" + "Filter", + "[]" ], "path": "x-pack/plugins/maps/public/embeddable/map_embeddable.tsx", "deprecated": false, @@ -822,7 +827,9 @@ "label": "addFilters", "description": [], "signature": [ - "((filters: any[], actionId: string) => Promise) | null" + "((filters: ", + "Filter", + "[], actionId: string) => Promise) | null" ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", "deprecated": false @@ -839,8 +846,8 @@ ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "maps", @@ -875,7 +882,9 @@ ") | undefined" ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "maps", @@ -896,7 +905,9 @@ "[]>) | undefined" ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "maps", @@ -910,19 +921,23 @@ ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "maps", - "id": "def-public.layerId", + "id": "def-public.RenderTooltipContentParams.getLayerName.$1", "type": "string", "tags": [], "label": "layerId", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "maps", @@ -948,22 +963,57 @@ ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "maps", - "id": "def-public.__0", + "id": "def-public.RenderTooltipContentParams.loadFeatureProperties.$1.layerIdfeatureIdmbProperties", "type": "Object", "tags": [], - "label": "__0", + "label": "{\n layerId,\n featureId,\n mbProperties,\n }", "description": [], - "signature": [ - "{ layerId: string; featureId?: string | number | undefined; mbProperties: GeoJSON.GeoJsonProperties; }" - ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.loadFeatureProperties.$1.layerIdfeatureIdmbProperties.layerId", + "type": "string", + "tags": [], + "label": "layerId", + "description": [], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false + }, + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.loadFeatureProperties.$1.layerIdfeatureIdmbProperties.featureId", + "type": "CompoundType", + "tags": [], + "label": "featureId", + "description": [], + "signature": [ + "string | number | undefined" + ], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false + }, + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.loadFeatureProperties.$1.layerIdfeatureIdmbProperties.mbProperties", + "type": "CompoundType", + "tags": [], + "label": "mbProperties", + "description": [], + "signature": [ + "{ [name: string]: any; } | null" + ], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "maps", @@ -977,22 +1027,44 @@ ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "maps", - "id": "def-public.__0", + "id": "def-public.RenderTooltipContentParams.loadFeatureGeometry.$1.layerIdfeatureId", "type": "Object", "tags": [], - "label": "__0", + "label": "{\n layerId,\n featureId,\n }", "description": [], - "signature": [ - "{ layerId: string; featureId?: string | number | undefined; }" - ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.loadFeatureGeometry.$1.layerIdfeatureId.layerId", + "type": "string", + "tags": [], + "label": "layerId", + "description": [], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false + }, + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.loadFeatureGeometry.$1.layerIdfeatureId.featureId", + "type": "CompoundType", + "tags": [], + "label": "featureId", + "description": [], + "signature": [ + "string | number | undefined" + ], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "maps", @@ -1013,7 +1085,58 @@ ") => void) | undefined" ], "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.onSingleValueTrigger.$1", + "type": "string", + "tags": [], + "label": "actionId", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.onSingleValueTrigger.$2", + "type": "string", + "tags": [], + "label": "key", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "maps", + "id": "def-public.RenderTooltipContentParams.onSingleValueTrigger.$3", + "type": "CompoundType", + "tags": [], + "label": "value", + "description": [], + "signature": [ + { + "pluginId": "maps", + "scope": "common", + "docId": "kibMapsPluginApi", + "section": "def-common.RawValue", + "text": "RawValue" + } + ], + "path": "x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts", + "deprecated": false, + "isRequired": false + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1110,8 +1233,8 @@ "pluginId": "data", "scope": "common", "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IIndexPattern", - "text": "IIndexPattern" + "section": "def-common.IndexPattern", + "text": "IndexPattern" }, "[]; }" ], @@ -2359,6 +2482,22 @@ ], "path": "x-pack/plugins/maps/common/constants.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "maps", + "id": "def-common.value", + "type": "CompoundType", + "tags": [], + "label": "value", + "description": [], + "signature": [ + "string | number | boolean | string[] | null | undefined" + ], + "path": "x-pack/plugins/maps/common/constants.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/maps.mdx b/api_docs/maps.mdx index cd7b1641b0f79..994cdb3bd8f7d 100644 --- a/api_docs/maps.mdx +++ b/api_docs/maps.mdx @@ -18,7 +18,7 @@ import mapsObj from './maps.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 204 | 2 | 203 | 11 | +| 213 | 2 | 212 | 11 | ## Client diff --git a/api_docs/maps_ems.json b/api_docs/maps_ems.json index af9faa1a77df2..df458ddf4466d 100644 --- a/api_docs/maps_ems.json +++ b/api_docs/maps_ems.json @@ -783,8 +783,8 @@ ], "path": "src/plugins/maps_ems/public/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/ml.json b/api_docs/ml.json index d30f84f2a1db5..0517a63ea1dbc 100644 --- a/api_docs/ml.json +++ b/api_docs/ml.json @@ -1247,6 +1247,24 @@ ], "path": "x-pack/plugins/ml/public/application/components/data_grid/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "ml", + "id": "def-public.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ rowIndex: number; columnId: string; setCellProps: (props: ", + "CommonProps", + " & React.HTMLAttributes) => void; }" + ], + "path": "x-pack/plugins/ml/public/application/components/data_grid/types.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/ml.mdx b/api_docs/ml.mdx index a866593eb3743..8bb0019735cfd 100644 --- a/api_docs/ml.mdx +++ b/api_docs/ml.mdx @@ -18,7 +18,7 @@ Contact [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) for q | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 278 | 10 | 274 | 33 | +| 279 | 10 | 275 | 33 | ## Client diff --git a/api_docs/monitoring.json b/api_docs/monitoring.json index d5433b1d70f67..8edd098d6f8bf 100644 --- a/api_docs/monitoring.json +++ b/api_docs/monitoring.json @@ -34,8 +34,8 @@ ], "path": "x-pack/plugins/monitoring/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "monitoring", @@ -49,8 +49,8 @@ ], "path": "x-pack/plugins/monitoring/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "monitoring", @@ -72,32 +72,29 @@ ], "path": "x-pack/plugins/monitoring/server/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "monitoring", - "id": "def-server.esClient", + "id": "def-server.IBulkUploader.start.$1", "type": "CompoundType", "tags": [], "label": "esClient", "description": [], "signature": [ - "Pick<", - "KibanaClient", - ", \"get\" | \"delete\" | \"create\" | \"index\" | \"update\" | \"closePointInTime\" | \"count\" | \"search\" | \"security\" | \"eql\" | \"on\" | \"off\" | \"transform\" | \"helpers\" | \"emit\" | \"once\" | \"asyncSearch\" | \"autoscaling\" | \"bulk\" | \"cat\" | \"ccr\" | \"clearScroll\" | \"cluster\" | \"danglingIndices\" | \"dataFrameTransformDeprecated\" | \"deleteByQuery\" | \"deleteByQueryRethrottle\" | \"deleteScript\" | \"enrich\" | \"exists\" | \"existsSource\" | \"explain\" | \"features\" | \"fieldCaps\" | \"fleet\" | \"getScript\" | \"getScriptContext\" | \"getScriptLanguages\" | \"getSource\" | \"graph\" | \"ilm\" | \"indices\" | \"info\" | \"ingest\" | \"license\" | \"logstash\" | \"mget\" | \"migration\" | \"ml\" | \"monitoring\" | \"msearch\" | \"msearchTemplate\" | \"mtermvectors\" | \"nodes\" | \"openPointInTime\" | \"ping\" | \"putScript\" | \"rankEval\" | \"reindex\" | \"reindexRethrottle\" | \"renderSearchTemplate\" | \"rollup\" | \"scriptsPainlessExecute\" | \"scroll\" | \"searchShards\" | \"searchTemplate\" | \"searchableSnapshots\" | \"shutdown\" | \"slm\" | \"snapshot\" | \"sql\" | \"ssl\" | \"tasks\" | \"termsEnum\" | \"termvectors\" | \"textStructure\" | \"updateByQuery\" | \"updateByQueryRethrottle\" | \"watcher\" | \"xpack\"> & { transport: { request(params: ", - "TransportRequestParams", - ", options?: ", - "TransportRequestOptions", - " | undefined): ", - "TransportRequestPromise", - "<", - "ApiResponse", - ", unknown>>; }; }" + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.ElasticsearchClient", + "text": "ElasticsearchClient" + } ], "path": "x-pack/plugins/monitoring/server/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "monitoring", @@ -111,8 +108,8 @@ ], "path": "x-pack/plugins/monitoring/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/observability.json b/api_docs/observability.json index e87ea796c49a6..2a0528878114b 100644 --- a/api_docs/observability.json +++ b/api_docs/observability.json @@ -1479,29 +1479,37 @@ ], "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "observability", - "id": "def-public.by", + "id": "def-public.MetricsFetchDataResponse.sort.$1", "type": "string", "tags": [], "label": "by", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "observability", - "id": "def-public.direction", + "id": "def-public.MetricsFetchDataResponse.sort.$2", "type": "string", "tags": [], "label": "direction", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "observability", @@ -2114,7 +2122,7 @@ "signature": [ "(options: { fields: OutputOf<", "Optional", - "<{ readonly \"kibana.rac.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.rac.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.id\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }) => { reason: string; link: string; }" + "<{ readonly \"kibana.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.id\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }) => { reason: string; link: string; }" ], "path": "x-pack/plugins/observability/public/rules/create_observability_rule_type_registry.ts", "deprecated": false, @@ -2130,7 +2138,7 @@ "signature": [ "{ fields: OutputOf<", "Optional", - "<{ readonly \"kibana.rac.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.rac.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.id\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }" + "<{ readonly \"kibana.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.id\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }" ], "path": "x-pack/plugins/observability/public/rules/create_observability_rule_type_registry.ts", "deprecated": false @@ -2834,6 +2842,28 @@ ], "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "observability", + "id": "def-public.fetchDataParams", + "type": "Object", + "tags": [], + "label": "fetchDataParams", + "description": [], + "signature": [ + { + "pluginId": "observability", + "scope": "public", + "docId": "kibObservabilityPluginApi", + "section": "def-public.FetchDataParams", + "text": "FetchDataParams" + } + ], + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -2864,6 +2894,29 @@ ], "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "observability", + "id": "def-public.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + { + "pluginId": "observability", + "scope": "public", + "docId": "kibObservabilityPluginApi", + "section": "def-public.HasDataParams", + "text": "HasDataParams" + }, + " | undefined" + ], + "path": "x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -2926,10 +2979,28 @@ "signature": [ "(options: { fields: OutputOf<", "Optional", - "<{ readonly \"kibana.rac.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.rac.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.id\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }) => { reason: string; link: string; }" + "<{ readonly \"kibana.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.id\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }) => { reason: string; link: string; }" ], "path": "x-pack/plugins/observability/public/rules/create_observability_rule_type_registry.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "observability", + "id": "def-public.options", + "type": "Object", + "tags": [], + "label": "options", + "description": [], + "signature": [ + "{ fields: OutputOf<", + "Optional", + "<{ readonly \"kibana.rac.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.rac.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.id\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">> & Record; formatters: { asDuration: (value: number | null | undefined, { defaultValue, extended }?: FormatterOptions) => string; asPercent: (numerator: number | null | undefined, denominator: number | undefined, fallbackResult?: string) => string; }; }" + ], + "path": "x-pack/plugins/observability/public/rules/create_observability_rule_type_registry.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -3051,6 +3122,22 @@ ], "path": "x-pack/plugins/observability/public/hooks/use_track_metric.tsx", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "observability", + "id": "def-public.__0", + "type": "CompoundType", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "TrackOptions & { metric: string; }" + ], + "path": "x-pack/plugins/observability/public/hooks/use_track_metric.tsx", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/observability.mdx b/api_docs/observability.mdx index bb0545f4adf87..5755741ee71ab 100644 --- a/api_docs/observability.mdx +++ b/api_docs/observability.mdx @@ -18,7 +18,7 @@ Contact Observability UI for questions regarding this plugin. | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 219 | 0 | 219 | 10 | +| 223 | 0 | 223 | 10 | ## Client diff --git a/api_docs/presentation_util.json b/api_docs/presentation_util.json index 85ee92cfb72a9..d062fa63965e7 100644 --- a/api_docs/presentation_util.json +++ b/api_docs/presentation_util.json @@ -1454,8 +1454,8 @@ ], "path": "src/plugins/presentation_util/public/services/capabilities.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1469,8 +1469,8 @@ ], "path": "src/plugins/presentation_util/public/services/capabilities.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1484,8 +1484,8 @@ ], "path": "src/plugins/presentation_util/public/services/capabilities.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1499,8 +1499,8 @@ ], "path": "src/plugins/presentation_util/public/services/capabilities.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1537,21 +1537,24 @@ ], "path": "src/plugins/presentation_util/public/services/dashboards.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.query", + "id": "def-public.PresentationDashboardsService.findDashboards.$1", "type": "string", "tags": [], "label": "query", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/presentation_util/public/services/dashboards.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "presentationUtil", - "id": "def-public.fields", + "id": "def-public.PresentationDashboardsService.findDashboards.$2", "type": "Array", "tags": [], "label": "fields", @@ -1560,9 +1563,11 @@ "string[]" ], "path": "src/plugins/presentation_util/public/services/dashboards.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1586,19 +1591,23 @@ ], "path": "src/plugins/presentation_util/public/services/dashboards.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.title", + "id": "def-public.PresentationDashboardsService.findDashboardsByTitle.$1", "type": "string", "tags": [], "label": "title", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/presentation_util/public/services/dashboards.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1625,11 +1634,10 @@ ], "path": "src/plugins/presentation_util/public/services/labs.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.id", + "id": "def-public.PresentationLabsService.isProjectEnabled.$1", "type": "string", "tags": [], "label": "id", @@ -1638,9 +1646,11 @@ "\"labs:dashboard:deferBelowFold\"" ], "path": "src/plugins/presentation_util/public/services/labs.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1654,8 +1664,8 @@ ], "path": "src/plugins/presentation_util/public/services/labs.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1676,11 +1686,10 @@ ], "path": "src/plugins/presentation_util/public/services/labs.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.id", + "id": "def-public.PresentationLabsService.getProject.$1", "type": "string", "tags": [], "label": "id", @@ -1689,9 +1698,11 @@ "\"labs:dashboard:deferBelowFold\"" ], "path": "src/plugins/presentation_util/public/services/labs.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1713,11 +1724,10 @@ ], "path": "src/plugins/presentation_util/public/services/labs.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.solutions", + "id": "def-public.PresentationLabsService.getProjects.$1", "type": "Array", "tags": [], "label": "solutions", @@ -1726,9 +1736,11 @@ "(\"dashboard\" | \"canvas\" | \"presentation\")[] | undefined" ], "path": "src/plugins/presentation_util/public/services/labs.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1742,11 +1754,10 @@ ], "path": "src/plugins/presentation_util/public/services/labs.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.id", + "id": "def-public.PresentationLabsService.setProjectStatus.$1", "type": "string", "tags": [], "label": "id", @@ -1755,11 +1766,12 @@ "\"labs:dashboard:deferBelowFold\"" ], "path": "src/plugins/presentation_util/public/services/labs.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "presentationUtil", - "id": "def-public.env", + "id": "def-public.PresentationLabsService.setProjectStatus.$2", "type": "CompoundType", "tags": [], "label": "env", @@ -1768,19 +1780,25 @@ "\"kibana\" | \"browser\" | \"session\"" ], "path": "src/plugins/presentation_util/public/services/labs.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "presentationUtil", - "id": "def-public.status", + "id": "def-public.PresentationLabsService.setProjectStatus.$3", "type": "boolean", "tags": [], "label": "status", "description": [], + "signature": [ + "boolean" + ], "path": "src/plugins/presentation_util/public/services/labs.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1794,8 +1812,8 @@ ], "path": "src/plugins/presentation_util/public/services/labs.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1844,8 +1862,8 @@ ], "path": "src/plugins/presentation_util/public/components/solution_toolbar/items/quick_group.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1918,8 +1936,8 @@ ], "path": "src/plugins/presentation_util/public/components/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -1941,11 +1959,10 @@ ], "path": "src/plugins/presentation_util/public/components/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "presentationUtil", - "id": "def-public.props", + "id": "def-public.SaveModalDashboardProps.onSave.$1", "type": "CompoundType", "tags": [], "label": "props", @@ -1961,9 +1978,11 @@ " & { dashboardId: string | null; addToLibrary: boolean; }" ], "path": "src/plugins/presentation_util/public/components/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "presentationUtil", @@ -2028,6 +2047,29 @@ ], "path": "src/plugins/presentation_util/public/services/create/factory.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "presentationUtil", + "id": "def-public.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + { + "pluginId": "presentationUtil", + "scope": "public", + "docId": "kibPresentationUtilPluginApi", + "section": "def-public.KibanaPluginServiceParams", + "text": "KibanaPluginServiceParams" + }, + "" + ], + "path": "src/plugins/presentation_util/public/services/create/factory.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -2044,6 +2086,22 @@ ], "path": "src/plugins/presentation_util/public/services/create/factory.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "presentationUtil", + "id": "def-public.params", + "type": "Uncategorized", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "Parameters" + ], + "path": "src/plugins/presentation_util/public/services/create/factory.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/presentation_util.mdx b/api_docs/presentation_util.mdx index b2376b309272c..641d602dcb564 100644 --- a/api_docs/presentation_util.mdx +++ b/api_docs/presentation_util.mdx @@ -18,7 +18,7 @@ import presentationUtilObj from './presentation_util.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 176 | 3 | 149 | 5 | +| 178 | 3 | 151 | 5 | ## Client diff --git a/api_docs/reporting.json b/api_docs/reporting.json index 68c79a9240572..b959cb91c4af3 100644 --- a/api_docs/reporting.json +++ b/api_docs/reporting.json @@ -54,6 +54,40 @@ "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", "deprecated": false, "isRequired": true + }, + { + "parentPluginId": "reporting", + "id": "def-public.ReportingAPIClient.Unnamed.$2", + "type": "Object", + "tags": [], + "label": "uiSettings", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "public", + "docId": "kibCorePluginApi", + "section": "def-public.IUiSettingsClient", + "text": "IUiSettingsClient" + } + ], + "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "reporting", + "id": "def-public.ReportingAPIClient.Unnamed.$3", + "type": "string", + "tags": [], + "label": "kibanaVersion", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", + "deprecated": false, + "isRequired": true } ], "returnComment": [] @@ -311,7 +345,9 @@ "label": "getReportingJobPath", "description": [], "signature": [ - "(exportType: string, jobParams: JobParams) => string" + "(exportType: string, jobParams: ", + "BaseParams", + ") => string" ], "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", "deprecated": false, @@ -338,7 +374,7 @@ "label": "jobParams", "description": [], "signature": [ - "JobParams" + "BaseParams" ], "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", "deprecated": false, @@ -355,7 +391,9 @@ "label": "createReportingJob", "description": [], "signature": [ - "(exportType: string, jobParams: any) => Promise<", + "(exportType: string, jobParams: ", + "BaseParams", + ") => Promise<", "Job", ">" ], @@ -379,12 +417,77 @@ { "parentPluginId": "reporting", "id": "def-public.ReportingAPIClient.createReportingJob.$2", - "type": "Any", + "type": "Object", "tags": [], "label": "jobParams", "description": [], "signature": [ - "any" + "BaseParams" + ], + "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "reporting", + "id": "def-public.ReportingAPIClient.createImmediateReport", + "type": "Function", + "tags": [], + "label": "createImmediateReport", + "description": [], + "signature": [ + "(baseParams: ", + "BaseParams", + ") => Promise" + ], + "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "reporting", + "id": "def-public.ReportingAPIClient.createImmediateReport.$1", + "type": "Object", + "tags": [], + "label": "baseParams", + "description": [], + "signature": [ + "BaseParams" + ], + "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "reporting", + "id": "def-public.ReportingAPIClient.getDecoratedJobParams", + "type": "Function", + "tags": [], + "label": "getDecoratedJobParams", + "description": [], + "signature": [ + ">(baseParams: T) => ", + "BaseParams" + ], + "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "reporting", + "id": "def-public.ReportingAPIClient.getDecoratedJobParams.$1", + "type": "Uncategorized", + "tags": [], + "label": "baseParams", + "description": [], + "signature": [ + "T" ], "path": "x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts", "deprecated": false, @@ -871,6 +974,21 @@ ], "returnComment": [] }, + { + "parentPluginId": "reporting", + "id": "def-server.ReportingCore.getKibanaVersion", + "type": "Function", + "tags": [], + "label": "getKibanaVersion", + "description": [], + "signature": [ + "() => string" + ], + "path": "x-pack/plugins/reporting/server/core.ts", + "deprecated": false, + "children": [], + "returnComment": [] + }, { "parentPluginId": "reporting", "id": "def-server.ReportingCore.pluginSetup", @@ -2138,8 +2256,8 @@ ], "path": "x-pack/plugins/reporting/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "start", diff --git a/api_docs/reporting.mdx b/api_docs/reporting.mdx index 2c46a2c088852..b852149816d70 100644 --- a/api_docs/reporting.mdx +++ b/api_docs/reporting.mdx @@ -18,7 +18,7 @@ Contact [Kibana Reporting Services](https://github.com/orgs/elastic/teams/kibana | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 133 | 1 | 132 | 14 | +| 140 | 0 | 139 | 15 | ## Client diff --git a/api_docs/rule_registry.json b/api_docs/rule_registry.json index 96cd95735756c..74480af0eb2f8 100644 --- a/api_docs/rule_registry.json +++ b/api_docs/rule_registry.json @@ -525,7 +525,7 @@ "section": "def-server.AlertExecutorOptions", "text": "AlertExecutorOptions" }, - ") => { \"rule.id\": string; \"rule.uuid\": string; \"rule.category\": string; \"rule.name\": string; tags: string[]; \"kibana.rac.alert.producer\": string; }" + ") => { \"rule.id\": string; \"rule.uuid\": string; \"rule.category\": string; \"rule.name\": string; tags: string[]; \"kibana.alert.producer\": string; }" ], "path": "x-pack/plugins/rule_registry/server/utils/get_rule_executor_data.ts", "deprecated": false, @@ -740,7 +740,7 @@ "signature": [ "(alert: { id: string; fields: Record & Partial>, \"tags\" | \"@timestamp\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">>; }) => Pick<", + "<{ readonly \"kibana.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.id\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">>, \"tags\" | \"@timestamp\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">>; }) => Pick<", "AlertInstance", ", \"getState\" | \"replaceState\" | \"scheduleActions\" | \"scheduleActionsWithSubGroup\">" ], @@ -758,7 +758,7 @@ "signature": [ "{ id: string; fields: Record & Partial>, \"tags\" | \"@timestamp\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">>; }" + "<{ readonly \"kibana.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.id\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">>, \"tags\" | \"@timestamp\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">>; }" ], "path": "x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts", "deprecated": false @@ -792,8 +792,8 @@ ], "path": "x-pack/plugins/rule_registry/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -850,10 +850,10 @@ }, { "parentPluginId": "ruleRegistry", - "id": "def-server.RuleExecutorData.PRODUCER", + "id": "def-server.RuleExecutorData.ALERT_PRODUCER", "type": "string", "tags": [], - "label": "[PRODUCER]", + "label": "[ALERT_PRODUCER]", "description": [], "path": "x-pack/plugins/rule_registry/server/utils/get_rule_executor_data.ts", "deprecated": false @@ -915,6 +915,22 @@ ], "path": "x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type_factory.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "ruleRegistry", + "id": "def-server.alert", + "type": "Object", + "tags": [], + "label": "alert", + "description": [], + "signature": [ + "{ id: string; fields: Record; }" + ], + "path": "x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type_factory.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -939,6 +955,46 @@ ], "path": "x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "ruleRegistry", + "id": "def-server.options", + "type": "CompoundType", + "tags": [], + "label": "options", + "description": [], + "signature": [ + "Pick<", + { + "pluginId": "alerting", + "scope": "server", + "docId": "kibAlertingPluginApi", + "section": "def-server.AlertExecutorOptions", + "text": "AlertExecutorOptions" + }, + ", \"name\" | \"params\" | \"tags\" | \"spaceId\" | \"rule\" | \"createdBy\" | \"updatedBy\" | \"previousStartedAt\" | \"state\" | \"alertId\" | \"namespace\" | \"startedAt\"> & { services: ", + { + "pluginId": "alerting", + "scope": "server", + "docId": "kibAlertingPluginApi", + "section": "def-server.AlertServices", + "text": "AlertServices" + }, + " & ", + { + "pluginId": "ruleRegistry", + "scope": "server", + "docId": "kibRuleRegistryPluginApi", + "section": "def-server.LifecycleAlertServices", + "text": "LifecycleAlertServices" + }, + "; }" + ], + "path": "x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1029,11 +1085,10 @@ ], "path": "x-pack/plugins/rule_registry/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "ruleRegistry", - "id": "def-server.req", + "id": "def-server.RuleRegistryPluginStartContract.getRacClientWithRequest.$1", "type": "Object", "tags": [], "label": "req", @@ -1049,9 +1104,11 @@ "" ], "path": "x-pack/plugins/rule_registry/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "ruleRegistry", @@ -1090,7 +1147,7 @@ "signature": [ "(input: unknown) => OutputOf<", "Optional", - "<{ readonly \"kibana.rac.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.rac.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.rac.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.rac.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.rac.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.rac.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.rac.alert.producer\" | \"kibana.rac.alert.owner\" | \"kibana.rac.alert.id\" | \"kibana.rac.alert.uuid\" | \"kibana.rac.alert.start\" | \"kibana.rac.alert.end\" | \"kibana.rac.alert.duration.us\" | \"kibana.rac.alert.severity.level\" | \"kibana.rac.alert.severity.value\" | \"kibana.rac.alert.status\" | \"kibana.rac.alert.evaluation.threshold\" | \"kibana.rac.alert.evaluation.value\" | \"kibana.rac.alert.reason\" | \"kibana.space_ids\">>" + "<{ readonly \"kibana.alert.owner\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.producer\": { readonly type: \"keyword\"; }; readonly \"kibana.space_ids\": { readonly type: \"keyword\"; readonly array: true; }; readonly \"kibana.alert.uuid\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.id\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.start\": { readonly type: \"date\"; }; readonly \"kibana.alert.end\": { readonly type: \"date\"; }; readonly \"kibana.alert.duration.us\": { readonly type: \"long\"; }; readonly \"kibana.alert.severity.level\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.severity.value\": { readonly type: \"long\"; }; readonly \"kibana.alert.status\": { readonly type: \"keyword\"; }; readonly \"kibana.alert.evaluation.threshold\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.evaluation.value\": { readonly type: \"scaled_float\"; readonly scaling_factor: 100; }; readonly \"kibana.alert.reason\": { readonly type: \"keyword\"; }; readonly tags: { readonly type: \"keyword\"; readonly array: true; readonly required: false; }; readonly '@timestamp': { readonly type: \"date\"; readonly array: false; readonly required: true; }; readonly 'event.kind': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'event.action': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.uuid': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.id': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.name': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; readonly 'rule.category': { readonly type: \"keyword\"; readonly array: false; readonly required: false; }; }, \"tags\" | \"event.kind\" | \"event.action\" | \"rule.uuid\" | \"rule.id\" | \"rule.name\" | \"rule.category\" | \"kibana.alert.producer\" | \"kibana.alert.owner\" | \"kibana.alert.id\" | \"kibana.alert.uuid\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity.level\" | \"kibana.alert.severity.value\" | \"kibana.alert.status\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.reason\" | \"kibana.space_ids\">>" ], "path": "x-pack/plugins/rule_registry/common/parse_technical_fields.ts", "deprecated": false, diff --git a/api_docs/rule_registry.mdx b/api_docs/rule_registry.mdx index b3ae2722bb14e..2578475c2dc8e 100644 --- a/api_docs/rule_registry.mdx +++ b/api_docs/rule_registry.mdx @@ -18,7 +18,7 @@ import ruleRegistryObj from './rule_registry.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 60 | 0 | 60 | 9 | +| 62 | 0 | 62 | 9 | ## Server diff --git a/api_docs/runtime_fields.json b/api_docs/runtime_fields.json index 4a7eb5dd20c49..8348666426fa9 100644 --- a/api_docs/runtime_fields.json +++ b/api_docs/runtime_fields.json @@ -200,11 +200,10 @@ ], "path": "x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "runtimeFields", - "id": "def-public.field", + "id": "def-public.Props.onSave.$1", "type": "Object", "tags": [], "label": "field", @@ -219,9 +218,11 @@ } ], "path": "x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "runtimeFields", @@ -237,8 +238,8 @@ ], "path": "x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "runtimeFields", diff --git a/api_docs/saved_objects.json b/api_docs/saved_objects.json index b7e931ee126eb..39fb367f066bd 100644 --- a/api_docs/saved_objects.json +++ b/api_docs/saved_objects.json @@ -1884,8 +1884,8 @@ ], "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -1934,7 +1934,24 @@ "((appId: string) => string | undefined) | undefined" ], "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "savedObjects", + "id": "def-public.OriginSaveModalProps.getAppNameFromId.$1", + "type": "string", + "tags": [], + "label": "appId", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -1997,8 +2014,8 @@ ], "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2041,11 +2058,10 @@ ], "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.props", + "id": "def-public.OriginSaveModalProps.onSave.$1", "type": "CompoundType", "tags": [], "label": "props", @@ -2061,9 +2077,11 @@ " & { returnToOrigin: boolean; }" ], "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -2198,8 +2216,8 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2234,22 +2252,23 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.resp", + "id": "def-public.SavedObject.applyESResp.$1", "type": "Object", "tags": [], "label": "resp", "description": [], "signature": [ - "{ [x: string]: any; }" + "Record" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2275,11 +2294,10 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.opts", + "id": "def-public.SavedObject.creationOpts.$1", "type": "Object", "tags": [], "label": "opts", @@ -2288,9 +2306,11 @@ "SavedObjectCreationOpts" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2316,7 +2336,9 @@ "(() => Promise<{}>) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2330,8 +2352,8 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2345,8 +2367,8 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2360,8 +2382,8 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2375,8 +2397,8 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2391,13 +2413,30 @@ "pluginId": "data", "scope": "common", "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IIndexPattern", - "text": "IIndexPattern" + "section": "def-common.IndexPattern", + "text": "IndexPattern" }, " | null>) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "savedObjects", + "id": "def-public.SavedObject.hydrateIndexPattern.$1", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/saved_objects/public/types.ts", + "deprecated": false, + "isRequired": false + } + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2431,7 +2470,9 @@ ">) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2455,8 +2496,8 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2501,11 +2542,10 @@ ], "path": "src/plugins/saved_objects/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.saveOptions", + "id": "def-public.SavedObject.save.$1", "type": "Object", "tags": [], "label": "saveOptions", @@ -2520,9 +2560,11 @@ } ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2639,7 +2681,30 @@ ">) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "savedObjects", + "id": "def-public.SavedObjectConfig.afterESResp.$1", + "type": "Object", + "tags": [], + "label": "savedObject", + "description": [], + "signature": [ + { + "pluginId": "savedObjects", + "scope": "public", + "docId": "kibSavedObjectsPluginApi", + "section": "def-public.SavedObject", + "text": "SavedObject" + } + ], + "path": "src/plugins/saved_objects/public/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2669,7 +2734,24 @@ ") | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "savedObjects", + "id": "def-public.SavedObjectConfig.extractReferences.$1", + "type": "Object", + "tags": [], + "label": "opts", + "description": [], + "signature": [ + "SavedObjectAttributesAndRefs" + ], + "path": "src/plugins/saved_objects/public/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2692,7 +2774,39 @@ "[]) => void) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "savedObjects", + "id": "def-public.SavedObjectConfig.injectReferences.$1", + "type": "Uncategorized", + "tags": [], + "label": "object", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/saved_objects/public/types.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "savedObjects", + "id": "def-public.SavedObjectConfig.injectReferences.$2", + "type": "Array", + "tags": [], + "label": "references", + "description": [], + "signature": [ + "SavedObjectReference", + "[]" + ], + "path": "src/plugins/saved_objects/public/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2718,7 +2832,9 @@ "(() => void) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2732,8 +2848,8 @@ "pluginId": "data", "scope": "common", "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IIndexPattern", - "text": "IIndexPattern" + "section": "def-common.IndexPattern", + "text": "IndexPattern" }, " | undefined" ], @@ -2875,11 +2991,10 @@ ], "path": "src/plugins/saved_objects/public/saved_object/decorators/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.config", + "id": "def-public.SavedObjectDecorator.decorateConfig.$1", "type": "Object", "tags": [], "label": "config", @@ -2894,9 +3009,11 @@ } ], "path": "src/plugins/saved_objects/public/saved_object/decorators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -2912,11 +3029,10 @@ ], "path": "src/plugins/saved_objects/public/saved_object/decorators/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.object", + "id": "def-public.SavedObjectDecorator.decorateObject.$1", "type": "Uncategorized", "tags": [], "label": "object", @@ -2925,9 +3041,11 @@ "T" ], "path": "src/plugins/saved_objects/public/saved_object/decorators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -3363,7 +3481,9 @@ "(() => void) | undefined" ], "path": "src/plugins/saved_objects/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "savedObjects", @@ -3507,6 +3627,22 @@ ], "path": "src/plugins/saved_objects/public/saved_object/decorators/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "savedObjects", + "id": "def-public.services", + "type": "Object", + "tags": [], + "label": "services", + "description": [], + "signature": [ + "SavedObjectKibanaServices" + ], + "path": "src/plugins/saved_objects/public/saved_object/decorators/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -3644,11 +3780,10 @@ ], "path": "src/plugins/saved_objects/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjects", - "id": "def-public.config", + "id": "def-public.SavedObjectSetup.registerDecorator.$1", "type": "Object", "tags": [], "label": "config", @@ -3664,9 +3799,11 @@ "" ], "path": "src/plugins/saved_objects/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/saved_objects.mdx b/api_docs/saved_objects.mdx index 0e64b52cbe31f..4a7bf6ae82e75 100644 --- a/api_docs/saved_objects.mdx +++ b/api_docs/saved_objects.mdx @@ -18,7 +18,7 @@ import savedObjectsObj from './saved_objects.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 213 | 3 | 199 | 5 | +| 220 | 3 | 206 | 5 | ## Client diff --git a/api_docs/saved_objects_management.json b/api_docs/saved_objects_management.json index b8e43a3836071..d7d19f1dfdfba 100644 --- a/api_docs/saved_objects_management.json +++ b/api_docs/saved_objects_management.json @@ -710,11 +710,10 @@ ], "path": "src/plugins/saved_objects_management/public/services/action_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjectsManagement", - "id": "def-public.action", + "id": "def-public.SavedObjectsManagementActionServiceSetup.register.$1", "type": "Object", "tags": [], "label": "action", @@ -729,9 +728,11 @@ } ], "path": "src/plugins/saved_objects_management/public/services/action_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -760,19 +761,23 @@ ], "path": "src/plugins/saved_objects_management/public/services/action_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjectsManagement", - "id": "def-public.actionId", + "id": "def-public.SavedObjectsManagementActionServiceStart.has.$1", "type": "string", "tags": [], "label": "actionId", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/saved_objects_management/public/services/action_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "savedObjectsManagement", @@ -796,8 +801,8 @@ ], "path": "src/plugins/saved_objects_management/public/services/action_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -906,11 +911,10 @@ ], "path": "src/plugins/saved_objects_management/public/services/column_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjectsManagement", - "id": "def-public.column", + "id": "def-public.SavedObjectsManagementColumnServiceSetup.register.$1", "type": "Object", "tags": [], "label": "column", @@ -926,9 +930,11 @@ "" ], "path": "src/plugins/saved_objects_management/public/services/column_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -965,8 +971,8 @@ ], "path": "src/plugins/saved_objects_management/public/services/column_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/saved_objects_tagging_oss.json b/api_docs/saved_objects_tagging_oss.json index a7b52b9355b11..eb9d9a733dced 100644 --- a/api_docs/saved_objects_tagging_oss.json +++ b/api_docs/saved_objects_tagging_oss.json @@ -253,11 +253,10 @@ ], "path": "src/plugins/saved_objects_tagging_oss/public/api.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjectsTaggingOss", - "id": "def-public.ids", + "id": "def-public.SavedObjectSaveModalTagSelectorComponentProps.onTagsSelected.$1", "type": "Array", "tags": [], "label": "ids", @@ -266,9 +265,11 @@ "string[]" ], "path": "src/plugins/saved_objects_tagging_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1037,11 +1038,10 @@ ], "path": "src/plugins/saved_objects_tagging_oss/public/api.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "savedObjectsTaggingOss", - "id": "def-public.ids", + "id": "def-public.TagSelectorComponentProps.onTagsSelected.$1", "type": "Array", "tags": [], "label": "ids", @@ -1050,9 +1050,11 @@ "string[]" ], "path": "src/plugins/saved_objects_tagging_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1087,6 +1089,28 @@ ], "path": "src/plugins/saved_objects_tagging_oss/public/api.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "savedObjectsTaggingOss", + "id": "def-public.object", + "type": "Object", + "tags": [], + "label": "object", + "description": [], + "signature": [ + { + "pluginId": "savedObjects", + "scope": "public", + "docId": "kibSavedObjectsPluginApi", + "section": "def-public.SavedObject", + "text": "SavedObject" + } + ], + "path": "src/plugins/saved_objects_tagging_oss/public/api.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/saved_objects_tagging_oss.mdx b/api_docs/saved_objects_tagging_oss.mdx index 407c9244349aa..1d3d0934c97ab 100644 --- a/api_docs/saved_objects_tagging_oss.mdx +++ b/api_docs/saved_objects_tagging_oss.mdx @@ -18,7 +18,7 @@ import savedObjectsTaggingOssObj from './saved_objects_tagging_oss.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 89 | 3 | 50 | 0 | +| 90 | 3 | 51 | 0 | ## Client diff --git a/api_docs/screenshot_mode.json b/api_docs/screenshot_mode.json index 14203cc4c3c4c..14e2ad501bbbf 100644 --- a/api_docs/screenshot_mode.json +++ b/api_docs/screenshot_mode.json @@ -232,8 +232,8 @@ ], "path": "src/plugins/screenshot_mode/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/security.json b/api_docs/security.json index f0a93cc5e6753..5a88090ecf980 100644 --- a/api_docs/security.json +++ b/api_docs/security.json @@ -119,8 +119,8 @@ ], "path": "x-pack/plugins/security/public/authentication/authentication_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "security", @@ -136,8 +136,8 @@ ], "path": "x-pack/plugins/security/public/authentication/authentication_service.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -446,8 +446,8 @@ ], "path": "x-pack/plugins/security/public/nav_control/nav_control_service.tsx", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "security", @@ -471,11 +471,10 @@ ], "path": "x-pack/plugins/security/public/nav_control/nav_control_service.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "security", - "id": "def-public.newUserMenuLink", + "id": "def-public.SecurityNavControlServiceStart.addUserMenuLinks.$1", "type": "Array", "tags": [], "label": "newUserMenuLink", @@ -491,9 +490,11 @@ "[]" ], "path": "x-pack/plugins/security/public/nav_control/nav_control_service.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -808,11 +809,10 @@ ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "security", - "id": "def-server.event", + "id": "def-server.AuditLogger.log.$1", "type": "Object", "tags": [], "label": "event", @@ -828,9 +828,11 @@ " | undefined" ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -872,11 +874,10 @@ ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "security", - "id": "def-server.request", + "id": "def-server.AuditServiceSetup.asScoped.$1", "type": "Object", "tags": [], "label": "request", @@ -892,9 +893,11 @@ "" ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "security", @@ -915,11 +918,10 @@ ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "security", - "id": "def-server.id", + "id": "def-server.AuditServiceSetup.getLogger.$1", "type": "string", "tags": [], "label": "id", @@ -928,9 +930,11 @@ "string | undefined" ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1147,11 +1151,10 @@ ], "path": "x-pack/plugins/security/server/authentication/authentication_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "security", - "id": "def-server.request", + "id": "def-server.AuthenticationServiceStart.getCurrentUser.$1", "type": "Object", "tags": [], "label": "request", @@ -1167,9 +1170,11 @@ "" ], "path": "x-pack/plugins/security/server/authentication/authentication_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1494,31 +1499,38 @@ ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "security", - "id": "def-server.eventType", + "id": "def-server.LegacyAuditLogger.log.$1", "type": "string", "tags": [], "label": "eventType", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "security", - "id": "def-server.message", + "id": "def-server.LegacyAuditLogger.log.$2", "type": "string", "tags": [], "label": "message", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "security", - "id": "def-server.data", + "id": "def-server.LegacyAuditLogger.log.$3", "type": "Object", "tags": [], "label": "data", @@ -1527,9 +1539,11 @@ "Record | undefined" ], "path": "x-pack/plugins/security/server/audit/audit_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/security_oss.json b/api_docs/security_oss.json index 1953d10c3f396..601563752d47d 100644 --- a/api_docs/security_oss.json +++ b/api_docs/security_oss.json @@ -126,11 +126,10 @@ ], "path": "src/plugins/security_oss/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securityOss", - "id": "def-server.provider", + "id": "def-server.SecurityOssPluginSetup.setAnonymousAccessServiceProvider.$1", "type": "Function", "tags": [], "label": "provider", @@ -140,9 +139,11 @@ "AnonymousAccessService" ], "path": "src/plugins/security_oss/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/security_solution.json b/api_docs/security_solution.json index 2db97ed3a6e65..7fff8eb0a2172 100644 --- a/api_docs/security_solution.json +++ b/api_docs/security_solution.json @@ -349,8 +349,8 @@ ], "path": "x-pack/plugins/security_solution/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "setup", @@ -707,8 +707,8 @@ ], "path": "x-pack/plugins/security_solution/server/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -1079,8 +1079,8 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -1195,7 +1195,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -1208,7 +1210,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -1264,7 +1268,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -2627,21 +2633,24 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securitySolution", - "id": "def-common.columnName", + "id": "def-common.ColumnRenderer.isInstance.$1", "type": "string", "tags": [], "label": "columnName", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "securitySolution", - "id": "def-common.data", + "id": "def-common.ColumnRenderer.isInstance.$2", "type": "Array", "tags": [], "label": "data", @@ -2657,9 +2666,11 @@ "[]" ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -2681,30 +2692,115 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securitySolution", - "id": "def-common.__0", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues", "type": "Object", "tags": [], - "label": "__0", + "label": "{\n columnName,\n eventId,\n field,\n timelineId,\n truncate,\n values,\n linkValues,\n }", "description": [], - "signature": [ - "{ columnName: string; eventId: string; field: ", + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false, + "children": [ { - "pluginId": "timelines", - "scope": "common", - "docId": "kibTimelinesPluginApi", - "section": "def-common.ColumnHeaderOptions", - "text": "ColumnHeaderOptions" + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.columnName", + "type": "string", + "tags": [], + "label": "columnName", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false }, - "; timelineId: string; truncate?: boolean | undefined; values: string[] | null | undefined; linkValues?: string[] | null | undefined; }" - ], - "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", - "deprecated": false + { + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.eventId", + "type": "string", + "tags": [], + "label": "eventId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.field", + "type": "CompoundType", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "Pick<", + "EuiDataGridColumn", + ", \"id\" | \"display\" | \"displayAsText\" | \"initialWidth\"> & { aggregatable?: boolean | undefined; category?: string | undefined; columnHeaderType: ", + { + "pluginId": "timelines", + "scope": "common", + "docId": "kibTimelinesPluginApi", + "section": "def-common.ColumnHeaderType", + "text": "ColumnHeaderType" + }, + "; description?: string | undefined; example?: string | undefined; format?: string | undefined; linkField?: string | undefined; placeholder?: string | undefined; subType?: ", + "IFieldSubType", + " | undefined; type?: string | undefined; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.timelineId", + "type": "string", + "tags": [], + "label": "timelineId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.truncate", + "type": "CompoundType", + "tags": [], + "label": "truncate", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.values", + "type": "CompoundType", + "tags": [], + "label": "values", + "description": [], + "signature": [ + "string[] | null | undefined" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.linkValues", + "type": "CompoundType", + "tags": [], + "label": "linkValues", + "description": [], + "signature": [ + "string[] | null | undefined" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -4973,22 +5069,31 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securitySolution", - "id": "def-common.__0", + "id": "def-common.HeaderActionProps.onSelectAll.$1.isSelected", "type": "Object", "tags": [], - "label": "__0", + "label": "{ isSelected }", "description": [], - "signature": [ - "{ isSelected: boolean; }" - ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.HeaderActionProps.onSelectAll.$1.isSelected.isSelected", + "type": "boolean", + "tags": [], + "label": "isSelected", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -9265,11 +9370,10 @@ ], "path": "x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securitySolution", - "id": "def-common.options", + "id": "def-common.MatrixHistogramSchema.buildDsl.$1", "type": "Object", "tags": [], "label": "options", @@ -9284,9 +9388,11 @@ } ], "path": "x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -9335,7 +9441,45 @@ "[]) | undefined" ], "path": "x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.MatrixHistogramSchema.parser.$1", + "type": "Uncategorized", + "tags": [], + "label": "data", + "description": [], + "signature": [ + { + "pluginId": "securitySolution", + "scope": "common", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-common.MatrixHistogramParseData", + "text": "MatrixHistogramParseData" + }, + "" + ], + "path": "x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.MatrixHistogramSchema.parser.$2", + "type": "string", + "tags": [], + "label": "keyBucket", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -14320,11 +14464,10 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securitySolution", - "id": "def-common.data", + "id": "def-common.RowRenderer.isInstance.$1", "type": "Object", "tags": [], "label": "data", @@ -14333,9 +14476,11 @@ "Ecs" ], "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "securitySolution", @@ -14359,32 +14504,75 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "securitySolution", - "id": "def-common.__0", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId", "type": "Object", "tags": [], - "label": "__0", + "label": "{\n browserFields,\n data,\n isDraggable,\n timelineId,\n }", "description": [], - "signature": [ - "{ browserFields: Readonly; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false }, - ">>>; data: ", - "Ecs", - "; isDraggable: boolean; timelineId: string; }" - ], - "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", - "deprecated": false + { + "parentPluginId": "securitySolution", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId.data", + "type": "Object", + "tags": [], + "label": "data", + "description": [], + "signature": [ + "Ecs" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId.isDraggable", + "type": "boolean", + "tags": [], + "label": "isDraggable", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false + }, + { + "parentPluginId": "securitySolution", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId.timelineId", + "type": "string", + "tags": [], + "label": "timelineId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -16330,7 +16518,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false @@ -19902,6 +20091,19 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.nextPage", + "type": "number", + "tags": [], + "label": "nextPage", + "description": [], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19916,6 +20118,19 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.columnId", + "type": "string", + "tags": [], + "label": "columnId", + "description": [], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19930,6 +20145,22 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ columnId: string; delta: number; }" + ], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19954,6 +20185,30 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.sorted", + "type": "Object", + "tags": [], + "label": "sorted", + "description": [], + "signature": [ + "{ columnId: string; sortDirection: ", + { + "pluginId": "securitySolution", + "scope": "common", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-common.SortDirection", + "text": "SortDirection" + }, + "; }" + ], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19976,6 +20231,30 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.sorted", + "type": "Array", + "tags": [], + "label": "sorted", + "description": [], + "signature": [ + "{ columnId: string; sortDirection: ", + { + "pluginId": "securitySolution", + "scope": "common", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-common.SortDirection", + "text": "SortDirection" + }, + "; }[]" + ], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -19992,6 +20271,19 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.eventId", + "type": "string", + "tags": [], + "label": "eventId", + "description": [], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -20008,6 +20300,22 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ eventIds: string[]; isSelected: boolean; }" + ], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -20024,6 +20332,22 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ isSelected: boolean; }" + ], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -20040,6 +20364,19 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.eventId", + "type": "string", + "tags": [], + "label": "eventId", + "description": [], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -20064,6 +20401,29 @@ ], "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "securitySolution", + "id": "def-common.columns", + "type": "Array", + "tags": [], + "label": "columns", + "description": [], + "signature": [ + { + "pluginId": "timelines", + "scope": "common", + "docId": "kibTimelinesPluginApi", + "section": "def-common.ColumnHeaderOptions", + "text": "ColumnHeaderOptions" + }, + "[]" + ], + "path": "x-pack/plugins/security_solution/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/security_solution.mdx b/api_docs/security_solution.mdx index c61a6e7d8e28f..fe1ba0f7b06e8 100644 --- a/api_docs/security_solution.mdx +++ b/api_docs/security_solution.mdx @@ -18,7 +18,7 @@ import securitySolutionObj from './security_solution.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 1298 | 8 | 1247 | 27 | +| 1322 | 8 | 1271 | 27 | ## Client diff --git a/api_docs/share.json b/api_docs/share.json index dbb9000b6d1ea..d9b0ba64d94ce 100644 --- a/api_docs/share.json +++ b/api_docs/share.json @@ -852,11 +852,10 @@ ], "path": "src/plugins/share/common/url_service/locators/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "share", - "id": "def-public.params", + "id": "def-public.LocatorPublic.useUrl.$1", "type": "Uncategorized", "tags": [], "label": "params", @@ -865,11 +864,12 @@ "P" ], "path": "src/plugins/share/common/url_service/locators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "share", - "id": "def-public.getUrlParams", + "id": "def-public.LocatorPublic.useUrl.$2", "type": "Object", "tags": [], "label": "getUrlParams", @@ -879,11 +879,12 @@ " | undefined" ], "path": "src/plugins/share/common/url_service/locators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "share", - "id": "def-public.deps", + "id": "def-public.LocatorPublic.useUrl.$3", "type": "Object", "tags": [], "label": "deps", @@ -892,9 +893,11 @@ "React.DependencyList | undefined" ], "path": "src/plugins/share/common/url_service/locators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -979,8 +982,8 @@ ], "path": "src/plugins/share/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "share", @@ -995,7 +998,24 @@ ") => boolean) | undefined" ], "path": "src/plugins/share/public/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "share", + "id": "def-public.ShareContext.showPublicUrlSwitch.$1", + "type": "Object", + "tags": [], + "label": "anonymousUserCapabilities", + "description": [], + "signature": [ + "Capabilities" + ], + "path": "src/plugins/share/public/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1141,11 +1161,10 @@ ], "path": "src/plugins/share/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "share", - "id": "def-public.context", + "id": "def-public.ShareMenuProvider.getShareMenuItems.$1", "type": "Object", "tags": [], "label": "context", @@ -1160,9 +1179,11 @@ } ], "path": "src/plugins/share/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -1449,7 +1470,31 @@ "[Id][\"State\"]) => Promise) | undefined" ], "path": "src/plugins/share/public/url_generators/url_generator_definition.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "share", + "id": "def-public.UrlGeneratorsDefinition.createUrl.$1", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + { + "pluginId": "share", + "scope": "public", + "docId": "kibSharePluginApi", + "section": "def-public.UrlGeneratorStateMapping", + "text": "UrlGeneratorStateMapping" + }, + "[Id][\"State\"]" + ], + "path": "src/plugins/share/public/url_generators/url_generator_definition.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "share", @@ -1499,7 +1544,31 @@ "[Id][\"MigratedId\"]; }>) | undefined" ], "path": "src/plugins/share/public/url_generators/url_generator_definition.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "share", + "id": "def-public.UrlGeneratorsDefinition.migrate.$1", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + { + "pluginId": "share", + "scope": "public", + "docId": "kibSharePluginApi", + "section": "def-public.UrlGeneratorStateMapping", + "text": "UrlGeneratorStateMapping" + }, + "[Id][\"State\"]" + ], + "path": "src/plugins/share/public/url_generators/url_generator_definition.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -2172,11 +2241,10 @@ ], "path": "src/plugins/share/common/url_service/locators/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "share", - "id": "def-common.params", + "id": "def-common.LocatorPublic.useUrl.$1", "type": "Uncategorized", "tags": [], "label": "params", @@ -2185,11 +2253,12 @@ "P" ], "path": "src/plugins/share/common/url_service/locators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "share", - "id": "def-common.getUrlParams", + "id": "def-common.LocatorPublic.useUrl.$2", "type": "Object", "tags": [], "label": "getUrlParams", @@ -2199,11 +2268,12 @@ " | undefined" ], "path": "src/plugins/share/common/url_service/locators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false }, { "parentPluginId": "share", - "id": "def-common.deps", + "id": "def-common.LocatorPublic.useUrl.$3", "type": "Object", "tags": [], "label": "deps", @@ -2212,9 +2282,11 @@ "React.DependencyList | undefined" ], "path": "src/plugins/share/common/url_service/locators/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/share.mdx b/api_docs/share.mdx index 7f6906c4a745c..3200c951b36e4 100644 --- a/api_docs/share.mdx +++ b/api_docs/share.mdx @@ -18,7 +18,7 @@ import shareObj from './share.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 123 | 1 | 83 | 8 | +| 126 | 1 | 86 | 8 | ## Client diff --git a/api_docs/spaces.json b/api_docs/spaces.json index 457b311d6ad17..e9a754f74bdda 100644 --- a/api_docs/spaces.json +++ b/api_docs/spaces.json @@ -1394,11 +1394,10 @@ ], "path": "x-pack/plugins/spaces/server/spaces_service/spaces_service.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "spaces", - "id": "def-server.request", + "id": "def-server.SpacesServiceStart.createSpacesClient.$1", "type": "Object", "tags": [], "label": "request", @@ -1416,9 +1415,11 @@ "" ], "path": "x-pack/plugins/spaces/server/spaces_service/spaces_service.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "spaces", @@ -1705,6 +1706,48 @@ ], "path": "x-pack/plugins/spaces/server/spaces_client/spaces_client_service.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "spaces", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "x-pack/plugins/spaces/server/spaces_client/spaces_client_service.ts", + "deprecated": false + }, + { + "parentPluginId": "spaces", + "id": "def-server.savedObjectsStart", + "type": "Object", + "tags": [], + "label": "savedObjectsStart", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsServiceStart", + "text": "SavedObjectsServiceStart" + } + ], + "path": "x-pack/plugins/spaces/server/spaces_client/spaces_client_service.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1746,6 +1789,48 @@ ], "path": "x-pack/plugins/spaces/server/spaces_client/spaces_client_service.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "spaces", + "id": "def-server.request", + "type": "Object", + "tags": [], + "label": "request", + "description": [], + "signature": [ + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + "" + ], + "path": "x-pack/plugins/spaces/server/spaces_client/spaces_client_service.ts", + "deprecated": false + }, + { + "parentPluginId": "spaces", + "id": "def-server.baseClient", + "type": "Object", + "tags": [], + "label": "baseClient", + "description": [], + "signature": [ + { + "pluginId": "spaces", + "scope": "server", + "docId": "kibSpacesPluginApi", + "section": "def-server.ISpacesClient", + "text": "ISpacesClient" + } + ], + "path": "x-pack/plugins/spaces/server/spaces_client/spaces_client_service.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/spaces.mdx b/api_docs/spaces.mdx index 9f724afd37a6e..b723b3c72288c 100644 --- a/api_docs/spaces.mdx +++ b/api_docs/spaces.mdx @@ -18,7 +18,7 @@ Contact [Platform Security](https://github.com/orgs/elastic/teams/kibana-securit | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 106 | 0 | 0 | 0 | +| 110 | 0 | 4 | 0 | ## Client diff --git a/api_docs/spaces_oss.json b/api_docs/spaces_oss.json index b480af5d380f6..cd59756b548b6 100644 --- a/api_docs/spaces_oss.json +++ b/api_docs/spaces_oss.json @@ -191,7 +191,52 @@ "((objects: { type: string; id: string; }[], spacesToAdd: string[], spacesToRemove: string[]) => Promise) | undefined" ], "path": "src/plugins/spaces_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "spacesOss", + "id": "def-public.ShareToSpaceFlyoutProps.changeSpacesHandler.$1", + "type": "Array", + "tags": [], + "label": "objects", + "description": [], + "signature": [ + "{ type: string; id: string; }[]" + ], + "path": "src/plugins/spaces_oss/public/api.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "spacesOss", + "id": "def-public.ShareToSpaceFlyoutProps.changeSpacesHandler.$2", + "type": "Array", + "tags": [], + "label": "spacesToAdd", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/spaces_oss/public/api.ts", + "deprecated": false, + "isRequired": true + }, + { + "parentPluginId": "spacesOss", + "id": "def-public.ShareToSpaceFlyoutProps.changeSpacesHandler.$3", + "type": "Array", + "tags": [], + "label": "spacesToRemove", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/spaces_oss/public/api.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "spacesOss", @@ -206,7 +251,24 @@ "((updatedObjects: { type: string; id: string; }[]) => void) | undefined" ], "path": "src/plugins/spaces_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "spacesOss", + "id": "def-public.ShareToSpaceFlyoutProps.onUpdate.$1", + "type": "Array", + "tags": [], + "label": "updatedObjects", + "description": [], + "signature": [ + "{ type: string; id: string; }[]" + ], + "path": "src/plugins/spaces_oss/public/api.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "spacesOss", @@ -221,7 +283,9 @@ "(() => void) | undefined" ], "path": "src/plugins/spaces_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -610,23 +674,26 @@ ], "path": "src/plugins/spaces_oss/public/api.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "spacesOss", - "id": "def-public.path", + "id": "def-public.SpacesApiUi.redirectLegacyUrl.$1", "type": "string", "tags": [], "label": "path", "description": [ "The path to use for the new URL, optionally including `search` and/or `hash` URL components." ], + "signature": [ + "string" + ], "path": "src/plugins/spaces_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "spacesOss", - "id": "def-public.objectNoun", + "id": "def-public.SpacesApiUi.redirectLegacyUrl.$2", "type": "string", "tags": [], "label": "objectNoun", @@ -637,9 +704,11 @@ "string | undefined" ], "path": "src/plugins/spaces_oss/public/api.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -982,6 +1051,22 @@ ], "path": "src/plugins/spaces_oss/public/api.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "spacesOss", + "id": "def-public.props", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/spaces_oss/public/api.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/spaces_oss.mdx b/api_docs/spaces_oss.mdx index fa7433a203333..d166a37a9373a 100644 --- a/api_docs/spaces_oss.mdx +++ b/api_docs/spaces_oss.mdx @@ -18,7 +18,7 @@ Contact [Platform Security](https://github.com/orgs/elastic/teams/kibana-securit | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 72 | 0 | 5 | 0 | +| 77 | 0 | 10 | 0 | ## Client diff --git a/api_docs/task_manager.json b/api_docs/task_manager.json index f3cbc0712713c..945a0ed5748e5 100644 --- a/api_docs/task_manager.json +++ b/api_docs/task_manager.json @@ -883,6 +883,28 @@ ], "path": "x-pack/plugins/task_manager/server/task.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "taskManager", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + { + "pluginId": "taskManager", + "scope": "server", + "docId": "kibTaskManagerPluginApi", + "section": "def-server.RunContext", + "text": "RunContext" + } + ], + "path": "x-pack/plugins/task_manager/server/task.ts", + "deprecated": false + } + ], "initialIsOpen": false } ], diff --git a/api_docs/task_manager.mdx b/api_docs/task_manager.mdx index f3d8befa755c2..df7ad2605d035 100644 --- a/api_docs/task_manager.mdx +++ b/api_docs/task_manager.mdx @@ -18,7 +18,7 @@ import taskManagerObj from './task_manager.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 52 | 0 | 25 | 8 | +| 53 | 0 | 26 | 8 | ## Server diff --git a/api_docs/telemetry.json b/api_docs/telemetry.json index e535cabee297a..cf1bb4c629343 100644 --- a/api_docs/telemetry.json +++ b/api_docs/telemetry.json @@ -165,8 +165,8 @@ ], "path": "src/plugins/telemetry/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "telemetry", @@ -194,8 +194,8 @@ ], "path": "src/plugins/telemetry/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "telemetry", @@ -211,8 +211,8 @@ ], "path": "src/plugins/telemetry/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "telemetry", @@ -228,8 +228,8 @@ ], "path": "src/plugins/telemetry/public/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "telemetry", @@ -245,21 +245,25 @@ ], "path": "src/plugins/telemetry/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "telemetry", - "id": "def-public.optedIn", + "id": "def-public.TelemetryServicePublicApis.setOptIn.$1", "type": "boolean", "tags": [], "label": "optedIn", "description": [ "Whether the user is opting-in (`true`) or out (`false`)." ], + "signature": [ + "boolean" + ], "path": "src/plugins/telemetry/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -661,8 +665,8 @@ ], "path": "src/plugins/telemetry/server/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "setup", @@ -694,8 +698,8 @@ ], "path": "src/plugins/telemetry/server/plugin.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] } ], "lifecycle": "start", diff --git a/api_docs/telemetry_collection_manager.json b/api_docs/telemetry_collection_manager.json index d5f11a5861d36..e962a772e84da 100644 --- a/api_docs/telemetry_collection_manager.json +++ b/api_docs/telemetry_collection_manager.json @@ -533,6 +533,47 @@ ], "path": "src/plugins/telemetry_collection_manager/server/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "telemetryCollectionManager", + "id": "def-server.config", + "type": "Object", + "tags": [], + "label": "config", + "description": [], + "signature": [ + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", + "text": "StatsCollectionConfig" + } + ], + "path": "src/plugins/telemetry_collection_manager/server/types.ts", + "deprecated": false + }, + { + "parentPluginId": "telemetryCollectionManager", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionContext", + "text": "StatsCollectionContext" + } + ], + "path": "src/plugins/telemetry_collection_manager/server/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -571,6 +612,67 @@ ], "path": "src/plugins/telemetry_collection_manager/server/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "telemetryCollectionManager", + "id": "def-server.clustersDetails", + "type": "Array", + "tags": [], + "label": "clustersDetails", + "description": [], + "signature": [ + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.ClusterDetails", + "text": "ClusterDetails" + }, + "[]" + ], + "path": "src/plugins/telemetry_collection_manager/server/types.ts", + "deprecated": false + }, + { + "parentPluginId": "telemetryCollectionManager", + "id": "def-server.config", + "type": "Object", + "tags": [], + "label": "config", + "description": [], + "signature": [ + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionConfig", + "text": "StatsCollectionConfig" + } + ], + "path": "src/plugins/telemetry_collection_manager/server/types.ts", + "deprecated": false + }, + { + "parentPluginId": "telemetryCollectionManager", + "id": "def-server.context", + "type": "Object", + "tags": [], + "label": "context", + "description": [], + "signature": [ + { + "pluginId": "telemetryCollectionManager", + "scope": "server", + "docId": "kibTelemetryCollectionManagerPluginApi", + "section": "def-server.StatsCollectionContext", + "text": "StatsCollectionContext" + } + ], + "path": "src/plugins/telemetry_collection_manager/server/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -617,11 +719,10 @@ ], "path": "src/plugins/telemetry_collection_manager/server/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "telemetryCollectionManager", - "id": "def-server.collectionConfig", + "id": "def-server.TelemetryCollectionManagerPluginSetup.setCollectionStrategy.$1", "type": "Object", "tags": [], "label": "collectionConfig", @@ -631,9 +732,11 @@ "" ], "path": "src/plugins/telemetry_collection_manager/server/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "telemetryCollectionManager", diff --git a/api_docs/telemetry_collection_manager.mdx b/api_docs/telemetry_collection_manager.mdx index 6589f18a49c32..799b328833f9a 100644 --- a/api_docs/telemetry_collection_manager.mdx +++ b/api_docs/telemetry_collection_manager.mdx @@ -18,7 +18,7 @@ import telemetryCollectionManagerObj from './telemetry_collection_manager.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 29 | 0 | 29 | 4 | +| 34 | 0 | 34 | 4 | ## Server diff --git a/api_docs/telemetry_management_section.json b/api_docs/telemetry_management_section.json index 90a231a9282da..84ef19d54d547 100644 --- a/api_docs/telemetry_management_section.json +++ b/api_docs/telemetry_management_section.json @@ -191,19 +191,23 @@ ], "path": "src/plugins/telemetry_management_section/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "telemetryManagementSection", - "id": "def-public.enabled", + "id": "def-public.TelemetryManagementSectionPluginSetup.toggleSecuritySolutionExample.$1", "type": "boolean", "tags": [], "label": "enabled", "description": [], + "signature": [ + "boolean" + ], "path": "src/plugins/telemetry_management_section/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/timelines.json b/api_docs/timelines.json index 7a202a956371c..4294381952216 100644 --- a/api_docs/timelines.json +++ b/api_docs/timelines.json @@ -458,11 +458,10 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.containerElement", + "id": "def-public.getTableSkipFocus.$1.containerElementgetFocusedCellshiftKeytableHasFocustableClassName.tableHasFocus.$1", "type": "CompoundType", "tags": [], "label": "containerElement", @@ -471,9 +470,11 @@ "HTMLElement | null" ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -567,8 +568,8 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -582,8 +583,8 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1496,6 +1497,22 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-public.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ newFocusedColumn: HTMLDivElement | null; newFocusedColumnAriaColindex: number | null; }" + ], + "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1514,7 +1531,9 @@ "section": "def-common.ColumnHeaderOptions", "text": "ColumnHeaderOptions" }, - "[]; filters?: any[] | undefined; title: string; id: string; sort: ", + "[]; filters?: ", + "Filter", + "[] | undefined; title: string; id: string; sort: ", { "pluginId": "timelines", "scope": "common", @@ -1624,8 +1643,8 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1645,22 +1664,24 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.props", + "id": "def-public.TimelinesUIStart.getTGrid.$1", "type": "Uncategorized", "tags": [], "label": "props", "description": [], "signature": [ - "T extends \"standalone\" ? TGridStandaloneCompProps : T extends \"embedded\" ? TGridIntegratedCompProps : TGridIntegratedCompProps" + "GetTGridProps", + "" ], "path": "x-pack/plugins/timelines/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1674,8 +1695,8 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1693,11 +1714,10 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.props", + "id": "def-public.TimelinesUIStart.getLoadingPanel.$1", "type": "Object", "tags": [], "label": "props", @@ -1706,9 +1726,11 @@ "LoadingPanelProps" ], "path": "x-pack/plugins/timelines/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1726,11 +1748,10 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.props", + "id": "def-public.TimelinesUIStart.getLastUpdated.$1", "type": "Object", "tags": [], "label": "props", @@ -1739,9 +1760,11 @@ "LastUpdatedAtProps" ], "path": "x-pack/plugins/timelines/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1752,31 +1775,30 @@ "description": [], "signature": [ "(props: ", - "FieldBrowserWrappedProps", + "FieldBrowserProps", ") => React.ReactElement<", - "FieldBrowserWrappedProps", + "FieldBrowserProps", ">" ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.props", - "type": "CompoundType", + "id": "def-public.TimelinesUIStart.getFieldBrowser.$1", + "type": "Object", "tags": [], "label": "props", "description": [], "signature": [ - "Pick<", - "FieldBrowserProps", - ", \"timelineId\" | \"columnHeaders\" | \"browserFields\" | \"isEventViewer\" | \"onFieldSelected\"> & { width?: number | undefined; height?: number | undefined; }" + "FieldBrowserProps" ], "path": "x-pack/plugins/timelines/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1793,8 +1815,8 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1810,8 +1832,8 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1828,8 +1850,8 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1847,11 +1869,10 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.store", + "id": "def-public.TimelinesUIStart.setTGridEmbeddedStore.$1", "type": "Object", "tags": [], "label": "store", @@ -1863,9 +1884,11 @@ ">" ], "path": "x-pack/plugins/timelines/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -1883,11 +1906,10 @@ ], "path": "x-pack/plugins/timelines/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-public.props", + "id": "def-public.TimelinesUIStart.getAddToCaseAction.$1", "type": "Object", "tags": [], "label": "props", @@ -1896,9 +1918,11 @@ "AddToCaseActionProps" ], "path": "x-pack/plugins/timelines/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "start", @@ -3204,11 +3228,10 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-common.containerElement", + "id": "def-common.getTableSkipFocus.$1.containerElementgetFocusedCellshiftKeytableHasFocustableClassName.tableHasFocus.$1", "type": "CompoundType", "tags": [], "label": "containerElement", @@ -3217,9 +3240,11 @@ "HTMLElement | null" ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -3327,8 +3352,8 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -3342,8 +3367,8 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -4753,8 +4778,8 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -4869,7 +4894,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -4882,7 +4909,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -4938,7 +4967,9 @@ "(() => void) | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] } ], "initialIsOpen": false @@ -5541,21 +5572,24 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-common.columnName", + "id": "def-common.ColumnRenderer.isInstance.$1", "type": "string", "tags": [], "label": "columnName", "description": [], + "signature": [ + "string" + ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "timelines", - "id": "def-common.data", + "id": "def-common.ColumnRenderer.isInstance.$2", "type": "Array", "tags": [], "label": "data", @@ -5571,9 +5605,11 @@ "[]" ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -5595,30 +5631,115 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-common.__0", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues", "type": "Object", "tags": [], - "label": "__0", + "label": "{\n columnName,\n eventId,\n field,\n timelineId,\n truncate,\n values,\n linkValues,\n }", "description": [], - "signature": [ - "{ columnName: string; eventId: string; field: ", + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false, + "children": [ { - "pluginId": "timelines", - "scope": "common", - "docId": "kibTimelinesPluginApi", - "section": "def-common.ColumnHeaderOptions", - "text": "ColumnHeaderOptions" + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.columnName", + "type": "string", + "tags": [], + "label": "columnName", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false }, - "; timelineId: string; truncate?: boolean | undefined; values: string[] | null | undefined; linkValues?: string[] | null | undefined; }" - ], - "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", - "deprecated": false + { + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.eventId", + "type": "string", + "tags": [], + "label": "eventId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.field", + "type": "CompoundType", + "tags": [], + "label": "field", + "description": [], + "signature": [ + "Pick<", + "EuiDataGridColumn", + ", \"id\" | \"display\" | \"displayAsText\" | \"initialWidth\"> & { aggregatable?: boolean | undefined; category?: string | undefined; columnHeaderType: ", + { + "pluginId": "timelines", + "scope": "common", + "docId": "kibTimelinesPluginApi", + "section": "def-common.ColumnHeaderType", + "text": "ColumnHeaderType" + }, + "; description?: string | undefined; example?: string | undefined; format?: string | undefined; linkField?: string | undefined; placeholder?: string | undefined; subType?: ", + "IFieldSubType", + " | undefined; type?: string | undefined; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.timelineId", + "type": "string", + "tags": [], + "label": "timelineId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.truncate", + "type": "CompoundType", + "tags": [], + "label": "truncate", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.values", + "type": "CompoundType", + "tags": [], + "label": "values", + "description": [], + "signature": [ + "string[] | null | undefined" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.ColumnRenderer.renderColumn.$1.columnNameeventIdfieldtimelineIdtruncatevalueslinkValues.linkValues", + "type": "CompoundType", + "tags": [], + "label": "linkValues", + "description": [], + "signature": [ + "string[] | null | undefined" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/columns/index.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -7575,22 +7696,31 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-common.__0", + "id": "def-common.HeaderActionProps.onSelectAll.$1.isSelected", "type": "Object", "tags": [], - "label": "__0", + "label": "{ isSelected }", "description": [], - "signature": [ - "{ isSelected: boolean; }" - ], "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.HeaderActionProps.onSelectAll.$1.isSelected.isSelected", + "type": "boolean", + "tags": [], + "label": "isSelected", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/actions/index.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -8556,11 +8686,10 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-common.data", + "id": "def-common.RowRenderer.isInstance.$1", "type": "Object", "tags": [], "label": "data", @@ -8569,9 +8698,11 @@ "Ecs" ], "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "timelines", @@ -8595,32 +8726,75 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "timelines", - "id": "def-common.__0", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId", "type": "Object", "tags": [], - "label": "__0", + "label": "{\n browserFields,\n data,\n isDraggable,\n timelineId,\n }", "description": [], - "signature": [ - "{ browserFields: Readonly; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false }, - ">>>; data: ", - "Ecs", - "; isDraggable: boolean; timelineId: string; }" - ], - "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", - "deprecated": false + { + "parentPluginId": "timelines", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId.data", + "type": "Object", + "tags": [], + "label": "data", + "description": [], + "signature": [ + "Ecs" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId.isDraggable", + "type": "boolean", + "tags": [], + "label": "isDraggable", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false + }, + { + "parentPluginId": "timelines", + "id": "def-common.RowRenderer.renderRow.$1.browserFieldsdataisDraggabletimelineId.timelineId", + "type": "string", + "tags": [], + "label": "timelineId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/rows/index.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -10437,7 +10611,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false @@ -10743,7 +10918,7 @@ "label": "alertConsumers", "description": [], "signature": [ - "ALERTS_CONSUMERS", + "AlertConsumers", "[] | undefined" ], "path": "x-pack/plugins/timelines/common/search_strategy/timeline/index.ts", @@ -12148,6 +12323,22 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ containerElement: HTMLElement | null; tableClassName: string; }" + ], + "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12316,6 +12507,19 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.nextPage", + "type": "number", + "tags": [], + "label": "nextPage", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12330,6 +12534,22 @@ ], "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ newFocusedColumn: HTMLDivElement | null; newFocusedColumnAriaColindex: number | null; }" + ], + "path": "x-pack/plugins/timelines/common/utils/accessibility/helpers.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12344,6 +12564,19 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.columnId", + "type": "string", + "tags": [], + "label": "columnId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12358,6 +12591,22 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ columnId: string; delta: number; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12382,6 +12631,30 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.sorted", + "type": "Object", + "tags": [], + "label": "sorted", + "description": [], + "signature": [ + "{ columnId: string; sortDirection: ", + { + "pluginId": "securitySolution", + "scope": "common", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-common.SortDirection", + "text": "SortDirection" + }, + "; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12404,6 +12677,30 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.sorted", + "type": "Array", + "tags": [], + "label": "sorted", + "description": [], + "signature": [ + "{ columnId: string; sortDirection: ", + { + "pluginId": "securitySolution", + "scope": "common", + "docId": "kibSecuritySolutionPluginApi", + "section": "def-common.SortDirection", + "text": "SortDirection" + }, + "; }[]" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12420,6 +12717,19 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.eventId", + "type": "string", + "tags": [], + "label": "eventId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12436,6 +12746,22 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ eventIds: string[]; isSelected: boolean; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12452,6 +12778,22 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.__0", + "type": "Object", + "tags": [], + "label": "__0", + "description": [], + "signature": [ + "{ isSelected: boolean; }" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12468,6 +12810,19 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.eventId", + "type": "string", + "tags": [], + "label": "eventId", + "description": [], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -12492,6 +12847,29 @@ ], "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "timelines", + "id": "def-common.columns", + "type": "Array", + "tags": [], + "label": "columns", + "description": [], + "signature": [ + { + "pluginId": "timelines", + "scope": "common", + "docId": "kibTimelinesPluginApi", + "section": "def-common.ColumnHeaderOptions", + "text": "ColumnHeaderOptions" + }, + "[]" + ], + "path": "x-pack/plugins/timelines/common/types/timeline/store.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { diff --git a/api_docs/timelines.mdx b/api_docs/timelines.mdx index 78b00340cc544..2669285776df9 100644 --- a/api_docs/timelines.mdx +++ b/api_docs/timelines.mdx @@ -18,7 +18,7 @@ import timelinesObj from './timelines.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 889 | 6 | 770 | 26 | +| 914 | 6 | 795 | 25 | ## Client diff --git a/api_docs/triggers_actions_ui.json b/api_docs/triggers_actions_ui.json index 4beeb5f45363d..23c9adad627b7 100644 --- a/api_docs/triggers_actions_ui.json +++ b/api_docs/triggers_actions_ui.json @@ -1154,11 +1154,10 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.alertParams", + "id": "def-public.AlertTypeModel.validate.$1", "type": "Uncategorized", "tags": [], "label": "alertParams", @@ -1167,9 +1166,11 @@ "Params" ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -1312,11 +1313,10 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.property", + "id": "def-public.AlertTypeParamsExpressionProps.setAlertParams.$1", "type": "Uncategorized", "tags": [], "label": "property", @@ -1325,11 +1325,12 @@ "Key" ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "triggersActionsUi", - "id": "def-public.value", + "id": "def-public.AlertTypeParamsExpressionProps.setAlertParams.$2", "type": "Uncategorized", "tags": [], "label": "value", @@ -1338,9 +1339,11 @@ "Params[Key] | undefined" ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -1362,11 +1365,10 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.key", + "id": "def-public.AlertTypeParamsExpressionProps.setAlertProperty.$1", "type": "Uncategorized", "tags": [], "label": "key", @@ -1375,11 +1377,12 @@ "Prop" ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "triggersActionsUi", - "id": "def-public.value", + "id": "def-public.AlertTypeParamsExpressionProps.setAlertProperty.$2", "type": "CompoundType", "tags": [], "label": "value", @@ -1396,9 +1399,11 @@ ", \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"throttle\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"notifyWhen\" | \"muteAll\" | \"mutedInstanceIds\" | \"executionStatus\">[Prop] | null" ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -1803,11 +1808,10 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/application/app.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.crumbs", + "id": "def-public.TriggersAndActionsUiServices.setBreadcrumbs.$1", "type": "Array", "tags": [], "label": "crumbs", @@ -1817,9 +1821,11 @@ "[]" ], "path": "x-pack/plugins/triggers_actions_ui/public/application/app.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -3117,46 +3123,25 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.props", + "id": "def-public.TriggersAndActionsUIPublicPluginStart.getAddConnectorFlyout.$1", "type": "Object", "tags": [], "label": "props", "description": [], "signature": [ - "{ onClose: () => void; consumer?: string | undefined; actionTypes?: ", - { - "pluginId": "actions", - "scope": "common", - "docId": "kibActionsPluginApi", - "section": "def-common.ActionType", - "text": "ActionType" - }, - "[] | undefined; onTestConnector?: ((connector: ", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ActionConnector", - "text": "ActionConnector" - }, - ", Record>) => void) | undefined; reloadConnectors?: (() => Promise, Record>[]>) | undefined; }" + "Pick<", + "ConnectorAddFlyoutProps", + ", \"onClose\" | \"consumer\" | \"actionTypes\" | \"onTestConnector\" | \"reloadConnectors\">" ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -3174,40 +3159,25 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.props", + "id": "def-public.TriggersAndActionsUIPublicPluginStart.getEditConnectorFlyout.$1", "type": "Object", "tags": [], "label": "props", "description": [], "signature": [ - "{ onClose: () => void; consumer?: string | undefined; reloadConnectors?: (() => Promise, Record>[]>) | undefined; initialConnector: ", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.ActionConnector", - "text": "ActionConnector" - }, - ", Record>; tab?: ", - "EditConectorTabs", - " | undefined; }" + "Pick<", + "ConnectorEditFlyoutProps", + ", \"onClose\" | \"consumer\" | \"reloadConnectors\" | \"initialConnector\" | \"tab\">" ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -3225,38 +3195,25 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.props", + "id": "def-public.TriggersAndActionsUIPublicPluginStart.getAddAlertFlyout.$1", "type": "Object", "tags": [], "label": "props", "description": [], "signature": [ - "{ onClose: (reason: ", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.AlertFlyoutCloseReason", - "text": "AlertFlyoutCloseReason" - }, - ") => void; metadata?: Record | undefined; onSave?: (() => Promise) | undefined; alertTypeId?: string | undefined; consumer: string; canChangeTrigger?: boolean | undefined; initialValues?: Partial>, \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"throttle\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"notifyWhen\" | \"muteAll\" | \"mutedInstanceIds\" | \"executionStatus\">> | undefined; reloadAlerts?: (() => Promise) | undefined; }" + "Pick<", + "AlertAddProps", + ">, \"onClose\" | \"metadata\" | \"onSave\" | \"alertTypeId\" | \"consumer\" | \"canChangeTrigger\" | \"initialValues\" | \"reloadAlerts\">" ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "triggersActionsUi", @@ -3274,38 +3231,25 @@ ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "triggersActionsUi", - "id": "def-public.props", + "id": "def-public.TriggersAndActionsUIPublicPluginStart.getEditAlertFlyout.$1", "type": "Object", "tags": [], "label": "props", "description": [], "signature": [ - "{ onClose: (reason: ", - { - "pluginId": "triggersActionsUi", - "scope": "public", - "docId": "kibTriggersActionsUiPluginApi", - "section": "def-public.AlertFlyoutCloseReason", - "text": "AlertFlyoutCloseReason" - }, - ") => void; metadata?: Record | undefined; onSave?: (() => Promise) | undefined; reloadAlerts?: (() => Promise) | undefined; initialAlert: Pick<", - { - "pluginId": "alerting", - "scope": "common", - "docId": "kibAlertingPluginApi", - "section": "def-common.Alert", - "text": "Alert" - }, - ">, \"enabled\" | \"id\" | \"name\" | \"params\" | \"actions\" | \"throttle\" | \"tags\" | \"alertTypeId\" | \"consumer\" | \"schedule\" | \"scheduledTaskId\" | \"createdBy\" | \"updatedBy\" | \"createdAt\" | \"updatedAt\" | \"apiKeyOwner\" | \"notifyWhen\" | \"muteAll\" | \"mutedInstanceIds\" | \"executionStatus\">; }" + "Pick<", + "AlertEditProps", + ">, \"onClose\" | \"metadata\" | \"onSave\" | \"reloadAlerts\" | \"initialAlert\">" ], "path": "x-pack/plugins/triggers_actions_ui/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "start", diff --git a/api_docs/triggers_actions_ui.mdx b/api_docs/triggers_actions_ui.mdx index e682f3872becf..3b1f4dfe55f05 100644 --- a/api_docs/triggers_actions_ui.mdx +++ b/api_docs/triggers_actions_ui.mdx @@ -18,7 +18,7 @@ import triggersActionsUiObj from './triggers_actions_ui.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 237 | 1 | 228 | 19 | +| 237 | 1 | 228 | 18 | ## Client diff --git a/api_docs/ui_actions_enhanced.json b/api_docs/ui_actions_enhanced.json index d75bb38be5224..697231e9f7935 100644 --- a/api_docs/ui_actions_enhanced.json +++ b/api_docs/ui_actions_enhanced.json @@ -2749,8 +2749,8 @@ ], "path": "x-pack/plugins/ui_actions_enhanced/public/drilldowns/drilldown_definition.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "uiActionsEnhanced", @@ -3160,11 +3160,10 @@ ], "path": "x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/dynamic_action_manager.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "uiActionsEnhanced", - "id": "def-public.context", + "id": "def-public.DynamicActionManagerParams.isCompatible.$1", "type": "Uncategorized", "tags": [], "label": "context", @@ -3173,9 +3172,11 @@ "C" ], "path": "x-pack/plugins/ui_actions_enhanced/public/dynamic_actions/dynamic_action_manager.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -3983,11 +3984,10 @@ ], "path": "x-pack/plugins/ui_actions_enhanced/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "uiActionsEnhanced", - "id": "def-server.definition", + "id": "def-server.SetupContract.registerActionFactory.$1", "type": "Object", "tags": [], "label": "definition", @@ -4011,9 +4011,11 @@ ">" ], "path": "x-pack/plugins/ui_actions_enhanced/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/url_forwarding.json b/api_docs/url_forwarding.json index 745775a1434bf..ab6a119cce283 100644 --- a/api_docs/url_forwarding.json +++ b/api_docs/url_forwarding.json @@ -217,19 +217,23 @@ ], "path": "src/plugins/url_forwarding/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "urlForwarding", - "id": "def-public.legacyPath", + "id": "def-public.ForwardDefinition.rewritePath.$1", "type": "string", "tags": [], "label": "legacyPath", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/url_forwarding/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false diff --git a/api_docs/usage_collection.json b/api_docs/usage_collection.json index b4e421165c782..b7a68aaa9cef7 100644 --- a/api_docs/usage_collection.json +++ b/api_docs/usage_collection.json @@ -145,39 +145,38 @@ ], "path": "src/plugins/usage_collection/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-public.appName", + "id": "def-public.UsageCollectionSetup.reportUiCounter.$1", "type": "string", "tags": [], "label": "appName", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "usageCollection", - "id": "def-public.type", + "id": "def-public.UsageCollectionSetup.reportUiCounter.$2", "type": "CompoundType", "tags": [], "label": "type", "description": [], "signature": [ - "METRIC_TYPE", - ".COUNT | ", - "METRIC_TYPE", - ".LOADED | ", - "METRIC_TYPE", - ".CLICK" + "UiCounterMetricType" ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "usageCollection", - "id": "def-public.eventNames", + "id": "def-public.UsageCollectionSetup.reportUiCounter.$3", "type": "CompoundType", "tags": [], "label": "eventNames", @@ -186,11 +185,12 @@ "string | string[]" ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "usageCollection", - "id": "def-public.count", + "id": "def-public.UsageCollectionSetup.reportUiCounter.$4", "type": "number", "tags": [], "label": "count", @@ -199,9 +199,11 @@ "number | undefined" ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", @@ -235,39 +237,38 @@ ], "path": "src/plugins/usage_collection/public/plugin.tsx", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-public.appName", + "id": "def-public.UsageCollectionStart.reportUiCounter.$1", "type": "string", "tags": [], "label": "appName", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "usageCollection", - "id": "def-public.type", + "id": "def-public.UsageCollectionStart.reportUiCounter.$2", "type": "CompoundType", "tags": [], "label": "type", "description": [], "signature": [ - "METRIC_TYPE", - ".COUNT | ", - "METRIC_TYPE", - ".LOADED | ", - "METRIC_TYPE", - ".CLICK" + "UiCounterMetricType" ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "usageCollection", - "id": "def-public.eventNames", + "id": "def-public.UsageCollectionStart.reportUiCounter.$3", "type": "CompoundType", "tags": [], "label": "eventNames", @@ -276,11 +277,12 @@ "string | string[]" ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "usageCollection", - "id": "def-public.count", + "id": "def-public.UsageCollectionStart.reportUiCounter.$4", "type": "number", "tags": [], "label": "count", @@ -289,9 +291,11 @@ "number | undefined" ], "path": "src/plugins/usage_collection/public/plugin.tsx", - "deprecated": false + "deprecated": false, + "isRequired": false } - ] + ], + "returnComment": [] } ], "lifecycle": "start", @@ -553,11 +557,10 @@ ], "path": "src/plugins/usage_collection/server/usage_counters/usage_counter.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-server.params", + "id": "def-server.IUsageCounter.incrementCounter.$1", "type": "Object", "tags": [], "label": "params", @@ -572,9 +575,11 @@ } ], "path": "src/plugins/usage_collection/server/usage_counters/usage_counter.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "initialIsOpen": false @@ -742,6 +747,46 @@ ], "path": "src/plugins/usage_collection/server/collector/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "usageCollection", + "id": "def-server.context", + "type": "CompoundType", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "{ esClient: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCorePluginApi", + "section": "def-server.ElasticsearchClient", + "text": "ElasticsearchClient" + }, + "; soClient: Pick<", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreSavedObjectsPluginApi", + "section": "def-server.SavedObjectsClient", + "text": "SavedObjectsClient" + }, + ", \"get\" | \"delete\" | \"create\" | \"bulkCreate\" | \"checkConflicts\" | \"find\" | \"bulkGet\" | \"resolve\" | \"update\" | \"collectMultiNamespaceReferences\" | \"updateObjectsSpaces\" | \"bulkUpdate\" | \"removeReferencesTo\" | \"openPointInTimeForType\" | \"closePointInTime\" | \"createPointInTimeFinder\" | \"errors\">; } & (WithKibanaRequest extends true ? { kibanaRequest?: ", + { + "pluginId": "core", + "scope": "server", + "docId": "kibCoreHttpPluginApi", + "section": "def-server.KibanaRequest", + "text": "KibanaRequest" + }, + " | undefined; } : {})" + ], + "path": "src/plugins/usage_collection/server/collector/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -963,19 +1008,23 @@ ], "path": "src/plugins/usage_collection/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-server.type", + "id": "def-server.UsageCollectionSetup.createUsageCounter.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/usage_collection/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "usageCollection", @@ -999,19 +1048,23 @@ ], "path": "src/plugins/usage_collection/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-server.type", + "id": "def-server.UsageCollectionSetup.getUsageCounterByType.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/usage_collection/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "usageCollection", @@ -1043,62 +1096,30 @@ ], "path": "src/plugins/usage_collection/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-server.options", + "id": "def-server.UsageCollectionSetup.makeUsageCollector.$1", "type": "CompoundType", "tags": [], "label": "options", "description": [], "signature": [ - "{ type: string; isReady: () => boolean | Promise; schema?: ", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.MakeSchemaFrom", - "text": "MakeSchemaFrom" - }, - " | undefined; fetch: ", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorFetchMethod", - "text": "CollectorFetchMethod" - }, - "; } & ExtraOptions & (WithKibanaRequest extends true ? { extendFetchContext: ", { "pluginId": "usageCollection", "scope": "server", "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorOptionsFetchExtendedContext", - "text": "CollectorOptionsFetchExtendedContext" + "section": "def-server.UsageCollectorOptions", + "text": "UsageCollectorOptions" }, - "; } : { extendFetchContext?: ", - { - "pluginId": "usageCollection", - "scope": "server", - "docId": "kibUsageCollectionPluginApi", - "section": "def-server.CollectorOptionsFetchExtendedContext", - "text": "CollectorOptionsFetchExtendedContext" - }, - " | undefined; }) & Required, \"schema\">>" + "" ], "path": "src/plugins/usage_collection/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "usageCollection", @@ -1122,11 +1143,10 @@ ], "path": "src/plugins/usage_collection/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-server.collector", + "id": "def-server.UsageCollectionSetup.registerCollector.$1", "type": "Object", "tags": [], "label": "collector", @@ -1142,9 +1162,11 @@ "" ], "path": "src/plugins/usage_collection/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "usageCollection", @@ -1168,19 +1190,23 @@ ], "path": "src/plugins/usage_collection/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "usageCollection", - "id": "def-server.type", + "id": "def-server.UsageCollectionSetup.getCollectorByType.$1", "type": "string", "tags": [], "label": "type", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/usage_collection/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/usage_collection.mdx b/api_docs/usage_collection.mdx index 6070c24c62003..72d3f34c6bd01 100644 --- a/api_docs/usage_collection.mdx +++ b/api_docs/usage_collection.mdx @@ -18,7 +18,7 @@ import usageCollectionObj from './usage_collection.json'; | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 57 | 0 | 16 | 2 | +| 58 | 0 | 17 | 2 | ## Client diff --git a/api_docs/vis_type_timeseries.json b/api_docs/vis_type_timeseries.json index f46208881a913..01b211e3da90b 100644 --- a/api_docs/vis_type_timeseries.json +++ b/api_docs/vis_type_timeseries.json @@ -135,11 +135,10 @@ ], "path": "src/plugins/vis_type_timeseries/server/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "visTypeTimeseries", - "id": "def-server.requestContext", + "id": "def-server.VisTypeTimeseriesSetup.getVisData.$1", "type": "Object", "tags": [], "label": "requestContext", @@ -148,11 +147,12 @@ "DataRequestHandlerContext" ], "path": "src/plugins/vis_type_timeseries/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "visTypeTimeseries", - "id": "def-server.fakeRequest", + "id": "def-server.VisTypeTimeseriesSetup.getVisData.$2", "type": "Object", "tags": [], "label": "fakeRequest", @@ -168,11 +168,12 @@ "" ], "path": "src/plugins/vis_type_timeseries/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "visTypeTimeseries", - "id": "def-server.options", + "id": "def-server.VisTypeTimeseriesSetup.getVisData.$3", "type": "Any", "tags": [], "label": "options", @@ -181,9 +182,11 @@ "any" ], "path": "src/plugins/vis_type_timeseries/server/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] } ], "lifecycle": "setup", diff --git a/api_docs/visualizations.json b/api_docs/visualizations.json index 9d55abf29d6f4..c779b4695fde5 100644 --- a/api_docs/visualizations.json +++ b/api_docs/visualizations.json @@ -2613,7 +2613,9 @@ "section": "def-common.TimeRange", "text": "TimeRange" }, - " | undefined) => any; getBounds: () => ", + " | undefined) => ", + "RangeFilter", + " | undefined; getBounds: () => ", { "pluginId": "data", "scope": "common", @@ -2802,7 +2804,9 @@ "(() => string[]) | undefined" ], "path": "src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "visualizations", @@ -2932,7 +2936,31 @@ " | undefined) => string[]) | undefined" ], "path": "src/plugins/visualizations/public/vis_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-public.VisTypeDefinition.getSupportedTriggers.$1", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + " | undefined" + ], + "path": "src/plugins/visualizations/public/vis_types/types.ts", + "deprecated": false, + "isRequired": false + } + ], + "returnComment": [] }, { "parentPluginId": "visualizations", @@ -2971,7 +2999,30 @@ "[]>) | undefined" ], "path": "src/plugins/visualizations/public/vis_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-public.VisTypeDefinition.getUsedIndexPattern.$1", + "type": "Object", + "tags": [], + "label": "visParams", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + } + ], + "path": "src/plugins/visualizations/public/vis_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "visualizations", @@ -3157,7 +3208,39 @@ ">) => React.ReactNode) | undefined" ], "path": "src/plugins/visualizations/public/vis_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-public.VisTypeDefinition.getInfoMessage.$1", + "type": "Object", + "tags": [], + "label": "vis", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "public", + "docId": "kibVisualizationsPluginApi", + "section": "def-public.Vis", + "text": "Vis" + }, + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">" + ], + "path": "src/plugins/visualizations/public/vis_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "visualizations", @@ -3275,7 +3358,31 @@ ">) | undefined" ], "path": "src/plugins/visualizations/public/vis_types/types.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-public.VisTypeDefinition.setup.$1", + "type": "Object", + "tags": [], + "label": "vis", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "public", + "docId": "kibVisualizationsPluginApi", + "section": "def-public.Vis", + "text": "Vis" + }, + "" + ], + "path": "src/plugins/visualizations/public/vis_types/types.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] }, { "parentPluginId": "visualizations", @@ -3461,7 +3568,9 @@ "(() => string[]) | undefined" ], "path": "src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts", - "deprecated": false + "deprecated": false, + "children": [], + "returnComment": [] }, { "parentPluginId": "visualizations", @@ -3602,12 +3711,13 @@ { "parentPluginId": "visualizations", "id": "def-public.VisualizeInput.query", - "type": "Any", + "type": "Object", "tags": [], "label": "query", "description": [], "signature": [ - "any" + "Query", + " | undefined" ], "path": "src/plugins/visualizations/public/embeddable/visualize_embeddable.ts", "deprecated": false @@ -3620,7 +3730,8 @@ "label": "filters", "description": [], "signature": [ - "any[] | undefined" + "Filter", + "[] | undefined" ], "path": "src/plugins/visualizations/public/embeddable/visualize_embeddable.ts", "deprecated": false @@ -3729,6 +3840,48 @@ ], "path": "src/plugins/visualizations/public/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-public.vis", + "type": "Object", + "tags": [], + "label": "vis", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "public", + "docId": "kibVisualizationsPluginApi", + "section": "def-public.Vis", + "text": "Vis" + }, + "" + ], + "path": "src/plugins/visualizations/public/types.ts", + "deprecated": false + }, + { + "parentPluginId": "visualizations", + "id": "def-public.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "public", + "docId": "kibVisualizationsPluginApi", + "section": "def-public.VisToExpressionAstParams", + "text": "VisToExpressionAstParams" + } + ], + "path": "src/plugins/visualizations/public/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -4370,21 +4523,24 @@ ], "path": "src/plugins/visualizations/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "visualizations", - "id": "def-public.visType", + "id": "def-public.VisualizationsStart.createVis.$1", "type": "string", "tags": [], "label": "visType", "description": [], + "signature": [ + "string" + ], "path": "src/plugins/visualizations/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "visualizations", - "id": "def-public.visState", + "id": "def-public.VisualizationsStart.createVis.$2", "type": "Object", "tags": [], "label": "visState", @@ -4408,9 +4564,11 @@ ">" ], "path": "src/plugins/visualizations/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } - ] + ], + "returnComment": [] }, { "parentPluginId": "visualizations", diff --git a/api_docs/visualizations.mdx b/api_docs/visualizations.mdx index 4686c5b64f936..4e47d231c312e 100644 --- a/api_docs/visualizations.mdx +++ b/api_docs/visualizations.mdx @@ -18,7 +18,7 @@ Contact [Kibana App](https://github.com/orgs/elastic/teams/kibana-app) for quest | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 257 | 14 | 239 | 12 | +| 263 | 13 | 245 | 12 | ## Client diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index 9be0170b67b74..b2ce650a531dc 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -72,10 +72,10 @@ You must migrate your time_based index patterns to a wildcard pattern. For examp [%collapsible] ==== *Details* + -For the `.tar.gz` and `.zip` archives, `platform` has been removed from the `root` folder name. For more information, refer to {kibana-pull}93835[#93835] +After you extract an archive, the output directory no longer includes the target platform. For example, `kibana-8.0.0-linux-aarch64.tar.gz` produces a `kibana-8.0.0` folder. For more information, refer to {kibana-pull}93835[#93835]. *Impact* + -The `root` folder name now appears as `kibana-8.0.0-SNAPSHOT-linux-aarch64.tar.gz -> kibana-8.0.0-SNAPSHOT`. +To use the new folder, update the configuration management tools and automation. ==== [discrete] @@ -84,10 +84,10 @@ The `root` folder name now appears as `kibana-8.0.0-SNAPSHOT-linux-aarch64.tar.g [%collapsible] ==== *Details* + -The default support for TLS v1.0 and v1.1 has been removed. For more information, refer to {kibana-pull}90511[#90511] +The default support for TLS v1.0 and v1.1 has been removed. For more information, refer to {kibana-pull}90511[#90511]. *Impact* + -To enable support, set the environment variable to `NODE_OPTIONS=--tls-min-1.0`. +To enable support, set `--tls-min-1.0` in the `node.options` configuration file. To locate the configuration file, go to the kibana/config folder or any other configuration with the `KBN_PATH_CONF` environment variable. For example, if you are using a Debian-based system, the configuration file is located in /etc/kibana. ==== [discrete] @@ -96,10 +96,10 @@ To enable support, set the environment variable to `NODE_OPTIONS=--tls-min-1.0`. [%collapsible] ==== *Details* + -Systems that don't have `service` aliased to use kibana.service are unable to use `service start kibana`. For more information, refer to {kibana-pull}74424[#74424] +All supported operating systems use systemd service files. Any system that doesn’t have `service` aliased to use kibana.service should use `systemctl start kibana.service` instead of `service start kibana`. For more information, refer to {kibana-pull}74424[#74424]. *Impact* + -If your system doesn't have `service` aliased to use kibana.service, use `systemctl start kibana.service`. +If your installation uses .deb or .rpm packages with SysV, migrate to systemd. ==== [discrete] @@ -108,10 +108,30 @@ If your system doesn't have `service` aliased to use kibana.service, use `system [%collapsible] ==== *Details* + -By default, responses are not logged. Previously, responses were logged if `logging.json` was set to `true`, `logging.dest` was specified, or a TTY was detected. For more information, refer to {kibana-pull}42353[#42353] +In previous versions, all events are logged in `json` when `logging.json:true`. With the new logging configuration, you can choose the `json` and pattern output formats with layouts. For more information, refer to {kibana-pull}42353[#42353]. *Impact* + -To log responses, set `logging.events.response=*` in kibana.yml. +To restore the previous behavior, configure the logging format for each custom appender with the `appender.layout property` in kibana.yml. There is no default for custom appenders, and each appender must be configured expilictly. + +[source,yaml] +------------------- +logging: + appenders: + custom_console: + type: console + layout: + type: pattern + custom_json: + type: console + layout: + type: json + loggers: + - name: plugins.myPlugin + appenders: [custom_console] + root: + appenders: [default, custom_json] + level: warn +------------------- ==== [float] @@ -120,7 +140,7 @@ To log responses, set `logging.events.response=*` in kibana.yml. [discrete] [[breaking-52539]] -.Removed legacy Reporting job params compatibility shim +.Legacy job parameters are no longer supported [%collapsible] ==== *Details* + @@ -152,10 +172,10 @@ Use the `/api/security/saml/callback` route, or wait to upgrade to 8.0.0-alpha2 [%collapsible] ==== *Details* + -To provide the maximum level of protection for most installations, the csp.strict config is now enabled by default. Legacy browsers not supported by Kibana, such as IE11, are unable to access {kib} unless explicitly enabled. All browsers officially supported by Kibana do not have this issue. For more information, refer to {kibana-pull}41700[#41700] +To provide the maximum level of protection for most installations, the csp.strict config is now enabled by default. Legacy browsers not supported by Kibana, such as Internet Explorer 11, are unable to access {kib} unless explicitly enabled. All browsers officially supported by Kibana do not have this issue. For more information, refer to {kibana-pull}41700[#41700] *Impact* + -To enable support for legacy browsers, set `csp.strict: false` in kibana.yml. +To enable support for legacy browsers, set `csp.strict: false` in kibana.yml. To effectively enforce the security protocol, we strongly discourage disabling `csp.strict` unless it is critical that you support Internet Explorer 11. ==== [float] @@ -191,14 +211,14 @@ You are now unable to use `0` as the `server.host`. [discrete] [[breaking-38657]] -.Removed `xpack.security.authProviders` and `xpack.security.public` +.Removed `xpack.security.public` and `xpack.security.authProviders` [%collapsible] ==== *Details* + The `xpack.security.public` and `xpack.security.authProviders` settings have been removed. For more information, refer to {kibana-pull}38657[#38657] *Impact* + -Use the `xpack.security.authc.saml.realm` setting. +Use the `xpack.security.authc.saml.realm` and `xpack.security.authc.providers` settings. ==== [discrete] diff --git a/docs/developer/contributing/linting.asciidoc b/docs/developer/contributing/linting.asciidoc index 0d05afa504538..eb7c22c517e4b 100644 --- a/docs/developer/contributing/linting.asciidoc +++ b/docs/developer/contributing/linting.asciidoc @@ -47,17 +47,21 @@ file types. "eslint.validate": [ "javascript", "javascriptreact", - { "language": "typescript", "autoFix": true }, - { "language": "typescriptreact", "autoFix": true } + "typescript", + "typescriptreact", ] ---- +Although, starting with https://github.com/microsoft/vscode-eslint#version-204[ESLint v2.0.4], there is no need to use `eslint.validate` to parse typescript files as it works out of the box. + `eslint` can automatically fix trivial lint errors when you save a file by adding this line in your setting. [source,json] ---- - "eslint.autoFixOnSave": true, +"editor.codeActionsOnSave": { + "source.fixAll.eslint": true +} ---- :warning: It is *not* recommended to use the @@ -67,4 +71,4 @@ the multiple `.eslintrc.js` files across the project and some of them use the https://www.npmjs.com/package/prettier[NPM version of Prettier]. Using the IDE extension might cause conflicts, applying the formatting to too many files that shouldn’t be prettier-ized and/or highlighting -errors that are actually OK. \ No newline at end of file +errors that are actually OK. diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index d50c58c7df9bb..dc410f2e5f2a5 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -115,10 +115,18 @@ for use in their own application. |Expression Shape plugin adds a shape function to the expression plugin and an associated renderer. The renderer will display the given shape with selected decorations. +|{kib-repo}blob/{branch}/src/plugins/field_formats/README.md[fieldFormats] +|Index pattern fields formatters + + |{kib-repo}blob/{branch}/src/plugins/home/README.md[home] |Moves the legacy ui/registry/feature_catalogue module for registering "features" that should be shown in the home page's feature catalogue to a service within a "home" plugin. The feature catalogue refered to here should not be confused with the "feature" plugin for registering features used to derive UI capabilities for feature controls. +|{kib-repo}blob/{branch}/src/plugins/index_pattern_editor/README.md[indexPatternEditor] +|Create index patterns from within Kibana apps. + + |{kib-repo}blob/{branch}/src/plugins/index_pattern_field_editor/README.md[indexPatternFieldEditor] |The reusable field editor across Kibana! @@ -136,6 +144,10 @@ for use in their own application. in Kibana, e.g. visualizations. It has the form of a flyout panel. +|{kib-repo}blob/{branch}/src/plugins/interactive_setup/README.md[interactiveSetup] +|The plugin provides UI and APIs for the interactive setup mode. + + |{kib-repo}blob/{branch}/src/plugins/kibana_legacy/README.md[kibanaLegacy] |This plugin contains several helpers and services to integrate pieces of the legacy Kibana app with the new Kibana platform. @@ -276,10 +288,6 @@ In general this plugin provides: |The Usage Collection Service defines a set of APIs for other plugins to report the usage of their features. At the same time, it provides necessary the APIs for other services (i.e.: telemetry, monitoring, ...) to consume that usage data. -|{kib-repo}blob/{branch}/src/plugins/user_setup/README.md[userSetup] -|The plugin provides UI and APIs for the interactive setup mode. - - |{kib-repo}blob/{branch}/src/plugins/vis_default_editor/README.md[visDefaultEditor] |The default editor is used in most primary visualizations, e.x. Area, Data table, Pie, etc. It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in public/components/sidebar/data_tab.tsx. diff --git a/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.hideclosebutton.md b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.hideclosebutton.md new file mode 100644 index 0000000000000..149a53f35d34d --- /dev/null +++ b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.hideclosebutton.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [OverlayFlyoutOpenOptions](./kibana-plugin-core-public.overlayflyoutopenoptions.md) > [hideCloseButton](./kibana-plugin-core-public.overlayflyoutopenoptions.hideclosebutton.md) + +## OverlayFlyoutOpenOptions.hideCloseButton property + +Signature: + +```typescript +hideCloseButton?: boolean; +``` 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 6665ebde295bc..fc4959b87a987 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.md @@ -18,6 +18,7 @@ export interface OverlayFlyoutOpenOptions | ["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 | | | [maxWidth](./kibana-plugin-core-public.overlayflyoutopenoptions.maxwidth.md) | boolean | number | string | | | [ownFocus](./kibana-plugin-core-public.overlayflyoutopenoptions.ownfocus.md) | boolean | | | [size](./kibana-plugin-core-public.overlayflyoutopenoptions.size.md) | EuiFlyoutSize | | 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 new file mode 100644 index 0000000000000..c6a429d345ed1 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsUtils](./kibana-plugin-core-server.savedobjectsutils.md) > [getConvertedObjectId](./kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md) + +## SavedObjectsUtils.getConvertedObjectId() method + +Uses a single-namespace object's "legacy ID" to determine what its new ID will be after it is converted to a multi-namespace type. + +Signature: + +```typescript +static getConvertedObjectId(namespace: string | undefined, type: string, id: string): string; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| namespace | string | undefined | | +| type | string | | +| id | string | | + +Returns: + +`string` + +{string} The ID of the saved object after it is converted. + 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 0148621e757b7..ab6382aca6a52 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md @@ -24,5 +24,6 @@ export declare class SavedObjectsUtils | Method | Modifiers | Description | | --- | --- | --- | | [generateId()](./kibana-plugin-core-server.savedobjectsutils.generateid.md) | static | Generates a random ID for a saved objects. | +| [getConvertedObjectId(namespace, type, id)](./kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md) | static | Uses a single-namespace object's "legacy ID" to determine what its new ID will be after it is converted to a multi-namespace type. | | [isRandomId(id)](./kibana-plugin-core-server.savedobjectsutils.israndomid.md) | static | Validates that a saved object ID has been randomly generated. | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfig.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfig.tojson.md index 6e9f12d98d149..2c93ae6143b44 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfig.tojson.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggconfig.tojson.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Use serialize() instead. 8.0 +> Use serialize() instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggregationrestrictions.md similarity index 69% rename from docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md rename to docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggregationrestrictions.md index 324bd1e410c6c..b3d04027980ca 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggregationrestrictions.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [AggregationRestrictions](./kibana-plugin-plugins-data-public.aggregationrestrictions.md) -## IndexPatternAggRestrictions type +## AggregationRestrictions type Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md deleted file mode 100644 index 1aa9f460c4fac..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) - -## baseFormattersPublic variable - -Signature: - -```typescript -baseFormattersPublic: (import("../../common").FieldFormatInstanceType | typeof DateFormat | typeof DateNanosFormat)[] -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md index c6135d9313b23..90aa0b0a8a313 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/field-types" package directly instead. 8.0 +> Import from the "@kbn/field-types" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md index 3d08df8544d6c..6addd931ce22d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.md index 4b2cad7b42882..b970a408e5130 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.md @@ -20,7 +20,7 @@ export declare class DataPublicPlugin implements PluginSignature: ```typescript -setup(core: CoreSetup, { bfetch, expressions, uiActions, usageCollection, inspector }: DataSetupDependencies): DataPublicPluginSetup; +setup(core: CoreSetup, { bfetch, expressions, uiActions, usageCollection, inspector, fieldFormats, }: DataSetupDependencies): DataPublicPluginSetup; ``` ## Parameters @@ -15,7 +15,7 @@ setup(core: CoreSetup, { bfetch, e | Parameter | Type | Description | | --- | --- | --- | | core | CoreSetup<DataStartDependencies, DataPublicPluginStart> | | -| { bfetch, expressions, uiActions, usageCollection, inspector } | DataSetupDependencies | | +| { bfetch, expressions, uiActions, usageCollection, inspector, fieldFormats, } | DataSetupDependencies | | Returns: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.start.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.start.md index 4ea7ec8cd4f65..c7611ac761bb9 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.start.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.dataplugin.start.md @@ -7,7 +7,7 @@ Signature: ```typescript -start(core: CoreStart, { uiActions }: DataStartDependencies): DataPublicPluginStart; +start(core: CoreStart, { uiActions, fieldFormats }: DataStartDependencies): DataPublicPluginStart; ``` ## Parameters @@ -15,7 +15,7 @@ start(core: CoreStart, { uiActions }: DataStartDependencies): DataPublicPluginSt | Parameter | Type | Description | | --- | --- | --- | | core | CoreStart | | -| { uiActions } | DataStartDependencies | | +| { uiActions, fieldFormats } | DataStartDependencies | | Returns: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md index 993634023c20c..54e64c309351e 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md @@ -4,6 +4,11 @@ ## DataPublicPluginSetup.fieldFormats property +> Warning: This API is now obsolete. +> +> Use fieldFormats plugin instead +> + Signature: ```typescript diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md index 344044b38f7de..a60e631835ea4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md @@ -4,7 +4,10 @@ ## DataPublicPluginStart.fieldFormats property -field formats service [FieldFormatsStart](./kibana-plugin-plugins-data-public.fieldformatsstart.md) +> Warning: This API is now obsolete. +> +> Use fieldFormats plugin instead +> Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md index c7810b18c55a9..341ec0d7e514c 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md @@ -18,7 +18,7 @@ export interface DataPublicPluginStart | --- | --- | --- | | [actions](./kibana-plugin-plugins-data-public.datapublicpluginstart.actions.md) | DataPublicPluginStartActions | filter creation utilities [DataPublicPluginStartActions](./kibana-plugin-plugins-data-public.datapublicpluginstartactions.md) | | [autocomplete](./kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md) | AutocompleteStart | autocomplete service [AutocompleteStart](./kibana-plugin-plugins-data-public.autocompletestart.md) | -| [fieldFormats](./kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md) | FieldFormatsStart | field formats service [FieldFormatsStart](./kibana-plugin-plugins-data-public.fieldformatsstart.md) | +| [fieldFormats](./kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md) | FieldFormatsStart | | | [indexPatterns](./kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md) | IndexPatternsContract | index patterns service [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.md) | | [nowProvider](./kibana-plugin-plugins-data-public.datapublicpluginstart.nowprovider.md) | NowProviderPublicContract | | | [query](./kibana-plugin-plugins-data-public.datapublicpluginstart.query.md) | QueryStart | query service [QueryStart](./kibana-plugin-plugins-data-public.querystart.md) | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index 24d60613d913a..b5d5c5cfee5ad 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import helpers from the "@kbn/es-query" package directly instead. 8.0 +> Import helpers from the "@kbn/es-query" package directly instead. 8.1 > Filter helpers namespace: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md index e569733f15e7f..3b768404aab95 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import helpers from the "@kbn/es-query" package directly instead. 8.0 +> Import helpers from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md index 447e387f90eb5..2a26b009d7447 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import helpers from the "@kbn/es-query" package directly instead. 8.0 +> Import helpers from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md index f877fa26b1b25..48a32cd9abe61 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md index 5c98ba4131ac3..79c92cfe52dd7 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat._constructor_.md deleted file mode 100644 index e38da6600696c..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat._constructor_.md +++ /dev/null @@ -1,21 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [(constructor)](./kibana-plugin-plugins-data-public.fieldformat._constructor_.md) - -## FieldFormat.(constructor) - -Constructs a new instance of the `FieldFormat` class - -Signature: - -```typescript -constructor(_params?: IFieldFormatMetaParams, getConfig?: FieldFormatsGetConfigFn); -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| \_params | IFieldFormatMetaParams | | -| getConfig | FieldFormatsGetConfigFn | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat._params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat._params.md deleted file mode 100644 index ac3f256a9afc3..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat._params.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [\_params](./kibana-plugin-plugins-data-public.fieldformat._params.md) - -## FieldFormat.\_params property - -Signature: - -```typescript -protected readonly _params: any; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.allowsnumericalaggregations.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.allowsnumericalaggregations.md deleted file mode 100644 index 454a816a60171..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.allowsnumericalaggregations.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [allowsNumericalAggregations](./kibana-plugin-plugins-data-public.fieldformat.allowsnumericalaggregations.md) - -## FieldFormat.allowsNumericalAggregations property - -Signature: - -```typescript -allowsNumericalAggregations?: boolean; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.convert.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.convert.md deleted file mode 100644 index 0535585cb4718..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.convert.md +++ /dev/null @@ -1,26 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [convert](./kibana-plugin-plugins-data-public.fieldformat.convert.md) - -## FieldFormat.convert() method - -Convert a raw value to a formatted string - -Signature: - -```typescript -convert(value: any, contentType?: FieldFormatsContentType, options?: HtmlContextTypeOptions | TextContextTypeOptions): string; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| value | any | | -| contentType | FieldFormatsContentType | | -| options | HtmlContextTypeOptions | TextContextTypeOptions | | - -Returns: - -`string` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.convertobject.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.convertobject.md deleted file mode 100644 index 436124ac08387..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.convertobject.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [convertObject](./kibana-plugin-plugins-data-public.fieldformat.convertobject.md) - -## FieldFormat.convertObject property - - {FieldFormatConvert} have to remove the private because of https://github.com/Microsoft/TypeScript/issues/17293 - -Signature: - -```typescript -convertObject: FieldFormatConvert | undefined; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.fieldtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.fieldtype.md deleted file mode 100644 index 1d109a599d2d9..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.fieldtype.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [fieldType](./kibana-plugin-plugins-data-public.fieldformat.fieldtype.md) - -## FieldFormat.fieldType property - - {string} - Field Format Type - -Signature: - -```typescript -static fieldType: string | string[]; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.from.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.from.md deleted file mode 100644 index ec497de59d236..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.from.md +++ /dev/null @@ -1,22 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [from](./kibana-plugin-plugins-data-public.fieldformat.from.md) - -## FieldFormat.from() method - -Signature: - -```typescript -static from(convertFn: FieldFormatConvertFunction): FieldFormatInstanceType; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| convertFn | FieldFormatConvertFunction | | - -Returns: - -`FieldFormatInstanceType` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getconfig.md deleted file mode 100644 index 446e0c237ce13..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getconfig.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [getConfig](./kibana-plugin-plugins-data-public.fieldformat.getconfig.md) - -## FieldFormat.getConfig property - -Signature: - -```typescript -protected getConfig: FieldFormatsGetConfigFn | undefined; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md deleted file mode 100644 index f4eeb5eed06a0..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md +++ /dev/null @@ -1,24 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [getConverterFor](./kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md) - -## FieldFormat.getConverterFor() method - -Get a convert function that is bound to a specific contentType - -Signature: - -```typescript -getConverterFor(contentType?: FieldFormatsContentType): FieldFormatConvertFunction; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| contentType | FieldFormatsContentType | | - -Returns: - -`FieldFormatConvertFunction` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md deleted file mode 100644 index 59afdc25df350..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md +++ /dev/null @@ -1,17 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [getParamDefaults](./kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md) - -## FieldFormat.getParamDefaults() method - -Get parameter defaults {object} - parameter defaults - -Signature: - -```typescript -getParamDefaults(): Record; -``` -Returns: - -`Record` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.hidden.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.hidden.md deleted file mode 100644 index 2032f0fc01112..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.hidden.md +++ /dev/null @@ -1,15 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [hidden](./kibana-plugin-plugins-data-public.fieldformat.hidden.md) - -## FieldFormat.hidden property - -Hidden field formats can only be accessed directly by id, They won't appear in field format editor UI, But they can be accessed and used from code internally. - - {boolean} - Is this a hidden field format - -Signature: - -```typescript -static hidden: boolean; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md deleted file mode 100644 index 945ac7ededff6..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [htmlConvert](./kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md) - -## FieldFormat.htmlConvert property - - {htmlConvert} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293 - -Signature: - -```typescript -htmlConvert: HtmlContextTypeConvert | undefined; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.id.md deleted file mode 100644 index 91c3ff4f2d9a3..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.id.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [id](./kibana-plugin-plugins-data-public.fieldformat.id.md) - -## FieldFormat.id property - - {string} - Field Format Id - -Signature: - -```typescript -static id: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md deleted file mode 100644 index c6afa27fe5952..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md +++ /dev/null @@ -1,22 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [isInstanceOfFieldFormat](./kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md) - -## FieldFormat.isInstanceOfFieldFormat() method - -Signature: - -```typescript -static isInstanceOfFieldFormat(fieldFormat: any): fieldFormat is FieldFormat; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| fieldFormat | any | | - -Returns: - -`fieldFormat is FieldFormat` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.md deleted file mode 100644 index 640064af4be12..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.md +++ /dev/null @@ -1,48 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) - -## FieldFormat class - -Signature: - -```typescript -export declare abstract class FieldFormat -``` - -## Constructors - -| Constructor | Modifiers | Description | -| --- | --- | --- | -| [(constructor)(\_params, getConfig)](./kibana-plugin-plugins-data-public.fieldformat._constructor_.md) | | Constructs a new instance of the FieldFormat class | - -## Properties - -| Property | Modifiers | Type | Description | -| --- | --- | --- | --- | -| [\_params](./kibana-plugin-plugins-data-public.fieldformat._params.md) | | any | | -| [allowsNumericalAggregations](./kibana-plugin-plugins-data-public.fieldformat.allowsnumericalaggregations.md) | | boolean | | -| [convertObject](./kibana-plugin-plugins-data-public.fieldformat.convertobject.md) | | FieldFormatConvert | undefined | {FieldFormatConvert} have to remove the private because of https://github.com/Microsoft/TypeScript/issues/17293 | -| [fieldType](./kibana-plugin-plugins-data-public.fieldformat.fieldtype.md) | static | string | string[] | {string} - Field Format Type | -| [getConfig](./kibana-plugin-plugins-data-public.fieldformat.getconfig.md) | | FieldFormatsGetConfigFn | undefined | | -| [hidden](./kibana-plugin-plugins-data-public.fieldformat.hidden.md) | static | boolean | Hidden field formats can only be accessed directly by id, They won't appear in field format editor UI, But they can be accessed and used from code internally. {boolean} - Is this a hidden field format | -| [htmlConvert](./kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md) | | HtmlContextTypeConvert | undefined | {htmlConvert} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293 | -| [id](./kibana-plugin-plugins-data-public.fieldformat.id.md) | static | string | {string} - Field Format Id | -| [textConvert](./kibana-plugin-plugins-data-public.fieldformat.textconvert.md) | | TextContextTypeConvert | undefined | {textConvert} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293 | -| [title](./kibana-plugin-plugins-data-public.fieldformat.title.md) | static | string | {string} - Field Format Title | -| [type](./kibana-plugin-plugins-data-public.fieldformat.type.md) | | any | {Function} - ref to child class | - -## Methods - -| Method | Modifiers | Description | -| --- | --- | --- | -| [convert(value, contentType, options)](./kibana-plugin-plugins-data-public.fieldformat.convert.md) | | Convert a raw value to a formatted string | -| [from(convertFn)](./kibana-plugin-plugins-data-public.fieldformat.from.md) | static | | -| [getConverterFor(contentType)](./kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md) | | Get a convert function that is bound to a specific contentType | -| [getParamDefaults()](./kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md) | | Get parameter defaults {object} - parameter defaults | -| [isInstanceOfFieldFormat(fieldFormat)](./kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md) | static | | -| [param(name)](./kibana-plugin-plugins-data-public.fieldformat.param.md) | | Get the value of a param. This value may be a default value. | -| [params()](./kibana-plugin-plugins-data-public.fieldformat.params.md) | | Get all of the params in a single object {object} | -| [setupContentType()](./kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md) | | | -| [toJSON()](./kibana-plugin-plugins-data-public.fieldformat.tojson.md) | | Serialize this format to a simple POJO, with only the params that are not default {object} | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.param.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.param.md deleted file mode 100644 index 1e7fd9d161429..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.param.md +++ /dev/null @@ -1,24 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [param](./kibana-plugin-plugins-data-public.fieldformat.param.md) - -## FieldFormat.param() method - -Get the value of a param. This value may be a default value. - -Signature: - -```typescript -param(name: string): any; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| name | string | | - -Returns: - -`any` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.params.md deleted file mode 100644 index 5825af4925d06..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.params.md +++ /dev/null @@ -1,17 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [params](./kibana-plugin-plugins-data-public.fieldformat.params.md) - -## FieldFormat.params() method - -Get all of the params in a single object {object} - -Signature: - -```typescript -params(): Record; -``` -Returns: - -`Record` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md deleted file mode 100644 index 41f5f2446f22a..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md +++ /dev/null @@ -1,15 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [setupContentType](./kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md) - -## FieldFormat.setupContentType() method - -Signature: - -```typescript -setupContentType(): FieldFormatConvert; -``` -Returns: - -`FieldFormatConvert` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.textconvert.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.textconvert.md deleted file mode 100644 index 57ccca9136081..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.textconvert.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [textConvert](./kibana-plugin-plugins-data-public.fieldformat.textconvert.md) - -## FieldFormat.textConvert property - - {textConvert} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293 - -Signature: - -```typescript -textConvert: TextContextTypeConvert | undefined; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.title.md deleted file mode 100644 index b19246758f080..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.title.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [title](./kibana-plugin-plugins-data-public.fieldformat.title.md) - -## FieldFormat.title property - - {string} - Field Format Title - -Signature: - -```typescript -static title: string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.tojson.md deleted file mode 100644 index 48ec9456c56dd..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.tojson.md +++ /dev/null @@ -1,25 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [toJSON](./kibana-plugin-plugins-data-public.fieldformat.tojson.md) - -## FieldFormat.toJSON() method - -Serialize this format to a simple POJO, with only the params that are not default - - {object} - -Signature: - -```typescript -toJSON(): { - id: any; - params: any; - }; -``` -Returns: - -`{ - id: any; - params: any; - }` - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.type.md deleted file mode 100644 index 394a2e3cc9afb..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformat.type.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [type](./kibana-plugin-plugins-data-public.fieldformat.type.md) - -## FieldFormat.type property - - {Function} - ref to child class - -Signature: - -```typescript -type: any; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md deleted file mode 100644 index 82441ee41d80d..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) > [es](./kibana-plugin-plugins-data-public.fieldformatconfig.es.md) - -## FieldFormatConfig.es property - -Signature: - -```typescript -es?: boolean; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md deleted file mode 100644 index b179c314a56d3..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) > [id](./kibana-plugin-plugins-data-public.fieldformatconfig.id.md) - -## FieldFormatConfig.id property - -Signature: - -```typescript -id: FieldFormatId; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md deleted file mode 100644 index f856a3132eccb..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md +++ /dev/null @@ -1,20 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) - -## FieldFormatConfig interface - -Signature: - -```typescript -export interface FieldFormatConfig -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [es](./kibana-plugin-plugins-data-public.fieldformatconfig.es.md) | boolean | | -| [id](./kibana-plugin-plugins-data-public.fieldformatconfig.id.md) | FieldFormatId | | -| [params](./kibana-plugin-plugins-data-public.fieldformatconfig.params.md) | Record<string, any> | | - diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md deleted file mode 100644 index aad977643ad2f..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) > [params](./kibana-plugin-plugins-data-public.fieldformatconfig.params.md) - -## FieldFormatConfig.params property - -Signature: - -```typescript -params: Record; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md deleted file mode 100644 index 9f94d50a2001f..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatId](./kibana-plugin-plugins-data-public.fieldformatid.md) - -## FieldFormatId type - - id type is needed for creating custom converters. - -Signature: - -```typescript -export declare type FieldFormatId = FIELD_FORMAT_IDS | string; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md deleted file mode 100644 index 838ea2b5d9f3a..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md +++ /dev/null @@ -1,39 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) - -## fieldFormats variable - -Signature: - -```typescript -fieldFormats: { - FieldFormat: typeof FieldFormat; - FieldFormatsRegistry: typeof FieldFormatsRegistry; - DEFAULT_CONVERTER_COLOR: { - range: string; - regex: string; - text: string; - background: string; - }; - HTML_CONTEXT_TYPE: import("../common").FieldFormatsContentType; - TEXT_CONTEXT_TYPE: import("../common").FieldFormatsContentType; - FIELD_FORMAT_IDS: typeof FIELD_FORMAT_IDS; - BoolFormat: typeof BoolFormat; - BytesFormat: typeof BytesFormat; - ColorFormat: typeof ColorFormat; - DateFormat: typeof DateFormat; - DateNanosFormat: typeof DateNanosFormat; - DurationFormat: typeof DurationFormat; - IpFormat: typeof IpFormat; - NumberFormat: typeof NumberFormat; - PercentFormat: typeof PercentFormat; - RelativeDateFormat: typeof RelativeDateFormat; - SourceFormat: typeof SourceFormat; - StaticLookupFormat: typeof StaticLookupFormat; - UrlFormat: typeof UrlFormat; - StringFormat: typeof StringFormat; - TruncateFormat: typeof TruncateFormat; - HistogramFormat: typeof HistogramFormat; -} -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md deleted file mode 100644 index 8e89a0262b438..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) - -## FieldFormatsContentType type - -\* - -Signature: - -```typescript -export declare type FieldFormatsContentType = 'html' | 'text'; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md deleted file mode 100644 index c54e549c42a44..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) - -## FieldFormatsGetConfigFn type - -Signature: - -```typescript -export declare type FieldFormatsGetConfigFn = GetConfigFn; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsstart.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsstart.md deleted file mode 100644 index ac8ddce6e7016..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsstart.md +++ /dev/null @@ -1,14 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatsStart](./kibana-plugin-plugins-data-public.fieldformatsstart.md) - -## FieldFormatsStart type - - -Signature: - -```typescript -export declare type FieldFormatsStart = Omit & { - deserialize: FormatFactory; -}; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md index b25d313129634..247760305db9c 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.allownoindex.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.allownoindex.md new file mode 100644 index 0000000000000..091fb4d8aaa44 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.allownoindex.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) > [allowNoIndex](./kibana-plugin-plugins-data-public.getfieldsoptions.allownoindex.md) + +## GetFieldsOptions.allowNoIndex property + +Signature: + +```typescript +allowNoIndex?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.lookback.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.lookback.md new file mode 100644 index 0000000000000..0e8c7e34b1fe8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.lookback.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) > [lookBack](./kibana-plugin-plugins-data-public.getfieldsoptions.lookback.md) + +## GetFieldsOptions.lookBack property + +Signature: + +```typescript +lookBack?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.md new file mode 100644 index 0000000000000..056018174baf6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) + +## GetFieldsOptions interface + +Signature: + +```typescript +export interface GetFieldsOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [allowNoIndex](./kibana-plugin-plugins-data-public.getfieldsoptions.allownoindex.md) | boolean | | +| [lookBack](./kibana-plugin-plugins-data-public.getfieldsoptions.lookback.md) | boolean | | +| [metaFields](./kibana-plugin-plugins-data-public.getfieldsoptions.metafields.md) | string[] | | +| [pattern](./kibana-plugin-plugins-data-public.getfieldsoptions.pattern.md) | string | | +| [rollupIndex](./kibana-plugin-plugins-data-public.getfieldsoptions.rollupindex.md) | string | | +| [type](./kibana-plugin-plugins-data-public.getfieldsoptions.type.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.metafields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.metafields.md new file mode 100644 index 0000000000000..87c0f9d9bfe5b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.metafields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) > [metaFields](./kibana-plugin-plugins-data-public.getfieldsoptions.metafields.md) + +## GetFieldsOptions.metaFields property + +Signature: + +```typescript +metaFields?: string[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.pattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.pattern.md new file mode 100644 index 0000000000000..c6c53b2cf7bc8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.pattern.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) > [pattern](./kibana-plugin-plugins-data-public.getfieldsoptions.pattern.md) + +## GetFieldsOptions.pattern property + +Signature: + +```typescript +pattern: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.rollupindex.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.rollupindex.md new file mode 100644 index 0000000000000..4711e3bdfce92 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.rollupindex.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) > [rollupIndex](./kibana-plugin-plugins-data-public.getfieldsoptions.rollupindex.md) + +## GetFieldsOptions.rollupIndex property + +Signature: + +```typescript +rollupIndex?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.type.md new file mode 100644 index 0000000000000..cdc4c562b5611 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getfieldsoptions.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) > [type](./kibana-plugin-plugins-data-public.getfieldsoptions.type.md) + +## GetFieldsOptions.type property + +Signature: + +```typescript +type?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md index 66effff722f3b..db741f74f538d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/field-types" package directly instead. 8.0 +> Import from the "@kbn/field-types" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md deleted file mode 100644 index 4fe738ddef5dc..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) - -## IFieldFormat type - -Signature: - -```typescript -export declare type IFieldFormat = FieldFormat; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md deleted file mode 100644 index 0f83e2bb2d423..0000000000000 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) - -## IFieldFormatsRegistry type - -Signature: - -```typescript -declare type IFieldFormatsRegistry = PublicMethodsOf; -``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md index ec723ddc00e72..8fe65d5a86de1 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md index b4b3198092604..6a798c3a4add1 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Use [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) 8.0 +> Use [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md index 3f8048d2913fb..99caa646c17b0 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Add scripted field to field list diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md index 70a9b624099cb..7a704b917daaf 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md index 517dec992c090..cd91bdcebce60 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.intervalname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.intervalname.md index 9d26cf9730f46..774601daf4a87 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.intervalname.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.intervalname.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Used by time range index patterns 8.0 +> Used by time range index patterns 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md index fbd85a7d73230..052ccc2ae97b4 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Remove scripted field from field list diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md index 8891620ad01ef..39da5c0548da0 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md index 522a1c66bb80e..047a9861002b5 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md index 6c6904d6625c6..73d82c25228bb 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md index 35ebdb1473c4e..51d0f8a139da5 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md index 49c9d1d143e6b..3716f5cb4febf 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -13,7 +13,6 @@ | [AggParamType](./kibana-plugin-plugins-data-public.aggparamtype.md) | | | [DataPlugin](./kibana-plugin-plugins-data-public.dataplugin.md) | | | [DuplicateIndexPatternError](./kibana-plugin-plugins-data-public.duplicateindexpatternerror.md) | | -| [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) | | | [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) | | | [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) | | | [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) | | @@ -64,7 +63,7 @@ | [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) | Data plugin public Start contract | | [DataPublicPluginStartActions](./kibana-plugin-plugins-data-public.datapublicpluginstartactions.md) | utilities to generate filters from action context | | [DataPublicPluginStartUi](./kibana-plugin-plugins-data-public.datapublicpluginstartui.md) | Data plugin prewired UI components | -| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | | +| [GetFieldsOptions](./kibana-plugin-plugins-data-public.getfieldsoptions.md) | | | [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) | | | [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | | | [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) | | @@ -104,7 +103,6 @@ | [AggGroupLabels](./kibana-plugin-plugins-data-public.agggrouplabels.md) | | | [AggGroupNames](./kibana-plugin-plugins-data-public.agggroupnames.md) | | | [APPLY\_FILTER\_TRIGGER](./kibana-plugin-plugins-data-public.apply_filter_trigger.md) | | -| [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) | | | [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-public.castestokbnfieldtypename.md) | | | [connectToQueryState](./kibana-plugin-plugins-data-public.connecttoquerystate.md) | Helper to setup two-way syncing of global data and a state container | | [createSavedQueryService](./kibana-plugin-plugins-data-public.createsavedqueryservice.md) | | @@ -114,7 +112,6 @@ | [esQuery](./kibana-plugin-plugins-data-public.esquery.md) | | | [exporters](./kibana-plugin-plugins-data-public.exporters.md) | | | [extractSearchSourceReferences](./kibana-plugin-plugins-data-public.extractsearchsourcereferences.md) | | -| [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) | | | [fieldList](./kibana-plugin-plugins-data-public.fieldlist.md) | | | [FilterItem](./kibana-plugin-plugins-data-public.filteritem.md) | | | [FilterLabel](./kibana-plugin-plugins-data-public.filterlabel.md) | | @@ -145,6 +142,7 @@ | [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) | | | [AggGroupName](./kibana-plugin-plugins-data-public.agggroupname.md) | | | [AggParam](./kibana-plugin-plugins-data-public.aggparam.md) | | +| [AggregationRestrictions](./kibana-plugin-plugins-data-public.aggregationrestrictions.md) | | | [AggsStart](./kibana-plugin-plugins-data-public.aggsstart.md) | AggsStart represents the actual external contract as AggsCommonStart is only used internally. The difference is that AggsStart includes the typings for the registry with initialized agg types. | | [AutocompleteStart](./kibana-plugin-plugins-data-public.autocompletestart.md) | \* | | [AutoRefreshDoneFn](./kibana-plugin-plugins-data-public.autorefreshdonefn.md) | | @@ -159,21 +157,14 @@ | [ExpressionFunctionKibana](./kibana-plugin-plugins-data-public.expressionfunctionkibana.md) | | | [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-public.expressionfunctionkibanacontext.md) | | | [ExpressionValueSearchContext](./kibana-plugin-plugins-data-public.expressionvaluesearchcontext.md) | | -| [FieldFormatId](./kibana-plugin-plugins-data-public.fieldformatid.md) | id type is needed for creating custom converters. | -| [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* | -| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | | -| [FieldFormatsStart](./kibana-plugin-plugins-data-public.fieldformatsstart.md) | | | [Filter](./kibana-plugin-plugins-data-public.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | | | [IEsError](./kibana-plugin-plugins-data-public.ieserror.md) | | | [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) | | -| [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | | -| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | | | [IFieldParamType](./kibana-plugin-plugins-data-public.ifieldparamtype.md) | | | [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) | | | [IMetricAggType](./kibana-plugin-plugins-data-public.imetricaggtype.md) | | -| [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) | | | [IndexPatternLoadExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.indexpatternloadexpressionfunctiondefinition.md) | | | [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.md) | | | [IndexPatternSelectProps](./kibana-plugin-plugins-data-public.indexpatternselectprops.md) | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md index 850aff0f6cd85..cc1007655ecf3 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md index a28dba5b1cd3f..48a41dc34497f 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md index 91dd7c13c472e..5d452d759c934 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md index 291dc90c3971d..eefb773f5727f 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md index 42db2d353befa..df78be16e6d01 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md index 977f875b214e5..b00a7f31318eb 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Use the `fetch$` method instead 8.0 +> Use the `fetch$` method instead 8.1 > Fetch this source and reject the returned Promise on error diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md index bdfc881878efd..fba9afd6f6648 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ui_settings.md @@ -24,13 +24,6 @@ UI_SETTINGS: { readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget"; readonly HISTOGRAM_MAX_BARS: "histogram:maxBars"; readonly HISTORY_LIMIT: "history:limit"; - readonly SHORT_DOTS_ENABLE: "shortDots:enable"; - readonly FORMAT_DEFAULT_TYPE_MAP: "format:defaultTypeMap"; - readonly FORMAT_NUMBER_DEFAULT_PATTERN: "format:number:defaultPattern"; - readonly FORMAT_PERCENT_DEFAULT_PATTERN: "format:percent:defaultPattern"; - readonly FORMAT_BYTES_DEFAULT_PATTERN: "format:bytes:defaultPattern"; - readonly FORMAT_CURRENCY_DEFAULT_PATTERN: "format:currency:defaultPattern"; - readonly FORMAT_NUMBER_DEFAULT_LOCALE: "format:number:defaultLocale"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: "timepicker:refreshIntervalDefaults"; readonly TIMEPICKER_QUICK_RANGES: "timepicker:quickRanges"; readonly TIMEPICKER_TIME_DEFAULTS: "timepicker:timeDefaults"; diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md index 834fe302ad9f8..a3f92491e8983 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/field-types" package directly instead. 8.0 +> Import from the "@kbn/field-types" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md deleted file mode 100644 index a3c3ddc4e1649..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) > [es](./kibana-plugin-plugins-data-server.fieldformatconfig.es.md) - -## FieldFormatConfig.es property - -Signature: - -```typescript -es?: boolean; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md deleted file mode 100644 index c5173fba22533..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) > [id](./kibana-plugin-plugins-data-server.fieldformatconfig.id.md) - -## FieldFormatConfig.id property - -Signature: - -```typescript -id: FieldFormatId; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md deleted file mode 100644 index 5d5c13784bc57..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md +++ /dev/null @@ -1,20 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) - -## FieldFormatConfig interface - -Signature: - -```typescript -export interface FieldFormatConfig -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [es](./kibana-plugin-plugins-data-server.fieldformatconfig.es.md) | boolean | | -| [id](./kibana-plugin-plugins-data-server.fieldformatconfig.id.md) | FieldFormatId | | -| [params](./kibana-plugin-plugins-data-server.fieldformatconfig.params.md) | Record<string, any> | | - diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md deleted file mode 100644 index c5e5faef30860..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) > [params](./kibana-plugin-plugins-data-server.fieldformatconfig.params.md) - -## FieldFormatConfig.params property - -Signature: - -```typescript -params: Record; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md deleted file mode 100644 index 42563051bcdc4..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md +++ /dev/null @@ -1,28 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) - -## fieldFormats variable - -Signature: - -```typescript -fieldFormats: { - FieldFormatsRegistry: typeof FieldFormatsRegistry; - FieldFormat: typeof FieldFormat; - BoolFormat: typeof BoolFormat; - BytesFormat: typeof BytesFormat; - ColorFormat: typeof ColorFormat; - DurationFormat: typeof DurationFormat; - IpFormat: typeof IpFormat; - NumberFormat: typeof NumberFormat; - PercentFormat: typeof PercentFormat; - RelativeDateFormat: typeof RelativeDateFormat; - SourceFormat: typeof SourceFormat; - StaticLookupFormat: typeof StaticLookupFormat; - UrlFormat: typeof UrlFormat; - StringFormat: typeof StringFormat; - TruncateFormat: typeof TruncateFormat; - HistogramFormat: typeof HistogramFormat; -} -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md deleted file mode 100644 index a3f6c709246ea..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) - -## FieldFormatsGetConfigFn type - -Signature: - -```typescript -export declare type FieldFormatsGetConfigFn = GetConfigFn; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md deleted file mode 100644 index c284d2c87fcaa..0000000000000 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) - -## IFieldFormatsRegistry type - -Signature: - -```typescript -declare type IFieldFormatsRegistry = PublicMethodsOf; -``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md index 9ac9ba1abc637..7f812fb08fd51 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md index 932afceb5d22b..93f91f6264dbc 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Use [IndexPatternField](./kibana-plugin-plugins-data-server.indexpatternfield.md) 8.0 +> Use [IndexPatternField](./kibana-plugin-plugins-data-server.indexpatternfield.md) 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.addscriptedfield.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.addscriptedfield.md index 9fe169233af13..829cc9c0752a0 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.addscriptedfield.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.addscriptedfield.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Add scripted field to field list diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getnonscriptedfields.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getnonscriptedfields.md index 8a06b394ae554..deb71a9df8cc5 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getnonscriptedfields.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getnonscriptedfields.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getscriptedfields.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getscriptedfields.md index 15978b6414947..3beef6e08ed3f 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getscriptedfields.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.getscriptedfields.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.intervalname.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.intervalname.md index e2810cc21a378..01367d931a841 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.intervalname.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.intervalname.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Used by time range index patterns 8.0 +> Used by time range index patterns 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.removescriptedfield.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.removescriptedfield.md index bc96d3596ed12..c72ad5163d4ec 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.removescriptedfield.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.removescriptedfield.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> use runtime field instead 8.0 +> use runtime field instead 8.1 > Remove scripted field from field list diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md index 0bdb5d6726fa8..f56300757736a 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Import from the "@kbn/es-query" package directly instead. 8.0 +> Import from the "@kbn/es-query" package directly instead. 8.1 > Signature: diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md index 2e76e3b0c6ad4..0363aa1ce6442 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -49,7 +49,6 @@ | [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) | | | [AsyncSearchStatusResponse](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md) | | | [FieldDescriptor](./kibana-plugin-plugins-data-server.fielddescriptor.md) | | -| [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) | | | [IEsSearchRequest](./kibana-plugin-plugins-data-server.iessearchrequest.md) | | | [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) | | | [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) | Interface for an index pattern saved object | @@ -80,7 +79,6 @@ | [esKuery](./kibana-plugin-plugins-data-server.eskuery.md) | | | [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | | | [exporters](./kibana-plugin-plugins-data-server.exporters.md) | | -| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | | | [INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE](./kibana-plugin-plugins-data-server.index_pattern_saved_object_type.md) | \* | | [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | | | [mergeCapabilitiesWithFields](./kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md) | | @@ -100,12 +98,10 @@ | [ExpressionFunctionKibana](./kibana-plugin-plugins-data-server.expressionfunctionkibana.md) | | | [ExpressionFunctionKibanaContext](./kibana-plugin-plugins-data-server.expressionfunctionkibanacontext.md) | | | [ExpressionValueSearchContext](./kibana-plugin-plugins-data-server.expressionvaluesearchcontext.md) | | -| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | | | [Filter](./kibana-plugin-plugins-data-server.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-server.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-server.iaggtype.md) | | | [IEsSearchResponse](./kibana-plugin-plugins-data-server.iessearchresponse.md) | | -| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | | | [IFieldParamType](./kibana-plugin-plugins-data-server.ifieldparamtype.md) | | | [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | | | [IMetricAggType](./kibana-plugin-plugins-data-server.imetricaggtype.md) | | diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md index bd90f23b4ab59..5763cb2dacb7a 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md @@ -7,12 +7,10 @@ Signature: ```typescript -setup(core: CoreSetup, { bfetch, expressions, usageCollection }: DataPluginSetupDependencies): { +setup(core: CoreSetup, { bfetch, expressions, usageCollection, fieldFormats }: DataPluginSetupDependencies): { __enhance: (enhancements: DataEnhancements) => void; search: ISearchSetup; - fieldFormats: { - register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number; - }; + fieldFormats: FieldFormatsSetup; }; ``` @@ -21,15 +19,13 @@ setup(core: CoreSetup, { bfetch, e | Parameter | Type | Description | | --- | --- | --- | | core | CoreSetup<DataPluginStartDependencies, DataPluginStart> | | -| { bfetch, expressions, usageCollection } | DataPluginSetupDependencies | | +| { bfetch, expressions, usageCollection, fieldFormats } | DataPluginSetupDependencies | | Returns: `{ __enhance: (enhancements: DataEnhancements) => void; search: ISearchSetup; - fieldFormats: { - register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number; - }; + fieldFormats: FieldFormatsSetup; }` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md index dd1f3806c1408..a31e4512cfcf1 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md @@ -7,10 +7,8 @@ Signature: ```typescript -start(core: CoreStart): { - fieldFormats: { - fieldFormatServiceFactory: (uiSettings: import("../../../core/server").IUiSettingsClient) => Promise; - }; +start(core: CoreStart, { fieldFormats }: DataPluginStartDependencies): { + fieldFormats: FieldFormatsStart; indexPatterns: { indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: import("../../../core/server").ElasticsearchClient) => Promise; }; @@ -23,13 +21,12 @@ start(core: CoreStart): { | Parameter | Type | Description | | --- | --- | --- | | core | CoreStart | | +| { fieldFormats } | DataPluginStartDependencies | | Returns: `{ - fieldFormats: { - fieldFormatServiceFactory: (uiSettings: import("../../../core/server").IUiSettingsClient) => Promise; - }; + fieldFormats: FieldFormatsStart; indexPatterns: { indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: import("../../../core/server").ElasticsearchClient) => Promise; }; diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md index 648e23e597f4d..55badaf2d07bc 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md @@ -4,6 +4,11 @@ ## PluginSetup.fieldFormats property +> Warning: This API is now obsolete. +> +> - use "fieldFormats" plugin directly instead +> + Signature: ```typescript diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md index 7a77c6c943cd7..26182e96a4a7e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md @@ -4,6 +4,11 @@ ## PluginStart.fieldFormats property +> Warning: This API is now obsolete. +> +> - use "fieldFormats" plugin directly instead +> + Signature: ```typescript diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md index 387dac22e1c83..e1f002674ef6d 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ui_settings.md @@ -24,13 +24,6 @@ UI_SETTINGS: { readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget"; readonly HISTOGRAM_MAX_BARS: "histogram:maxBars"; readonly HISTORY_LIMIT: "history:limit"; - readonly SHORT_DOTS_ENABLE: "shortDots:enable"; - readonly FORMAT_DEFAULT_TYPE_MAP: "format:defaultTypeMap"; - readonly FORMAT_NUMBER_DEFAULT_PATTERN: "format:number:defaultPattern"; - readonly FORMAT_PERCENT_DEFAULT_PATTERN: "format:percent:defaultPattern"; - readonly FORMAT_BYTES_DEFAULT_PATTERN: "format:bytes:defaultPattern"; - readonly FORMAT_CURRENCY_DEFAULT_PATTERN: "format:currency:defaultPattern"; - readonly FORMAT_NUMBER_DEFAULT_LOCALE: "format:number:defaultLocale"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: "timepicker:refreshIntervalDefaults"; readonly TIMEPICKER_QUICK_RANGES: "timepicker:quickRanges"; readonly TIMEPICKER_TIME_DEFAULTS: "timepicker:timeDefaults"; diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 70e40576fdd71..bd3e36620611d 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -4,8 +4,6 @@ :include-xpack: true :lang: en :kib-repo-dir: {kibana-root}/docs -:blog-ref: https://www.elastic.co/blog/ -:wikipedia: https://en.wikipedia.org/wiki include::{docs-root}/shared/versions/stack/{source_branch}.asciidoc[] diff --git a/docs/management/connectors/action-types/servicenow.asciidoc b/docs/management/connectors/action-types/servicenow.asciidoc index dfac22cb23c6c..8655b126ae5db 100644 --- a/docs/management/connectors/action-types/servicenow.asciidoc +++ b/docs/management/connectors/action-types/servicenow.asciidoc @@ -5,7 +5,7 @@ ServiceNow ++++ -The ServiceNow connector uses the https://developer.servicenow.com/app.do#!/rest_api_doc?v=orlando&id=c_TableAPI[V2 Table API] to create ServiceNow incidents. +The ServiceNow connector uses the https://docs.servicenow.com/bundle/orlando-application-development/page/integrate/inbound-rest/concept/c_TableAPI.html[V2 Table API] to create ServiceNow incidents. [float] [[servicenow-connector-configuration]] diff --git a/docs/maps/asset-tracking-tutorial.asciidoc b/docs/maps/asset-tracking-tutorial.asciidoc new file mode 100644 index 0000000000000..822510e882c12 --- /dev/null +++ b/docs/maps/asset-tracking-tutorial.asciidoc @@ -0,0 +1,340 @@ +[role="xpack"] +[[asset-tracking-tutorial]] +== Track, visualize, and alert on assets in real time + +Are you interested in asset tracking? Good news! Visualizing and analyzing data that moves is easy with *Maps*. You can track the location of an IoT device and monitor a package or vehicle in transit. + +In this tutorial, you’ll look at live urban transit data from the city of Portland, Oregon. You’ll watch the city buses, use the data to visualize congestion, and notify a dispatch team when a bus enters a construction zone. + +You’ll learn to: + +- Use Logstash to ingest the TriMet REST API into Elasticsearch. +- Create a map with layers that visualize asset tracks and last-known locations. +- Use symbols and colors to style data values and show which direction an asset is heading. +- Set up tracking containment alerts to monitor moving vehicles. + +When you complete this tutorial, you’ll have a map that looks like this: + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/construction_zones.png[] + +[float] +=== Prerequisites + +- If you don’t already have {kib}, set it up with https://www.elastic.co/cloud/elasticsearch-service/signup?baymax=docs-body&elektra=docs[our free trial]. Download the deployment credentials. +- Obtain an API key for https://developer.trimet.org/[TriMet web services] at https://developer.trimet.org/appid/registration/. +- https://www.elastic.co/guide/en/logstash/current/getting-started-with-logstash.html[Install Logstash]. + +[float] +=== Part 1: Ingest the Portland bus data +To get to the fun of visualizing and alerting on Portland buses, you must first create a Logstash pipeline to ingest the TriMet Portland bus data into {es}. + +[float] +==== Step 1: Set up an Elasticsearch index + +. In Kibana, open the main menu, then click *Dev Tools*. +. In *Console*, create the `tri_met_tracks` index: ++ +[source,js] +---------------------------------- +PUT tri_met_tracks +---------------------------------- + +. To configure the `tri_met_tracks` index mappings, run: ++ +[source,js] +---------------------------------- +PUT tri_met_tracks/_mapping +{ + "properties": { + "in_congestion": { + "type": "boolean" + }, + "location": { + "type": "geo_point" + }, + "route": { + "type": "keyword" + }, + "time": { + "type": "date", + "format": "epoch_millis" + }, + "type": { + "type": "keyword" + }, + "vehicle_id": { + "type": "keyword" + } + } +} +---------------------------------- + +[float] +==== Step 2: Start Logstash + +. In your `logstash/config` folder, create the file `trimet-pipeline.conf`. +. Copy the pipeline script into your `trimet-pipeline.conf` file. ++ +[source,yaml] +---------------------------------- +input { + http_poller { + urls => { + trimet => "https://developer.trimet.org/ws/v2/vehicles?appID=" + } + request_timeout => 60 + schedule => { cron => "* * * * * UTC"} + codec => "json" + } +} + +filter { + split { + field => "[resultSet][vehicle]" + } + + if ![resultSet][vehicle][inCongestion] { + mutate { + update => { + "[resultSet][vehicle][inCongestion]" => "false" + } + } + } + + mutate { + add_field => { + "bearing" => "%{[resultSet][vehicle][bearing]}" + "in_congestion" => "%{[resultSet][vehicle][inCongestion]}" + "location" => "%{[resultSet][vehicle][latitude]},%{[resultSet][vehicle][longitude]}" + "route" => "%{[resultSet][vehicle][routeNumber]}" + "time" => "%{[resultSet][vehicle][time]}" + "type" => "%{[resultSet][vehicle][type]}" + "vehicle_id" => "%{[resultSet][vehicle][vehicleID]}" + } + remove_field => [ "resultSet", "@version", "@timestamp" ] + } + + mutate { + convert => { + "bearing" => "float" + "in_congestion" => "boolean" + "time" => "integer" + } + } +} + +output { + stdout { + codec => rubydebug + } + + elasticsearch { + cloud_auth => "" + cloud_id => "" + index => "tri_met_tracks" + document_id => "%{[vehicle_id]}_%{[time]}" + } +} +---------------------------------- + +. Replace `` with your TriMet application id. +. Replace `` with your Elastic Cloud deployment credentials. +. Replace `` with your {ece}/ece-cloud-id.html[elastic cloud id]. +. Open a terminal window, and then navigate to the Logstash folder. +. In your `logstash` folder, run Logstash with the TriMet pipeline: ++ +[source,bash] +---------------------------------- +bin/logstash -f config/trimet-pipeline.conf +---------------------------------- + +. Wait for Logstash to initialize and confirm data is flowing. You should see messages similar to this: ++ +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/logstash_output.png[] +. Leave the terminal window open and Logstash running throughout this tutorial. + +[float] +==== Step 3: Create a {kib} index pattern for the tri_met_tracks {es} index + +. In Kibana, open the main menu, and click *Stack Management > Index Patterns*. +. Click *Create index pattern*. +. Give the index pattern a name: *tri_met_tracks**. +. Click *Next step*. +. Set the *Time field* to *time*. +. Click *Create index pattern*. + +{kib} shows the fields in your index pattern. + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/index_pattern.png[] + +[float] +==== Step 4: Explore the Portland bus data + +. Open the main menu, and click *Discover*. +. Set the index pattern to *tri_met_tracks**. +. Open the <>, and set the time range to the last 15 minutes. +. Expand a document and explore some of the fields that you will use later in this tutorial: `bearing`, `in_congestion`, `location`, and `vehicle_id`. + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/discover.png[] + +[float] +=== Part 2: Build an operational map +It's hard to get an overview of Portland buses by looking at individual events. Let's create a map to show the bus routes and current location for each bus, along with the direction the buses are headed. + +[float] +==== Step 1: Create your map +Create your map and set the theme for the default layer to dark mode. + +. Open the main menu, and click *Maps*. +. Click *Create map*. +. In the *Layers* list, click *Road map*, and then click *Edit layer settings*. +. Open the *Tile service* dropdown, and select *Road map - dark*. +. Click *Save & close*. + +[float] +==== Step 2. Add a tracks layer + +Add a layer to show the bus routes for the last 15 minutes. + +. Click *Add layer*. +. Click *Tracks*. +. Select the *tri_met_tracks** index pattern. +. Define the tracks: +.. Set *Entity* to *vehicle_id*. +.. Set *Sort* to *time*. +. Click *Add layer*. +. In Layer settings: +.. Set *Name* to *Buses*. +.. Set *Opacity* to 80%. +. Scroll to *Layer Style*, and set *Border color* to pink. +. Click *Save & close*. +. In the *Layers* list, click *Buses*, and then click *Fit to data*. + +At this point, you have a map with lines that represent the routes of the buses as they move around the city. + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/tracks_layer.png[] + +[float] +==== Step 3. Indicate the direction of the bus tracks + +Add a layer that uses attributes in the data to set the style and orientation of the buses. You’ll see the direction buses are headed and what traffic is like. + +. Click *Add layer*, and then select *Top Hits per entity*. +. Select the *tri_met_tracks** index pattern. +. To display the most recent location per bus: +.. Set *Entity* to *vehicle_id*. +.. Set *Documents per entity* to 1. +.. Set *Sort field* to *time*. +.. Set *Sort order* to *descending*. +. Click *Add layer*. +. Scroll to *Layer Style*. +.. Set *Symbol type* to *icon*. +.. Set *Icon* to *arrow-es*. +.. Set the *Fill color*: +... Select *By value* styling, and set the field to *in_congestion*. +... Use a *Custom color palette*. +... Set the *Other* color to black. +... Add a green class for *false*, meaning the bus is not in traffic. +... Add a red class for *true*, meaning the bus is in congestion. +.. Set *Border width* to 0. +.. Change *Symbol orientation* to use *By value* and the *bearing* field. ++ +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/top_hits_layer_style.png[] +. Click *Save & close*. +. Open the <>, and set *Refresh every* to 10 seconds, and click *Start*. + +Your map should automatically refresh every 10 seconds to show the lastest bus positions and tracks. + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/tracks_and_top_hits.png[] + +[float] +=== Part 3: Setup geo-fencing alerts +Let's make TriMet Portland bus data actionable and alert when buses enter construction zones. + +[float] +==== Step 1. Add a construction zone + +Add a layer for construction zones, which you will draw on the map. The construction zones will be used as your geofence boundary or threshold that serves as the basis for triggering alerts. + +. Click *Add layer*. +. Click *Create index*. +. Set *Index name* to *construction_zones*. +. Click *Create index*. +. Draw 2 or 3 construction zones on your map: +.. In the toolbar on left side of the map, select the bounding box icon image:maps/images/asset-tracking-tutorial/bounding_box_icon.png[bounding box icon]. +.. To draw a construction zone, click a start point on the map and drag. +.. Click an endpoint to finish. +. When you finish drawing the construction zones, click *Exit* under the layer name in the legend. +. In *Layer settings*, set *Name* to *Construction zones*. +. Scroll to *Layer Style*, and set *Fill color* to yellow. +. Click *Save & close*. +. *Save* the map. +.. Give the map a title. +.. Under *Add to dashboard*, select *None*. +.. Click *Save and add to library*. + +The map now represents an operational view of live bus traffic. You’ll see the direction that the buses are traveling, and whether they are near or have entered a construction zone. + +Your map is now complete. + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/construction_zones.png[] + + +[float] +==== Step 2. Configure an alert + +Create a new alert by defining a rule and a connector. The rule includes the conditions that will trigger the alert, and the connector defines what action takes place once the alert is triggered. In this case, each alert will log a message to the Kibana log. + +. Open *Stack Management*, and then click *Rules and Connectors*. +. Click *Create rule*. +. Name the rule *Bus Alerts*. +. Set *Check every* to *5 seconds*. +. Notify *Only on status change*. ++ +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/rule_configuration.png[] +. Select the *Tracking containment* rule type. +. Set *Select entity*: +.. Set *INDEX* to *tri_met_tracks**. +.. Set *BY* to *vehicle_id*. +. Set *Select boundary* *INDEX* to *construction_zones*. ++ +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/tracking_containment_configuration.png[] +. Under *Actions*, select the *Server log* connector type. +. Click *Create a connector*. +. In the *Server log connector*: +.. Set *Connector name* to *Bus alert connector*. +.. Click *Save*. +. Complete the *Actions* configuration. +.. Set *Message* to : ++ +[source,js] +---------------------------------- +{ + "entityId": "{{context.entityId}}", + "entityDateTime": "{{context.entityDateTime}}", + "entityDocumentId": "{{context.entityDocumentId}}", + "detectionDateTime": "{{context.detectionDateTime}}", + "entityLocation": "{{context.entityLocation}}", + "containingBoundaryId": "{{context.containingBoundaryId}}", + "containingBoundaryName": "{{context.containingBoundaryName}}" +} +---------------------------------- + +. Click *Save*. + +The *Bus Alert connector* is added to the *Rules and Connectors* page. For more information on common connectors, refer to the <> and <> connectors. + +[role="screenshot"] +image::maps/images/asset-tracking-tutorial/rules_and_connectors.png[] + +Congratulations! You have completed the tutorial and have the recipe for tracking assets. You can now try replicating this same analysis with your own data. diff --git a/docs/maps/images/asset-tracking-tutorial/bounding_box_icon.png b/docs/maps/images/asset-tracking-tutorial/bounding_box_icon.png new file mode 100644 index 0000000000000..a7289c35fc0c3 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/bounding_box_icon.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/construction_zones.png b/docs/maps/images/asset-tracking-tutorial/construction_zones.png new file mode 100644 index 0000000000000..0487c3d040a3b Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/construction_zones.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/discover.png b/docs/maps/images/asset-tracking-tutorial/discover.png new file mode 100644 index 0000000000000..d5ea0e55eedde Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/discover.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/index_pattern.png b/docs/maps/images/asset-tracking-tutorial/index_pattern.png new file mode 100644 index 0000000000000..e1aaecbe62d65 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/index_pattern.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/logstash_output.png b/docs/maps/images/asset-tracking-tutorial/logstash_output.png new file mode 100644 index 0000000000000..9235e31e98504 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/logstash_output.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/rule_configuration.png b/docs/maps/images/asset-tracking-tutorial/rule_configuration.png new file mode 100644 index 0000000000000..a94c5a9e1dba9 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/rule_configuration.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/rules_and_connectors.png b/docs/maps/images/asset-tracking-tutorial/rules_and_connectors.png new file mode 100644 index 0000000000000..35d89dd42ab27 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/rules_and_connectors.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/top_hits_layer_style.png b/docs/maps/images/asset-tracking-tutorial/top_hits_layer_style.png new file mode 100644 index 0000000000000..b4a869529ad45 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/top_hits_layer_style.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/tracking_containment_configuration.png b/docs/maps/images/asset-tracking-tutorial/tracking_containment_configuration.png new file mode 100644 index 0000000000000..4baf34bb414f1 Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/tracking_containment_configuration.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/tracks_and_top_hits.png b/docs/maps/images/asset-tracking-tutorial/tracks_and_top_hits.png new file mode 100644 index 0000000000000..3dd856af4a18e Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/tracks_and_top_hits.png differ diff --git a/docs/maps/images/asset-tracking-tutorial/tracks_layer.png b/docs/maps/images/asset-tracking-tutorial/tracks_layer.png new file mode 100644 index 0000000000000..b1275ec9d502f Binary files /dev/null and b/docs/maps/images/asset-tracking-tutorial/tracks_layer.png differ diff --git a/docs/maps/index.asciidoc b/docs/maps/index.asciidoc index 0922a4cc94c22..e2b379b7eb8c2 100644 --- a/docs/maps/index.asciidoc +++ b/docs/maps/index.asciidoc @@ -74,6 +74,7 @@ Search across the layers in your map to focus in on just the data you want. Comb -- include::maps-getting-started.asciidoc[] +include::asset-tracking-tutorial.asciidoc[] include::heatmap-layer.asciidoc[] include::tile-layer.asciidoc[] include::vector-layer.asciidoc[] diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index a523c2cb005a2..c9847effd5f49 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -41,14 +41,15 @@ You can configure the following settings in the `kibana.yml` file. [cols="2*<"] |=== | `xpack.actions.enabled` - | Feature toggle that enables Actions in {kib}. Default: `true`. + | Feature toggle that enables Actions in {kib}. + If `false`, all features dependent on Actions are disabled, including the *Observability* and *Security* apps. Default: `true`. | `xpack.actions.allowedHosts` {ess-icon} | A list of hostnames that {kib} is allowed to connect to when built-in actions are triggered. It defaults to `[*]`, allowing any host, but keep in mind the potential for SSRF attacks when hosts are not explicitly added to the allowed hosts. An empty list `[]` can be used to block built-in actions from making any external connections. + + Note that hosts associated with built-in actions, such as Slack and PagerDuty, are not automatically added to allowed hosts. If you are not using the default `[*]` setting, you must ensure that the corresponding endpoints are added to the allowed hosts as well. - -| `xpack.actions.customHostSettings` {ess-icon} + +| `xpack.actions.customHostSettings` {ess-icon} | A list of custom host settings to override existing global settings. Default: an empty list. + + @@ -69,7 +70,7 @@ You can configure the following settings in the `kibana.yml` file. -- xpack.actions.customHostSettings: - url: smtp://mail.example.com:465 - ssl: + ssl: verificationMode: 'full' certificateAuthoritiesFiles: [ 'one.crt' ] certificateAuthoritiesData: | @@ -79,7 +80,7 @@ xpack.actions.customHostSettings: smtp: requireTLS: true - url: https://webhook.example.com - ssl: + ssl: // legacy rejectUnauthorized: false verificationMode: 'none' @@ -117,14 +118,14 @@ xpack.actions.customHostSettings: The options `smtp.ignoreTLS` and `smtp.requireTLS` can not both be set to true. | `xpack.actions.customHostSettings[n]` -`.ssl.rejectUnauthorized` {ess-icon} +`.ssl.rejectUnauthorized` | Deprecated. Use <> instead. A boolean value indicating whether to bypass server certificate validation. Overrides the general `xpack.actions.rejectUnauthorized` configuration for requests made for this hostname/port. |[[action-config-custom-host-verification-mode]] `xpack.actions.customHostSettings[n]` -`.ssl.verificationMode` - | Controls the verification of the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the host server. Valid values are `full`, `certificate`, and `none`. +`.ssl.verificationMode` {ess-icon} + | Controls the verification of the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the host server. Valid values are `full`, `certificate`, and `none`. Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. Overrides the general `xpack.actions.ssl.verificationMode` configuration for requests made for this hostname/port. @@ -137,7 +138,7 @@ xpack.actions.customHostSettings: `.ssl.certificateAuthoritiesData` {ess-icon} | The contents of a PEM-encoded certificate file, or multiple files appended into a single string. This configuration can be used for environments where - the files cannot be made available. + the files cannot be made available. | `xpack.actions.enabledActionTypes` {ess-icon} | A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, and `.webhook`. An empty list `[]` will disable all action types. + @@ -170,7 +171,7 @@ a|`xpack.actions.` |[[action-config-proxy-verification-mode]] `xpack.actions[n]` `.ssl.proxyVerificationMode` {ess-icon} -| Controls the verification for the proxy server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the proxy server. Valid values are `full`, `certificate`, and `none`. +| Controls the verification for the proxy server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the proxy server. Valid values are `full`, `certificate`, and `none`. Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. | `xpack.actions.rejectUnauthorized` {ess-icon} @@ -182,7 +183,7 @@ Use `full` to perform hostname verification, `certificate` to skip hostname veri |[[action-config-verification-mode]] `xpack.actions[n]` `.ssl.verificationMode` {ess-icon} -| Controls the verification for the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection for actions. Valid values are `full`, `certificate`, and `none`. +| Controls the verification for the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection for actions. Valid values are `full`, `certificate`, and `none`. Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. + + As an alternative to setting `xpack.actions.ssl.verificationMode`, you can use the setting @@ -213,4 +214,4 @@ Use `full` to perform hostname verification, `certificate` to skip hostname veri | `xpack.alerting.maxEphemeralActionsPerAlert` | Sets the number of actions that will be executed ephemerally. To use this, enable ephemeral tasks in task manager first with <> -|=== \ No newline at end of file +|=== diff --git a/docs/user/monitoring/kibana-alerts.asciidoc b/docs/user/monitoring/kibana-alerts.asciidoc index 837248e0cf41d..f00a3999ab277 100644 --- a/docs/user/monitoring/kibana-alerts.asciidoc +++ b/docs/user/monitoring/kibana-alerts.asciidoc @@ -11,8 +11,7 @@ specific needs. [role="screenshot"] image::user/monitoring/images/monitoring-kibana-alerting-notification.png["{kib} alerting notifications in {stack-monitor-app}"] -When you open *{stack-monitor-app}*, you will be ask to create these rules -They are initially configured to detect and notify on various +When you open *{stack-monitor-app}* for the first time, you will be asked to acknowledge the creation of these default rules. They are initially configured to detect and notify on various conditions across your monitored clusters. You can view notifications for: *Cluster health*, *Resource utilization*, and *Errors and exceptions* for {es} in real time. @@ -23,8 +22,8 @@ been recreated as rules in {kib} {alert-features}. For this reason, the existing The default action for all {stack-monitor-app} rules is to write to {kib} logs and display a notification in the UI. -To review and modify all available rules, click *Enter setup mode* on the -*Cluster overview* page. +To review and modify existing *{stack-monitor-app}* rules, click *Enter setup mode* on the *Cluster overview* page. +Alternatively, to manage all rules, including create and delete functionality go to *Stack Management > Rules and Connectors*. [discrete] [[kibana-alerts-cpu-threshold]] @@ -32,17 +31,15 @@ To review and modify all available rules, click *Enter setup mode* on the This rule checks for {es} nodes that run a consistently high CPU load. By default, the condition is set at 85% or more averaged over the last 5 minutes. -The rule is grouped across all the nodes of the cluster by running checks on a -schedule time of 1 minute with a re-notify interval of 1 day. +The default rule checks on a schedule time of 1 minute with a re-notify interval of 1 day. [discrete] [[kibana-alerts-disk-usage-threshold]] == Disk usage threshold This rule checks for {es} nodes that are nearly at disk capacity. By default, -the condition is set at 80% or more averaged over the last 5 minutes. The rule -is grouped across all the nodes of the cluster by running checks on a schedule -time of 1 minute with a re-notify interval of 1 day. +the condition is set at 80% or more averaged over the last 5 minutes. The default rule +checks on a schedule time of 1 minute with a re-notify interval of 1 day. [discrete] [[kibana-alerts-jvm-memory-threshold]] @@ -50,16 +47,14 @@ time of 1 minute with a re-notify interval of 1 day. This rule checks for {es} nodes that use a high amount of JVM memory. By default, the condition is set at 85% or more averaged over the last 5 minutes. -The rule is grouped across all the nodes of the cluster by running checks on a -schedule time of 1 minute with a re-notify interval of 1 day. +The default rule checks on a schedule time of 1 minute with a re-notify interval of 1 day. [discrete] [[kibana-alerts-missing-monitoring-data]] == Missing monitoring data This rule checks for {es} nodes that stop sending monitoring data. By default, -the condition is set to missing for 15 minutes looking back 1 day. The rule is -grouped across all the {es} nodes of the cluster by running checks on a schedule +the condition is set to missing for 15 minutes looking back 1 day. The default rule checks on a schedule time of 1 minute with a re-notify interval of 6 hours. [discrete] @@ -67,9 +62,8 @@ time of 1 minute with a re-notify interval of 6 hours. == Thread pool rejections (search/write) This rule checks for {es} nodes that experience thread pool rejections. By -default, the condition is set at 300 or more over the last 5 minutes. The rule -is grouped across all the nodes of the cluster by running checks on a schedule -time of 1 minute with a re-notify interval of 1 day. Thresholds can be set +default, the condition is set at 300 or more over the last 5 minutes. The default rule +checks on a schedule time of 1 minute with a re-notify interval of 1 day. Thresholds can be set independently for `search` and `write` type rejections. [discrete] @@ -78,8 +72,7 @@ independently for `search` and `write` type rejections. This rule checks for read exceptions on any of the replicated {es} clusters. The condition is met if 1 or more read exceptions are detected in the last hour. The -rule is grouped across all replicated clusters by running checks on a schedule -time of 1 minute with a re-notify interval of 6 hours. +default rule checks on a schedule time of 1 minute with a re-notify interval of 6 hours. [discrete] [[kibana-alerts-large-shard-size]] @@ -87,9 +80,8 @@ time of 1 minute with a re-notify interval of 6 hours. This rule checks for a large average shard size (across associated primaries) on any of the specified index patterns in an {es} cluster. The condition is met if -an index's average shard size is 55gb or higher in the last 5 minutes. The rule -is grouped across all indices that match the default pattern of `-.*` by running -checks on a schedule time of 1 minute with a re-notify interval of 12 hours. +an index's average shard size is 55gb or higher in the last 5 minutes. The default rule +matches the pattern of `-.*` by running checks on a schedule time of 1 minute with a re-notify interval of 12 hours. [discrete] [[kibana-alerts-cluster-alerts]] diff --git a/package.json b/package.json index b148eae39cbb3..2058eed5f024d 100644 --- a/package.json +++ b/package.json @@ -95,11 +95,11 @@ "dependencies": { "@elastic/apm-rum": "^5.8.0", "@elastic/apm-rum-react": "^1.2.11", - "@elastic/charts": "33.1.0", + "@elastic/charts": "33.2.0", "@elastic/datemath": "link:bazel-bin/packages/elastic-datemath", - "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.13", + "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.14", "@elastic/ems-client": "7.14.0", - "@elastic/eui": "36.0.0", + "@elastic/eui": "36.1.0", "@elastic/filesaver": "1.1.2", "@elastic/good": "^9.0.1-kibana3", "@elastic/maki": "6.3.0", @@ -438,7 +438,6 @@ "@babel/plugin-proposal-object-rest-spread": "^7.12.1", "@babel/plugin-proposal-optional-chaining": "^7.12.7", "@babel/plugin-proposal-private-methods": "^7.12.1", - "@babel/plugin-transform-modules-commonjs": "^7.12.1", "@babel/plugin-transform-runtime": "^7.12.10", "@babel/preset-env": "^7.12.11", "@babel/preset-react": "^7.12.10", diff --git a/packages/kbn-babel-code-parser/BUILD.bazel b/packages/kbn-babel-code-parser/BUILD.bazel index dcdc042d7b802..dcf76b337ff91 100644 --- a/packages/kbn-babel-code-parser/BUILD.bazel +++ b/packages/kbn-babel-code-parser/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("@npm//@babel/cli:index.bzl", "babel") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-babel-code-parser" PKG_REQUIRE_NAME = "@kbn/babel-code-parser" @@ -25,35 +25,22 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -DEPS = [ - "//packages/kbn-babel-preset", +RUNTIME_DEPS = [ "@npm//@babel/parser", "@npm//@babel/traverse", "@npm//lodash", ] -babel( - name = "target", - data = DEPS + [ - ":srcs", - ".babelrc", - ], - output_dir = True, - # the following arg paths includes $(execpath) as babel runs on the sandbox root - args = [ - "./%s/src" % package_name(), - "--config-file", - "./%s/.babelrc" % package_name(), - "--out-dir", - "$(@D)", - "--quiet" - ], +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), ) js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":target"], + deps = RUNTIME_DEPS + [":target_node"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-babel-code-parser/package.json b/packages/kbn-babel-code-parser/package.json index da55565c6076c..a4ad8d603a0cb 100755 --- a/packages/kbn-babel-code-parser/package.json +++ b/packages/kbn-babel-code-parser/package.json @@ -3,7 +3,7 @@ "description": "babel code parser for Kibana", "private": true, "version": "1.0.0", - "main": "./target/index.js", + "main": "./target_node/index.js", "license": "SSPL-1.0 OR Elastic License 2.0", "repository": { "type": "git", diff --git a/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts b/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts index 4b1bbb43ba888..a681f1ff2e4cd 100644 --- a/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts +++ b/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts @@ -77,8 +77,11 @@ export interface CliDevModeOptions { cache: boolean; } -const firstAllTrue = (...sources: Array>) => - Rx.combineLatest(sources).pipe( +const getValue$ = (source: Rx.BehaviorSubject): Rx.Observable => + source.isStopped ? Rx.of(source.getValue()) : source; + +const firstAllTrue = (...sources: Array>) => + Rx.combineLatest(sources.map(getValue$)).pipe( filter((values) => values.every((v) => v === true)), take(1), mapTo(undefined) @@ -198,11 +201,24 @@ export class CliDevMode { ? Rx.EMPTY : Rx.timer(1000).pipe( tap(() => { - this.log.warn( - 'please hold', - !optimizerReady$.getValue() - ? 'optimizer is still bundling so requests have been paused' - : 'server is not ready so requests have been paused' + if (!optimizerReady$.getValue()) { + this.log.warn( + 'please hold', + 'optimizer is still bundling so requests have been paused' + ); + return; + } + + if (!serverReady$.getValue()) { + this.log.warn( + 'please hold', + 'Kibana server is not ready so requests have been paused' + ); + return; + } + + throw new Error( + 'user is waiting for over 1 second and neither serverReady$ or optimizerReady$ is false' ); }) ) diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts index 3e16a25b36a14..ce7f93826d1da 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts @@ -84,7 +84,7 @@ it('Test Interface Kind doc def', () => { expect(def.type).toBe(TypeKind.InterfaceKind); expect(def.children).toBeDefined(); - expect(def.children!.length).toBe(3); + expect(def.children!.length).toBe(6); }); it('Test union export', () => { diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts index 54b3f433b2e8f..3d54cda5cf0fc 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Node } from 'ts-morph'; +import { FunctionTypeNode, Node } from 'ts-morph'; import { ToolingLog, KibanaPlatformPlugin } from '@kbn/dev-utils'; import { buildClassDec } from './build_class_dec'; import { buildFunctionDec } from './build_function_dec'; @@ -17,6 +17,8 @@ import { buildTypeLiteralDec } from './build_type_literal_dec'; import { ApiScope } from '../types'; import { buildInterfaceDec } from './build_interface_dec'; import { buildBasicApiDeclaration } from './build_basic_api_declaration'; +import { buildFunctionTypeDec } from './build_function_type_dec'; +import { buildCallSignatureDec } from './build_call_signature_dec'; /** * A potentially recursive function, depending on the node type, that builds a JSON like structure @@ -65,13 +67,28 @@ export function buildApiDeclaration({ return buildClassDec(node, plugins, anchorLink, currentPluginId, log, captureReferences); } else if (Node.isInterfaceDeclaration(node)) { return buildInterfaceDec(node, plugins, anchorLink, currentPluginId, log, captureReferences); + } else if ( + Node.isPropertySignature(node) && + node.getTypeNode() && + Node.isFunctionTypeNode(node.getTypeNode()!) + ) { + // This code path covers optional properties on interfaces, otherwise they lost their children. Yes, a bit strange. + return buildFunctionTypeDec({ + node, + typeNode: node.getTypeNode()! as FunctionTypeNode, + plugins, + anchorLink, + currentPluginId, + log, + captureReferences, + }); } else if ( Node.isMethodSignature(node) || Node.isFunctionDeclaration(node) || Node.isMethodDeclaration(node) || Node.isConstructorDeclaration(node) ) { - return buildFunctionDec(node, plugins, anchorLink, currentPluginId, log, captureReferences); + return buildFunctionDec({ node, plugins, anchorLink, currentPluginId, log, captureReferences }); } else if ( Node.isPropertySignature(node) || Node.isPropertyDeclaration(node) || @@ -92,6 +109,29 @@ export function buildApiDeclaration({ ); } + // Without this types that are functions won't include comments on parameters. e.g. + // /** + // * @param t A parameter + // */ + // export type AFn = (t: string) => void; + // + if (node.getType().getCallSignatures().length > 0) { + if (node.getType().getCallSignatures().length > 1) { + log.warning(`Not handling more than one call signature for node ${apiName}`); + } else { + return buildCallSignatureDec({ + signature: node.getType().getCallSignatures()[0], + log, + captureReferences, + plugins, + anchorLink, + currentPluginId, + name: apiName, + node, + }); + } + } + return buildBasicApiDeclaration({ currentPluginId, anchorLink, diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts index afdf971336d34..c387b551a3002 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts @@ -27,14 +27,21 @@ import { buildBasicApiDeclaration } from './build_basic_api_declaration'; * @param anchorLink * @param log */ -export function buildFunctionDec( - node: FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature, - plugins: KibanaPlatformPlugin[], - anchorLink: AnchorLink, - currentPluginId: string, - log: ToolingLog, - captureReferences: boolean -): ApiDeclaration { +export function buildFunctionDec({ + node, + plugins, + anchorLink, + currentPluginId, + log, + captureReferences, +}: { + node: FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature; + plugins: KibanaPlatformPlugin[]; + anchorLink: AnchorLink; + currentPluginId: string; + log: ToolingLog; + captureReferences: boolean; +}): ApiDeclaration { const label = Node.isConstructorDeclaration(node) ? 'Constructor' : node.getName() || '(WARN: Missing name)'; diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_type_dec.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_type_dec.ts new file mode 100644 index 0000000000000..e8137e9e7536d --- /dev/null +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_type_dec.ts @@ -0,0 +1,60 @@ +/* + * 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 { PropertySignature } from 'ts-morph'; + +import { ToolingLog, KibanaPlatformPlugin } from '@kbn/dev-utils'; +import { FunctionTypeNode } from 'ts-morph'; +import { buildApiDecsForParameters } from './build_parameter_decs'; +import { AnchorLink, ApiDeclaration, TypeKind } from '../types'; +import { getJSDocReturnTagComment, getJSDocs } from './js_doc_utils'; +import { buildBasicApiDeclaration } from './build_basic_api_declaration'; + +/** + * Takes the various function-type node declaration types and converts them into an ApiDeclaration. + */ +export function buildFunctionTypeDec({ + node, + typeNode, + plugins, + anchorLink, + currentPluginId, + log, + captureReferences, +}: { + node: PropertySignature; + typeNode: FunctionTypeNode; + plugins: KibanaPlatformPlugin[]; + anchorLink: AnchorLink; + currentPluginId: string; + log: ToolingLog; + captureReferences: boolean; +}): ApiDeclaration { + const fn = { + ...buildBasicApiDeclaration({ + currentPluginId, + anchorLink, + node, + captureReferences, + plugins, + log, + apiName: node.getName(), + }), + type: TypeKind.FunctionKind, + children: buildApiDecsForParameters( + typeNode.getParameters(), + plugins, + anchorLink, + currentPluginId, + log, + captureReferences, + getJSDocs(node) + ), + returnComment: getJSDocReturnTagComment(node), + }; + return fn; +} diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_variable_dec.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_variable_dec.ts index cc3c2f8f50211..7a363f93f2efa 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_variable_dec.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_variable_dec.ts @@ -46,7 +46,6 @@ export function buildVariableDec( captureReferences: boolean ): ApiDeclaration { const initializer = node.getInitializer(); - if (initializer && Node.isObjectLiteralExpression(initializer)) { // Recursively list object properties as children. return { @@ -90,6 +89,7 @@ export function buildVariableDec( ); } + // Without this the test "Property on interface pointing to generic function type exported with link" will fail. if (node.getType().getCallSignatures().length > 0) { if (node.getType().getCallSignatures().length > 1) { log.warning(`Not handling more than one call signature for node ${node.getName()}`); diff --git a/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts b/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts index f17e3e4d90600..d91cadce10754 100644 --- a/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts @@ -38,7 +38,7 @@ beforeAll(() => { }); test('foo service has all exports', () => { - expect(doc?.client.length).toBe(35); + expect(doc?.client.length).toBe(36); const split = splitApisByFolder(doc); expect(split.length).toBe(2); @@ -47,5 +47,5 @@ test('foo service has all exports', () => { expect(fooDoc?.common.length).toBe(1); expect(fooDoc?.client.length).toBe(2); - expect(mainDoc?.client.length).toBe(33); + expect(mainDoc?.client.length).toBe(34); }); diff --git a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts index 3641bc41945aa..e80ae3f4f4c5f 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts @@ -8,7 +8,7 @@ /* eslint-disable max-classes-per-file */ -import { ImAType } from './types'; +import { FnTypeWithGeneric, ImAType } from './types'; /** * @internal @@ -87,10 +87,26 @@ export interface ExampleInterface extends AnotherInterface { */ aFnWithGen: (t: T) => void; + /** + * Add coverage for this bug report: https://github.com/elastic/kibana/issues/107145 + */ + anOptionalFn?: (foo: string) => string; + /** * These are not coming back properly. */ aFn(): void; + + /** + * This one is slightly different than the above `aFnWithGen`. The generic is part of the type, not the function (it's before the = sign). + * Ideally, we can still capture the children. + */ + fnTypeWithGeneric: FnTypeWithGeneric; + + /** + * Optional code path is different than others. + */ + fnTypeWithGenericThatIsOptional?: FnTypeWithGeneric; } /** diff --git a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts index 0e70fe1afb6cf..e0ac1bfd089fc 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts @@ -25,6 +25,14 @@ export type ImAType = string | number | TypeWithGeneric | FooType | ImAC */ export type FnWithGeneric = (t: T) => TypeWithGeneric; +/** + * Ever so slightly different than above. Users of this type must specify the generic. + * + * @param t something! + * @return something! + */ +export type FnTypeWithGeneric = (t: T, p: MyProps) => TypeWithGeneric; + /** * Comments on enums. */ diff --git a/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts b/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts index 0c97743c65d35..0d567632346f1 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/api_doc_suite.test.ts @@ -244,7 +244,49 @@ describe('objects', () => { }); }); -describe('Misc types', () => { +describe('Types', () => { + it('Generic type pointing to a function', () => { + const api = doc.client.find((c) => c.label === 'FnTypeWithGeneric'); + expect(api).toBeDefined(); + expect(api?.signature).toBeDefined(); + expect(linkCount(api?.signature!)).toBe(2); + + expect(api?.children).toBeDefined(); + expect(api?.signature!).toMatchInlineSnapshot(` + Array [ + "(t: T, p: ", + Object { + "docId": "kibPluginAPluginApi", + "pluginId": "pluginA", + "scope": "public", + "section": "def-public.MyProps", + "text": "MyProps", + }, + ") => ", + Object { + "docId": "kibPluginAPluginApi", + "pluginId": "pluginA", + "scope": "public", + "section": "def-public.TypeWithGeneric", + "text": "TypeWithGeneric", + }, + "", + ] + `); + }); + + it('Generic type pointing to an array', () => { + const api = doc.client.find((c) => c.label === 'TypeWithGeneric'); + expect(api).toBeDefined(); + expect(api?.signature).toBeDefined(); + expect(linkCount(api?.signature!)).toBe(0); + expect(api?.signature!).toMatchInlineSnapshot(` + Array [ + "T[]", + ] + `); + }); + it('Type using ReactElement has the right signature', () => { const api = doc.client.find((c) => c.label === 'AReactElementFn'); expect(api).toBeDefined(); @@ -322,6 +364,14 @@ describe('Misc types', () => { ] `); expect(linkCount(fnType?.signature!)).toBe(1); + + expect(fnType?.children).toBeDefined(); + expect(fnType?.children?.length).toBe(1); + expect(fnType?.children![0].description).toMatchInlineSnapshot(` + Array [ + "This is a generic T type. It can be anything.", + ] + `); }); it('Union type is exported correctly', () => { @@ -417,6 +467,20 @@ describe('interfaces and classes', () => { `); }); + /** + * Coverage for https://github.com/elastic/kibana/issues/107145 + */ + it('Optional function on interface includes children', () => { + const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface'); + expect(exampleInterface).toBeDefined(); + + const fn = exampleInterface!.children?.find((c) => c.label === 'anOptionalFn'); + expect(fn).toBeDefined(); + expect(fn?.type).toBe(TypeKind.FunctionKind); + expect(fn?.children).toBeDefined(); + expect(fn?.children?.length).toBe(1); + }); + it('Non arrow function on interface is exported as function type', () => { const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface'); expect(exampleInterface).toBeDefined(); @@ -462,7 +526,7 @@ describe('interfaces and classes', () => { expect(linkCount(clss?.signature!)).toBe(3); }); - it('Function with generic inside interface is exported with function type', () => { + it('Generic function inside interface is exported as a function', () => { const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface'); expect(exampleInterface).toBeDefined(); @@ -481,6 +545,47 @@ describe('interfaces and classes', () => { expect(param!.description![0]).toBe('This a parameter.'); }); + it('Property on interface pointing to generic function type exported with link', () => { + const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface'); + expect(exampleInterface).toBeDefined(); + + const fn = exampleInterface?.children?.find((c) => c.label === 'fnTypeWithGeneric'); + expect(fn).toBeDefined(); + + // `fnTypeWithGeneric` is defined as: + // fnTypeWithGeneric: FnTypeWithGeneric; + // and `GenericTypeFn` is defined as: + // type FnTypeWithGeneric = (t: T, p: MyProps) => TypeWithGeneric; + // In get_signature.ts, we use the `TypeFormatFlags.InTypeAlias` flag which ends up expanding the type + // to be a function, and thus this doesn't show up as a single referenced type with no kids. If we ever fixed that, + // it would be find to change expectations here to be no children and TypeKind instead of FunctionKind. + expect(fn?.children).toBeDefined(); + expect(fn?.type).toBe(TypeKind.FunctionKind); + expect(fn?.signature).toBeDefined(); + expect(linkCount(fn!.signature!)).toBe(2); + expect(fn?.children?.length).toBe(2); + + // This will fail! It actually shows up as Uncategorized. It would be some effort to get it to show up as string, which may involve + // trying to fix the above issue so it's not expanded. + // expect(fn?.children[0]!.type).toBe(TypeKind.StringKind); + }); + + // Optional code path is different than non-optional properties. + it('Optional interface property pointing to generic function type', () => { + const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface'); + expect(exampleInterface).toBeDefined(); + + const fn = exampleInterface?.children?.find( + (c) => c.label === 'fnTypeWithGenericThatIsOptional' + ); + expect(fn).toBeDefined(); + + // Unlike the above, the type is _not_ expanded inline, so we make sure it has no children, but does link to the property. + expect(fn?.children).toBeUndefined(); + expect(fn?.signature).toBeDefined(); + expect(linkCount(fn!.signature!)).toBe(1); + }); + it('interfaces with internal tags are not exported', () => { const internal = doc.client.find((c) => c.label === 'IShouldBeInternalInterface'); expect(internal).toBeUndefined(); diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json index 8a2a31c11be57..a63f726a8ca45 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json @@ -416,22 +416,31 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "pluginA", - "id": "def-public.foo", + "id": "def-public.crazyFunction.$2.fn.fn.$1.foo", "type": "Object", "tags": [], "label": "foo", "description": [], - "signature": [ - "{ param: string; }" - ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.crazyFunction.$2.fn.fn.$1.foo.param", + "type": "string", + "tags": [], + "label": "param", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] } ] }, @@ -732,8 +741,8 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", "deprecated": false, - "returnComment": [], - "children": [] + "children": [], + "returnComment": [] }, { "parentPluginId": "pluginA", @@ -749,13 +758,10 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", "deprecated": false, - "returnComment": [ - "nothing!" - ], "children": [ { "parentPluginId": "pluginA", - "id": "def-public.t", + "id": "def-public.ExampleInterface.aFnWithGen.$1", "type": "Uncategorized", "tags": [], "label": "t", @@ -766,10 +772,46 @@ "T" ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "nothing!" ] }, + { + "parentPluginId": "pluginA", + "id": "def-public.ExampleInterface.anOptionalFn", + "type": "Function", + "tags": [], + "label": "anOptionalFn", + "description": [ + "\nAdd coverage for this bug report: https://github.com/elastic/kibana/issues/107145" + ], + "signature": [ + "((foo: string) => string) | undefined" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.ExampleInterface.anOptionalFn.$1", + "type": "string", + "tags": [], + "label": "foo", + "description": [], + "signature": [ + "string" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", + "deprecated": false, + "isRequired": true + } + ], + "returnComment": [] + }, { "parentPluginId": "pluginA", "id": "def-public.ExampleInterface.aFn", @@ -786,6 +828,94 @@ "deprecated": false, "children": [], "returnComment": [] + }, + { + "parentPluginId": "pluginA", + "id": "def-public.ExampleInterface.fnTypeWithGeneric", + "type": "Function", + "tags": [], + "label": "fnTypeWithGeneric", + "description": [ + "\nThis one is slightly different than the above `aFnWithGen`. The generic is part of the type, not the function (it's before the = sign).\nIdeally, we can still capture the children." + ], + "signature": [ + "(t: string, p: ", + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.MyProps", + "text": "MyProps" + }, + ") => ", + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.TypeWithGeneric", + "text": "TypeWithGeneric" + }, + "" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", + "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.t", + "type": "Uncategorized", + "tags": [], + "label": "t", + "description": [], + "signature": [ + "T" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.p", + "type": "Object", + "tags": [], + "label": "p", + "description": [], + "signature": [ + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.MyProps", + "text": "MyProps" + } + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", + "deprecated": false + } + ] + }, + { + "parentPluginId": "pluginA", + "id": "def-public.ExampleInterface.fnTypeWithGenericThatIsOptional", + "type": "Function", + "tags": [], + "label": "fnTypeWithGenericThatIsOptional", + "description": [ + "\nOptional code path is different than others." + ], + "signature": [ + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.FnTypeWithGeneric", + "text": "FnTypeWithGeneric" + }, + " | undefined" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts", + "deprecated": false } ], "initialIsOpen": false @@ -1074,6 +1204,8 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false }, { @@ -1129,6 +1261,79 @@ "deprecated": false, "initialIsOpen": false }, + { + "parentPluginId": "pluginA", + "id": "def-public.FnTypeWithGeneric", + "type": "Type", + "tags": [ + "return" + ], + "label": "FnTypeWithGeneric", + "description": [ + "\nEver so slightly different than above. Users of this type must specify the generic.\n" + ], + "signature": [ + "(t: T, p: ", + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.MyProps", + "text": "MyProps" + }, + ") => ", + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.TypeWithGeneric", + "text": "TypeWithGeneric" + }, + "" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", + "deprecated": false, + "returnComment": [ + "something!" + ], + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.t", + "type": "Uncategorized", + "tags": [], + "label": "t", + "description": [ + "something!" + ], + "signature": [ + "T" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.p", + "type": "Object", + "tags": [], + "label": "p", + "description": [], + "signature": [ + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.MyProps", + "text": "MyProps" + } + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", + "deprecated": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "pluginA", "id": "def-public.FnWithGeneric", @@ -1151,6 +1356,24 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.t", + "type": "Uncategorized", + "tags": [], + "label": "t", + "description": [ + "This is a generic T type. It can be anything." + ], + "signature": [ + "T" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/types.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1309,6 +1532,94 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", "deprecated": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.a", + "type": "string", + "tags": [], + "label": "a", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.b", + "type": "number", + "tags": [], + "label": "b", + "description": [], + "signature": [ + "number | undefined" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.c", + "type": "Array", + "tags": [], + "label": "c", + "description": [], + "signature": [ + "string[]" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.d", + "type": "CompoundType", + "tags": [], + "label": "d", + "description": [], + "signature": [ + "string | number | ", + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAFooPluginApi", + "section": "def-public.FooType", + "text": "FooType" + }, + " | ", + { + "pluginId": "pluginA", + "scope": "public", + "docId": "kibPluginAPluginApi", + "section": "def-public.TypeWithGeneric", + "text": "TypeWithGeneric" + }, + " | ", + { + "pluginId": "pluginA", + "scope": "common", + "docId": "kibPluginAPluginApi", + "section": "def-common.ImACommonType", + "text": "ImACommonType" + } + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.e", + "type": "string", + "tags": [], + "label": "e", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/fns.ts", + "deprecated": false + } + ], "initialIsOpen": false }, { @@ -1738,13 +2049,10 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", "deprecated": false, - "returnComment": [ - "the id of the search service." - ], "children": [ { "parentPluginId": "pluginA", - "id": "def-public.searchSpec", + "id": "def-public.Setup.getSearchService.$1", "type": "Object", "tags": [], "label": "searchSpec", @@ -1761,8 +2069,12 @@ } ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true } + ], + "returnComment": [ + "the id of the search service." ] }, { @@ -1779,24 +2091,41 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", "deprecated": false, - "returnComment": [], "children": [ { "parentPluginId": "pluginA", - "id": "def-public.searchSpec", + "id": "def-public.Setup.getSearchService2.$1.searchSpec", "type": "Object", "tags": [], "label": "searchSpec", - "description": [ - "Provide the settings neccessary to create a new Search Service" - ], - "signature": [ - "{ username: string; password: string; }" - ], + "description": [], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.Setup.getSearchService2.$1.searchSpec.username", + "type": "string", + "tags": [], + "label": "username", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.Setup.getSearchService2.$1.searchSpec.password", + "type": "string", + "tags": [], + "label": "password", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "pluginA", @@ -1815,48 +2144,63 @@ "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", "deprecated": true, "references": [], - "returnComment": [], "children": [ { "parentPluginId": "pluginA", - "id": "def-public.thingOne", + "id": "def-public.Setup.doTheThing.$1", "type": "number", "tags": [], "label": "thingOne", "description": [ "Thing one comment" ], + "signature": [ + "number" + ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "pluginA", - "id": "def-public.thingTwo", + "id": "def-public.Setup.doTheThing.$2", "type": "string", "tags": [], "label": "thingTwo", "description": [ "ThingTwo comment" ], + "signature": [ + "string" + ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", - "deprecated": false + "deprecated": false, + "isRequired": true }, { "parentPluginId": "pluginA", - "id": "def-public.thingThree", + "id": "def-public.Setup.doTheThing.$3.thingThree", "type": "Object", "tags": [], "label": "thingThree", - "description": [ - "Thing three is an object with a nested var" - ], - "signature": [ - "{ nestedVar: number; }" - ], + "description": [], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.Setup.doTheThing.$3.thingThree.nestedVar", + "type": "number", + "tags": [], + "label": "nestedVar", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", + "deprecated": false + } + ] } - ] + ], + "returnComment": [] }, { "parentPluginId": "pluginA", @@ -1872,25 +2216,60 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", "deprecated": false, - "returnComment": [ - "It's hard to tell but I think this returns a function that returns an object with a\nproperty that is a function that returns a string. Whoa." - ], "children": [ { "parentPluginId": "pluginA", - "id": "def-public.obj", + "id": "def-public.Setup.fnWithInlineParams.$1.obj", "type": "Object", "tags": [], "label": "obj", - "description": [ - "A funky parameter." - ], - "signature": [ - "{ fn: (foo: { param: string; }) => number; }" - ], + "description": [], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", - "deprecated": false + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.Setup.fnWithInlineParams.$1.obj.fn", + "type": "Function", + "tags": [], + "label": "fn", + "description": [], + "signature": [ + "(foo: { param: string; }) => number" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.Setup.fnWithInlineParams.$1.obj.fn.$1.foo", + "type": "Object", + "tags": [], + "label": "foo", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.Setup.fnWithInlineParams.$1.obj.fn.$1.foo.param", + "type": "string", + "tags": [], + "label": "param", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", + "deprecated": false + } + ] + } + ], + "returnComment": [] + } + ] } + ], + "returnComment": [ + "It's hard to tell but I think this returns a function that returns an object with a\nproperty that is a function that returns a string. Whoa." ] }, { @@ -1934,10 +2313,10 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/plugin.ts", "deprecated": false, + "children": [], "returnComment": [ "The currently selected {@link SearchLanguage}" - ], - "children": [] + ] } ], "lifecycle": "start", diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.json index 83931cfa3b087..c7b43d9436cb9 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.json +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.json @@ -35,6 +35,8 @@ ], "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts", "deprecated": false, + "returnComment": [], + "children": [], "initialIsOpen": false } ], diff --git a/packages/kbn-es/BUILD.bazel b/packages/kbn-es/BUILD.bazel index 8d50d4e34e296..91dc48cec7d0c 100644 --- a/packages/kbn-es/BUILD.bazel +++ b/packages/kbn-es/BUILD.bazel @@ -1,5 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") -load("@npm//@babel/cli:index.bzl", "babel") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-es" PKG_REQUIRE_NAME = "@kbn/es" @@ -27,8 +27,7 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -DEPS = [ - "//packages/kbn-babel-preset", +RUNTIME_DEPS = [ "@npm//@elastic/elasticsearch", "@npm//abort-controller", "@npm//chalk", @@ -43,31 +42,16 @@ DEPS = [ "@npm//zlib" ] -babel( - name = "target", - data = DEPS + [ - ":srcs", - ".babelrc", - ], - output_dir = True, - # the following arg paths includes $(execpath) as babel runs on the sandbox root - args = [ - "./%s/src" % package_name(), - "--config-file", - "./%s/.babelrc" % package_name(), - "--out-dir", - "$(@D)", - "--extensions", - ".ts,.js", - "--copy-files", - "--quiet" - ], +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), ) js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":target"], + deps = RUNTIME_DEPS + [":target_node"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-es/package.json b/packages/kbn-es/package.json index ed3f29feaef98..ee8d8e89030e1 100644 --- a/packages/kbn-es/package.json +++ b/packages/kbn-es/package.json @@ -1,6 +1,6 @@ { "name": "@kbn/es", - "main": "./target/index.js", + "main": "./target_node/index.js", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true, diff --git a/packages/kbn-es/src/utils/native_realm.js b/packages/kbn-es/src/utils/native_realm.js index a5051cdb0d89a..f7ee9da290dc6 100644 --- a/packages/kbn-es/src/utils/native_realm.js +++ b/packages/kbn-es/src/utils/native_realm.js @@ -11,6 +11,23 @@ const chalk = require('chalk'); const { log: defaultLog } = require('./log'); +/** + * Hack to skip the Product Check performed by the Elasticsearch-js client. + * We noticed a couple of bugs that may need to be fixed before taking full + * advantage of this feature. + * + * The bugs are detailed in this issue: https://github.com/elastic/kibana/issues/105557 + * + * The hack is copied from the test/utils in the elasticsearch-js repo + * (https://github.com/elastic/elasticsearch-js/blob/master/test/utils/index.js#L45-L56) + */ +function skipProductCheck(client) { + const tSymbol = Object.getOwnPropertySymbols(client.transport || client).filter( + (symbol) => symbol.description === 'product check' + )[0]; + (client.transport || client)[tSymbol] = 2; +} + exports.NativeRealm = class NativeRealm { constructor({ elasticPassword, port, log = defaultLog, ssl = false, caCert }) { this._client = new Client({ @@ -22,6 +39,8 @@ exports.NativeRealm = class NativeRealm { } : undefined, }); + // TODO: @elastic/es-clients I had to disable the product check here because the client is getting 404 while ES is initializing, but the requests here auto retry them. + skipProductCheck(this._client); this._elasticPassword = elasticPassword; this._log = log; } diff --git a/packages/kbn-i18n/.babelrc b/packages/kbn-i18n/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-i18n/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-i18n/.babelrc.browser b/packages/kbn-i18n/.babelrc.browser new file mode 100644 index 0000000000000..dc6a77bbe0bcd --- /dev/null +++ b/packages/kbn-i18n/.babelrc.browser @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/webpack_preset"] +} diff --git a/packages/kbn-i18n/BUILD.bazel b/packages/kbn-i18n/BUILD.bazel index a48939d6e26fd..1b3410c9f25e7 100644 --- a/packages/kbn-i18n/BUILD.bazel +++ b/packages/kbn-i18n/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-i18n" PKG_REQUIRE_NAME = "@kbn/i18n" @@ -33,24 +34,19 @@ NPM_MODULE_EXTRA_FILES = [ "README.md" ] -SRC_DEPS = [ - "//packages/kbn-babel-preset", - "//packages/kbn-dev-utils", - "@npm//@babel/core", - "@npm//babel-loader", - "@npm//del", - "@npm//getopts", +RUNTIME_DEPS = [ "@npm//intl-format-cache", "@npm//intl-messageformat", "@npm//intl-relativeformat", "@npm//prop-types", "@npm//react", - "@npm//react-intl", - "@npm//supports-color", + "@npm//react-intl" ] TYPES_DEPS = [ - "@npm//typescript", + "//packages/kbn-babel-preset", + "@npm//intl-messageformat", + "@npm//tslib", "@npm//@types/angular", "@npm//@types/intl-relativeformat", "@npm//@types/jest", @@ -59,59 +55,46 @@ TYPES_DEPS = [ "@npm//@types/react-intl", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) -ts_config( - name = "tsconfig", - src = "tsconfig.json", - deps = [ - "//:tsconfig.base.json", - ], +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + config_file = ".babelrc.browser" ) ts_config( - name = "tsconfig_browser", - src = "tsconfig.browser.json", + name = "tsconfig", + src = "tsconfig.json", deps = [ "//:tsconfig.base.json", - "//:tsconfig.browser.json", ], ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, - allow_js = True, + deps = TYPES_DEPS, declaration = True, - declaration_dir = "target_types", declaration_map = True, - incremental = True, - out_dir = "target_node", + emit_declaration_only = True, + incremental = False, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", ) -ts_project( - name = "tsc_browser", - args = ['--pretty'], - srcs = SRCS, - deps = DEPS, - allow_js = True, - declaration = False, - incremental = True, - out_dir = "target_web", - source_map = True, - root_dir = "src", - tsconfig = ":tsconfig_browser", -) - js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc", ":tsc_browser"], + deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-i18n/tsconfig.browser.json b/packages/kbn-i18n/tsconfig.browser.json deleted file mode 100644 index d7b8495a0d21d..0000000000000 --- a/packages/kbn-i18n/tsconfig.browser.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../tsconfig.browser.json", - "compilerOptions": { - "allowJs": true, - "incremental": true, - "outDir": "./target_web", - "declaration": false, - "isolatedModules": true, - "sourceMap": true, - "sourceRoot": "../../../../../packages/kbn-i18n/src", - "types": [ - "jest", - "node" - ], - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "types/intl_format_cache.d.ts", - "types/intl_relativeformat.d.ts" - ], - "exclude": [ - "**/__fixtures__/**/*" - ] -} diff --git a/packages/kbn-i18n/tsconfig.json b/packages/kbn-i18n/tsconfig.json index 787e9b45123ac..68c02adf9aaea 100644 --- a/packages/kbn-i18n/tsconfig.json +++ b/packages/kbn-i18n/tsconfig.json @@ -1,12 +1,11 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, - "incremental": true, - "declarationDir": "./target_types", - "outDir": "./target_node", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "incremental": false, + "outDir": "./target_types", "sourceMap": true, "sourceRoot": "../../../../../packages/kbn-i18n/src", "types": [ diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 5a0b376c4cbc5..10ce4f7ab1d1f 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -8,12 +8,12 @@ pageLoadAssetSize: charts: 95000 cloud: 21076 console: 46091 - core: 432925 + core: 434325 crossClusterReplication: 65408 dashboard: 374194 dashboardEnhanced: 65646 dashboardMode: 22716 - data: 900000 + data: 824229 dataEnhanced: 50420 devTools: 38637 discover: 99999 @@ -24,6 +24,7 @@ pageLoadAssetSize: esUiShared: 326654 expressions: 224136 features: 21723 + fieldFormats: 92628 globalSearch: 29696 globalSearchBar: 50403 globalSearchProviders: 25554 @@ -33,6 +34,7 @@ pageLoadAssetSize: indexLifecycleManagement: 107090 indexManagement: 140608 indexPatternManagement: 28222 + indexPatternEditor: 25000 infra: 184320 fleet: 465774 ingestPipelines: 58003 @@ -107,7 +109,7 @@ pageLoadAssetSize: dataVisualizer: 27530 banners: 17946 mapsEms: 26072 - timelines: 330000 + timelines: 327300 screenshotMode: 17856 visTypePie: 35583 expressionRevealImage: 25675 @@ -116,5 +118,5 @@ pageLoadAssetSize: expressionRepeatImage: 22341 expressionImage: 19288 expressionMetric: 22238 - expressionShape: 30033 - userSetup: 18532 + expressionShape: 34008 + interactiveSetup: 18532 diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts b/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts index 2d0b0ec4a726c..d3d20edffa286 100644 --- a/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts +++ b/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts @@ -15,7 +15,7 @@ * setting, with which the user can change the index prefix. */ -export const ALERTS_CONSUMERS = { +export const AlertConsumers = { APM: 'apm', LOGS: 'logs', INFRASTRUCTURE: 'infrastructure', @@ -23,9 +23,9 @@ export const ALERTS_CONSUMERS = { SIEM: 'siem', SYNTHETICS: 'synthetics', } as const; -export type ALERTS_CONSUMERS = typeof ALERTS_CONSUMERS[keyof typeof ALERTS_CONSUMERS]; +export type AlertConsumers = typeof AlertConsumers[keyof typeof AlertConsumers]; -export const mapConsumerToIndexName: Record = { +export const mapConsumerToIndexName: Record = { apm: '.alerts-observability-apm', logs: '.alerts-observability.logs', infrastructure: '.alerts-observability.metrics', diff --git a/packages/kbn-rule-data-utils/src/technical_field_names.ts b/packages/kbn-rule-data-utils/src/technical_field_names.ts index 54a6fa26664e3..a29c1023caf67 100644 --- a/packages/kbn-rule-data-utils/src/technical_field_names.ts +++ b/packages/kbn-rule-data-utils/src/technical_field_names.ts @@ -8,79 +8,207 @@ import { ValuesType } from 'utility-types'; -const ALERT_NAMESPACE = 'kibana.rac.alert' as const; +const KIBANA_NAMESPACE = 'kibana' as const; -const TIMESTAMP = '@timestamp' as const; -const EVENT_KIND = 'event.kind' as const; +const ALERT_NAMESPACE = `${KIBANA_NAMESPACE}.alert` as const; +const ALERT_RULE_NAMESPACE = `${ALERT_NAMESPACE}.rule` as const; + +const CONSUMERS = `${KIBANA_NAMESPACE}.consumers` as const; +const ECS_VERSION = 'ecs.version' as const; const EVENT_ACTION = 'event.action' as const; -const RULE_UUID = 'rule.uuid' as const; +const EVENT_KIND = 'event.kind' as const; +const RULE_CATEGORY = 'rule.category' as const; +const RULE_CONSUMERS = 'rule.consumers' as const; const RULE_ID = 'rule.id' as const; const RULE_NAME = 'rule.name' as const; -const RULE_CATEGORY = 'rule.category' as const; +const RULE_UUID = 'rule.uuid' as const; +const SPACE_IDS = `${KIBANA_NAMESPACE}.space_ids` as const; const TAGS = 'tags' as const; -const PRODUCER = `${ALERT_NAMESPACE}.producer` as const; -const OWNER = `${ALERT_NAMESPACE}.owner` as const; -const ALERT_ID = `${ALERT_NAMESPACE}.id` as const; -const ALERT_UUID = `${ALERT_NAMESPACE}.uuid` as const; -const ALERT_START = `${ALERT_NAMESPACE}.start` as const; -const ALERT_END = `${ALERT_NAMESPACE}.end` as const; +const TIMESTAMP = '@timestamp' as const; +const VERSION = `${KIBANA_NAMESPACE}.version` as const; + +const ALERT_ACTION_GROUP = `${ALERT_NAMESPACE}.action_group` as const; const ALERT_DURATION = `${ALERT_NAMESPACE}.duration.us` as const; -const ALERT_SEVERITY_LEVEL = `${ALERT_NAMESPACE}.severity.level` as const; -const ALERT_SEVERITY_VALUE = `${ALERT_NAMESPACE}.severity.value` as const; -const ALERT_STATUS = `${ALERT_NAMESPACE}.status` as const; -const SPACE_IDS = 'kibana.space_ids' as const; +const ALERT_END = `${ALERT_NAMESPACE}.end` as const; const ALERT_EVALUATION_THRESHOLD = `${ALERT_NAMESPACE}.evaluation.threshold` as const; const ALERT_EVALUATION_VALUE = `${ALERT_NAMESPACE}.evaluation.value` as const; +const ALERT_ID = `${ALERT_NAMESPACE}.id` as const; +const ALERT_OWNER = `${ALERT_NAMESPACE}.owner` as const; +const ALERT_CONSUMERS = `${ALERT_NAMESPACE}.consumers` as const; +const ALERT_PRODUCER = `${ALERT_NAMESPACE}.producer` as const; const ALERT_REASON = `${ALERT_NAMESPACE}.reason` as const; +const ALERT_RISK_SCORE = `${ALERT_NAMESPACE}.risk_score` as const; +const ALERT_SEVERITY = `${ALERT_NAMESPACE}.severity` as const; +const ALERT_SEVERITY_LEVEL = `${ALERT_NAMESPACE}.severity.level` as const; +const ALERT_SEVERITY_VALUE = `${ALERT_NAMESPACE}.severity.value` as const; +const ALERT_START = `${ALERT_NAMESPACE}.start` as const; +const ALERT_STATUS = `${ALERT_NAMESPACE}.status` as const; +const ALERT_SYSTEM_STATUS = `${ALERT_NAMESPACE}.system_status` as const; +const ALERT_UUID = `${ALERT_NAMESPACE}.uuid` as const; +const ALERT_WORKFLOW_REASON = `${ALERT_NAMESPACE}.workflow_reason` as const; +const ALERT_WORKFLOW_STATUS = `${ALERT_NAMESPACE}.workflow_status` as const; +const ALERT_WORKFLOW_USER = `${ALERT_NAMESPACE}.workflow_user` as const; + +const ALERT_RULE_AUTHOR = `${ALERT_RULE_NAMESPACE}.author` as const; +const ALERT_RULE_CONSUMERS = `${ALERT_RULE_NAMESPACE}.consumers` as const; +const ALERT_RULE_CREATED_AT = `${ALERT_RULE_NAMESPACE}.created_at` as const; +const ALERT_RULE_CREATED_BY = `${ALERT_RULE_NAMESPACE}.created_by` as const; +const ALERT_RULE_DESCRIPTION = `${ALERT_RULE_NAMESPACE}.description` as const; +const ALERT_RULE_ENABLED = `${ALERT_RULE_NAMESPACE}.enabled` as const; +const ALERT_RULE_FROM = `${ALERT_RULE_NAMESPACE}.from` as const; +const ALERT_RULE_ID = `${ALERT_RULE_NAMESPACE}.id` as const; +const ALERT_RULE_INTERVAL = `${ALERT_RULE_NAMESPACE}.interval` as const; +const ALERT_RULE_LICENSE = `${ALERT_RULE_NAMESPACE}.license` as const; +const ALERT_RULE_NAME = `${ALERT_RULE_NAMESPACE}.name` as const; +const ALERT_RULE_NOTE = `${ALERT_RULE_NAMESPACE}.note` as const; +const ALERT_RULE_REFERENCES = `${ALERT_RULE_NAMESPACE}.references` as const; +const ALERT_RULE_RISK_SCORE = `${ALERT_RULE_NAMESPACE}.risk_score` as const; +const ALERT_RULE_RISK_SCORE_MAPPING = `${ALERT_RULE_NAMESPACE}.risk_score_mapping` as const; +const ALERT_RULE_RULE_ID = `${ALERT_RULE_NAMESPACE}.rule_id` as const; +const ALERT_RULE_RULE_NAME_OVERRIDE = `${ALERT_RULE_NAMESPACE}.rule_name_override` as const; +const ALERT_RULE_SEVERITY = `${ALERT_RULE_NAMESPACE}.severity` as const; +const ALERT_RULE_SEVERITY_MAPPING = `${ALERT_RULE_NAMESPACE}.severity_mapping` as const; +const ALERT_RULE_TAGS = `${ALERT_RULE_NAMESPACE}.tags` as const; +const ALERT_RULE_TO = `${ALERT_RULE_NAMESPACE}.to` as const; +const ALERT_RULE_TYPE = `${ALERT_RULE_NAMESPACE}.type` as const; +const ALERT_RULE_TYPE_ID = `${ALERT_RULE_NAMESPACE}.rule_type_id` as const; +const ALERT_RULE_UPDATED_AT = `${ALERT_RULE_NAMESPACE}.updated_at` as const; +const ALERT_RULE_UPDATED_BY = `${ALERT_RULE_NAMESPACE}.updated_by` as const; +const ALERT_RULE_VERSION = `${ALERT_RULE_NAMESPACE}.version` as const; + +const namespaces = { + KIBANA_NAMESPACE, + ALERT_NAMESPACE, + ALERT_RULE_NAMESPACE, +}; const fields = { - TIMESTAMP, + CONSUMERS, + ECS_VERSION, EVENT_KIND, EVENT_ACTION, - RULE_UUID, + RULE_CATEGORY, + RULE_CONSUMERS, RULE_ID, RULE_NAME, - RULE_CATEGORY, + RULE_UUID, TAGS, - PRODUCER, - OWNER, + TIMESTAMP, + ALERT_ACTION_GROUP, + ALERT_DURATION, + ALERT_END, + ALERT_EVALUATION_THRESHOLD, + ALERT_EVALUATION_VALUE, ALERT_ID, - ALERT_UUID, + ALERT_OWNER, + ALERT_CONSUMERS, + ALERT_PRODUCER, + ALERT_REASON, + ALERT_RISK_SCORE, + ALERT_RULE_AUTHOR, + ALERT_RULE_CONSUMERS, + ALERT_RULE_CREATED_AT, + ALERT_RULE_CREATED_BY, + ALERT_RULE_DESCRIPTION, + ALERT_RULE_ENABLED, + ALERT_RULE_FROM, + ALERT_RULE_ID, + ALERT_RULE_INTERVAL, + ALERT_RULE_LICENSE, + ALERT_RULE_NAME, + ALERT_RULE_NOTE, + ALERT_RULE_REFERENCES, + ALERT_RULE_RISK_SCORE, + ALERT_RULE_RISK_SCORE_MAPPING, + ALERT_RULE_RULE_ID, + ALERT_RULE_RULE_NAME_OVERRIDE, + ALERT_RULE_SEVERITY, + ALERT_RULE_SEVERITY_MAPPING, + ALERT_RULE_TAGS, + ALERT_RULE_TO, + ALERT_RULE_TYPE, + ALERT_RULE_TYPE_ID, + ALERT_RULE_UPDATED_AT, + ALERT_RULE_UPDATED_BY, + ALERT_RULE_VERSION, ALERT_START, - ALERT_END, - ALERT_DURATION, + ALERT_SEVERITY, ALERT_SEVERITY_LEVEL, ALERT_SEVERITY_VALUE, ALERT_STATUS, - ALERT_EVALUATION_THRESHOLD, - ALERT_EVALUATION_VALUE, - ALERT_REASON, + ALERT_SYSTEM_STATUS, + ALERT_UUID, + ALERT_WORKFLOW_REASON, + ALERT_WORKFLOW_STATUS, + ALERT_WORKFLOW_USER, SPACE_IDS, + VERSION, }; export { - TIMESTAMP, - EVENT_KIND, - EVENT_ACTION, - RULE_UUID, - RULE_ID, - RULE_NAME, - RULE_CATEGORY, - TAGS, - PRODUCER, - OWNER, - ALERT_ID, - ALERT_UUID, - ALERT_START, - ALERT_END, + ALERT_ACTION_GROUP, ALERT_DURATION, - ALERT_SEVERITY_LEVEL, - ALERT_SEVERITY_VALUE, - ALERT_STATUS, + ALERT_END, ALERT_EVALUATION_THRESHOLD, ALERT_EVALUATION_VALUE, + ALERT_ID, + ALERT_NAMESPACE, + ALERT_RULE_NAMESPACE, + ALERT_OWNER, + ALERT_CONSUMERS, + ALERT_PRODUCER, ALERT_REASON, + ALERT_RISK_SCORE, + ALERT_STATUS, + ALERT_WORKFLOW_REASON, + ALERT_WORKFLOW_STATUS, + ALERT_WORKFLOW_USER, + ALERT_RULE_AUTHOR, + ALERT_RULE_CONSUMERS, + ALERT_RULE_CREATED_AT, + ALERT_RULE_CREATED_BY, + ALERT_RULE_DESCRIPTION, + ALERT_RULE_ENABLED, + ALERT_RULE_FROM, + ALERT_RULE_ID, + ALERT_RULE_INTERVAL, + ALERT_RULE_LICENSE, + ALERT_RULE_NAME, + ALERT_RULE_NOTE, + ALERT_RULE_REFERENCES, + ALERT_RULE_RISK_SCORE, + ALERT_RULE_RISK_SCORE_MAPPING, + ALERT_RULE_RULE_ID, + ALERT_RULE_RULE_NAME_OVERRIDE, + ALERT_RULE_SEVERITY_MAPPING, + ALERT_RULE_TAGS, + ALERT_RULE_TO, + ALERT_RULE_TYPE, + ALERT_RULE_TYPE_ID, + ALERT_RULE_UPDATED_AT, + ALERT_RULE_UPDATED_BY, + ALERT_RULE_VERSION, + ALERT_RULE_SEVERITY, + ALERT_SEVERITY, + ALERT_SEVERITY_LEVEL, + ALERT_SEVERITY_VALUE, + ALERT_START, + ALERT_SYSTEM_STATUS, + ALERT_UUID, + CONSUMERS, + ECS_VERSION, + EVENT_ACTION, + EVENT_KIND, + KIBANA_NAMESPACE, + RULE_CATEGORY, + RULE_CONSUMERS, + RULE_ID, + RULE_NAME, + RULE_UUID, + TAGS, + TIMESTAMP, SPACE_IDS, + VERSION, }; -export type TechnicalRuleDataFieldName = ValuesType; +export type TechnicalRuleDataFieldName = ValuesType; diff --git a/packages/kbn-securitysolution-io-ts-types/src/enumeration/index.test.ts b/packages/kbn-securitysolution-io-ts-types/src/enumeration/index.test.ts new file mode 100644 index 0000000000000..c904618689ca9 --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-types/src/enumeration/index.test.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { left } from 'fp-ts/lib/Either'; +import { enumeration } from '.'; +import { foldLeftRight, getPaths } from '@kbn/securitysolution-io-ts-utils'; + +describe('enumeration', () => { + enum TestEnum { + 'test' = 'test', + } + + it('should validate a string from the enum', () => { + const input = TestEnum.test; + const codec = enumeration('TestEnum', TestEnum); + const decoded = codec.decode(input); + const message = foldLeftRight(decoded); + + expect(getPaths(left(message.errors))).toEqual([]); + expect(message.schema).toEqual(input); + }); + + it('should NOT validate a random string', () => { + const input = 'some string'; + const codec = enumeration('TestEnum', TestEnum); + const decoded = codec.decode(input); + const message = foldLeftRight(decoded); + + expect(getPaths(left(message.errors))).toEqual([ + 'Invalid value "some string" supplied to "TestEnum"', + ]); + expect(message.schema).toEqual({}); + }); +}); diff --git a/packages/kbn-securitysolution-io-ts-types/src/enumeration/index.ts b/packages/kbn-securitysolution-io-ts-types/src/enumeration/index.ts new file mode 100644 index 0000000000000..917d6d3bc6c01 --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-types/src/enumeration/index.ts @@ -0,0 +1,24 @@ +/* + * 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 * as t from 'io-ts'; + +export function enumeration( + name: string, + originalEnum: Record +): t.Type { + const isEnumValue = (input: unknown): input is EnumType => + Object.values(originalEnum).includes(input); + + return new t.Type( + name, + isEnumValue, + (input, context) => (isEnumValue(input) ? t.success(input) : t.failure(input, context)), + t.identity + ); +} diff --git a/packages/kbn-securitysolution-io-ts-types/src/index.ts b/packages/kbn-securitysolution-io-ts-types/src/index.ts index 2847894d63690..b85bff63fe2a7 100644 --- a/packages/kbn-securitysolution-io-ts-types/src/index.ts +++ b/packages/kbn-securitysolution-io-ts-types/src/index.ts @@ -15,15 +15,16 @@ export * from './default_string_boolean_false'; export * from './default_uuid'; export * from './default_version_number'; export * from './empty_string_array'; +export * from './enumeration'; export * from './iso_date_string'; export * from './non_empty_array'; export * from './non_empty_or_nullable_string_array'; -export * from './non_empty_string'; export * from './non_empty_string_array'; -export * from './operator'; +export * from './non_empty_string'; export * from './only_false_allowed'; -export * from './positive_integer'; +export * from './operator'; export * from './positive_integer_greater_than_zero'; +export * from './positive_integer'; export * from './string_to_positive_number'; export * from './uuid'; export * from './version'; diff --git a/packages/kbn-server-http-tools/.babelrc b/packages/kbn-server-http-tools/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-server-http-tools/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-server-http-tools/BUILD.bazel b/packages/kbn-server-http-tools/BUILD.bazel index d654527b2658a..2e1a33f647430 100644 --- a/packages/kbn-server-http-tools/BUILD.bazel +++ b/packages/kbn-server-http-tools/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-server-http-tools" PKG_REQUIRE_NAME = "@kbn/server-http-tools" @@ -25,7 +26,7 @@ NPM_MODULE_EXTRA_FILES = [ "README.md" ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-config-schema", "//packages/kbn-crypto", "@npm//@hapi/hapi", @@ -36,13 +37,24 @@ SRC_DEPS = [ ] TYPES_DEPS = [ + "//packages/kbn-config-schema", + "//packages/kbn-crypto", + "@npm//@hapi/hapi", + "@npm//@hapi/hoek", + "@npm//joi", + "@npm//moment", "@npm//@types/hapi__hapi", + "@npm//@types/jest", "@npm//@types/joi", "@npm//@types/node", "@npm//@types/uuid", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -53,14 +65,15 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - incremental = True, - out_dir = "target", + emit_declaration_only = True, + incremental = False, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -69,7 +82,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-server-http-tools/package.json b/packages/kbn-server-http-tools/package.json index 7ec52743f027e..9255dfe5c8d21 100644 --- a/packages/kbn-server-http-tools/package.json +++ b/packages/kbn-server-http-tools/package.json @@ -1,7 +1,7 @@ { "name": "@kbn/server-http-tools", - "main": "./target/index.js", - "types": "./target/index.d.ts", + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true diff --git a/packages/kbn-server-http-tools/tsconfig.json b/packages/kbn-server-http-tools/tsconfig.json index e1d3d61644bfe..643b932073c9e 100644 --- a/packages/kbn-server-http-tools/tsconfig.json +++ b/packages/kbn-server-http-tools/tsconfig.json @@ -1,10 +1,11 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "incremental": true, - "outDir": "./target", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "incremental": false, + "outDir": "./target", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-server-http-tools/src", diff --git a/packages/kbn-server-route-repository/.babelrc b/packages/kbn-server-route-repository/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-server-route-repository/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-server-route-repository/BUILD.bazel b/packages/kbn-server-route-repository/BUILD.bazel index 3a146086e80bc..147b72c65f954 100644 --- a/packages/kbn-server-route-repository/BUILD.bazel +++ b/packages/kbn-server-route-repository/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-server-route-repository" PKG_REQUIRE_NAME = "@kbn/server-route-repository" @@ -25,23 +26,31 @@ NPM_MODULE_EXTRA_FILES = [ "README.md" ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-config-schema", "//packages/kbn-io-ts-utils", "@npm//@hapi/boom", "@npm//fp-ts", - "@npm//io-ts", "@npm//lodash", "@npm//utility-types" ] TYPES_DEPS = [ + "//packages/kbn-config-schema", + "//packages/kbn-io-ts-utils", + "@npm//@hapi/boom", + "@npm//fp-ts", + "@npm//utility-types", "@npm//@types/jest", "@npm//@types/lodash", "@npm//@types/node", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -52,14 +61,15 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - incremental = True, - out_dir = "target", + emit_declaration_only = True, + incremental = False, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -68,7 +78,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-server-route-repository/package.json b/packages/kbn-server-route-repository/package.json index cfeab275e19cf..920abc2a3836f 100644 --- a/packages/kbn-server-route-repository/package.json +++ b/packages/kbn-server-route-repository/package.json @@ -1,7 +1,7 @@ { "name": "@kbn/server-route-repository", - "main": "./target/index.js", - "types": "./target/index.d.ts", + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true diff --git a/packages/kbn-server-route-repository/tsconfig.json b/packages/kbn-server-route-repository/tsconfig.json index 7614a9411602e..947744bc68d42 100644 --- a/packages/kbn-server-route-repository/tsconfig.json +++ b/packages/kbn-server-route-repository/tsconfig.json @@ -1,13 +1,15 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "incremental": true, - "outDir": "./target", - "stripInternal": false, "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "incremental": false, + "outDir": "./target_types", + "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-server-route-repository/src", + "stripInternal": false, "types": [ "jest", "node" @@ -15,6 +17,6 @@ "noUnusedLocals": false }, "include": [ - "./src/**/*.ts" + "src/**/*.ts" ] } diff --git a/packages/kbn-telemetry-tools/.babelrc b/packages/kbn-telemetry-tools/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-telemetry-tools/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-telemetry-tools/BUILD.bazel b/packages/kbn-telemetry-tools/BUILD.bazel index cf71b3e197dad..f90ca9b22dc92 100644 --- a/packages/kbn-telemetry-tools/BUILD.bazel +++ b/packages/kbn-telemetry-tools/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-telemetry-tools" PKG_REQUIRE_NAME = "@kbn/telemetry-tools" @@ -28,29 +29,30 @@ NPM_MODULE_EXTRA_FILES = [ "GUIDELINE.md", ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-dev-utils", "//packages/kbn-utility-types", "@npm//glob", "@npm//listr", "@npm//normalize-path", - "@npm//tslib", ] TYPES_DEPS = [ - "@npm//@types/flot", + "//packages/kbn-dev-utils", + "//packages/kbn-utility-types", "@npm//@types/glob", "@npm//@types/jest", "@npm//@types/listr", "@npm//@types/lodash", "@npm//@types/node", "@npm//@types/normalize-path", - "@npm//@types/testing-library__jest-dom", - "@npm//resize-observer-polyfill", - "@npm//@emotion/react", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -61,14 +63,15 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - incremental = True, - out_dir = "target", + emit_declaration_only = True, + incremental = False, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -77,7 +80,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-telemetry-tools/package.json b/packages/kbn-telemetry-tools/package.json index cd3fd3aa966c7..cb281524abefe 100644 --- a/packages/kbn-telemetry-tools/package.json +++ b/packages/kbn-telemetry-tools/package.json @@ -2,8 +2,8 @@ "name": "@kbn/telemetry-tools", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", - "main": "./target/index.js", - "types": "./target/index.d.ts", + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts", "private": true, "kibana": { "devOnly": true diff --git a/packages/kbn-telemetry-tools/tsconfig.json b/packages/kbn-telemetry-tools/tsconfig.json index 3c0e04ded359d..1f1b4aea5d5c6 100644 --- a/packages/kbn-telemetry-tools/tsconfig.json +++ b/packages/kbn-telemetry-tools/tsconfig.json @@ -1,14 +1,15 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "incremental": true, - "outDir": "./target", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "incremental": false, + "isolatedModules": true, + "outDir": "./target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-telemetry-tools/src", - "isolatedModules": true, "types": [ "jest", "node" diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index af836d4436a1a..d2bc11f4db877 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -4843,20 +4843,29 @@ exports[`Header renders 1`] = ` truncate={true} > diff --git a/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap index 5080b23e99c25..eb90df831fabc 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap @@ -1,34 +1,54 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`HeaderBreadcrumbs renders updates to the breadcrumbs$ observable 1`] = ` - - First - + + + First + + + `; exports[`HeaderBreadcrumbs renders updates to the breadcrumbs$ observable 2`] = ` Array [ - - First - , - + + First + + + , +
  • - Second - , + + + Second + + +
  • , ] `; diff --git a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap index cd8c669aae235..f723cf5bca23a 100644 --- a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap +++ b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap @@ -17,7 +17,8 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiBottomBar.customScreenReaderAnnouncement": [Function], "euiBottomBar.screenReaderAnnouncement": "There is a new region landmark with page level controls at the end of the document.", "euiBottomBar.screenReaderHeading": "Page level controls", - "euiBreadcrumbs.collapsedBadge.ariaLabel": "Show collapsed breadcrumbs", + "euiBreadcrumbs.collapsedBadge.ariaLabel": "See collapsed breadcrumbs", + "euiBreadcrumbs.nav.ariaLabel": "Breadcrumbs", "euiCardSelect.select": "Select", "euiCardSelect.selected": "Selected", "euiCardSelect.unavailable": "Unavailable", @@ -193,11 +194,13 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiSelectableTemplateSitewide.searchPlaceholder": "Search for anything...", "euiStat.loadingText": "Statistic is loading", "euiStepStrings.complete": [Function], + "euiStepStrings.current": [Function], "euiStepStrings.disabled": [Function], "euiStepStrings.errors": [Function], "euiStepStrings.incomplete": [Function], "euiStepStrings.loading": [Function], "euiStepStrings.simpleComplete": [Function], + "euiStepStrings.simpleCurrent": [Function], "euiStepStrings.simpleDisabled": [Function], "euiStepStrings.simpleErrors": [Function], "euiStepStrings.simpleIncomplete": [Function], diff --git a/src/core/public/i18n/i18n_eui_mapping.tsx b/src/core/public/i18n/i18n_eui_mapping.tsx index 3372146894edb..0a6c7a05e1c75 100644 --- a/src/core/public/i18n/i18n_eui_mapping.tsx +++ b/src/core/public/i18n/i18n_eui_mapping.tsx @@ -92,10 +92,14 @@ export const getEuiContextMapping = (): EuiTokensObject => { 'euiBreadcrumbs.collapsedBadge.ariaLabel': i18n.translate( 'core.euiBreadcrumbs.collapsedBadge.ariaLabel', { - defaultMessage: 'Show collapsed breadcrumbs', + defaultMessage: 'See collapsed breadcrumbs', description: 'Displayed when one or more breadcrumbs are hidden.', } ), + 'euiBreadcrumbs.nav.ariaLabel': i18n.translate('core.euiBreadcrumbs.nav.ariaLabel', { + defaultMessage: 'Breadcrumbs', + description: 'Label on the breadcrumbs nav element', + }), 'euiCardSelect.select': i18n.translate('core.euiCardSelect.select', { defaultMessage: 'Select', description: 'Displayed button text when a card option can be selected.', @@ -932,11 +936,21 @@ export const getEuiContextMapping = (): EuiTokensObject => { defaultMessage: 'Step {number}: {title} is complete', values: { number, title }, }), + 'euiStepStrings.current': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.current', { + defaultMessage: 'Current step {number}: {title}', + values: { number, title }, + }), 'euiStepStrings.simpleComplete': ({ number }: EuiValues) => i18n.translate('core.euiStepStrings.simpleComplete', { defaultMessage: 'Step {number} is complete', values: { number }, }), + 'euiStepStrings.simpleCurrent': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleCurrent', { + defaultMessage: 'Current step is {number}', + values: { number }, + }), 'euiStepStrings.warning': ({ number, title }: EuiValues) => i18n.translate('core.euiStepStrings.warning', { defaultMessage: 'Step {number}: {title} has warnings', diff --git a/src/core/public/overlays/flyout/flyout_service.tsx b/src/core/public/overlays/flyout/flyout_service.tsx index 603736f08268f..b41b85e5f429f 100644 --- a/src/core/public/overlays/flyout/flyout_service.tsx +++ b/src/core/public/overlays/flyout/flyout_service.tsx @@ -84,6 +84,7 @@ export interface OverlayFlyoutOpenOptions { 'data-test-subj'?: string; size?: EuiFlyoutSize; maxWidth?: boolean | number | string; + hideCloseButton?: boolean; } interface StartDeps { diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 8e0087cbeeed0..80fd3927e05a3 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -1027,6 +1027,8 @@ export interface OverlayFlyoutOpenOptions { // (undocumented) closeButtonAriaLabel?: string; // (undocumented) + hideCloseButton?: boolean; + // (undocumented) maxWidth?: boolean | number | string; // (undocumented) ownFocus?: boolean; diff --git a/src/core/server/elasticsearch/client/configure_client.ts b/src/core/server/elasticsearch/client/configure_client.ts index 18c9724c2f8f4..f2953862c25e0 100644 --- a/src/core/server/elasticsearch/client/configure_client.ts +++ b/src/core/server/elasticsearch/client/configure_client.ts @@ -50,6 +50,12 @@ export const configureClient = ( const client = new Client({ ...clientOptions, Transport: KibanaTransport }); addLogging(client, logger.get('query', type)); + // ------------------------------------------------------------------------ // + // Hack to disable the "Product check" while the bugs in // + // https://github.com/elastic/kibana/issues/105557 are handled. // + skipProductCheck(client); + // ------------------------------------------------------------------------ // + return client; }; @@ -112,3 +118,21 @@ const addLogging = (client: Client, logger: Logger) => { } }); }; + +/** + * Hack to skip the Product Check performed by the Elasticsearch-js client. + * We noticed a couple of bugs that may need to be fixed before taking full + * advantage of this feature. + * + * The bugs are detailed in this issue: https://github.com/elastic/kibana/issues/105557 + * + * The hack is copied from the test/utils in the elasticsearch-js repo + * (https://github.com/elastic/elasticsearch-js/blob/master/test/utils/index.js#L45-L56) + */ +function skipProductCheck(client: Client) { + const tSymbol = Object.getOwnPropertySymbols(client.transport || client).filter( + (symbol) => symbol.description === 'product check' + )[0]; + // @ts-expect-error `tSymbol` is missing in the index signature of Transport + (client.transport || client)[tSymbol] = 2; +} diff --git a/src/core/server/plugins/plugin.test.ts b/src/core/server/plugins/plugin.test.ts index 610bc1cac5a3b..31706e01e4b84 100644 --- a/src/core/server/plugins/plugin.test.ts +++ b/src/core/server/plugins/plugin.test.ts @@ -39,6 +39,11 @@ jest.doMock(join('plugin-with-wrong-initializer-path', 'server'), () => ({ plugi virtual: true, }); +const OSS_PLUGIN_PATH_POSIX = '/kibana/src/plugins/ossPlugin'; +const OSS_PLUGIN_PATH_WINDOWS = 'C:\\kibana\\src\\plugins\\ossPlugin'; +const XPACK_PLUGIN_PATH_POSIX = '/kibana/x-pack/plugins/xPackPlugin'; +const XPACK_PLUGIN_PATH_WINDOWS = 'C:\\kibana\\x-pack\\plugins\\xPackPlugin'; + function createPluginManifest(manifestProps: Partial = {}): PluginManifest { return { id: 'some-plugin-id', @@ -97,10 +102,49 @@ test('`constructor` correctly initializes plugin instance', () => { expect(plugin.name).toBe('some-plugin-id'); expect(plugin.configPath).toBe('path'); expect(plugin.path).toBe('some-plugin-path'); + expect(plugin.source).toBe('external'); // see below for test cases for non-external sources (OSS and X-Pack) expect(plugin.requiredPlugins).toEqual(['some-required-dep']); expect(plugin.optionalPlugins).toEqual(['some-optional-dep']); }); +describe('`constructor` correctly sets non-external source', () => { + function createPlugin(path: string) { + const manifest = createPluginManifest(); + const opaqueId = Symbol(); + return new PluginWrapper({ + path, + manifest, + opaqueId, + initializerContext: createPluginInitializerContext( + coreContext, + opaqueId, + manifest, + instanceInfo + ), + }); + } + + test('for OSS plugin in POSIX', () => { + const plugin = createPlugin(OSS_PLUGIN_PATH_POSIX); + expect(plugin.source).toBe('oss'); + }); + + test('for OSS plugin in Windows', () => { + const plugin = createPlugin(OSS_PLUGIN_PATH_WINDOWS); + expect(plugin.source).toBe('oss'); + }); + + test('for X-Pack plugin in POSIX', () => { + const plugin = createPlugin(XPACK_PLUGIN_PATH_POSIX); + expect(plugin.source).toBe('x-pack'); + }); + + test('for X-Pack plugin in Windows', () => { + const plugin = createPlugin(XPACK_PLUGIN_PATH_WINDOWS); + expect(plugin.source).toBe('x-pack'); + }); +}); + test('`setup` fails if `plugin` initializer is not exported', () => { const manifest = createPluginManifest(); const opaqueId = Symbol(); diff --git a/src/core/server/plugins/plugin.ts b/src/core/server/plugins/plugin.ts index 76ed4f8f24b3d..dc861b4489dcf 100644 --- a/src/core/server/plugins/plugin.ts +++ b/src/core/server/plugins/plugin.ts @@ -27,6 +27,9 @@ import { } from './types'; import { CorePreboot, CoreSetup, CoreStart } from '..'; +const OSS_PATH_REGEX = /[\/|\\]src[\/|\\]plugins[\/|\\]/; // Matches src/plugins directory on POSIX and Windows +const XPACK_PATH_REGEX = /[\/|\\]x-pack[\/|\\]plugins[\/|\\]/; // Matches x-pack/plugins directory on POSIX and Windows + /** * Lightweight wrapper around discovered plugin that is responsible for instantiating * plugin and dispatching proper context and dependencies into plugin's lifecycle hooks. @@ -40,6 +43,7 @@ export class PluginWrapper< TPluginsStart extends object = object > { public readonly path: string; + public readonly source: 'oss' | 'x-pack' | 'external'; public readonly manifest: PluginManifest; public readonly opaqueId: PluginOpaqueId; public readonly name: PluginManifest['id']; @@ -70,6 +74,7 @@ export class PluginWrapper< } ) { this.path = params.path; + this.source = getPluginSource(params.path); this.manifest = params.manifest; this.opaqueId = params.opaqueId; this.initializerContext = params.initializerContext; @@ -204,3 +209,12 @@ export class PluginWrapper< return this.manifest.type === PluginType.preboot; } } + +function getPluginSource(path: string): 'oss' | 'x-pack' | 'external' { + if (OSS_PATH_REGEX.test(path)) { + return 'oss'; + } else if (XPACK_PATH_REGEX.test(path)) { + return 'x-pack'; + } + return 'external'; +} diff --git a/src/core/server/plugins/plugins_service.test.ts b/src/core/server/plugins/plugins_service.test.ts index 3cd645cb74ac0..a9827dc60fb78 100644 --- a/src/core/server/plugins/plugins_service.test.ts +++ b/src/core/server/plugins/plugins_service.test.ts @@ -52,6 +52,15 @@ expect.addSnapshotSerializer(createAbsolutePathSerializer()); }); }); +const OSS_PLUGIN_PATH = '/kibana/src/plugins/ossPlugin'; +const XPACK_PLUGIN_PATH = '/kibana/x-pack/plugins/xPackPlugin'; +const EXTERNAL_PLUGIN_PATH = '/kibana/plugins/externalPlugin'; +[OSS_PLUGIN_PATH, XPACK_PLUGIN_PATH, EXTERNAL_PLUGIN_PATH].forEach((path) => { + jest.doMock(join(path, 'server'), () => ({}), { + virtual: true, + }); +}); + const createPlugin = ( id: string, { @@ -247,6 +256,75 @@ describe('PluginsService', () => { expect(standardMockPluginSystem.setupPlugins).not.toHaveBeenCalled(); }); + describe('X-Pack dependencies', () => { + function mockDiscoveryResults(params: { sourcePluginPath: string; dependencyType: string }) { + const { sourcePluginPath, dependencyType } = params; + // Each plugin's source is derived from its path; the PluginWrapper test suite contains more detailed test cases around the paths (for both POSIX and Windows) + mockDiscover.mockReturnValue({ + error$: from([]), + plugin$: from([ + createPlugin('sourcePlugin', { + path: sourcePluginPath, + version: 'some-version', + configPath: 'path', + requiredPlugins: dependencyType === 'requiredPlugin' ? ['xPackPlugin'] : [], + requiredBundles: dependencyType === 'requiredBundle' ? ['xPackPlugin'] : undefined, + optionalPlugins: dependencyType === 'optionalPlugin' ? ['xPackPlugin'] : [], + }), + createPlugin('xPackPlugin', { + path: XPACK_PLUGIN_PATH, + version: 'some-version', + configPath: 'path', + requiredPlugins: [], + optionalPlugins: [], + }), + ]), + }); + } + + async function expectError() { + await expect(pluginsService.discover({ environment: environmentPreboot })).rejects.toThrow( + `X-Pack plugin or bundle with id "xPackPlugin" is required by OSS plugin "sourcePlugin", which is prohibited. Consider making this an optional dependency instead.` + ); + expect(standardMockPluginSystem.addPlugin).not.toHaveBeenCalled(); + } + async function expectSuccess() { + await expect(pluginsService.discover({ environment: environmentPreboot })).resolves.toEqual( + expect.anything() + ); + expect(standardMockPluginSystem.addPlugin).toHaveBeenCalled(); + } + + it('throws if an OSS plugin requires an X-Pack plugin or bundle', async () => { + for (const dependencyType of ['requiredPlugin', 'requiredBundle']) { + mockDiscoveryResults({ sourcePluginPath: OSS_PLUGIN_PATH, dependencyType }); + await expectError(); + } + }); + + it('does not throw if an OSS plugin has an optional dependency on an X-Pack plugin', async () => { + mockDiscoveryResults({ + sourcePluginPath: OSS_PLUGIN_PATH, + dependencyType: 'optionalPlugin', + }); + await expectSuccess(); + }); + + it('does not throw if an X-Pack plugin depends on an X-Pack plugin or bundle', async () => { + for (const dependencyType of ['requiredPlugin', 'requiredBundle', 'optionalPlugin']) { + mockDiscoveryResults({ sourcePluginPath: XPACK_PLUGIN_PATH, dependencyType }); + await expectSuccess(); + } + }); + + it('does not throw if an external plugin depends on an X-Pack plugin or bundle', async () => { + for (const dependencyType of ['requiredPlugin', 'requiredBundle', 'optionalPlugin']) { + mockDiscoveryResults({ sourcePluginPath: EXTERNAL_PLUGIN_PATH, dependencyType }); + await expectSuccess(); + } + }); + }); + it('properly detects plugins that should be disabled.', async () => { jest .spyOn(configService, 'isEnabledAtPath') diff --git a/src/core/server/plugins/plugins_service.ts b/src/core/server/plugins/plugins_service.ts index 05bb60fb22c6d..9def7554ccd09 100644 --- a/src/core/server/plugins/plugins_service.ts +++ b/src/core/server/plugins/plugins_service.ts @@ -314,27 +314,7 @@ export class PluginsService implements CoreService + ) { + const { name, manifest, requiredBundles, requiredPlugins } = plugin; + + // validate that `requiredBundles` ids point to a discovered plugin which `includesUiPlugin` + for (const requiredBundleId of requiredBundles) { + if (!pluginEnableStatuses.has(requiredBundleId)) { + throw new Error( + `Plugin bundle with id "${requiredBundleId}" is required by plugin "${name}" but it is missing.` + ); + } + + const requiredPlugin = pluginEnableStatuses.get(requiredBundleId)!.plugin; + if (!requiredPlugin.includesUiPlugin) { + throw new Error( + `Plugin bundle with id "${requiredBundleId}" is required by plugin "${name}" but it doesn't have a UI bundle.` + ); + } + + if (requiredPlugin.manifest.type !== plugin.manifest.type) { + throw new Error( + `Plugin bundle with id "${requiredBundleId}" is required by plugin "${name}" and expected to have "${manifest.type}" type, but its type is "${requiredPlugin.manifest.type}".` + ); + } + } + + // validate that OSS plugins do not have required dependencies on X-Pack plugins + if (plugin.source === 'oss') { + for (const id of [...requiredPlugins, ...requiredBundles]) { + const requiredPlugin = pluginEnableStatuses.get(id); + if (requiredPlugin && requiredPlugin.plugin.source === 'x-pack') { + throw new Error( + `X-Pack plugin or bundle with id "${id}" is required by OSS plugin "${name}", which is prohibited. Consider making this an optional dependency instead.` + ); + } + } + } + } + private shouldEnablePlugin( pluginName: PluginName, pluginEnableStatuses: Map, diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.test.mock.ts b/src/core/server/saved_objects/migrations/core/document_migrator.test.mock.ts new file mode 100644 index 0000000000000..ee0b18af5ac0d --- /dev/null +++ b/src/core/server/saved_objects/migrations/core/document_migrator.test.mock.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 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. + */ + +const mockGetConvertedObjectId = jest.fn().mockReturnValue('uuidv5'); +jest.mock('../../service/lib/utils', () => { + const actual = jest.requireActual('../../service/lib/utils'); + return { + ...actual, + SavedObjectsUtils: { + ...actual.SavedObjectsUtils, + getConvertedObjectId: mockGetConvertedObjectId, + }, + }; +}); + +export { mockGetConvertedObjectId }; diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.test.ts b/src/core/server/saved_objects/migrations/core/document_migrator.test.ts index 87b8ee0809064..64c1c4ce2fa9f 100644 --- a/src/core/server/saved_objects/migrations/core/document_migrator.test.ts +++ b/src/core/server/saved_objects/migrations/core/document_migrator.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { mockUuidv5 } from './__mocks__'; +import { mockGetConvertedObjectId } from './document_migrator.test.mock'; import { set } from '@elastic/safer-lodash-set'; import _ from 'lodash'; import { SavedObjectUnsanitizedDoc } from '../../serialization'; @@ -37,7 +37,7 @@ const createRegistry = (...types: Array>) => { }; beforeEach(() => { - mockUuidv5.mockClear(); + mockGetConvertedObjectId.mockClear(); }); describe('DocumentMigrator', () => { @@ -866,7 +866,7 @@ describe('DocumentMigrator', () => { namespace: 'foo-namespace', }; const actual = migrator.migrate(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual({ id: 'cowardly', type: 'dog', @@ -898,7 +898,7 @@ describe('DocumentMigrator', () => { it('in the default space', () => { const actual = migrator.migrateAndConvert(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual([ { id: 'bad', @@ -912,8 +912,8 @@ describe('DocumentMigrator', () => { it('in a non-default space', () => { const actual = migrator.migrateAndConvert({ ...obj, namespace: 'foo-namespace' }); - expect(mockUuidv5).toHaveBeenCalledTimes(1); - expect(mockUuidv5).toHaveBeenCalledWith('foo-namespace:toy:favorite', 'DNSUUID'); + expect(mockGetConvertedObjectId).toHaveBeenCalledTimes(1); + expect(mockGetConvertedObjectId).toHaveBeenCalledWith('foo-namespace', 'toy', 'favorite'); expect(actual).toEqual([ { id: 'bad', @@ -946,7 +946,7 @@ describe('DocumentMigrator', () => { it('in the default space', () => { const actual = migrator.migrateAndConvert(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual([ { id: 'loud', @@ -961,8 +961,8 @@ describe('DocumentMigrator', () => { it('in a non-default space', () => { const actual = migrator.migrateAndConvert({ ...obj, namespace: 'foo-namespace' }); - expect(mockUuidv5).toHaveBeenCalledTimes(1); - expect(mockUuidv5).toHaveBeenCalledWith('foo-namespace:dog:loud', 'DNSUUID'); + expect(mockGetConvertedObjectId).toHaveBeenCalledTimes(1); + expect(mockGetConvertedObjectId).toHaveBeenCalledWith('foo-namespace', 'dog', 'loud'); expect(actual).toEqual([ { id: 'uuidv5', @@ -1008,7 +1008,7 @@ describe('DocumentMigrator', () => { it('in the default space', () => { const actual = migrator.migrateAndConvert(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual([ { id: 'cute', @@ -1024,9 +1024,19 @@ describe('DocumentMigrator', () => { it('in a non-default space', () => { const actual = migrator.migrateAndConvert({ ...obj, namespace: 'foo-namespace' }); - expect(mockUuidv5).toHaveBeenCalledTimes(2); - expect(mockUuidv5).toHaveBeenNthCalledWith(1, 'foo-namespace:toy:favorite', 'DNSUUID'); - expect(mockUuidv5).toHaveBeenNthCalledWith(2, 'foo-namespace:dog:cute', 'DNSUUID'); + expect(mockGetConvertedObjectId).toHaveBeenCalledTimes(2); + expect(mockGetConvertedObjectId).toHaveBeenNthCalledWith( + 1, + 'foo-namespace', + 'toy', + 'favorite' + ); + expect(mockGetConvertedObjectId).toHaveBeenNthCalledWith( + 2, + 'foo-namespace', + 'dog', + 'cute' + ); expect(actual).toEqual([ { id: 'uuidv5', @@ -1080,7 +1090,7 @@ describe('DocumentMigrator', () => { it('in the default space', () => { const actual = migrator.migrateAndConvert(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual([ { id: 'sleepy', @@ -1095,8 +1105,8 @@ describe('DocumentMigrator', () => { it('in a non-default space', () => { const actual = migrator.migrateAndConvert({ ...obj, namespace: 'foo-namespace' }); - expect(mockUuidv5).toHaveBeenCalledTimes(1); - expect(mockUuidv5).toHaveBeenCalledWith('foo-namespace:toy:favorite', 'DNSUUID'); + expect(mockGetConvertedObjectId).toHaveBeenCalledTimes(1); + expect(mockGetConvertedObjectId).toHaveBeenCalledWith('foo-namespace', 'toy', 'favorite'); expect(actual).toEqual([ { id: 'sleepy', @@ -1134,7 +1144,7 @@ describe('DocumentMigrator', () => { it('in the default space', () => { const actual = migrator.migrateAndConvert(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual([ { id: 'hungry', @@ -1149,8 +1159,8 @@ describe('DocumentMigrator', () => { it('in a non-default space', () => { const actual = migrator.migrateAndConvert({ ...obj, namespace: 'foo-namespace' }); - expect(mockUuidv5).toHaveBeenCalledTimes(1); - expect(mockUuidv5).toHaveBeenCalledWith('foo-namespace:dog:hungry', 'DNSUUID'); + expect(mockGetConvertedObjectId).toHaveBeenCalledTimes(1); + expect(mockGetConvertedObjectId).toHaveBeenCalledWith('foo-namespace', 'dog', 'hungry'); expect(actual).toEqual([ { id: 'uuidv5', @@ -1204,7 +1214,7 @@ describe('DocumentMigrator', () => { it('in the default space', () => { const actual = migrator.migrateAndConvert(obj); - expect(mockUuidv5).not.toHaveBeenCalled(); + expect(mockGetConvertedObjectId).not.toHaveBeenCalled(); expect(actual).toEqual([ { id: 'pretty', @@ -1220,9 +1230,19 @@ describe('DocumentMigrator', () => { it('in a non-default space', () => { const actual = migrator.migrateAndConvert({ ...obj, namespace: 'foo-namespace' }); - expect(mockUuidv5).toHaveBeenCalledTimes(2); - expect(mockUuidv5).toHaveBeenNthCalledWith(1, 'foo-namespace:toy:favorite', 'DNSUUID'); - expect(mockUuidv5).toHaveBeenNthCalledWith(2, 'foo-namespace:dog:pretty', 'DNSUUID'); + expect(mockGetConvertedObjectId).toHaveBeenCalledTimes(2); + expect(mockGetConvertedObjectId).toHaveBeenNthCalledWith( + 1, + 'foo-namespace', + 'toy', + 'favorite' + ); + expect(mockGetConvertedObjectId).toHaveBeenNthCalledWith( + 2, + 'foo-namespace', + 'dog', + 'pretty' + ); expect(actual).toEqual([ { id: 'uuidv5', diff --git a/src/core/server/saved_objects/migrations/core/document_migrator.ts b/src/core/server/saved_objects/migrations/core/document_migrator.ts index 23f5d075d72e3..040aa81cdab3a 100644 --- a/src/core/server/saved_objects/migrations/core/document_migrator.ts +++ b/src/core/server/saved_objects/migrations/core/document_migrator.ts @@ -65,7 +65,7 @@ import { MigrationLogger } from './migration_logger'; import { TransformSavedObjectDocumentError } from '.'; import { ISavedObjectTypeRegistry } from '../../saved_objects_type_registry'; import { SavedObjectMigrationFn, SavedObjectMigrationMap } from '../types'; -import { DEFAULT_NAMESPACE_STRING } from '../../service/lib/utils'; +import { DEFAULT_NAMESPACE_STRING, SavedObjectsUtils } from '../../service/lib/utils'; import { LegacyUrlAlias, LEGACY_URL_ALIAS_TYPE } from '../../object_types'; const DEFAULT_MINIMUM_CONVERT_VERSION = '8.0.0'; @@ -556,7 +556,7 @@ function convertNamespaceType(doc: SavedObjectUnsanitizedDoc) { } const { id: originId, type } = otherAttrs; - const id = deterministicallyRegenerateObjectId(namespace, type, originId!); + const id = SavedObjectsUtils.getConvertedObjectId(namespace, type, originId!); if (namespace !== undefined) { const legacyUrlAlias: SavedObjectUnsanitizedDoc = { id: `${namespace}:${type}:${originId}`, @@ -616,7 +616,9 @@ function getReferenceTransforms(typeRegistry: ISavedObjectTypeRegistry): Transfo references: references.map(({ type, id, ...attrs }) => ({ ...attrs, type, - id: types.has(type) ? deterministicallyRegenerateObjectId(namespace, type, id) : id, + id: types.has(type) + ? SavedObjectsUtils.getConvertedObjectId(namespace, type, id) + : id, })), }, additionalDocs: [], diff --git a/src/core/server/saved_objects/migrations/core/__mocks__/index.ts b/src/core/server/saved_objects/service/lib/utils.test.mock.ts similarity index 80% rename from src/core/server/saved_objects/migrations/core/__mocks__/index.ts rename to src/core/server/saved_objects/service/lib/utils.test.mock.ts index d290bc57e2669..9e2b5c66bc91a 100644 --- a/src/core/server/saved_objects/migrations/core/__mocks__/index.ts +++ b/src/core/server/saved_objects/service/lib/utils.test.mock.ts @@ -6,8 +6,11 @@ * Side Public License, v 1. */ +const mockUuidv1 = jest.fn().mockReturnValue('uuidv1'); +jest.mock('uuid/v1', () => mockUuidv1); + const mockUuidv5 = jest.fn().mockReturnValue('uuidv5'); Object.defineProperty(mockUuidv5, 'DNS', { value: 'DNSUUID', writable: false }); jest.mock('uuid/v5', () => mockUuidv5); -export { mockUuidv5 }; +export { mockUuidv1, mockUuidv5 }; diff --git a/src/core/server/saved_objects/service/lib/utils.test.ts b/src/core/server/saved_objects/service/lib/utils.test.ts index 7101eafc72a32..0f502d8bfb9f1 100644 --- a/src/core/server/saved_objects/service/lib/utils.test.ts +++ b/src/core/server/saved_objects/service/lib/utils.test.ts @@ -6,14 +6,11 @@ * Side Public License, v 1. */ -import uuid from 'uuid'; +import { mockUuidv1, mockUuidv5 } from './utils.test.mock'; + import { SavedObjectsFindOptions } from '../../types'; import { SavedObjectsUtils } from './utils'; -jest.mock('uuid', () => ({ - v1: jest.fn().mockReturnValue('mock-uuid'), -})); - describe('SavedObjectsUtils', () => { const { namespaceIdToString, @@ -21,6 +18,7 @@ describe('SavedObjectsUtils', () => { createEmptyFindResponse, generateId, isRandomId, + getConvertedObjectId, } = SavedObjectsUtils; describe('#namespaceIdToString', () => { @@ -80,8 +78,8 @@ describe('SavedObjectsUtils', () => { describe('#generateId', () => { it('returns a valid uuid', () => { - expect(generateId()).toBe('mock-uuid'); - expect(uuid.v1).toHaveBeenCalled(); + expect(generateId()).toBe('uuidv1'); // default return value for mockUuidv1 + expect(mockUuidv1).toHaveBeenCalled(); }); }); @@ -93,4 +91,20 @@ describe('SavedObjectsUtils', () => { expect(isRandomId(undefined)).toBe(false); }); }); + + describe('#getConvertedObjectId', () => { + it('does not change the object ID if namespace is undefined or "default"', () => { + for (const namespace of [undefined, 'default']) { + const result = getConvertedObjectId(namespace, 'type', 'oldId'); + expect(result).toBe('oldId'); + expect(mockUuidv5).not.toHaveBeenCalled(); + } + }); + + it('changes the object ID if namespace is defined and not "default"', () => { + const result = getConvertedObjectId('namespace', 'type', 'oldId'); + expect(result).toBe('uuidv5'); // default return value for mockUuidv5 + expect(mockUuidv5).toHaveBeenCalledWith('namespace:type:oldId', 'DNSUUID'); + }); + }); }); diff --git a/src/core/server/saved_objects/service/lib/utils.ts b/src/core/server/saved_objects/service/lib/utils.ts index 494ac6ce9fad5..6942b3b376232 100644 --- a/src/core/server/saved_objects/service/lib/utils.ts +++ b/src/core/server/saved_objects/service/lib/utils.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import uuid from 'uuid'; +import uuidv1 from 'uuid/v1'; +import uuidv5 from 'uuid/v5'; import { SavedObjectsFindOptions } from '../../types'; import { SavedObjectsFindResponse } from '..'; @@ -65,7 +66,7 @@ export class SavedObjectsUtils { * Generates a random ID for a saved objects. */ public static generateId() { - return uuid.v1(); + return uuidv1(); } /** @@ -77,4 +78,19 @@ export class SavedObjectsUtils { public static isRandomId(id: string | undefined) { return typeof id === 'string' && UUID_REGEX.test(id); } + + /** + * Uses a single-namespace object's "legacy ID" to determine what its new ID will be after it is converted to a multi-namespace type. + * + * @param {string} namespace The namespace of the saved object before it is converted. + * @param {string} type The type of the saved object before it is converted. + * @param {string} id The ID of the saved object before it is converted. + * @returns {string} The ID of the saved object after it is converted. + */ + public static getConvertedObjectId(namespace: string | undefined, type: string, id: string) { + if (SavedObjectsUtils.namespaceIdToString(namespace) === DEFAULT_NAMESPACE_STRING) { + return id; // Objects that exist in the Default space do not get new IDs when they are converted. + } + return uuidv5(`${namespace}:${type}:${id}`, uuidv5.DNS); // The uuidv5 namespace constant (uuidv5.DNS) is arbitrary. + } } diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index fbc51acfdc8ef..7f2ce38a5bdd4 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -3163,6 +3163,7 @@ export interface SavedObjectsUpdateResponse extends Omit({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse; static generateId(): string; + static getConvertedObjectId(namespace: string | undefined, type: string, id: string): string; static isRandomId(id: string | undefined): boolean; static namespaceIdToString: (namespace?: string | undefined) => string; static namespaceStringToId: (namespace: string) => string | undefined; diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index 644dc32dd8140..e2d81c5ae1752 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -191,6 +191,7 @@ kibana_vars=( telemetry.enabled telemetry.optIn telemetry.optInStatusUrl + telemetry.sendUsageTo telemetry.sendUsageFrom tilemap.options.attribution tilemap.options.maxZoom diff --git a/src/dev/typescript/build_ts_refs_cli.ts b/src/dev/typescript/build_ts_refs_cli.ts index 00f298887ee17..ad7807eb87c66 100644 --- a/src/dev/typescript/build_ts_refs_cli.ts +++ b/src/dev/typescript/build_ts_refs_cli.ts @@ -41,7 +41,7 @@ export async function runBuildRefsCli() { const cacheEnabled = process.env.BUILD_TS_REFS_CACHE_ENABLE !== 'false' && !!flags.cache; const doCapture = process.env.BUILD_TS_REFS_CACHE_CAPTURE === 'true'; const doClean = !!flags.clean || doCapture; - const doInitCache = cacheEnabled && !doClean; + const doInitCache = cacheEnabled && !doCapture; if (doClean) { log.info('deleting', outDirs.length, 'ts output directories'); diff --git a/src/plugins/charts/public/index.ts b/src/plugins/charts/public/index.ts index cc1a54c2e25b0..0eec6f14eff64 100644 --- a/src/plugins/charts/public/index.ts +++ b/src/plugins/charts/public/index.ts @@ -15,6 +15,8 @@ export { ChartsPluginSetup, ChartsPluginStart } from './plugin'; export * from './static'; export * from './services/palettes/types'; export { lightenColor } from './services/palettes/lighten_color'; +export { useActiveCursor } from './services/active_cursor'; + export { PaletteOutput, CustomPaletteArguments, diff --git a/src/plugins/charts/public/mocks.ts b/src/plugins/charts/public/mocks.ts index c85a91a1ef563..7460962c3e1fa 100644 --- a/src/plugins/charts/public/mocks.ts +++ b/src/plugins/charts/public/mocks.ts @@ -8,6 +8,7 @@ import { ChartsPlugin } from './plugin'; import { themeServiceMock } from './services/theme/mock'; +import { activeCursorMock } from './services/active_cursor/mock'; import { colorsServiceMock } from './services/legacy_colors/mock'; import { getPaletteRegistry, paletteServiceMock } from './services/palettes/mock'; @@ -23,6 +24,7 @@ const createSetupContract = (): Setup => ({ const createStartContract = (): Start => ({ legacyColors: colorsServiceMock, theme: themeServiceMock, + activeCursor: activeCursorMock, palettes: paletteServiceMock.setup({} as any), }); diff --git a/src/plugins/charts/public/plugin.ts b/src/plugins/charts/public/plugin.ts index 5bc0b8c84560f..7802cef3b4934 100644 --- a/src/plugins/charts/public/plugin.ts +++ b/src/plugins/charts/public/plugin.ts @@ -12,6 +12,7 @@ import { palette, systemPalette } from '../common'; import { ThemeService, LegacyColorsService } from './services'; import { PaletteService } from './services/palettes/service'; +import { ActiveCursor } from './services/active_cursor'; export type Theme = Omit; export type Color = Omit; @@ -28,13 +29,16 @@ export interface ChartsPluginSetup { } /** @public */ -export type ChartsPluginStart = ChartsPluginSetup; +export type ChartsPluginStart = ChartsPluginSetup & { + activeCursor: ActiveCursor; +}; /** @public */ export class ChartsPlugin implements Plugin { private readonly themeService = new ThemeService(); private readonly legacyColorsService = new LegacyColorsService(); private readonly paletteService = new PaletteService(); + private readonly activeCursor = new ActiveCursor(); private palettes: undefined | ReturnType; @@ -45,6 +49,8 @@ export class ChartsPlugin implements Plugin { + let activeCursor: ActiveCursor; + + beforeEach(() => { + activeCursor = new ActiveCursor(); + }); + + test('should initialize activeCursor$ stream on setup hook', () => { + expect(activeCursor.activeCursor$).toBeUndefined(); + + activeCursor.setup(); + + expect(activeCursor.activeCursor$).toMatchInlineSnapshot(` + Subject { + "_isScalar": false, + "closed": false, + "hasError": false, + "isStopped": false, + "observers": Array [], + "thrownError": null, + } + `); + }); +}); diff --git a/src/plugins/vis_type_timelion/public/helpers/active_cursor.ts b/src/plugins/charts/public/services/active_cursor/active_cursor.ts similarity index 66% rename from src/plugins/vis_type_timelion/public/helpers/active_cursor.ts rename to src/plugins/charts/public/services/active_cursor/active_cursor.ts index 7f7f62fd6a9da..60aefc29169bc 100644 --- a/src/plugins/vis_type_timelion/public/helpers/active_cursor.ts +++ b/src/plugins/charts/public/services/active_cursor/active_cursor.ts @@ -7,6 +7,12 @@ */ import { Subject } from 'rxjs'; -import { PointerEvent } from '@elastic/charts'; +import type { ActiveCursorPayload } from './types'; -export const activeCursor$ = new Subject(); +export class ActiveCursor { + public activeCursor$?: Subject; + + setup() { + this.activeCursor$ = new Subject(); + } +} diff --git a/src/plugins/charts/public/services/active_cursor/active_cursor_utils.test.ts b/src/plugins/charts/public/services/active_cursor/active_cursor_utils.test.ts new file mode 100644 index 0000000000000..3230c1ec0f32b --- /dev/null +++ b/src/plugins/charts/public/services/active_cursor/active_cursor_utils.test.ts @@ -0,0 +1,141 @@ +/* + * 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 { parseSyncOptions } from './active_cursor_utils'; +import type { Datatable } from '../../../../expressions/public'; + +describe('active_cursor_utils', () => { + describe('parseSyncOptions', () => { + describe('dateHistogramSyncOption', () => { + test('should return isDateHistogram true in case if that mode is active', () => { + expect(parseSyncOptions({ isDateHistogram: true })).toMatchInlineSnapshot(` + Object { + "isDateHistogram": true, + } + `); + }); + + test('should return isDateHistogram false for other cases', () => { + expect(parseSyncOptions({ datatables: [] as Datatable[] })).toMatchInlineSnapshot(` + Object { + "accessors": Array [], + "isDateHistogram": false, + } + `); + }); + }); + + describe('datatablesSyncOption', () => { + test('should extract accessors', () => { + expect( + parseSyncOptions({ + datatables: ([ + { + columns: [ + { + meta: { + index: 'foo_index', + field: 'foo_field', + }, + }, + ], + }, + ] as unknown) as Datatable[], + }).accessors + ).toMatchInlineSnapshot(` + Array [ + "foo_index:foo_field", + ] + `); + }); + + test('should return isDateHistogram true in case all datatables is time based', () => { + expect( + parseSyncOptions({ + datatables: ([ + { + columns: [ + { + meta: { + index: 'foo_index', + field: 'foo_field', + sourceParams: { + appliedTimeRange: {}, + }, + }, + }, + ], + }, + { + columns: [ + { + meta: { + index: 'foo_index1', + field: 'foo_field1', + sourceParams: { + appliedTimeRange: {}, + }, + }, + }, + ], + }, + ] as unknown) as Datatable[], + }) + ).toMatchInlineSnapshot(` + Object { + "accessors": Array [ + "foo_index:foo_field", + "foo_index1:foo_field1", + ], + "isDateHistogram": true, + } + `); + }); + + test('should return isDateHistogram false in case of not all datatables is time based', () => { + expect( + parseSyncOptions({ + datatables: ([ + { + columns: [ + { + meta: { + index: 'foo_index', + field: 'foo_field', + sourceParams: { + appliedTimeRange: {}, + }, + }, + }, + ], + }, + { + columns: [ + { + meta: { + index: 'foo_index1', + field: 'foo_field1', + }, + }, + ], + }, + ] as unknown) as Datatable[], + }) + ).toMatchInlineSnapshot(` + Object { + "accessors": Array [ + "foo_index:foo_field", + "foo_index1:foo_field1", + ], + "isDateHistogram": false, + } + `); + }); + }); + }); +}); diff --git a/src/plugins/charts/public/services/active_cursor/active_cursor_utils.ts b/src/plugins/charts/public/services/active_cursor/active_cursor_utils.ts new file mode 100644 index 0000000000000..37eeb6bf2d820 --- /dev/null +++ b/src/plugins/charts/public/services/active_cursor/active_cursor_utils.ts @@ -0,0 +1,49 @@ +/* + * 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 { uniq } from 'lodash'; + +import type { Datatable } from '../../../../expressions/public'; +import type { ActiveCursorSyncOption, DateHistogramSyncOption } from './types'; +import type { ActiveCursorPayload } from './types'; + +function isDateHistogramSyncOption( + syncOption?: ActiveCursorSyncOption +): syncOption is DateHistogramSyncOption { + return Boolean(syncOption && 'isDateHistogram' in syncOption); +} + +const parseDatatable = (dataTables: Datatable[]) => { + const isDateHistogram = + Boolean(dataTables.length) && + dataTables.every((dataTable) => + dataTable.columns.some((c) => Boolean(c.meta.sourceParams?.appliedTimeRange)) + ); + + const accessors = uniq( + dataTables + .map((dataTable) => { + const column = dataTable.columns.find((c) => c.meta.index && c.meta.field); + + if (column?.meta.index) { + return `${column.meta.index}:${column.meta.field}`; + } + }) + .filter(Boolean) as string[] + ); + return { isDateHistogram, accessors }; +}; + +/** @internal **/ +export const parseSyncOptions = ( + syncOptions: ActiveCursorSyncOption +): Partial => + isDateHistogramSyncOption(syncOptions) + ? { + isDateHistogram: syncOptions.isDateHistogram, + } + : parseDatatable(syncOptions.datatables); diff --git a/src/plugins/data/server/field_formats/index.ts b/src/plugins/charts/public/services/active_cursor/index.ts similarity index 77% rename from src/plugins/data/server/field_formats/index.ts rename to src/plugins/charts/public/services/active_cursor/index.ts index a8e6d28f2c642..7c1fa88354a7c 100644 --- a/src/plugins/data/server/field_formats/index.ts +++ b/src/plugins/charts/public/services/active_cursor/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { FieldFormatsService, FieldFormatsSetup, FieldFormatsStart } from './field_formats_service'; +export { ActiveCursor } from './active_cursor'; +export { useActiveCursor } from './use_active_cursor'; diff --git a/src/plugins/charts/public/services/active_cursor/mock.ts b/src/plugins/charts/public/services/active_cursor/mock.ts new file mode 100644 index 0000000000000..118575b9b96fd --- /dev/null +++ b/src/plugins/charts/public/services/active_cursor/mock.ts @@ -0,0 +1,19 @@ +/* + * 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 { ActiveCursor } from './active_cursor'; + +export const activeCursorMock: ActiveCursor = { + activeCursor$: { + subscribe: jest.fn(), + pipe: jest.fn(() => ({ + subscribe: jest.fn(), + })), + }, + setup: jest.fn(), +} as any; diff --git a/src/plugins/charts/public/services/active_cursor/types.ts b/src/plugins/charts/public/services/active_cursor/types.ts new file mode 100644 index 0000000000000..0b0180a622efb --- /dev/null +++ b/src/plugins/charts/public/services/active_cursor/types.ts @@ -0,0 +1,35 @@ +/* + * 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 { PointerEvent } from '@elastic/charts'; +import type { Datatable } from '../../../../expressions/public'; + +/** @public **/ +export type ActiveCursorSyncOption = DateHistogramSyncOption | DatatablesSyncOption; + +/** @internal **/ +export interface ActiveCursorPayload { + cursor: PointerEvent; + isDateHistogram?: boolean; + accessors?: string[]; +} + +/** @internal **/ +interface BaseSyncOptions { + debounce?: number; +} + +/** @internal **/ +export interface DateHistogramSyncOption extends BaseSyncOptions { + isDateHistogram: boolean; +} + +/** @internal **/ +export interface DatatablesSyncOption extends BaseSyncOptions { + datatables: Datatable[]; +} diff --git a/src/plugins/charts/public/services/active_cursor/use_active_cursor.test.ts b/src/plugins/charts/public/services/active_cursor/use_active_cursor.test.ts new file mode 100644 index 0000000000000..efe5c9b49849f --- /dev/null +++ b/src/plugins/charts/public/services/active_cursor/use_active_cursor.test.ts @@ -0,0 +1,183 @@ +/* + * 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 { renderHook } from '@testing-library/react-hooks'; +import type { RefObject } from 'react'; + +import { ActiveCursor } from './active_cursor'; +import { useActiveCursor } from './use_active_cursor'; + +import type { ActiveCursorSyncOption, ActiveCursorPayload } from './types'; +import type { Chart, PointerEvent } from '@elastic/charts'; +import type { Datatable } from '../../../../expressions/public'; + +describe('useActiveCursor', () => { + let cursor: ActiveCursorPayload['cursor']; + let dispatchExternalPointerEvent: jest.Mock; + + const act = ( + syncOption: ActiveCursorSyncOption, + events: Array>, + eventsTimeout = 1 + ) => + new Promise(async (resolve) => { + const activeCursor = new ActiveCursor(); + let allEventsExecuted = false; + + activeCursor.setup(); + + dispatchExternalPointerEvent.mockImplementation((pointerEvent) => { + if (allEventsExecuted) { + resolve(pointerEvent); + } + }); + + renderHook(() => + useActiveCursor( + activeCursor, + { + current: { + dispatchExternalPointerEvent: dispatchExternalPointerEvent as ( + pointerEvent: PointerEvent + ) => void, + }, + } as RefObject, + { ...syncOption, debounce: syncOption.debounce ?? 1 } + ) + ); + + for (const e of events) { + await new Promise((eventResolve) => + setTimeout(() => { + if (e === events[events.length - 1]) { + allEventsExecuted = true; + } + activeCursor.activeCursor$!.next({ cursor, ...e }); + eventResolve(null); + }, eventsTimeout) + ); + } + }); + + beforeEach(() => { + cursor = {} as ActiveCursorPayload['cursor']; + dispatchExternalPointerEvent = jest.fn(); + }); + + test('should debounce events', async () => { + await act( + { + debounce: 5, + datatables: [ + { + columns: [ + { + meta: { + index: 'foo_index', + field: 'foo_field', + }, + }, + ], + }, + ] as Datatable[], + }, + [ + { accessors: ['foo_index:foo_field'] }, + { accessors: ['foo_index:foo_field'] }, + { accessors: ['foo_index:foo_field'] }, + { accessors: ['foo_index:foo_field'] }, + ] + ); + + expect(dispatchExternalPointerEvent).toHaveBeenCalledTimes(1); + }); + + test('should trigger cursor pointer update (chart type: time, event type: time)', async () => { + await act({ isDateHistogram: true }, [{ isDateHistogram: true }]); + + expect(dispatchExternalPointerEvent).toHaveBeenCalledTimes(1); + }); + + test('should trigger cursor pointer update (chart type: datatable - time based, event type: time)', async () => { + await act( + { + datatables: ([ + { + columns: [ + { + meta: { + index: 'foo_index', + field: 'foo_field', + sourceParams: { + appliedTimeRange: {}, + }, + }, + }, + ], + }, + ] as unknown) as Datatable[], + }, + [{ isDateHistogram: true }, { accessors: ['foo_index:foo_field'] }] + ); + + expect(dispatchExternalPointerEvent).toHaveBeenCalledTimes(2); + }); + + test('should not trigger cursor pointer update (chart type: datatable, event type: time)', async () => { + await act( + { + datatables: [ + { + columns: [ + { + meta: { + index: 'foo_index', + field: 'foo_field', + }, + }, + ], + }, + ] as Datatable[], + }, + [{ isDateHistogram: true }, { accessors: ['foo_index:foo_field'] }] + ); + + expect(dispatchExternalPointerEvent).toHaveBeenCalledTimes(1); + }); + + test('should works with multi datatables (intersection)', async () => { + await act( + { + datatables: [ + { + columns: [ + { + meta: { + index: 'ia', + field: 'fa', + }, + }, + ], + }, + { + columns: [ + { + meta: { + index: 'ib', + field: 'fb', + }, + }, + ], + }, + ] as Datatable[], + }, + [{ accessors: ['foo_index:foo_field', 'ib:fb'] }] + ); + + expect(dispatchExternalPointerEvent).toHaveBeenCalledTimes(1); + }); +}); diff --git a/src/plugins/charts/public/services/active_cursor/use_active_cursor.ts b/src/plugins/charts/public/services/active_cursor/use_active_cursor.ts new file mode 100644 index 0000000000000..b857208e657ae --- /dev/null +++ b/src/plugins/charts/public/services/active_cursor/use_active_cursor.ts @@ -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 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 { intersection } from 'lodash'; +import { animationFrameScheduler } from 'rxjs'; +import { useCallback, useEffect, RefObject } from 'react'; +import { filter, debounceTime } from 'rxjs/operators'; + +import type { Chart } from '@elastic/charts'; + +import { parseSyncOptions } from './active_cursor_utils'; + +import type { ActiveCursor } from './active_cursor'; +import type { ActiveCursorSyncOption } from './types'; + +const DEFAULT_DEBOUNCE_TIME = 40; + +export const useActiveCursor = ( + activeCursor: ActiveCursor, + chartRef: RefObject, + syncOptions: ActiveCursorSyncOption +) => { + const { accessors, isDateHistogram } = parseSyncOptions(syncOptions); + const handleCursorUpdate = useCallback( + (cursor) => { + activeCursor.activeCursor$?.next({ + cursor, + isDateHistogram, + accessors, + }); + }, + [activeCursor.activeCursor$, accessors, isDateHistogram] + ); + + useEffect(() => { + const cursorSubscription = activeCursor.activeCursor$ + ?.pipe( + debounceTime(syncOptions.debounce ?? DEFAULT_DEBOUNCE_TIME, animationFrameScheduler), + filter((payload) => { + if (payload.isDateHistogram && isDateHistogram) { + return true; + } + return intersection(accessors, payload.accessors).length > 0; + }) + ) + .subscribe(({ cursor }) => { + chartRef?.current?.dispatchExternalPointerEvent(cursor); + }); + + return () => { + cursorSubscription?.unsubscribe(); + }; + }, [activeCursor.activeCursor$, syncOptions.debounce, chartRef, accessors, isDateHistogram]); + + return handleCursorUpdate; +}; diff --git a/src/plugins/charts/public/services/index.ts b/src/plugins/charts/public/services/index.ts index aa2326f47377f..88d92543cb8dd 100644 --- a/src/plugins/charts/public/services/index.ts +++ b/src/plugins/charts/public/services/index.ts @@ -8,3 +8,4 @@ export { LegacyColorsService } from './legacy_colors'; export { ThemeService } from './theme'; +export { ActiveCursor, useActiveCursor } from './active_cursor'; diff --git a/src/plugins/dashboard/public/application/actions/export_csv_action.tsx b/src/plugins/dashboard/public/application/actions/export_csv_action.tsx index dd6eeb92ef932..cf643fa7d271f 100644 --- a/src/plugins/dashboard/public/application/actions/export_csv_action.tsx +++ b/src/plugins/dashboard/public/application/actions/export_csv_action.tsx @@ -8,7 +8,7 @@ import { Datatable } from 'src/plugins/expressions/public'; import { CoreStart } from '../../../../../core/public'; -import { FormatFactory } from '../../../../data/common/field_formats/utils'; +import { FormatFactory } from '../../../../field_formats/common'; import { DataPublicPluginStart, exporters } from '../../services/data'; import { downloadMultipleAs } from '../../services/share'; diff --git a/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap b/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap index afe339f3f43a2..70a21438754bd 100644 --- a/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap +++ b/src/plugins/dashboard/public/application/embeddable/empty_screen/__snapshots__/dashboard_empty_screen.test.tsx.snap @@ -308,6 +308,7 @@ exports[`DashboardEmptyScreen renders correctly with edit mode 1`] = ` >
    Create content that tells a story about your data. @@ -666,6 +667,7 @@ exports[`DashboardEmptyScreen renders correctly with readonly mode 1`] = ` >
    You need additional privileges to edit this dashboard.
    @@ -1023,6 +1025,7 @@ exports[`DashboardEmptyScreen renders correctly with view mode 1`] = ` >

    Click edit in the menu bar above to start adding panels. diff --git a/src/plugins/data/README.mdx b/src/plugins/data/README.mdx index fba5cbd6d48e1..c2da9a686cacb 100644 --- a/src/plugins/data/README.mdx +++ b/src/plugins/data/README.mdx @@ -49,10 +49,6 @@ This is helpful when you want to provide a user with options, for example when c ``` -## Field Formats - -Coming soon. - ## Index Patterns The Index Patterns API provides a consistent method of structuring and formatting documents diff --git a/src/plugins/data/common/constants.ts b/src/plugins/data/common/constants.ts index 89ccdfcc0479e..406da4e56d150 100644 --- a/src/plugins/data/common/constants.ts +++ b/src/plugins/data/common/constants.ts @@ -31,13 +31,6 @@ export const UI_SETTINGS = { HISTOGRAM_BAR_TARGET: 'histogram:barTarget', HISTOGRAM_MAX_BARS: 'histogram:maxBars', HISTORY_LIMIT: 'history:limit', - SHORT_DOTS_ENABLE: 'shortDots:enable', - FORMAT_DEFAULT_TYPE_MAP: 'format:defaultTypeMap', - FORMAT_NUMBER_DEFAULT_PATTERN: 'format:number:defaultPattern', - FORMAT_PERCENT_DEFAULT_PATTERN: 'format:percent:defaultPattern', - FORMAT_BYTES_DEFAULT_PATTERN: 'format:bytes:defaultPattern', - FORMAT_CURRENCY_DEFAULT_PATTERN: 'format:currency:defaultPattern', - FORMAT_NUMBER_DEFAULT_LOCALE: 'format:number:defaultLocale', TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: 'timepicker:refreshIntervalDefaults', TIMEPICKER_QUICK_RANGES: 'timepicker:quickRanges', TIMEPICKER_TIME_DEFAULTS: 'timepicker:timeDefaults', diff --git a/src/plugins/data/common/exports/export_csv.test.ts b/src/plugins/data/common/exports/export_csv.test.ts index 8bf44fe48a589..f108e69c68d56 100644 --- a/src/plugins/data/common/exports/export_csv.test.ts +++ b/src/plugins/data/common/exports/export_csv.test.ts @@ -7,7 +7,7 @@ */ import { Datatable } from 'src/plugins/expressions'; -import { FieldFormat } from '../../common/field_formats'; +import { FieldFormat } from '../../../field_formats/common'; import { datatableToCSV } from './export_csv'; function getDefaultOptions() { diff --git a/src/plugins/data/common/exports/export_csv.tsx b/src/plugins/data/common/exports/export_csv.tsx index d4477e72b64c4..68f817d1b1484 100644 --- a/src/plugins/data/common/exports/export_csv.tsx +++ b/src/plugins/data/common/exports/export_csv.tsx @@ -8,8 +8,8 @@ // Inspired by the inspector CSV exporter -import { FormatFactory } from 'src/plugins/data/common/field_formats/utils'; import { Datatable } from 'src/plugins/expressions'; +import { FormatFactory } from '../../../field_formats/common'; import { createEscapeValue } from './escape_value'; export const LINE_FEED_CHARACTER = '\r\n'; diff --git a/src/plugins/data/common/index.ts b/src/plugins/data/common/index.ts index cd05c613f793f..2bc383db6f530 100644 --- a/src/plugins/data/common/index.ts +++ b/src/plugins/data/common/index.ts @@ -8,7 +8,6 @@ export * from './constants'; export * from './es_query'; -export * from './field_formats'; export * from './index_patterns'; export * from './kbn_field_types'; export * from './query'; diff --git a/src/plugins/data/common/index_patterns/fields/index_pattern_field.test.ts b/src/plugins/data/common/index_patterns/fields/index_pattern_field.test.ts index 73f015ca5517c..f95de90955b65 100644 --- a/src/plugins/data/common/index_patterns/fields/index_pattern_field.test.ts +++ b/src/plugins/data/common/index_patterns/fields/index_pattern_field.test.ts @@ -8,8 +8,9 @@ import { IndexPatternField } from './index_pattern_field'; import { IndexPattern } from '../index_patterns'; -import { KBN_FIELD_TYPES, FieldFormat } from '../../../common'; +import { KBN_FIELD_TYPES } from '../../../common'; import { FieldSpec, RuntimeField } from '../types'; +import { FieldFormat } from '../../../../field_formats/common'; describe('Field', function () { function flatten(obj: Record) { diff --git a/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.test.ts b/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.test.ts index 9a33b0cfa6f1c..f4f94856c7226 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.test.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/flatten_hit.test.ts @@ -12,7 +12,7 @@ import { IndexPattern } from './index_pattern'; import mockLogStashFields from './fixtures/logstash_fields'; import { stubbedSavedObjectIndexPattern } from './fixtures/stubbed_saved_object_index_pattern'; -import { fieldFormatsMock } from '../../field_formats/mocks'; +import { fieldFormatsMock } from '../../../../field_formats/common/mocks'; import { flattenHitWrapper } from './flatten_hit'; class MockFieldFormatter {} diff --git a/src/plugins/data/common/index_patterns/index_patterns/format_hit.ts b/src/plugins/data/common/index_patterns/index_patterns/format_hit.ts index 732b9c7c8eab0..fe872ae929899 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/format_hit.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/format_hit.ts @@ -8,7 +8,7 @@ import _ from 'lodash'; import { IndexPattern } from './index_pattern'; -import { FieldFormatsContentType } from '../../../common'; +import { FieldFormatsContentType } from '../../../../field_formats/common'; const formattedCache = new WeakMap(); const partialFormattedCache = new WeakMap(); diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.test.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.test.ts index 508bddb7a4096..7c111f7666544 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.test.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.test.ts @@ -16,8 +16,8 @@ import mockLogStashFields from './fixtures/logstash_fields'; import { stubbedSavedObjectIndexPattern } from './fixtures/stubbed_saved_object_index_pattern'; import { IndexPatternField } from '../fields'; -import { fieldFormatsMock } from '../../field_formats/mocks'; -import { FieldFormat } from '../..'; +import { fieldFormatsMock } from '../../../../field_formats/common/mocks'; +import { FieldFormat } from '../../../../field_formats/common'; import { RuntimeField } from '../types'; class MockFieldFormatter {} diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts index b3f2605723c02..48bcdf6982b67 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts @@ -15,7 +15,7 @@ import { ES_FIELD_TYPES, KBN_FIELD_TYPES, IIndexPattern, IFieldType } from '../. import { IndexPatternField, IIndexPatternFieldList, fieldList } from '../fields'; import { formatHitProvider } from './format_hit'; import { flattenHitWrapper } from './flatten_hit'; -import { FieldFormatsStartCommon, FieldFormat } from '../../field_formats'; +import { FieldFormatsStartCommon, FieldFormat } from '../../../../field_formats/common'; import { IndexPatternSpec, TypeMeta, SourceFilter, IndexPatternFieldMap } from '../types'; import { SerializedFieldFormat } from '../../../../expressions/common'; import { castEsToKbnFieldTypeName } from '../../kbn_field_types'; diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts index 8715f8feb067a..a80e97b4e2cab 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts @@ -8,7 +8,7 @@ import { defaults } from 'lodash'; import { IndexPatternsService, IndexPattern } from '.'; -import { fieldFormatsMock } from '../../field_formats/mocks'; +import { fieldFormatsMock } from '../../../../field_formats/common/mocks'; import { stubbedSavedObjectIndexPattern } from './fixtures/stubbed_saved_object_index_pattern'; import { UiSettingsCommon, SavedObjectsClientCommon, SavedObject } from '../types'; diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts index cecf3b8c07d1a..64628f7165f27 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts @@ -29,7 +29,7 @@ import { FieldSpec, IndexPatternFieldMap, } from '../types'; -import { FieldFormatsStartCommon } from '../../field_formats'; +import { FieldFormatsStartCommon, FORMATS_UI_SETTINGS } from '../../../../field_formats/common/'; import { UI_SETTINGS, SavedObject } from '../../../common'; import { SavedObjectNotFound } from '../../../../kibana_utils/common'; import { IndexPatternMissingIndices } from '../lib'; @@ -500,7 +500,7 @@ export class IndexPatternsService { * @returns IndexPattern */ async create(spec: IndexPatternSpec, skipFetchFields = false): Promise { - const shortDotsEnable = await this.config.get(UI_SETTINGS.SHORT_DOTS_ENABLE); + const shortDotsEnable = await this.config.get(FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE); const metaFields = await this.config.get(UI_SETTINGS.META_FIELDS); const indexPattern = new IndexPattern({ @@ -528,7 +528,7 @@ export class IndexPatternsService { const indexPattern = await this.create(spec, skipFetchFields); const createdIndexPattern = await this.createSavedObject(indexPattern, override); await this.setDefault(createdIndexPattern.id!); - return createdIndexPattern; + return createdIndexPattern!; } /** diff --git a/src/plugins/data/common/index_patterns/types.ts b/src/plugins/data/common/index_patterns/types.ts index d05a7ea6e2d93..56a79dd9cfada 100644 --- a/src/plugins/data/common/index_patterns/types.ts +++ b/src/plugins/data/common/index_patterns/types.ts @@ -13,7 +13,8 @@ import type { SavedObject } from 'src/core/server'; import { IFieldType } from './fields'; import { RUNTIME_FIELD_TYPES } from './constants'; import { SerializedFieldFormat } from '../../../expressions/common'; -import { KBN_FIELD_TYPES, IndexPatternField, FieldFormat } from '..'; +import { KBN_FIELD_TYPES, IndexPatternField } from '..'; +import { FieldFormat } from '../../../field_formats/common'; export type FieldFormatMap = Record; diff --git a/src/plugins/data/common/search/aggs/agg_types.ts b/src/plugins/data/common/search/aggs/agg_types.ts index 1db60db507f0f..375de79f7f081 100644 --- a/src/plugins/data/common/search/aggs/agg_types.ts +++ b/src/plugins/data/common/search/aggs/agg_types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { FieldFormatsStartCommon } from '../../field_formats'; +import { FieldFormatsStartCommon } from '../../../../field_formats/common'; import * as buckets from './buckets'; import * as metrics from './metrics'; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.test.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.test.ts index c147708b5b2f9..0cefd6b73b336 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/histogram.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { BytesFormat, FieldFormatsGetConfigFn } from '../../../../../common/field_formats'; +import { BytesFormat, FieldFormatsGetConfigFn } from '../../../../../../field_formats/common'; import { AggConfigs } from '../../agg_configs'; import { mockAggTypesRegistry, mockGetFieldFormatsStart } from '../../test_helpers'; import { BUCKET_TYPES } from '../bucket_agg_types'; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.test.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.test.ts index 1e4d97a007301..51ea6d081d139 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/ip_range.test.ts @@ -9,7 +9,7 @@ import { createFilterIpRange } from './ip_range'; import { AggConfigs, CreateAggConfigParams } from '../../agg_configs'; import { mockAggTypesRegistry } from '../../test_helpers'; -import { IpFormat } from '../../../../../common'; +import { IpFormat } from '../../../../../../field_formats/common'; import { BUCKET_TYPES } from '../bucket_agg_types'; import { IBucketAggConfig } from '../bucket_agg_type'; diff --git a/src/plugins/data/common/search/aggs/buckets/create_filter/range.test.ts b/src/plugins/data/common/search/aggs/buckets/create_filter/range.test.ts index 7e4289e23cfae..c9ab1617929dc 100644 --- a/src/plugins/data/common/search/aggs/buckets/create_filter/range.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/create_filter/range.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { BytesFormat, FieldFormatsGetConfigFn } from '../../../../../common/field_formats'; +import { BytesFormat, FieldFormatsGetConfigFn } from '../../../../../../field_formats/common'; import { AggConfigs } from '../../agg_configs'; import { mockAggTypesRegistry, mockGetFieldFormatsStart } from '../../test_helpers'; import { IBucketAggConfig } from '../bucket_agg_type'; diff --git a/src/plugins/data/common/search/aggs/buckets/range.test.ts b/src/plugins/data/common/search/aggs/buckets/range.test.ts index 60a58a68e18e0..202cc59c83c0f 100644 --- a/src/plugins/data/common/search/aggs/buckets/range.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/range.test.ts @@ -9,7 +9,7 @@ import { AggConfigs } from '../agg_configs'; import { mockAggTypesRegistry } from '../test_helpers'; import { BUCKET_TYPES } from './bucket_agg_types'; -import { FieldFormatsGetConfigFn, NumberFormat } from '../../../../common/field_formats'; +import { FieldFormatsGetConfigFn, NumberFormat } from '../../../../../field_formats/common'; describe('Range Agg', () => { const getConfig = (() => {}) as FieldFormatsGetConfigFn; diff --git a/src/plugins/data/common/search/aggs/buckets/shard_delay.test.ts b/src/plugins/data/common/search/aggs/buckets/shard_delay.test.ts index 51c71cd1a2994..9f7559c6fe34f 100644 --- a/src/plugins/data/common/search/aggs/buckets/shard_delay.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/shard_delay.test.ts @@ -7,7 +7,7 @@ */ import { AggConfigs } from '../agg_configs'; -import { FieldFormatsGetConfigFn, NumberFormat } from '../../../../common/field_formats'; +import { FieldFormatsGetConfigFn, NumberFormat } from '../../../../../field_formats/common'; import { getShardDelayBucketAgg, SHARD_DELAY_AGG_NAME } from './shard_delay'; describe('Shard Delay Agg', () => { diff --git a/src/plugins/data/common/search/aggs/test_helpers/mock_agg_types_registry.ts b/src/plugins/data/common/search/aggs/test_helpers/mock_agg_types_registry.ts index ff22af720bde6..50c8966d284a0 100644 --- a/src/plugins/data/common/search/aggs/test_helpers/mock_agg_types_registry.ts +++ b/src/plugins/data/common/search/aggs/test_helpers/mock_agg_types_registry.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { fieldFormatsMock } from '../../../field_formats/mocks'; +import { fieldFormatsMock } from '../../../../../field_formats/common/mocks'; import { AggTypesRegistry, AggTypesRegistryStart } from '../agg_types_registry'; import { AggTypesDependencies, getAggTypes } from '../agg_types'; diff --git a/src/plugins/data/common/search/aggs/utils/get_aggs_formats.test.ts b/src/plugins/data/common/search/aggs/utils/get_aggs_formats.test.ts index 1cf80a6d0085c..76112980c55fb 100644 --- a/src/plugins/data/common/search/aggs/utils/get_aggs_formats.test.ts +++ b/src/plugins/data/common/search/aggs/utils/get_aggs_formats.test.ts @@ -8,8 +8,11 @@ import { identity } from 'lodash'; -import { SerializedFieldFormat } from 'src/plugins/expressions/common/types'; -import { FieldFormat, IFieldFormat } from '../../../../common'; +import { + FieldFormat, + IFieldFormat, + SerializedFieldFormat, +} from '../../../../../field_formats/common'; import { getAggsFormats } from './get_aggs_formats'; const getAggFormat = ( diff --git a/src/plugins/data/common/search/aggs/utils/get_aggs_formats.ts b/src/plugins/data/common/search/aggs/utils/get_aggs_formats.ts index 175b6832b3c85..2aead866c6b60 100644 --- a/src/plugins/data/common/search/aggs/utils/get_aggs_formats.ts +++ b/src/plugins/data/common/search/aggs/utils/get_aggs_formats.ts @@ -15,7 +15,7 @@ import { FieldFormatInstanceType, FieldFormatsContentType, IFieldFormat, -} from '../../../../common/field_formats'; +} from '../../../../../field_formats/common'; import { DateRange } from '../../expressions'; import { convertDateRangeToString } from '../buckets/lib/date_range'; import { convertIPRangeToString, IpRangeKey } from '../buckets/lib/ip_range'; diff --git a/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts b/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts index b78980cb5136e..e200f9bf02536 100644 --- a/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts +++ b/src/plugins/data/common/search/expressions/esaggs/create_filter.test.ts @@ -7,7 +7,7 @@ */ import { isRangeFilter } from '@kbn/es-query'; -import { BytesFormat, FieldFormatsGetConfigFn } from '../../../field_formats'; +import { BytesFormat, FieldFormatsGetConfigFn } from '../../../../../field_formats/common'; import { AggConfigs, IAggConfig } from '../../aggs'; import { mockAggTypesRegistry } from '../../aggs/test_helpers'; 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 c982ba1e7a293..c72976e3412a6 100644 --- a/src/plugins/data/common/search/search_source/search_source.ts +++ b/src/plugins/data/common/search/search_source/search_source.ts @@ -99,7 +99,7 @@ import { isPartialResponse, IKibanaSearchResponse, } from '../../../common'; -import { getHighlightRequest } from '../../../common/field_formats'; +import { getHighlightRequest } from '../../../../field_formats/common'; import { extractReferences } from './extract_references'; /** @internal */ diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index e425d0701155b..e6faa6bd0b1a7 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -3,8 +3,8 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["bfetch", "expressions", "uiActions", "share", "inspector"], - "serviceFolders": ["search", "index_patterns", "query", "autocomplete", "ui", "field_formats"], + "requiredPlugins": ["bfetch", "expressions", "uiActions", "share", "inspector", "fieldFormats"], + "serviceFolders": ["search", "index_patterns", "query", "autocomplete", "ui"], "optionalPlugins": ["usageCollection"], "extraPublicDirs": ["common"], "requiredBundles": ["kibanaUtils", "kibanaReact", "inspector"], diff --git a/src/plugins/data/public/actions/filters/create_filters_from_range_select.test.ts b/src/plugins/data/public/actions/filters/create_filters_from_range_select.test.ts index ea7d7690fb876..5c3b016dc631e 100644 --- a/src/plugins/data/public/actions/filters/create_filters_from_range_select.test.ts +++ b/src/plugins/data/public/actions/filters/create_filters_from_range_select.test.ts @@ -10,14 +10,11 @@ import moment from 'moment'; import { createFiltersFromRangeSelectAction } from './create_filters_from_range_select'; -import { - fieldFormats, - FieldFormatsGetConfigFn, - IndexPatternsContract, - RangeFilter, -} from '../../../public'; +import { IndexPatternsContract, RangeFilter } from '../../../public'; import { dataPluginMock } from '../../../public/mocks'; import { setIndexPatterns, setSearchService } from '../../../public/services'; +import { FieldFormatsGetConfigFn } from '../../../../field_formats/common'; +import { DateFormat } from '../../../../field_formats/public/'; describe('brushEvent', () => { const DAY_IN_MS = 24 * 60 * 60 * 1000; @@ -35,7 +32,7 @@ describe('brushEvent', () => { id: 'logstash-*', }, filterable: true, - format: new fieldFormats.DateFormat({}, (() => {}) as FieldFormatsGetConfigFn), + format: new DateFormat({}, (() => {}) as FieldFormatsGetConfigFn), }; const indexPattern = { diff --git a/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts b/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts index 14ae24a2a5626..563321cf56fef 100644 --- a/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts +++ b/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts @@ -6,18 +6,14 @@ * Side Public License, v 1. */ -import { - fieldFormats, - FieldFormatsGetConfigFn, - esFilters, - IndexPatternsContract, -} from '../../../public'; +import { esFilters, IndexPatternsContract } from '../../../public'; import { dataPluginMock } from '../../../public/mocks'; import { setIndexPatterns, setSearchService } from '../../../public/services'; import { createFiltersFromValueClickAction, ValueClickDataContext, } from './create_filters_from_value_click'; +import { FieldFormatsGetConfigFn, BytesFormat } from '../../../../field_formats/common'; const mockField = { name: 'bytes', @@ -72,8 +68,7 @@ describe('createFiltersFromValueClick', () => { getByName: () => mockField, filter: () => [mockField], }, - getFormatterForField: () => - new fieldFormats.BytesFormat({}, (() => {}) as FieldFormatsGetConfigFn), + getFormatterForField: () => new BytesFormat({}, (() => {}) as FieldFormatsGetConfigFn), }), } as unknown) as IndexPatternsContract); }); diff --git a/src/plugins/data/public/field_formats/field_formats_registry.stub.ts b/src/plugins/data/public/field_formats/field_formats_registry.stub.ts deleted file mode 100644 index 566532085059d..0000000000000 --- a/src/plugins/data/public/field_formats/field_formats_registry.stub.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { CoreSetup } from 'src/core/public'; -import { baseFormattersPublic } from './constants'; -import { fieldFormats } from '..'; - -export const getFieldFormatsRegistry = (core: CoreSetup) => { - const fieldFormatsRegistry = new fieldFormats.FieldFormatsRegistry(); - const getConfig = core.uiSettings.get.bind(core.uiSettings); - - fieldFormatsRegistry.init(getConfig, {}, baseFormattersPublic); - - return fieldFormatsRegistry; -}; diff --git a/src/plugins/data/public/index.scss b/src/plugins/data/public/index.scss index c0eebf3402771..467efa98934ec 100644 --- a/src/plugins/data/public/index.scss +++ b/src/plugins/data/public/index.scss @@ -1,3 +1,2 @@ @import './ui/index'; @import './utils/table_inspector_view/index'; -@import './field_formats/converters/index'; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index e3ecacfbda5ad..fb35d00545040 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -19,75 +19,6 @@ export { getEsQueryConfig } from '../common'; export { FilterLabel, FilterItem } from './ui'; export { getDisplayValueFromFilter, generateFilters, extractTimeRange } from './query'; -/* - * Field Formatters: - */ - -import { - FieldFormat, - FieldFormatsRegistry, - DEFAULT_CONVERTER_COLOR, - HTML_CONTEXT_TYPE, - TEXT_CONTEXT_TYPE, - FIELD_FORMAT_IDS, - BoolFormat, - BytesFormat, - ColorFormat, - DurationFormat, - IpFormat, - NumberFormat, - PercentFormat, - RelativeDateFormat, - SourceFormat, - StaticLookupFormat, - UrlFormat, - StringFormat, - TruncateFormat, - HistogramFormat, -} from '../common/field_formats'; - -import { DateNanosFormat, DateFormat } from './field_formats'; -export { baseFormattersPublic, FieldFormatsStart } from './field_formats'; - -// Field formats helpers namespace: -export const fieldFormats = { - FieldFormat, - FieldFormatsRegistry, // exported only for tests. Consider mock. - - DEFAULT_CONVERTER_COLOR, - HTML_CONTEXT_TYPE, - TEXT_CONTEXT_TYPE, - FIELD_FORMAT_IDS, - - BoolFormat, - BytesFormat, - ColorFormat, - DateFormat, - DateNanosFormat, - DurationFormat, - IpFormat, - NumberFormat, - PercentFormat, - RelativeDateFormat, - SourceFormat, - StaticLookupFormat, - UrlFormat, - StringFormat, - TruncateFormat, - HistogramFormat, -}; - -export { - IFieldFormat, - FieldFormatInstanceType, - IFieldFormatsRegistry, - FieldFormatsContentType, - FieldFormatsGetConfigFn, - FieldFormatConfig, - FieldFormatId, - FieldFormat, -} from '../common'; - /** * Exporters (CSV) */ @@ -152,7 +83,9 @@ export { IndexPatternSpec, IndexPatternLoadExpressionFunctionDefinition, fieldList, + GetFieldsOptions, INDEX_PATTERN_SAVED_OBJECT_TYPE, + AggregationRestrictions, IndexPatternType, } from '../common'; diff --git a/src/plugins/data/public/mocks.ts b/src/plugins/data/public/mocks.ts index 9e01350add2e3..ba1cba987c0b9 100644 --- a/src/plugins/data/public/mocks.ts +++ b/src/plugins/data/public/mocks.ts @@ -7,7 +7,7 @@ */ import { DataPlugin, IndexPatternsContract } from '.'; -import { fieldFormatsServiceMock } from './field_formats/mocks'; +import { fieldFormatsServiceMock } from '../../field_formats/public/mocks'; import { searchServiceMock } from './search/mocks'; import { queryServiceMock } from './query/mocks'; import { AutocompleteStart, AutocompleteSetup } from './autocomplete'; diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts index 7a071dbffe696..46b1d4a14be78 100644 --- a/src/plugins/data/public/plugin.ts +++ b/src/plugins/data/public/plugin.ts @@ -19,7 +19,6 @@ import { } from './types'; import { AutocompleteService } from './autocomplete'; import { SearchService } from './search/search_service'; -import { FieldFormatsService } from './field_formats'; import { QueryService } from './query'; import { createIndexPatternSelect } from './ui/index_pattern_select'; import { @@ -62,7 +61,6 @@ export class DataPublicPlugin > { private readonly autocomplete: AutocompleteService; private readonly searchService: SearchService; - private readonly fieldFormatsService: FieldFormatsService; private readonly queryService: QueryService; private readonly storage: IStorageWrapper; private usageCollection: UsageCollectionSetup | undefined; @@ -71,7 +69,6 @@ export class DataPublicPlugin constructor(initializerContext: PluginInitializerContext) { this.searchService = new SearchService(initializerContext); this.queryService = new QueryService(); - this.fieldFormatsService = new FieldFormatsService(); this.autocomplete = new AutocompleteService(initializerContext); this.storage = new Storage(window.localStorage); @@ -80,7 +77,14 @@ export class DataPublicPlugin public setup( core: CoreSetup, - { bfetch, expressions, uiActions, usageCollection, inspector }: DataSetupDependencies + { + bfetch, + expressions, + uiActions, + usageCollection, + inspector, + fieldFormats, + }: DataSetupDependencies ): DataPublicPluginSetup { const startServices = createStartServicesGetter(core.getStartServices); @@ -115,10 +119,9 @@ export class DataPublicPlugin })) ); - const fieldFormats = this.fieldFormatsService.setup(core); fieldFormats.register( getAggsFormats((serializedFieldFormat) => - startServices().self.fieldFormats.deserialize(serializedFieldFormat) + startServices().plugins.fieldFormats.deserialize(serializedFieldFormat) ) ); @@ -133,14 +136,15 @@ export class DataPublicPlugin }; } - public start(core: CoreStart, { uiActions }: DataStartDependencies): DataPublicPluginStart { + public start( + core: CoreStart, + { uiActions, fieldFormats }: DataStartDependencies + ): DataPublicPluginStart { const { uiSettings, http, notifications, savedObjects, overlays, application } = core; setNotifications(notifications); setOverlays(overlays); setUiSettings(uiSettings); - const fieldFormats = this.fieldFormatsService.start(); - const indexPatterns = new IndexPatternsService({ uiSettings: new UiSettingsPublicToCommon(uiSettings), savedObjectsClient: new SavedObjectsClientPublicToCommon(savedObjects.client), diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index ce105b8cc94ac..64b73ded88eef 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -43,9 +43,10 @@ import { ExpressionAstExpression } from 'src/plugins/expressions/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsSetup } from 'src/plugins/expressions/public'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; +import { FieldFormatsSetup } from 'src/plugins/field_formats/public'; +import { FieldFormatsStart } from 'src/plugins/field_formats/public'; import { Filter as Filter_2 } from '@kbn/es-query'; import { FilterStateStore } from '@kbn/es-query'; -import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; import { History } from 'history'; import { Href } from 'history'; import { HttpSetup } from 'kibana/public'; @@ -107,7 +108,7 @@ import { SavedObjectsFindOptions } from 'kibana/public'; import { SavedObjectsFindResponse } from 'kibana/server'; import { SavedObjectsUpdateResponse } from 'kibana/server'; import { SchemaTypeError } from '@kbn/config-schema'; -import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; +import { SerializedFieldFormat as SerializedFieldFormat_3 } from 'src/plugins/expressions/common'; import { StartServicesAccessor } from 'kibana/public'; import { ToastInputFields } from 'src/core/public/notifications'; import { ToastsSetup } from 'kibana/public'; @@ -207,7 +208,7 @@ export class AggConfig { // @deprecated (undocumented) toJSON(): AggConfigSerialized; // Warning: (ae-forgotten-export) The symbol "SerializableState" needs to be exported by the entry point index.d.ts - toSerializedFieldFormat(): {} | Ensure, SerializableState_2>; + toSerializedFieldFormat(): {} | Ensure, SerializableState_2>; // (undocumented) get type(): IAggType; set type(type: IAggType); @@ -537,6 +538,22 @@ export class AggParamType extends Ba makeAgg: (agg: TAggConfig, state?: AggConfigSerialized) => TAggConfig; } +// Warning: (ae-missing-release-tag) "AggregationRestrictions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +type AggregationRestrictions = Record; + +export { AggregationRestrictions } + +export { AggregationRestrictions as IndexPatternAggRestrictions } + // Warning: (ae-forgotten-export) The symbol "AggsCommonStart" needs to be exported by the entry point index.d.ts // // @public @@ -573,13 +590,6 @@ export type AutocompleteStart = ReturnType; // @public (undocumented) export type AutoRefreshDoneFn = () => void; -// Warning: (ae-forgotten-export) The symbol "DateFormat" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "baseFormattersPublic" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const baseFormattersPublic: (import("../../common").FieldFormatInstanceType | typeof DateFormat | typeof DateNanosFormat)[]; - // Warning: (ae-missing-release-tag) "BUCKET_TYPES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -644,9 +654,9 @@ export class DataPlugin implements Plugin); // (undocumented) - setup(core: CoreSetup, { bfetch, expressions, uiActions, usageCollection, inspector }: DataSetupDependencies): DataPublicPluginSetup; + setup(core: CoreSetup, { bfetch, expressions, uiActions, usageCollection, inspector, fieldFormats, }: DataSetupDependencies): DataPublicPluginSetup; // (undocumented) - start(core: CoreStart_2, { uiActions }: DataStartDependencies): DataPublicPluginStart; + start(core: CoreStart_2, { uiActions, fieldFormats }: DataStartDependencies): DataPublicPluginStart; // (undocumented) stop(): void; } @@ -659,9 +669,7 @@ export interface DataPublicPluginSetup { // // (undocumented) autocomplete: AutocompleteSetup; - // Warning: (ae-forgotten-export) The symbol "FieldFormatsSetup" needs to be exported by the entry point index.d.ts - // - // (undocumented) + // @deprecated (undocumented) fieldFormats: FieldFormatsSetup; // (undocumented) query: QuerySetup; @@ -675,6 +683,7 @@ export interface DataPublicPluginSetup { export interface DataPublicPluginStart { actions: DataPublicPluginStartActions; autocomplete: AutocompleteStart; + // @deprecated (undocumented) fieldFormats: FieldFormatsStart; indexPatterns: IndexPatternsContract; // Warning: (ae-forgotten-export) The symbol "NowProviderPublicContract" needs to be exported by the entry point index.d.ts @@ -896,124 +905,6 @@ export function extractTimeRange(filters: Filter_2[], timeFieldName?: string): { timeRange?: TimeRange; }; -// Warning: (ae-missing-release-tag) "FieldFormat" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export abstract class FieldFormat { - // Warning: (ae-forgotten-export) The symbol "IFieldFormatMetaParams" needs to be exported by the entry point index.d.ts - constructor(_params?: IFieldFormatMetaParams, getConfig?: FieldFormatsGetConfigFn); - // (undocumented) - allowsNumericalAggregations?: boolean; - // Warning: (ae-forgotten-export) The symbol "HtmlContextTypeOptions" needs to be exported by the entry point index.d.ts - // Warning: (ae-forgotten-export) The symbol "TextContextTypeOptions" needs to be exported by the entry point index.d.ts - convert(value: any, contentType?: FieldFormatsContentType, options?: HtmlContextTypeOptions | TextContextTypeOptions): string; - // Warning: (ae-forgotten-export) The symbol "FieldFormatConvert" needs to be exported by the entry point index.d.ts - convertObject: FieldFormatConvert | undefined; - static fieldType: string | string[]; - // Warning: (ae-incompatible-release-tags) The symbol "from" is marked as @public, but its signature references "FieldFormatInstanceType" which is marked as @internal - // - // (undocumented) - static from(convertFn: FieldFormatConvertFunction): FieldFormatInstanceType; - // (undocumented) - protected getConfig: FieldFormatsGetConfigFn | undefined; - // Warning: (ae-forgotten-export) The symbol "FieldFormatConvertFunction" needs to be exported by the entry point index.d.ts - getConverterFor(contentType?: FieldFormatsContentType): FieldFormatConvertFunction; - getParamDefaults(): Record; - static hidden: boolean; - // Warning: (ae-forgotten-export) The symbol "HtmlContextTypeConvert" needs to be exported by the entry point index.d.ts - htmlConvert: HtmlContextTypeConvert | undefined; - static id: string; - // (undocumented) - static isInstanceOfFieldFormat(fieldFormat: any): fieldFormat is FieldFormat; - param(name: string): any; - params(): Record; - // (undocumented) - protected readonly _params: any; - // (undocumented) - setupContentType(): FieldFormatConvert; - // Warning: (ae-forgotten-export) The symbol "TextContextTypeConvert" needs to be exported by the entry point index.d.ts - textConvert: TextContextTypeConvert | undefined; - static title: string; - toJSON(): { - id: any; - params: any; - }; - type: any; -} - -// Warning: (ae-missing-release-tag) "FieldFormatConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface FieldFormatConfig { - // (undocumented) - es?: boolean; - // (undocumented) - id: FieldFormatId; - // (undocumented) - params: Record; -} - -// Warning: (ae-forgotten-export) The symbol "FIELD_FORMAT_IDS" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "FieldFormatId" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public -export type FieldFormatId = FIELD_FORMAT_IDS | string; - -// @internal (undocumented) -export type FieldFormatInstanceType = (new (params?: any, getConfig?: FieldFormatsGetConfigFn) => FieldFormat) & { - id: FieldFormatId; - title: string; - hidden?: boolean; - fieldType: string | string[]; -}; - -// Warning: (ae-missing-release-tag) "fieldFormats" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const fieldFormats: { - FieldFormat: typeof FieldFormat; - FieldFormatsRegistry: typeof FieldFormatsRegistry; - DEFAULT_CONVERTER_COLOR: { - range: string; - regex: string; - text: string; - background: string; - }; - HTML_CONTEXT_TYPE: import("../common").FieldFormatsContentType; - TEXT_CONTEXT_TYPE: import("../common").FieldFormatsContentType; - FIELD_FORMAT_IDS: typeof FIELD_FORMAT_IDS; - BoolFormat: typeof BoolFormat; - BytesFormat: typeof BytesFormat; - ColorFormat: typeof ColorFormat; - DateFormat: typeof DateFormat; - DateNanosFormat: typeof DateNanosFormat; - DurationFormat: typeof DurationFormat; - IpFormat: typeof IpFormat; - NumberFormat: typeof NumberFormat; - PercentFormat: typeof PercentFormat; - RelativeDateFormat: typeof RelativeDateFormat; - SourceFormat: typeof SourceFormat; - StaticLookupFormat: typeof StaticLookupFormat; - UrlFormat: typeof UrlFormat; - StringFormat: typeof StringFormat; - TruncateFormat: typeof TruncateFormat; - HistogramFormat: typeof HistogramFormat; -}; - -// @public (undocumented) -export type FieldFormatsContentType = 'html' | 'text'; - -// Warning: (ae-forgotten-export) The symbol "GetConfigFn" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "FieldFormatsGetConfigFn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type FieldFormatsGetConfigFn = GetConfigFn; - -// @public (undocumented) -export type FieldFormatsStart = Omit & { - deserialize: FormatFactory; -}; - // Warning: (ae-forgotten-export) The symbol "FieldSpec" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "fieldList" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1112,6 +1003,24 @@ export function getEsPreference(uiSettings: IUiSettingsClient_2, sessionId?: str // @public (undocumented) export function getEsQueryConfig(config: KibanaConfig): EsQueryConfig_2; +// Warning: (ae-missing-release-tag) "GetFieldsOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface GetFieldsOptions { + // (undocumented) + allowNoIndex?: boolean; + // (undocumented) + lookBack?: boolean; + // (undocumented) + metaFields?: string[]; + // (undocumented) + pattern: string; + // (undocumented) + rollupIndex?: string; + // (undocumented) + type?: string; +} + // Warning: (ae-missing-release-tag) "getKbnTypeNames" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) @@ -1191,16 +1100,6 @@ export interface IEsSearchRequest extends IKibanaSearchRequest = IKibanaSearchResponse>; -// Warning: (ae-missing-release-tag) "IFieldFormat" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type IFieldFormat = FieldFormat; - -// Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type IFieldFormatsRegistry = PublicMethodsOf; - // Warning: (ae-forgotten-export) The symbol "FieldParamType" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "IFieldParamType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1254,6 +1153,7 @@ export interface IIndexPattern extends IndexPatternBase { fieldFormatMap?: Record | undefined>; // (undocumented) fields: IFieldType[]; + // Warning: (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts getFormatterForField?: (field: IndexPatternField | IndexPatternField['spec'] | IFieldType) => FieldFormat; // (undocumented) getTimeField?(): IFieldType | undefined; @@ -1437,18 +1337,6 @@ export class IndexPattern implements IIndexPattern { version: string | undefined; } -// Warning: (ae-missing-release-tag) "AggregationRestrictions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type IndexPatternAggRestrictions = Record; - // Warning: (ae-missing-release-tag) "IndexPatternAttributes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @@ -1640,7 +1528,6 @@ export class IndexPatternsService { getDefault: () => Promise; getDefaultId: () => Promise; getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise; - // Warning: (ae-forgotten-export) The symbol "GetFieldsOptions" needs to be exported by the entry point index.d.ts getFieldsForWildcard: (options: GetFieldsOptions) => Promise; getIds: (refresh?: boolean) => Promise; getIdsWithTitle: (refresh?: boolean) => Promise; + aggs?: Record; // (undocumented) params?: { rollup_index: string; @@ -2578,13 +2465,6 @@ export const UI_SETTINGS: { readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget"; readonly HISTOGRAM_MAX_BARS: "histogram:maxBars"; readonly HISTORY_LIMIT: "history:limit"; - readonly SHORT_DOTS_ENABLE: "shortDots:enable"; - readonly FORMAT_DEFAULT_TYPE_MAP: "format:defaultTypeMap"; - readonly FORMAT_NUMBER_DEFAULT_PATTERN: "format:number:defaultPattern"; - readonly FORMAT_PERCENT_DEFAULT_PATTERN: "format:percent:defaultPattern"; - readonly FORMAT_BYTES_DEFAULT_PATTERN: "format:bytes:defaultPattern"; - readonly FORMAT_CURRENCY_DEFAULT_PATTERN: "format:currency:defaultPattern"; - readonly FORMAT_NUMBER_DEFAULT_LOCALE: "format:number:defaultLocale"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: "timepicker:refreshIntervalDefaults"; readonly TIMEPICKER_QUICK_RANGES: "timepicker:quickRanges"; readonly TIMEPICKER_TIME_DEFAULTS: "timepicker:timeDefaults"; @@ -2614,45 +2494,30 @@ export interface WaitUntilNextSessionCompletesOptions { // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:139:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:170:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts // src/plugins/data/common/search/aggs/types.ts:128:51 - (ae-forgotten-export) The symbol "AggTypesRegistryStart" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/search/search_source/fetch/get_search_params.ts:35:19 - (ae-forgotten-export) The symbol "GetConfigFn" needs to be exported by the entry point index.d.ts // src/plugins/data/public/deprecated.ts:98:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts // src/plugins/data/public/deprecated.ts:98:23 - (ae-forgotten-export) The symbol "convertRangeFilterToTimeRangeString" needs to be exported by the entry point index.d.ts // src/plugins/data/public/deprecated.ts:98:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/field_formats/field_formats_service.ts:51:3 - (ae-forgotten-export) The symbol "FormatFactory" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:53:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:96:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:123:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:123:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:123:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:123:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:123:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:294:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:294:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:294:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:296:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:297:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:306:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:307:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:308:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:309:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:313:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:314:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:317:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:318:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:321:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:27:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:54:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:54:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:54:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:54:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:54:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:227:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:227:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:227:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:229:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:230:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:239:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:240:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:241:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:242:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:246:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:247:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:250:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:251:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:254:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/search/session/session_service.ts:62:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/data/public/search/aggs/aggs_service.test.ts b/src/plugins/data/public/search/aggs/aggs_service.test.ts index cd2ee69d33996..563fd5d044073 100644 --- a/src/plugins/data/public/search/aggs/aggs_service.test.ts +++ b/src/plugins/data/public/search/aggs/aggs_service.test.ts @@ -11,7 +11,7 @@ import { BehaviorSubject, Subscription } from 'rxjs'; import { coreMock } from '../../../../../core/public/mocks'; import { expressionsPluginMock } from '../../../../../plugins/expressions/public/mocks'; import { BucketAggType, getAggTypes, MetricAggType } from '../../../common'; -import { fieldFormatsServiceMock } from '../../field_formats/mocks'; +import { fieldFormatsServiceMock } from '../../../../field_formats/public/mocks'; import { dataPluginMock } from '../../mocks'; import { diff --git a/src/plugins/data/public/search/aggs/aggs_service.ts b/src/plugins/data/public/search/aggs/aggs_service.ts index f603bd733f601..3f91ced6de950 100644 --- a/src/plugins/data/public/search/aggs/aggs_service.ts +++ b/src/plugins/data/public/search/aggs/aggs_service.ts @@ -10,7 +10,7 @@ import { Subscription } from 'rxjs'; import { IUiSettingsClient } from 'src/core/public'; import { ExpressionsServiceSetup } from 'src/plugins/expressions/common'; -import { FieldFormatsStart } from '../../field_formats'; +import { FieldFormatsStart } from '../../../../field_formats/public'; import { calculateBounds, TimeRange } from '../../../common'; import { aggsRequiredUiSettings, diff --git a/src/plugins/data/public/test_utils.ts b/src/plugins/data/public/test_utils.ts index b964ddbd2a379..613e3850c922e 100644 --- a/src/plugins/data/public/test_utils.ts +++ b/src/plugins/data/public/test_utils.ts @@ -6,5 +6,5 @@ * Side Public License, v 1. */ -export { getFieldFormatsRegistry } from './field_formats/field_formats_registry.stub'; +export { getFieldFormatsRegistry } from '../../field_formats/public/mocks'; export { getStubIndexPattern, StubIndexPattern } from './index_patterns/index_pattern.stub'; diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index 5ba4ba2bc48af..d8bfcfdb6ddb1 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -12,8 +12,8 @@ import { BfetchPublicSetup } from 'src/plugins/bfetch/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { ExpressionsSetup } from 'src/plugins/expressions/public'; import { UiActionsSetup, UiActionsStart } from 'src/plugins/ui_actions/public'; +import { FieldFormatsSetup, FieldFormatsStart } from 'src/plugins/field_formats/public'; import { AutocompleteSetup, AutocompleteStart } from './autocomplete'; -import { FieldFormatsSetup, FieldFormatsStart } from './field_formats'; import { createFiltersFromRangeSelectAction, createFiltersFromValueClickAction } from './actions'; import { ISearchSetup, ISearchStart } from './search'; import { QuerySetup, QueryStart } from './query'; @@ -29,10 +29,12 @@ export interface DataSetupDependencies { uiActions: UiActionsSetup; inspector: InspectorSetup; usageCollection?: UsageCollectionSetup; + fieldFormats: FieldFormatsSetup; } export interface DataStartDependencies { uiActions: UiActionsStart; + fieldFormats: FieldFormatsStart; } /** @@ -41,6 +43,9 @@ export interface DataStartDependencies { export interface DataPublicPluginSetup { autocomplete: AutocompleteSetup; search: ISearchSetup; + /** + * @deprecated Use fieldFormats plugin instead + */ fieldFormats: FieldFormatsSetup; query: QuerySetup; } @@ -86,8 +91,7 @@ export interface DataPublicPluginStart { */ search: ISearchStart; /** - * field formats service - * {@link FieldFormatsStart} + * @deprecated Use fieldFormats plugin instead */ fieldFormats: FieldFormatsStart; /** diff --git a/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap b/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap index 1e7b59d8a9e76..612ffdcf5029e 100644 --- a/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap +++ b/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap @@ -196,6 +196,7 @@ exports[`Inspector Data View component should render empty state 1`] = ` > import('./data_view')); diff --git a/src/plugins/data/public/utils/table_inspector_view/components/download_options.tsx b/src/plugins/data/public/utils/table_inspector_view/components/download_options.tsx index e79a1c2b52e03..57e586eaf12f8 100644 --- a/src/plugins/data/public/utils/table_inspector_view/components/download_options.tsx +++ b/src/plugins/data/public/utils/table_inspector_view/components/download_options.tsx @@ -22,7 +22,7 @@ import { import { CSV_MIME_TYPE, datatableToCSV, tableHasFormulas } from '../../../../common'; import { Datatable } from '../../../../../expressions'; import { downloadMultipleAs } from '../../../../../share/public'; -import { FieldFormatsStart } from '../../../field_formats'; +import { FieldFormatsStart } from '../../../../../field_formats/public'; import { IUiSettingsClient } from '../../../../../../core/public'; interface DataDownloadOptionsState { diff --git a/src/plugins/data/public/utils/table_inspector_view/index.ts b/src/plugins/data/public/utils/table_inspector_view/index.ts index 10c74bbc99dd0..498fe8d7fcca0 100644 --- a/src/plugins/data/public/utils/table_inspector_view/index.ts +++ b/src/plugins/data/public/utils/table_inspector_view/index.ts @@ -11,7 +11,7 @@ import { IUiSettingsClient } from 'kibana/public'; import { Adapters, InspectorViewDescription } from '../../../../inspector/public'; import { getDataViewComponentWrapper } from './components/data_view_wrapper'; import { UiActionsStart } from '../../../../ui_actions/public'; -import { FieldFormatsStart } from '../../field_formats'; +import { FieldFormatsStart } from '../../../../field_formats/public'; import { DatatableColumn } from '../../../../expressions/common/expression_types/specs'; export const getTableViewDescription = ( diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index e5656ceabc151..d010819d14e94 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -27,50 +27,7 @@ export const exporters = { * Field Formats: */ -import { - FieldFormatsRegistry, - FieldFormat, - BoolFormat, - BytesFormat, - ColorFormat, - DurationFormat, - IpFormat, - NumberFormat, - PercentFormat, - RelativeDateFormat, - SourceFormat, - StaticLookupFormat, - UrlFormat, - StringFormat, - TruncateFormat, - HistogramFormat, -} from '../common/field_formats'; - -export const fieldFormats = { - FieldFormatsRegistry, - FieldFormat, - BoolFormat, - BytesFormat, - ColorFormat, - DurationFormat, - IpFormat, - NumberFormat, - PercentFormat, - RelativeDateFormat, - SourceFormat, - StaticLookupFormat, - UrlFormat, - StringFormat, - TruncateFormat, - HistogramFormat, -}; - -export { - IFieldFormatsRegistry, - FieldFormatsGetConfigFn, - FieldFormatConfig, - INDEX_PATTERN_SAVED_OBJECT_TYPE, -} from '../common'; +export { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../common'; /* * Index patterns: diff --git a/src/plugins/data/server/index_patterns/index_patterns_service.ts b/src/plugins/data/server/index_patterns/index_patterns_service.ts index 4269f15127daf..c3cdc65d3fa04 100644 --- a/src/plugins/data/server/index_patterns/index_patterns_service.ts +++ b/src/plugins/data/server/index_patterns/index_patterns_service.ts @@ -22,7 +22,7 @@ import { registerRoutes } from './routes'; import { indexPatternSavedObjectType } from '../saved_objects'; import { capabilitiesProvider } from './capabilities_provider'; import { IndexPatternsCommonService } from '../'; -import { FieldFormatsStart } from '../field_formats'; +import { FieldFormatsStart } from '../../../field_formats/server'; import { getIndexPatternLoad } from './expressions'; import { UiSettingsServerToCommon } from './ui_settings_wrapper'; import { IndexPatternsApiServer } from './index_patterns_api_client'; diff --git a/src/plugins/data/server/mocks.ts b/src/plugins/data/server/mocks.ts index 786dd30dbabd0..af104dea72af7 100644 --- a/src/plugins/data/server/mocks.ts +++ b/src/plugins/data/server/mocks.ts @@ -11,13 +11,19 @@ import { createSearchStartMock, createSearchRequestHandlerContext, } from './search/mocks'; -import { createFieldFormatsSetupMock, createFieldFormatsStartMock } from './field_formats/mocks'; +import { + createFieldFormatsSetupMock, + createFieldFormatsStartMock, +} from '../../field_formats/server/mocks'; import { createIndexPatternsStartMock } from './index_patterns/mocks'; import { DataRequestHandlerContext } from './search'; function createSetupContract() { return { search: createSearchSetupMock(), + /** + * @deprecated - use directly from "fieldFormats" plugin instead + */ fieldFormats: createFieldFormatsSetupMock(), }; } @@ -25,6 +31,9 @@ function createSetupContract() { function createStartContract() { return { search: createSearchStartMock(), + /** + * @deprecated - use directly from "fieldFormats" plugin instead + */ fieldFormats: createFieldFormatsStartMock(), indexPatterns: createIndexPatternsStartMock(), }; diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index 7b73802f1a34d..e04095ed26a46 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -18,7 +18,7 @@ import { ScriptsService } from './scripts'; import { KqlTelemetryService } from './kql_telemetry'; import { UsageCollectionSetup } from '../../usage_collection/server'; import { AutocompleteService } from './autocomplete'; -import { FieldFormatsService, FieldFormatsSetup, FieldFormatsStart } from './field_formats'; +import { FieldFormatsSetup, FieldFormatsStart } from '../../field_formats/server'; import { getUiSettings } from './ui_settings'; export interface DataEnhancements { @@ -27,6 +27,9 @@ export interface DataEnhancements { export interface DataPluginSetup { search: ISearchSetup; + /** + * @deprecated - use "fieldFormats" plugin directly instead + */ fieldFormats: FieldFormatsSetup; /** * @internal @@ -36,6 +39,9 @@ export interface DataPluginSetup { export interface DataPluginStart { search: ISearchStart; + /** + * @deprecated - use "fieldFormats" plugin directly instead + */ fieldFormats: FieldFormatsStart; indexPatterns: IndexPatternsServiceStart; } @@ -44,6 +50,7 @@ export interface DataPluginSetupDependencies { bfetch: BfetchServerSetup; expressions: ExpressionsServerSetup; usageCollection?: UsageCollectionSetup; + fieldFormats: FieldFormatsSetup; } export interface DataPluginStartDependencies { @@ -64,7 +71,6 @@ export class DataServerPlugin private readonly kqlTelemetryService: KqlTelemetryService; private readonly autocompleteService: AutocompleteService; private readonly indexPatterns = new IndexPatternsServiceProvider(); - private readonly fieldFormats = new FieldFormatsService(); private readonly queryService = new QueryService(); private readonly logger: Logger; @@ -78,7 +84,7 @@ export class DataServerPlugin public setup( core: CoreSetup, - { bfetch, expressions, usageCollection }: DataPluginSetupDependencies + { bfetch, expressions, usageCollection, fieldFormats }: DataPluginSetupDependencies ) { this.scriptsService.setup(core); this.queryService.setup(core); @@ -103,12 +109,11 @@ export class DataServerPlugin searchSetup.__enhance(enhancements.search); }, search: searchSetup, - fieldFormats: this.fieldFormats.setup(), + fieldFormats, }; } - public start(core: CoreStart) { - const fieldFormats = this.fieldFormats.start(); + public start(core: CoreStart, { fieldFormats }: DataPluginStartDependencies) { const indexPatterns = this.indexPatterns.start(core, { fieldFormats, logger: this.logger.get('indexPatterns'), diff --git a/src/plugins/data/server/search/aggs/aggs_service.test.ts b/src/plugins/data/server/search/aggs/aggs_service.test.ts index 0a4f54ee339a1..fdff2a4a8118c 100644 --- a/src/plugins/data/server/search/aggs/aggs_service.test.ts +++ b/src/plugins/data/server/search/aggs/aggs_service.test.ts @@ -11,7 +11,7 @@ import { KibanaRequest, ElasticsearchClient } from 'src/core/server'; import { coreMock } from '../../../../../core/server/mocks'; import { expressionsPluginMock } from '../../../../../plugins/expressions/server/mocks'; import { BucketAggType, getAggTypes, MetricAggType } from '../../../common'; -import { createFieldFormatsStartMock } from '../../field_formats/mocks'; +import { createFieldFormatsStartMock } from '../../../../field_formats/server/mocks'; import { createIndexPatternsStartMock } from '../../index_patterns/mocks'; import { AggsService, AggsSetupDependencies, AggsStartDependencies } from './aggs_service'; diff --git a/src/plugins/data/server/search/aggs/aggs_service.ts b/src/plugins/data/server/search/aggs/aggs_service.ts index 96927728f2f2f..197d8fd7caa99 100644 --- a/src/plugins/data/server/search/aggs/aggs_service.ts +++ b/src/plugins/data/server/search/aggs/aggs_service.ts @@ -22,7 +22,7 @@ import { calculateBounds, TimeRange, } from '../../../common'; -import { FieldFormatsStart } from '../../field_formats'; +import { FieldFormatsStart } from '../../../../field_formats/server'; import { IndexPatternsServiceStart } from '../../index_patterns'; import { AggsSetup, AggsStart } from './types'; diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts index 314cb2c3acbf8..e6db3c76ef9ba 100644 --- a/src/plugins/data/server/search/search_service.test.ts +++ b/src/plugins/data/server/search/search_service.test.ts @@ -11,7 +11,7 @@ import { CoreSetup, CoreStart, SavedObject } from '../../../../core/server'; import { coreMock } from '../../../../core/server/mocks'; import { DataPluginStart, DataPluginStartDependencies } from '../plugin'; -import { createFieldFormatsStartMock } from '../field_formats/mocks'; +import { createFieldFormatsStartMock } from '../../../field_formats/server/mocks'; import { createIndexPatternsStartMock } from '../index_patterns/mocks'; import { SearchService, SearchServiceSetupDependencies } from './search_service'; diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index cc7981220fa6f..5b4ff121f3c77 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -34,7 +34,7 @@ import type { import { AggsService } from './aggs'; -import { FieldFormatsStart } from '../field_formats'; +import { FieldFormatsStart } from '../../../field_formats/server'; import { IndexPatternsServiceStart } from '../index_patterns'; import { registerMsearchRoute, registerSearchRoute } from './routes'; import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './strategies/es_search'; diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 9d5e598588f25..51436dabe05a0 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -33,7 +33,6 @@ import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { ExpressionValueBoxed } from 'src/plugins/expressions/common'; import { Filter as Filter_2 } from '@kbn/es-query'; -import { FormatFactory as FormatFactory_2 } from 'src/plugins/data/common/field_formats/utils'; import { IAggConfigs as IAggConfigs_2 } from 'src/plugins/data/public'; import { IEsSearchResponse as IEsSearchResponse_2 } from 'src/plugins/data/public'; import { IFieldSubType as IFieldSubType_2 } from '@kbn/es-query'; @@ -60,7 +59,6 @@ import { PathConfigType } from '@kbn/utils'; import { Plugin as Plugin_2 } from 'src/core/server'; import { Plugin as Plugin_3 } from 'kibana/server'; import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/server'; -import { PublicMethodsOf } from '@kbn/utility-types'; import { Query } from '@kbn/es-query'; import { RecursiveReadonly } from '@kbn/utility-types'; import { RequestAdapter } from 'src/plugins/inspector/common'; @@ -73,7 +71,7 @@ import { SavedObjectsFindOptions } from 'kibana/server'; import { SavedObjectsFindResponse } from 'kibana/server'; import { SavedObjectsUpdateResponse } from 'kibana/server'; import { Search } from '@elastic/elasticsearch/api/requestParams'; -import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; +import { SerializedFieldFormat as SerializedFieldFormat_3 } from 'src/plugins/expressions/common'; import { SharedGlobalConfig as SharedGlobalConfig_2 } from 'kibana/server'; import { ToastInputFields } from 'src/core/public/notifications'; import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; @@ -488,48 +486,6 @@ export { FieldDescriptor } export { FieldDescriptor as IndexPatternFieldDescriptor } -// Warning: (ae-missing-release-tag) "FieldFormatConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface FieldFormatConfig { - // (undocumented) - es?: boolean; - // Warning: (ae-forgotten-export) The symbol "FieldFormatId" needs to be exported by the entry point index.d.ts - // - // (undocumented) - id: FieldFormatId; - // (undocumented) - params: Record; -} - -// Warning: (ae-missing-release-tag) "fieldFormats" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const fieldFormats: { - FieldFormatsRegistry: typeof FieldFormatsRegistry; - FieldFormat: typeof FieldFormat; - BoolFormat: typeof BoolFormat; - BytesFormat: typeof BytesFormat; - ColorFormat: typeof ColorFormat; - DurationFormat: typeof DurationFormat; - IpFormat: typeof IpFormat; - NumberFormat: typeof NumberFormat; - PercentFormat: typeof PercentFormat; - RelativeDateFormat: typeof RelativeDateFormat; - SourceFormat: typeof SourceFormat; - StaticLookupFormat: typeof StaticLookupFormat; - UrlFormat: typeof UrlFormat; - StringFormat: typeof StringFormat; - TruncateFormat: typeof TruncateFormat; - HistogramFormat: typeof HistogramFormat; -}; - -// Warning: (ae-forgotten-export) The symbol "GetConfigFn" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "FieldFormatsGetConfigFn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type FieldFormatsGetConfigFn = GetConfigFn; - // Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated (undocumented) @@ -607,11 +563,6 @@ export interface IEsSearchRequest extends IKibanaSearchRequest = IKibanaSearchResponse>; -// Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export type IFieldFormatsRegistry = PublicMethodsOf; - // Warning: (ae-forgotten-export) The symbol "FieldParamType" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "IFieldParamType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -721,6 +672,7 @@ export class IndexPattern implements IIndexPattern { }; // (undocumented) getFieldByName(name: string): IndexPatternField | undefined; + // Warning: (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts getFormatterForField(field: IndexPatternField | IndexPatternField['spec'] | IFieldType): FieldFormat; getFormatterForFieldNoDefault(fieldname: string): FieldFormat | undefined; // @deprecated (undocumented) @@ -769,7 +721,7 @@ export class IndexPattern implements IIndexPattern { // Warning: (ae-forgotten-export) The symbol "SerializedFieldFormat" needs to be exported by the entry point index.d.ts // // (undocumented) - readonly setFieldFormat: (fieldName: string, format: SerializedFieldFormat) => void; + readonly setFieldFormat: (fieldName: string, format: SerializedFieldFormat_2) => void; // Warning: (ae-forgotten-export) The symbol "SourceFilter" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -1196,18 +1148,14 @@ export function parseInterval(interval: string): moment.Duration | null; export class Plugin implements Plugin_2 { constructor(initializerContext: PluginInitializerContext_2); // (undocumented) - setup(core: CoreSetup, { bfetch, expressions, usageCollection }: DataPluginSetupDependencies): { + setup(core: CoreSetup, { bfetch, expressions, usageCollection, fieldFormats }: DataPluginSetupDependencies): { __enhance: (enhancements: DataEnhancements) => void; search: ISearchSetup; - fieldFormats: { - register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number; - }; + fieldFormats: FieldFormatsSetup; }; // (undocumented) - start(core: CoreStart_2): { - fieldFormats: { - fieldFormatServiceFactory: (uiSettings: import("../../../core/server").IUiSettingsClient) => Promise; - }; + start(core: CoreStart_2, { fieldFormats }: DataPluginStartDependencies): { + fieldFormats: FieldFormatsStart; indexPatterns: { indexPatternsServiceFactory: (savedObjectsClient: Pick, elasticsearchClient: import("../../../core/server").ElasticsearchClient) => Promise; }; @@ -1228,9 +1176,7 @@ export function plugin(initializerContext: PluginInitializerContext void; - // Warning: (ae-forgotten-export) The symbol "FieldFormatsSetup" needs to be exported by the entry point index.d.ts - // - // (undocumented) + // @deprecated (undocumented) fieldFormats: FieldFormatsSetup; // (undocumented) search: ISearchSetup; @@ -1240,9 +1186,7 @@ export interface PluginSetup { // // @public (undocumented) export interface PluginStart { - // Warning: (ae-forgotten-export) The symbol "FieldFormatsStart" needs to be exported by the entry point index.d.ts - // - // (undocumented) + // @deprecated (undocumented) fieldFormats: FieldFormatsStart; // (undocumented) indexPatterns: IndexPatternsServiceStart; @@ -1425,13 +1369,6 @@ export const UI_SETTINGS: { readonly HISTOGRAM_BAR_TARGET: "histogram:barTarget"; readonly HISTOGRAM_MAX_BARS: "histogram:maxBars"; readonly HISTORY_LIMIT: "history:limit"; - readonly SHORT_DOTS_ENABLE: "shortDots:enable"; - readonly FORMAT_DEFAULT_TYPE_MAP: "format:defaultTypeMap"; - readonly FORMAT_NUMBER_DEFAULT_PATTERN: "format:number:defaultPattern"; - readonly FORMAT_PERCENT_DEFAULT_PATTERN: "format:percent:defaultPattern"; - readonly FORMAT_BYTES_DEFAULT_PATTERN: "format:bytes:defaultPattern"; - readonly FORMAT_CURRENCY_DEFAULT_PATTERN: "format:currency:defaultPattern"; - readonly FORMAT_NUMBER_DEFAULT_LOCALE: "format:number:defaultLocale"; readonly TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: "timepicker:refreshIntervalDefaults"; readonly TIMEPICKER_QUICK_RANGES: "timepicker:quickRanges"; readonly TIMEPICKER_TIME_DEFAULTS: "timepicker:timeDefaults"; @@ -1455,37 +1392,23 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:139:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts // src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:170:7 - (ae-forgotten-export) The symbol "RuntimeField" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:21:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:49:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:81:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:81:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:198:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:198:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:200:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:201:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:210:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:211:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:212:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:216:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:217:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:221:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:224:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:225:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:38:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:38:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:155:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:155:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:157:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:158:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:167:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:168:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:169:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:173:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:174:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:178:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:181:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:182:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/plugin.ts:87:88 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/plugin.ts:110:7 - (ae-forgotten-export) The symbol "FieldFormatsSetup" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/plugin.ts:117:14 - (ae-forgotten-export) The symbol "FieldFormatsStart" needs to be exported by the entry point index.d.ts // src/plugins/data/server/search/types.ts:120:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/src/plugins/data/server/ui_settings.ts b/src/plugins/data/server/ui_settings.ts index 0723c4b2d85c2..360529ad5a735 100644 --- a/src/plugins/data/server/ui_settings.ts +++ b/src/plugins/data/server/ui_settings.ts @@ -9,8 +9,6 @@ import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; import { UiSettingsParams } from 'kibana/server'; -// @ts-ignore untyped module -import numeralLanguages from '@elastic/numeral/languages'; import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../common'; const luceneQueryLanguageLabel = i18n.translate('data.advancedSettings.searchQueryLanguageLucene', { @@ -33,15 +31,6 @@ const requestPreferenceOptionLabels = { }), }; -// We add the `en` key manually here, since that's not a real numeral locale, but the -// default fallback in case the locale is not found. -const numeralLanguageIds = [ - 'en', - ...numeralLanguages.map((numeralLanguage: any) => { - return numeralLanguage.id; - }), -]; - export function getUiSettings(): Record> { return { [UI_SETTINGS.META_FIELDS]: { @@ -341,192 +330,6 @@ export function getUiSettings(): Record> { }), schema: schema.number(), }, - [UI_SETTINGS.SHORT_DOTS_ENABLE]: { - name: i18n.translate('data.advancedSettings.shortenFieldsTitle', { - defaultMessage: 'Shorten fields', - }), - value: false, - description: i18n.translate('data.advancedSettings.shortenFieldsText', { - defaultMessage: 'Shorten long fields, for example, instead of foo.bar.baz, show f.b.baz', - }), - schema: schema.boolean(), - }, - [UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: { - name: i18n.translate('data.advancedSettings.format.defaultTypeMapTitle', { - defaultMessage: 'Field type format name', - }), - value: `{ - "ip": { "id": "ip", "params": {} }, - "date": { "id": "date", "params": {} }, - "date_nanos": { "id": "date_nanos", "params": {}, "es": true }, - "number": { "id": "number", "params": {} }, - "boolean": { "id": "boolean", "params": {} }, - "histogram": { "id": "histogram", "params": {} }, - "_source": { "id": "_source", "params": {} }, - "_default_": { "id": "string", "params": {} } -}`, - type: 'json', - description: i18n.translate('data.advancedSettings.format.defaultTypeMapText', { - defaultMessage: - 'Map of the format name to use by default for each field type. ' + - '{defaultFormat} is used if the field type is not mentioned explicitly', - values: { - defaultFormat: '"_default_"', - }, - }), - schema: schema.object({ - ip: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - date: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - date_nanos: schema.object({ - id: schema.string(), - params: schema.object({}), - es: schema.boolean(), - }), - number: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - boolean: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - histogram: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - _source: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - _default_: schema.object({ - id: schema.string(), - params: schema.object({}), - }), - }), - }, - [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: { - name: i18n.translate('data.advancedSettings.format.numberFormatTitle', { - defaultMessage: 'Number format', - }), - value: '0,0.[000]', - type: 'string', - description: i18n.translate('data.advancedSettings.format.numberFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "number" format', - description: - 'Part of composite text: data.advancedSettings.format.numberFormatText + ' + - 'data.advancedSettings.format.numberFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('data.advancedSettings.format.numberFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - schema: schema.string(), - }, - [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: { - name: i18n.translate('data.advancedSettings.format.percentFormatTitle', { - defaultMessage: 'Percent format', - }), - value: '0,0.[000]%', - type: 'string', - description: i18n.translate('data.advancedSettings.format.percentFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "percent" format', - description: - 'Part of composite text: data.advancedSettings.format.percentFormatText + ' + - 'data.advancedSettings.format.percentFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('data.advancedSettings.format.percentFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - schema: schema.string(), - }, - [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: { - name: i18n.translate('data.advancedSettings.format.bytesFormatTitle', { - defaultMessage: 'Bytes format', - }), - value: '0,0.[0]b', - type: 'string', - description: i18n.translate('data.advancedSettings.format.bytesFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "bytes" format', - description: - 'Part of composite text: data.advancedSettings.format.bytesFormatText + ' + - 'data.advancedSettings.format.bytesFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('data.advancedSettings.format.bytesFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - schema: schema.string(), - }, - [UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN]: { - name: i18n.translate('data.advancedSettings.format.currencyFormatTitle', { - defaultMessage: 'Currency format', - }), - value: '($0,0.[00])', - type: 'string', - description: i18n.translate('data.advancedSettings.format.currencyFormatText', { - defaultMessage: 'Default {numeralFormatLink} for the "currency" format', - description: - 'Part of composite text: data.advancedSettings.format.currencyFormatText + ' + - 'data.advancedSettings.format.currencyFormat.numeralFormatLinkText', - values: { - numeralFormatLink: - '' + - i18n.translate('data.advancedSettings.format.currencyFormat.numeralFormatLinkText', { - defaultMessage: 'numeral format', - }) + - '', - }, - }), - schema: schema.string(), - }, - [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: { - name: i18n.translate('data.advancedSettings.format.formattingLocaleTitle', { - defaultMessage: 'Formatting locale', - }), - value: 'en', - type: 'select', - options: numeralLanguageIds, - optionLabels: Object.fromEntries( - numeralLanguages.map((language: Record) => [language.id, language.name]) - ), - description: i18n.translate('data.advancedSettings.format.formattingLocaleText', { - defaultMessage: `{numeralLanguageLink} locale`, - description: - 'Part of composite text: data.advancedSettings.format.formattingLocale.numeralLanguageLinkText + ' + - 'data.advancedSettings.format.formattingLocaleText', - values: { - numeralLanguageLink: - '' + - i18n.translate( - 'data.advancedSettings.format.formattingLocale.numeralLanguageLinkText', - { - defaultMessage: 'Numeral language', - } - ) + - '', - }, - }), - schema: schema.string(), - }, [UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS]: { name: i18n.translate('data.advancedSettings.timepicker.refreshIntervalDefaultsTitle', { defaultMessage: 'Time filter refresh interval', diff --git a/src/plugins/data/tsconfig.json b/src/plugins/data/tsconfig.json index 9c95878af631e..6e4e89f7538fd 100644 --- a/src/plugins/data/tsconfig.json +++ b/src/plugins/data/tsconfig.json @@ -23,6 +23,7 @@ { "path": "../inspector/tsconfig.json" }, { "path": "../usage_collection/tsconfig.json" }, { "path": "../kibana_utils/tsconfig.json" }, - { "path": "../kibana_react/tsconfig.json" } + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../field_formats/tsconfig.json" } ] } diff --git a/src/plugins/discover/kibana.json b/src/plugins/discover/kibana.json index 04469e0ef4276..f612e0ec2cc8d 100644 --- a/src/plugins/discover/kibana.json +++ b/src/plugins/discover/kibana.json @@ -16,7 +16,7 @@ "indexPatternFieldEditor" ], "optionalPlugins": ["home", "share", "usageCollection"], - "requiredBundles": ["kibanaUtils", "home", "kibanaReact"], + "requiredBundles": ["kibanaUtils", "home", "kibanaReact", "fieldFormats"], "owner": { "name": "Kibana App", "githubTeam": "kibana-app" diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts index 5e3a025d8c7ba..0f6c86df0db64 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts @@ -9,7 +9,7 @@ import { TableHeader } from './table_header/table_header'; import { getServices } from '../../../../kibana_services'; import { SORT_DEFAULT_ORDER_SETTING, DOC_HIDE_TIME_COLUMN_SETTING } from '../../../../../common'; -import { UI_SETTINGS } from '../../../../../../data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../field_formats/common'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function createTableHeaderDirective(reactDirective: any) { @@ -30,7 +30,7 @@ export function createTableHeaderDirective(reactDirective: any) { { restrict: 'A' }, { hideTimeColumn: config.get(DOC_HIDE_TIME_COLUMN_SETTING, false), - isShortDots: config.get(UI_SETTINGS.SHORT_DOTS_ENABLE), + isShortDots: config.get(FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE), defaultSortOrder: config.get(SORT_DEFAULT_ORDER_SETTING, 'desc'), } ); diff --git a/src/plugins/discover/public/application/angular/helpers/row_formatter.test.ts b/src/plugins/discover/public/application/angular/helpers/row_formatter.test.ts index 80fb8a570f78b..6b356446850e6 100644 --- a/src/plugins/discover/public/application/angular/helpers/row_formatter.test.ts +++ b/src/plugins/discover/public/application/angular/helpers/row_formatter.test.ts @@ -9,7 +9,7 @@ import { formatRow, formatTopLevelObject } from './row_formatter'; import { stubbedSavedObjectIndexPattern } from '../../../__mocks__/stubbed_saved_object_index_pattern'; import { IndexPattern } from '../../../../../data/common/index_patterns/index_patterns'; -import { fieldFormatsMock } from '../../../../../data/common/field_formats/mocks'; +import { fieldFormatsMock } from '../../../../../field_formats/common/mocks'; import { setServices } from '../../../kibana_services'; import { DiscoverServices } from '../../../build_services'; diff --git a/src/plugins/discover/public/application/components/source_viewer/__snapshots__/source_viewer.test.tsx.snap b/src/plugins/discover/public/application/components/source_viewer/__snapshots__/source_viewer.test.tsx.snap index 5f6dabc26659f..dfded530c6983 100644 --- a/src/plugins/discover/public/application/components/source_viewer/__snapshots__/source_viewer.test.tsx.snap +++ b/src/plugins/discover/public/application/components/source_viewer/__snapshots__/source_viewer.test.tsx.snap @@ -167,6 +167,7 @@ exports[`Source Viewer component renders error state 1`] = ` >

    { + const fn = functionWrapper(progressFunction); + const value = 0.33; + + it('returns a render as progress', () => { + const result = fn(0.2, {}, {} as ExecutionContext); + expect(result).toHaveProperty('type', 'render'); + expect(result).toHaveProperty('as', 'progress'); + }); + + it('sets the progress to context', () => { + const result = fn(0.58, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('value', 0.58); + }); + + it(`throws when context is outside of the valid range`, async () => { + expect.assertions(1); + try { + await fn(3, {}, {} as ExecutionContext); + } catch (e: any) { + expect(e.message).toEqual(errors.invalidValue(3).message); + } + }); + + describe('args', () => { + describe('shape', () => { + it('sets the progress element shape', () => { + const result = fn( + value, + { + shape: 'wheel', + }, + {} as ExecutionContext + ); + expect(result.value).toHaveProperty('shape', 'wheel'); + }); + + it(`defaults to 'gauge'`, () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('shape', 'gauge'); + }); + }); + + describe('max', () => { + it('sets the maximum value', () => { + const result = fn( + value, + { + max: 2, + }, + {} as ExecutionContext + ); + expect(result.value).toHaveProperty('max', 2); + }); + + it('defaults to 1', () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('max', 1); + }); + + it('throws if max <= 0', async () => { + expect.assertions(1); + try { + await fn(value, { max: -0.5 }, {} as ExecutionContext); + } catch (e: any) { + expect(e.message).toEqual(errors.invalidMaxValue(-0.5).message); + } + }); + }); + + describe('valueColor', () => { + it('sets the color of the progress bar', () => { + const result = fn( + value, + { + valueColor: '#000000', + }, + {} as ExecutionContext + ); + expect(result.value).toHaveProperty('valueColor', '#000000'); + }); + + it(`defaults to '#1785b0'`, () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('valueColor', '#1785b0'); + }); + }); + + describe('barColor', () => { + it('sets the color of the background bar', () => { + const result = fn( + value, + { + barColor: '#FFFFFF', + }, + {} as ExecutionContext + ); + expect(result.value).toHaveProperty('barColor', '#FFFFFF'); + }); + + it(`defaults to '#f0f0f0'`, () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('barColor', '#f0f0f0'); + }); + }); + + describe('valueWeight', () => { + it('sets the thickness of the bars', () => { + const result = fn( + value, + { + valuWeight: 100, + }, + {} as ExecutionContext + ); + + expect(result.value).toHaveProperty('valuWeight', 100); + }); + + it(`defaults to 20`, () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('barWeight', 20); + }); + }); + + describe('barWeight', () => { + it('sets the thickness of the bars', () => { + const result = fn( + value, + { + barWeight: 50, + }, + {} as ExecutionContext + ); + + expect(result.value).toHaveProperty('barWeight', 50); + }); + + it(`defaults to 20`, () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('barWeight', 20); + }); + }); + + describe('label', () => { + it('sets the label of the progress', () => { + const result = fn(value, { label: 'foo' }, {} as ExecutionContext); + + expect(result.value).toHaveProperty('label', 'foo'); + }); + + it('hides the label if false', () => { + const result = fn( + value, + { + label: false, + }, + {} as ExecutionContext + ); + expect(result.value).toHaveProperty('label', ''); + }); + + it('defaults to true which sets the context as the label', () => { + const result = fn(value, {}, {} as ExecutionContext); + expect(result.value).toHaveProperty('label', '0.33'); + }); + }); + + describe('font', () => { + it('sets the font style for the label', () => { + const result = fn( + value, + { + font: fontStyle, + }, + {} as ExecutionContext + ); + + expect(result.value).toHaveProperty('font'); + expect(Object.keys(result.value.font).sort()).toEqual(Object.keys(fontStyle).sort()); + expect(Object.keys(result.value.font.spec).sort()).toEqual( + Object.keys(fontStyle.spec).sort() + ); + }); + + it('sets fill to color', () => { + const result = fn( + value, + { + font: fontStyle, + }, + {} as ExecutionContext + ); + expect(result.value.font.spec).toHaveProperty('fill', fontStyle.spec.color); + }); + + // TODO: write test when using an instance of the interpreter + // it("sets a default style for the label when not provided", () => {}); + }); + }); +}); diff --git a/src/plugins/expression_shape/common/expression_functions/progress_function.ts b/src/plugins/expression_shape/common/expression_functions/progress_function.ts new file mode 100644 index 0000000000000..56ee8878e531c --- /dev/null +++ b/src/plugins/expression_shape/common/expression_functions/progress_function.ts @@ -0,0 +1,174 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; +import { Style, openSans } from '../../../expressions/common'; +import { CSS, FONT_FAMILY, FONT_WEIGHT, BOOLEAN_TRUE, BOOLEAN_FALSE } from '../constants'; +import { ExpressionProgressFunction, Progress } from '../types'; + +export const strings = { + help: i18n.translate('expressionShape.functions.progressHelpText', { + defaultMessage: 'Configures a progress element.', + }), + args: { + barColor: i18n.translate('expressionShape.functions.progress.args.barColorHelpText', { + defaultMessage: 'The color of the background bar.', + }), + barWeight: i18n.translate('expressionShape.functions.progress.args.barWeightHelpText', { + defaultMessage: 'The thickness of the background bar.', + }), + font: i18n.translate('expressionShape.functions.progress.args.fontHelpText', { + defaultMessage: + 'The {CSS} font properties for the label. For example, {FONT_FAMILY} or {FONT_WEIGHT}.', + values: { + CSS, + FONT_FAMILY, + FONT_WEIGHT, + }, + }), + label: i18n.translate('expressionShape.functions.progress.args.labelHelpText', { + defaultMessage: + 'To show or hide the label, use {BOOLEAN_TRUE} or {BOOLEAN_FALSE}. Alternatively, provide a string to display as a label.', + values: { + BOOLEAN_TRUE, + BOOLEAN_FALSE, + }, + }), + max: i18n.translate('expressionShape.functions.progress.args.maxHelpText', { + defaultMessage: 'The maximum value of the progress element.', + }), + shape: i18n.translate('expressionShape.functions.progress.args.shapeHelpText', { + defaultMessage: `Select {list}, or {end}.`, + values: { + list: Object.values(Progress) + .slice(0, -1) + .map((shape) => `\`"${shape}"\``) + .join(', '), + end: `\`"${Object.values(Progress).slice(-1)[0]}"\``, + }, + }), + valueColor: i18n.translate('expressionShape.functions.progress.args.valueColorHelpText', { + defaultMessage: 'The color of the progress bar.', + }), + valueWeight: i18n.translate('expressionShape.functions.progress.args.valueWeightHelpText', { + defaultMessage: 'The thickness of the progress bar.', + }), + }, +}; + +export const errors = { + invalidMaxValue: (max: number) => + new Error( + i18n.translate('expressionShape.functions.progress.invalidMaxValueErrorMessage', { + defaultMessage: "Invalid {arg} value: '{max, number}'. '{arg}' must be greater than 0", + values: { + arg: 'max', + max, + }, + }) + ), + invalidValue: (value: number, max: number = 1) => + new Error( + i18n.translate('expressionShape.functions.progress.invalidValueErrorMessage', { + defaultMessage: + "Invalid value: '{value, number}'. Value must be between 0 and {max, number}", + values: { + value, + max, + }, + }) + ), +}; + +export const progressFunction: ExpressionProgressFunction = () => { + const { help, args: argHelp } = strings; + + return { + name: 'progress', + aliases: [], + type: 'render', + inputTypes: ['number'], + help, + args: { + shape: { + aliases: ['_'], + types: ['string'], + help: argHelp.shape, + options: Object.values(Progress), + default: 'gauge', + }, + barColor: { + types: ['string'], + help: argHelp.barColor, + default: `#f0f0f0`, + }, + barWeight: { + types: ['number'], + help: argHelp.barWeight, + default: 20, + }, + font: { + types: ['style'], + help: argHelp.font, + default: `{font size=24 family="${openSans.value}" color="#000000" align=center}`, + }, + label: { + types: ['boolean', 'string'], + help: argHelp.label, + default: true, + }, + max: { + types: ['number'], + help: argHelp.max, + default: 1, + }, + valueColor: { + types: ['string'], + help: argHelp.valueColor, + default: `#1785b0`, + }, + valueWeight: { + types: ['number'], + help: argHelp.valueWeight, + default: 20, + }, + }, + fn: (value, args) => { + if (args.max <= 0) { + throw errors.invalidMaxValue(args.max); + } + if (value > args.max || value < 0) { + throw errors.invalidValue(value, args.max); + } + + let label = ''; + if (args.label) { + label = typeof args.label === 'string' ? args.label : `${value}`; + } + + let font: Style = {} as Style; + + if (get(args, 'font.spec')) { + font = { ...args.font }; + font.spec.fill = args.font.spec.color; // SVG uses fill for font color + } + + return { + type: 'render', + as: 'progress', + value: { + value, + ...args, + label, + font, + }, + }; + }, + }; +}; diff --git a/src/plugins/expression_shape/common/index.ts b/src/plugins/expression_shape/common/index.ts index 7a56f49eb38cb..94dba27576094 100755 --- a/src/plugins/expression_shape/common/index.ts +++ b/src/plugins/expression_shape/common/index.ts @@ -9,4 +9,4 @@ export * from './constants'; export * from './types'; -export { getAvailableShapes } from './lib/available_shapes'; +export { getAvailableShapes, getAvailableProgressShapes } from './lib/available_shapes'; diff --git a/src/plugins/expression_shape/common/lib/available_shapes.ts b/src/plugins/expression_shape/common/lib/available_shapes.ts index a8883f76e0c98..b1e2ab8e63434 100644 --- a/src/plugins/expression_shape/common/lib/available_shapes.ts +++ b/src/plugins/expression_shape/common/lib/available_shapes.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ -import { Shape } from '../types'; +import { Shape, Progress } from '../types'; export const getAvailableShapes = () => Object.values(Shape); +export const getAvailableProgressShapes = () => Object.values(Progress); diff --git a/src/plugins/expression_shape/common/lib/get_id.ts b/src/plugins/expression_shape/common/lib/get_id.ts new file mode 100644 index 0000000000000..9e4e4d6486349 --- /dev/null +++ b/src/plugins/expression_shape/common/lib/get_id.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 uuid from 'uuid/v4'; + +export function getId(type: string): string { + return `${type}-${uuid()}`; +} diff --git a/src/plugins/expression_shape/common/lib/index.ts b/src/plugins/expression_shape/common/lib/index.ts index d62a0d96078be..726d63929ebd8 100644 --- a/src/plugins/expression_shape/common/lib/index.ts +++ b/src/plugins/expression_shape/common/lib/index.ts @@ -8,3 +8,4 @@ export * from './view_box'; export * from './available_shapes'; +export * from './get_id'; diff --git a/src/plugins/expression_shape/common/lib/view_box.ts b/src/plugins/expression_shape/common/lib/view_box.ts index 3028d7a846ed4..b931a6dab1a38 100644 --- a/src/plugins/expression_shape/common/lib/view_box.ts +++ b/src/plugins/expression_shape/common/lib/view_box.ts @@ -9,7 +9,10 @@ import { ParentNodeParams, ViewBoxParams } from '../types'; export function viewBoxToString(viewBox?: ViewBoxParams): undefined | string { - if (!viewBox) return; + if (!viewBox) { + return; + } + return `${viewBox?.minX} ${viewBox?.minY} ${viewBox?.width} ${viewBox?.height}`; } diff --git a/src/plugins/expression_shape/common/types/expression_functions.ts b/src/plugins/expression_shape/common/types/expression_functions.ts index 4f0fad62fde04..2486be13f51bf 100644 --- a/src/plugins/expression_shape/common/types/expression_functions.ts +++ b/src/plugins/expression_shape/common/types/expression_functions.ts @@ -5,7 +5,8 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { ExpressionFunctionDefinition } from 'src/plugins/expressions'; + +import { ExpressionFunctionDefinition, ExpressionValueRender, Style } from '../../../expressions'; export enum Shape { ARROW = 'arrow', @@ -44,3 +45,36 @@ export type ExpressionShapeFunction = () => ExpressionFunctionDefinition< Arguments, Output >; + +export enum Progress { + GAUGE = 'gauge', + HORIZONTAL_BAR = 'horizontalBar', + HORIZONTAL_PILL = 'horizontalPill', + SEMICIRCLE = 'semicircle', + UNICORN = 'unicorn', + VERTICAL_BAR = 'verticalBar', + VERTICAL_PILL = 'verticalPill', + WHEEL = 'wheel', +} + +export interface ProgressArguments { + barColor: string; + barWeight: number; + font: Style; + label: boolean | string; + max: number; + shape: Progress; + valueColor: string; + valueWeight: number; +} + +export type ProgressOutput = ProgressArguments & { + value: number; +}; + +export type ExpressionProgressFunction = () => ExpressionFunctionDefinition< + 'progress', + number, + ProgressArguments, + ExpressionValueRender +>; diff --git a/src/plugins/expression_shape/common/types/expression_renderers.ts b/src/plugins/expression_shape/common/types/expression_renderers.ts index c61d8292ddff6..8c95687d099a6 100644 --- a/src/plugins/expression_shape/common/types/expression_renderers.ts +++ b/src/plugins/expression_shape/common/types/expression_renderers.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 { Shape } from './expression_functions'; +import { Shape, ProgressOutput as Arguments } from './expression_functions'; export type OriginString = 'bottom' | 'left' | 'top' | 'right'; export interface ShapeRendererConfig { @@ -33,3 +33,5 @@ export interface ViewBoxParams { width: number; height: number; } + +export type ProgressRendererConfig = Arguments; diff --git a/src/plugins/vis_type_timeseries/public/application/visualizations/lib/active_cursor.ts b/src/plugins/expression_shape/public/components/progress/index.ts similarity index 65% rename from src/plugins/vis_type_timeseries/public/application/visualizations/lib/active_cursor.ts rename to src/plugins/expression_shape/public/components/progress/index.ts index 7f7f62fd6a9da..3aa7e6212cf09 100644 --- a/src/plugins/vis_type_timeseries/public/application/visualizations/lib/active_cursor.ts +++ b/src/plugins/expression_shape/public/components/progress/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Subject } from 'rxjs'; -import { PointerEvent } from '@elastic/charts'; +import { lazy } from 'react'; -export const activeCursor$ = new Subject(); +export const LazyProgressComponent = lazy(() => import('./progress_component')); +export const LazyProgressDrawer = lazy(() => import('./progress_drawer')); diff --git a/src/plugins/expression_shape/public/components/progress/progress_component.tsx b/src/plugins/expression_shape/public/components/progress/progress_component.tsx new file mode 100644 index 0000000000000..e9c71753e8ff6 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/progress_component.tsx @@ -0,0 +1,131 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { CSSProperties, RefCallback, useCallback, useEffect, useRef, useState } from 'react'; +import { useResizeObserver } from '@elastic/eui'; +import { IInterpreterRenderHandlers } from '../../../../expressions'; +import { NodeDimensions, ProgressRendererConfig } from '../../../common/types'; +import { ShapeRef, SvgConfig, SvgTextAttributes } from '../reusable/types'; +import { getShapeContentElement } from '../reusable/shape_factory'; +import { withSuspense } from '../../../../presentation_util/public'; +import { getTextAttributes, getViewBox } from './utils'; +import { getId } from '../../../common/lib'; +import { getDefaultShapeData } from '../reusable'; +import { LazyProgressDrawer } from '../..'; + +const ProgressDrawer = withSuspense(LazyProgressDrawer); + +interface ProgressComponentProps extends ProgressRendererConfig { + onLoaded: IInterpreterRenderHandlers['done']; + parentNode: HTMLElement; +} + +function ProgressComponent({ + onLoaded, + parentNode, + shape: shapeType, + value, + max, + valueColor, + barColor, + valueWeight, + barWeight, + label, + font, +}: ProgressComponentProps) { + const parentNodeDimensions = useResizeObserver(parentNode); + const [dimensions, setDimensions] = useState({ + width: parentNode.offsetWidth, + height: parentNode.offsetHeight, + }); + const [shapeData, setShapeData] = useState(getDefaultShapeData()); + const shapeRef = useCallback>((node) => { + if (node !== null) { + setShapeData(node.getData()); + } + }, []); + + const [totalLength, setTotalLength] = useState(0); + + useEffect(() => { + setDimensions({ + width: parentNode.offsetWidth, + height: parentNode.offsetHeight, + }); + onLoaded(); + }, [onLoaded, parentNode, parentNodeDimensions]); + + const progressRef = useRef< + SVGCircleElement & SVGPathElement & SVGPolygonElement & SVGRectElement + >(null); + const textRef = useRef(null); + + useEffect(() => { + setTotalLength(progressRef.current ? progressRef.current.getTotalLength() : 0); + }, [shapeType, shapeData, progressRef]); + + const BarProgress = shapeData.shapeType ? getShapeContentElement(shapeData.shapeType) : null; + + const shapeContentAttributes = { + fill: 'none', + stroke: barColor, + strokeWidth: `${barWeight}px`, + }; + + const percent = value / max; + const to = totalLength * (1 - percent); + + const barProgressAttributes = { + ...shapeData.shapeProps, + fill: 'none', + stroke: valueColor, + strokeWidth: `${valueWeight}px`, + strokeDasharray: totalLength, + strokeDashoffset: Math.max(0, to), + }; + + const { width: labelWidth, height: labelHeight } = textRef.current + ? textRef.current.getBBox() + : { width: 0, height: 0 }; + + const offset = Math.max(valueWeight, barWeight); + + const updatedTextAttributes = shapeData.textAttributes + ? getTextAttributes(shapeType, shapeData.textAttributes, offset, label) + : {}; + + const textAttributes: SvgTextAttributes = { + style: font.spec as CSSProperties, + ...updatedTextAttributes, + }; + + const updatedViewBox = getViewBox(shapeType, shapeData.viewBox, offset, labelWidth, labelHeight); + const shapeAttributes = { + id: getId('svg'), + ...(dimensions || {}), + viewBox: updatedViewBox, + }; + + return ( +
    + + {BarProgress && } + +
    + ); +} + +// default export required for React.Lazy +// eslint-disable-next-line import/no-default-export +export { ProgressComponent as default }; diff --git a/src/plugins/expression_shape/public/components/progress/progress_drawer.tsx b/src/plugins/expression_shape/public/components/progress/progress_drawer.tsx new file mode 100644 index 0000000000000..0d5ed96d35dd5 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/progress_drawer.tsx @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import React, { Ref } from 'react'; +import { ShapeDrawer, ShapeRef, ShapeDrawerComponentProps } from '../reusable'; +import { getShape } from './shapes'; + +const ProgressDrawerComponent = React.forwardRef( + (props: ShapeDrawerComponentProps, ref: Ref) => ( + + ) +); + +// eslint-disable-next-line import/no-default-export +export { ProgressDrawerComponent as default }; diff --git a/src/plugins/expression_shape/public/components/progress/shapes/gauge.tsx b/src/plugins/expression_shape/public/components/progress/shapes/gauge.tsx new file mode 100644 index 0000000000000..c7eebf7be4982 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/gauge.tsx @@ -0,0 +1,29 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const Gauge = createShape({ + viewBox: { + minX: 0, + minY: 0, + width: 120, + height: 120, + }, + shapeProps: { + d: 'M 15 100 A 60 60 0 1 1 105 100', + }, + shapeType: SvgElementTypes.path, + textAttributes: { + x: '60', + y: '60', + textAnchor: 'middle', + dominantBaseline: 'central', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/horizontal_bar.tsx b/src/plugins/expression_shape/public/components/progress/shapes/horizontal_bar.tsx new file mode 100644 index 0000000000000..81e6cb6bf0cca --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/horizontal_bar.tsx @@ -0,0 +1,28 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const HorizontalBar = createShape({ + viewBox: { + minX: 0, + minY: 0, + width: 208, + height: 1, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: 'M 0 1 L 200 1', + }, + textAttributes: { + x: 208, + y: 0, + textAnchor: 'start', + dominantBaseline: 'central', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/horizontal_pill.tsx b/src/plugins/expression_shape/public/components/progress/shapes/horizontal_pill.tsx new file mode 100644 index 0000000000000..084438ddd7910 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/horizontal_pill.tsx @@ -0,0 +1,29 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const HorizontalPill = createShape({ + viewBox: { + minX: 0, + minY: 0, + width: 208, + height: 1, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: 'M 0 1 L 200 1', + strokeLinecap: 'round', + }, + textAttributes: { + x: 208, + y: 0, + textAnchor: 'start', + dominantBaseline: 'central', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/index.ts b/src/plugins/expression_shape/public/components/progress/shapes/index.ts new file mode 100644 index 0000000000000..ef7b4a7b1ec0a --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/index.ts @@ -0,0 +1,30 @@ +/* + * 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 { ShapeType } from '../../reusable'; +import { Gauge as gauge } from './gauge'; +import { HorizontalBar as horizontalBar } from './horizontal_bar'; +import { HorizontalPill as horizontalPill } from './horizontal_pill'; +import { Semicircle as semicircle } from './semicircle'; +import { Unicorn as unicorn } from './unicorn'; +import { VerticalBar as verticalBar } from './vertical_bar'; +import { VerticalPill as verticalPill } from './vertical_pill'; +import { Wheel as wheel } from './wheel'; + +const shapes: { [key: string]: ShapeType } = { + gauge, + horizontalBar, + horizontalPill, + semicircle, + unicorn, + verticalBar, + verticalPill, + wheel, +}; + +export const getShape = (shapeType: string) => shapes[shapeType]; diff --git a/src/plugins/expression_shape/public/components/progress/shapes/semicircle.tsx b/src/plugins/expression_shape/public/components/progress/shapes/semicircle.tsx new file mode 100644 index 0000000000000..a624a0bdf3137 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/semicircle.tsx @@ -0,0 +1,28 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const Semicircle = createShape({ + viewBox: { + minX: 0, + minY: 0, + width: 120, + height: 60, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: 'M 0 60 A 60 60 0 1 1 120 60', + }, + textAttributes: { + x: 60, + y: 60, + textAnchor: 'middle', + dy: '-1', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/unicorn.tsx b/src/plugins/expression_shape/public/components/progress/shapes/unicorn.tsx new file mode 100644 index 0000000000000..020176244e444 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/unicorn.tsx @@ -0,0 +1,29 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const Unicorn = createShape({ + viewBox: { + minX: 0, + minY: 0, + width: 200, + height: 200, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: + 'M 123 189 C 93 141 129 126 102 96 L 78 102 L 48 117 L 42 129 Q 30 132 21 126 L 18 114 L 27 90 L 42 72 L 48 57 L 3 6 L 57 42 L 63 33 L 60 15 L 69 27 L 69 15 L 84 27 Q 162 36 195 108 Q 174 159 123 189 Z', + }, + textAttributes: { + x: '0', + y: '200', + textAnchor: 'start', + dominantBaseline: 'text-after-edge', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/vertical_bar.tsx b/src/plugins/expression_shape/public/components/progress/shapes/vertical_bar.tsx new file mode 100644 index 0000000000000..bedb0e93dfd88 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/vertical_bar.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const VerticalBar = createShape({ + viewBox: { + minX: 0, + minY: -8, + width: 1, + height: 208, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: 'M 1 200 L 1 0', + }, + textAttributes: { + x: '0', + y: '-8', + textAnchor: 'middle', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/vertical_pill.tsx b/src/plugins/expression_shape/public/components/progress/shapes/vertical_pill.tsx new file mode 100644 index 0000000000000..9226cc03e16a9 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/vertical_pill.tsx @@ -0,0 +1,28 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const VerticalPill = createShape({ + viewBox: { + minX: 0, + minY: -8, + width: 1, + height: 208, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: 'M 1 200 L 1 0', + strokeLinecap: 'round', + }, + textAttributes: { + x: '0', + y: '-8', + textAnchor: 'middle', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/shapes/wheel.tsx b/src/plugins/expression_shape/public/components/progress/shapes/wheel.tsx new file mode 100644 index 0000000000000..484738335a07d --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/shapes/wheel.tsx @@ -0,0 +1,28 @@ +/* + * 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 { createShape } from '../../reusable/shape_factory'; +import { SvgElementTypes } from '../../reusable'; + +export const Wheel = createShape({ + viewBox: { + minX: 0, + minY: 0, + width: 120, + height: 120, + }, + shapeType: SvgElementTypes.path, + shapeProps: { + d: 'M 60 0 A 60 60 0 1 1 60 120 A 60 60 0 1 1 60 0 Z', + }, + textAttributes: { + x: '60', + y: '60', + textAnchor: 'middle', + dominantBaseline: 'central', + }, +}); diff --git a/src/plugins/expression_shape/public/components/progress/utils.ts b/src/plugins/expression_shape/public/components/progress/utils.ts new file mode 100644 index 0000000000000..890e6739675a4 --- /dev/null +++ b/src/plugins/expression_shape/public/components/progress/utils.ts @@ -0,0 +1,146 @@ +/* + * 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 { Progress, ViewBoxParams } from '../../../common'; +import { SvgTextAttributes } from '../reusable'; + +type GetViewBox = ( + shapeType: Progress, + initialViewBox: ViewBoxParams, + offset: number, + labelWidth: number, + labelHeight: number +) => ViewBoxParams; + +type GetViewBoxArguments = Parameters; +type GetViewBoxParam = (...args: GetViewBoxArguments) => number; + +const getMinX: GetViewBoxParam = (shapeType, viewBox, offset = 0) => { + let { minX } = viewBox; + + if (shapeType !== Progress.HORIZONTAL_BAR) { + minX -= offset / 2; + } + + return minX; +}; + +const getMinY: GetViewBoxParam = (shapeType, viewBox, offset = 0, labelWidth, labelHeight = 0) => { + let { minY } = viewBox; + + if (shapeType === Progress.SEMICIRCLE) { + minY -= offset / 2; + } + if (shapeType !== Progress.SEMICIRCLE && shapeType !== Progress.VERTICAL_BAR) { + minY -= offset / 2; + } + if (shapeType === Progress.VERTICAL_BAR || shapeType === Progress.VERTICAL_PILL) { + minY -= labelHeight; + } + + return minY; +}; + +const getWidth: GetViewBoxParam = (shapeType, viewBox, offset = 0, labelWidth = 0) => { + let { width } = viewBox; + + if (shapeType !== Progress.HORIZONTAL_BAR) { + width += offset; + } + if (shapeType === Progress.HORIZONTAL_BAR || shapeType === Progress.HORIZONTAL_PILL) { + width += labelWidth; + } + + return width; +}; + +const getHeight: GetViewBoxParam = ( + shapeType, + viewBox, + offset = 0, + labelWidth = 0, + labelHeight = 0 +) => { + let { height } = viewBox; + + if (shapeType === Progress.SEMICIRCLE) { + height += offset / 2; + } + if (shapeType !== Progress.SEMICIRCLE && shapeType !== Progress.VERTICAL_BAR) { + height += offset; + } + if (shapeType === Progress.VERTICAL_BAR || shapeType === Progress.VERTICAL_PILL) { + height += labelHeight; + } + + return height; +}; + +const updateMinxAndWidthIfNecessary = ( + shapeType: Progress, + labelWidth: number, + minX: number, + width: number +) => { + if ( + (shapeType === Progress.VERTICAL_BAR || shapeType === Progress.VERTICAL_PILL) && + labelWidth > width + ) { + minX = -labelWidth / 2; + width = labelWidth; + } + return [minX, width]; +}; + +export const getViewBox: GetViewBox = function ( + shapeType, + viewBox, + offset = 0, + labelWidth = 0, + labelHeight = 0 +): ViewBoxParams { + const args: GetViewBoxArguments = [shapeType, viewBox, offset, labelWidth, labelHeight]; + const minX = getMinX(...args); + const minY = getMinY(...args); + const width = getWidth(...args); + const height = getHeight(...args); + const [updatedMinX, updatedWidth] = updateMinxAndWidthIfNecessary( + shapeType, + labelWidth, + minX, + width + ); + return { minX: updatedMinX, minY, width: updatedWidth, height }; +}; + +export function getTextAttributes( + shapeType: Progress, + textAttributes: SvgTextAttributes, + offset: number = 0, + label: string | boolean = '' +) { + if (!label) { + return textAttributes; + } + + let { x, y, textContent } = textAttributes; + + textContent = label ? label.toString() : ''; + + if (shapeType === Progress.HORIZONTAL_PILL) { + x = parseInt(String(x)!, 10) + offset / 2; + } + if (shapeType === Progress.VERTICAL_PILL) { + y = parseInt(String(y)!, 10) - offset / 2; + } + if (shapeType === Progress.HORIZONTAL_BAR || shapeType === Progress.HORIZONTAL_PILL) { + x = parseInt(String(x)!, 10); + } + + return { x, y, textContent }; +} diff --git a/src/plugins/expression_shape/public/components/reusable/shape_factory.tsx b/src/plugins/expression_shape/public/components/reusable/shape_factory.tsx index 9e775616726bf..c51daa36fe004 100644 --- a/src/plugins/expression_shape/public/components/reusable/shape_factory.tsx +++ b/src/plugins/expression_shape/public/components/reusable/shape_factory.tsx @@ -10,32 +10,59 @@ import React from 'react'; import { viewBoxToString } from '../../../common/lib'; import { ShapeProps, SvgConfig, SvgElementTypes } from './types'; -const getShapeComponent = (svgParams: SvgConfig) => - function Shape({ shapeAttributes, shapeContentAttributes }: ShapeProps) { - const { viewBox: initialViewBox, shapeProps, shapeType } = svgParams; +export const getShapeComponent = (svgParams: SvgConfig) => + function Shape({ + shapeAttributes, + shapeContentAttributes, + children, + textAttributes, + }: ShapeProps) { + const { + viewBox: initialViewBox, + shapeProps: defaultShapeContentAttributes, + textAttributes: defaultTextAttributes, + shapeType, + } = svgParams; const viewBox = shapeAttributes?.viewBox ? viewBoxToString(shapeAttributes?.viewBox) : viewBoxToString(initialViewBox); const SvgContentElement = getShapeContentElement(shapeType); + + const TextElement = textAttributes + ? React.forwardRef((props, ref) => ) + : null; + return ( - + + {children} + {TextElement && ( + + {textAttributes?.textContent} + + )} ); }; -function getShapeContentElement(type?: SvgElementTypes) { +export function getShapeContentElement(type?: SvgElementTypes) { switch (type) { case SvgElementTypes.circle: - return (props: SvgConfig['shapeProps']) => ; + return React.forwardRef((props, ref) => ( + + )); case SvgElementTypes.rect: - return (props: SvgConfig['shapeProps']) => ; + return React.forwardRef((props, ref) => ); case SvgElementTypes.path: - return (props: SvgConfig['shapeProps']) => ; + return React.forwardRef((props, ref) => ); default: - return (props: SvgConfig['shapeProps']) => ; + return React.forwardRef((props, ref) => ( + + )); } } diff --git a/src/plugins/expression_shape/public/components/reusable/types.tsx b/src/plugins/expression_shape/public/components/reusable/types.tsx index f779633e08a87..79360393ff545 100644 --- a/src/plugins/expression_shape/public/components/reusable/types.tsx +++ b/src/plugins/expression_shape/public/components/reusable/types.tsx @@ -6,14 +6,16 @@ * Side Public License, v 1. */ -import { Ref, SVGProps } from 'react'; +import { Component, CSSProperties, Ref, SVGProps } from 'react'; import { ViewBoxParams } from '../../../common/types'; import type { ShapeType } from './shape_factory'; -export interface ShapeProps { +export type ShapeProps = { shapeAttributes?: ShapeAttributes; - shapeContentAttributes?: ShapeContentAttributes; -} + shapeContentAttributes?: ShapeContentAttributes & + SpecificShapeContentAttributes & { ref?: React.RefObject }; + textAttributes?: SvgTextAttributes; +} & Component['props'] & { ref?: React.RefObject }; export enum SvgElementTypes { polygon, @@ -39,36 +41,48 @@ export interface ShapeContentAttributes { vectorEffect?: SVGProps['vectorEffect']; strokeMiterlimit?: SVGProps['strokeMiterlimit']; } +export interface SvgConfig { + shapeType?: SvgElementTypes; + viewBox: ViewBoxParams; + shapeProps: ShapeContentAttributes & + SpecificShapeContentAttributes & + Component['props'] & { ref?: React.RefObject }; + textAttributes?: SvgTextAttributes; +} + +export type SvgTextAttributes = Partial & { + x?: SVGProps['x']; + y?: SVGProps['y']; + textAnchor?: SVGProps['textAnchor']; + dominantBaseline?: SVGProps['dominantBaseline']; + dx?: SVGProps['dx']; + dy?: SVGProps['dy']; +} & { style?: CSSProperties } & { ref?: React.RefObject }; -interface CircleParams { +export interface CircleParams { r: SVGProps['r']; cx: SVGProps['cx']; cy: SVGProps['cy']; } -interface RectParams { +export interface RectParams { x: SVGProps['x']; y: SVGProps['y']; width: SVGProps['width']; height: SVGProps['height']; } -interface PathParams { +export interface PathParams { d: SVGProps['d']; + strokeLinecap?: SVGProps['strokeLinecap']; } -interface PolygonParams { +export interface PolygonParams { points?: SVGProps['points']; strokeLinejoin?: SVGProps['strokeLinejoin']; } -type SpecificShapeContentAttributes = CircleParams | RectParams | PathParams | PolygonParams; - -export interface SvgConfig { - shapeType?: SvgElementTypes; - viewBox: ViewBoxParams; - shapeProps: ShapeContentAttributes & SpecificShapeContentAttributes; -} +export type SpecificShapeContentAttributes = CircleParams | RectParams | PathParams | PolygonParams; export type ShapeDrawerProps = { shapeType: string; @@ -80,4 +94,6 @@ export interface ShapeRef { getData: () => SvgConfig; } +export type ShapeDrawerComponentProps = Omit; + export type { ShapeType }; diff --git a/src/plugins/expression_shape/public/components/shape/shape_drawer.tsx b/src/plugins/expression_shape/public/components/shape/shape_drawer.tsx index 90906c203332a..7647b07aa58cb 100644 --- a/src/plugins/expression_shape/public/components/shape/shape_drawer.tsx +++ b/src/plugins/expression_shape/public/components/shape/shape_drawer.tsx @@ -6,9 +6,8 @@ * Side Public License, v 1. */ import React, { Ref } from 'react'; -import { ShapeDrawer, ShapeRef } from '../reusable'; +import { ShapeDrawer, ShapeRef, ShapeDrawerComponentProps } from '../reusable'; import { getShape } from './shapes'; -import { ShapeDrawerComponentProps } from './types'; const ShapeDrawerComponent = React.forwardRef( (props: ShapeDrawerComponentProps, ref: Ref) => ( diff --git a/src/plugins/expression_shape/public/components/shape/types.ts b/src/plugins/expression_shape/public/components/shape/types.ts index d99d4c386db53..279bf29575214 100644 --- a/src/plugins/expression_shape/public/components/shape/types.ts +++ b/src/plugins/expression_shape/public/components/shape/types.ts @@ -8,7 +8,6 @@ import { IInterpreterRenderHandlers } from '../../../../../../src/plugins/expressions'; import { ShapeRendererConfig } from '../../../common/types'; -import { ShapeDrawerProps } from '../reusable/types'; export interface ShapeComponentProps extends ShapeRendererConfig { onLoaded: IInterpreterRenderHandlers['done']; @@ -19,4 +18,3 @@ export interface Dimensions { width: number; height: number; } -export type ShapeDrawerComponentProps = Omit; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/__stories__/progress.stories.tsx b/src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx similarity index 54% rename from x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/__stories__/progress.stories.tsx rename to src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx index 4ba699d0c05cb..dcf2daaafcfc1 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/__stories__/progress.stories.tsx +++ b/src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { progress } from '../'; -import { Render } from '../../__stories__/render'; -import { Shape } from '../../../functions/common/progress'; +import { Render } from '../../../../presentation_util/public/__stories__'; +import { progressRenderer } from '../progress_renderer'; +import { Progress } from '../../../common'; storiesOf('renderers/progress', module).add('default', () => { const config = { @@ -22,11 +23,11 @@ storiesOf('renderers/progress', module).add('default', () => { }, label: '66%', max: 1, - shape: Shape.UNICORN, + shape: Progress.UNICORN, value: 0.66, valueColor: '#000', valueWeight: 15, }; - return ; + return ; }); diff --git a/src/plugins/expression_shape/public/expression_renderers/index.ts b/src/plugins/expression_shape/public/expression_renderers/index.ts index 7dba64d7728db..fc031c4a03c8a 100644 --- a/src/plugins/expression_shape/public/expression_renderers/index.ts +++ b/src/plugins/expression_shape/public/expression_renderers/index.ts @@ -7,7 +7,8 @@ */ import { shapeRenderer } from './shape_renderer'; +import { progressRenderer } from './progress_renderer'; -export const renderers = [shapeRenderer]; +export const renderers = [shapeRenderer, progressRenderer]; -export { shapeRenderer }; +export { shapeRenderer, progressRenderer }; diff --git a/src/plugins/expression_shape/public/expression_renderers/progress_renderer.tsx b/src/plugins/expression_shape/public/expression_renderers/progress_renderer.tsx new file mode 100644 index 0000000000000..5f81ffcffd3d9 --- /dev/null +++ b/src/plugins/expression_shape/public/expression_renderers/progress_renderer.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import React from 'react'; +import { render, unmountComponentAtNode } from 'react-dom'; +import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions'; +import { i18n } from '@kbn/i18n'; +import { ProgressRendererConfig } from '../../common/types'; +import { LazyProgressComponent } from '../components/progress'; +import { withSuspense } from '../../../presentation_util/public'; + +const ProgressComponent = withSuspense(LazyProgressComponent); + +const strings = { + getDisplayName: () => + i18n.translate('expressionShape.renderer.progress.displayName', { + defaultMessage: 'Progress', + }), + getHelpDescription: () => + i18n.translate('expressionShape.renderer.progress.helpDescription', { + defaultMessage: 'Render a basic progress', + }), +}; + +export const progressRenderer = (): ExpressionRenderDefinition => ({ + name: 'progress', + displayName: strings.getDisplayName(), + help: strings.getHelpDescription(), + reuseDomNode: true, + render: async ( + domNode: HTMLElement, + config: ProgressRendererConfig, + handlers: IInterpreterRenderHandlers + ) => { + handlers.onDestroy(() => { + unmountComponentAtNode(domNode); + }); + + render( + , + domNode + ); + }, +}); diff --git a/src/plugins/expression_shape/public/index.ts b/src/plugins/expression_shape/public/index.ts index c5933a8cd06ed..882d1ea699d1d 100755 --- a/src/plugins/expression_shape/public/index.ts +++ b/src/plugins/expression_shape/public/index.ts @@ -16,6 +16,7 @@ export function plugin() { export * from './expression_renderers'; export { LazyShapeDrawer } from './components/shape'; +export { LazyProgressDrawer } from './components/progress'; export { getDefaultShapeData } from './components/reusable'; export * from './components/shape/types'; export * from './components/reusable/types'; diff --git a/src/plugins/expression_shape/public/plugin.ts b/src/plugins/expression_shape/public/plugin.ts index b20f357d52a9b..0b8fa274e2b08 100755 --- a/src/plugins/expression_shape/public/plugin.ts +++ b/src/plugins/expression_shape/public/plugin.ts @@ -8,8 +8,8 @@ import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { ExpressionsStart, ExpressionsSetup } from '../../expressions/public'; -import { shapeRenderer } from './expression_renderers'; -import { shapeFunction } from '../common/expression_functions'; +import { shapeRenderer, progressRenderer } from './expression_renderers'; +import { shapeFunction, progressFunction } from '../common/expression_functions'; interface SetupDeps { expressions: ExpressionsSetup; @@ -26,7 +26,9 @@ export class ExpressionShapePlugin implements Plugin { public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionShapePluginSetup { expressions.registerFunction(shapeFunction); + expressions.registerFunction(progressFunction); expressions.registerRenderer(shapeRenderer); + expressions.registerRenderer(progressRenderer); } public start(core: CoreStart): ExpressionShapePluginStart {} diff --git a/src/plugins/expression_shape/server/plugin.ts b/src/plugins/expression_shape/server/plugin.ts index c03acaa04f1ec..d6eb7a8e717cd 100644 --- a/src/plugins/expression_shape/server/plugin.ts +++ b/src/plugins/expression_shape/server/plugin.ts @@ -8,7 +8,7 @@ import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { ExpressionsServerStart, ExpressionsServerSetup } from '../../expressions/server'; -import { shapeFunction } from '../common/expression_functions'; +import { shapeFunction, progressFunction } from '../common/expression_functions'; interface SetupDeps { expressions: ExpressionsServerSetup; @@ -25,6 +25,7 @@ export class ExpressionShapePlugin implements Plugin { public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionShapePluginSetup { expressions.registerFunction(shapeFunction); + expressions.registerFunction(progressFunction); } public start(core: CoreStart): ExpressionShapePluginStart {} diff --git a/src/plugins/expressions/common/executor/executor.test.ts b/src/plugins/expressions/common/executor/executor.test.ts index d3837272fb50f..0a1e793ffbe22 100644 --- a/src/plugins/expressions/common/executor/executor.test.ts +++ b/src/plugins/expressions/common/executor/executor.test.ts @@ -10,8 +10,9 @@ import { Executor } from './executor'; import * as expressionTypes from '../expression_types'; import * as expressionFunctions from '../expression_functions'; import { Execution } from '../execution'; -import { ExpressionAstFunction, parseExpression } from '../ast'; +import { ExpressionAstFunction, parseExpression, formatExpression } from '../ast'; import { MigrateFunction } from '../../../kibana_utils/common/persistable_state'; +import { SavedObjectReference } from 'src/core/types'; describe('Executor', () => { test('can instantiate', () => { @@ -153,7 +154,7 @@ describe('Executor', () => { const executor = new Executor(); const injectFn = jest.fn().mockImplementation((args, references) => args); - const extractFn = jest.fn().mockReturnValue({ args: {}, references: [] }); + const extractFn = jest.fn().mockImplementation((state) => ({ state, references: [] })); const migrateFn = jest.fn().mockImplementation((args) => args); const fooFn = { @@ -181,7 +182,50 @@ describe('Executor', () => { }, fn: jest.fn(), }; + + const refFnRefName = 'ref.id'; + + const refFn = { + name: 'ref', + help: 'test', + args: { + id: { + types: ['string'], + help: 'will be extracted', + }, + other: { + types: ['string'], + help: 'other arg', + }, + }, + extract: (state: ExpressionAstFunction['arguments']) => { + const references: SavedObjectReference[] = [ + { + name: refFnRefName, + type: 'ref', + id: state.id[0] as string, + }, + ]; + + return { + state: { + ...state, + id: [refFnRefName], + }, + references, + }; + }, + inject: (state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) => { + const reference = references.find((ref) => ref.name === refFnRefName); + if (reference) { + state.id[0] = reference.id; + } + return state; + }, + fn: jest.fn(), + }; executor.registerFunction(fooFn); + executor.registerFunction(refFn); test('calls inject function for every expression function in expression', () => { executor.inject( @@ -198,6 +242,18 @@ describe('Executor', () => { ); expect(extractFn).toBeCalledTimes(5); }); + + test('extracts references with the proper step key', () => { + const expression = `ref id="my-id" other={ref id="nested-id" other="other" | foo bar="baz"}`; + const { state, references } = executor.extract(parseExpression(expression)); + + expect(references[0].name).toBe('l0_ref.id'); + expect(references[0].id).toBe('nested-id'); + expect(references[1].name).toBe('l2_ref.id'); + expect(references[1].id).toBe('my-id'); + + expect(formatExpression(executor.inject(state, references))).toBe(expression); + }); }); describe('.getAllMigrations', () => { diff --git a/src/plugins/expressions/common/executor/executor.ts b/src/plugins/expressions/common/executor/executor.ts index ec6ca0323ea5c..930c9a4f04243 100644 --- a/src/plugins/expressions/common/executor/executor.ts +++ b/src/plugins/expressions/common/executor/executor.ts @@ -237,7 +237,8 @@ export class Executor = Record { const { state, references } = fn.extract(link.arguments); link.arguments = state; - allReferences.push(...references.map((r) => ({ ...r, name: `l${linkId++}_${r.name}` }))); + allReferences.push(...references.map((r) => ({ ...r, name: `l${linkId}_${r.name}` }))); + linkId = linkId + 1; }); return { state: newAst, references: allReferences }; } diff --git a/src/plugins/field_formats/README.md b/src/plugins/field_formats/README.md new file mode 100755 index 0000000000000..1bb519af87acf --- /dev/null +++ b/src/plugins/field_formats/README.md @@ -0,0 +1,3 @@ +# Field formats + +Index pattern fields formatters diff --git a/src/plugins/data/common/field_formats/constants/base_formatters.ts b/src/plugins/field_formats/common/constants/base_formatters.ts similarity index 100% rename from src/plugins/data/common/field_formats/constants/base_formatters.ts rename to src/plugins/field_formats/common/constants/base_formatters.ts diff --git a/src/plugins/data/common/field_formats/constants/color_default.ts b/src/plugins/field_formats/common/constants/color_default.ts similarity index 100% rename from src/plugins/data/common/field_formats/constants/color_default.ts rename to src/plugins/field_formats/common/constants/color_default.ts diff --git a/src/plugins/field_formats/common/constants/ui_settings.ts b/src/plugins/field_formats/common/constants/ui_settings.ts new file mode 100644 index 0000000000000..98bae6bcf39d3 --- /dev/null +++ b/src/plugins/field_formats/common/constants/ui_settings.ts @@ -0,0 +1,17 @@ +/* + * 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 FORMATS_UI_SETTINGS = { + FORMAT_DEFAULT_TYPE_MAP: 'format:defaultTypeMap', + FORMAT_NUMBER_DEFAULT_PATTERN: 'format:number:defaultPattern', + FORMAT_PERCENT_DEFAULT_PATTERN: 'format:percent:defaultPattern', + FORMAT_BYTES_DEFAULT_PATTERN: 'format:bytes:defaultPattern', + FORMAT_CURRENCY_DEFAULT_PATTERN: 'format:currency:defaultPattern', + FORMAT_NUMBER_DEFAULT_LOCALE: 'format:number:defaultLocale', + SHORT_DOTS_ENABLE: 'shortDots:enable', +} as const; diff --git a/src/plugins/data/common/field_formats/content_types/html_content_type.ts b/src/plugins/field_formats/common/content_types/html_content_type.ts similarity index 100% rename from src/plugins/data/common/field_formats/content_types/html_content_type.ts rename to src/plugins/field_formats/common/content_types/html_content_type.ts diff --git a/src/plugins/data/common/field_formats/content_types/index.ts b/src/plugins/field_formats/common/content_types/index.ts similarity index 100% rename from src/plugins/data/common/field_formats/content_types/index.ts rename to src/plugins/field_formats/common/content_types/index.ts diff --git a/src/plugins/data/common/field_formats/content_types/text_content_type.ts b/src/plugins/field_formats/common/content_types/text_content_type.ts similarity index 100% rename from src/plugins/data/common/field_formats/content_types/text_content_type.ts rename to src/plugins/field_formats/common/content_types/text_content_type.ts diff --git a/src/plugins/data/common/field_formats/converters/boolean.test.ts b/src/plugins/field_formats/common/converters/boolean.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/boolean.test.ts rename to src/plugins/field_formats/common/converters/boolean.test.ts diff --git a/src/plugins/data/common/field_formats/converters/boolean.ts b/src/plugins/field_formats/common/converters/boolean.ts similarity index 94% rename from src/plugins/data/common/field_formats/converters/boolean.ts rename to src/plugins/field_formats/common/converters/boolean.ts index d70501bf0f9d5..674e02fac8de0 100644 --- a/src/plugins/data/common/field_formats/converters/boolean.ts +++ b/src/plugins/field_formats/common/converters/boolean.ts @@ -14,7 +14,7 @@ import { asPrettyString } from '../utils'; export class BoolFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.BOOLEAN; - static title = i18n.translate('data.fieldFormats.boolean.title', { + static title = i18n.translate('fieldFormats.boolean.title', { defaultMessage: 'Boolean', }); static fieldType = [KBN_FIELD_TYPES.BOOLEAN, KBN_FIELD_TYPES.NUMBER, KBN_FIELD_TYPES.STRING]; diff --git a/src/plugins/data/common/field_formats/converters/bytes.test.ts b/src/plugins/field_formats/common/converters/bytes.test.ts similarity index 85% rename from src/plugins/data/common/field_formats/converters/bytes.test.ts rename to src/plugins/field_formats/common/converters/bytes.test.ts index be8adbb6355ac..a820b2c1f2b32 100644 --- a/src/plugins/data/common/field_formats/converters/bytes.test.ts +++ b/src/plugins/field_formats/common/converters/bytes.test.ts @@ -7,12 +7,12 @@ */ import { BytesFormat } from './bytes'; -import { UI_SETTINGS } from '../../constants'; +import { FORMATS_UI_SETTINGS } from '../constants/ui_settings'; describe('BytesFormat', () => { const config: Record = {}; - config[UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN] = '0,0.[000]b'; + config[FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN] = '0,0.[000]b'; const getConfig = (key: string) => config[key]; diff --git a/src/plugins/data/common/field_formats/converters/bytes.ts b/src/plugins/field_formats/common/converters/bytes.ts similarity index 91% rename from src/plugins/data/common/field_formats/converters/bytes.ts rename to src/plugins/field_formats/common/converters/bytes.ts index 840a59f3d3092..829063aa07d02 100644 --- a/src/plugins/data/common/field_formats/converters/bytes.ts +++ b/src/plugins/field_formats/common/converters/bytes.ts @@ -12,7 +12,7 @@ import { FIELD_FORMAT_IDS } from '../types'; export class BytesFormat extends NumeralFormat { static id = FIELD_FORMAT_IDS.BYTES; - static title = i18n.translate('data.fieldFormats.bytes.title', { + static title = i18n.translate('fieldFormats.bytes.title', { defaultMessage: 'Bytes', }); diff --git a/src/plugins/data/common/field_formats/converters/color.test.ts b/src/plugins/field_formats/common/converters/color.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/color.test.ts rename to src/plugins/field_formats/common/converters/color.test.ts diff --git a/src/plugins/data/common/field_formats/converters/color.tsx b/src/plugins/field_formats/common/converters/color.tsx similarity index 97% rename from src/plugins/data/common/field_formats/converters/color.tsx rename to src/plugins/field_formats/common/converters/color.tsx index f653c6a4f82a2..d3a6964619cae 100644 --- a/src/plugins/data/common/field_formats/converters/color.tsx +++ b/src/plugins/field_formats/common/converters/color.tsx @@ -18,7 +18,7 @@ import { DEFAULT_CONVERTER_COLOR } from '../constants/color_default'; export class ColorFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.COLOR; - static title = i18n.translate('data.fieldFormats.color.title', { + static title = i18n.translate('fieldFormats.color.title', { defaultMessage: 'Color', }); static fieldType = [KBN_FIELD_TYPES.NUMBER, KBN_FIELD_TYPES.STRING]; diff --git a/src/plugins/data/common/field_formats/converters/custom.ts b/src/plugins/field_formats/common/converters/custom.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/custom.ts rename to src/plugins/field_formats/common/converters/custom.ts diff --git a/src/plugins/data/common/field_formats/converters/date_nanos_shared.test.ts b/src/plugins/field_formats/common/converters/date_nanos_shared.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/date_nanos_shared.test.ts rename to src/plugins/field_formats/common/converters/date_nanos_shared.test.ts diff --git a/src/plugins/data/common/field_formats/converters/date_nanos_shared.ts b/src/plugins/field_formats/common/converters/date_nanos_shared.ts similarity index 96% rename from src/plugins/data/common/field_formats/converters/date_nanos_shared.ts rename to src/plugins/field_formats/common/converters/date_nanos_shared.ts index d058d0c6a6574..1d226c936a977 100644 --- a/src/plugins/data/common/field_formats/converters/date_nanos_shared.ts +++ b/src/plugins/field_formats/common/converters/date_nanos_shared.ts @@ -8,8 +8,9 @@ import { i18n } from '@kbn/i18n'; import { memoize, noop } from 'lodash'; +import { KBN_FIELD_TYPES } from '@kbn/field-types'; import moment, { Moment } from 'moment'; -import { FieldFormat, FIELD_FORMAT_IDS, KBN_FIELD_TYPES } from '../../'; +import { FieldFormat, FIELD_FORMAT_IDS } from '../'; import { TextContextTypeConvert } from '../types'; /** @@ -59,7 +60,7 @@ export function formatWithNanos( export class DateNanosFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.DATE_NANOS; - static title = i18n.translate('data.fieldFormats.date_nanos.title', { + static title = i18n.translate('fieldFormats.date_nanos.title', { defaultMessage: 'Date nanos', }); static fieldType = KBN_FIELD_TYPES.DATE; diff --git a/src/plugins/data/common/field_formats/converters/duration.test.ts b/src/plugins/field_formats/common/converters/duration.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/duration.test.ts rename to src/plugins/field_formats/common/converters/duration.test.ts diff --git a/src/plugins/data/common/field_formats/converters/duration.ts b/src/plugins/field_formats/common/converters/duration.ts similarity index 74% rename from src/plugins/data/common/field_formats/converters/duration.ts rename to src/plugins/field_formats/common/converters/duration.ts index 926f907af8fe9..a92a6756b335c 100644 --- a/src/plugins/data/common/field_formats/converters/duration.ts +++ b/src/plugins/field_formats/common/converters/duration.ts @@ -21,76 +21,76 @@ const HUMAN_FRIENDLY = 'humanize'; const HUMAN_FRIENDLY_PRECISE = 'humanizePrecise'; const DEFAULT_OUTPUT_PRECISION = 2; const DEFAULT_INPUT_FORMAT = { - text: i18n.translate('data.fieldFormats.duration.inputFormats.seconds', { + text: i18n.translate('fieldFormats.duration.inputFormats.seconds', { defaultMessage: 'Seconds', }), kind: 'seconds', }; const inputFormats = [ { - text: i18n.translate('data.fieldFormats.duration.inputFormats.picoseconds', { + text: i18n.translate('fieldFormats.duration.inputFormats.picoseconds', { defaultMessage: 'Picoseconds', }), kind: 'picoseconds', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.nanoseconds', { + text: i18n.translate('fieldFormats.duration.inputFormats.nanoseconds', { defaultMessage: 'Nanoseconds', }), kind: 'nanoseconds', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.microseconds', { + text: i18n.translate('fieldFormats.duration.inputFormats.microseconds', { defaultMessage: 'Microseconds', }), kind: 'microseconds', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.milliseconds', { + text: i18n.translate('fieldFormats.duration.inputFormats.milliseconds', { defaultMessage: 'Milliseconds', }), kind: 'milliseconds', }, { ...DEFAULT_INPUT_FORMAT }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.minutes', { + text: i18n.translate('fieldFormats.duration.inputFormats.minutes', { defaultMessage: 'Minutes', }), kind: 'minutes', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.hours', { + text: i18n.translate('fieldFormats.duration.inputFormats.hours', { defaultMessage: 'Hours', }), kind: 'hours', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.days', { + text: i18n.translate('fieldFormats.duration.inputFormats.days', { defaultMessage: 'Days', }), kind: 'days', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.weeks', { + text: i18n.translate('fieldFormats.duration.inputFormats.weeks', { defaultMessage: 'Weeks', }), kind: 'weeks', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.months', { + text: i18n.translate('fieldFormats.duration.inputFormats.months', { defaultMessage: 'Months', }), kind: 'months', }, { - text: i18n.translate('data.fieldFormats.duration.inputFormats.years', { + text: i18n.translate('fieldFormats.duration.inputFormats.years', { defaultMessage: 'Years', }), kind: 'years', }, ]; const DEFAULT_OUTPUT_FORMAT = { - text: i18n.translate('data.fieldFormats.duration.outputFormats.humanize.approximate', { + text: i18n.translate('fieldFormats.duration.outputFormats.humanize.approximate', { defaultMessage: 'Human-readable (approximate)', }), method: 'humanize', @@ -98,79 +98,79 @@ const DEFAULT_OUTPUT_FORMAT = { const outputFormats = [ { ...DEFAULT_OUTPUT_FORMAT }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.humanize.precise', { + text: i18n.translate('fieldFormats.duration.outputFormats.humanize.precise', { defaultMessage: 'Human-readable (precise)', }), method: 'humanizePrecise', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asMilliseconds', { + text: i18n.translate('fieldFormats.duration.outputFormats.asMilliseconds', { defaultMessage: 'Milliseconds', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asMilliseconds.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asMilliseconds.short', { defaultMessage: 'ms', }), method: 'asMilliseconds', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asSeconds', { + text: i18n.translate('fieldFormats.duration.outputFormats.asSeconds', { defaultMessage: 'Seconds', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asSeconds.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asSeconds.short', { defaultMessage: 's', }), method: 'asSeconds', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asMinutes', { + text: i18n.translate('fieldFormats.duration.outputFormats.asMinutes', { defaultMessage: 'Minutes', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asMinutes.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asMinutes.short', { defaultMessage: 'min', }), method: 'asMinutes', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asHours', { + text: i18n.translate('fieldFormats.duration.outputFormats.asHours', { defaultMessage: 'Hours', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asHours.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asHours.short', { defaultMessage: 'h', }), method: 'asHours', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asDays', { + text: i18n.translate('fieldFormats.duration.outputFormats.asDays', { defaultMessage: 'Days', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asDays.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asDays.short', { defaultMessage: 'd', }), method: 'asDays', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asWeeks', { + text: i18n.translate('fieldFormats.duration.outputFormats.asWeeks', { defaultMessage: 'Weeks', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asWeeks.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asWeeks.short', { defaultMessage: 'w', }), method: 'asWeeks', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asMonths', { + text: i18n.translate('fieldFormats.duration.outputFormats.asMonths', { defaultMessage: 'Months', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asMonths.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asMonths.short', { defaultMessage: 'mon', }), method: 'asMonths', }, { - text: i18n.translate('data.fieldFormats.duration.outputFormats.asYears', { + text: i18n.translate('fieldFormats.duration.outputFormats.asYears', { defaultMessage: 'Years', }), - shortText: i18n.translate('data.fieldFormats.duration.outputFormats.asYears.short', { + shortText: i18n.translate('fieldFormats.duration.outputFormats.asYears.short', { defaultMessage: 'y', }), method: 'asYears', @@ -210,7 +210,7 @@ function formatInputHumanPrecise( export class DurationFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.DURATION; - static title = i18n.translate('data.fieldFormats.duration.title', { + static title = i18n.translate('fieldFormats.duration.title', { defaultMessage: 'Duration', }); static fieldType = KBN_FIELD_TYPES.NUMBER; @@ -250,7 +250,7 @@ export class DurationFormat extends FieldFormat { const prefix = val < 0 && human - ? i18n.translate('data.fieldFormats.duration.negativeLabel', { + ? i18n.translate('fieldFormats.duration.negativeLabel', { defaultMessage: 'minus', }) + ' ' : ''; diff --git a/src/plugins/data/common/field_formats/converters/histogram.ts b/src/plugins/field_formats/common/converters/histogram.ts similarity index 95% rename from src/plugins/data/common/field_formats/converters/histogram.ts rename to src/plugins/field_formats/common/converters/histogram.ts index 0812dcc795dc9..586d42ffa7a31 100644 --- a/src/plugins/data/common/field_formats/converters/histogram.ts +++ b/src/plugins/field_formats/common/converters/histogram.ts @@ -17,7 +17,7 @@ import { PercentFormat } from './percent'; export class HistogramFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.HISTOGRAM; static fieldType = KBN_FIELD_TYPES.HISTOGRAM; - static title = i18n.translate('data.fieldFormats.histogram.title', { + static title = i18n.translate('fieldFormats.histogram.title', { defaultMessage: 'Histogram', }); diff --git a/src/plugins/data/common/field_formats/converters/index.ts b/src/plugins/field_formats/common/converters/index.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/index.ts rename to src/plugins/field_formats/common/converters/index.ts diff --git a/src/plugins/data/common/field_formats/converters/ip.test.ts b/src/plugins/field_formats/common/converters/ip.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/ip.test.ts rename to src/plugins/field_formats/common/converters/ip.test.ts diff --git a/src/plugins/data/common/field_formats/converters/ip.ts b/src/plugins/field_formats/common/converters/ip.ts similarity index 94% rename from src/plugins/data/common/field_formats/converters/ip.ts rename to src/plugins/field_formats/common/converters/ip.ts index 76fe4404e2418..b981eca5db441 100644 --- a/src/plugins/data/common/field_formats/converters/ip.ts +++ b/src/plugins/field_formats/common/converters/ip.ts @@ -13,7 +13,7 @@ import { TextContextTypeConvert, FIELD_FORMAT_IDS } from '../types'; export class IpFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.IP; - static title = i18n.translate('data.fieldFormats.ip.title', { + static title = i18n.translate('fieldFormats.ip.title', { defaultMessage: 'IP address', }); static fieldType = KBN_FIELD_TYPES.IP; diff --git a/src/plugins/data/common/field_formats/converters/number.test.ts b/src/plugins/field_formats/common/converters/number.test.ts similarity index 85% rename from src/plugins/data/common/field_formats/converters/number.test.ts rename to src/plugins/field_formats/common/converters/number.test.ts index 837031b59dc5c..da849fae1e6ab 100644 --- a/src/plugins/data/common/field_formats/converters/number.test.ts +++ b/src/plugins/field_formats/common/converters/number.test.ts @@ -7,12 +7,12 @@ */ import { NumberFormat } from './number'; -import { UI_SETTINGS } from '../../constants'; +import { FORMATS_UI_SETTINGS } from '../constants/ui_settings'; describe('NumberFormat', () => { const config: Record = {}; - config[UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN] = '0,0.[000]'; + config[FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN] = '0,0.[000]'; const getConfig = (key: string) => config[key]; diff --git a/src/plugins/data/common/field_formats/converters/number.ts b/src/plugins/field_formats/common/converters/number.ts similarity index 91% rename from src/plugins/data/common/field_formats/converters/number.ts rename to src/plugins/field_formats/common/converters/number.ts index c8c98d010dc61..36470cbd14874 100644 --- a/src/plugins/data/common/field_formats/converters/number.ts +++ b/src/plugins/field_formats/common/converters/number.ts @@ -12,7 +12,7 @@ import { FIELD_FORMAT_IDS } from '../types'; export class NumberFormat extends NumeralFormat { static id = FIELD_FORMAT_IDS.NUMBER; - static title = i18n.translate('data.fieldFormats.number.title', { + static title = i18n.translate('fieldFormats.number.title', { defaultMessage: 'Number', }); diff --git a/src/plugins/data/common/field_formats/converters/numeral.ts b/src/plugins/field_formats/common/converters/numeral.ts similarity index 90% rename from src/plugins/data/common/field_formats/converters/numeral.ts rename to src/plugins/field_formats/common/converters/numeral.ts index 9d8b7ba1c369d..7f11b6377836d 100644 --- a/src/plugins/data/common/field_formats/converters/numeral.ts +++ b/src/plugins/field_formats/common/converters/numeral.ts @@ -13,7 +13,7 @@ import numeralLanguages from '@elastic/numeral/languages'; import { KBN_FIELD_TYPES } from '@kbn/field-types'; import { FieldFormat } from '../field_format'; import { TextContextTypeConvert } from '../types'; -import { UI_SETTINGS } from '../../constants'; +import { FORMATS_UI_SETTINGS } from '../constants/ui_settings'; const numeralInst = numeral(); @@ -42,7 +42,7 @@ export abstract class NumeralFormat extends FieldFormat { const previousLocale = numeral.language(); const defaultLocale = - (this.getConfig && this.getConfig(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE)) || 'en'; + (this.getConfig && this.getConfig(FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE)) || 'en'; numeral.language(defaultLocale); const formatted = numeralInst.set(val).format(this.param('pattern')); diff --git a/src/plugins/data/common/field_formats/converters/percent.test.ts b/src/plugins/field_formats/common/converters/percent.test.ts similarity index 85% rename from src/plugins/data/common/field_formats/converters/percent.test.ts rename to src/plugins/field_formats/common/converters/percent.test.ts index 77f4274759ba3..d01acf571f9d9 100644 --- a/src/plugins/data/common/field_formats/converters/percent.test.ts +++ b/src/plugins/field_formats/common/converters/percent.test.ts @@ -7,12 +7,12 @@ */ import { PercentFormat } from './percent'; -import { UI_SETTINGS } from '../../constants'; +import { FORMATS_UI_SETTINGS } from '../constants/ui_settings'; describe('PercentFormat', () => { const config: Record = {}; - config[UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN] = '0,0.[000]%'; + config[FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN] = '0,0.[000]%'; const getConfig = (key: string) => config[key]; diff --git a/src/plugins/data/common/field_formats/converters/percent.ts b/src/plugins/field_formats/common/converters/percent.ts similarity index 82% rename from src/plugins/data/common/field_formats/converters/percent.ts rename to src/plugins/field_formats/common/converters/percent.ts index a402975c672e2..3fd70c8ce74a8 100644 --- a/src/plugins/data/common/field_formats/converters/percent.ts +++ b/src/plugins/field_formats/common/converters/percent.ts @@ -9,11 +9,11 @@ import { i18n } from '@kbn/i18n'; import { NumeralFormat } from './numeral'; import { TextContextTypeConvert, FIELD_FORMAT_IDS } from '../types'; -import { UI_SETTINGS } from '../../constants'; +import { FORMATS_UI_SETTINGS } from '../constants/ui_settings'; export class PercentFormat extends NumeralFormat { static id = FIELD_FORMAT_IDS.PERCENT; - static title = i18n.translate('data.fieldFormats.percent.title', { + static title = i18n.translate('fieldFormats.percent.title', { defaultMessage: 'Percentage', }); @@ -22,7 +22,7 @@ export class PercentFormat extends NumeralFormat { allowsNumericalAggregations = true; getParamDefaults = () => ({ - pattern: this.getConfig!(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN), + pattern: this.getConfig!(FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN), fractional: true, }); diff --git a/src/plugins/data/common/field_formats/converters/relative_date.test.ts b/src/plugins/field_formats/common/converters/relative_date.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/relative_date.test.ts rename to src/plugins/field_formats/common/converters/relative_date.test.ts diff --git a/src/plugins/data/common/field_formats/converters/relative_date.ts b/src/plugins/field_formats/common/converters/relative_date.ts similarity index 93% rename from src/plugins/data/common/field_formats/converters/relative_date.ts rename to src/plugins/field_formats/common/converters/relative_date.ts index c54e32452f267..6111cbf838b79 100644 --- a/src/plugins/data/common/field_formats/converters/relative_date.ts +++ b/src/plugins/field_formats/common/converters/relative_date.ts @@ -14,7 +14,7 @@ import { TextContextTypeConvert, FIELD_FORMAT_IDS } from '../types'; export class RelativeDateFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.RELATIVE_DATE; - static title = i18n.translate('data.fieldFormats.relative_date.title', { + static title = i18n.translate('fieldFormats.relative_date.title', { defaultMessage: 'Relative date', }); static fieldType = KBN_FIELD_TYPES.DATE; diff --git a/src/plugins/data/common/field_formats/converters/source.test.ts b/src/plugins/field_formats/common/converters/source.test.ts similarity index 87% rename from src/plugins/data/common/field_formats/converters/source.test.ts rename to src/plugins/field_formats/common/converters/source.test.ts index 655cf315a05a4..726f2c31e7825 100644 --- a/src/plugins/data/common/field_formats/converters/source.test.ts +++ b/src/plugins/field_formats/common/converters/source.test.ts @@ -9,7 +9,21 @@ import { SourceFormat } from './source'; import { HtmlContextTypeConvert } from '../types'; import { HTML_CONTEXT_TYPE } from '../content_types'; -import { stubIndexPatternWithFields } from '../../index_patterns/index_pattern.stub'; + +export const stubIndexPatternWithFields = { + id: '1234', + title: 'logstash-*', + fields: [ + { + name: 'response', + type: 'number', + esTypes: ['integer'], + aggregatable: true, + filterable: true, + searchable: true, + }, + ], +}; describe('Source Format', () => { let convertHtml: Function; diff --git a/src/plugins/data/common/field_formats/converters/source.tsx b/src/plugins/field_formats/common/converters/source.tsx similarity index 92% rename from src/plugins/data/common/field_formats/converters/source.tsx rename to src/plugins/field_formats/common/converters/source.tsx index de77736503f86..b3ed90329d6d4 100644 --- a/src/plugins/data/common/field_formats/converters/source.tsx +++ b/src/plugins/field_formats/common/converters/source.tsx @@ -6,14 +6,14 @@ * Side Public License, v 1. */ +import { KBN_FIELD_TYPES } from '@kbn/field-types'; import React, { Fragment } from 'react'; import ReactDOM from 'react-dom/server'; import { escape, keys } from 'lodash'; -import { KBN_FIELD_TYPES } from '@kbn/field-types'; -import { shortenDottedString } from '../../utils'; +import { shortenDottedString } from '../utils'; import { FieldFormat } from '../field_format'; import { TextContextTypeConvert, HtmlContextTypeConvert, FIELD_FORMAT_IDS } from '../types'; -import { UI_SETTINGS } from '../../constants'; +import { FORMATS_UI_SETTINGS } from '../constants/ui_settings'; interface Props { defPairs: Array<[string, string]>; @@ -55,7 +55,7 @@ export class SourceFormat extends FieldFormat { const formatted = indexPattern.formatHit(hit); const highlightPairs: any[] = []; const sourcePairs: any[] = []; - const isShortDots = this.getConfig!(UI_SETTINGS.SHORT_DOTS_ENABLE); + const isShortDots = this.getConfig!(FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE); keys(formatted).forEach((key) => { const pairs = highlights[key] ? highlightPairs : sourcePairs; diff --git a/src/plugins/data/common/field_formats/converters/static_lookup.ts b/src/plugins/field_formats/common/converters/static_lookup.ts similarity index 95% rename from src/plugins/data/common/field_formats/converters/static_lookup.ts rename to src/plugins/field_formats/common/converters/static_lookup.ts index 63d3506dda0bb..ba5b38ba8b24f 100644 --- a/src/plugins/data/common/field_formats/converters/static_lookup.ts +++ b/src/plugins/field_formats/common/converters/static_lookup.ts @@ -23,7 +23,7 @@ function convertLookupEntriesToMap(lookupEntries: any[]) { export class StaticLookupFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.STATIC_LOOKUP; - static title = i18n.translate('data.fieldFormats.static_lookup.title', { + static title = i18n.translate('fieldFormats.static_lookup.title', { defaultMessage: 'Static lookup', }); static fieldType = [ diff --git a/src/plugins/data/common/field_formats/converters/string.test.ts b/src/plugins/field_formats/common/converters/string.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/string.test.ts rename to src/plugins/field_formats/common/converters/string.test.ts diff --git a/src/plugins/data/common/field_formats/converters/string.ts b/src/plugins/field_formats/common/converters/string.ts similarity index 80% rename from src/plugins/data/common/field_formats/converters/string.ts rename to src/plugins/field_formats/common/converters/string.ts index c6aba38cf376d..149da871761e2 100644 --- a/src/plugins/data/common/field_formats/converters/string.ts +++ b/src/plugins/field_formats/common/converters/string.ts @@ -9,55 +9,54 @@ import { escape } from 'lodash'; import { i18n } from '@kbn/i18n'; import { KBN_FIELD_TYPES } from '@kbn/field-types'; -import { asPrettyString, getHighlightHtml } from '../utils'; +import { asPrettyString, getHighlightHtml, shortenDottedString } from '../utils'; import { FieldFormat } from '../field_format'; import { TextContextTypeConvert, FIELD_FORMAT_IDS, HtmlContextTypeConvert } from '../types'; -import { shortenDottedString } from '../../utils'; -const emptyLabel = i18n.translate('data.fieldFormats.string.emptyLabel', { +const emptyLabel = i18n.translate('fieldFormats.string.emptyLabel', { defaultMessage: '(empty)', }); const TRANSFORM_OPTIONS = [ { kind: false, - text: i18n.translate('data.fieldFormats.string.transformOptions.none', { + text: i18n.translate('fieldFormats.string.transformOptions.none', { defaultMessage: '- None -', }), }, { kind: 'lower', - text: i18n.translate('data.fieldFormats.string.transformOptions.lower', { + text: i18n.translate('fieldFormats.string.transformOptions.lower', { defaultMessage: 'Lower Case', }), }, { kind: 'upper', - text: i18n.translate('data.fieldFormats.string.transformOptions.upper', { + text: i18n.translate('fieldFormats.string.transformOptions.upper', { defaultMessage: 'Upper Case', }), }, { kind: 'title', - text: i18n.translate('data.fieldFormats.string.transformOptions.title', { + text: i18n.translate('fieldFormats.string.transformOptions.title', { defaultMessage: 'Title Case', }), }, { kind: 'short', - text: i18n.translate('data.fieldFormats.string.transformOptions.short', { + text: i18n.translate('fieldFormats.string.transformOptions.short', { defaultMessage: 'Short Dots', }), }, { kind: 'base64', - text: i18n.translate('data.fieldFormats.string.transformOptions.base64', { + text: i18n.translate('fieldFormats.string.transformOptions.base64', { defaultMessage: 'Base64 Decode', }), }, { kind: 'urlparam', - text: i18n.translate('data.fieldFormats.string.transformOptions.url', { + text: i18n.translate('fieldFormats.string.transformOptions.url', { defaultMessage: 'URL Param Decode', }), }, @@ -66,7 +65,7 @@ const DEFAULT_TRANSFORM_OPTION = false; export class StringFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.STRING; - static title = i18n.translate('data.fieldFormats.string.title', { + static title = i18n.translate('fieldFormats.string.title', { defaultMessage: 'String', }); static fieldType = [ diff --git a/src/plugins/data/common/field_formats/converters/truncate.test.ts b/src/plugins/field_formats/common/converters/truncate.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/truncate.test.ts rename to src/plugins/field_formats/common/converters/truncate.test.ts diff --git a/src/plugins/data/common/field_formats/converters/truncate.ts b/src/plugins/field_formats/common/converters/truncate.ts similarity index 93% rename from src/plugins/data/common/field_formats/converters/truncate.ts rename to src/plugins/field_formats/common/converters/truncate.ts index 4c68a4c056b82..fd8bbcbc46541 100644 --- a/src/plugins/data/common/field_formats/converters/truncate.ts +++ b/src/plugins/field_formats/common/converters/truncate.ts @@ -16,7 +16,7 @@ const omission = '...'; export class TruncateFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.TRUNCATE; - static title = i18n.translate('data.fieldFormats.truncated_string.title', { + static title = i18n.translate('fieldFormats.truncated_string.title', { defaultMessage: 'Truncated string', }); static fieldType = KBN_FIELD_TYPES.STRING; diff --git a/src/plugins/data/common/field_formats/converters/url.test.ts b/src/plugins/field_formats/common/converters/url.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/converters/url.test.ts rename to src/plugins/field_formats/common/converters/url.test.ts diff --git a/src/plugins/data/common/field_formats/converters/url.ts b/src/plugins/field_formats/common/converters/url.ts similarity index 95% rename from src/plugins/data/common/field_formats/converters/url.ts rename to src/plugins/field_formats/common/converters/url.ts index 3e808d90f0409..07d9ed4cd535e 100644 --- a/src/plugins/data/common/field_formats/converters/url.ts +++ b/src/plugins/field_formats/common/converters/url.ts @@ -24,19 +24,19 @@ const allowedUrlSchemes = ['http://', 'https://']; const URL_TYPES = [ { kind: 'a', - text: i18n.translate('data.fieldFormats.url.types.link', { + text: i18n.translate('fieldFormats.url.types.link', { defaultMessage: 'Link', }), }, { kind: 'img', - text: i18n.translate('data.fieldFormats.url.types.img', { + text: i18n.translate('fieldFormats.url.types.img', { defaultMessage: 'Image', }), }, { kind: 'audio', - text: i18n.translate('data.fieldFormats.url.types.audio', { + text: i18n.translate('fieldFormats.url.types.audio', { defaultMessage: 'Audio', }), }, @@ -45,7 +45,7 @@ const DEFAULT_URL_TYPE = 'a'; export class UrlFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.URL; - static title = i18n.translate('data.fieldFormats.url.title', { + static title = i18n.translate('fieldFormats.url.title', { defaultMessage: 'Url', }); static fieldType = [ diff --git a/src/plugins/data/common/field_formats/errors.ts b/src/plugins/field_formats/common/errors.ts similarity index 100% rename from src/plugins/data/common/field_formats/errors.ts rename to src/plugins/field_formats/common/errors.ts diff --git a/src/plugins/data/common/field_formats/field_format.test.ts b/src/plugins/field_formats/common/field_format.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/field_format.test.ts rename to src/plugins/field_formats/common/field_format.test.ts diff --git a/src/plugins/data/common/field_formats/field_format.ts b/src/plugins/field_formats/common/field_format.ts similarity index 100% rename from src/plugins/data/common/field_formats/field_format.ts rename to src/plugins/field_formats/common/field_format.ts diff --git a/src/plugins/data/common/field_formats/field_formats_registry.test.ts b/src/plugins/field_formats/common/field_formats_registry.test.ts similarity index 99% rename from src/plugins/data/common/field_formats/field_formats_registry.test.ts rename to src/plugins/field_formats/common/field_formats_registry.test.ts index 86e44b69c05bf..e94efc88be20f 100644 --- a/src/plugins/data/common/field_formats/field_formats_registry.test.ts +++ b/src/plugins/field_formats/common/field_formats_registry.test.ts @@ -9,7 +9,7 @@ import { FieldFormatsRegistry } from './field_formats_registry'; import { BoolFormat, PercentFormat, StringFormat } from './converters'; import { FieldFormatsGetConfigFn, FieldFormatInstanceType } from './types'; -import { KBN_FIELD_TYPES } from '../../common'; +import { KBN_FIELD_TYPES } from '@kbn/field-types'; const getValueOfPrivateField = (instance: any, field: string) => instance[field]; diff --git a/src/plugins/data/common/field_formats/field_formats_registry.ts b/src/plugins/field_formats/common/field_formats_registry.ts similarity index 96% rename from src/plugins/data/common/field_formats/field_formats_registry.ts rename to src/plugins/field_formats/common/field_formats_registry.ts index 9e96f5cc1a6bd..675ec897c2b70 100644 --- a/src/plugins/data/common/field_formats/field_formats_registry.ts +++ b/src/plugins/field_formats/common/field_formats_registry.ts @@ -17,13 +17,13 @@ import { FieldFormatInstanceType, FieldFormatId, IFieldFormatMetaParams, + SerializedFieldFormat, + FormatFactory, } from './types'; import { baseFormatters } from './constants/base_formatters'; import { FieldFormat } from './field_format'; -import { FormatFactory } from './utils'; -import { UI_SETTINGS } from '../constants'; -import { FieldFormatNotFoundError } from '../field_formats'; -import { SerializedFieldFormat } from '../../../expressions/common/types'; +import { FORMATS_UI_SETTINGS } from '../common/constants/ui_settings'; +import { FieldFormatNotFoundError } from './errors'; export class FieldFormatsRegistry { protected fieldFormats: Map = new Map(); @@ -53,7 +53,7 @@ export class FieldFormatsRegistry { metaParamsOptions: Record = {}, defaultFieldConverters: FieldFormatInstanceType[] = baseFormatters ) { - const defaultTypeMap = getConfig(UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP); + const defaultTypeMap = getConfig(FORMATS_UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP); this.register(defaultFieldConverters); this.parseDefaultTypeMap(defaultTypeMap); this.getConfig = getConfig; diff --git a/src/plugins/data/common/field_formats/index.ts b/src/plugins/field_formats/common/index.ts similarity index 90% rename from src/plugins/data/common/field_formats/index.ts rename to src/plugins/field_formats/common/index.ts index a3d763196e11f..f2395eef29c54 100644 --- a/src/plugins/data/common/field_formats/index.ts +++ b/src/plugins/field_formats/common/index.ts @@ -33,6 +33,7 @@ export { export { getHighlightRequest } from './utils'; export { DEFAULT_CONVERTER_COLOR } from './constants/color_default'; +export { FORMATS_UI_SETTINGS } from './constants/ui_settings'; export { FIELD_FORMAT_IDS } from './types'; export { HTML_CONTEXT_TYPE, TEXT_CONTEXT_TYPE } from './content_types'; @@ -41,7 +42,9 @@ export { FieldFormatsContentType, FieldFormatConfig, FieldFormatId, - // Used in data plugin only + SerializedFieldFormat, + FormatFactory, + // Used in field format plugin only FieldFormatInstanceType, IFieldFormat, FieldFormatsStartCommon, diff --git a/src/plugins/data/common/field_formats/mocks.ts b/src/plugins/field_formats/common/mocks.ts similarity index 100% rename from src/plugins/data/common/field_formats/mocks.ts rename to src/plugins/field_formats/common/mocks.ts diff --git a/src/plugins/data/common/field_formats/types.ts b/src/plugins/field_formats/common/types.ts similarity index 73% rename from src/plugins/data/common/field_formats/types.ts rename to src/plugins/field_formats/common/types.ts index c09106751815f..9c9112f45373b 100644 --- a/src/plugins/data/common/field_formats/types.ts +++ b/src/plugins/field_formats/common/types.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import { GetConfigFn } from '../types'; import { FieldFormat } from './field_format'; import { FieldFormatsRegistry } from './field_formats_registry'; @@ -65,7 +64,17 @@ export interface FieldFormatConfig { es?: boolean; } -export type FieldFormatsGetConfigFn = GetConfigFn; +/** + * If a service is being shared on both the client and the server, and + * the client code requires synchronous access to uiSettings, both client + * and server should wrap the core uiSettings services in a function + * matching this signature. + * + * This matches the signature of the public `core.uiSettings.get`, and + * should only be used in scenarios where async access to uiSettings is + * not possible. + */ +export type FieldFormatsGetConfigFn = (key: string, defaultOverride?: T) => T; export type IFieldFormat = FieldFormat; @@ -96,3 +105,17 @@ export interface IFieldFormatMetaParams { } export type FieldFormatsStartCommon = Omit; + +/** + * JSON representation of a field formatter configuration. + * Is used to carry information about how to format data in + * a data table as part of the column definition. + * + * @public + */ +export interface SerializedFieldFormat> { + id?: string; + params?: TParams; +} + +export type FormatFactory = (mapping?: SerializedFieldFormat) => IFieldFormat; diff --git a/src/plugins/data/common/field_formats/utils/as_pretty_string.test.ts b/src/plugins/field_formats/common/utils/as_pretty_string.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/as_pretty_string.test.ts rename to src/plugins/field_formats/common/utils/as_pretty_string.test.ts diff --git a/src/plugins/data/common/field_formats/utils/as_pretty_string.ts b/src/plugins/field_formats/common/utils/as_pretty_string.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/as_pretty_string.ts rename to src/plugins/field_formats/common/utils/as_pretty_string.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/highlight_html.test.ts b/src/plugins/field_formats/common/utils/highlight/highlight_html.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/highlight_html.test.ts rename to src/plugins/field_formats/common/utils/highlight/highlight_html.test.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/highlight_html.ts b/src/plugins/field_formats/common/utils/highlight/highlight_html.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/highlight_html.ts rename to src/plugins/field_formats/common/utils/highlight/highlight_html.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/highlight_request.test.ts b/src/plugins/field_formats/common/utils/highlight/highlight_request.test.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/highlight_request.test.ts rename to src/plugins/field_formats/common/utils/highlight/highlight_request.test.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/highlight_request.ts b/src/plugins/field_formats/common/utils/highlight/highlight_request.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/highlight_request.ts rename to src/plugins/field_formats/common/utils/highlight/highlight_request.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/highlight_tags.ts b/src/plugins/field_formats/common/utils/highlight/highlight_tags.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/highlight_tags.ts rename to src/plugins/field_formats/common/utils/highlight/highlight_tags.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/html_tags.ts b/src/plugins/field_formats/common/utils/highlight/html_tags.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/html_tags.ts rename to src/plugins/field_formats/common/utils/highlight/html_tags.ts diff --git a/src/plugins/data/common/field_formats/utils/highlight/index.ts b/src/plugins/field_formats/common/utils/highlight/index.ts similarity index 100% rename from src/plugins/data/common/field_formats/utils/highlight/index.ts rename to src/plugins/field_formats/common/utils/highlight/index.ts diff --git a/src/plugins/data/common/field_formats/utils/index.ts b/src/plugins/field_formats/common/utils/index.ts similarity index 70% rename from src/plugins/data/common/field_formats/utils/index.ts rename to src/plugins/field_formats/common/utils/index.ts index 5771c0166075d..3cfa0241c6f41 100644 --- a/src/plugins/data/common/field_formats/utils/index.ts +++ b/src/plugins/field_formats/common/utils/index.ts @@ -6,10 +6,6 @@ * Side Public License, v 1. */ -import { SerializedFieldFormat } from '../../../../expressions/common/types'; -import { IFieldFormat } from '../index'; - export { asPrettyString } from './as_pretty_string'; export { getHighlightHtml, getHighlightRequest } from './highlight'; - -export type FormatFactory = (mapping?: SerializedFieldFormat) => IFieldFormat; +export { shortenDottedString } from './shorten_dotted_string'; diff --git a/src/plugins/field_formats/common/utils/shorten_dotted_string.test.ts b/src/plugins/field_formats/common/utils/shorten_dotted_string.test.ts new file mode 100644 index 0000000000000..33a44925982ec --- /dev/null +++ b/src/plugins/field_formats/common/utils/shorten_dotted_string.test.ts @@ -0,0 +1,23 @@ +/* + * 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 { shortenDottedString } from './shorten_dotted_string'; + +describe('shortenDottedString', () => { + test('should convert a dot.notated.string into a short string', () => { + expect(shortenDottedString('dot.notated.string')).toBe('d.n.string'); + }); + + test('should ignore non-string values', () => { + const obj = { key: 'val' }; + + expect(shortenDottedString(true)).toBe(true); + expect(shortenDottedString(123)).toBe(123); + expect(shortenDottedString(obj)).toBe(obj); + }); +}); diff --git a/src/plugins/field_formats/common/utils/shorten_dotted_string.ts b/src/plugins/field_formats/common/utils/shorten_dotted_string.ts new file mode 100644 index 0000000000000..53f7471913dc3 --- /dev/null +++ b/src/plugins/field_formats/common/utils/shorten_dotted_string.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +const DOT_PREFIX_RE = /(.).+?\./g; + +/** + * Convert a dot.notated.string into a short + * version (d.n.string) + * + * @return {any} + */ +export function shortenDottedString(input: any) { + return typeof input !== 'string' ? input : input.replace(DOT_PREFIX_RE, '$1.'); +} diff --git a/src/plugins/user_setup/jest.config.js b/src/plugins/field_formats/jest.config.js similarity index 89% rename from src/plugins/user_setup/jest.config.js rename to src/plugins/field_formats/jest.config.js index 75e355e230c5d..ea20fcfec6d09 100644 --- a/src/plugins/user_setup/jest.config.js +++ b/src/plugins/field_formats/jest.config.js @@ -9,5 +9,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../../..', - roots: ['/src/plugins/user_setup'], + roots: ['/src/plugins/field_formats'], }; diff --git a/src/plugins/field_formats/kibana.json b/src/plugins/field_formats/kibana.json new file mode 100755 index 0000000000000..ee5529697851d --- /dev/null +++ b/src/plugins/field_formats/kibana.json @@ -0,0 +1,15 @@ +{ + "id": "fieldFormats", + "version": "1.0.0", + "kibanaVersion": "kibana", + "server": true, + "ui": true, + "extraPublicDirs": ["common"], + "requiredPlugins": [], + "optionalPlugins": [], + "owner": { + "name": "App Services", + "githubTeam": "kibana-app-services" + }, + "description": "Index pattern fields and ambiguous values formatters" +} diff --git a/src/plugins/field_formats/public/index.scss b/src/plugins/field_formats/public/index.scss new file mode 100644 index 0000000000000..7928d81b1f565 --- /dev/null +++ b/src/plugins/field_formats/public/index.scss @@ -0,0 +1 @@ +@import './lib/converters/index'; diff --git a/src/plugins/user_setup/server/plugin.ts b/src/plugins/field_formats/public/index.ts old mode 100644 new mode 100755 similarity index 60% rename from src/plugins/user_setup/server/plugin.ts rename to src/plugins/field_formats/public/index.ts index 918c9a2007935..f765513fb4c4c --- a/src/plugins/user_setup/server/plugin.ts +++ b/src/plugins/field_formats/public/index.ts @@ -6,12 +6,10 @@ * Side Public License, v 1. */ -import type { CoreSetup, CoreStart, Plugin } from 'src/core/server'; +import { FieldFormatsPlugin } from './plugin'; +export { DateFormat, DateNanosFormat } from './lib/converters'; -export class UserSetupPlugin implements Plugin { - public setup(core: CoreSetup) {} - - public start(core: CoreStart) {} - - public stop() {} +export function plugin() { + return new FieldFormatsPlugin(); } +export { FieldFormatsSetup, FieldFormatsStart } from './plugin'; diff --git a/src/plugins/data/public/field_formats/constants.ts b/src/plugins/field_formats/public/lib/constants.ts similarity index 100% rename from src/plugins/data/public/field_formats/constants.ts rename to src/plugins/field_formats/public/lib/constants.ts diff --git a/src/plugins/data/public/field_formats/converters/_index.scss b/src/plugins/field_formats/public/lib/converters/_index.scss similarity index 100% rename from src/plugins/data/public/field_formats/converters/_index.scss rename to src/plugins/field_formats/public/lib/converters/_index.scss diff --git a/src/plugins/data/public/field_formats/converters/_string.scss b/src/plugins/field_formats/public/lib/converters/_string.scss similarity index 100% rename from src/plugins/data/public/field_formats/converters/_string.scss rename to src/plugins/field_formats/public/lib/converters/_string.scss diff --git a/src/plugins/data/public/field_formats/converters/date.test.ts b/src/plugins/field_formats/public/lib/converters/date.test.ts similarity index 100% rename from src/plugins/data/public/field_formats/converters/date.test.ts rename to src/plugins/field_formats/public/lib/converters/date.test.ts diff --git a/src/plugins/data/public/field_formats/converters/date.ts b/src/plugins/field_formats/public/lib/converters/date.ts similarity index 87% rename from src/plugins/data/public/field_formats/converters/date.ts rename to src/plugins/field_formats/public/lib/converters/date.ts index 1d74e6095427d..acc051afd6b1d 100644 --- a/src/plugins/data/public/field_formats/converters/date.ts +++ b/src/plugins/field_formats/public/lib/converters/date.ts @@ -9,12 +9,13 @@ import { i18n } from '@kbn/i18n'; import { memoize, noop } from 'lodash'; import moment from 'moment'; -import { FieldFormat, KBN_FIELD_TYPES, FIELD_FORMAT_IDS } from '../../../common'; -import { TextContextTypeConvert } from '../../../common/field_formats/types'; +import { KBN_FIELD_TYPES } from '@kbn/field-types'; +import { FieldFormat, FIELD_FORMAT_IDS } from '../../../common'; +import { TextContextTypeConvert } from '../../../common/types'; export class DateFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.DATE; - static title = i18n.translate('data.fieldFormats.date.title', { + static title = i18n.translate('fieldFormats.date.title', { defaultMessage: 'Date', }); static fieldType = KBN_FIELD_TYPES.DATE; diff --git a/src/plugins/data/public/field_formats/converters/date_nanos.ts b/src/plugins/field_formats/public/lib/converters/date_nanos.ts similarity index 79% rename from src/plugins/data/public/field_formats/converters/date_nanos.ts rename to src/plugins/field_formats/public/lib/converters/date_nanos.ts index f94d0e47a8ed4..c2e0b3f929067 100644 --- a/src/plugins/data/public/field_formats/converters/date_nanos.ts +++ b/src/plugins/field_formats/public/lib/converters/date_nanos.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { DateNanosFormat } from '../../../common/field_formats/converters/date_nanos_shared'; +export { DateNanosFormat } from '../../../common/converters/date_nanos_shared'; diff --git a/src/plugins/data/public/field_formats/converters/index.ts b/src/plugins/field_formats/public/lib/converters/index.ts similarity index 100% rename from src/plugins/data/public/field_formats/converters/index.ts rename to src/plugins/field_formats/public/lib/converters/index.ts diff --git a/src/plugins/data/public/field_formats/index.ts b/src/plugins/field_formats/public/lib/index.ts similarity index 82% rename from src/plugins/data/public/field_formats/index.ts rename to src/plugins/field_formats/public/lib/index.ts index 8b8b00b2b8746..83a2dc60d8d95 100644 --- a/src/plugins/data/public/field_formats/index.ts +++ b/src/plugins/field_formats/public/lib/index.ts @@ -6,6 +6,5 @@ * Side Public License, v 1. */ -export { FieldFormatsService, FieldFormatsSetup, FieldFormatsStart } from './field_formats_service'; export { DateFormat, DateNanosFormat } from './converters'; export { baseFormattersPublic } from './constants'; diff --git a/src/plugins/data/public/field_formats/mocks.ts b/src/plugins/field_formats/public/mocks.ts similarity index 56% rename from src/plugins/data/public/field_formats/mocks.ts rename to src/plugins/field_formats/public/mocks.ts index 883af75939220..53f8cf3a17494 100644 --- a/src/plugins/data/public/field_formats/mocks.ts +++ b/src/plugins/field_formats/public/mocks.ts @@ -6,17 +6,26 @@ * Side Public License, v 1. */ -import type { PublicMethodsOf } from '@kbn/utility-types'; -import { FieldFormatsStart, FieldFormatsSetup, FieldFormatsService } from '.'; -import { fieldFormatsMock } from '../../common/field_formats/mocks'; +import { CoreSetup } from 'src/core/public'; +import { baseFormattersPublic } from './lib/constants'; +import { FieldFormatsRegistry } from '../common'; +import type { FieldFormatsStart, FieldFormatsSetup } from '.'; +import { fieldFormatsMock } from '../common/mocks'; -type FieldFormatsServiceClientContract = PublicMethodsOf; +export const getFieldFormatsRegistry = (core: CoreSetup) => { + const fieldFormatsRegistry = new FieldFormatsRegistry(); + const getConfig = core.uiSettings.get.bind(core.uiSettings); + + fieldFormatsRegistry.init(getConfig, {}, baseFormattersPublic); + + return fieldFormatsRegistry; +}; const createSetupContractMock = () => fieldFormatsMock as FieldFormatsSetup; const createStartContractMock = () => fieldFormatsMock as FieldFormatsStart; const createMock = () => { - const mocked: jest.Mocked = { + const mocked: jest.Mocked<{ start: () => FieldFormatsStart; setup: () => FieldFormatsSetup }> = { setup: jest.fn().mockReturnValue(createSetupContractMock()), start: jest.fn().mockReturnValue(createStartContractMock()), }; diff --git a/src/plugins/data/public/field_formats/field_formats_service.test.ts b/src/plugins/field_formats/public/plugin.test.ts similarity index 51% rename from src/plugins/data/public/field_formats/field_formats_service.test.ts rename to src/plugins/field_formats/public/plugin.test.ts index 06d007b2aff00..808413667918d 100644 --- a/src/plugins/data/public/field_formats/field_formats_service.test.ts +++ b/src/plugins/field_formats/public/plugin.test.ts @@ -6,18 +6,18 @@ * Side Public License, v 1. */ -import { FieldFormatsService } from './field_formats_service'; -import { coreMock } from '../../../../../src/core/public/mocks'; -import { DateFormat } from './converters/date'; +import { coreMock } from '../../../../src/core/public/mocks'; +import { DateFormat } from './lib/converters/date'; +import { FieldFormatsPlugin } from './plugin'; -describe('FieldFormatService', () => { +describe('FieldFormatsPublic', () => { test('DateFormat is public version', () => { const mockCore = coreMock.createSetup(); - const service = new FieldFormatsService(); - service.setup(mockCore); - const fieldFormatsRegistry = service.start(); - const DateFormatFromRegsitry = fieldFormatsRegistry.getTypeWithoutMetaParams('date'); + const plugin = new FieldFormatsPlugin(); + plugin.setup(mockCore); + const fieldFormatsRegistry = plugin.start(); + const DateFormatFromRegistry = fieldFormatsRegistry.getTypeWithoutMetaParams('date'); - expect(DateFormatFromRegsitry).toEqual(DateFormat); + expect(DateFormatFromRegistry).toEqual(DateFormat); }); }); diff --git a/src/plugins/data/public/field_formats/field_formats_service.ts b/src/plugins/field_formats/public/plugin.ts old mode 100644 new mode 100755 similarity index 73% rename from src/plugins/data/public/field_formats/field_formats_service.ts rename to src/plugins/field_formats/public/plugin.ts index 041d0d7dd0e1c..0e90aa9b48c8e --- a/src/plugins/data/public/field_formats/field_formats_service.ts +++ b/src/plugins/field_formats/public/plugin.ts @@ -6,17 +6,18 @@ * Side Public License, v 1. */ -import { CoreSetup } from 'src/core/public'; -import { FieldFormatsRegistry, UI_SETTINGS } from '../../common'; -import { FormatFactory } from '../../common/field_formats/utils'; -import { baseFormattersPublic } from './constants'; +import { CoreSetup, Plugin } from '../../../core/public'; +import { FieldFormatsRegistry, FORMATS_UI_SETTINGS } from '../common'; +import { baseFormattersPublic } from './lib'; +import { FormatFactory } from '../common/types'; +import './index.scss'; -export class FieldFormatsService { +export class FieldFormatsPlugin implements Plugin { private readonly fieldFormatsRegistry: FieldFormatsRegistry = new FieldFormatsRegistry(); - public setup(core: CoreSetup) { + public setup(core: CoreSetup): FieldFormatsSetup { core.uiSettings.getUpdate$().subscribe(({ key, newValue }) => { - if (key === UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP) { + if (key === FORMATS_UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP) { this.fieldFormatsRegistry.parseDefaultTypeMap(newValue); } }); @@ -41,6 +42,8 @@ export class FieldFormatsService { public start() { return this.fieldFormatsRegistry as FieldFormatsStart; } + + public stop() {} } /** @public */ diff --git a/src/plugins/field_formats/server/index.ts b/src/plugins/field_formats/server/index.ts new file mode 100755 index 0000000000000..44de8fde558ec --- /dev/null +++ b/src/plugins/field_formats/server/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { PluginInitializerContext } from '../../../core/server'; +import { FieldFormatsPlugin } from './plugin'; +export { DateFormat, DateNanosFormat } from './lib/converters'; + +export function plugin(initializerContext: PluginInitializerContext) { + return new FieldFormatsPlugin(initializerContext); +} + +export { FieldFormatsSetup, FieldFormatsStart } from './types'; diff --git a/src/plugins/data/server/field_formats/converters/date_nanos_server.test.ts b/src/plugins/field_formats/server/lib/converters/date_nanos_server.test.ts similarity index 97% rename from src/plugins/data/server/field_formats/converters/date_nanos_server.test.ts rename to src/plugins/field_formats/server/lib/converters/date_nanos_server.test.ts index 3353f4a959b7e..86f0b2a7dc875 100644 --- a/src/plugins/data/server/field_formats/converters/date_nanos_server.test.ts +++ b/src/plugins/field_formats/server/lib/converters/date_nanos_server.test.ts @@ -7,7 +7,7 @@ */ import { DateNanosFormat } from './date_nanos_server'; -import { FieldFormatsGetConfigFn } from 'src/plugins/data/common'; +import { FieldFormatsGetConfigFn } from '../../../common'; describe('Date Nanos Format: Server side edition', () => { let convert: Function; diff --git a/src/plugins/data/server/field_formats/converters/date_nanos_server.ts b/src/plugins/field_formats/server/lib/converters/date_nanos_server.ts similarity index 94% rename from src/plugins/data/server/field_formats/converters/date_nanos_server.ts rename to src/plugins/field_formats/server/lib/converters/date_nanos_server.ts index 655c76d328f47..d47475f6274fa 100644 --- a/src/plugins/data/server/field_formats/converters/date_nanos_server.ts +++ b/src/plugins/field_formats/server/lib/converters/date_nanos_server.ts @@ -12,8 +12,8 @@ import { analysePatternForFract, DateNanosFormat, formatWithNanos, -} from '../../../common/field_formats/converters/date_nanos_shared'; -import { TextContextTypeConvert } from '../../../common/field_formats/types'; +} from '../../../common/converters/date_nanos_shared'; +import { TextContextTypeConvert } from '../../../common/types'; class DateNanosFormatServer extends DateNanosFormat { textConvert: TextContextTypeConvert = (val) => { diff --git a/src/plugins/data/server/field_formats/converters/date_server.ts b/src/plugins/field_formats/server/lib/converters/date_server.ts similarity index 90% rename from src/plugins/data/server/field_formats/converters/date_server.ts rename to src/plugins/field_formats/server/lib/converters/date_server.ts index a86f3c894c543..bf2151db0072c 100644 --- a/src/plugins/data/server/field_formats/converters/date_server.ts +++ b/src/plugins/field_formats/server/lib/converters/date_server.ts @@ -9,20 +9,13 @@ import { i18n } from '@kbn/i18n'; import { memoize, noop } from 'lodash'; import moment from 'moment-timezone'; -import { - FieldFormat, - KBN_FIELD_TYPES, - FIELD_FORMAT_IDS, - FieldFormatsGetConfigFn, -} from '../../../common'; -import { - IFieldFormatMetaParams, - TextContextTypeConvert, -} from '../../../common/field_formats/types'; +import { KBN_FIELD_TYPES } from '@kbn/field-types'; +import { FieldFormat, FIELD_FORMAT_IDS, FieldFormatsGetConfigFn } from '../../../common'; +import { IFieldFormatMetaParams, TextContextTypeConvert } from '../../../common/types'; export class DateFormat extends FieldFormat { static id = FIELD_FORMAT_IDS.DATE; - static title = i18n.translate('data.fieldFormats.date.title', { + static title = i18n.translate('fieldFormats.date.title', { defaultMessage: 'Date', }); static fieldType = KBN_FIELD_TYPES.DATE; diff --git a/src/plugins/data/server/field_formats/converters/index.ts b/src/plugins/field_formats/server/lib/converters/index.ts similarity index 100% rename from src/plugins/data/server/field_formats/converters/index.ts rename to src/plugins/field_formats/server/lib/converters/index.ts diff --git a/src/plugins/data/server/field_formats/mocks.ts b/src/plugins/field_formats/server/mocks.ts similarity index 100% rename from src/plugins/data/server/field_formats/mocks.ts rename to src/plugins/field_formats/server/mocks.ts diff --git a/src/plugins/data/server/field_formats/field_formats_service.test.ts b/src/plugins/field_formats/server/plugin.test.ts similarity index 58% rename from src/plugins/data/server/field_formats/field_formats_service.test.ts rename to src/plugins/field_formats/server/plugin.test.ts index 0bfa9f89117e8..266d724ce5e22 100644 --- a/src/plugins/data/server/field_formats/field_formats_service.test.ts +++ b/src/plugins/field_formats/server/plugin.test.ts @@ -6,16 +6,16 @@ * Side Public License, v 1. */ -import { FieldFormatsService } from './field_formats_service'; -import { DateFormat } from './converters/date_server'; -import { coreMock } from '../../../../core/server/mocks'; +import { DateFormat } from './lib/converters/date_server'; +import { coreMock } from '../../../core/server/mocks'; +import { FieldFormatsPlugin } from './plugin'; -describe('FieldFormatService', () => { +describe('FieldFormats registry server plugin', () => { test('DateFormat is server version', async () => { - const service = new FieldFormatsService(); - const fieldFormatsService = await service.start(); + const plugin = new FieldFormatsPlugin(coreMock.createPluginInitializerContext()); + const pluginStart = await plugin.start(coreMock.createStart()); const uiSettings = coreMock.createStart().uiSettings.asScopedToClient({} as any); - const fieldFormatsRegistry = await fieldFormatsService.fieldFormatServiceFactory(uiSettings); + const fieldFormatsRegistry = await pluginStart.fieldFormatServiceFactory(uiSettings); const DateFormatFromRegsitry = fieldFormatsRegistry.getTypeWithoutMetaParams('date'); expect(DateFormatFromRegsitry).toEqual(DateFormat); diff --git a/src/plugins/data/server/field_formats/field_formats_service.ts b/src/plugins/field_formats/server/plugin.ts old mode 100644 new mode 100755 similarity index 60% rename from src/plugins/data/server/field_formats/field_formats_service.ts rename to src/plugins/field_formats/server/plugin.ts index fa94e5dcef9cf..e2c64807433a9 --- a/src/plugins/data/server/field_formats/field_formats_service.ts +++ b/src/plugins/field_formats/server/plugin.ts @@ -8,28 +8,36 @@ import { has } from 'lodash'; import { - FieldFormatsRegistry, - FieldFormatInstanceType, - baseFormatters, -} from '../../common/field_formats'; -import { IUiSettingsClient } from '../../../../core/server'; -import { DateFormat, DateNanosFormat } from './converters'; - -export class FieldFormatsService { - private readonly fieldFormatClasses: FieldFormatInstanceType[] = [ + PluginInitializerContext, + CoreSetup, + CoreStart, + Plugin, + IUiSettingsClient, +} from '../../../core/server'; +import { FieldFormatsStart, FieldFormatsSetup } from './types'; +import { DateFormat, DateNanosFormat } from './lib/converters'; +import { baseFormatters, FieldFormatInstanceType, FieldFormatsRegistry } from '../common'; +import { getUiSettings } from './ui_settings'; + +export class FieldFormatsPlugin implements Plugin { + private readonly fieldFormats: FieldFormatInstanceType[] = [ DateFormat, DateNanosFormat, ...baseFormatters, ]; - public setup() { + constructor(initializerContext: PluginInitializerContext) {} + + public setup(core: CoreSetup) { + core.uiSettings.register(getUiSettings()); + return { register: (customFieldFormat: FieldFormatInstanceType) => - this.fieldFormatClasses.push(customFieldFormat), + this.fieldFormats.push(customFieldFormat), }; } - public start() { + public start(core: CoreStart) { return { fieldFormatServiceFactory: async (uiSettings: IUiSettingsClient) => { const fieldFormatsRegistry = new FieldFormatsRegistry(); @@ -43,16 +51,12 @@ export class FieldFormatsService { } }); - fieldFormatsRegistry.init((key: string) => uiConfigs[key], {}, this.fieldFormatClasses); + fieldFormatsRegistry.init((key: string) => uiConfigs[key], {}, this.fieldFormats); return fieldFormatsRegistry; }, }; } -} -/** @public */ -export type FieldFormatsSetup = ReturnType; - -/** @public */ -export type FieldFormatsStart = ReturnType; + public stop() {} +} diff --git a/src/plugins/field_formats/server/types.ts b/src/plugins/field_formats/server/types.ts new file mode 100755 index 0000000000000..eaf9c9ffdc390 --- /dev/null +++ b/src/plugins/field_formats/server/types.ts @@ -0,0 +1,26 @@ +/* + * 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 { FieldFormatInstanceType, FieldFormatsRegistry } from '../common'; +import { IUiSettingsClient } from '../../../core/server'; + +export interface FieldFormatsSetup { + /** + * Register a server side field formatter + * @param fieldFormat {@link FieldFormatInstanceType} + */ + register: (fieldFormat: FieldFormatInstanceType) => void; +} + +export interface FieldFormatsStart { + /** + * Create a field format registry + * @param uiSettings - {@link IUiSettingsClient} + */ + fieldFormatServiceFactory: (uiSettings: IUiSettingsClient) => Promise; +} diff --git a/src/plugins/field_formats/server/ui_settings.ts b/src/plugins/field_formats/server/ui_settings.ts new file mode 100644 index 0000000000000..f24ddc60e1f97 --- /dev/null +++ b/src/plugins/field_formats/server/ui_settings.ts @@ -0,0 +1,226 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { schema } from '@kbn/config-schema'; +import { UiSettingsParams } from 'kibana/server'; +// @ts-ignore untyped module +import numeralLanguages from '@elastic/numeral/languages'; +import { FORMATS_UI_SETTINGS } from '../common'; + +// We add the `en` key manually here, since that's not a real numeral locale, but the +// default fallback in case the locale is not found. +const numeralLanguageIds = [ + 'en', + ...numeralLanguages.map((numeralLanguage: any) => { + return numeralLanguage.id; + }), +]; + +export function getUiSettings(): Record> { + return { + [FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE]: { + name: i18n.translate('fieldFormats.advancedSettings.shortenFieldsTitle', { + defaultMessage: 'Shorten fields', + }), + value: false, + description: i18n.translate('fieldFormats.advancedSettings.shortenFieldsText', { + defaultMessage: 'Shorten long fields, for example, instead of foo.bar.baz, show f.b.baz', + }), + schema: schema.boolean(), + }, + [FORMATS_UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: { + name: i18n.translate('fieldFormats.advancedSettings.format.defaultTypeMapTitle', { + defaultMessage: 'Field type format name', + }), + value: `{ + "ip": { "id": "ip", "params": {} }, + "date": { "id": "date", "params": {} }, + "date_nanos": { "id": "date_nanos", "params": {}, "es": true }, + "number": { "id": "number", "params": {} }, + "boolean": { "id": "boolean", "params": {} }, + "histogram": { "id": "histogram", "params": {} }, + "_source": { "id": "_source", "params": {} }, + "_default_": { "id": "string", "params": {} } +}`, + type: 'json', + description: i18n.translate('fieldFormats.advancedSettings.format.defaultTypeMapText', { + defaultMessage: + 'Map of the format name to use by default for each field type. ' + + '{defaultFormat} is used if the field type is not mentioned explicitly', + values: { + defaultFormat: '"_default_"', + }, + }), + schema: schema.object({ + ip: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + date: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + date_nanos: schema.object({ + id: schema.string(), + params: schema.object({}), + es: schema.boolean(), + }), + number: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + boolean: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + histogram: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + _source: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + _default_: schema.object({ + id: schema.string(), + params: schema.object({}), + }), + }), + }, + [FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: { + name: i18n.translate('fieldFormats.advancedSettings.format.numberFormatTitle', { + defaultMessage: 'Number format', + }), + value: '0,0.[000]', + type: 'string', + description: i18n.translate('fieldFormats.advancedSettings.format.numberFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "number" format', + description: + 'Part of composite text: fieldFormats.advancedSettings.format.numberFormatText + ' + + 'fieldFormats.advancedSettings.format.numberFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate( + 'fieldFormats.advancedSettings.format.numberFormat.numeralFormatLinkText', + { + defaultMessage: 'numeral format', + } + ) + + '', + }, + }), + schema: schema.string(), + }, + [FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: { + name: i18n.translate('fieldFormats.advancedSettings.format.percentFormatTitle', { + defaultMessage: 'Percent format', + }), + value: '0,0.[000]%', + type: 'string', + description: i18n.translate('fieldFormats.advancedSettings.format.percentFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "percent" format', + description: + 'Part of composite text: fieldFormats.advancedSettings.format.percentFormatText + ' + + 'fieldFormats.advancedSettings.format.percentFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate( + 'fieldFormats.advancedSettings.format.percentFormat.numeralFormatLinkText', + { + defaultMessage: 'numeral format', + } + ) + + '', + }, + }), + schema: schema.string(), + }, + [FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: { + name: i18n.translate('fieldFormats.advancedSettings.format.bytesFormatTitle', { + defaultMessage: 'Bytes format', + }), + value: '0,0.[0]b', + type: 'string', + description: i18n.translate('fieldFormats.advancedSettings.format.bytesFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "bytes" format', + description: + 'Part of composite text: fieldFormats.advancedSettings.format.bytesFormatText + ' + + 'fieldFormats.advancedSettings.format.bytesFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate( + 'fieldFormats.advancedSettings.format.bytesFormat.numeralFormatLinkText', + { + defaultMessage: 'numeral format', + } + ) + + '', + }, + }), + schema: schema.string(), + }, + [FORMATS_UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN]: { + name: i18n.translate('fieldFormats.advancedSettings.format.currencyFormatTitle', { + defaultMessage: 'Currency format', + }), + value: '($0,0.[00])', + type: 'string', + description: i18n.translate('fieldFormats.advancedSettings.format.currencyFormatText', { + defaultMessage: 'Default {numeralFormatLink} for the "currency" format', + description: + 'Part of composite text: fieldFormats.advancedSettings.format.currencyFormatText + ' + + 'fieldFormats.advancedSettings.format.currencyFormat.numeralFormatLinkText', + values: { + numeralFormatLink: + '' + + i18n.translate( + 'fieldFormats.advancedSettings.format.currencyFormat.numeralFormatLinkText', + { + defaultMessage: 'numeral format', + } + ) + + '', + }, + }), + schema: schema.string(), + }, + [FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: { + name: i18n.translate('fieldFormats.advancedSettings.format.formattingLocaleTitle', { + defaultMessage: 'Formatting locale', + }), + value: 'en', + type: 'select', + options: numeralLanguageIds, + optionLabels: Object.fromEntries( + numeralLanguages.map((language: Record) => [language.id, language.name]) + ), + description: i18n.translate('fieldFormats.advancedSettings.format.formattingLocaleText', { + defaultMessage: `{numeralLanguageLink} locale`, + description: + 'Part of composite text: fieldFormats.advancedSettings.format.formattingLocale.numeralLanguageLinkText + ' + + 'fieldFormats.advancedSettings.format.formattingLocaleText', + values: { + numeralLanguageLink: + '' + + i18n.translate( + 'fieldFormats.advancedSettings.format.formattingLocale.numeralLanguageLinkText', + { + defaultMessage: 'Numeral language', + } + ) + + '', + }, + }), + schema: schema.string(), + }, + }; +} diff --git a/src/plugins/field_formats/tsconfig.json b/src/plugins/field_formats/tsconfig.json new file mode 100644 index 0000000000000..4382ab1051c1d --- /dev/null +++ b/src/plugins/field_formats/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*", + "config.ts", + "common/**/*.json", + "public/**/*.json" + ], + "references": [{ "path": "../../core/tsconfig.json" }] +} diff --git a/src/plugins/index_pattern_editor/README.md b/src/plugins/index_pattern_editor/README.md new file mode 100644 index 0000000000000..3ffb589230732 --- /dev/null +++ b/src/plugins/index_pattern_editor/README.md @@ -0,0 +1,48 @@ +# Index pattern editor + +Create index patterns from within Kibana apps. + +## How to use + +You first need to add in your kibana.json the "`indexPatternEditor`" plugin as a required dependency of your plugin. + +You will then receive in the start contract of the indexPatternEditor plugin the following API: + +### `userPermissions.editIndexPattern(): boolean` + +Convenience method that uses the `core.application.capabilities` api to determine whether the user can create or edit the index pattern. + +### `openEditor(options: IndexPatternEditorProps): CloseEditor` + +Use this method to display the index pattern editor to create an index pattern. + +#### `options` + +`onSave: (indexPattern: IndexPattern) => void` (**required**) + +You must provide an `onSave` handler to be notified when an index pattern has been created/updated. This handler is called after the index pattern has been persisted as a saved object. + +`onCancel: () => void;` (optional) + +You can optionally pass an `onCancel` handler which is called when the index pattern creation flyout is closed wihtout creating an index pattern. + +`defaultTypeIsRollup: boolean` (optional, default false) + +The default index pattern type can be optionally specified as `rollup`. + +`requireTimestampField: boolean` (optional, default false) + +The editor can require a timestamp field on the index pattern. + +### IndexPatternEditorComponent + +This the React component interface equivalent to `openEditor`. It takes the same arguments - + +```tsx + +``` diff --git a/src/plugins/index_pattern_editor/jest.config.js b/src/plugins/index_pattern_editor/jest.config.js new file mode 100644 index 0000000000000..0a018a42d06e6 --- /dev/null +++ b/src/plugins/index_pattern_editor/jest.config.js @@ -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. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/src/plugins/index_pattern_editor'], +}; diff --git a/src/plugins/index_pattern_editor/kibana.json b/src/plugins/index_pattern_editor/kibana.json new file mode 100644 index 0000000000000..b4a1bea555616 --- /dev/null +++ b/src/plugins/index_pattern_editor/kibana.json @@ -0,0 +1,13 @@ +{ + "id": "indexPatternEditor", + "version": "kibana", + "server": false, + "ui": true, + "requiredPlugins": ["data"], + "requiredBundles": ["kibanaReact", "esUiShared"], + "owner": { + "name": "App Services", + "githubTeam": "kibana-app-services" + }, + "description": "This plugin provides the ability to create index patterns via a modal flyout from any kibana app" +} diff --git a/src/plugins/index_pattern_editor/public/components/_templates.scss b/src/plugins/index_pattern_editor/public/components/_templates.scss new file mode 100644 index 0000000000000..5303537bddabc --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/_templates.scss @@ -0,0 +1,11 @@ +%inp-empty-state-footer { + background: $euiColorLightestShade; + margin: 0 (-$euiSizeL) (-$euiSizeL); + padding: $euiSizeL; + border-radius: 0 0 $euiBorderRadius $euiBorderRadius; + + // sass-lint:disable-block mixins-before-declarations + @include euiBreakpoint('xs', 's') { + text-align: center; + } +} diff --git a/src/plugins/index_pattern_editor/public/components/_variables.scss b/src/plugins/index_pattern_editor/public/components/_variables.scss new file mode 100644 index 0000000000000..5da25a91bd77c --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/_variables.scss @@ -0,0 +1 @@ +$inpEmptyStateMaxWidth: $euiSizeXXL * 19; diff --git a/src/plugins/index_pattern_editor/public/components/advanced_params_content/advanced_params_content.tsx b/src/plugins/index_pattern_editor/public/components/advanced_params_content/advanced_params_content.tsx new file mode 100644 index 0000000000000..ad876fed51801 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/advanced_params_content/advanced_params_content.tsx @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; + +import { UseField, TextField, ToggleField } from '../../shared_imports'; +import { IndexPatternConfig } from '../../types'; + +import { AdvancedParamsSection } from './advanced_params_section'; + +const allowHiddenAriaLabel = i18n.translate('indexPatternEditor.form.allowHiddenAriaLabel', { + defaultMessage: 'Allow hidden and system indices', +}); + +const customIndexPatternIdLabel = i18n.translate( + 'indexPatternEditor.form.customIndexPatternIdLabel', + { + defaultMessage: 'Custom index pattern ID', + } +); + +interface AdvancedParamsContentProps { + disableAllowHidden: boolean; +} + +export const AdvancedParamsContent = ({ disableAllowHidden }: AdvancedParamsContentProps) => ( + + + + + path={'allowHidden'} + component={ToggleField} + data-test-subj="allowHiddenField" + componentProps={{ + euiFieldProps: { + 'aria-label': allowHiddenAriaLabel, + disabled: disableAllowHidden, + }, + }} + /> + + + + + + + path={'id'} + component={TextField} + data-test-subj="savedObjectIdField" + componentProps={{ + euiFieldProps: { + 'aria-label': customIndexPatternIdLabel, + }, + }} + /> + + + +); diff --git a/src/plugins/index_pattern_editor/public/components/advanced_params_content/advanced_params_section.tsx b/src/plugins/index_pattern_editor/public/components/advanced_params_content/advanced_params_section.tsx new file mode 100644 index 0000000000000..b313fddb8ee2d --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/advanced_params_content/advanced_params_section.tsx @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useState, useCallback } from 'react'; +import { i18n } from '@kbn/i18n'; + +import { EuiButtonEmpty, EuiSpacer } from '@elastic/eui'; + +interface Props { + children: React.ReactNode; +} + +export const AdvancedParamsSection = ({ children }: Props) => { + const [isVisible, setIsVisible] = useState(false); + + const toggleIsVisible = useCallback(() => { + setIsVisible(!isVisible); + }, [isVisible]); + + return ( + <> + + {isVisible + ? i18n.translate('indexPatternEditor.editor.form.advancedSettings.hideButtonLabel', { + defaultMessage: 'Hide advanced settings', + }) + : i18n.translate('indexPatternEditor.editor.form.advancedSettings.showButtonLabel', { + defaultMessage: 'Show advanced settings', + })} + + +
    + + {/* We ned to wrap the children inside a "div" to have our css :first-child rule */} +
    {children}
    +
    + + ); +}; diff --git a/src/plugins/index_pattern_editor/public/components/advanced_params_content/index.ts b/src/plugins/index_pattern_editor/public/components/advanced_params_content/index.ts new file mode 100644 index 0000000000000..a285004d1f45d --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/advanced_params_content/index.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 { AdvancedParamsContent } from './advanced_params_content'; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/__snapshots__/empty_index_list_prompt.test.tsx.snap similarity index 71% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/__snapshots__/empty_index_list_prompt.test.tsx.snap index 75b8177d9dac3..a104c36e3a8a0 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/__snapshots__/empty_index_list_prompt.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`EmptyState should render normally 1`] = ` +exports[`EmptyIndexListPrompt should render normally 1`] = ` @@ -38,7 +38,7 @@ exports[`EmptyState should render normally 1`] = ` description={ } @@ -53,7 +53,7 @@ exports[`EmptyState should render normally 1`] = ` title={ } @@ -65,7 +65,7 @@ exports[`EmptyState should render normally 1`] = ` description={ } @@ -80,7 +80,7 @@ exports[`EmptyState should render normally 1`] = ` title={ } @@ -92,7 +92,7 @@ exports[`EmptyState should render normally 1`] = ` description={ } @@ -107,7 +107,7 @@ exports[`EmptyState should render normally 1`] = ` title={ } @@ -131,18 +131,18 @@ exports[`EmptyState should render normally 1`] = ` Object { "description": , "title": , }, @@ -164,7 +164,7 @@ exports[`EmptyState should render normally 1`] = ` > @@ -175,7 +175,7 @@ exports[`EmptyState should render normally 1`] = ` , "title": , }, @@ -184,33 +184,33 @@ exports[`EmptyState should render normally 1`] = ` /> + + + + + , + } + } + /> +
    - - - - - , - } - } - /> - `; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.scss b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.scss similarity index 86% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.scss rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.scss index 37889b9d7c483..845ddfb3eb234 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.scss +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.scss @@ -1,5 +1,5 @@ -@import '../../../variables'; -@import '../../../templates'; +@import '../../variables'; +@import '../../templates'; .inpEmptyState { // override EUI specificity diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx similarity index 69% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx index ed68d4d4ddd64..f5a996a441515 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.test.tsx @@ -7,14 +7,11 @@ */ import React from 'react'; -import { EmptyState } from '../empty_state'; +import { EmptyIndexListPrompt } from './empty_index_list_prompt'; import { shallow } from 'enzyme'; import sinon from 'sinon'; import { findTestSubject } from '@elastic/eui/lib/test'; import { mountWithIntl } from '@kbn/test/jest'; -import { docLinksServiceMock } from '../../../../../../core/public/mocks'; - -const docLinks = docLinksServiceMock.createStartContract(); jest.mock('react-router-dom', () => ({ useHistory: () => ({ @@ -22,14 +19,16 @@ jest.mock('react-router-dom', () => ({ }), })); -describe('EmptyState', () => { +describe('EmptyIndexListPrompt', () => { it('should render normally', () => { const component = shallow( - {}} - navigateToApp={async () => {}} - canSave={true} + createAnyway={() => {}} + closeFlyout={() => {}} + addDataUrl={'http://elastic.co'} + navigateToApp={async (appId) => {}} + canSaveIndexPattern={true} /> ); @@ -42,11 +41,13 @@ describe('EmptyState', () => { const onRefreshHandler = sinon.stub(); const component = mountWithIntl( - {}} - canSave={true} + createAnyway={() => {}} + closeFlyout={() => {}} + addDataUrl={'http://elastic.co'} + navigateToApp={async (appId) => {}} + canSaveIndexPattern={true} /> ); diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.tsx similarity index 72% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.tsx index af49e8c36fe3b..1331eb9b7c4ac 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/empty_index_list_prompt.tsx @@ -6,10 +6,9 @@ * Side Public License, v 1. */ -import './empty_state.scss'; +import './empty_index_list_prompt.scss'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { DocLinksStart, ApplicationStart } from 'kibana/public'; import { EuiPageContentHeader, EuiPageContentHeaderSection, @@ -26,30 +25,34 @@ import { EuiText, EuiFlexGroup, } from '@elastic/eui'; -import { useHistory } from 'react-router-dom'; -import { reactRouterNavigate } from '../../../../../../plugins/kibana_react/public'; -export const EmptyState = ({ +import { ApplicationStart } from 'src/core/public'; + +export const EmptyIndexListPrompt = ({ onRefresh, + closeFlyout, + createAnyway, + canSaveIndexPattern, + addDataUrl, navigateToApp, - docLinks, - canSave, }: { onRefresh: () => void; + closeFlyout: () => void; + createAnyway: () => void; + canSaveIndexPattern: boolean; + addDataUrl: string; navigateToApp: ApplicationStart['navigateToApp']; - docLinks: DocLinksStart; - canSave: boolean; }) => { - const createAnyway = ( + const createAnywayLink = ( + createAnyway()} data-test-subj="createAnyway"> @@ -74,7 +77,7 @@ export const EmptyState = ({

    @@ -87,17 +90,20 @@ export const EmptyState = ({ navigateToApp('home', { path: '#/tutorial_directory' })} + onClick={() => { + navigateToApp('home', { path: '#/tutorial_directory' }); + closeFlyout(); + }} icon={} title={ } description={ } @@ -110,13 +116,13 @@ export const EmptyState = ({ icon={} title={ } description={ } @@ -125,17 +131,20 @@ export const EmptyState = ({ navigateToApp('home', { path: '#/tutorial_directory/sampleData' })} + onClick={() => { + navigateToApp('home', { path: '#/tutorial_directory/sampleData' }); + closeFlyout(); + }} icon={} title={ } description={ } @@ -151,14 +160,14 @@ export const EmptyState = ({ { title: ( ), description: ( - + @@ -173,14 +182,14 @@ export const EmptyState = ({ { title: ( ), description: ( {' '} @@ -191,11 +200,11 @@ export const EmptyState = ({ /> + + {canSaveIndexPattern && createAnywayLink}
    - - {canSave && createAnyway} ); }; diff --git a/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/index.ts b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/index.ts new file mode 100644 index 0000000000000..ae5dcecf069c7 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_list_prompt/index.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 { EmptyIndexListPrompt } from './empty_index_list_prompt'; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap similarity index 66% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap index bc69fa29e6904..6216f04c0a1a9 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/__snapshots__/empty_index_pattern_prompt.test.tsx.snap @@ -19,7 +19,15 @@ exports[`EmptyIndexPatternPrompt should render normally 1`] = ` className="inpEmptyIndexPatternPrompt__illustration" grow={1} > - + + } + > + +

    - - +
    @@ -79,19 +83,19 @@ exports[`EmptyIndexPatternPrompt should render normally 1`] = ` > diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.scss b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/assets/index_pattern_illustration.scss similarity index 100% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.scss rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/assets/index_pattern_illustration.scss diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/assets/index_pattern_illustration.tsx similarity index 99% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.tsx rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/assets/index_pattern_illustration.tsx index 3666c1be7b5d2..09b18e25e9d00 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/assets/index_pattern_illustration.tsx +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/assets/index_pattern_illustration.tsx @@ -537,4 +537,5 @@ const IndexPatternIllustration = () => ( ); -export const Illustration = IndexPatternIllustration; +/* eslint-disable import/no-default-export */ +export default IndexPatternIllustration; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.scss b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.scss similarity index 92% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.scss rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.scss index 11ac55b098a57..f6db2fc89f353 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.scss +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.scss @@ -1,5 +1,5 @@ -@import '../../../variables'; -@import '../../../templates'; +@import '../../variables'; +@import '../../templates'; .inpEmptyIndexPatternPrompt { // override EUI specificity diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx similarity index 82% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx index 1cd0574a35d15..4cf3c4b55acde 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx @@ -14,10 +14,9 @@ describe('EmptyIndexPatternPrompt', () => { it('should render normally', () => { const component = shallowWithI18nProvider( {} }]} - docLinksIndexPatternIntro={'testUrl'} - setBreadcrumbs={() => {}} + goToCreate={() => {}} + canSaveIndexPattern={true} + indexPatternsIntroUrl={'http://elastic.co/'} /> ); diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx similarity index 65% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx index f36f3a38c7380..054ff9d13b043 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx @@ -8,34 +8,26 @@ import './empty_index_pattern_prompt.scss'; -import React from 'react'; +import React, { lazy, Suspense } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiPageContent, EuiSpacer, EuiText, EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; import { EuiDescriptionListTitle } from '@elastic/eui'; import { EuiDescriptionListDescription, EuiDescriptionList } from '@elastic/eui'; -import { EuiLink } from '@elastic/eui'; -import { getListBreadcrumbs } from '../../breadcrumbs'; -import { IndexPatternCreationOption } from '../../types'; -import { CreateButton } from '../../create_button'; -import { Illustration } from './assets/index_pattern_illustration'; -import { ManagementAppMountParams } from '../../../../../management/public'; - +import { EuiLink, EuiButton, EuiLoadingSpinner } from '@elastic/eui'; interface Props { - canSave: boolean; - creationOptions: IndexPatternCreationOption[]; - docLinksIndexPatternIntro: string; - setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; + goToCreate: () => void; + canSaveIndexPattern: boolean; + indexPatternsIntroUrl: string; } +const Illustration = lazy(() => import('./assets/index_pattern_illustration')); + export const EmptyIndexPatternPrompt = ({ - canSave, - creationOptions, - docLinksIndexPatternIntro, - setBreadcrumbs, + goToCreate, + canSaveIndexPattern, + indexPatternsIntroUrl, }: Props) => { - setBreadcrumbs(getListBreadcrumbs()); - return ( - + }> + +


    - {canSave && ( - + {canSaveIndexPattern && ( + - + )}
    @@ -85,14 +84,14 @@ export const EmptyIndexPatternPrompt = ({ - + diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/index.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/index.tsx similarity index 100% rename from src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/index.tsx rename to src/plugins/index_pattern_editor/public/components/empty_prompts/empty_index_pattern_prompt/index.tsx diff --git a/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_prompts.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_prompts.tsx new file mode 100644 index 0000000000000..3b06fa1cff298 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/empty_prompts.tsx @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useState, useCallback, FC } from 'react'; + +import { useKibana } from '../../shared_imports'; + +import { MatchedItem, ResolveIndexResponseItemAlias, IndexPatternEditorContext } from '../../types'; + +import { getIndices } from '../../lib'; + +import { EmptyIndexListPrompt } from './empty_index_list_prompt'; +import { EmptyIndexPatternPrompt } from './empty_index_pattern_prompt'; +import { PromptFooter } from './prompt_footer'; + +const removeAliases = (item: MatchedItem) => + !((item as unknown) as ResolveIndexResponseItemAlias).indices; + +interface Props { + onCancel: () => void; + allSources: MatchedItem[]; + hasExistingIndexPatterns: boolean; + loadSources: () => void; +} + +export const EmptyPrompts: FC = ({ + hasExistingIndexPatterns, + allSources, + onCancel, + children, + loadSources, +}) => { + const { + services: { docLinks, application, http }, + } = useKibana(); + + const [remoteClustersExist, setRemoteClustersExist] = useState(false); + const [goToForm, setGoToForm] = useState(false); + + const hasDataIndices = allSources.some(({ name }: MatchedItem) => !name.startsWith('.')); + + useCallback(() => { + let isMounted = true; + if (!hasDataIndices) + getIndices(http, () => false, '*:*', false).then((dataSources) => { + if (isMounted) { + setRemoteClustersExist(!!dataSources.filter(removeAliases).length); + } + }); + return () => { + isMounted = false; + }; + }, [http, hasDataIndices]); + + if (!hasExistingIndexPatterns && !goToForm) { + if (!hasDataIndices && !remoteClustersExist) { + // load data + return ( + <> + setGoToForm(true)} + canSaveIndexPattern={application.capabilities.indexPatterns.save as boolean} + navigateToApp={application.navigateToApp} + addDataUrl={docLinks.links.indexPatterns.introduction} + /> + + + ); + } else { + // first time + return ( + <> + setGoToForm(true)} + indexPatternsIntroUrl={docLinks.links.indexPatterns.introduction} + canSaveIndexPattern={application.capabilities.indexPatterns.save as boolean} + /> + + + ); + } + } + + return <>{children}; +}; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/index.ts b/src/plugins/index_pattern_editor/public/components/empty_prompts/index.tsx similarity index 88% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/index.ts rename to src/plugins/index_pattern_editor/public/components/empty_prompts/index.tsx index 8f737b3a42613..20bf754e3771a 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/index.ts +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/index.tsx @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { Header } from './header'; +export { EmptyPrompts } from './empty_prompts'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/index.ts b/src/plugins/index_pattern_editor/public/components/empty_prompts/prompt_footer/index.ts similarity index 88% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/index.ts rename to src/plugins/index_pattern_editor/public/components/empty_prompts/prompt_footer/index.ts index 6d39f5bacbcaa..52b2a82651b28 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/index.ts +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/prompt_footer/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { LoadingState } from './loading_state'; +export { PromptFooter } from './prompt_footer'; diff --git a/src/plugins/index_pattern_editor/public/components/empty_prompts/prompt_footer/prompt_footer.tsx b/src/plugins/index_pattern_editor/public/components/empty_prompts/prompt_footer/prompt_footer.tsx new file mode 100644 index 0000000000000..d1ab3febc5ed3 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/empty_prompts/prompt_footer/prompt_footer.tsx @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { EuiFlyoutFooter, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui'; + +const closeButtonLabel = i18n.translate( + 'indexPatternEditor.editor.emptyPrompt.flyoutCloseButtonLabel', + { + defaultMessage: 'Close', + } +); + +interface PromptFooterProps { + onCancel: () => void; +} + +export const PromptFooter = ({ onCancel }: PromptFooterProps) => { + return ( + + + + + {closeButtonLabel} + + + + + ); +}; diff --git a/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panel.tsx b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panel.tsx new file mode 100644 index 0000000000000..8f9193a47327f --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panel.tsx @@ -0,0 +1,120 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { + CSSProperties, + useState, + useLayoutEffect, + useCallback, + createContext, + useContext, +} from 'react'; +import classnames from 'classnames'; +import { EuiFlexItem } from '@elastic/eui'; + +import { useFlyoutPanelsContext } from './flyout_panels'; + +interface Context { + registerFooter: () => void; + registerContent: () => void; +} + +const flyoutPanelContext = createContext({ + registerFooter: () => {}, + registerContent: () => {}, +}); + +export interface Props { + /** Width of the panel (in percent %) */ + width?: number; + /** EUI sass background */ + backgroundColor?: 'euiPageBackground' | 'euiEmptyShade'; + /** Add a border to the panel */ + border?: 'left' | 'right'; +} + +export const Panel: React.FC> = ({ + children, + width, + className = '', + backgroundColor, + border, + ...rest +}) => { + const [config, setConfig] = useState<{ hasFooter: boolean; hasContent: boolean }>({ + hasContent: false, + hasFooter: false, + }); + + /* eslint-disable @typescript-eslint/naming-convention */ + const classes = classnames('fieldEditor__flyoutPanel', className, { + 'fieldEditor__flyoutPanel--pageBackground': backgroundColor === 'euiPageBackground', + 'fieldEditor__flyoutPanel--emptyShade': backgroundColor === 'euiEmptyShade', + 'fieldEditor__flyoutPanel--leftBorder': border === 'left', + 'fieldEditor__flyoutPanel--rightBorder': border === 'right', + 'fieldEditor__flyoutPanel--withContent': config.hasContent, + }); + /* eslint-enable @typescript-eslint/naming-convention */ + + const { addPanel } = useFlyoutPanelsContext(); + + const registerContent = useCallback(() => { + setConfig((prev) => { + return { + ...prev, + hasContent: true, + }; + }); + }, []); + + const registerFooter = useCallback(() => { + setConfig((prev) => { + if (!prev.hasContent) { + throw new Error( + 'You need to add a when you add a ' + ); + } + return { + ...prev, + hasFooter: true, + }; + }); + }, []); + + useLayoutEffect(() => { + const removePanel = addPanel({ width }); + + return removePanel; + }, [width, addPanel]); + + const styles: CSSProperties = {}; + + if (width) { + styles.flexBasis = `${width}%`; + } + + return ( + + +
    + {children} +
    +
    +
    + ); +}; + +export const useFlyoutPanelContext = (): Context => { + const ctx = useContext(flyoutPanelContext); + + if (ctx === undefined) { + throw new Error('useFlyoutPanel() must be used within a '); + } + + return ctx; +}; diff --git a/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels.scss b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels.scss new file mode 100644 index 0000000000000..8ba2770003954 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels.scss @@ -0,0 +1,42 @@ +.fieldEditor__flyoutPanels { + height: 100%; +} + +.fieldEditor__flyoutPanel { + height: 100%; + overflow-y: auto; + padding: $euiSizeL $euiSizeL 0 $euiSizeL; + + &--pageBackground { + background-color: $euiPageBackgroundColor; + } + &--emptyShade { + background-color: $euiColorEmptyShade; + } + &--leftBorder { + border-left: $euiBorderThin; + } + &--rightBorder { + border-right: $euiBorderThin; + } + &--withContent { + padding: 0; + overflow-y: hidden; + display: flex; + flex-direction: column; + } + + &__header { + padding: 0 !important; + } + + &__content { + flex: 1; + overflow-y: auto; + padding: $euiSizeL; + } + + &__footer { + flex: 0; + } +} diff --git a/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels.tsx b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels.tsx new file mode 100644 index 0000000000000..c878090ec7c1b --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels.tsx @@ -0,0 +1,119 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { + useState, + createContext, + useContext, + useCallback, + useMemo, + useLayoutEffect, +} from 'react'; +import { EuiFlexGroup, EuiFlexGroupProps } from '@elastic/eui'; + +import './flyout_panels.scss'; + +interface Panel { + width?: number; +} + +interface Context { + addPanel: (panel: Panel) => () => void; +} + +let idx = 0; + +const panelId = () => idx++; + +const flyoutPanelsContext = createContext({ + addPanel() { + return () => {}; + }, +}); + +export interface Props { + /** + * The total max width with all the panels in the DOM + * Corresponds to the "maxWidth" prop passed to the EuiFlyout + */ + maxWidth: number; + /** The className selector of the flyout */ + flyoutClassName: string; + /** The size between the panels. Corresponds to EuiFlexGroup gutterSize */ + gutterSize?: EuiFlexGroupProps['gutterSize']; +} + +export const Panels: React.FC = ({ maxWidth, flyoutClassName, ...props }) => { + const flyoutDOMelement = useMemo(() => { + const el = document.getElementsByClassName(flyoutClassName); + + if (el.length === 0) { + // throw new Error(`Flyout with className "${flyoutClassName}" not found.`); + return null; + } + + return el.item(0) as HTMLDivElement; + }, [flyoutClassName]); + + const [panels, setPanels] = useState<{ [id: number]: Panel }>({}); + + const removePanel = useCallback((id: number) => { + setPanels((prev) => { + const { [id]: panelToRemove, ...rest } = prev; + return rest; + }); + }, []); + + const addPanel = useCallback( + (panel: Panel) => { + const nextId = panelId(); + setPanels((prev) => { + return { ...prev, [nextId]: panel }; + }); + return removePanel.bind(null, nextId); + }, + [removePanel] + ); + + const ctx: Context = useMemo( + () => ({ + addPanel, + }), + [addPanel] + ); + + useLayoutEffect(() => { + if (!flyoutDOMelement) { + return; + } + + const totalPercentWidth = Math.min( + 100, + Object.values(panels).reduce((acc, { width = 0 }) => acc + width, 0) + ); + const currentWidth = (maxWidth * totalPercentWidth) / 100; + + flyoutDOMelement.style.maxWidth = `${currentWidth}px`; + }, [panels, maxWidth, flyoutClassName, flyoutDOMelement]); + + return ( + + + + ); +}; + +export const useFlyoutPanelsContext = (): Context => { + const ctx = useContext(flyoutPanelsContext); + + if (ctx === undefined) { + throw new Error(' must be used within a wrapper'); + } + + return ctx; +}; diff --git a/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_content.tsx b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_content.tsx new file mode 100644 index 0000000000000..a25d4a03a83c8 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_content.tsx @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import React, { useEffect } from 'react'; + +import { useFlyoutPanelContext } from './flyout_panel'; + +export const PanelContent: React.FC = (props) => { + const { registerContent } = useFlyoutPanelContext(); + + useEffect(() => { + registerContent(); + }, [registerContent]); + + return
    ; +}; diff --git a/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_footer.tsx b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_footer.tsx new file mode 100644 index 0000000000000..8a987420dd84b --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_footer.tsx @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import React, { useEffect } from 'react'; +import { EuiFlyoutFooter, EuiFlyoutFooterProps } from '@elastic/eui'; + +import { useFlyoutPanelContext } from './flyout_panel'; + +export const PanelFooter: React.FC< + { children: React.ReactNode } & Omit +> = (props) => { + const { registerFooter } = useFlyoutPanelContext(); + + useEffect(() => { + registerFooter(); + }, [registerFooter]); + + return ; +}; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_header.tsx similarity index 53% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx rename to src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_header.tsx index ac10848500f63..00edf1c637fc1 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.test.tsx +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/flyout_panels_header.tsx @@ -7,13 +7,13 @@ */ import React from 'react'; -import { LoadingState } from '../loading_state'; -import { shallow } from 'enzyme'; +import { EuiSpacer, EuiFlyoutHeader, EuiFlyoutHeaderProps } from '@elastic/eui'; -describe('LoadingState', () => { - it('should render normally', () => { - const component = shallow(); - - expect(component).toMatchSnapshot(); - }); -}); +export const PanelHeader: React.FunctionComponent< + { children: React.ReactNode } & Omit +> = (props) => ( + <> + + + +); diff --git a/src/plugins/index_pattern_editor/public/components/flyout_panels/index.ts b/src/plugins/index_pattern_editor/public/components/flyout_panels/index.ts new file mode 100644 index 0000000000000..9fc9a7a916f56 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/flyout_panels/index.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 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 { PanelFooter } from './flyout_panels_footer'; +import { PanelHeader } from './flyout_panels_header'; +import { PanelContent } from './flyout_panels_content'; +import { Panel } from './flyout_panel'; +import { Panels } from './flyout_panels'; + +export const FlyoutPanels = { + Group: Panels, + Item: Panel, + Content: PanelContent, + Header: PanelHeader, + Footer: PanelFooter, +}; diff --git a/src/plugins/index_pattern_editor/public/components/footer/footer.tsx b/src/plugins/index_pattern_editor/public/components/footer/footer.tsx new file mode 100644 index 0000000000000..0c80d0e77534c --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/footer/footer.tsx @@ -0,0 +1,63 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { + EuiFlyoutFooter, + EuiFlexGroup, + EuiFlexItem, + EuiButtonEmpty, + EuiButton, +} from '@elastic/eui'; + +interface FooterProps { + onCancel: () => void; + onSubmit: () => void; + submitDisabled: boolean; +} + +const closeButtonLabel = i18n.translate('indexPatternEditor.editor.flyoutCloseButtonLabel', { + defaultMessage: 'Close', +}); + +const saveButtonLabel = i18n.translate('indexPatternEditor.editor.flyoutSaveButtonLabel', { + defaultMessage: 'Create index pattern', +}); + +export const Footer = ({ onCancel, onSubmit, submitDisabled }: FooterProps) => { + return ( + + + + + {closeButtonLabel} + + + + + + {saveButtonLabel} + + + + + ); +}; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/index.ts b/src/plugins/index_pattern_editor/public/components/footer/index.ts similarity index 91% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/index.ts rename to src/plugins/index_pattern_editor/public/components/footer/index.ts index 8f737b3a42613..e3103aab170e0 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/index.ts +++ b/src/plugins/index_pattern_editor/public/components/footer/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { Header } from './header'; +export { Footer } from './footer'; diff --git a/src/plugins/index_pattern_editor/public/components/form_fields/index.ts b/src/plugins/index_pattern_editor/public/components/form_fields/index.ts new file mode 100644 index 0000000000000..0d2091c065771 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/form_fields/index.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 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 { TimestampField } from './timestamp_field'; +export { TypeField } from './type_field'; +export { TitleField } from './title_field'; diff --git a/src/plugins/index_pattern_editor/public/components/form_fields/timestamp_field.tsx b/src/plugins/index_pattern_editor/public/components/form_fields/timestamp_field.tsx new file mode 100644 index 0000000000000..93cb39ea1ba33 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/form_fields/timestamp_field.tsx @@ -0,0 +1,157 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; + +import { EuiFormRow, EuiComboBox, EuiFormHelpText, EuiComboBoxOptionOption } from '@elastic/eui'; + +import { + UseField, + FieldConfig, + ValidationConfig, + getFieldValidityAndErrorMessage, +} from '../../shared_imports'; + +import { TimestampOption } from '../../types'; +import { schema } from '../form_schema'; + +interface Props { + options: TimestampOption[]; + isLoadingOptions: boolean; + isExistingIndexPattern: boolean; + isLoadingMatchedIndices: boolean; + hasMatchedIndices: boolean; +} + +const requireTimestampOptionValidator = (options: Props['options']): ValidationConfig => ({ + validator: async ({ value }) => { + const isValueRequired = !!options.length; + if (isValueRequired && !value) { + return { + message: i18n.translate( + 'indexPatternEditor.requireTimestampOption.ValidationErrorMessage', + { + defaultMessage: 'Select a timestamp field.', + } + ), + }; + } + }, +}); + +const getTimestampConfig = ( + options: Props['options'] +): FieldConfig> => { + const timestampFieldConfig = schema.timestampField; + + const validations = [ + ...timestampFieldConfig.validations, + // note this is responsible for triggering the state update for the selected source list. + requireTimestampOptionValidator(options), + ]; + + return { + ...timestampFieldConfig!, + validations, + }; +}; + +const noTimestampOptionText = i18n.translate('indexPatternEditor.editor.form.noTimeFieldsLabel', { + defaultMessage: 'No matching data stream, index, or alias has a timestamp field.', +}); + +const timestampFieldHelp = i18n.translate('indexPatternEditor.editor.form.timeFieldHelp', { + defaultMessage: 'Select a timestamp field for use with the global time filter.', +}); + +export const TimestampField = ({ + options = [], + isLoadingOptions = false, + isExistingIndexPattern, + isLoadingMatchedIndices, + hasMatchedIndices, +}: Props) => { + const optionsAsComboBoxOptions = options.map(({ display, fieldName }) => ({ + label: display, + value: fieldName, + })); + const timestampConfig = useMemo(() => getTimestampConfig(options), [options]); + const selectTimestampHelp = options.length ? timestampFieldHelp : ''; + + const timestampNoFieldsHelp = + options.length === 0 && + !isExistingIndexPattern && + !isLoadingMatchedIndices && + !isLoadingOptions && + hasMatchedIndices + ? noTimestampOptionText + : ''; + + return ( + > config={timestampConfig} path="timestampField"> + {(field) => { + const { label, value, setValue } = field; + + if (value === undefined) { + return null; + } + + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + const isDisabled = !optionsAsComboBoxOptions.length; + + return ( + <> + + <> + + placeholder={i18n.translate( + 'indexPatternEditor.editor.form.runtimeType.placeholderLabel', + { + defaultMessage: 'Select a timestamp field', + } + )} + singleSelection={{ asPlainText: true }} + options={optionsAsComboBoxOptions} + selectedOptions={value ? [value] : undefined} + onChange={(newValue) => { + if (newValue.length === 0) { + // Don't allow clearing the type. One must always be selected + return; + } + // + setValue(newValue[0]); + }} + isClearable={false} + isDisabled={isDisabled} + data-test-subj="timestampField" + aria-label={i18n.translate( + 'indexPatternEditor.editor.form.timestampSelectAriaLabel', + { + defaultMessage: 'Timestamp field', + } + )} + isLoading={isLoadingOptions} + fullWidth + /> + + {timestampNoFieldsHelp || selectTimestampHelp || <> } + + + + + ); + }} + + ); +}; diff --git a/src/plugins/index_pattern_editor/public/components/form_fields/title_field.tsx b/src/plugins/index_pattern_editor/public/components/form_fields/title_field.tsx new file mode 100644 index 0000000000000..aa16351e0922f --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/form_fields/title_field.tsx @@ -0,0 +1,232 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { ChangeEvent, useState, useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFormRow, EuiFieldText } from '@elastic/eui'; +import { + UseField, + getFieldValidityAndErrorMessage, + ValidationConfig, + FieldConfig, +} from '../../shared_imports'; +import { canAppendWildcard } from '../../lib'; +import { schema } from '../form_schema'; +import { + MatchedItem, + RollupIndicesCapsResponse, + IndexPatternConfig, + MatchedIndicesSet, +} from '../../types'; + +interface RefreshMatchedIndicesResult { + matchedIndicesResult: MatchedIndicesSet; + newRollupIndexName?: string; +} + +interface TitleFieldProps { + existingIndexPatterns: string[]; + isRollup: boolean; + matchedIndices: MatchedItem[]; + rollupIndicesCapabilities: RollupIndicesCapsResponse; + refreshMatchedIndices: (title: string) => Promise; +} + +const rollupIndexPatternNoMatchError = { + message: i18n.translate('indexPatternEditor.rollupIndexPattern.createIndex.noMatchError', { + defaultMessage: 'Rollup index pattern error: must match one rollup index', + }), +}; + +const rollupIndexPatternTooManyMatchesError = { + message: i18n.translate('indexPatternEditor.rollupIndexPattern.createIndex.tooManyMatchesError', { + defaultMessage: 'Rollup index pattern error: can only match one rollup index', + }), +}; + +const mustMatchError = { + message: i18n.translate('indexPatternEditor.createIndex.noMatch', { + defaultMessage: 'Name must match one or more data streams, indices, or aliases.', + }), +}; + +const createTitlesNoDupesValidator = ( + namesNotAllowed: string[] +): ValidationConfig<{}, string, string> => ({ + validator: ({ value }) => { + if (namesNotAllowed.includes(value)) { + return { + message: i18n.translate('indexPatternEditor.indexPatternExists.ValidationErrorMessage', { + defaultMessage: 'An index pattern with this title already exists.', + }), + }; + } + }, +}); + +interface MatchesValidatorArgs { + rollupIndicesCapabilities: Record; + refreshMatchedIndices: (title: string) => Promise; + isRollup: boolean; +} + +const createMatchesIndicesValidator = ({ + rollupIndicesCapabilities, + refreshMatchedIndices, + isRollup, +}: MatchesValidatorArgs): ValidationConfig<{}, string, string> => ({ + validator: async ({ value }) => { + const { matchedIndicesResult, newRollupIndexName } = await refreshMatchedIndices(value); + const rollupIndices = Object.keys(rollupIndicesCapabilities); + + if (matchedIndicesResult.exactMatchedIndices.length === 0) { + return mustMatchError; + } + + if (!isRollup || !rollupIndices || !rollupIndices.length) { + return; + } + + // A rollup index pattern needs to match one and only one rollup index. + const rollupIndexMatches = matchedIndicesResult.exactMatchedIndices.filter((matchedIndex) => + rollupIndices.includes(matchedIndex.name) + ); + + if (!rollupIndexMatches.length) { + return rollupIndexPatternNoMatchError; + } else if (rollupIndexMatches.length > 1) { + return rollupIndexPatternTooManyMatchesError; + } + + // Error info is potentially provided via the rollup indices caps request + const error = newRollupIndexName && rollupIndicesCapabilities[newRollupIndexName].error; + + if (error) { + return { + message: i18n.translate('indexPatternEditor.rollup.uncaughtError', { + defaultMessage: 'Rollup index pattern error: {error}', + values: { + error, + }, + }), + }; + } + }, +}); + +interface GetTitleConfigArgs { + namesNotAllowed: string[]; + isRollup: boolean; + matchedIndices: MatchedItem[]; + rollupIndicesCapabilities: RollupIndicesCapsResponse; + refreshMatchedIndices: (title: string) => Promise; +} + +const getTitleConfig = ({ + namesNotAllowed, + isRollup, + rollupIndicesCapabilities, + refreshMatchedIndices, +}: GetTitleConfigArgs): FieldConfig => { + const titleFieldConfig = schema.title; + + const validations = [ + ...titleFieldConfig.validations, + // note this is responsible for triggering the state update for the selected source list. + createMatchesIndicesValidator({ + rollupIndicesCapabilities, + refreshMatchedIndices, + isRollup, + }), + createTitlesNoDupesValidator(namesNotAllowed), + ]; + + return { + ...titleFieldConfig!, + validations, + }; +}; + +export const TitleField = ({ + existingIndexPatterns, + isRollup, + matchedIndices, + rollupIndicesCapabilities, + refreshMatchedIndices, +}: TitleFieldProps) => { + const [appendedWildcard, setAppendedWildcard] = useState(false); + + const fieldConfig = useMemo( + () => + getTitleConfig({ + namesNotAllowed: existingIndexPatterns, + isRollup, + matchedIndices, + rollupIndicesCapabilities, + refreshMatchedIndices, + }), + [ + existingIndexPatterns, + isRollup, + matchedIndices, + rollupIndicesCapabilities, + refreshMatchedIndices, + ] + ); + + return ( + + path="title" + config={fieldConfig} + componentProps={{ + euiFieldProps: { + 'aria-label': i18n.translate('indexPatternEditor.form.titleAriaLabel', { + defaultMessage: 'Title field', + }), + }, + }} + > + {(field) => { + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + return ( + + ) => { + e.persist(); + let query = e.target.value; + if (query.length === 1 && !appendedWildcard && canAppendWildcard(query)) { + query += '*'; + setAppendedWildcard(true); + setTimeout(() => e.target.setSelectionRange(1, 1)); + } else { + if (['', '*'].includes(query) && appendedWildcard) { + query = ''; + setAppendedWildcard(false); + } + } + field.setValue(query); + }} + isLoading={field.isValidating} + fullWidth + data-test-subj="createIndexPatternNameInput" + /> + + ); + }} + + ); +}; diff --git a/src/plugins/index_pattern_editor/public/components/form_fields/type_field.tsx b/src/plugins/index_pattern_editor/public/components/form_fields/type_field.tsx new file mode 100644 index 0000000000000..606197159e53c --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/form_fields/type_field.tsx @@ -0,0 +1,114 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +// @ts-ignore +import { euiColorAccent } from '@elastic/eui/dist/eui_theme_light.json'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { + EuiFormRow, + EuiSuperSelect, + EuiDescriptionList, + EuiDescriptionListTitle, + EuiDescriptionListDescription, + EuiBadge, +} from '@elastic/eui'; + +import { UseField } from '../../shared_imports'; + +import { INDEX_PATTERN_TYPE, IndexPatternConfig } from '../../types'; + +interface TypeFieldProps { + onChange: (type: INDEX_PATTERN_TYPE) => void; +} + +const standardSelectItem = ( + + + + + + + + +); + +const rollupSelectItem = ( + + + +   + + + + + + + + +); + +export const TypeField = ({ onChange }: TypeFieldProps) => { + return ( + path="type"> + {({ label, value, setValue }) => { + if (value === undefined) { + return null; + } + return ( + <> + + { + setValue(newValue); + onChange(newValue); + }} + aria-label={i18n.translate('indexPatternEditor.editor.form.typeSelectAriaLabel', { + defaultMessage: 'Type field', + })} + fullWidth + /> + + + ); + }} + + ); +}; diff --git a/src/plugins/index_pattern_editor/public/components/form_schema.ts b/src/plugins/index_pattern_editor/public/components/form_schema.ts new file mode 100644 index 0000000000000..4e852285031ca --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/form_schema.ts @@ -0,0 +1,63 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { fieldValidators } from '../shared_imports'; +import { INDEX_PATTERN_TYPE } from '../types'; + +export const schema = { + title: { + label: i18n.translate('indexPatternEditor.editor.form.titleLabel', { + defaultMessage: 'Name', + }), + defaultValue: '', + helpText: i18n.translate('indexPatternEditor.validations.titleHelpText', { + defaultMessage: + 'Use an asterisk (*) to match multiple indices. Spaces and the characters , /, ?, ", <, >, | are not allowed.', + }), + validations: [ + { + validator: fieldValidators.emptyField( + i18n.translate('indexPatternEditor.validations.titleIsRequiredErrorMessage', { + defaultMessage: 'A name is required.', + }) + ), + }, + ], + }, + timestampField: { + label: i18n.translate('indexPatternEditor.editor.form.timeFieldLabel', { + defaultMessage: 'Timestamp field', + }), + helpText: i18n.translate('indexPatternEditor.editor.form.timestampFieldHelp', { + defaultMessage: 'Select a timestamp field for use with the global time filter.', + }), + validations: [], + }, + allowHidden: { + label: i18n.translate('indexPatternEditor.editor.form.allowHiddenLabel', { + defaultMessage: 'Allow hidden and system indices', + }), + defaultValue: false, + }, + id: { + label: i18n.translate('indexPatternEditor.editor.form.customIdLabel', { + defaultMessage: 'Custom index pattern ID', + }), + helpText: i18n.translate('indexPatternEditor.editor.form.customIdHelp', { + defaultMessage: + 'Kibana provides a unique identifier for each index pattern, or you can create your own.', + }), + }, + type: { + label: i18n.translate('indexPatternEditor.editor.form.TypeLabel', { + defaultMessage: 'Index pattern type', + }), + defaultValue: INDEX_PATTERN_TYPE.DEFAULT, + }, +}; diff --git a/src/plugins/index_pattern_editor/public/components/i18n_texts.ts b/src/plugins/index_pattern_editor/public/components/i18n_texts.ts new file mode 100644 index 0000000000000..5745714ae7bd8 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/i18n_texts.ts @@ -0,0 +1,26 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +export const geti18nTexts = () => { + return { + noTimestampOptionText: i18n.translate( + 'indexPatternEditor.createIndexPattern.stepTime.noTimeFieldsLabel', + { + defaultMessage: 'No matching data stream, index, or alias has a timestamp field.', + } + ), + timestampFieldHelp: i18n.translate('indexPatternEditor.editor.form.timeFieldHelp', { + defaultMessage: 'Select a timestamp field for use with the global time filter.', + }), + rollupLabel: i18n.translate('indexPatternEditor.rollupIndexPattern.createIndex.indexLabel', { + defaultMessage: 'Rollup', + }), + }; +}; diff --git a/src/plugins/index_pattern_editor/public/components/index.ts b/src/plugins/index_pattern_editor/public/components/index.ts new file mode 100644 index 0000000000000..82da708ac859d --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/index.ts @@ -0,0 +1,24 @@ +/* + * 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 { + IndexPatternEditorFlyoutContent, + Props as IndexPatternEditorFlyoutContentProps, +} from './index_pattern_editor_flyout_content'; + +export { IndexPatternEditor } from './index_pattern_editor'; + +export { schema } from './form_schema'; +export { TimestampField, TypeField, TitleField } from './form_fields'; +export { EmptyPrompts } from './empty_prompts'; +export { PreviewPanel } from './preview_panel'; +export { LoadingIndices } from './loading_indices'; +export { geti18nTexts } from './i18n_texts'; +export { Footer } from './footer'; +export { AdvancedParamsContent } from './advanced_params_content'; +export { RollupBetaWarning } from './rollup_beta_warning'; diff --git a/src/plugins/index_pattern_editor/public/components/index_pattern_editor.scss b/src/plugins/index_pattern_editor/public/components/index_pattern_editor.scss new file mode 100644 index 0000000000000..5b3a30effc767 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/index_pattern_editor.scss @@ -0,0 +1,13 @@ +.indexPatternEditor__form { + flex-grow: 1; +} + +.fieldEditor__mainFlyoutPanel { + display: flex; + flex-direction: column; +} + +.indexPatternEditor__footer { + margin-left: -$euiSizeL; + margin-right: -$euiSizeL; +} diff --git a/src/plugins/index_pattern_editor/public/components/index_pattern_editor.tsx b/src/plugins/index_pattern_editor/public/components/index_pattern_editor.tsx new file mode 100644 index 0000000000000..bc0b6156a7844 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/index_pattern_editor.tsx @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { EuiFlyout } from '@elastic/eui'; +import { IndexPatternEditorLazy } from './index_pattern_editor_lazy'; +import { IndexPatternEditorContext, IndexPatternEditorProps } from '../types'; +import { createKibanaReactContext } from '../shared_imports'; +import './index_pattern_editor.scss'; + +export interface IndexPatternEditorPropsWithServices extends IndexPatternEditorProps { + services: IndexPatternEditorContext; +} + +export const IndexPatternEditor = ({ + onSave, + onCancel = () => {}, + services, + defaultTypeIsRollup = false, + requireTimestampField = false, +}: IndexPatternEditorPropsWithServices) => { + const { + Provider: KibanaReactContextProvider, + } = createKibanaReactContext(services); + + return ( + + {}} hideCloseButton={true} size="l"> + + + + ); +}; diff --git a/src/plugins/index_pattern_editor/public/components/index_pattern_editor_flyout_content.tsx b/src/plugins/index_pattern_editor/public/components/index_pattern_editor_flyout_content.tsx new file mode 100644 index 0000000000000..cabff9bfb009b --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/index_pattern_editor_flyout_content.tsx @@ -0,0 +1,379 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useState, useEffect, useCallback, useRef } from 'react'; +import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiLoadingSpinner } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +import { + IndexPatternSpec, + Form, + useForm, + useFormData, + useKibana, + GetFieldsOptions, +} from '../shared_imports'; + +import { ensureMinimumTime, getIndices, extractTimeFields, getMatchedIndices } from '../lib'; +import { FlyoutPanels } from './flyout_panels'; + +import { + MatchedItem, + IndexPatternEditorContext, + RollupIndicesCapsResponse, + INDEX_PATTERN_TYPE, + IndexPatternConfig, + MatchedIndicesSet, + FormInternal, + TimestampOption, +} from '../types'; + +import { + TimestampField, + TypeField, + TitleField, + schema, + Footer, + AdvancedParamsContent, + EmptyPrompts, + PreviewPanel, + RollupBetaWarning, +} from '.'; + +export interface Props { + /** + * Handler for the "save" footer button + */ + onSave: (indexPatternSpec: IndexPatternSpec) => void; + /** + * Handler for the "cancel" footer button + */ + onCancel: () => void; + defaultTypeIsRollup?: boolean; + requireTimestampField?: boolean; +} + +const editorTitle = i18n.translate('indexPatternEditor.title', { + defaultMessage: 'Create index pattern', +}); + +const IndexPatternEditorFlyoutContentComponent = ({ + onSave, + onCancel, + defaultTypeIsRollup, + requireTimestampField = false, +}: Props) => { + const isMounted = useRef(false); + const { + services: { http, indexPatternService, uiSettings }, + } = useKibana(); + + const { form } = useForm({ + defaultValue: { + type: defaultTypeIsRollup ? INDEX_PATTERN_TYPE.ROLLUP : INDEX_PATTERN_TYPE.DEFAULT, + }, + schema, + onSubmit: async (formData, isValid) => { + if (!isValid) { + return; + } + + const indexPatternStub: IndexPatternSpec = { + title: formData.title, + timeFieldName: formData.timestampField?.value, + id: formData.id, + }; + + if (type === INDEX_PATTERN_TYPE.ROLLUP && rollupIndex) { + indexPatternStub.type = INDEX_PATTERN_TYPE.ROLLUP; + indexPatternStub.typeMeta = { + params: { + rollup_index: rollupIndex, + }, + aggs: rollupIndicesCapabilities[rollupIndex].aggs, + }; + } + + await onSave(indexPatternStub); + }, + }); + + const { getFields } = form; + + const [{ title, allowHidden, type }] = useFormData({ form }); + const [isLoadingSources, setIsLoadingSources] = useState(true); + + const [timestampFieldOptions, setTimestampFieldOptions] = useState([]); + const [isLoadingTimestampFields, setIsLoadingTimestampFields] = useState(false); + const [isLoadingMatchedIndices, setIsLoadingMatchedIndices] = useState(false); + const [allSources, setAllSources] = useState([]); + const [isLoadingIndexPatterns, setIsLoadingIndexPatterns] = useState(true); + const [existingIndexPatterns, setExistingIndexPatterns] = useState([]); + const [rollupIndex, setRollupIndex] = useState(); + const [ + rollupIndicesCapabilities, + setRollupIndicesCapabilities, + ] = useState({}); + const [matchedIndices, setMatchedIndices] = useState({ + allIndices: [], + exactMatchedIndices: [], + partialMatchedIndices: [], + visibleIndices: [], + }); + + // load all data sources and set initial matchedIndices + const loadSources = useCallback(() => { + getIndices(http, () => false, '*', allowHidden).then((dataSources) => { + setAllSources(dataSources); + const matchedSet = getMatchedIndices(dataSources, [], [], allowHidden); + setMatchedIndices(matchedSet); + setIsLoadingSources(false); + }); + }, [http, allowHidden]); + + // loading list of index patterns + useEffect(() => { + isMounted.current = true; + loadSources(); + const getTitles = async () => { + const indexPatternTitles = await indexPatternService.getTitles(); + if (isMounted.current) { + setExistingIndexPatterns(indexPatternTitles); + setIsLoadingIndexPatterns(false); + } + }; + getTitles(); + return () => { + isMounted.current = false; + }; + }, [http, indexPatternService, loadSources]); + + // loading rollup info + useEffect(() => { + const getRollups = async () => { + try { + const response = await http.get('/api/rollup/indices'); + if (isMounted.current) { + setRollupIndicesCapabilities(response || {}); + } + } catch (e) { + // Silently swallow failure responses such as expired trials + } + }; + + getRollups(); + }, [http, type]); + + const getRollupIndices = (rollupCaps: RollupIndicesCapsResponse) => Object.keys(rollupCaps); + + const loadTimestampFieldOptions = useCallback( + async (query: string) => { + let timestampOptions: TimestampOption[] = []; + const isValidResult = + !existingIndexPatterns.includes(query) && matchedIndices.exactMatchedIndices.length > 0; + if (isValidResult) { + setIsLoadingTimestampFields(true); + const getFieldsOptions: GetFieldsOptions = { + pattern: query, + }; + if (type === INDEX_PATTERN_TYPE.ROLLUP) { + getFieldsOptions.type = INDEX_PATTERN_TYPE.ROLLUP; + getFieldsOptions.rollupIndex = rollupIndex; + } + + const fields = await ensureMinimumTime( + indexPatternService.getFieldsForWildcard(getFieldsOptions) + ); + timestampOptions = extractTimeFields(fields, requireTimestampField); + } + if (isMounted.current) { + setIsLoadingTimestampFields(false); + setTimestampFieldOptions(timestampOptions); + } + return timestampOptions; + }, + [ + existingIndexPatterns, + indexPatternService, + requireTimestampField, + rollupIndex, + type, + matchedIndices.exactMatchedIndices, + ] + ); + + useEffect(() => { + loadTimestampFieldOptions(title); + getFields().timestampField?.setValue(''); + }, [matchedIndices, loadTimestampFieldOptions, title, getFields]); + + const reloadMatchedIndices = useCallback( + async (newTitle: string) => { + const isRollupIndex = (indexName: string) => + getRollupIndices(rollupIndicesCapabilities).includes(indexName); + let newRollupIndexName: string | undefined; + + const fetchIndices = async (query: string = '') => { + setIsLoadingMatchedIndices(true); + const indexRequests = []; + + if (query?.endsWith('*')) { + const exactMatchedQuery = getIndices(http, isRollupIndex, query, allowHidden); + indexRequests.push(exactMatchedQuery); + // provide default value when not making a request for the partialMatchQuery + indexRequests.push(Promise.resolve([])); + } else { + const exactMatchQuery = getIndices(http, isRollupIndex, query, allowHidden); + const partialMatchQuery = getIndices(http, isRollupIndex, `${query}*`, allowHidden); + + indexRequests.push(exactMatchQuery); + indexRequests.push(partialMatchQuery); + } + + const [exactMatched, partialMatched] = (await ensureMinimumTime( + indexRequests + )) as MatchedItem[][]; + + const matchedIndicesResult = getMatchedIndices( + allSources, + partialMatched, + exactMatched, + allowHidden + ); + + if (isMounted.current) { + if (type === INDEX_PATTERN_TYPE.ROLLUP) { + const rollupIndices = exactMatched.filter((index) => isRollupIndex(index.name)); + newRollupIndexName = rollupIndices.length === 1 ? rollupIndices[0].name : undefined; + setRollupIndex(newRollupIndexName); + } else { + setRollupIndex(undefined); + } + + setMatchedIndices(matchedIndicesResult); + setIsLoadingMatchedIndices(false); + } + + return { matchedIndicesResult, newRollupIndexName }; + }; + + return fetchIndices(newTitle); + }, + [http, allowHidden, allSources, type, rollupIndicesCapabilities] + ); + + useEffect(() => { + reloadMatchedIndices(title); + }, [allowHidden, reloadMatchedIndices, title]); + + const onTypeChange = useCallback( + (newType) => { + form.setFieldValue('title', ''); + form.setFieldValue('timestampField', ''); + if (newType === INDEX_PATTERN_TYPE.ROLLUP) { + form.setFieldValue('allowHidden', false); + } + }, + [form] + ); + + if (isLoadingSources || isLoadingIndexPatterns) { + return ; + } + + const showIndexPatternTypeSelect = () => + uiSettings.isDeclared('rollups:enableIndexPatterns') && + uiSettings.get('rollups:enableIndexPatterns') && + getRollupIndices(rollupIndicesCapabilities).length; + + const indexPatternTypeSelect = showIndexPatternTypeSelect() ? ( + <> + + + + + + + {type === INDEX_PATTERN_TYPE.ROLLUP ? ( + + + + + + ) : ( + <> + )} + + ) : ( + <> + ); + + return ( + + + + +

    {editorTitle}

    +
    +
    + {indexPatternTypeSelect} + + + + + + + + + + + + + + +
    form.submit()} + submitDisabled={form.isSubmitted && !form.isValid} + /> + + + {isLoadingSources ? ( + <> + ) : ( + + )} + + + + ); +}; + +export const IndexPatternEditorFlyoutContent = React.memo(IndexPatternEditorFlyoutContentComponent); diff --git a/src/plugins/index_pattern_editor/public/components/index_pattern_editor_lazy.tsx b/src/plugins/index_pattern_editor/public/components/index_pattern_editor_lazy.tsx new file mode 100644 index 0000000000000..4241f042af0d5 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/index_pattern_editor_lazy.tsx @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { lazy, Suspense } from 'react'; +import { EuiLoadingSpinner } from '@elastic/eui'; + +import { IndexPatternEditorProps } from '../types'; + +const IndexPatternFlyoutContentContainer = lazy( + () => import('./index_pattern_flyout_content_container') +); + +export const IndexPatternEditorLazy = (props: IndexPatternEditorProps) => ( + }> + + +); diff --git a/src/plugins/index_pattern_editor/public/components/index_pattern_flyout_content_container.tsx b/src/plugins/index_pattern_editor/public/components/index_pattern_flyout_content_container.tsx new file mode 100644 index 0000000000000..2f60d85677207 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/index_pattern_flyout_content_container.tsx @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { IndexPatternSpec, useKibana } from '../shared_imports'; +import { IndexPatternEditorFlyoutContent } from './index_pattern_editor_flyout_content'; +import { IndexPatternEditorContext, IndexPatternEditorProps } from '../types'; + +const IndexPatternFlyoutContentContainer = ({ + onSave, + onCancel = () => {}, + defaultTypeIsRollup, + requireTimestampField = false, +}: IndexPatternEditorProps) => { + const { + services: { indexPatternService, notifications }, + } = useKibana(); + + const onSaveClick = async (indexPatternSpec: IndexPatternSpec) => { + try { + const indexPattern = await indexPatternService.createAndSave(indexPatternSpec); + + const message = i18n.translate('indexPatternEditor.saved', { + defaultMessage: "Saved '{indexPatternTitle}'", + values: { indexPatternTitle: indexPattern.title }, + }); + notifications.toasts.addSuccess(message); + await onSave(indexPattern); + } catch (e) { + const title = i18n.translate('indexPatternEditor.indexPatterns.unableSaveLabel', { + defaultMessage: 'Failed to save index pattern.', + }); + + notifications.toasts.addDanger({ title }); + } + }; + + return ( + + ); +}; + +/* eslint-disable import/no-default-export */ +export default IndexPatternFlyoutContentContainer; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap b/src/plugins/index_pattern_editor/public/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap similarity index 88% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap rename to src/plugins/index_pattern_editor/public/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap index a5517f6d4b616..8c62657c7859e 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap +++ b/src/plugins/index_pattern_editor/public/components/loading_indices/__snapshots__/loading_indices.test.tsx.snap @@ -18,7 +18,7 @@ exports[`LoadingIndices should render normally 1`] = ` > diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts b/src/plugins/index_pattern_editor/public/components/loading_indices/index.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/index.ts rename to src/plugins/index_pattern_editor/public/components/loading_indices/index.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx b/src/plugins/index_pattern_editor/public/components/loading_indices/loading_indices.test.tsx similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.test.tsx rename to src/plugins/index_pattern_editor/public/components/loading_indices/loading_indices.test.tsx diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx b/src/plugins/index_pattern_editor/public/components/loading_indices/loading_indices.tsx similarity index 93% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx rename to src/plugins/index_pattern_editor/public/components/loading_indices/loading_indices.tsx index eb17027c63a3d..14ae51567938d 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.tsx +++ b/src/plugins/index_pattern_editor/public/components/loading_indices/loading_indices.tsx @@ -24,7 +24,7 @@ export const LoadingIndices = ({ ...rest }) => (

    diff --git a/src/plugins/index_pattern_management/public/components/create_button/index.ts b/src/plugins/index_pattern_editor/public/components/preview_panel/index.ts similarity index 88% rename from src/plugins/index_pattern_management/public/components/create_button/index.ts rename to src/plugins/index_pattern_editor/public/components/preview_panel/index.ts index 497096d2fb7bc..c677d9878f183 100644 --- a/src/plugins/index_pattern_management/public/components/create_button/index.ts +++ b/src/plugins/index_pattern_editor/public/components/preview_panel/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { CreateButton } from './create_button'; +export { PreviewPanel } from './preview_panel'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap b/src/plugins/index_pattern_editor/public/components/preview_panel/indices_list/__snapshots__/indices_list.test.tsx.snap similarity index 97% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap rename to src/plugins/index_pattern_editor/public/components/preview_panel/indices_list/__snapshots__/indices_list.test.tsx.snap index ca41dddf6197e..74d803a6ff176 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/indices_list/__snapshots__/indices_list.test.tsx.snap +++ b/src/plugins/index_pattern_editor/public/components/preview_panel/indices_list/__snapshots__/indices_list.test.tsx.snap @@ -47,7 +47,7 @@ exports[`IndicesList should change pages 1`] = ` > { pager: Pager; constructor(props: IndicesListProps) { @@ -96,7 +97,7 @@ export class IndicesList extends React.Component diff --git a/src/plugins/index_pattern_editor/public/components/preview_panel/preview_panel.tsx b/src/plugins/index_pattern_editor/public/components/preview_panel/preview_panel.tsx new file mode 100644 index 0000000000000..28413debdb2a9 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/preview_panel/preview_panel.tsx @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { EuiSpacer } from '@elastic/eui'; +import { StatusMessage } from './status_message'; +import { IndicesList } from './indices_list'; + +import { INDEX_PATTERN_TYPE, MatchedIndicesSet } from '../../types'; + +interface Props { + type: INDEX_PATTERN_TYPE; + allowHidden: boolean; + title: string; + matched: MatchedIndicesSet; +} + +export const PreviewPanel = ({ type, allowHidden, title = '', matched }: Props) => { + const indicesListContent = + matched.visibleIndices.length || matched.allIndices.length ? ( + <> + + + + ) : ( + <> + ); + + return ( + <> + + {indicesListContent} + + ); +}; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/__snapshots__/status_message.test.tsx.snap similarity index 66% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap rename to src/plugins/index_pattern_editor/public/components/preview_panel/status_message/__snapshots__/status_message.test.tsx.snap index 44b753c473803..8b492be417bff 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/__snapshots__/status_message.test.tsx.snap +++ b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/__snapshots__/status_message.test.tsx.snap @@ -11,7 +11,7 @@ exports[`StatusMessage should render with exact matches 1`] = `   @@ -134,7 +133,7 @@ exports[`StatusMessage should show that system indices exist 1`] = ` diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/index.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/index.ts rename to src/plugins/index_pattern_editor/public/components/preview_panel/status_message/index.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/status_message.test.tsx similarity index 96% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx rename to src/plugins/index_pattern_editor/public/components/preview_panel/status_message/status_message.test.tsx index 6201440d5e7ff..1bae9bdf3c666 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.test.tsx +++ b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/status_message.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { StatusMessage } from '../status_message'; import { shallow } from 'enzyme'; -import { MatchedItem } from '../../../../types'; +import { MatchedItem } from '../../../types'; const tagsPartial = { tags: [], @@ -22,6 +22,7 @@ const matchedIndices = { ] as unknown) as MatchedItem[], exactMatchedIndices: [] as MatchedItem[], partialMatchedIndices: ([{ name: 'kibana', ...tagsPartial }] as unknown) as MatchedItem[], + visibleIndices: [], }; describe('StatusMessage', () => { @@ -94,6 +95,7 @@ describe('StatusMessage', () => { allIndices: [], exactMatchedIndices: [], partialMatchedIndices: [], + visibleIndices: [], }} isIncludingSystemIndices={false} query={''} @@ -111,6 +113,7 @@ describe('StatusMessage', () => { allIndices: [], exactMatchedIndices: [], partialMatchedIndices: [], + visibleIndices: [], }} isIncludingSystemIndices={true} query={''} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/status_message.tsx similarity index 58% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx rename to src/plugins/index_pattern_editor/public/components/preview_panel/status_message/status_message.tsx index 0ab41ed1a5be4..871ed79c27de5 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/status_message/status_message.tsx +++ b/src/plugins/index_pattern_editor/public/components/preview_panel/status_message/status_message.tsx @@ -12,19 +12,48 @@ import { EuiCallOut } from '@elastic/eui'; import { EuiIconType } from '@elastic/eui/src/components/icon/icon'; import { FormattedMessage } from '@kbn/i18n/react'; -import { MatchedItem } from '../../../../types'; +import { MatchedIndicesSet } from '../../../types'; interface StatusMessageProps { - matchedIndices: { - allIndices: MatchedItem[]; - exactMatchedIndices: MatchedItem[]; - partialMatchedIndices: MatchedItem[]; - }; + matchedIndices: MatchedIndicesSet; isIncludingSystemIndices: boolean; query: string; showSystemIndices: boolean; } +const NoMatchStatusMessage = (allIndicesLength: number) => ( + + + + + ), + }} + /> + +); + +const NoMatchNoIndicesStatusMessage = () => ( + + + +); + export const StatusMessage: React.FC = ({ matchedIndices: { allIndices = [], exactMatchedIndices = [], partialMatchedIndices = [] }, isIncludingSystemIndices, @@ -45,10 +74,10 @@ export const StatusMessage: React.FC = ({ statusMessage = ( @@ -58,8 +87,8 @@ export const StatusMessage: React.FC = ({ statusMessage = ( ); @@ -67,7 +96,7 @@ export const StatusMessage: React.FC = ({ statusMessage = ( @@ -80,7 +109,7 @@ export const StatusMessage: React.FC = ({   @@ -124,33 +153,9 @@ export const StatusMessage: React.FC = ({ } else { statusIcon = undefined; statusColor = 'warning'; - statusMessage = ( - - - - - ), - indicesLength: allIndicesLength, - }} - /> - - ); + statusMessage = allIndicesLength + ? NoMatchStatusMessage(allIndicesLength) + : NoMatchNoIndicesStatusMessage(); } return ( diff --git a/src/plugins/index_pattern_editor/public/components/rollup_beta_warning/index.ts b/src/plugins/index_pattern_editor/public/components/rollup_beta_warning/index.ts new file mode 100644 index 0000000000000..4c72c12312855 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/rollup_beta_warning/index.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 { RollupBetaWarning } from './rollup_beta_warning'; diff --git a/src/plugins/index_pattern_editor/public/components/rollup_beta_warning/rollup_beta_warning.tsx b/src/plugins/index_pattern_editor/public/components/rollup_beta_warning/rollup_beta_warning.tsx new file mode 100644 index 0000000000000..fcd61bab07d4c --- /dev/null +++ b/src/plugins/index_pattern_editor/public/components/rollup_beta_warning/rollup_beta_warning.tsx @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { EuiCallOut } from '@elastic/eui'; + +const rollupBetaWarningTitle = i18n.translate( + 'indexPatternEditor.rollupIndexPattern.warning.title', + { + defaultMessage: 'Beta feature', + } +); + +export const RollupBetaWarning = () => ( + +

    + +

    +

    + +

    +
    +); diff --git a/src/plugins/index_pattern_editor/public/constants.ts b/src/plugins/index_pattern_editor/public/constants.ts new file mode 100644 index 0000000000000..ff74e0827fa50 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/constants.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 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 pluginName = 'index_pattern_editor'; +export const MAX_NUMBER_OF_MATCHING_INDICES = 100; +export const CONFIG_ROLLUPS = 'rollups:enableIndexPatterns'; diff --git a/src/plugins/index_pattern_editor/public/index.ts b/src/plugins/index_pattern_editor/public/index.ts new file mode 100644 index 0000000000000..76c184f9399f1 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/index.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * Management Plugin - public + * + * This is the entry point for the entire client-side public contract of the plugin. + * If something is not explicitly exported here, you can safely assume it is private + * to the plugin and not considered stable. + * + * All stateful contracts will be injected by the platform at runtime, and are defined + * in the setup/start interfaces in `plugin.ts`. The remaining items exported here are + * either types, or static code. + */ + +import { IndexPatternEditorPlugin } from './plugin'; + +export type { PluginStart as IndexPatternEditorStart, IndexPatternEditorProps } from './types'; + +export function plugin() { + return new IndexPatternEditorPlugin(); +} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/__snapshots__/get_indices.test.ts.snap b/src/plugins/index_pattern_editor/public/lib/__snapshots__/get_indices.test.ts.snap similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/__snapshots__/get_indices.test.ts.snap rename to src/plugins/index_pattern_editor/public/lib/__snapshots__/get_indices.test.ts.snap diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.test.ts b/src/plugins/index_pattern_editor/public/lib/can_append_wildcard.test.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.test.ts rename to src/plugins/index_pattern_editor/public/lib/can_append_wildcard.test.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.ts b/src/plugins/index_pattern_editor/public/lib/can_append_wildcard.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/can_append_wildcard.ts rename to src/plugins/index_pattern_editor/public/lib/can_append_wildcard.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_illegal_characters.ts b/src/plugins/index_pattern_editor/public/lib/contains_illegal_characters.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_illegal_characters.ts rename to src/plugins/index_pattern_editor/public/lib/contains_illegal_characters.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts b/src/plugins/index_pattern_editor/public/lib/contains_invalid_characters.test.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/contains_invalid_characters.test.ts rename to src/plugins/index_pattern_editor/public/lib/contains_invalid_characters.test.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts b/src/plugins/index_pattern_editor/public/lib/ensure_minimum_time.test.ts similarity index 79% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts rename to src/plugins/index_pattern_editor/public/lib/ensure_minimum_time.test.ts index 1bda1b9b5394c..6fb80df3f8932 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.test.ts +++ b/src/plugins/index_pattern_editor/public/lib/ensure_minimum_time.test.ts @@ -9,28 +9,25 @@ import { ensureMinimumTime } from './ensure_minimum_time'; describe('ensureMinimumTime', () => { - it('resolves single promise', async (done) => { + it('resolves single promise', async () => { const promiseA = new Promise((resolve) => resolve('a')); const a = await ensureMinimumTime(promiseA, 0); expect(a).toBe('a'); - done(); }); - it('resolves multiple promises', async (done) => { - const promiseA = new Promise((resolve) => resolve('a')); - const promiseB = new Promise((resolve) => resolve('b')); + it('resolves multiple promises', async () => { + const promiseA = new Promise((resolve) => resolve('a')); + const promiseB = new Promise((resolve) => resolve('b')); const [a, b] = await ensureMinimumTime([promiseA, promiseB], 0); expect(a).toBe('a'); expect(b).toBe('b'); - done(); }); - it('resolves in the amount of time provided, at minimum', async (done) => { + it('resolves in the amount of time provided, at minimum', async () => { const startTime = new Date().getTime(); const promise = new Promise((resolve) => resolve()); await ensureMinimumTime(promise, 100); const endTime = new Date().getTime(); expect(endTime - startTime).toBeGreaterThanOrEqual(100); - done(); }); }); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts b/src/plugins/index_pattern_editor/public/lib/ensure_minimum_time.ts similarity index 95% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts rename to src/plugins/index_pattern_editor/public/lib/ensure_minimum_time.ts index cab11ff3b5a37..5c52446efbe34 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts +++ b/src/plugins/index_pattern_editor/public/lib/ensure_minimum_time.ts @@ -15,8 +15,8 @@ export const DEFAULT_MINIMUM_TIME_MS = 300; -export async function ensureMinimumTime( - promiseOrPromises: Promise | Array>, +export async function ensureMinimumTime( + promiseOrPromises: Promise | Array>, minimumTimeMs = DEFAULT_MINIMUM_TIME_MS ) { let returnValue; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts b/src/plugins/index_pattern_editor/public/lib/extract_time_fields.test.ts similarity index 76% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts rename to src/plugins/index_pattern_editor/public/lib/extract_time_fields.test.ts index 071c21d229524..bc3e4209f5db7 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.test.ts +++ b/src/plugins/index_pattern_editor/public/lib/extract_time_fields.test.ts @@ -16,18 +16,16 @@ describe('extractTimeFields', () => { { type: 'text', name: 'name' }, ] as IndexPatternField[]; - expect(extractTimeFields(fields)).toEqual([ - { display: `The indices which match this index pattern don't contain any time fields.` }, - ]); + expect(extractTimeFields(fields)).toEqual([]); }); it('should add extra options', () => { const fields = [{ type: 'date', name: '@timestamp' }] as IndexPatternField[]; + // const extractedFields = extractTimeFields(fields); expect(extractTimeFields(fields)).toEqual([ { display: '@timestamp', fieldName: '@timestamp' }, - { isDisabled: true, display: '───', fieldName: '' }, - { display: `I don't want to use the time filter`, fieldName: undefined }, + { display: `--- I don't want to use the time filter ---`, fieldName: '' }, ]); }); }); diff --git a/src/plugins/index_pattern_editor/public/lib/extract_time_fields.ts b/src/plugins/index_pattern_editor/public/lib/extract_time_fields.ts new file mode 100644 index 0000000000000..82b94b5c6744a --- /dev/null +++ b/src/plugins/index_pattern_editor/public/lib/extract_time_fields.ts @@ -0,0 +1,44 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { IndexPatternField } from '../../../../plugins/data/public'; +import { TimestampOption } from '../types'; + +export function extractTimeFields( + fields: IndexPatternField[], + requireTimestampField: boolean = false +): TimestampOption[] { + const dateFields = fields.filter((field) => field.type === 'date'); + + if (dateFields.length === 0) { + return []; + } + + const noTimeFieldLabel = i18n.translate( + 'indexPatternEditor.createIndexPattern.stepTime.noTimeFieldOptionLabel', + { + defaultMessage: "--- I don't want to use the time filter ---", + } + ); + const noTimeFieldOption = { + display: noTimeFieldLabel, + fieldName: '', + }; + + const timeFields = dateFields.map((field) => ({ + display: field.name, + fieldName: field.name, + })); + + if (!requireTimestampField) { + timeFields.push(noTimeFieldOption); + } + + return timeFields; +} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.test.ts b/src/plugins/index_pattern_editor/public/lib/get_indices.test.ts similarity index 79% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.test.ts rename to src/plugins/index_pattern_editor/public/lib/get_indices.test.ts index 29330cefc4806..fc96482f0379f 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.test.ts +++ b/src/plugins/index_pattern_editor/public/lib/get_indices.test.ts @@ -7,7 +7,7 @@ */ import { getIndices, responseToItemArray } from './get_indices'; -import { httpServiceMock } from '../../../../../../core/public/mocks'; +import { httpServiceMock } from '../../../../core/public/mocks'; import { ResolveIndexResponseItemIndexAttrs } from '../types'; export const successfulResponse = { @@ -33,26 +33,27 @@ export const successfulResponse = { }; const mockGetTags = () => []; +const mockIsRollupIndex = () => false; const http = httpServiceMock.createStartContract(); http.get.mockResolvedValue(successfulResponse); describe('getIndices', () => { it('should work in a basic case', async () => { - const result = await getIndices(http, mockGetTags, 'kibana', false); + const result = await getIndices(http, mockIsRollupIndex, 'kibana', false); expect(result.length).toBe(3); expect(result[0].name).toBe('f-alias'); expect(result[1].name).toBe('foo'); }); it('should ignore ccs query-all', async () => { - expect((await getIndices(http, mockGetTags, '*:', false)).length).toBe(0); + expect((await getIndices(http, mockIsRollupIndex, '*:', false)).length).toBe(0); }); it('should ignore a single comma', async () => { - expect((await getIndices(http, mockGetTags, ',', false)).length).toBe(0); - expect((await getIndices(http, mockGetTags, ',*', false)).length).toBe(0); - expect((await getIndices(http, mockGetTags, ',foobar', false)).length).toBe(0); + expect((await getIndices(http, mockIsRollupIndex, ',', false)).length).toBe(0); + expect((await getIndices(http, mockIsRollupIndex, ',*', false)).length).toBe(0); + expect((await getIndices(http, mockIsRollupIndex, ',foobar', false)).length).toBe(0); }); it('response object to item array', () => { @@ -89,7 +90,7 @@ describe('getIndices', () => { http.get.mockImplementationOnce(() => { throw new Error('Test error'); }); - const result = await getIndices(http, mockGetTags, 'kibana', false); + const result = await getIndices(http, mockIsRollupIndex, 'kibana', false); expect(result.length).toBe(0); }); }); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts b/src/plugins/index_pattern_editor/public/lib/get_indices.ts similarity index 73% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts rename to src/plugins/index_pattern_editor/public/lib/get_indices.ts index e7edd177c2bda..625e99ecbcdc5 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_indices.ts +++ b/src/plugins/index_pattern_editor/public/lib/get_indices.ts @@ -9,25 +9,41 @@ import { sortBy } from 'lodash'; import { HttpStart } from 'kibana/public'; import { i18n } from '@kbn/i18n'; -import { IndexPatternCreationConfig } from '../../../../../index_pattern_management/public'; +import { Tag, INDEX_PATTERN_TYPE } from '../types'; +// todo move into this plugin, consider removing all ipm references import { MatchedItem, ResolveIndexResponse, ResolveIndexResponseItemIndexAttrs } from '../types'; -const aliasLabel = i18n.translate('indexPatternManagement.aliasLabel', { defaultMessage: 'Alias' }); -const dataStreamLabel = i18n.translate('indexPatternManagement.dataStreamLabel', { +const aliasLabel = i18n.translate('indexPatternEditor.aliasLabel', { defaultMessage: 'Alias' }); +const dataStreamLabel = i18n.translate('indexPatternEditor.dataStreamLabel', { defaultMessage: 'Data stream', }); -const indexLabel = i18n.translate('indexPatternManagement.indexLabel', { +const indexLabel = i18n.translate('indexPatternEditor.indexLabel', { defaultMessage: 'Index', }); -const frozenLabel = i18n.translate('indexPatternManagement.frozenLabel', { +const frozenLabel = i18n.translate('indexPatternEditor.frozenLabel', { defaultMessage: 'Frozen', }); +const rollupLabel = i18n.translate('indexPatternEditor.rollupLabel', { + defaultMessage: 'Rollup', +}); + +const getIndexTags = (isRollupIndex: (indexName: string) => boolean) => (indexName: string) => + isRollupIndex(indexName) + ? [ + { + key: INDEX_PATTERN_TYPE.ROLLUP, + name: rollupLabel, + color: 'primary', + }, + ] + : []; + export async function getIndices( http: HttpStart, - getIndexTags: IndexPatternCreationConfig['getIndexTags'], + isRollupIndex: (indexName: string) => boolean, rawPattern: string, showAllIndices: boolean ): Promise { @@ -62,7 +78,7 @@ export async function getIndices( return []; } - return responseToItemArray(response, getIndexTags); + return responseToItemArray(response, getIndexTags(isRollupIndex)); } catch { return []; } @@ -70,7 +86,7 @@ export async function getIndices( export const responseToItemArray = ( response: ResolveIndexResponse, - getIndexTags: IndexPatternCreationConfig['getIndexTags'] + getTags: (indexName: string) => Tag[] ): MatchedItem[] => { const source: MatchedItem[] = []; @@ -78,7 +94,7 @@ export const responseToItemArray = ( const tags: MatchedItem['tags'] = [{ key: 'index', name: indexLabel, color: 'default' }]; const isFrozen = (index.attributes || []).includes(ResolveIndexResponseItemIndexAttrs.FROZEN); - tags.push(...getIndexTags(index.name)); + tags.push(...getTags(index.name)); if (isFrozen) { tags.push({ name: frozenLabel, key: 'frozen', color: 'danger' }); } diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.test.ts b/src/plugins/index_pattern_editor/public/lib/get_matched_indices.test.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.test.ts rename to src/plugins/index_pattern_editor/public/lib/get_matched_indices.test.ts diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.ts b/src/plugins/index_pattern_editor/public/lib/get_matched_indices.ts similarity index 97% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.ts rename to src/plugins/index_pattern_editor/public/lib/get_matched_indices.ts index e9b365474425b..0b659aa5fbc76 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/get_matched_indices.ts +++ b/src/plugins/index_pattern_editor/public/lib/get_matched_indices.ts @@ -23,10 +23,6 @@ function isSystemIndex(index: string): boolean { } function filterSystemIndices(indices: MatchedItem[], isIncludingSystemIndices: boolean) { - if (!indices) { - return indices; - } - const acceptableIndices = isIncludingSystemIndices ? indices : // All system indices begin with a period. @@ -54,14 +50,14 @@ function filterSystemIndices(indices: MatchedItem[], isIncludingSystemIndices: b We call this `exact` matches because ES is telling us exactly what it matches */ -import { MatchedItem } from '../types'; +import { MatchedItem, MatchedIndicesSet } from '../types'; export function getMatchedIndices( unfilteredAllIndices: MatchedItem[], unfilteredPartialMatchedIndices: MatchedItem[], unfilteredExactMatchedIndices: MatchedItem[], isIncludingSystemIndices: boolean = false -) { +): MatchedIndicesSet { const allIndices = filterSystemIndices(unfilteredAllIndices, isIncludingSystemIndices); const partialMatchedIndices = filterSystemIndices( unfilteredPartialMatchedIndices, diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/index.ts b/src/plugins/index_pattern_editor/public/lib/index.ts similarity index 100% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/index.ts rename to src/plugins/index_pattern_editor/public/lib/index.ts diff --git a/src/plugins/index_pattern_editor/public/mocks.ts b/src/plugins/index_pattern_editor/public/mocks.ts new file mode 100644 index 0000000000000..c7ac1d61e3c10 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/mocks.ts @@ -0,0 +1,32 @@ +/* + * 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 { IndexPatternEditorPlugin } from './plugin'; + +export type Start = jest.Mocked>; + +export type Setup = jest.Mocked>; + +const createSetupContract = (): Setup => { + return {}; +}; + +const createStartContract = (): Start => { + return { + openEditor: jest.fn(), + IndexPatternEditorComponent: jest.fn(), + userPermissions: { + editIndexPattern: jest.fn(), + }, + }; +}; + +export const indexPatternEditorPluginMock = { + createSetupContract, + createStartContract, +}; diff --git a/src/plugins/index_pattern_editor/public/open_editor.tsx b/src/plugins/index_pattern_editor/public/open_editor.tsx new file mode 100644 index 0000000000000..ec62a1d6ec7c6 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/open_editor.tsx @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { CoreStart, OverlayRef } from 'src/core/public'; +import { I18nProvider } from '@kbn/i18n/react'; + +import { + createKibanaReactContext, + toMountPoint, + IndexPattern, + DataPublicPluginStart, +} from './shared_imports'; + +import { CloseEditor, IndexPatternEditorContext, IndexPatternEditorProps } from './types'; +import { IndexPatternEditorLazy } from './components/index_pattern_editor_lazy'; + +interface Dependencies { + core: CoreStart; + indexPatternService: DataPublicPluginStart['indexPatterns']; +} + +export const getEditorOpener = ({ core, indexPatternService }: Dependencies) => ( + options: IndexPatternEditorProps +): CloseEditor => { + const { uiSettings, overlays, docLinks, notifications, http, application } = core; + const { + Provider: KibanaReactContextProvider, + } = createKibanaReactContext({ + uiSettings, + docLinks, + http, + notifications, + application, + indexPatternService, + }); + + let overlayRef: OverlayRef | null = null; + + const openEditor = ({ + onSave, + onCancel = () => {}, + defaultTypeIsRollup = false, + requireTimestampField = false, + }: IndexPatternEditorProps): CloseEditor => { + const closeEditor = () => { + if (overlayRef) { + overlayRef.close(); + overlayRef = null; + } + }; + + const onSaveIndexPattern = (indexPattern: IndexPattern) => { + closeEditor(); + + if (onSave) { + onSave(indexPattern); + } + }; + + overlayRef = overlays.openFlyout( + toMountPoint( + + + { + closeEditor(); + onCancel(); + }} + defaultTypeIsRollup={defaultTypeIsRollup} + requireTimestampField={requireTimestampField} + /> + + + ), + { + hideCloseButton: true, + size: 'l', + } + ); + + return closeEditor; + }; + + return openEditor(options); +}; diff --git a/src/plugins/index_pattern_editor/public/plugin.test.tsx b/src/plugins/index_pattern_editor/public/plugin.test.tsx new file mode 100644 index 0000000000000..b11d6b0c176b6 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/plugin.test.tsx @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import React from 'react'; + +jest.mock('../../kibana_react/public', () => { + const original = jest.requireActual('../../kibana_react/public'); + + return { + ...original, + toMountPoint: (node: React.ReactNode) => node, + }; +}); + +import { CoreStart } from 'src/core/public'; +import { coreMock } from 'src/core/public/mocks'; +import { dataPluginMock } from '../../data/public/mocks'; +import { usageCollectionPluginMock } from '../../usage_collection/public/mocks'; + +import { IndexPatternEditorLazy } from './components/index_pattern_editor_lazy'; +import { IndexPatternEditorPlugin } from './plugin'; + +const noop = () => {}; + +describe('IndexPatternEditorPlugin', () => { + const coreStart: CoreStart = coreMock.createStart(); + const pluginStart = { + data: dataPluginMock.createStartContract(), + usageCollection: usageCollectionPluginMock.createSetupContract(), + }; + + let plugin: IndexPatternEditorPlugin; + + beforeEach(() => { + plugin = new IndexPatternEditorPlugin(); + }); + + test('should expose a handler to open the indexpattern field editor', async () => { + const startApi = await plugin.start(coreStart, pluginStart); + expect(startApi.openEditor).toBeDefined(); + }); + + test('should call core.overlays.openFlyout when opening the editor', async () => { + const openFlyout = jest.fn(); + const onSaveSpy = jest.fn(); + + const coreStartMocked = { + ...coreStart, + overlays: { + ...coreStart.overlays, + openFlyout, + }, + }; + const { openEditor } = await plugin.start(coreStartMocked, pluginStart); + + openEditor({ onSave: onSaveSpy }); + + expect(openFlyout).toHaveBeenCalled(); + + const [[arg]] = openFlyout.mock.calls; + const i18nProvider = arg.props.children; + expect(i18nProvider.props.children.type).toBe(IndexPatternEditorLazy); + + // We force call the "onSave" prop from the component + // and make sure that the the spy is being called. + // Note: we are testing implementation details, if we change or rename the "onSave" prop on + // the component, we will need to update this test accordingly. + expect(i18nProvider.props.children.props.onSave).toBeDefined(); + i18nProvider.props.children.props.onSave(); + expect(onSaveSpy).toHaveBeenCalled(); + }); + + test('should return a handler to close the flyout', async () => { + const { openEditor } = await plugin.start(coreStart, pluginStart); + + const closeEditorHandler = openEditor({ onSave: noop }); + expect(typeof closeEditorHandler).toBe('function'); + }); +}); diff --git a/src/plugins/index_pattern_editor/public/plugin.tsx b/src/plugins/index_pattern_editor/public/plugin.tsx new file mode 100644 index 0000000000000..ca72249496e77 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/plugin.tsx @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { Plugin, CoreSetup, CoreStart } from 'src/core/public'; + +import { + PluginSetup, + PluginStart, + SetupPlugins, + StartPlugins, + IndexPatternEditorProps, +} from './types'; +import { getEditorOpener } from './open_editor'; +import { IndexPatternEditor } from './components/index_pattern_editor'; + +export class IndexPatternEditorPlugin + implements Plugin { + public setup(core: CoreSetup, plugins: SetupPlugins): PluginSetup { + return {}; + } + + public start(core: CoreStart, plugins: StartPlugins) { + const { application, uiSettings, docLinks, http, notifications } = core; + const { data } = plugins; + + return { + /** + * Index pattern editor flyout via function interface + * @param IndexPatternEditorProps - index pattern editor config + * @returns method to close editor + */ + openEditor: getEditorOpener({ + core, + indexPatternService: data.indexPatterns, + }), + /** + * Index pattern editor flyout via react component + * @param IndexPatternEditorProps - index pattern editor config + * @returns JSX.Element + */ + IndexPatternEditorComponent: (props: IndexPatternEditorProps) => ( + + ), + /** + * Convenience method to determine whether the user can create or edit edit the index patterns. + * + * @returns boolean + */ + userPermissions: { + editIndexPattern: () => { + return application.capabilities.management.kibana.indexPatterns; + }, + }, + }; + } + + public stop() { + return {}; + } +} diff --git a/src/plugins/index_pattern_editor/public/shared_imports.ts b/src/plugins/index_pattern_editor/public/shared_imports.ts new file mode 100644 index 0000000000000..c99d32e0c8a28 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/shared_imports.ts @@ -0,0 +1,50 @@ +/* + * 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 { + IndexPattern, + IndexPatternField, + DataPublicPluginStart, + IndexPatternSpec, + GetFieldsOptions, + IndexPatternAggRestrictions, +} from '../../data/public'; + +export { + createKibanaReactContext, + toMountPoint, + CodeEditor, + useKibana, +} from '../../kibana_react/public'; + +export { + useForm, + useFormData, + useFormContext, + Form, + FormSchema, + UseField, + FormHook, + ValidationFunc, + FieldConfig, + getFieldValidityAndErrorMessage, + ValidationConfig, +} from '../../es_ui_shared/static/forms/hook_form_lib'; + +export { fieldValidators } from '../../es_ui_shared/static/forms/helpers'; + +export { + TextField, + ToggleField, + NumericField, + SelectField, + FormRow, + SuperSelectField, +} from '../../es_ui_shared/static/forms/components'; + +export { HttpStart } from '../../../core/public'; diff --git a/src/plugins/index_pattern_editor/public/test_utils/helpers.ts b/src/plugins/index_pattern_editor/public/test_utils/helpers.ts new file mode 100644 index 0000000000000..b55a59df34545 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/test_utils/helpers.ts @@ -0,0 +1,41 @@ +/* + * 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 { act } from 'react-dom/test-utils'; +import { TestBed } from './test_utils'; + +export const getCommonActions = (testBed: TestBed) => { + const toggleFormRow = (row: 'customLabel' | 'value' | 'format', value: 'on' | 'off' = 'on') => { + const testSubj = `${row}Row.toggle`; + const toggle = testBed.find(testSubj); + const isOn = toggle.props()['aria-checked']; + + if ((value === 'on' && isOn) || (value === 'off' && isOn === false)) { + return; + } + + testBed.form.toggleEuiSwitch(testSubj); + }; + + const changeFieldType = async (value: string, label?: string) => { + await act(async () => { + testBed.find('typeField').simulate('change', [ + { + value, + label: label ?? value, + }, + ]); + }); + testBed.component.update(); + }; + + return { + toggleFormRow, + changeFieldType, + }; +}; diff --git a/src/plugins/index_pattern_editor/public/test_utils/index.ts b/src/plugins/index_pattern_editor/public/test_utils/index.ts new file mode 100644 index 0000000000000..b5d943281cd79 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/test_utils/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. + */ + +export * from './test_utils'; + +export * from './mocks'; + +export * from './helpers'; diff --git a/packages/kbn-i18n/babel.config.js b/src/plugins/index_pattern_editor/public/test_utils/mocks.ts similarity index 61% rename from packages/kbn-i18n/babel.config.js rename to src/plugins/index_pattern_editor/public/test_utils/mocks.ts index b4a118df51af5..5d0296a04ea51 100644 --- a/packages/kbn-i18n/babel.config.js +++ b/src/plugins/index_pattern_editor/public/test_utils/mocks.ts @@ -6,14 +6,12 @@ * Side Public License, v 1. */ -module.exports = { - env: { - web: { - presets: ['@kbn/babel-preset/webpack_preset'], - }, - node: { - presets: ['@kbn/babel-preset/node_preset'], - }, - }, - ignore: ['**/*.test.ts', '**/*.test.tsx'], +import { DocLinksStart } from 'src/core/public'; + +export const noop = () => {}; + +export const docLinks: DocLinksStart = { + ELASTIC_WEBSITE_URL: 'htts://jestTest.elastic.co', + DOC_LINK_VERSION: 'jest', + links: {} as any, }; diff --git a/src/plugins/index_pattern_editor/public/test_utils/test_utils.ts b/src/plugins/index_pattern_editor/public/test_utils/test_utils.ts new file mode 100644 index 0000000000000..c8e4aedc26471 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/test_utils/test_utils.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 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 { getRandomString } from '@kbn/test/jest'; + +export { registerTestBed, TestBed } from '@kbn/test/jest'; diff --git a/src/plugins/index_pattern_editor/public/types.ts b/src/plugins/index_pattern_editor/public/types.ts new file mode 100644 index 0000000000000..2a2abe249b330 --- /dev/null +++ b/src/plugins/index_pattern_editor/public/types.ts @@ -0,0 +1,184 @@ +/* + * 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 { FC } from 'react'; +import { + ApplicationStart, + IUiSettingsClient, + NotificationsStart, + DocLinksStart, + HttpSetup, +} from 'src/core/public'; + +import { EuiComboBoxOptionOption } from '@elastic/eui'; + +import type { IndexPattern } from 'src/plugins/data/public'; +import { DataPublicPluginStart, IndexPatternAggRestrictions } from './shared_imports'; + +export interface IndexPatternEditorContext { + uiSettings: IUiSettingsClient; + docLinks: DocLinksStart; + http: HttpSetup; + notifications: NotificationsStart; + application: ApplicationStart; + indexPatternService: DataPublicPluginStart['indexPatterns']; +} + +/** @public */ +export interface IndexPatternEditorProps { + /** + * Handler for the "save" footer button + * @param indexPattern - newly created index pattern + */ + onSave: (indexPattern: IndexPattern) => void; + /** + * Handler for the "cancel" footer button + */ + onCancel?: () => void; + /** + * Sets the default index pattern type to rollup. Defaults to false. + */ + defaultTypeIsRollup?: boolean; + /** + * Sets whether a timestamp field is required to create an index pattern. Defaults to false. + */ + requireTimestampField?: boolean; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface PluginSetup {} + +export interface PluginStart { + openEditor(options: IndexPatternEditorProps): () => void; + IndexPatternEditorComponent: FC; + userPermissions: { + editIndexPattern: () => boolean; + }; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SetupPlugins {} + +export interface StartPlugins { + data: DataPublicPluginStart; +} + +export type CloseEditor = () => void; + +export interface MatchedItem { + name: string; + tags: Tag[]; + item: { + name: string; + backing_indices?: string[]; + timestamp_field?: string; + indices?: string[]; + aliases?: string[]; + attributes?: ResolveIndexResponseItemIndexAttrs[]; + data_stream?: string; + }; +} + +// for showing index matches +export interface ResolveIndexResponse { + indices?: ResolveIndexResponseItemIndex[]; + aliases?: ResolveIndexResponseItemAlias[]; + data_streams?: ResolveIndexResponseItemDataStream[]; +} + +export interface ResolveIndexResponseItem { + name: string; +} + +export interface ResolveIndexResponseItemDataStream extends ResolveIndexResponseItem { + backing_indices: string[]; + timestamp_field: string; +} + +export interface ResolveIndexResponseItemAlias extends ResolveIndexResponseItem { + indices: string[]; +} + +export interface ResolveIndexResponseItemIndex extends ResolveIndexResponseItem { + aliases?: string[]; + attributes?: ResolveIndexResponseItemIndexAttrs[]; + data_stream?: string; +} + +export interface Tag { + name: string; + key: string; + color: string; +} +// end for index matches + +export interface IndexPatternTableItem { + id: string; + title: string; + default: boolean; + tag?: string[]; + sort: string; +} + +// copied from index pattern management, needs review +export interface MatchedItem { + name: string; + tags: Tag[]; + item: { + name: string; + backing_indices?: string[]; + timestamp_field?: string; + indices?: string[]; + aliases?: string[]; + attributes?: ResolveIndexResponseItemIndexAttrs[]; + data_stream?: string; + }; +} + +export enum ResolveIndexResponseItemIndexAttrs { + OPEN = 'open', + CLOSED = 'closed', + HIDDEN = 'hidden', + FROZEN = 'frozen', +} + +export interface RollupIndiciesCapability { + aggs: Record; + error: string; +} + +export type RollupIndicesCapsResponse = Record; + +export enum INDEX_PATTERN_TYPE { + ROLLUP = 'rollup', + DEFAULT = 'default', +} + +export interface IndexPatternConfig { + title: string; + timestampField?: EuiComboBoxOptionOption; + allowHidden: boolean; + id?: string; + type: INDEX_PATTERN_TYPE; +} + +export interface FormInternal extends Omit { + timestampField?: TimestampOption; +} + +export interface TimestampOption { + display: string; + fieldName?: string; +} + +export interface MatchedIndicesSet { + allIndices: MatchedItem[]; + exactMatchedIndices: MatchedItem[]; + partialMatchedIndices: MatchedItem[]; + visibleIndices: MatchedItem[]; +} diff --git a/src/plugins/index_pattern_editor/tsconfig.json b/src/plugins/index_pattern_editor/tsconfig.json new file mode 100644 index 0000000000000..559b1aaf0fc26 --- /dev/null +++ b/src/plugins/index_pattern_editor/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*", + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../es_ui_shared/tsconfig.json" }, + ] +} diff --git a/src/plugins/index_pattern_field_editor/kibana.json b/src/plugins/index_pattern_field_editor/kibana.json index a3a7e61e9806e..02308b349d4ca 100644 --- a/src/plugins/index_pattern_field_editor/kibana.json +++ b/src/plugins/index_pattern_field_editor/kibana.json @@ -5,7 +5,7 @@ "ui": true, "requiredPlugins": ["data"], "optionalPlugins": ["usageCollection"], - "requiredBundles": ["kibanaReact", "esUiShared", "usageCollection"], + "requiredBundles": ["kibanaReact", "esUiShared", "usageCollection", "fieldFormats"], "owner": { "name": "App Services", "githubTeam": "kibana-app-services" diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/bytes/bytes.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/bytes/bytes.test.tsx index 04be866a33ca7..219a51e421b44 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/bytes/bytes.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/bytes/bytes.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { coreMock } from 'src/core/public/mocks'; import { createKibanaReactContext } from '../../../../../../kibana_react/public'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { BytesFormatEditor } from './bytes'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.test.tsx index 1026012f3b887..4b0df63261496 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.test.tsx @@ -8,17 +8,16 @@ import React from 'react'; import { shallowWithI18nProvider } from '@kbn/test/jest'; -import { FieldFormat } from 'src/plugins/data/public'; import { ColorFormatEditor } from './color'; -import { fieldFormats } from '../../../../../../data/public'; +import { FieldFormat, DEFAULT_CONVERTER_COLOR } from '../../../../../../field_formats/common'; const fieldType = 'string'; const format = { getConverterFor: jest.fn(), }; const formatParams = { - colors: [{ ...fieldFormats.DEFAULT_CONVERTER_COLOR }], + colors: [{ ...DEFAULT_CONVERTER_COLOR }], }; const onChange = jest.fn(); const onError = jest.fn(); diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.tsx index 3570ef4c9d33a..67290212c04dd 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/color/color.tsx @@ -15,7 +15,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { DefaultFormatEditor } from '../default/default'; import { formatId } from './constants'; -import { fieldFormats } from '../../../../../../data/public'; +import { DEFAULT_CONVERTER_COLOR } from '../../../../../../field_formats/common'; import { FormatEditorProps } from '../types'; interface Color { @@ -56,7 +56,7 @@ export class ColorFormatEditor extends DefaultFormatEditor { const colors = [...(this.props.formatParams.colors || [])]; this.onChange({ - colors: [...colors, { ...fieldFormats.DEFAULT_CONVERTER_COLOR }], + colors: [...colors, { ...DEFAULT_CONVERTER_COLOR }], }); }; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date/date.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date/date.test.tsx index f3f46cbbdda31..348ac86e209ea 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date/date.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date/date.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { DateFormatEditor } from './date'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx index 4e8d56f91c6eb..8fc4f4dbdfdb6 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/date_nanos/date_nanos.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import type { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { DateNanosFormatEditor } from './date_nanos'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.test.tsx index 90f1d43fa357a..c56d1c0261ed1 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { SampleInput } from '../../types'; import { DefaultFormatEditor, convertSampleInput } from './default'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.tsx index 7228a02afa2a5..129049e1b0565 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/default/default.tsx @@ -9,7 +9,7 @@ import React, { PureComponent, ReactText } from 'react'; import { i18n } from '@kbn/i18n'; -import { FieldFormatsContentType } from 'src/plugins/data/public'; +import type { FieldFormatsContentType } from 'src/plugins/field_formats/common'; import { Sample, SampleInput } from '../../types'; import { FormatEditorProps } from '../types'; import { formatId } from './constants'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.test.tsx index 80a57b9419763..dbc369126d64e 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { DurationFormatEditor } from './duration'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { EuiSwitch } from '@elastic/eui'; const fieldType = 'number'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.tsx index 2bfb0182cbb88..89bac89a95b76 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/duration/duration.tsx @@ -7,7 +7,7 @@ */ import React, { Fragment } from 'react'; -import { DurationFormat } from 'src/plugins/data/common'; +import { DurationFormat } from 'src/plugins/field_formats/common'; import { EuiFieldNumber, EuiFormRow, EuiSelect, EuiSwitch } from '@elastic/eui'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/histogram/histogram.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/histogram/histogram.test.tsx index 053dff1213908..4c34af8748f59 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/histogram/histogram.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/histogram/histogram.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { HistogramFormatEditor } from './histogram'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/number/number.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/number/number.test.tsx index ad71263978d9c..1554da93dac53 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/number/number.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/number/number.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { coreMock } from 'src/core/public/mocks'; import { createKibanaReactContext } from '../../../../../../kibana_react/public'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { NumberFormatEditor } from './number'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/percent/percent.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/percent/percent.test.tsx index 6f6a88cfb7c95..ef71055deca7b 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/percent/percent.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/percent/percent.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { coreMock } from 'src/core/public/mocks'; import { createKibanaReactContext } from '../../../../../../kibana_react/public'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { PercentFormatEditor } from './percent'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx index 8d9cb17b33a40..68a65e5a0fa6c 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { shallowWithI18nProvider } from '@kbn/test/jest'; import { StaticLookupFormatEditorFormatParams } from './static_lookup'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { StaticLookupFormatEditor } from './static_lookup'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/string/string.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/string/string.test.tsx index 5b573d938ebb2..61076353dbf5e 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/string/string.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/string/string.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { StringFormatEditor } from './string'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/truncate/truncate.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/truncate/truncate.test.tsx index 6a4ae0fde0c59..acba1fbedb206 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/truncate/truncate.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/truncate/truncate.test.tsx @@ -9,7 +9,7 @@ import React, { ChangeEvent } from 'react'; import { shallow } from 'enzyme'; import { EuiFieldNumber } from '@elastic/eui'; -import { FieldFormat } from 'src/plugins/data/public'; +import { FieldFormat } from 'src/plugins/field_formats/common'; import { TruncateFormatEditor } from './truncate'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts index 556078286e524..cbdd8efb2a4c8 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/types.ts @@ -7,7 +7,7 @@ */ import type { ComponentType } from 'react'; -import type { FieldFormat } from '../../../../../data/common'; +import type { FieldFormat } from '../../../../../field_formats/common'; import type { FormatSelectEditorProps } from '../field_format_editor'; /** diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx index 1000d9d2b8650..79dc63230dc33 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/editors/url/url.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { __IntlProvider as IntlProvider } from '@kbn/i18n/react'; import { UrlFormatEditor } from './url'; import { coreMock } from 'src/core/public/mocks'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/field_format_editor.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/field_format_editor.tsx index ccb6cf7794f87..1c0c7ecba3b2b 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/field_format_editor.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/field_format_editor.tsx @@ -12,12 +12,12 @@ import { EuiCode, EuiFormRow, EuiSelect } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { - FieldFormatInstanceType, IndexPattern, KBN_FIELD_TYPES, ES_FIELD_TYPES, DataPublicPluginStart, } from 'src/plugins/data/public'; +import type { FieldFormatInstanceType } from 'src/plugins/field_formats/common'; import { CoreStart } from 'src/core/public'; import { castEsToKbnFieldTypeName } from '../../../../data/public'; import { FormatEditor } from './format_editor'; diff --git a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/format_editor.tsx b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/format_editor.tsx index dbbaf51f114b1..c6f5fc9899ac7 100644 --- a/src/plugins/index_pattern_field_editor/public/components/field_format_editor/format_editor.tsx +++ b/src/plugins/index_pattern_field_editor/public/components/field_format_editor/format_editor.tsx @@ -9,7 +9,7 @@ import { EuiDelayRender, EuiLoadingContent } from '@elastic/eui'; import { memoize } from 'lodash'; import React, { PureComponent, LazyExoticComponent } from 'react'; -import type { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { FieldFormatEditorFactory, FieldFormatEditor } from './editors'; export interface FormatEditorProps { diff --git a/src/plugins/index_pattern_field_editor/public/shared_imports.ts b/src/plugins/index_pattern_field_editor/public/shared_imports.ts index 9caa5e093a96f..cfc36543780c1 100644 --- a/src/plugins/index_pattern_field_editor/public/shared_imports.ts +++ b/src/plugins/index_pattern_field_editor/public/shared_imports.ts @@ -6,12 +6,7 @@ * Side Public License, v 1. */ -export { - IndexPattern, - IndexPatternField, - DataPublicPluginStart, - FieldFormat, -} from '../../data/public'; +export { IndexPattern, IndexPatternField, DataPublicPluginStart } from '../../data/public'; export { UsageCollectionStart } from '../../usage_collection/public'; @@ -19,6 +14,8 @@ export { RuntimeType, RuntimeField, KBN_FIELD_TYPES, ES_FIELD_TYPES } from '../. export { createKibanaReactContext, toMountPoint, CodeEditor } from '../../kibana_react/public'; +export { FieldFormat } from '../../field_formats/common'; + export { useForm, useFormData, diff --git a/src/plugins/index_pattern_field_editor/tsconfig.json b/src/plugins/index_pattern_field_editor/tsconfig.json index 559b1aaf0fc26..5450ae74a91a0 100644 --- a/src/plugins/index_pattern_field_editor/tsconfig.json +++ b/src/plugins/index_pattern_field_editor/tsconfig.json @@ -16,5 +16,6 @@ { "path": "../kibana_react/tsconfig.json" }, { "path": "../kibana_utils/tsconfig.json" }, { "path": "../es_ui_shared/tsconfig.json" }, + { "path": "../field_formats/tsconfig.json" } ] } diff --git a/src/plugins/index_pattern_management/kibana.json b/src/plugins/index_pattern_management/kibana.json index 7d9d885bbf9d6..3ba56eda3620e 100644 --- a/src/plugins/index_pattern_management/kibana.json +++ b/src/plugins/index_pattern_management/kibana.json @@ -3,7 +3,7 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["management", "data", "urlForwarding", "indexPatternFieldEditor"], + "requiredPlugins": ["management", "data", "urlForwarding", "indexPatternFieldEditor", "indexPatternEditor"], "requiredBundles": ["kibanaReact", "kibanaUtils"], "owner": { "name": "App Services", diff --git a/src/plugins/index_pattern_management/public/components/__snapshots__/utils.test.ts.snap b/src/plugins/index_pattern_management/public/components/__snapshots__/utils.test.ts.snap index 224a5c992d58b..3a25a78472b50 100644 --- a/src/plugins/index_pattern_management/public/components/__snapshots__/utils.test.ts.snap +++ b/src/plugins/index_pattern_management/public/components/__snapshots__/utils.test.ts.snap @@ -6,14 +6,19 @@ Array [ "default": true, "id": "test", "sort": "0test name", - "tags": undefined, + "tags": Array [ + Object { + "key": "default", + "name": "Default", + }, + ], "title": "test name", }, Object { "default": false, "id": "test1", "sort": "1test name 1", - "tags": undefined, + "tags": Array [], "title": "test name 1", }, ] diff --git a/src/plugins/index_pattern_management/public/components/create_button/create_button.tsx b/src/plugins/index_pattern_management/public/components/create_button/create_button.tsx deleted file mode 100644 index 0da250f5cba3b..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_button/create_button.tsx +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -// @ts-ignore -import { euiColorAccent } from '@elastic/eui/dist/eui_theme_light.json'; -import React, { Component, Fragment } from 'react'; - -import { - EuiBadge, - EuiButton, - EuiContextMenuItem, - EuiContextMenuPanel, - EuiDescriptionList, - EuiDescriptionListDescription, - EuiDescriptionListTitle, - EuiPopover, -} from '@elastic/eui'; - -import { FormattedMessage } from '@kbn/i18n/react'; - -interface State { - isPopoverOpen: boolean; -} - -interface Props { - options: Array<{ - text: string; - description?: string; - testSubj?: string; - isBeta?: boolean; - onClick: () => void; - }>; -} - -export class CreateButton extends Component { - public state = { - isPopoverOpen: false, - }; - - public render() { - const { options, children } = this.props; - const { isPopoverOpen } = this.state; - - if (!options || !options.length) { - return null; - } - - if (options.length === 1) { - return ( - - {children} - - ); - } - - const button = ( - - {children} - - ); - - if (options.length > 1) { - return ( - - { - return ( - - - - {option.text} - {option.isBeta ? {this.renderBetaBadge()} : null} - - - {option.description} - - - - ); - })} - /> - - ); - } - } - - private togglePopover = () => { - this.setState({ - isPopoverOpen: !this.state.isPopoverOpen, - }); - }; - - private closePopover = () => { - this.setState({ - isPopoverOpen: false, - }); - }; - - private renderBetaBadge = () => { - return ( - - - - ); - }; -} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md deleted file mode 100644 index 6e01bf001691e..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/CREATE_INDEX_PATTERN.md +++ /dev/null @@ -1,15 +0,0 @@ -# Create Index Pattern - -This is meant to serve as a guide to this area of code. - -## Bye bye regressions -In order to prevent future regressions, there are a few scenarios -that need to be tested with each change to this area of the code. - -- Cross-cluster search - - Ensure changes work properly in a CCS environment - - A solid CCS environment involves various indices on all nodes including the controlling node. -- Alias support - - Indices are the most common use case, but we also support aliases. -- Time field name - - This needs to be `undefined` if the user does not select one (other areas of Kibana depend on this) \ No newline at end of file diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap deleted file mode 100644 index 38a9e47014416..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap +++ /dev/null @@ -1,250 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`CreateIndexPatternWizard defaults to the loading state 1`] = ` - - - - -`; - -exports[`CreateIndexPatternWizard renders index pattern step when there are indices 1`] = ` - -
    - - - - -`; - -exports[`CreateIndexPatternWizard renders the empty state when there are no indices 1`] = ` - -
    - - - - -`; - -exports[`CreateIndexPatternWizard renders time field step when step is set to 2 1`] = ` - -
    - - - - -`; - -exports[`CreateIndexPatternWizard renders when there are no indices but there are remote clusters 1`] = ` - -
    - - - - -`; - -exports[`CreateIndexPatternWizard shows system indices even if there are no other indices if the include system indices is toggled 1`] = ` - -
    - - - - -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap deleted file mode 100644 index 5e5fbb7c5e99d..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/__snapshots__/header.test.tsx.snap +++ /dev/null @@ -1,499 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Header should render a different name, prompt, and beta tag if provided 1`] = ` -
    - Test prompt -
    - } -> - - Create test index pattern - - - - - - } - > -
    - - Create test index pattern - - - - - - } - responsive={true} - > -
    - -
    - -
    - -

    - Create test index pattern - - - - Beta - - -

    -
    -
    -
    -
    -
    -
    - -
    - - -
    -

    - - multiple - , - "single": - filebeat-4-3-22 - , - "star": - filebeat-* - , - } - } - > - - An index pattern can match a single source, for example, - - - - - filebeat-4-3-22 - - - - - , or - - multiple - - data sources, - - - - - filebeat-* - - - - - . - - -
    - - - -

    -
    -
    - -
    - -
    - Test prompt -
    -
    -
    - -
    -
    - -`; - -exports[`Header should render normally 1`] = ` -
    - - Create test index pattern - - } - > -
    - - Create test index pattern - - } - responsive={true} - > -
    - -
    - -
    - -

    - Create test index pattern -

    -
    -
    -
    -
    -
    -
    - -
    - - -
    -

    - - multiple - , - "single": - filebeat-4-3-22 - , - "star": - filebeat-* - , - } - } - > - - An index pattern can match a single source, for example, - - - - - filebeat-4-3-22 - - - - - , or - - multiple - - data sources, - - - - - filebeat-* - - - - - . - - -
    - - - -

    -
    -
    -
    -
    - -
    -
    -
    -`; - -exports[`Header should render without including system indices 1`] = ` -
    - - Create test index pattern - - } - > -
    - - Create test index pattern - - } - responsive={true} - > -
    - -
    - -
    - -

    - Create test index pattern -

    -
    -
    -
    -
    -
    -
    - -
    - - -
    -

    - - multiple - , - "single": - filebeat-4-3-22 - , - "star": - filebeat-* - , - } - } - > - - An index pattern can match a single source, for example, - - - - - filebeat-4-3-22 - - - - - , or - - multiple - - data sources, - - - - - filebeat-* - - - - - . - - -
    - - - -

    -
    -
    -
    -
    - -
    -
    -
    -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx deleted file mode 100644 index 188fe2fbc02af..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { Header } from '../header'; -import { mount } from 'enzyme'; -import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; -import { mockManagementPlugin } from '../../../../mocks'; -import { DocLinksStart } from 'kibana/public'; - -describe('Header', () => { - const indexPatternName = 'test index pattern'; - const mockedContext = mockManagementPlugin.createIndexPatternManagmentContext(); - const mockedDocLinks = { - links: { - indexPatterns: {}, - }, - } as DocLinksStart; - - it('should render normally', () => { - const component = mount( -
    , - { - wrappingComponent: KibanaContextProvider, - wrappingComponentProps: { - services: mockedContext, - }, - } - ); - - expect(component).toMatchSnapshot(); - }); - - it('should render without including system indices', () => { - const component = mount( -
    , - { - wrappingComponent: KibanaContextProvider, - wrappingComponentProps: { - services: mockedContext, - }, - } - ); - - expect(component).toMatchSnapshot(); - }); - - it('should render a different name, prompt, and beta tag if provided', () => { - const component = mount( -
    Test prompt
    } - indexPatternName={indexPatternName} - isBeta={true} - docLinks={mockedDocLinks} - />, - { - wrappingComponent: KibanaContextProvider, - wrappingComponentProps: { - services: mockedContext, - }, - } - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx deleted file mode 100644 index c708bd3cac33e..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.tsx +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { EuiBetaBadge, EuiCode, EuiLink, EuiPageHeader, EuiSpacer, EuiText } from '@elastic/eui'; - -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { DocLinksStart } from 'kibana/public'; -import { useKibana } from '../../../../../../../plugins/kibana_react/public'; -import { IndexPatternManagmentContext } from '../../../../types'; - -export const Header = ({ - prompt, - indexPatternName, - isBeta = false, - docLinks, -}: { - prompt?: React.ReactNode; - indexPatternName: string; - isBeta?: boolean; - docLinks: DocLinksStart; -}) => { - const changeTitle = useKibana().services.chrome.docTitle.change; - const createIndexPatternHeader = i18n.translate( - 'indexPatternManagement.createIndexPatternHeader', - { - defaultMessage: 'Create {indexPatternName}', - values: { indexPatternName }, - } - ); - - changeTitle(createIndexPatternHeader); - - return ( - - {createIndexPatternHeader} - {isBeta ? ( - <> - {' '} - - - ) : null} - - } - bottomBorder - > - -

    - multiple, - single: filebeat-4-3-22, - star: filebeat-*, - }} - /> -
    - - - -

    -
    - {prompt ? ( - <> - - {prompt} - - ) : null} -
    - ); -}; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap deleted file mode 100644 index 1e6ac56d437e1..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/__snapshots__/loading_state.test.tsx.snap +++ /dev/null @@ -1,39 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`LoadingState should render normally 1`] = ` - - - -

    - -

    -
    -
    - - - -
    -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.tsx deleted file mode 100644 index 9cfb9321b3f00..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/loading_state/loading_state.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner, EuiTitle } from '@elastic/eui'; - -import { FormattedMessage } from '@kbn/i18n/react'; - -export const LoadingState = () => ( - - - -

    - -

    -
    -
    - - - - -
    -); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap deleted file mode 100644 index 813a0c61c0829..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/__snapshots__/step_index_pattern.test.tsx.snap +++ /dev/null @@ -1,58 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`StepIndexPattern renders errors when input is invalid 1`] = ` -Object { - "component":
    , |" - data-test-subj="createIndexPatternStep1Header" - errors={ - Array [ - "A name cannot contain spaces or the characters: \\\\, /, ?, \\", <, >, |", - ] - } - goToNextStep={[Function]} - isIncludingSystemIndices={false} - isInputInvalid={true} - isNextStepDisabled={true} - onChangeIncludingSystemIndices={[Function]} - onQueryChanged={[Function]} - query="?" - />, -} -`; - -exports[`StepIndexPattern renders indices which match the initial query 1`] = ` - -`; - -exports[`StepIndexPattern renders matching indices when input is valid 1`] = ` - -`; - -exports[`StepIndexPattern renders the loading state 1`] = ` - -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap deleted file mode 100644 index 851e5cc4c2a76..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/__snapshots__/header.test.tsx.snap +++ /dev/null @@ -1,221 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Header should mark the input as invalid 1`] = ` -
    - -

    - -

    -
    - - - - - - - * - , - } - } - /> - - - % - , - } - } - /> - - } - isInvalid={true} - label={ - - } - labelType="label" - > - - - - - - - - - - - - -
    -`; - -exports[`Header should render normally 1`] = ` -
    - -

    - -

    -
    - - - - - - - * - , - } - } - /> - - - % - , - } - } - /> - - } - isInvalid={false} - label={ - - } - labelType="label" - > - - - - - - - - - - - - -
    -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx deleted file mode 100644 index 8c7e43ed57c77..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx +++ /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 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { Header } from '../header'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; - -describe('Header', () => { - it('should render normally', () => { - const component = shallowWithI18nProvider( -
    {}} - goToNextStep={() => {}} - isNextStepDisabled={false} - onChangeIncludingSystemIndices={() => {}} - isIncludingSystemIndices={false} - /> - ); - - expect(component).toMatchSnapshot(); - }); - - it('should mark the input as invalid', () => { - const component = shallowWithI18nProvider( -
    {}} - goToNextStep={() => {}} - isNextStepDisabled={true} - onChangeIncludingSystemIndices={() => {}} - isIncludingSystemIndices={false} - /> - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx deleted file mode 100644 index 342665b185e79..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.tsx +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { - EuiTitle, - EuiFlexGroup, - EuiFlexItem, - EuiSpacer, - EuiButton, - EuiForm, - EuiFormRow, - EuiFieldText, - EuiSwitchEvent, - EuiSwitch, -} from '@elastic/eui'; - -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; - -interface HeaderProps { - isInputInvalid: boolean; - errors: any; - characterList: string; - query: string; - onQueryChanged: (e: React.ChangeEvent) => void; - goToNextStep: (query: string) => void; - isNextStepDisabled: boolean; - showSystemIndices?: boolean; - onChangeIncludingSystemIndices: (event: EuiSwitchEvent) => void; - isIncludingSystemIndices: boolean; -} - -export const Header: React.FC = ({ - isInputInvalid, - errors, - characterList, - query, - onQueryChanged, - goToNextStep, - isNextStepDisabled, - showSystemIndices = false, - onChangeIncludingSystemIndices, - isIncludingSystemIndices, - ...rest -}) => ( -
    - -

    - -

    -
    - - - - - - } - isInvalid={isInputInvalid} - error={errors} - helpText={ - <> - * }} - />{' '} - {characterList} }} - /> - - } - > - - - - {showSystemIndices ? ( - - - } - id="checkboxShowSystemIndices" - checked={isIncludingSystemIndices} - onChange={onChangeIncludingSystemIndices} - data-test-subj="showSystemAndHiddenIndices" - /> - - ) : null} - - - - - goToNextStep(query)} - isDisabled={isNextStepDisabled} - data-test-subj="createIndexPatternGoToStep2Button" - > - - - - - -
    -); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/index.ts deleted file mode 100644 index 3d87a6d7c39dc..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { StepIndexPattern } from './step_index_pattern'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx deleted file mode 100644 index 8b4f751a4e3a3..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { StepIndexPattern, canPreselectTimeField } from './step_index_pattern'; -import { Header } from './components/header'; -import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; -import { mockManagementPlugin } from '../../../../mocks'; -import { createComponentWithContext } from '../../../test_utils'; - -jest.mock('../../lib/ensure_minimum_time', () => ({ - ensureMinimumTime: async (promises: Array>) => - Array.isArray(promises) ? await Promise.all(promises) : await promises, -})); - -const mockIndexPatternCreationType = new IndexPatternCreationConfig({ - type: 'default', - name: 'name', -}); - -jest.mock('../../lib/get_indices', () => ({ - getIndices: ({}, {}, query: string) => { - if (query.startsWith('e')) { - return [{ name: 'es', item: {} }]; - } - - return [{ name: 'kibana', item: {} }]; - }, -})); - -const allIndices = [ - { name: 'kibana', tags: [], item: {} }, - { name: 'es', tags: [], item: {} }, -]; - -const goToNextStep = () => {}; - -const mockContext = mockManagementPlugin.createIndexPatternManagmentContext(); - -mockContext.data.indexPatterns.getTitles = async () => Promise.resolve([]); -mockContext.uiSettings.get.mockReturnValue(''); - -describe('StepIndexPattern', () => { - it('renders the loading state', () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - component.setState({ isLoadingIndices: true }); - expect(component.find('[data-test-subj="createIndexPatternStep1Loading"]')).toMatchSnapshot(); - }); - - it('renders indices which match the initial query', async () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - initialQuery: 'kibana', - }, - mockContext - ); - - // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); - // Ensure the state changes are reflected - await component.update(); - - expect( - component.find('[data-test-subj="createIndexPatternStep1IndicesList"]') - ).toMatchSnapshot(); - }); - - it('renders errors when input is invalid', async () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - const instance = component.instance() as StepIndexPattern; - instance.onQueryChanged({ target: { value: '?' } } as React.ChangeEvent); - - // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); - // Ensure the state changes are reflected - component.update(); - expect({ - component: component.find('[data-test-subj="createIndexPatternStep1Header"]'), - }).toMatchSnapshot(); - }); - - it('renders matching indices when input is valid', async () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - const instance = component.instance() as StepIndexPattern; - instance.onQueryChanged({ target: { value: 'k' } } as React.ChangeEvent); - - // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); - // Ensure the state changes are reflected - component.update(); - - expect( - component.find('[data-test-subj="createIndexPatternStep1IndicesList"]') - ).toMatchSnapshot(); - }); - - it('appends a wildcard automatically to queries', async () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - const instance = component.instance() as StepIndexPattern; - instance.onQueryChanged({ target: { value: 'k' } } as React.ChangeEvent); - expect(component.state('query')).toBe('k*'); - }); - - it('disables the next step if the index pattern exists', async () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - component.setState({ indexPatternExists: true }); - expect(component.find(Header).prop('isNextStepDisabled')).toBe(true); - }); - - it('ensures the response of the latest request is persisted', async () => { - const component = createComponentWithContext( - StepIndexPattern, - { - allIndices, - isIncludingSystemIndices: false, - goToNextStep, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - const instance = component.instance() as StepIndexPattern; - instance.onQueryChanged({ target: { value: 'e' } } as React.ChangeEvent); - instance.lastQuery = 'k'; - await new Promise((resolve) => process.nextTick(resolve)); - - // Honesty, the state would match the result of the `k` query but - // it's hard to mock this in tests but if remove our fix - // (the early return if the queries do not match) then this - // equals [{name: 'es'}] - expect(component.state('exactMatchedIndices')).toEqual([]); - - // Ensure it works in the other code flow too (the other early return) - - // Provide `es` so we do not auto append * and enter our other code flow - instance.onQueryChanged({ target: { value: 'es' } } as React.ChangeEvent); - instance.lastQuery = 'k'; - await new Promise((resolve) => process.nextTick(resolve)); - expect(component.state('exactMatchedIndices')).toEqual([]); - }); - - it('it can preselect time field', async () => { - const dataStream1 = { - name: 'data stream 1', - tags: [], - item: { name: 'data stream 1', backing_indices: [], timestamp_field: 'timestamp_field' }, - }; - - const dataStream2 = { - name: 'data stream 2', - tags: [], - item: { name: 'data stream 2', backing_indices: [], timestamp_field: 'timestamp_field' }, - }; - - const differentDataStream = { - name: 'different data stream', - tags: [], - item: { name: 'different data stream 2', backing_indices: [], timestamp_field: 'x' }, - }; - - const index = { - name: 'index', - tags: [], - item: { - name: 'index', - }, - }; - - const alias = { - name: 'alias', - tags: [], - item: { - name: 'alias', - indices: [], - }, - }; - - expect(canPreselectTimeField([index])).toEqual(undefined); - expect(canPreselectTimeField([alias])).toEqual(undefined); - expect(canPreselectTimeField([index, alias, dataStream1])).toEqual(undefined); - - expect(canPreselectTimeField([dataStream1])).toEqual('timestamp_field'); - - expect(canPreselectTimeField([dataStream1, dataStream2])).toEqual('timestamp_field'); - - expect(canPreselectTimeField([dataStream1, dataStream2, differentDataStream])).toEqual( - undefined - ); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx deleted file mode 100644 index 052e454041181..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React, { Component } from 'react'; -import { EuiSpacer, EuiCallOut, EuiSwitchEvent } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { indexPatterns, UI_SETTINGS } from '../../../../../../../plugins/data/public'; -import { - getIndices, - containsIllegalCharacters, - getMatchedIndices, - canAppendWildcard, - ensureMinimumTime, -} from '../../lib'; -import { LoadingIndices } from './components/loading_indices'; -import { StatusMessage } from './components/status_message'; -import { IndicesList } from './components/indices_list'; -import { Header } from './components/header'; -import { context as contextType } from '../../../../../../kibana_react/public'; -import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; -import { MatchedItem } from '../../types'; -import { IndexPatternManagmentContextValue } from '../../../../types'; - -interface StepIndexPatternProps { - allIndices: MatchedItem[]; - indexPatternCreationType: IndexPatternCreationConfig; - goToNextStep: (query: string, timestampField?: string) => void; - initialQuery?: string; - showSystemIndices: boolean; -} - -interface StepIndexPatternState { - partialMatchedIndices: MatchedItem[]; - exactMatchedIndices: MatchedItem[]; - isLoadingIndices: boolean; - existingIndexPatterns: string[]; - indexPatternExists: boolean; - query: string; - appendedWildcard: boolean; - showingIndexPatternQueryErrors: boolean; - indexPatternName: string; - isIncludingSystemIndices: boolean; -} - -export const canPreselectTimeField = (indices: MatchedItem[]) => { - const preselectStatus = indices.reduce( - ( - { canPreselect, timeFieldName }: { canPreselect: boolean; timeFieldName?: string }, - matchedItem - ) => { - const dataStreamItem = matchedItem.item; - const dataStreamTimestampField = dataStreamItem.timestamp_field; - const isDataStream = !!dataStreamItem.timestamp_field; - const timestampFieldMatches = - timeFieldName === undefined || timeFieldName === dataStreamTimestampField; - - return { - canPreselect: canPreselect && isDataStream && timestampFieldMatches, - timeFieldName: dataStreamTimestampField || timeFieldName, - }; - }, - { - canPreselect: true, - timeFieldName: undefined, - } - ); - - return preselectStatus.canPreselect ? preselectStatus.timeFieldName : undefined; -}; - -export class StepIndexPattern extends Component { - static contextType = contextType; - - public readonly context!: IndexPatternManagmentContextValue; - - state = { - partialMatchedIndices: [], - exactMatchedIndices: [], - isLoadingIndices: false, - existingIndexPatterns: [], - indexPatternExists: false, - query: '', - appendedWildcard: false, - showingIndexPatternQueryErrors: false, - indexPatternName: '', - isIncludingSystemIndices: false, - }; - - ILLEGAL_CHARACTERS = [...indexPatterns.ILLEGAL_CHARACTERS]; - - constructor(props: StepIndexPatternProps, context: IndexPatternManagmentContextValue) { - super(props, context); - const { indexPatternCreationType, initialQuery } = this.props; - - this.state.query = - initialQuery || context.services.uiSettings.get(UI_SETTINGS.INDEXPATTERN_PLACEHOLDER); - this.state.indexPatternName = indexPatternCreationType.getIndexPatternName(); - } - - lastQuery = ''; - - async UNSAFE_componentWillMount() { - this.fetchExistingIndexPatterns(); - if (this.state.query) { - this.lastQuery = this.state.query; - this.fetchIndices(this.state.query); - } - } - - fetchExistingIndexPatterns = async () => { - const existingIndexPatterns = await this.context.services.data.indexPatterns.getTitles(); - this.setState({ existingIndexPatterns }); - }; - - fetchIndices = async (query: string) => { - const { indexPatternCreationType } = this.props; - const { existingIndexPatterns } = this.state; - - if ((existingIndexPatterns as string[]).includes(query)) { - this.setState({ indexPatternExists: true }); - return; - } - - this.setState({ isLoadingIndices: true, indexPatternExists: false }); - - if (query.endsWith('*')) { - const exactMatchedIndices = await ensureMinimumTime( - getIndices( - this.context.services.http, - (indexName: string) => indexPatternCreationType.getIndexTags(indexName), - query, - this.state.isIncludingSystemIndices - ) - ); - // If the search changed, discard this state - if (query !== this.lastQuery) { - return; - } - this.setState({ exactMatchedIndices, isLoadingIndices: false }); - return; - } - - const [partialMatchedIndices, exactMatchedIndices] = await ensureMinimumTime([ - getIndices( - this.context.services.http, - (indexName: string) => indexPatternCreationType.getIndexTags(indexName), - `${query}*`, - this.state.isIncludingSystemIndices - ), - getIndices( - this.context.services.http, - (indexName: string) => indexPatternCreationType.getIndexTags(indexName), - query, - this.state.isIncludingSystemIndices - ), - ]); - - // If the search changed, discard this state - if (query !== this.lastQuery) { - return; - } - - this.setState({ - partialMatchedIndices, - exactMatchedIndices, - isLoadingIndices: false, - }); - }; - - onQueryChanged = (e: React.ChangeEvent) => { - const { appendedWildcard } = this.state; - const { target } = e; - - let query = target.value; - if (query.length === 1 && !appendedWildcard && canAppendWildcard(query)) { - query += '*'; - this.setState({ appendedWildcard: true }); - setTimeout(() => target.setSelectionRange(1, 1)); - } else { - if (['', '*'].includes(query) && appendedWildcard) { - query = ''; - this.setState({ appendedWildcard: false }); - } - } - - this.lastQuery = query; - this.setState({ query, showingIndexPatternQueryErrors: !!query.length }); - this.fetchIndices(query); - }; - - renderLoadingState() { - const { isLoadingIndices } = this.state; - - if (!isLoadingIndices) { - return null; - } - - return ( - <> - - - - - ); - } - - renderStatusMessage(matchedIndices: { - allIndices: MatchedItem[]; - exactMatchedIndices: MatchedItem[]; - partialMatchedIndices: MatchedItem[]; - }) { - const { indexPatternCreationType } = this.props; - const { query, isLoadingIndices, indexPatternExists, isIncludingSystemIndices } = this.state; - - if (isLoadingIndices || indexPatternExists) { - return null; - } - - return ( - - ); - } - - renderList({ - visibleIndices, - allIndices, - }: { - visibleIndices: MatchedItem[]; - allIndices: MatchedItem[]; - }) { - const { query, isLoadingIndices, indexPatternExists } = this.state; - - if (isLoadingIndices || indexPatternExists) { - return null; - } - - const indicesToList = query.length ? visibleIndices : allIndices; - return ( - - ); - } - - renderIndexPatternExists() { - const { indexPatternExists, query } = this.state; - - if (!indexPatternExists) { - return null; - } - - return ( - - } - iconType="help" - color="warning" - /> - ); - } - - renderHeader({ exactMatchedIndices: indices }: { exactMatchedIndices: MatchedItem[] }) { - const { goToNextStep, indexPatternCreationType } = this.props; - const { - query, - showingIndexPatternQueryErrors, - indexPatternExists, - indexPatternName, - isIncludingSystemIndices, - } = this.state; - - let containsErrors = false; - const errors = []; - const characterList = this.ILLEGAL_CHARACTERS.slice(0, this.ILLEGAL_CHARACTERS.length - 1).join( - ', ' - ); - - const checkIndices = indexPatternCreationType.checkIndicesForErrors(indices); - - if (!query || !query.length || query === '.' || query === '..') { - // This is an error scenario but do not report an error - containsErrors = true; - } else if (containsIllegalCharacters(query, indexPatterns.ILLEGAL_CHARACTERS)) { - const errorMessage = i18n.translate( - 'indexPatternManagement.createIndexPattern.step.invalidCharactersErrorMessage', - { - defaultMessage: - 'A {indexPatternName} cannot contain spaces or the characters: {characterList}', - values: { characterList, indexPatternName }, - } - ); - - errors.push(errorMessage); - containsErrors = true; - } else if (checkIndices) { - errors.push(...(checkIndices as string[])); - containsErrors = true; - } - - const isInputInvalid = showingIndexPatternQueryErrors && containsErrors && errors.length > 0; - const isNextStepDisabled = containsErrors || indices.length === 0 || indexPatternExists; - - return ( -
    goToNextStep(query, canPreselectTimeField(indices))} - isNextStepDisabled={isNextStepDisabled} - onChangeIncludingSystemIndices={this.onChangeIncludingSystemIndices} - isIncludingSystemIndices={isIncludingSystemIndices} - showSystemIndices={this.props.showSystemIndices} - /> - ); - } - - onChangeIncludingSystemIndices = (event: EuiSwitchEvent) => { - this.setState({ isIncludingSystemIndices: event.target.checked }, () => - this.fetchIndices(this.state.query) - ); - }; - - render() { - const { allIndices } = this.props; - const { partialMatchedIndices, exactMatchedIndices, isIncludingSystemIndices } = this.state; - - const matchedIndices = getMatchedIndices( - allIndices, - partialMatchedIndices, - exactMatchedIndices, - isIncludingSystemIndices - ); - - return ( - <> - {this.renderHeader(matchedIndices)} - - {this.renderLoadingState()} - {this.renderIndexPatternExists()} - {this.renderStatusMessage(matchedIndices)} - - {this.renderList(matchedIndices)} - - ); - } -} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/__snapshots__/step_time_field.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/__snapshots__/step_time_field.test.tsx.snap deleted file mode 100644 index 544e3ba983122..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/__snapshots__/step_time_field.test.tsx.snap +++ /dev/null @@ -1,364 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`StepTimeField should disable the action button if an invalid time field is selected 1`] = ` - -`; - -exports[`StepTimeField should enable the action button if the user decides to not select a time field 1`] = ` - -`; - -exports[`StepTimeField should render "Custom index pattern ID already exists" when error is "Conflict" 1`] = ` - -
    - - - - - - - } - > -

    - -

    -
    - - - -`; - -exports[`StepTimeField should render a loading state when creating the index pattern 1`] = ` - - - -

    - -

    -
    -
    - - - -
    -`; - -exports[`StepTimeField should render a selected timeField 1`] = ` - -
    - - - - - - - -`; - -exports[`StepTimeField should render advanced options 1`] = ` - -
    - - - - - - - -`; - -exports[`StepTimeField should render advanced options with an index pattern id 1`] = ` - -
    - - - - - - - -`; - -exports[`StepTimeField should render any error message 1`] = ` - -
    - - - - - - - } - > -

    - foobar -

    -
    - - - -`; - -exports[`StepTimeField should render normally 1`] = ` - -
    - - - - - - - -`; - -exports[`StepTimeField should render timeFields 1`] = ` - -
    - - - - - - - -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx deleted file mode 100644 index 1f5b194fc2549..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/action_buttons.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { EuiFlexGroup, EuiFlexItem, EuiButton, EuiButtonEmpty } from '@elastic/eui'; - -import { FormattedMessage } from '@kbn/i18n/react'; - -export const ActionButtons = ({ - goToPreviousStep, - submittable, - createIndexPattern, -}: { - goToPreviousStep: () => void; - submittable: boolean; - createIndexPattern: () => void; -}) => ( - - - - - - - - - - - - -); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts deleted file mode 100644 index 56f13b55bc6be..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/action_buttons/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { ActionButtons } from './action_buttons'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap deleted file mode 100644 index a2d2023ea0601..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/__snapshots__/advanced_options.test.tsx.snap +++ /dev/null @@ -1,69 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AdvancedOptions should hide if not showing 1`] = ` -
    - - - - -
    -`; - -exports[`AdvancedOptions should render normally 1`] = ` -
    - - - - - - - } - label={ - - } - labelType="label" - > - - - -
    -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx deleted file mode 100644 index 0341a760c535f..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { AdvancedOptions } from '../advanced_options'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; - -describe('AdvancedOptions', () => { - it('should render normally', () => { - const component = shallowWithI18nProvider( - {}} - onChangeIndexPatternId={() => {}} - /> - ); - - expect(component).toMatchSnapshot(); - }); - - it('should hide if not showing', () => { - const component = shallowWithI18nProvider( - {}} - onChangeIndexPatternId={() => {}} - /> - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx deleted file mode 100644 index 665972c546158..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { EuiForm, EuiFormRow, EuiFieldText, EuiButtonEmpty, EuiSpacer } from '@elastic/eui'; - -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; - -interface AdvancedOptionsProps { - isVisible: boolean; - indexPatternId: string; - toggleAdvancedOptions: (e: React.FormEvent) => void; - onChangeIndexPatternId: (e: React.ChangeEvent) => void; -} - -export const AdvancedOptions: React.FC = ({ - isVisible, - indexPatternId, - toggleAdvancedOptions, - onChangeIndexPatternId, -}) => ( -
    - - {isVisible ? ( - - ) : ( - - )} - - - {isVisible ? ( - - - } - helpText={ - - } - > - - - - ) : null} -
    -); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts deleted file mode 100644 index 23ebc3a8c3f66..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { AdvancedOptions } from './advanced_options'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap deleted file mode 100644 index 9efda4fdac7f9..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/__snapshots__/header.test.tsx.snap +++ /dev/null @@ -1,34 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Header should render normally 1`] = ` -
    - -

    - -

    -
    - - - - ki* - , - "indexPatternName": "ki*", - } - } - /> - -
    -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx deleted file mode 100644 index 444e5c49cb497..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.test.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { Header } from '../header'; -import { shallow } from 'enzyme'; - -describe('Header', () => { - it('should render normally', () => { - const component = shallow(
    ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx deleted file mode 100644 index 41cae957def2b..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/header/header.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { EuiTitle, EuiSpacer, EuiText } from '@elastic/eui'; - -import { FormattedMessage } from '@kbn/i18n/react'; - -interface HeaderProps { - indexPattern: string; - indexPatternName: string; -} - -export const Header: React.FC = ({ indexPattern, indexPatternName }) => ( -
    - -

    - -

    -
    - - - {indexPattern}, - indexPatternName, - }} - /> - -
    -); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap deleted file mode 100644 index 73277b1963626..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/__snapshots__/time_field.test.tsx.snap +++ /dev/null @@ -1,188 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`TimeField should render a loading state 1`] = ` - - -

    - -

    -
    - - - } - labelAppend={ - - } - labelType="label" - > - - -
    -`; - -exports[`TimeField should render a selected time field 1`] = ` - - -

    - -

    -
    - - - } - labelAppend={ - - - - - - } - labelType="label" - > - - -
    -`; - -exports[`TimeField should render normally 1`] = ` - - -

    - -

    -
    - - - } - labelAppend={ - - - - - - } - labelType="label" - > - - -
    -`; - -exports[`TimeField should render something if hiding time field 1`] = ` - - -

    - -

    -
    -
    -`; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts deleted file mode 100644 index 7dba3ecc1f75f..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { TimeField } from './time_field'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx deleted file mode 100644 index 1f16842f3c89d..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { TimeField } from '../time_field'; -import { shallowWithI18nProvider } from '@kbn/test/jest'; - -describe('TimeField', () => { - it('should render normally', () => { - const component = shallowWithI18nProvider( - {}} - timeFieldOptions={[{ text: '@timestamp', value: '@timestamp' }]} - isLoading={false} - selectedTimeField={''} - onTimeFieldChanged={() => {}} - /> - ); - - expect(component).toMatchSnapshot(); - }); - - it('should render something if hiding time field', () => { - const component = shallowWithI18nProvider( - {}} - timeFieldOptions={[{ text: '@timestamp', value: '@timestamp' }]} - isLoading={false} - selectedTimeField={''} - onTimeFieldChanged={() => {}} - /> - ); - - expect(component).toMatchSnapshot(); - }); - - it('should render a selected time field', () => { - const component = shallowWithI18nProvider( - {}} - timeFieldOptions={[{ text: '@timestamp', value: '@timestamp' }]} - isLoading={false} - selectedTimeField={'@timestamp'} - onTimeFieldChanged={() => {}} - /> - ); - - expect(component).toMatchSnapshot(); - }); - - it('should render a loading state', () => { - const component = shallowWithI18nProvider( - {}} - timeFieldOptions={[{ text: '@timestamp', value: '@timestamp' }]} - isLoading={true} - selectedTimeField={'@timestamp'} - onTimeFieldChanged={() => {}} - /> - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx deleted file mode 100644 index 7fac76eb847cd..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.tsx +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { - EuiForm, - EuiFormRow, - EuiSpacer, - EuiLink, - EuiSelect, - EuiText, - EuiLoadingSpinner, -} from '@elastic/eui'; - -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; - -interface TimeFieldProps { - isVisible: boolean; - fetchTimeFields: () => void; - timeFieldOptions: Array<{ text: string; value?: string }>; - isLoading: boolean; - selectedTimeField?: string; - onTimeFieldChanged: (e: React.ChangeEvent) => void; -} - -export const TimeField: React.FC = ({ - isVisible, - fetchTimeFields, - timeFieldOptions, - isLoading, - selectedTimeField, - onTimeFieldChanged, -}) => ( - - {isVisible ? ( - <> - -

    - -

    -
    - - - } - labelAppend={ - isLoading ? ( - - ) : ( - - - - - - ) - } - > - {isLoading ? ( - - ) : ( - - )} - - - ) : ( - -

    - -

    -
    - )} -
    -); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/index.ts deleted file mode 100644 index 4591dc5ae83dc..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { StepTimeField } from './step_time_field'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx deleted file mode 100644 index fabc6ec69b0ee..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.test.tsx +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { IndexPatternCreationConfig } from '../../../../../../../plugins/index_pattern_management/public'; -import { IndexPatternField } from '../../../../../../../plugins/data/public'; -import { mockManagementPlugin } from '../../../../mocks'; -import { createComponentWithContext } from '../../../test_utils'; - -import { StepTimeField } from '../step_time_field'; - -jest.mock('./components/header', () => ({ Header: 'Header' })); -jest.mock('./components/time_field', () => ({ TimeField: 'TimeField' })); -jest.mock('./components/advanced_options', () => ({ AdvancedOptions: 'AdvancedOptions' })); -jest.mock('./components/action_buttons', () => ({ ActionButtons: 'ActionButtons' })); -jest.mock('./../../lib', () => ({ - extractTimeFields: jest.requireActual('./../../lib').extractTimeFields, - ensureMinimumTime: async (fields: IndexPatternField) => Promise.resolve(fields), -})); - -const mockIndexPatternCreationType = new IndexPatternCreationConfig({ - type: 'default', - name: 'name', -}); - -const noop = () => {}; -const mockContext = mockManagementPlugin.createIndexPatternManagmentContext(); -const fields = [ - { - name: '@timestamp', - type: 'date', - }, -]; -mockContext.data.indexPatterns = { - create: () => ({}), - getFieldsForWildcard: jest.fn().mockReturnValue(Promise.resolve(fields)), -} as any; - -describe('StepTimeField', () => { - it('should render normally', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - expect(component).toMatchSnapshot(); - }); - - it('should render timeFields', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ - timeFields: [ - { display: '@timestamp', fieldName: '@timestamp' }, - { display: 'name', fieldName: 'name' }, - ], - }); - - expect(component).toMatchSnapshot(); - }); - - it('should render a selected timeField', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ - timeFields: [ - { display: '@timestamp', fieldName: '@timestamp' }, - { display: 'name', fieldName: 'name' }, - ], - selectedTimeField: '@timestamp', - timeFieldSet: true, - }); - - expect(component).toMatchSnapshot(); - }); - - it('should ensure disabled time field options work properly', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ - timeFields: [ - { display: '@timestamp', fieldName: '@timestamp' }, - { display: 'name', fieldName: 'name' }, - ], - }); - - // If the value is undefined, that means the user selected the - // `I don't want to use a Time filter` option - (component.instance() as StepTimeField).onTimeFieldChanged(({ - target: { value: undefined }, - } as unknown) as React.ChangeEvent); - expect(component.state('timeFieldSet')).toBe(true); - - // If the value is an empty string, that means the user selected - // an invalid selection (like the empty selection or the `-----`) - (component.instance() as StepTimeField).onTimeFieldChanged(({ - target: { value: '' }, - } as unknown) as React.ChangeEvent); - expect(component.state('timeFieldSet')).toBe(false); - }); - - it('should disable the action button if an invalid time field is selected', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ - timeFields: [ - { display: '@timestamp', fieldName: '@timestamp' }, - { display: 'name', fieldName: 'name' }, - ], - }); - - (component.instance() as StepTimeField).onTimeFieldChanged(({ - target: { value: '' }, - } as unknown) as React.ChangeEvent); - component.update(); - - expect(component.find('ActionButtons')).toMatchSnapshot(); - }); - - it('should enable the action button if the user decides to not select a time field', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ - timeFields: [ - { display: '@timestamp', fieldName: '@timestamp' }, - { display: 'name', fieldName: 'name' }, - ], - }); - - (component.instance() as StepTimeField).onTimeFieldChanged(({ - target: { value: undefined }, - } as unknown) as React.ChangeEvent); - component.update(); - - expect(component.find('ActionButtons')).toMatchSnapshot(); - }); - - it('should render advanced options', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ showingAdvancedOptions: true }); - - expect(component).toMatchSnapshot(); - }); - - it('should render advanced options with an index pattern id', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ - showingAdvancedOptions: true, - indexPatternId: 'foobar', - }); - - expect(component).toMatchSnapshot(); - }); - - it('should render a loading state when creating the index pattern', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ isCreating: true }); - - expect(component).toMatchSnapshot(); - }); - - it('should render any error message', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ error: 'foobar' }); - - expect(component).toMatchSnapshot(); - }); - - it('should render "Custom index pattern ID already exists" when error is "Conflict"', () => { - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern: noop, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - component.setState({ error: 'Conflict' }); - - expect(component).toMatchSnapshot(); - }); - - it('should remember error thrown by createIndexPatter() prop', async () => { - const createIndexPattern = async () => { - throw new Error('foobar'); - }; - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - await (component.instance() as StepTimeField).createIndexPattern(); - component.update(); - - expect(component.instance().state).toMatchObject({ - error: 'foobar', - }); - }); - - it('should call createIndexPattern with undefined time field when no time filter chosen', async () => { - const createIndexPattern = jest.fn(); - - const component = createComponentWithContext( - StepTimeField, - { - indexPattern: 'ki*', - goToPreviousStep: noop, - createIndexPattern, - indexPatternCreationType: mockIndexPatternCreationType, - }, - mockContext - ); - - await (component.instance() as StepTimeField).fetchTimeFields(); - - expect((component.state() as any).timeFields).toHaveLength(3); - - (component.instance() as StepTimeField).onTimeFieldChanged(({ - target: { value: undefined }, - } as unknown) as React.ChangeEvent); - - await (component.instance() as StepTimeField).createIndexPattern(); - - expect(createIndexPattern).toHaveBeenCalledWith(undefined, ''); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx deleted file mode 100644 index f489132946ec7..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/step_time_field.tsx +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React, { Component } from 'react'; -import { - EuiCallOut, - EuiFlexGroup, - EuiFlexItem, - EuiTitle, - EuiSpacer, - EuiLoadingSpinner, - EuiHorizontalRule, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { ensureMinimumTime, extractTimeFields } from '../../lib'; - -import { Header } from './components/header'; -import { TimeField } from './components/time_field'; -import { AdvancedOptions } from './components/advanced_options'; -import { ActionButtons } from './components/action_buttons'; -import { context } from '../../../../../../kibana_react/public'; -import { IndexPatternManagmentContextValue } from '../../../../types'; -import { IndexPatternCreationConfig } from '../../../..'; - -interface StepTimeFieldProps { - indexPattern: string; - goToPreviousStep: () => void; - createIndexPattern: (selectedTimeField: string | undefined, indexPatternId: string) => void; - indexPatternCreationType: IndexPatternCreationConfig; - selectedTimeField?: string; -} - -interface StepTimeFieldState { - error: string; - timeFields: TimeFieldConfig[]; - selectedTimeField?: string; - timeFieldSet: boolean; - isAdvancedOptionsVisible: boolean; - isFetchingTimeFields: boolean; - isCreating: boolean; - indexPatternId: string; - indexPatternType: string; - indexPatternName: string; -} - -interface TimeFieldConfig { - display: string; - fieldName?: string; - isDisabled?: boolean; -} - -export class StepTimeField extends Component { - static contextType = context; - - public readonly context!: IndexPatternManagmentContextValue; - - state: StepTimeFieldState = { - error: '', - timeFields: [], - selectedTimeField: undefined, - timeFieldSet: false, - isAdvancedOptionsVisible: false, - isFetchingTimeFields: false, - isCreating: false, - indexPatternId: '', - indexPatternType: '', - indexPatternName: '', - }; - - constructor(props: StepTimeFieldProps) { - super(props); - this.state.indexPatternType = props.indexPatternCreationType.getIndexPatternType() || ''; - this.state.indexPatternName = props.indexPatternCreationType.getIndexPatternName(); - this.state.selectedTimeField = props.selectedTimeField; - if (props.selectedTimeField) { - this.state.timeFieldSet = true; - } - } - - mounted = false; - - componentDidMount() { - this.mounted = true; - this.fetchTimeFields(); - } - - componentWillUnmount() { - this.mounted = false; - } - - fetchTimeFields = async () => { - const { indexPattern: pattern } = this.props; - const { getFetchForWildcardOptions } = this.props.indexPatternCreationType; - - this.setState({ isFetchingTimeFields: true }); - const fields = await ensureMinimumTime( - this.context.services.data.indexPatterns.getFieldsForWildcard({ - pattern, - ...getFetchForWildcardOptions(), - }) - ); - const timeFields = extractTimeFields(fields); - - this.setState({ timeFields, isFetchingTimeFields: false }); - }; - - onTimeFieldChanged = (e: React.ChangeEvent) => { - const value = e.target.value; - - // Find the time field based on the selected value - const timeField = this.state.timeFields.find( - (timeFld: TimeFieldConfig) => timeFld.fieldName === value - ); - - // If the value is an empty string, it's not a valid selection - const validSelection = value !== ''; - - this.setState({ - selectedTimeField: timeField ? (timeField as TimeFieldConfig).fieldName : undefined, - timeFieldSet: validSelection, - }); - }; - - onChangeIndexPatternId = (e: React.ChangeEvent) => { - this.setState({ indexPatternId: e.target.value }); - }; - - toggleAdvancedOptions = () => { - this.setState((state) => ({ - isAdvancedOptionsVisible: !state.isAdvancedOptionsVisible, - })); - }; - - createIndexPattern = async () => { - const { createIndexPattern } = this.props; - const { selectedTimeField, indexPatternId } = this.state; - this.setState({ isCreating: true }); - try { - await createIndexPattern(selectedTimeField, indexPatternId); - } catch (error) { - if (!this.mounted) return; - this.setState({ - error: error instanceof Error ? error.message : String(error), - isCreating: false, - }); - } - }; - - formatErrorMessage(message: string) { - // `createIndexPattern` throws "Conflict" when index pattern ID already exists. - return message === 'Conflict' ? ( - - ) : ( - message - ); - } - - render() { - const { - timeFields, - selectedTimeField, - timeFieldSet, - isAdvancedOptionsVisible, - indexPatternId, - isCreating, - isFetchingTimeFields, - indexPatternName, - } = this.state; - - if (isCreating) { - return ( - - - -

    - -

    -
    -
    - - - - -
    - ); - } - - const { indexPattern, goToPreviousStep } = this.props; - - const timeFieldOptions = - timeFields.length > 0 - ? [ - { text: '', value: '' }, - ...timeFields.map((timeField: TimeFieldConfig) => ({ - text: timeField.display, - value: timeField.fieldName, - disabled: ((timeFields as unknown) as TimeFieldConfig).isDisabled, - })), - ] - : []; - - const showTimeField = !timeFields || timeFields.length > 1; - const submittable = !showTimeField || timeFieldSet; - const error = this.state.error ? ( - <> - - } - color="danger" - iconType="cross" - > -

    {this.formatErrorMessage(this.state.error)}

    -
    - - - ) : null; - - return ( - <> -
    - - - - - - {error} - - - ); - } -} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/constants/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/constants/index.ts deleted file mode 100644 index 8bc64bdaa490f..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/constants/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -// This isn't ideal. We want to avoid searching for 20 indices -// then filtering out the majority of them because they are system indices. -// We'd like to filter system indices out in the query -// so if we can accomplish that in the future, this logic can go away -export const ESTIMATED_NUMBER_OF_SYSTEM_INDICES = 100; -export const MAX_NUMBER_OF_MATCHING_INDICES = 100; -export const MAX_SEARCH_SIZE = MAX_NUMBER_OF_MATCHING_INDICES + ESTIMATED_NUMBER_OF_SYSTEM_INDICES; - -export const PER_PAGE_INCREMENTS = [5, 10, 20, 50]; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx deleted file mode 100644 index a6c7e71445ae3..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.test.tsx +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { CreateIndexPatternWizard } from './create_index_pattern_wizard'; -import { IndexPattern } from '../../../../../plugins/data/public'; -import { mockManagementPlugin } from '../../mocks'; -import { IndexPatternCreationConfig } from '../../'; -import { createComponentWithContext } from '../test_utils'; - -jest.mock('./components/step_index_pattern', () => ({ StepIndexPattern: 'StepIndexPattern' })); -jest.mock('./components/step_time_field', () => ({ StepTimeField: 'StepTimeField' })); -jest.mock('./components/header', () => ({ Header: 'Header' })); -jest.mock('./components/loading_state', () => ({ LoadingState: 'LoadingState' })); -jest.mock('./lib/get_indices', () => ({ - getIndices: () => { - return [{ name: 'kibana' }]; - }, -})); -const routeComponentPropsMock = { - history: { - push: jest.fn(), - } as any, - location: {} as any, - match: {} as any, -}; -const mockContext = mockManagementPlugin.createIndexPatternManagmentContext(); -mockContext.indexPatternManagementStart.creation.getType = () => { - return new IndexPatternCreationConfig({ - type: 'default', - name: 'name', - }); -}; - -describe('CreateIndexPatternWizard', () => { - test(`defaults to the loading state`, () => { - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - expect(component).toMatchSnapshot(); - }); - - test('renders the empty state when there are no indices', async () => { - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - component.setState({ - isInitiallyLoadingIndices: false, - allIndices: [], - remoteClustersExist: false, - }); - - await component.update(); - expect(component).toMatchSnapshot(); - }); - - test('renders when there are no indices but there are remote clusters', async () => { - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - component.setState({ - isInitiallyLoadingIndices: false, - allIndices: [], - remoteClustersExist: true, - }); - - await component.update(); - expect(component).toMatchSnapshot(); - }); - - test('shows system indices even if there are no other indices if the include system indices is toggled', async () => { - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - component.setState({ - isInitiallyLoadingIndices: false, - isIncludingSystemIndices: true, - allIndices: [{ name: '.kibana ' }], - }); - - await component.update(); - expect(component).toMatchSnapshot(); - }); - - test('renders index pattern step when there are indices', async () => { - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - component.setState({ - isInitiallyLoadingIndices: false, - allIndices: [{ name: 'myIndexPattern' }], - }); - - await component.update(); - expect(component).toMatchSnapshot(); - }); - - test('renders time field step when step is set to 2', async () => { - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - component.setState({ - isInitiallyLoadingIndices: false, - allIndices: [{ name: 'myIndexPattern' }], - step: 2, - }); - - await component.update(); - expect(component).toMatchSnapshot(); - }); - - test('invokes the provided services when creating an index pattern', async () => { - const newIndexPatternAndSave = jest.fn().mockImplementation(async () => { - return indexPattern; - }); - const clear = jest.fn(); - mockContext.data.indexPatterns.clearCache = clear; - const indexPattern = ({ - id: '1', - title: 'my-fake-index-pattern', - timeFieldName: 'timestamp', - fields: [], - _fetchFields: jest.fn(), - } as unknown) as IndexPattern; - mockContext.data.indexPatterns.createAndSave = newIndexPatternAndSave; - mockContext.data.indexPatterns.setDefault = jest.fn(); - - const component = createComponentWithContext( - CreateIndexPatternWizard, - { ...routeComponentPropsMock }, - mockContext - ); - - component.setState({ indexPattern: 'foo' }); - await (component.instance() as CreateIndexPatternWizard).createIndexPattern(undefined, 'id'); - expect(newIndexPatternAndSave).toBeCalled(); - expect(clear).toBeCalledWith('1'); - expect(routeComponentPropsMock.history.push).toBeCalledWith(`/patterns/1`); - }); -}); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx deleted file mode 100644 index 5bc53105dbcf8..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React, { Component, ReactElement } from 'react'; - -import { EuiGlobalToastList, EuiGlobalToastListToast, EuiSpacer } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { i18n } from '@kbn/i18n'; -import { RouteComponentProps, withRouter } from 'react-router-dom'; -import { DocLinksStart } from 'src/core/public'; -import { StepIndexPattern } from './components/step_index_pattern'; -import { StepTimeField } from './components/step_time_field'; -import { Header } from './components/header'; -import { LoadingState } from './components/loading_state'; - -import { context as contextType } from '../../../../kibana_react/public'; -import { getCreateBreadcrumbs } from '../breadcrumbs'; -import { ensureMinimumTime, getIndices } from './lib'; -import { IndexPatternCreationConfig } from '../..'; -import { IndexPatternManagmentContextValue } from '../../types'; -import { MatchedItem } from './types'; -import { DuplicateIndexPatternError, IndexPattern } from '../../../../data/public'; - -interface CreateIndexPatternWizardState { - step: number; - indexPattern: string; - allIndices: MatchedItem[]; - remoteClustersExist: boolean; - isInitiallyLoadingIndices: boolean; - toasts: EuiGlobalToastListToast[]; - indexPatternCreationType: IndexPatternCreationConfig; - selectedTimeField?: string; - docLinks: DocLinksStart; -} - -export class CreateIndexPatternWizard extends Component< - RouteComponentProps, - CreateIndexPatternWizardState -> { - static contextType = contextType; - - public readonly context!: IndexPatternManagmentContextValue; - - constructor(props: RouteComponentProps, context: IndexPatternManagmentContextValue) { - super(props, context); - - context.services.setBreadcrumbs(getCreateBreadcrumbs()); - - const type = new URLSearchParams(props.location.search).get('type') || undefined; - const indexPattern = new URLSearchParams(props.location.search).get('name') || ''; - - this.state = { - step: 1, - indexPattern, - allIndices: [], - remoteClustersExist: false, - isInitiallyLoadingIndices: true, - toasts: [], - indexPatternCreationType: context.services.indexPatternManagementStart.creation.getType(type), - docLinks: context.services.docLinks, - }; - } - - async UNSAFE_componentWillMount() { - this.fetchData(); - } - - catchAndWarn = async ( - asyncFn: Promise, - errorValue: [] | string[], - errorMsg: ReactElement - ) => { - try { - return await asyncFn; - } catch (errors) { - this.setState((prevState) => ({ - toasts: prevState.toasts.concat([ - { - title: errorMsg, - id: errorMsg.props.id, - color: 'warning', - iconType: 'alert', - }, - ]), - })); - return errorValue; - } - }; - - fetchData = async () => { - const indicesFailMsg = ( - - ); - - const clustersFailMsg = ( - - ); - - // query local and remote indices, updating state independently - ensureMinimumTime( - this.catchAndWarn( - getIndices( - this.context.services.http, - (indexName: string) => this.state.indexPatternCreationType.getIndexTags(indexName), - `*`, - false - ), - - [], - indicesFailMsg - ) - ).then((allIndices: MatchedItem[]) => - this.setState({ allIndices, isInitiallyLoadingIndices: false }) - ); - - this.catchAndWarn( - // if we get an error from remote cluster query, supply fallback value that allows user entry. - // ['a'] is fallback value - getIndices( - this.context.services.http, - (indexName: string) => this.state.indexPatternCreationType.getIndexTags(indexName), - `*:*`, - false - ), - - ['a'], - clustersFailMsg - ).then((remoteIndices: string[] | MatchedItem[]) => - this.setState({ remoteClustersExist: !!remoteIndices.length }) - ); - }; - - createIndexPattern = async (timeFieldName: string | undefined, indexPatternId: string) => { - let emptyPattern: IndexPattern; - const { history } = this.props; - const { indexPattern } = this.state; - - try { - emptyPattern = await this.context.services.data.indexPatterns.createAndSave({ - id: indexPatternId, - title: indexPattern, - timeFieldName, - ...this.state.indexPatternCreationType.getIndexPatternMappings(), - }); - } catch (err) { - if (err instanceof DuplicateIndexPatternError) { - const confirmMessage = i18n.translate( - 'indexPatternManagement.indexPattern.titleExistsLabel', - { - values: { title: emptyPattern!.title }, - defaultMessage: "An index pattern with the title '{title}' already exists.", - } - ); - - const isConfirmed = await this.context.services.overlays.openConfirm(confirmMessage, { - confirmButtonText: i18n.translate( - 'indexPatternManagement.indexPattern.goToPatternButtonLabel', - { - defaultMessage: 'Go to existing pattern', - } - ), - }); - - if (isConfirmed) { - return history.push(`/patterns/${indexPatternId}`); - } else { - return; - } - } else { - throw err; - } - } - - await this.context.services.data.indexPatterns.setDefault(emptyPattern.id as string); - - this.context.services.data.indexPatterns.clearCache(emptyPattern.id as string); - history.push(`/patterns/${emptyPattern.id}`); - }; - - goToTimeFieldStep = (indexPattern: string, selectedTimeField?: string) => { - this.setState({ step: 2, indexPattern, selectedTimeField }); - }; - - goToIndexPatternStep = () => { - this.setState({ step: 1 }); - }; - - renderHeader() { - const { docLinks, indexPatternCreationType } = this.state; - return ( -
    - ); - } - - renderContent() { - const { allIndices, isInitiallyLoadingIndices, step, indexPattern } = this.state; - - if (isInitiallyLoadingIndices) { - return ; - } - - const header = this.renderHeader(); - - if (step === 1) { - const { location } = this.props; - const initialQuery = new URLSearchParams(location.search).get('id') || undefined; - - return ( - <> - {header} - - - - ); - } - - if (step === 2) { - return ( - <> - {header} - - - - ); - } - - return null; - } - - removeToast = (id: string) => { - this.setState((prevState) => ({ - toasts: prevState.toasts.filter((toast) => toast.id !== id), - })); - }; - - render() { - const content = this.renderContent(); - - return ( - <> - {content} - { - this.removeToast(id); - }} - toastLifeTimeMs={6000} - /> - - ); - } -} - -export const CreateIndexPatternWizardWithRouter = withRouter(CreateIndexPatternWizard); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts deleted file mode 100644 index 52087f388cb97..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { CreateIndexPatternWizardWithRouter } from './create_index_pattern_wizard'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts deleted file mode 100644 index e2af9339e57a3..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/extract_time_fields.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { i18n } from '@kbn/i18n'; -import { IndexPatternField } from '../../../../../../plugins/data/public'; - -export function extractTimeFields(fields: IndexPatternField[]) { - const dateFields = fields.filter((field) => field.type === 'date'); - const label = i18n.translate( - 'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldsLabel', - { - defaultMessage: "The indices which match this index pattern don't contain any time fields.", - } - ); - - if (dateFields.length === 0) { - return [ - { - display: label, - }, - ]; - } - - const disabledDividerOption = { - isDisabled: true, - display: '───', - fieldName: '', - }; - const noTimeFieldLabel = i18n.translate( - 'indexPatternManagement.createIndexPattern.stepTime.noTimeFieldOptionLabel', - { - defaultMessage: "I don't want to use the time filter", - } - ); - const noTimeFieldOption = { - display: noTimeFieldLabel, - fieldName: undefined, - }; - - return [ - ...dateFields.map((field) => ({ - display: field.name, - fieldName: field.name, - })), - disabledDividerOption, - noTimeFieldOption, - ]; -} diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/types.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/types.ts deleted file mode 100644 index 8d511a30c3532..0000000000000 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/types.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export interface MatchedItem { - name: string; - tags: Tag[]; - item: { - name: string; - backing_indices?: string[]; - timestamp_field?: string; - indices?: string[]; - aliases?: string[]; - attributes?: ResolveIndexResponseItemIndexAttrs[]; - data_stream?: string; - }; -} - -export interface ResolveIndexResponse { - indices?: ResolveIndexResponseItemIndex[]; - aliases?: ResolveIndexResponseItemAlias[]; - data_streams?: ResolveIndexResponseItemDataStream[]; -} - -export interface ResolveIndexResponseItem { - name: string; -} - -export interface ResolveIndexResponseItemDataStream extends ResolveIndexResponseItem { - backing_indices: string[]; - timestamp_field: string; -} - -export interface ResolveIndexResponseItemAlias extends ResolveIndexResponseItem { - indices: string[]; -} - -export interface ResolveIndexResponseItemIndex extends ResolveIndexResponseItem { - aliases?: string[]; - attributes?: ResolveIndexResponseItemIndexAttrs[]; - data_stream?: string; -} - -export enum ResolveIndexResponseItemIndexAttrs { - OPEN = 'open', - CLOSED = 'closed', - HIDDEN = 'hidden', - FROZEN = 'frozen', -} - -export interface Tag { - name: string; - key: string; - color: string; -} diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx index 6609605da87d1..a8f89b471e4eb 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/edit_index_pattern.tsx @@ -25,6 +25,7 @@ import { useKibana } from '../../../../../plugins/kibana_react/public'; import { IndexPatternManagmentContext } from '../../types'; import { Tabs } from './tabs'; import { IndexHeader } from './index_header'; +import { getTags } from '../utils'; export interface EditIndexPatternProps extends RouteComponentProps { indexPattern: IndexPattern; @@ -57,7 +58,6 @@ export const EditIndexPattern = withRouter( ({ indexPattern, history, location }: EditIndexPatternProps) => { const { uiSettings, - indexPatternManagementStart, overlays, chrome, data, @@ -77,13 +77,8 @@ export const EditIndexPattern = withRouter( }, [indexPattern]); useEffect(() => { - const indexPatternTags = - indexPatternManagementStart.list.getIndexPatternTags( - indexPattern, - indexPattern.id === defaultIndex - ) || []; - setTags(indexPatternTags); - }, [defaultIndex, indexPattern, indexPatternManagementStart.list]); + setTags(getTags(indexPattern, indexPattern.id === defaultIndex)); + }, [defaultIndex, indexPattern]); const setDefaultPattern = useCallback(() => { uiSettings.set('defaultIndex', indexPattern.id); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx index 6d37e8f13d6b3..2f288dc072914 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { IndexPatternField, IndexPattern, IndexPatternType } from 'src/plugins/data/public'; import { IndexedFieldsTable } from './indexed_fields_table'; -import { RollupIndexPatternListConfig } from '../../../service/list'; +import { getFieldInfo } from '../../utils'; jest.mock('@elastic/eui', () => ({ EuiFlexGroup: 'eui-flex-group', @@ -30,7 +30,7 @@ const helpers = { editField: (fieldName: string) => {}, deleteField: (fieldName: string) => {}, // getFieldInfo handles non rollups as well - getFieldInfo: new RollupIndexPatternListConfig().getFieldInfo, + getFieldInfo, }; const indexPattern = ({ diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx index 4d99bd504cd0f..6594d677884c2 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx @@ -35,6 +35,7 @@ import { SourceFiltersTable } from '../source_filters_table'; import { IndexedFieldsTable } from '../indexed_fields_table'; import { ScriptedFieldsTable } from '../scripted_fields_table'; import { getTabs, getPath, convertToEuiSelectOption } from './utils'; +import { getFieldInfo } from '../../utils'; interface TabsProps extends Pick { indexPattern: IndexPattern; @@ -81,7 +82,6 @@ export function Tabs({ }: TabsProps) { const { uiSettings, - indexPatternManagementStart, docLinks, indexPatternFieldEditor, } = useKibana().services; @@ -227,7 +227,7 @@ export function Tabs({ helpers={{ editField: openFieldEditor, deleteField, - getFieldInfo: indexPatternManagementStart.list.getFieldInfo, + getFieldInfo, }} /> )} @@ -280,7 +280,6 @@ export function Tabs({ getFilterSection, history, indexPattern, - indexPatternManagementStart.list.getFieldInfo, indexedFieldTypeFilter, refreshFilters, scriptedFieldLanguageFilter, @@ -293,15 +292,13 @@ export function Tabs({ const euiTabs: EuiTabbedContentTab[] = useMemo( () => - getTabs(indexPattern, fieldFilter, indexPatternManagementStart.list).map( - (tab: Pick) => { - return { - ...tab, - content: getContent(tab.id), - }; - } - ), - [fieldFilter, getContent, indexPattern, indexPatternManagementStart.list] + getTabs(indexPattern, fieldFilter).map((tab: Pick) => { + return { + ...tab, + content: getContent(tab.id), + }; + }), + [fieldFilter, getContent, indexPattern] ); const [selectedTabId, setSelectedTabId] = useState(euiTabs[0].id); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts index afa786b4d71e6..76bb86eb88d9b 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/utils.ts @@ -9,8 +9,8 @@ import { Dictionary, countBy, defaults, uniq } from 'lodash'; import { i18n } from '@kbn/i18n'; import { IndexPattern, IndexPatternField } from '../../../../../../plugins/data/public'; -import { IndexPatternManagementStart } from '../../../../../../plugins/index_pattern_management/public'; import { TAB_INDEXED_FIELDS, TAB_SCRIPTED_FIELDS, TAB_SOURCE_FILTERS } from '../constants'; +import { areScriptedFieldsEnabled } from '../../utils'; function filterByName(items: IndexPatternField[], filter: string) { const lowercaseFilter = (filter || '').toLowerCase(); @@ -68,11 +68,7 @@ function getTitle(type: string, filteredCount: Dictionary, totalCount: D return title + count; } -export function getTabs( - indexPattern: IndexPattern, - fieldFilter: string, - indexPatternListProvider: IndexPatternManagementStart['list'] -) { +export function getTabs(indexPattern: IndexPattern, fieldFilter: string) { const totalCount = getCounts(indexPattern.fields.getAll(), indexPattern.getSourceFiltering()); const filteredCount = getCounts( indexPattern.fields.getAll(), @@ -88,7 +84,7 @@ export function getTabs( 'data-test-subj': 'tab-indexedFields', }); - if (indexPatternListProvider.areScriptedFieldsEnabled(indexPattern)) { + if (areScriptedFieldsEnabled(indexPattern)) { tabs.push({ name: getTitle('scripted', filteredCount, totalCount), id: TAB_SCRIPTED_FIELDS, diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx index c2f0c7cbfd64c..1a06fdf425500 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.test.tsx @@ -10,7 +10,7 @@ import React, { PureComponent } from 'react'; import { shallow } from 'enzyme'; import { FieldFormatEditor } from './field_format_editor'; -import type { FieldFormat } from '../../../../../../data/public'; +import type { FieldFormat } from '../../../../../../field_formats/common'; class TestEditor extends PureComponent { render() { diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx index 545a464da0eb3..3689ae70639c8 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/field_format_editor.tsx @@ -13,7 +13,7 @@ import type { FieldFormatEditorFactory, FieldFormatEditor as InnerFieldFormatEditor, } from 'src/plugins/index_pattern_field_editor/public'; -import type { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; export interface FieldFormatEditorProps { fieldType: string; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap index ba0f2aee0565f..5d417dadca923 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/__snapshots__/warning_call_out.test.tsx.snap @@ -152,6 +152,7 @@ exports[`ScriptingWarningCallOut should render normally 1`] = ` >
    ({})); diff --git a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx index b5c0186cd998c..bdc18938f9d6c 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.tsx @@ -33,13 +33,13 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import type { FieldFormatInstanceType } from 'src/plugins/field_formats/common'; import { getEnabledScriptingLanguages, getDeprecatedScriptingLanguages, getSupportedScriptingLanguages, } from '../../scripting_languages'; import { - FieldFormatInstanceType, IndexPattern, IndexPatternField, KBN_FIELD_TYPES, diff --git a/src/plugins/index_pattern_management/public/components/index.ts b/src/plugins/index_pattern_management/public/components/index.ts index 022f32fb3defc..bbe10af809c9f 100644 --- a/src/plugins/index_pattern_management/public/components/index.ts +++ b/src/plugins/index_pattern_management/public/components/index.ts @@ -13,4 +13,3 @@ export { CreateEditField, CreateEditFieldContainer, } from './edit_index_pattern'; -export { CreateIndexPatternWizardWithRouter } from './create_index_pattern_wizard'; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/index.ts b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/index.ts deleted file mode 100644 index 4e19a60d5a769..0000000000000 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { EmptyState } from './empty_state'; diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx index 6405a81282471..ef99be4df7cb8 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx @@ -8,6 +8,7 @@ import { EuiBadge, + EuiButton, EuiBadgeGroup, EuiButtonEmpty, EuiInMemoryTable, @@ -15,19 +16,14 @@ import { EuiSpacer, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { RouteComponentProps, withRouter } from 'react-router-dom'; +import { RouteComponentProps, withRouter, useLocation } from 'react-router-dom'; import React, { useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { reactRouterNavigate, useKibana } from '../../../../../plugins/kibana_react/public'; import { IndexPatternManagmentContext } from '../../types'; -import { CreateButton } from '../create_button'; -import { IndexPatternCreationOption, IndexPatternTableItem } from '../types'; +import { IndexPatternTableItem } from '../types'; import { getIndexPatterns } from '../utils'; import { getListBreadcrumbs } from '../breadcrumbs'; -import { EmptyState } from './empty_state'; -import { MatchedItem, ResolveIndexResponseItemAlias } from '../create_index_pattern_wizard/types'; -import { EmptyIndexPatternPrompt } from './empty_index_pattern_prompt'; -import { getIndices } from '../create_index_pattern_wizard/lib'; const pagination = { initialPageSize: 10, @@ -56,67 +52,45 @@ const title = i18n.translate('indexPatternManagement.indexPatternTable.title', { interface Props extends RouteComponentProps { canSave: boolean; + showCreateDialog?: boolean; } -export const IndexPatternTable = ({ canSave, history }: Props) => { +export const IndexPatternTable = ({ + history, + canSave, + showCreateDialog: showCreateDialogProp = false, +}: Props) => { const { setBreadcrumbs, uiSettings, indexPatternManagementStart, chrome, - docLinks, - application, - http, data, + IndexPatternEditor, } = useKibana().services; const [indexPatterns, setIndexPatterns] = useState([]); - const [creationOptions, setCreationOptions] = useState([]); - const [sources, setSources] = useState([]); - const [remoteClustersExist, setRemoteClustersExist] = useState(false); - const [isLoadingSources, setIsLoadingSources] = useState(true); const [isLoadingIndexPatterns, setIsLoadingIndexPatterns] = useState(true); + const [showCreateDialog, setShowCreateDialog] = useState(showCreateDialogProp); setBreadcrumbs(getListBreadcrumbs()); useEffect(() => { (async function () { - const options = await indexPatternManagementStart.creation.getIndexPatternCreationOptions( - history.push - ); const gettedIndexPatterns: IndexPatternTableItem[] = await getIndexPatterns( uiSettings.get('defaultIndex'), - indexPatternManagementStart, data.indexPatterns ); - setIsLoadingIndexPatterns(false); - setCreationOptions(options); setIndexPatterns(gettedIndexPatterns); + setIsLoadingIndexPatterns(false); + if (gettedIndexPatterns.length === 0) { + setShowCreateDialog(true); + } })(); - }, [history.push, indexPatterns.length, indexPatternManagementStart, uiSettings, data]); - - const removeAliases = (item: MatchedItem) => - !((item as unknown) as ResolveIndexResponseItemAlias).indices; - - const loadSources = () => { - getIndices(http, () => [], '*', false).then((dataSources) => - setSources(dataSources.filter(removeAliases)) - ); - getIndices(http, () => [], '*:*', false).then((dataSources) => - setRemoteClustersExist(!!dataSources.filter(removeAliases).length) - ); - }; - - useEffect(() => { - getIndices(http, () => [], '*', false).then((dataSources) => { - setSources(dataSources.filter(removeAliases)); - setIsLoadingSources(false); - }); - getIndices(http, () => [], '*:*', false).then((dataSources) => - setRemoteClustersExist(!!dataSources.filter(removeAliases).length) - ); - }, [http, creationOptions]); + }, [indexPatternManagementStart, uiSettings, data]); chrome.docTitle.change(title); + const isRollup = new URLSearchParams(useLocation().search).get('type') === 'rollup'; + const columns = [ { field: 'title', @@ -150,43 +124,36 @@ export const IndexPatternTable = ({ canSave, history }: Props) => { ]; const createButton = canSave ? ( - + setShowCreateDialog(true)} + data-test-subj="createIndexPatternButton" + > - + ) : ( <> ); - if (isLoadingSources || isLoadingIndexPatterns) { + if (isLoadingIndexPatterns) { return <>; } - const hasDataIndices = sources.some(({ name }: MatchedItem) => !name.startsWith('.')); - - if (!indexPatterns.length) { - if (!hasDataIndices && !remoteClustersExist) { - return ( - - ); - } else { - return ( - - ); - } - } + const displayIndexPatternEditor = showCreateDialog ? ( + { + history.push(`patterns/${indexPattern.id}`); + }} + onCancel={() => setShowCreateDialog(false)} + defaultTypeIsRollup={isRollup} + /> + ) : ( + <> + ); return (
    @@ -214,6 +181,7 @@ export const IndexPatternTable = ({ canSave, history }: Props) => { sorting={sorting} search={search} /> + {displayIndexPatternEditor}
    ); }; diff --git a/src/plugins/index_pattern_management/public/components/utils.test.ts b/src/plugins/index_pattern_management/public/components/utils.test.ts index 15e0a65390f4d..6215a8dd15c4c 100644 --- a/src/plugins/index_pattern_management/public/components/utils.test.ts +++ b/src/plugins/index_pattern_management/public/components/utils.test.ts @@ -7,7 +7,6 @@ */ import { IndexPatternsContract } from 'src/plugins/data/public'; import { getIndexPatterns } from './utils'; -import { mockManagementPlugin } from '../mocks'; const indexPatternContractMock = ({ getIdsWithTitle: jest.fn().mockReturnValue( @@ -25,13 +24,7 @@ const indexPatternContractMock = ({ get: jest.fn().mockReturnValue(Promise.resolve({})), } as unknown) as jest.Mocked; -const mockManagementPluginStart = mockManagementPlugin.createStartContract(); - test('getting index patterns', async () => { - const indexPatterns = await getIndexPatterns( - 'test', - mockManagementPluginStart, - indexPatternContractMock - ); + const indexPatterns = await getIndexPatterns('test', indexPatternContractMock); expect(indexPatterns).toMatchSnapshot(); }); diff --git a/src/plugins/index_pattern_management/public/components/utils.ts b/src/plugins/index_pattern_management/public/components/utils.ts index 68e78199798b4..6520de95028c6 100644 --- a/src/plugins/index_pattern_management/public/components/utils.ts +++ b/src/plugins/index_pattern_management/public/components/utils.ts @@ -7,11 +7,29 @@ */ import { IndexPatternsContract } from 'src/plugins/data/public'; -import { IndexPatternManagementStart } from '../plugin'; +import { IndexPattern, IFieldType } from 'src/plugins/data/public'; +import { i18n } from '@kbn/i18n'; + +const defaultIndexPatternListName = i18n.translate( + 'indexPatternManagement.editIndexPattern.list.defaultIndexPatternListName', + { + defaultMessage: 'Default', + } +); + +const rollupIndexPatternListName = i18n.translate( + 'indexPatternManagement.editIndexPattern.list.rollupIndexPatternListName', + { + defaultMessage: 'Rollup', + } +); + +const isRollup = (indexPattern: IndexPattern) => { + return indexPattern.type === 'rollup'; +}; export async function getIndexPatterns( defaultIndex: string, - indexPatternManagementStart: IndexPatternManagementStart, indexPatternsService: IndexPatternsContract ) { const existingIndexPatterns = await indexPatternsService.getIdsWithTitle(true); @@ -19,10 +37,7 @@ export async function getIndexPatterns( existingIndexPatterns.map(async ({ id, title }) => { const isDefault = defaultIndex === id; const pattern = await indexPatternsService.get(id); - const tags = (indexPatternManagementStart as IndexPatternManagementStart).list.getIndexPatternTags( - pattern, - isDefault - ); + const tags = getTags(pattern, isDefault); return { id, @@ -49,3 +64,78 @@ export async function getIndexPatterns( }) || [] ); } + +export const getTags = (indexPattern: IndexPattern, isDefault: boolean) => { + const tags = []; + if (isDefault) { + tags.push({ + key: 'default', + name: defaultIndexPatternListName, + }); + } + if (isRollup(indexPattern)) { + tags.push({ + key: 'rollup', + name: rollupIndexPatternListName, + }); + } + return tags; +}; + +export const areScriptedFieldsEnabled = (indexPattern: IndexPattern) => { + return !isRollup(indexPattern); +}; + +export const getFieldInfo = (indexPattern: IndexPattern, field: IFieldType) => { + if (!isRollup(indexPattern)) { + return []; + } + + const allAggs = indexPattern.typeMeta && indexPattern.typeMeta.aggs; + const fieldAggs = allAggs && Object.keys(allAggs).filter((agg) => allAggs[agg][field.name]); + + if (!fieldAggs || !fieldAggs.length) { + return []; + } + + return ['Rollup aggregations:'].concat( + fieldAggs.map((aggName) => { + const agg = allAggs![aggName][field.name]; + switch (aggName) { + case 'date_histogram': + return i18n.translate( + 'indexPatternManagement.editIndexPattern.list.dateHistogramSummary', + { + defaultMessage: '{aggName} (interval: {interval}, {delay} {time_zone})', + values: { + aggName, + interval: agg.fixed_interval, + delay: agg.delay + ? i18n.translate( + 'indexPatternManagement.editIndexPattern.list.DateHistogramDelaySummary', + { + defaultMessage: 'delay: {delay},', + values: { + delay: agg.delay, + }, + } + ) + : '', + time_zone: agg.time_zone, + }, + } + ); + case 'histogram': + return i18n.translate('indexPatternManagement.editIndexPattern.list.histogramSummary', { + defaultMessage: '{aggName} (interval: {interval})', + values: { + aggName, + interval: agg.interval, + }, + }); + default: + return aggName; + } + }) + ); +}; diff --git a/src/plugins/index_pattern_management/public/index.ts b/src/plugins/index_pattern_management/public/index.ts index 726c055d1b8c3..45a2f0b5a468b 100644 --- a/src/plugins/index_pattern_management/public/index.ts +++ b/src/plugins/index_pattern_management/public/index.ts @@ -24,9 +24,3 @@ export { IndexPatternManagementSetup, IndexPatternManagementStart } from './plug export function plugin(initializerContext: PluginInitializerContext) { return new IndexPatternManagementPlugin(initializerContext); } - -export { - IndexPatternCreationConfig, - IndexPatternCreationOption, - IndexPatternListConfig, -} from './service'; diff --git a/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx b/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx index ec5b7c74020a5..e493595c848cf 100644 --- a/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx +++ b/src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx @@ -20,7 +20,6 @@ import { IndexPatternTableWithRouter, EditIndexPatternContainer, CreateEditFieldContainer, - CreateIndexPatternWizardWithRouter, } from '../components'; import { IndexPatternManagementStartDependencies, IndexPatternManagementStart } from '../plugin'; import { IndexPatternManagmentContext } from '../types'; @@ -41,7 +40,7 @@ export async function mountManagementSection( ) { const [ { chrome, application, uiSettings, notifications, overlays, http, docLinks }, - { data, indexPatternFieldEditor }, + { data, indexPatternFieldEditor, indexPatternEditor }, indexPatternManagementStart, ] = await getStartServices(); const canSave = Boolean(application.capabilities.indexPatterns.save); @@ -63,6 +62,7 @@ export async function mountManagementSection( indexPatternManagementStart: indexPatternManagementStart as IndexPatternManagementStart, setBreadcrumbs: params.setBreadcrumbs, fieldFormatEditors: indexPatternFieldEditor.fieldFormatEditors, + IndexPatternEditor: indexPatternEditor.IndexPatternEditorComponent, }; ReactDOM.render( @@ -71,7 +71,7 @@ export async function mountManagementSection( - + diff --git a/src/plugins/index_pattern_management/public/mocks.ts b/src/plugins/index_pattern_management/public/mocks.ts index 7671a532d1cb8..5bcca1f09029f 100644 --- a/src/plugins/index_pattern_management/public/mocks.ts +++ b/src/plugins/index_pattern_management/public/mocks.ts @@ -12,6 +12,7 @@ import { managementPluginMock } from '../../management/public/mocks'; import { urlForwardingPluginMock } from '../../url_forwarding/public/mocks'; import { dataPluginMock } from '../../data/public/mocks'; import { indexPatternFieldEditorPluginMock } from '../../index_pattern_field_editor/public/mocks'; +import { indexPatternEditorPluginMock } from '../../index_pattern_editor/public/mocks'; import { IndexPatternManagementSetup, IndexPatternManagementStart, @@ -19,19 +20,9 @@ import { } from './plugin'; import { IndexPatternManagmentContext } from './types'; -const createSetupContract = (): IndexPatternManagementSetup => {}; +const createSetupContract = (): IndexPatternManagementSetup => ({}); -const createStartContract = (): IndexPatternManagementStart => ({ - creation: { - getType: jest.fn(), - getIndexPatternCreationOptions: jest.fn(), - } as any, - list: { - getIndexPatternTags: jest.fn(), - getFieldInfo: jest.fn(), - areScriptedFieldsEnabled: jest.fn(), - } as any, -}); +const createStartContract = (): IndexPatternManagementStart => ({}); const createInstance = async () => { const plugin = new IndexPatternManagementPlugin({} as PluginInitializerContext); @@ -40,11 +31,7 @@ const createInstance = async () => { management: managementPluginMock.createSetupContract(), urlForwarding: urlForwardingPluginMock.createSetupContract(), }); - const doStart = () => - plugin.start(coreMock.createStart(), { - data: dataPluginMock.createStartContract(), - indexPatternFieldEditor: indexPatternFieldEditorPluginMock.createStartContract(), - }); + const doStart = () => plugin.start(); return { plugin, @@ -84,6 +71,8 @@ const createIndexPatternManagmentContext = (): { indexPatternManagementStart: createStartContract(), setBreadcrumbs: () => {}, fieldFormatEditors: indexPatternFieldEditor.fieldFormatEditors, + IndexPatternEditor: indexPatternEditorPluginMock.createStartContract() + .IndexPatternEditorComponent, }; }; diff --git a/src/plugins/index_pattern_management/public/plugin.ts b/src/plugins/index_pattern_management/public/plugin.ts index d254691a0270d..9527a04a6b0e2 100644 --- a/src/plugins/index_pattern_management/public/plugin.ts +++ b/src/plugins/index_pattern_management/public/plugin.ts @@ -7,17 +7,13 @@ */ import { i18n } from '@kbn/i18n'; -import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public'; +import { PluginInitializerContext, CoreSetup, Plugin } from 'src/core/public'; import { DataPublicPluginStart } from 'src/plugins/data/public'; import { UrlForwardingSetup } from '../../url_forwarding/public'; -import { - IndexPatternManagementService, - IndexPatternManagementServiceSetup, - IndexPatternManagementServiceStart, -} from './service'; import { ManagementSetup } from '../../management/public'; import { IndexPatternFieldEditorStart } from '../../index_pattern_field_editor/public'; +import { IndexPatternEditorStart } from '../../index_pattern_editor/public'; export interface IndexPatternManagementSetupDependencies { management: ManagementSetup; @@ -27,11 +23,14 @@ export interface IndexPatternManagementSetupDependencies { export interface IndexPatternManagementStartDependencies { data: DataPublicPluginStart; indexPatternFieldEditor: IndexPatternFieldEditorStart; + indexPatternEditor: IndexPatternEditorStart; } -export type IndexPatternManagementSetup = IndexPatternManagementServiceSetup; +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface IndexPatternManagementSetup {} -export type IndexPatternManagementStart = IndexPatternManagementServiceStart; +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface IndexPatternManagementStart {} const sectionsHeader = i18n.translate('indexPatternManagement.indexPattern.sectionsHeader', { defaultMessage: 'Index Patterns', @@ -47,8 +46,6 @@ export class IndexPatternManagementPlugin IndexPatternManagementSetupDependencies, IndexPatternManagementStartDependencies > { - private readonly indexPatternManagementService = new IndexPatternManagementService(); - constructor(initializerContext: PluginInitializerContext) {} public setup( @@ -80,16 +77,12 @@ export class IndexPatternManagementPlugin return mountManagementSection(core.getStartServices, params); }, }); + return {}; } - public start(core: CoreStart, plugins: IndexPatternManagementStartDependencies) { - return this.indexPatternManagementService.start({ - httpClient: core.http, - uiSettings: core.uiSettings, - }); + public start() { + return {}; } - public stop() { - this.indexPatternManagementService.stop(); - } + public stop() {} } diff --git a/src/plugins/index_pattern_management/public/service/creation/components/rollup_prompt/index.ts b/src/plugins/index_pattern_management/public/service/creation/components/rollup_prompt/index.ts deleted file mode 100644 index d1fc2fa242eb1..0000000000000 --- a/src/plugins/index_pattern_management/public/service/creation/components/rollup_prompt/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { RollupPrompt } from './rollup_prompt'; diff --git a/src/plugins/index_pattern_management/public/service/creation/components/rollup_prompt/rollup_prompt.tsx b/src/plugins/index_pattern_management/public/service/creation/components/rollup_prompt/rollup_prompt.tsx deleted file mode 100644 index 81fcdaedb90c9..0000000000000 --- a/src/plugins/index_pattern_management/public/service/creation/components/rollup_prompt/rollup_prompt.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { i18n } from '@kbn/i18n'; - -import { EuiCallOut } from '@elastic/eui'; - -export const RollupPrompt = () => ( - -

    - {i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.rollupPrompt.betaCalloutParagraph1Text', - { - defaultMessage: - "Kibana's support for rollup index patterns is in beta. You might encounter issues using " + - 'these patterns in saved searches, visualizations, and dashboards. They are not supported in ' + - 'some advanced features, such as Timelion, and Machine Learning.', - } - )} -

    -

    - {i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.rollupPrompt.betaCalloutParagraph2Text', - { - defaultMessage: - 'You can match a rollup index pattern against one rollup index and zero or more regular ' + - 'indices. A rollup index pattern has limited metrics, fields, intervals, and aggregations. A ' + - 'rollup index is limited to indices that have one job configuration, or multiple jobs with ' + - 'compatible configurations.', - } - )} -

    -
    -); diff --git a/src/plugins/index_pattern_management/public/service/creation/config.ts b/src/plugins/index_pattern_management/public/service/creation/config.ts deleted file mode 100644 index 6d7e3aa9e5ede..0000000000000 --- a/src/plugins/index_pattern_management/public/service/creation/config.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { i18n } from '@kbn/i18n'; -import { MatchedItem } from '../../components/create_index_pattern_wizard/types'; - -const indexPatternTypeName = i18n.translate( - 'indexPatternManagement.editIndexPattern.createIndex.defaultTypeName', - { defaultMessage: 'index pattern' } -); - -const indexPatternButtonText = i18n.translate( - 'indexPatternManagement.editIndexPattern.createIndex.defaultButtonText', - { defaultMessage: 'Standard index pattern' } -); - -const indexPatternButtonDescription = i18n.translate( - 'indexPatternManagement.editIndexPattern.createIndex.defaultButtonDescription', - { defaultMessage: 'Perform full aggregations against any data' } -); - -export type UrlHandler = (url: string) => void; - -export interface IndexPatternCreationOption { - text: string; - description: string; - testSubj: string; - onClick: () => void; - isBeta?: boolean; -} - -export class IndexPatternCreationConfig { - public readonly key = 'default'; - - protected type?: string; - protected name: string; - protected showSystemIndices: boolean; - protected httpClient: object | null; - protected isBeta: boolean; - - constructor({ - type = undefined, - name = indexPatternTypeName, - showSystemIndices = true, - httpClient = null, - isBeta = false, - }: { - type?: string; - name?: string; - showSystemIndices?: boolean; - httpClient?: object | null; - isBeta?: boolean; - }) { - this.type = type; - this.name = name; - this.showSystemIndices = showSystemIndices; - this.httpClient = httpClient; - this.isBeta = isBeta; - } - - public getIndexPatternCreationOption(urlHandler: UrlHandler): IndexPatternCreationOption { - return { - text: indexPatternButtonText, - description: indexPatternButtonDescription, - testSubj: `createStandardIndexPatternButton`, - onClick: () => { - urlHandler('/create'); - }, - }; - } - - public getIndexPatternType() { - return this.type; - } - - public getIndexPatternName() { - return this.name; - } - - public getIsBeta() { - return this.isBeta; - } - - public getShowSystemIndices() { - return this.showSystemIndices; - } - - public getIndexTags(indexName: string) { - return []; - } - - public checkIndicesForErrors(indices: MatchedItem[]) { - return undefined; - } - - public getIndexPatternMappings() { - return {}; - } - - public renderPrompt() { - return null; - } - - public getFetchForWildcardOptions() { - return {}; - } -} diff --git a/src/plugins/index_pattern_management/public/service/creation/index.ts b/src/plugins/index_pattern_management/public/service/creation/index.ts deleted file mode 100644 index e1f464b01e550..0000000000000 --- a/src/plugins/index_pattern_management/public/service/creation/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { IndexPatternCreationConfig, IndexPatternCreationOption } from './config'; -export { IndexPatternCreationManager } from './manager'; -// @ts-ignore -export { RollupIndexPatternCreationConfig } from './rollup_creation_config'; diff --git a/src/plugins/index_pattern_management/public/service/creation/manager.ts b/src/plugins/index_pattern_management/public/service/creation/manager.ts deleted file mode 100644 index cc2285bbfcafb..0000000000000 --- a/src/plugins/index_pattern_management/public/service/creation/manager.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { once } from 'lodash'; -import { HttpStart, CoreStart } from '../../../../../core/public'; -import { IndexPatternCreationConfig, UrlHandler, IndexPatternCreationOption } from './config'; -import { CONFIG_ROLLUPS } from '../../constants'; -// @ts-ignore -import { RollupIndexPatternCreationConfig } from './rollup_creation_config'; - -interface IndexPatternCreationManagerStart { - httpClient: HttpStart; - uiSettings: CoreStart['uiSettings']; -} - -export class IndexPatternCreationManager { - start({ httpClient, uiSettings }: IndexPatternCreationManagerStart) { - const getConfigs = once(() => { - const configs: IndexPatternCreationConfig[] = []; - configs.push(new IndexPatternCreationConfig({ httpClient })); - - if (uiSettings.isDeclared(CONFIG_ROLLUPS) && uiSettings.get(CONFIG_ROLLUPS)) { - configs.push(new RollupIndexPatternCreationConfig({ httpClient })); - } - - return configs; - }); - - const getType = (key: string | undefined): IndexPatternCreationConfig => { - const configs = getConfigs(); - if (key) { - const index = configs.findIndex((config) => config.key === key); - const config = configs[index]; - - if (config) { - return config; - } else { - throw new Error(`Index pattern creation type not found: ${key}`); - } - } else { - return getType('default'); - } - }; - - return { - getType, - getIndexPatternCreationOptions: async (urlHandler: UrlHandler) => { - const options: IndexPatternCreationOption[] = []; - - await Promise.all( - getConfigs().map(async (config) => { - const option = config.getIndexPatternCreationOption - ? await config.getIndexPatternCreationOption(urlHandler) - : null; - if (option) { - options.push(option); - } - }) - ); - - return options; - }, - }; - } -} diff --git a/src/plugins/index_pattern_management/public/service/creation/rollup_creation_config.js b/src/plugins/index_pattern_management/public/service/creation/rollup_creation_config.js deleted file mode 100644 index 2a85dfa01143c..0000000000000 --- a/src/plugins/index_pattern_management/public/service/creation/rollup_creation_config.js +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import { i18n } from '@kbn/i18n'; - -import { RollupPrompt } from './components/rollup_prompt'; -import { IndexPatternCreationConfig } from '.'; - -const rollupIndexPatternTypeName = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.defaultTypeName', - { defaultMessage: 'rollup index pattern' } -); - -const rollupIndexPatternButtonText = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.defaultButtonText', - { defaultMessage: 'Rollup index pattern' } -); - -const rollupIndexPatternButtonDescription = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.defaultButtonDescription', - { defaultMessage: 'Perform limited aggregations against summarized data' } -); - -const rollupIndexPatternNoMatchError = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.noMatchError', - { defaultMessage: 'Rollup index pattern error: must match one rollup index' } -); - -const rollupIndexPatternTooManyMatchesError = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.tooManyMatchesError', - { defaultMessage: 'Rollup index pattern error: can only match one rollup index' } -); - -const rollupIndexPatternIndexLabel = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.indexLabel', - { defaultMessage: 'Rollup' } -); - -export class RollupIndexPatternCreationConfig extends IndexPatternCreationConfig { - key = 'rollup'; - - constructor(options) { - super({ - type: 'rollup', - name: rollupIndexPatternTypeName, - showSystemIndices: false, - isBeta: true, - ...options, - }); - - this.rollupIndex = null; - this.rollupJobs = []; - this.rollupIndicesCapabilities = {}; - this.rollupIndices = []; - } - - async setRollupIndices() { - try { - // This is a hack intended to prevent the getRollupIndices() request from being sent if - // we're on /logout. There is a race condition that can arise on that page, whereby this - // request resolves after the logout request resolves, and un-clears the session ID. - const isAnonymous = this.httpClient.anonymousPaths.isAnonymous(window.location.pathname); - if (!isAnonymous) { - const response = await this.httpClient.get('/api/rollup/indices'); - this.rollupIndicesCapabilities = response || {}; - } - - this.rollupIndices = Object.keys(this.rollupIndicesCapabilities); - } catch (e) { - // Silently swallow failure responses such as expired trials - } - } - - async getIndexPatternCreationOption(urlHandler) { - await this.setRollupIndices(); - return this.rollupIndices && this.rollupIndices.length - ? { - text: rollupIndexPatternButtonText, - description: rollupIndexPatternButtonDescription, - testSubj: `createRollupIndexPatternButton`, - isBeta: this.isBeta, - onClick: () => { - urlHandler('/create?type=rollup'); - }, - } - : null; - } - - isRollupIndex = (indexName) => { - return this.rollupIndices.includes(indexName); - }; - - getIndexTags(indexName) { - return this.isRollupIndex(indexName) - ? [ - { - key: this.type, - name: rollupIndexPatternIndexLabel, - color: 'primary', - }, - ] - : []; - } - - checkIndicesForErrors = (indices) => { - this.rollupIndex = null; - - if (!indices || !indices.length) { - return; - } - - const rollupIndices = indices.filter((index) => this.isRollupIndex(index.name)); - - if (!rollupIndices.length) { - return [rollupIndexPatternNoMatchError]; - } else if (rollupIndices.length > 1) { - return [rollupIndexPatternTooManyMatchesError]; - } - - const rollupIndexName = rollupIndices[0].name; - const error = this.rollupIndicesCapabilities[rollupIndexName].error; - - if (error) { - const errorMessage = i18n.translate( - 'indexPatternManagement.editRollupIndexPattern.createIndex.uncaughtError', - { - defaultMessage: 'Rollup index pattern error: {error}', - values: { - error, - }, - } - ); - return [errorMessage]; - } - - this.rollupIndex = rollupIndexName; - }; - - getIndexPatternMappings = () => { - return this.rollupIndex - ? { - type: this.type, - typeMeta: { - params: { - rollup_index: this.rollupIndex, - }, - aggs: this.rollupIndicesCapabilities[this.rollupIndex].aggs, - }, - } - : {}; - }; - - renderPrompt = () => { - return ; - }; - - getFetchForWildcardOptions = () => { - return { - type: this.type, - rollupIndex: this.rollupIndex, - }; - }; -} diff --git a/src/plugins/index_pattern_management/public/service/index.ts b/src/plugins/index_pattern_management/public/service/index.ts deleted file mode 100644 index 8bf09cf544648..0000000000000 --- a/src/plugins/index_pattern_management/public/service/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export * from './index_pattern_management_service'; -export { IndexPatternCreationConfig, IndexPatternCreationOption } from './creation'; -export { IndexPatternListConfig } from './list'; diff --git a/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts b/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts deleted file mode 100644 index 25a36faa1c3e3..0000000000000 --- a/src/plugins/index_pattern_management/public/service/index_pattern_management_service.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { HttpStart, CoreStart } from '../../../../core/public'; -import { IndexPatternCreationManager } from './creation'; -import { IndexPatternListManager } from './list'; - -interface StartDependencies { - httpClient: HttpStart; - uiSettings: CoreStart['uiSettings']; -} - -/** - * Index patterns management service - * - * @internal - */ -export class IndexPatternManagementService { - indexPatternCreationManager: IndexPatternCreationManager; - indexPatternListConfig: IndexPatternListManager; - - constructor() { - this.indexPatternCreationManager = new IndexPatternCreationManager(); - this.indexPatternListConfig = new IndexPatternListManager(); - } - - public setup() {} - - public start({ httpClient, uiSettings }: StartDependencies) { - return { - creation: this.indexPatternCreationManager.start({ httpClient, uiSettings }), - list: this.indexPatternListConfig.start({ uiSettings }), - }; - } - - public stop() { - // nothing to do here yet. - } -} - -/** @internal */ -export type IndexPatternManagementServiceSetup = ReturnType; -export type IndexPatternManagementServiceStart = ReturnType; diff --git a/src/plugins/index_pattern_management/public/service/list/config.ts b/src/plugins/index_pattern_management/public/service/list/config.ts deleted file mode 100644 index 4be27fc47d0db..0000000000000 --- a/src/plugins/index_pattern_management/public/service/list/config.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { i18n } from '@kbn/i18n'; -import { IndexPattern, IndexPatternField, IndexPatternType } from '../../../../data/public'; - -export interface IndexPatternTag { - key: string; - name: string; -} - -const defaultIndexPatternListName = i18n.translate( - 'indexPatternManagement.editIndexPattern.list.defaultIndexPatternListName', - { - defaultMessage: 'Default', - } -); - -export class IndexPatternListConfig { - public readonly key: IndexPatternType = IndexPatternType.DEFAULT; - - public getIndexPatternTags(indexPattern: IndexPattern, isDefault: boolean): IndexPatternTag[] { - return isDefault - ? [ - { - key: 'default', - name: defaultIndexPatternListName, - }, - ] - : []; - } - - public getFieldInfo(indexPattern: IndexPattern, field: IndexPatternField): string[] { - return []; - } - - public areScriptedFieldsEnabled(indexPattern: IndexPattern): boolean { - return true; - } -} diff --git a/src/plugins/index_pattern_management/public/service/list/index.ts b/src/plugins/index_pattern_management/public/service/list/index.ts deleted file mode 100644 index 738b807ac7624..0000000000000 --- a/src/plugins/index_pattern_management/public/service/list/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { IndexPatternListConfig } from './config'; -export { IndexPatternListManager } from './manager'; -// @ts-ignore -export { RollupIndexPatternListConfig } from './rollup_list_config'; diff --git a/src/plugins/index_pattern_management/public/service/list/manager.ts b/src/plugins/index_pattern_management/public/service/list/manager.ts deleted file mode 100644 index d9cefbd8001a5..0000000000000 --- a/src/plugins/index_pattern_management/public/service/list/manager.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { IndexPattern, IndexPatternField } from 'src/plugins/data/public'; -import { once } from 'lodash'; -import { CoreStart } from '../../../../../core/public'; -import { IndexPatternListConfig, IndexPatternTag } from './config'; -import { CONFIG_ROLLUPS } from '../../constants'; -import { RollupIndexPatternListConfig } from './rollup_list_config'; - -interface IndexPatternListManagerStart { - uiSettings: CoreStart['uiSettings']; -} - -export class IndexPatternListManager { - start({ uiSettings }: IndexPatternListManagerStart) { - const getConfigs = once(() => { - const configs: IndexPatternListConfig[] = []; - configs.push(new IndexPatternListConfig()); - - if (uiSettings.isDeclared(CONFIG_ROLLUPS) && uiSettings.get(CONFIG_ROLLUPS)) { - configs.push(new RollupIndexPatternListConfig()); - } - - return configs; - }); - return { - getIndexPatternTags: (indexPattern: IndexPattern, isDefault: boolean) => - getConfigs().reduce( - (tags: IndexPatternTag[], config) => - config.getIndexPatternTags - ? tags.concat(config.getIndexPatternTags(indexPattern, isDefault)) - : tags, - [] - ), - - getFieldInfo: (indexPattern: IndexPattern, field: IndexPatternField): string[] => - getConfigs().reduce( - (info: string[], config) => - config.getFieldInfo ? info.concat(config.getFieldInfo(indexPattern, field)) : info, - [] - ), - - areScriptedFieldsEnabled: (indexPattern: IndexPattern): boolean => - getConfigs().every((config) => - config.areScriptedFieldsEnabled ? config.areScriptedFieldsEnabled(indexPattern) : true - ), - }; - } -} diff --git a/src/plugins/index_pattern_management/public/service/list/rollup_list_config.ts b/src/plugins/index_pattern_management/public/service/list/rollup_list_config.ts deleted file mode 100644 index bb9da0d461701..0000000000000 --- a/src/plugins/index_pattern_management/public/service/list/rollup_list_config.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { IndexPattern, IndexPatternField, IndexPatternType } from '../../../../data/public'; -import { IndexPatternListConfig } from '.'; - -function isRollup(indexPattern: IndexPattern) { - return indexPattern.type === IndexPatternType.ROLLUP; -} - -export class RollupIndexPatternListConfig extends IndexPatternListConfig { - key = IndexPatternType.ROLLUP; - - getIndexPatternTags = (indexPattern: IndexPattern) => { - return isRollup(indexPattern) - ? [ - { - key: 'rollup', - name: 'Rollup', - }, - ] - : []; - }; - - getFieldInfo = (indexPattern: IndexPattern, field: IndexPatternField) => { - if (!isRollup(indexPattern)) { - return []; - } - - const allAggs = indexPattern.typeMeta && indexPattern.typeMeta.aggs; - const fieldAggs = allAggs && Object.keys(allAggs).filter((agg) => allAggs[agg][field.name]); - - if (!fieldAggs || !fieldAggs.length) { - return []; - } - - return ['Rollup aggregations:'].concat( - fieldAggs.map((aggName) => { - const agg = allAggs![aggName][field.name]; - switch (aggName) { - case 'date_histogram': - return `${aggName} (interval: ${agg.fixed_interval}, ${ - agg.delay ? `delay: ${agg.delay},` : '' - } ${agg.time_zone})`; - case 'histogram': - return `${aggName} (interval: ${agg.interval})`; - default: - return aggName; - } - }) - ); - }; - - areScriptedFieldsEnabled = (indexPattern: IndexPattern) => { - return !isRollup(indexPattern); - }; -} diff --git a/src/plugins/index_pattern_management/public/types.ts b/src/plugins/index_pattern_management/public/types.ts index a61eeb99b25a5..b2c77fccf90b9 100644 --- a/src/plugins/index_pattern_management/public/types.ts +++ b/src/plugins/index_pattern_management/public/types.ts @@ -20,6 +20,7 @@ import { ManagementAppMountParams } from '../../management/public'; import { IndexPatternManagementStart } from './index'; import { KibanaReactContextValue } from '../../kibana_react/public'; import { IndexPatternFieldEditorStart } from '../../index_pattern_field_editor/public'; +import { IndexPatternEditorStart } from '../../index_pattern_editor/public'; export interface IndexPatternManagmentContext { chrome: ChromeStart; @@ -34,6 +35,7 @@ export interface IndexPatternManagmentContext { indexPatternManagementStart: IndexPatternManagementStart; setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; fieldFormatEditors: IndexPatternFieldEditorStart['fieldFormatEditors']; + IndexPatternEditor: IndexPatternEditorStart['IndexPatternEditorComponent']; } export type IndexPatternManagmentContextValue = KibanaReactContextValue; diff --git a/src/plugins/index_pattern_management/tsconfig.json b/src/plugins/index_pattern_management/tsconfig.json index 37bd3e4aa5bbb..16afcb3599fec 100644 --- a/src/plugins/index_pattern_management/tsconfig.json +++ b/src/plugins/index_pattern_management/tsconfig.json @@ -20,5 +20,6 @@ { "path": "../kibana_utils/tsconfig.json" }, { "path": "../es_ui_shared/tsconfig.json" }, { "path": "../index_pattern_field_editor/tsconfig.json" }, + { "path": "../index_pattern_editor/tsconfig.json" }, ] } diff --git a/src/plugins/user_setup/README.md b/src/plugins/interactive_setup/README.md similarity index 69% rename from src/plugins/user_setup/README.md rename to src/plugins/interactive_setup/README.md index 61ec964f5bb80..9fd43eb0445b6 100644 --- a/src/plugins/user_setup/README.md +++ b/src/plugins/interactive_setup/README.md @@ -1,3 +1,3 @@ -# `userSetup` plugin +# `interactiveSetup` plugin The plugin provides UI and APIs for the interactive setup mode. diff --git a/src/plugins/interactive_setup/common/elasticsearch_connection_status.ts b/src/plugins/interactive_setup/common/elasticsearch_connection_status.ts new file mode 100644 index 0000000000000..4e1506f69990c --- /dev/null +++ b/src/plugins/interactive_setup/common/elasticsearch_connection_status.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * Describes current status of the Elasticsearch connection. + */ +export enum ElasticsearchConnectionStatus { + /** + * Indicates that Kibana hasn't figured out yet if existing Elasticsearch connection configuration is valid. + */ + Unknown = 'unknown', + + /** + * Indicates that current Elasticsearch connection configuration valid and sufficient. + */ + Configured = 'configured', + + /** + * Indicates that current Elasticsearch connection configuration isn't valid or not sufficient. + */ + NotConfigured = 'not-configured', +} diff --git a/src/plugins/interactive_setup/common/index.ts b/src/plugins/interactive_setup/common/index.ts new file mode 100644 index 0000000000000..f736d1e230122 --- /dev/null +++ b/src/plugins/interactive_setup/common/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export type { InteractiveSetupViewState, EnrollmentToken } from './types'; +export { ElasticsearchConnectionStatus } from './elasticsearch_connection_status'; diff --git a/src/plugins/interactive_setup/common/types.ts b/src/plugins/interactive_setup/common/types.ts new file mode 100644 index 0000000000000..4df7c8eaa9724 --- /dev/null +++ b/src/plugins/interactive_setup/common/types.ts @@ -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 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 { ElasticsearchConnectionStatus } from './elasticsearch_connection_status'; + +/** + * A set of state details that interactive setup view retrieves from the Kibana server. + */ +export interface InteractiveSetupViewState { + /** + * Current status of the Elasticsearch connection. + */ + elasticsearchConnectionStatus: ElasticsearchConnectionStatus; +} + +/** + * The token that allows one to configure Kibana instance to communicate with an existing Elasticsearch cluster that + * has security features enabled. + */ +export interface EnrollmentToken { + /** + * The version of the Elasticsearch node that generated this enrollment token. + */ + ver: string; + + /** + * An array of addresses in the form of `:` or `:` where the Elasticsearch node is listening for HTTP connections. + */ + adr: readonly string[]; + + /** + * The SHA-256 fingerprint of the CA certificate that is used to sign the certificate that the Elasticsearch node presents for HTTP over TLS connections. + */ + fgr: string; + + /** + * An Elasticsearch API key (not encoded) that can be used as credentials authorized to call the enrollment related APIs in Elasticsearch. + */ + key: string; +} diff --git a/src/plugins/interactive_setup/jest.config.js b/src/plugins/interactive_setup/jest.config.js new file mode 100644 index 0000000000000..e9f1f479d66aa --- /dev/null +++ b/src/plugins/interactive_setup/jest.config.js @@ -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. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/src/plugins/interactive_setup'], +}; diff --git a/src/plugins/user_setup/kibana.json b/src/plugins/interactive_setup/kibana.json similarity index 74% rename from src/plugins/user_setup/kibana.json rename to src/plugins/interactive_setup/kibana.json index 192fd42cd3e26..10270bf5b2c03 100644 --- a/src/plugins/user_setup/kibana.json +++ b/src/plugins/interactive_setup/kibana.json @@ -1,5 +1,5 @@ { - "id": "userSetup", + "id": "interactiveSetup", "owner": { "name": "Platform Security", "githubTeam": "kibana-security" @@ -7,7 +7,8 @@ "description": "This plugin provides UI and APIs for the interactive setup mode.", "version": "8.0.0", "kibanaVersion": "kibana", - "configPath": ["userSetup"], + "type": "preboot", + "configPath": ["interactiveSetup"], "server": true, "ui": true } diff --git a/src/plugins/user_setup/public/app.tsx b/src/plugins/interactive_setup/public/app.tsx similarity index 100% rename from src/plugins/user_setup/public/app.tsx rename to src/plugins/interactive_setup/public/app.tsx diff --git a/src/plugins/user_setup/public/index.ts b/src/plugins/interactive_setup/public/index.ts similarity index 100% rename from src/plugins/user_setup/public/index.ts rename to src/plugins/interactive_setup/public/index.ts diff --git a/src/plugins/user_setup/public/plugin.tsx b/src/plugins/interactive_setup/public/plugin.tsx similarity index 92% rename from src/plugins/user_setup/public/plugin.tsx rename to src/plugins/interactive_setup/public/plugin.tsx index 677c27cc456dc..375f04e5047d5 100644 --- a/src/plugins/user_setup/public/plugin.tsx +++ b/src/plugins/interactive_setup/public/plugin.tsx @@ -10,13 +10,14 @@ import React from 'react'; import ReactDOM from 'react-dom'; import type { CoreSetup, CoreStart, Plugin } from 'src/core/public'; + import { App } from './app'; export class UserSetupPlugin implements Plugin { public setup(core: CoreSetup) { core.application.register({ - id: 'userSetup', - title: 'User Setup', + id: 'interactiveSetup', + title: 'Interactive Setup', chromeless: true, mount: (params) => { ReactDOM.render(, params.element); diff --git a/src/plugins/user_setup/server/config.ts b/src/plugins/interactive_setup/server/config.ts similarity index 100% rename from src/plugins/user_setup/server/config.ts rename to src/plugins/interactive_setup/server/config.ts diff --git a/src/plugins/user_setup/server/index.ts b/src/plugins/interactive_setup/server/index.ts similarity index 69% rename from src/plugins/user_setup/server/index.ts rename to src/plugins/interactive_setup/server/index.ts index 2a43cbbf65c9d..018c6875b3c04 100644 --- a/src/plugins/user_setup/server/index.ts +++ b/src/plugins/interactive_setup/server/index.ts @@ -7,7 +7,11 @@ */ import type { TypeOf } from '@kbn/config-schema'; -import type { PluginConfigDescriptor } from 'src/core/server'; +import type { + PluginConfigDescriptor, + PluginInitializer, + PluginInitializerContext, +} from 'src/core/server'; import { ConfigSchema } from './config'; import { UserSetupPlugin } from './plugin'; @@ -16,4 +20,6 @@ export const config: PluginConfigDescriptor> = { schema: ConfigSchema, }; -export const plugin = () => new UserSetupPlugin(); +export const plugin: PluginInitializer = ( + initializerContext: PluginInitializerContext +) => new UserSetupPlugin(initializerContext); diff --git a/src/plugins/interactive_setup/server/plugin.ts b/src/plugins/interactive_setup/server/plugin.ts new file mode 100644 index 0000000000000..6b2a12bad76bc --- /dev/null +++ b/src/plugins/interactive_setup/server/plugin.ts @@ -0,0 +1,119 @@ +/* + * 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 { Subscription } from 'rxjs'; + +import type { TypeOf } from '@kbn/config-schema'; +import type { CorePreboot, Logger, PluginInitializerContext, PrebootPlugin } from 'src/core/server'; + +import { ElasticsearchConnectionStatus } from '../common'; +import type { ConfigSchema, ConfigType } from './config'; +import { defineRoutes } from './routes'; + +export class UserSetupPlugin implements PrebootPlugin { + readonly #logger: Logger; + + #configSubscription?: Subscription; + #config?: ConfigType; + readonly #getConfig = () => { + if (!this.#config) { + throw new Error('Config is not available.'); + } + return this.#config; + }; + + #elasticsearchConnectionStatus = ElasticsearchConnectionStatus.Unknown; + readonly #getElasticsearchConnectionStatus = () => { + return this.#elasticsearchConnectionStatus; + }; + + constructor(private readonly initializerContext: PluginInitializerContext) { + this.#logger = this.initializerContext.logger.get(); + } + + public setup(core: CorePreboot) { + this.#configSubscription = this.initializerContext.config + .create>() + .subscribe((config) => { + this.#config = config; + }); + + // We shouldn't activate interactive setup mode if we detect that user has already configured + // Elasticsearch connection manually: either if Kibana system user credentials are specified or + // user specified non-default host for the Elasticsearch. + const shouldActiveSetupMode = + !core.elasticsearch.config.credentialsSpecified && + core.elasticsearch.config.hosts.length === 1 && + core.elasticsearch.config.hosts[0] === 'http://localhost:9200'; + if (!shouldActiveSetupMode) { + this.#logger.debug( + 'Interactive setup mode will not be activated since Elasticsearch connection is already configured.' + ); + return; + } + + let completeSetup: (result: { shouldReloadConfig: boolean }) => void; + core.preboot.holdSetupUntilResolved( + 'Validating Elasticsearch connection configuration…', + new Promise((resolve) => { + completeSetup = resolve; + }) + ); + + // If preliminary check above indicates that user didn't alter default Elasticsearch connection + // details, it doesn't mean Elasticsearch connection isn't configured. There is a chance that they + // already disabled security features in Elasticsearch and everything should work by default. + // We should check if we can connect to Elasticsearch with default configuration to know if we + // need to activate interactive setup. This check can take some time, so we should register our + // routes to let interactive setup UI to handle user requests until the check is complete. + core.elasticsearch + .createClient('ping') + .asInternalUser.ping() + .then( + (pingResponse) => { + if (pingResponse.body) { + this.#logger.debug( + 'Kibana is already properly configured to connect to Elasticsearch. Interactive setup mode will not be activated.' + ); + this.#elasticsearchConnectionStatus = ElasticsearchConnectionStatus.Configured; + completeSetup({ shouldReloadConfig: false }); + } else { + this.#logger.debug( + 'Kibana is not properly configured to connect to Elasticsearch. Interactive setup mode will be activated.' + ); + this.#elasticsearchConnectionStatus = ElasticsearchConnectionStatus.NotConfigured; + } + }, + () => { + // TODO: we should probably react differently to different errors. 401 - credentials aren't correct, etc. + // Do we want to constantly ping ES if interactive mode UI isn't active? Just in case user runs Kibana and then + // configure Elasticsearch so that it can eventually connect to it without any configuration changes? + this.#elasticsearchConnectionStatus = ElasticsearchConnectionStatus.NotConfigured; + } + ); + + core.http.registerRoutes('', (router) => { + defineRoutes({ + router, + basePath: core.http.basePath, + logger: this.#logger.get('routes'), + getConfig: this.#getConfig.bind(this), + getElasticsearchConnectionStatus: this.#getElasticsearchConnectionStatus.bind(this), + }); + }); + } + + public stop() { + this.#logger.debug('Stopping plugin'); + + if (this.#configSubscription) { + this.#configSubscription.unsubscribe(); + this.#configSubscription = undefined; + } + } +} diff --git a/src/plugins/interactive_setup/server/routes/enroll.ts b/src/plugins/interactive_setup/server/routes/enroll.ts new file mode 100644 index 0000000000000..a600d18109760 --- /dev/null +++ b/src/plugins/interactive_setup/server/routes/enroll.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { schema } from '@kbn/config-schema'; + +import type { RouteDefinitionParams } from './'; + +/** + * Defines routes to deal with Elasticsearch `enroll_kibana` APIs. + */ +export function defineEnrollRoutes({ router }: RouteDefinitionParams) { + router.post( + { + path: '/internal/interactive_setup/enroll', + validate: { + body: schema.object({ token: schema.string() }), + }, + options: { authRequired: false }, + }, + async (context, request, response) => { + return response.forbidden({ + body: { message: `API is not implemented yet.` }, + }); + } + ); +} diff --git a/src/plugins/interactive_setup/server/routes/index.ts b/src/plugins/interactive_setup/server/routes/index.ts new file mode 100644 index 0000000000000..0f14f5ffac8ec --- /dev/null +++ b/src/plugins/interactive_setup/server/routes/index.ts @@ -0,0 +1,28 @@ +/* + * 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 { IBasePath, IRouter, Logger } from 'src/core/server'; + +import type { ElasticsearchConnectionStatus } from '../../common'; +import type { ConfigType } from '../config'; +import { defineEnrollRoutes } from './enroll'; + +/** + * Describes parameters used to define HTTP routes. + */ +export interface RouteDefinitionParams { + readonly router: IRouter; + readonly basePath: IBasePath; + readonly logger: Logger; + readonly getConfig: () => ConfigType; + readonly getElasticsearchConnectionStatus: () => ElasticsearchConnectionStatus; +} + +export function defineRoutes(params: RouteDefinitionParams) { + defineEnrollRoutes(params); +} diff --git a/src/plugins/user_setup/tsconfig.json b/src/plugins/interactive_setup/tsconfig.json similarity index 81% rename from src/plugins/user_setup/tsconfig.json rename to src/plugins/interactive_setup/tsconfig.json index d211a70f12df3..530e01a034b00 100644 --- a/src/plugins/user_setup/tsconfig.json +++ b/src/plugins/interactive_setup/tsconfig.json @@ -7,6 +7,6 @@ "declaration": true, "declarationMap": true }, - "include": ["public/**/*", "server/**/*"], + "include": ["common/**/*", "public/**/*", "server/**/*"], "references": [{ "path": "../../core/tsconfig.json" }] } 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 ff7da1725fa7f..b797ea44d1f91 100644 --- a/src/plugins/kibana_react/public/code_editor/languages/index.ts +++ b/src/plugins/kibana_react/public/code_editor/languages/index.ts @@ -9,5 +9,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'; -export { CssLang, HandlebarsLang, MarkdownLang }; +export { CssLang, HandlebarsLang, MarkdownLang, YamlLang }; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts b/src/plugins/kibana_react/public/code_editor/languages/yaml/constants.ts similarity index 91% rename from src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts rename to src/plugins/kibana_react/public/code_editor/languages/yaml/constants.ts index 8f737b3a42613..71a34088a216b 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/index.ts +++ b/src/plugins/kibana_react/public/code_editor/languages/yaml/constants.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { Header } from './header'; +export const LANG = 'yaml'; diff --git a/src/plugins/kibana_react/public/code_editor/languages/yaml/index.ts b/src/plugins/kibana_react/public/code_editor/languages/yaml/index.ts new file mode 100644 index 0000000000000..f501de74debec --- /dev/null +++ b/src/plugins/kibana_react/public/code_editor/languages/yaml/index.ts @@ -0,0 +1,12 @@ +/* + * 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/yaml/language.ts b/src/plugins/kibana_react/public/code_editor/languages/yaml/language.ts new file mode 100644 index 0000000000000..d17f284b28408 --- /dev/null +++ b/src/plugins/kibana_react/public/code_editor/languages/yaml/language.ts @@ -0,0 +1,12 @@ +/* + * 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. + */ + +/* eslint-disable @kbn/eslint/module_migration */ +import { conf, language } from 'monaco-editor/esm/vs/basic-languages/yaml/yaml'; + +export { conf as languageConfiguration, language as lexerRules }; 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 b4a0f4d53cdf4..a32318a7e4b20 100644 --- a/src/plugins/kibana_react/public/code_editor/register_languages.ts +++ b/src/plugins/kibana_react/public/code_editor/register_languages.ts @@ -6,8 +6,9 @@ * Side Public License, v 1. */ import { registerLanguage } from '@kbn/monaco'; -import { CssLang, HandlebarsLang, MarkdownLang } from './languages'; +import { CssLang, HandlebarsLang, MarkdownLang, YamlLang } from './languages'; registerLanguage(CssLang); registerLanguage(HandlebarsLang); registerLanguage(MarkdownLang); +registerLanguage(YamlLang); diff --git a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx index 09554292072f9..4c96b45353cc9 100644 --- a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx +++ b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx @@ -50,7 +50,9 @@ export const OverviewPageFooter: FC = ({ iconType="home" size="xs" onClick={(event: MouseEvent) => { - application.navigateToUrl(addBasePath('/app/management/kibana/settings#defaultRoute')); + application.navigateToUrl( + addBasePath('/app/management/kibana/settings?query=default+route') + ); if (onChangeDefaultRoute) { onChangeDefaultRoute(event); } diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts index ace26dc9e6295..57c9893f0cfea 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts @@ -428,10 +428,6 @@ export const stackManagementSchema: MakeSchemaFrom = { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, }, - 'apm:enableServiceOverview': { - type: 'boolean', - _meta: { description: 'Non-default value of setting.' }, - }, 'observability:enableInspectEsQueries': { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts index 95faaee88fa61..52cf38d32c2e2 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts @@ -35,7 +35,6 @@ export interface UsageStats { 'discover:maxDocFieldsDisplayed': number; 'securitySolution:rulesTableRefresh': string; 'apm:enableSignificantTerms': boolean; - 'apm:enableServiceOverview': boolean; 'observability:enableInspectEsQueries': boolean; 'visualize:enableLabs': boolean; 'visualization:heatmap:maxBuckets': number; diff --git a/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/intro.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/intro.test.tsx.snap index 5a8cd06b8ecc0..9c9349b0524c0 100644 --- a/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/intro.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/object_view/components/__snapshots__/intro.test.tsx.snap @@ -59,6 +59,7 @@ exports[`Intro component renders correctly 1`] = ` >
    diff --git a/src/plugins/telemetry/common/constants.ts b/src/plugins/telemetry/common/constants.ts index 8aeb26e8253b6..f6b99badca492 100644 --- a/src/plugins/telemetry/common/constants.ts +++ b/src/plugins/telemetry/common/constants.ts @@ -49,3 +49,17 @@ export const PRIVACY_STATEMENT_URL = `https://www.elastic.co/legal/privacy-state * The endpoint version when hitting the remote telemetry service */ export const ENDPOINT_VERSION = 'v2'; + +/** + * The telemetry endpoints for the remote telemetry service. + */ +export const TELEMETRY_ENDPOINT = { + MAIN_CHANNEL: { + PROD: `https://telemetry.elastic.co/xpack/${ENDPOINT_VERSION}/send`, + STAGING: `https://telemetry-staging.elastic.co/xpack/${ENDPOINT_VERSION}/send`, + }, + OPT_IN_STATUS_CHANNEL: { + PROD: `https://telemetry.elastic.co/opt_in_status/${ENDPOINT_VERSION}/send`, + STAGING: `https://telemetry-staging.elastic.co/opt_in_status/${ENDPOINT_VERSION}/send`, + }, +}; diff --git a/src/plugins/telemetry/common/telemetry_config/get_telemetry_channel_endpoint.test.ts b/src/plugins/telemetry/common/telemetry_config/get_telemetry_channel_endpoint.test.ts new file mode 100644 index 0000000000000..74d45f6a9f7d4 --- /dev/null +++ b/src/plugins/telemetry/common/telemetry_config/get_telemetry_channel_endpoint.test.ts @@ -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 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 { getTelemetryChannelEndpoint } from './get_telemetry_channel_endpoint'; +import { TELEMETRY_ENDPOINT } from '../constants'; + +describe('getTelemetryChannelEndpoint', () => { + it('throws on unknown env', () => { + expect(() => + // @ts-expect-error + getTelemetryChannelEndpoint({ env: 'ANY', channelName: 'main' }) + ).toThrowErrorMatchingInlineSnapshot(`"Unknown telemetry endpoint env ANY."`); + }); + + it('throws on unknown channelName', () => { + expect(() => + // @ts-expect-error + getTelemetryChannelEndpoint({ env: 'prod', channelName: 'ANY' }) + ).toThrowErrorMatchingInlineSnapshot(`"Unknown telemetry channel ANY."`); + }); + + describe('main channel', () => { + it('returns correct prod endpoint', () => { + const endpoint = getTelemetryChannelEndpoint({ env: 'prod', channelName: 'main' }); + expect(endpoint).toBe(TELEMETRY_ENDPOINT.MAIN_CHANNEL.PROD); + }); + it('returns correct staging endpoint', () => { + const endpoint = getTelemetryChannelEndpoint({ env: 'staging', channelName: 'main' }); + expect(endpoint).toBe(TELEMETRY_ENDPOINT.MAIN_CHANNEL.STAGING); + }); + }); + + describe('optInStatus channel', () => { + it('returns correct prod endpoint', () => { + const endpoint = getTelemetryChannelEndpoint({ env: 'prod', channelName: 'optInStatus' }); + expect(endpoint).toBe(TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.PROD); + }); + it('returns correct staging endpoint', () => { + const endpoint = getTelemetryChannelEndpoint({ env: 'staging', channelName: 'optInStatus' }); + expect(endpoint).toBe(TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.STAGING); + }); + }); +}); diff --git a/src/plugins/telemetry/common/telemetry_config/get_telemetry_channel_endpoint.ts b/src/plugins/telemetry/common/telemetry_config/get_telemetry_channel_endpoint.ts new file mode 100644 index 0000000000000..a0af7878afef6 --- /dev/null +++ b/src/plugins/telemetry/common/telemetry_config/get_telemetry_channel_endpoint.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 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 { TELEMETRY_ENDPOINT } from '../constants'; + +export interface GetTelemetryChannelEndpointConfig { + channelName: 'main' | 'optInStatus'; + env: 'staging' | 'prod'; +} + +export function getTelemetryChannelEndpoint({ + channelName, + env, +}: GetTelemetryChannelEndpointConfig): string { + if (env !== 'staging' && env !== 'prod') { + throw new Error(`Unknown telemetry endpoint env ${env}.`); + } + + const endpointEnv = env === 'staging' ? 'STAGING' : 'PROD'; + + switch (channelName) { + case 'main': + return TELEMETRY_ENDPOINT.MAIN_CHANNEL[endpointEnv]; + case 'optInStatus': + return TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL[endpointEnv]; + default: + throw new Error(`Unknown telemetry channel ${channelName}.`); + } +} diff --git a/src/plugins/telemetry/common/telemetry_config/index.ts b/src/plugins/telemetry/common/telemetry_config/index.ts index cc4ff102742d7..eb268639cad91 100644 --- a/src/plugins/telemetry/common/telemetry_config/index.ts +++ b/src/plugins/telemetry/common/telemetry_config/index.ts @@ -11,3 +11,5 @@ export { getTelemetrySendUsageFrom } from './get_telemetry_send_usage_from'; export { getTelemetryAllowChangingOptInStatus } from './get_telemetry_allow_changing_opt_in_status'; export { getTelemetryFailureDetails } from './get_telemetry_failure_details'; export type { TelemetryFailureDetails } from './get_telemetry_failure_details'; +export { getTelemetryChannelEndpoint } from './get_telemetry_channel_endpoint'; +export type { GetTelemetryChannelEndpointConfig } from './get_telemetry_channel_endpoint'; diff --git a/src/plugins/telemetry/public/mocks.ts b/src/plugins/telemetry/public/mocks.ts index 418aeace77c70..405c6620e802a 100644 --- a/src/plugins/telemetry/public/mocks.ts +++ b/src/plugins/telemetry/public/mocks.ts @@ -34,8 +34,7 @@ export function mockTelemetryService({ }: TelemetryServiceMockOptions = {}) { const config = { enabled: true, - url: 'http://localhost', - optInStatusUrl: 'http://localhost', + sendUsageTo: 'staging' as const, sendUsageFrom: 'browser' as const, optIn: true, banner: true, diff --git a/src/plugins/telemetry/public/plugin.ts b/src/plugins/telemetry/public/plugin.ts index 04fabe3d62b17..73dc07d7a4fb9 100644 --- a/src/plugins/telemetry/public/plugin.ts +++ b/src/plugins/telemetry/public/plugin.ts @@ -90,16 +90,14 @@ interface TelemetryPluginSetupDependencies { export interface TelemetryPluginConfig { /** Is the plugin enabled? **/ enabled: boolean; - /** Remote telemetry service's URL **/ - url: string; /** The banner is expected to be shown when needed **/ banner: boolean; /** Does the cluster allow changing the opt-in/out status via the UI? **/ allowChangingOptInStatus: boolean; /** Is the cluster opted-in? **/ optIn: boolean | null; - /** Opt-in/out notification URL **/ - optInStatusUrl: string; + /** Specify if telemetry should send usage to the prod or staging remote telemetry service **/ + sendUsageTo: 'prod' | 'staging'; /** Should the telemetry payloads be sent from the server or the browser? **/ sendUsageFrom: 'browser' | 'server'; /** Should notify the user about the opt-in status? **/ diff --git a/src/plugins/telemetry/public/services/telemetry_service.test.ts b/src/plugins/telemetry/public/services/telemetry_service.test.ts index 94630c0cb8d80..b23ba127c1522 100644 --- a/src/plugins/telemetry/public/services/telemetry_service.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_service.test.ts @@ -10,7 +10,7 @@ /* eslint-disable dot-notation */ import { mockTelemetryService } from '../mocks'; - +import { TELEMETRY_ENDPOINT } from '../../common/constants'; describe('TelemetryService', () => { describe('fetchTelemetry', () => { it('calls expected URL with 20 minutes - now', async () => { @@ -137,13 +137,42 @@ describe('TelemetryService', () => { }); describe('getTelemetryUrl', () => { - it('should return the config.url parameter', async () => { - const url = 'http://test.com'; + it('should return staging endpoint when sendUsageTo is set to staging', async () => { + const telemetryService = mockTelemetryService({ + config: { sendUsageTo: 'staging' }, + }); + + expect(telemetryService.getTelemetryUrl()).toBe(TELEMETRY_ENDPOINT.MAIN_CHANNEL.STAGING); + }); + + it('should return prod endpoint when sendUsageTo is set to prod', async () => { + const telemetryService = mockTelemetryService({ + config: { sendUsageTo: 'prod' }, + }); + + expect(telemetryService.getTelemetryUrl()).toBe(TELEMETRY_ENDPOINT.MAIN_CHANNEL.PROD); + }); + }); + + describe('getOptInStatusUrl', () => { + it('should return staging endpoint when sendUsageTo is set to staging', async () => { + const telemetryService = mockTelemetryService({ + config: { sendUsageTo: 'staging' }, + }); + + expect(telemetryService.getOptInStatusUrl()).toBe( + TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.STAGING + ); + }); + + it('should return prod endpoint when sendUsageTo is set to prod', async () => { const telemetryService = mockTelemetryService({ - config: { url }, + config: { sendUsageTo: 'prod' }, }); - expect(telemetryService.getTelemetryUrl()).toBe(url); + expect(telemetryService.getOptInStatusUrl()).toBe( + TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.PROD + ); }); }); diff --git a/src/plugins/telemetry/public/services/telemetry_service.ts b/src/plugins/telemetry/public/services/telemetry_service.ts index 515d2039a4a11..4e52ec3a7e6ed 100644 --- a/src/plugins/telemetry/public/services/telemetry_service.ts +++ b/src/plugins/telemetry/public/services/telemetry_service.ts @@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n'; import { CoreStart } from 'kibana/public'; import { TelemetryPluginConfig } from '../plugin'; +import { getTelemetryChannelEndpoint } from '../../common/telemetry_config'; interface TelemetryServiceConstructor { config: TelemetryPluginConfig; @@ -93,14 +94,14 @@ export class TelemetryService { /** Retrieve the opt-in/out notification URL **/ public getOptInStatusUrl = () => { - const telemetryOptInStatusUrl = this.config.optInStatusUrl; - return telemetryOptInStatusUrl; + const { sendUsageTo } = this.config; + return getTelemetryChannelEndpoint({ channelName: 'optInStatus', env: sendUsageTo }); }; /** Retrieve the URL to report telemetry **/ public getTelemetryUrl = () => { - const telemetryUrl = this.config.url; - return telemetryUrl; + const { sendUsageTo } = this.config; + return getTelemetryChannelEndpoint({ channelName: 'main', env: sendUsageTo }); }; /** diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 6947b6cc3ce38..3fceb7913eae6 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -7783,12 +7783,6 @@ "description": "Non-default value of setting." } }, - "apm:enableServiceOverview": { - "type": "boolean", - "_meta": { - "description": "Non-default value of setting." - } - }, "observability:enableInspectEsQueries": { "type": "boolean", "_meta": { @@ -9336,4 +9330,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/plugins/telemetry/server/config.ts b/src/plugins/telemetry/server/config/config.ts similarity index 50% rename from src/plugins/telemetry/server/config.ts rename to src/plugins/telemetry/server/config/config.ts index 8123ae4c66e3c..8d75f0aba1726 100644 --- a/src/plugins/telemetry/server/config.ts +++ b/src/plugins/telemetry/server/config/config.ts @@ -6,11 +6,18 @@ * Side Public License, v 1. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import { schema, TypeOf, Type } from '@kbn/config-schema'; import { getConfigPath } from '@kbn/utils'; -import { ENDPOINT_VERSION } from '../common/constants'; +import { PluginConfigDescriptor } from 'kibana/server'; +import { TELEMETRY_ENDPOINT } from '../../common/constants'; +import { deprecateEndpointConfigs } from './deprecations'; -export const configSchema = schema.object({ +const clusterEnvSchema: [Type<'prod'>, Type<'staging'>] = [ + schema.literal('prod'), + schema.literal('staging'), +]; + +const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: true }), allowChangingOptInStatus: schema.boolean({ defaultValue: true }), optIn: schema.conditional( @@ -23,24 +30,38 @@ export const configSchema = schema.object({ // `config` is used internally and not intended to be set config: schema.string({ defaultValue: getConfigPath() }), banner: schema.boolean({ defaultValue: true }), + sendUsageTo: schema.conditional( + schema.contextRef('dist'), + schema.literal(false), // Point to staging if it's not a distributable release + schema.oneOf(clusterEnvSchema, { defaultValue: 'staging' }), + schema.oneOf(clusterEnvSchema, { defaultValue: 'prod' }) + ), + /** + * REMOVE IN 8.0 - INTERNAL CONFIG DEPRECATED IN 7.15 + * REPLACED WITH `telemetry.sendUsageTo: staging | prod` + */ url: schema.conditional( schema.contextRef('dist'), schema.literal(false), // Point to staging if it's not a distributable release schema.string({ - defaultValue: `https://telemetry-staging.elastic.co/xpack/${ENDPOINT_VERSION}/send`, + defaultValue: TELEMETRY_ENDPOINT.MAIN_CHANNEL.STAGING, }), schema.string({ - defaultValue: `https://telemetry.elastic.co/xpack/${ENDPOINT_VERSION}/send`, + defaultValue: TELEMETRY_ENDPOINT.MAIN_CHANNEL.PROD, }) ), + /** + * REMOVE IN 8.0 - INTERNAL CONFIG DEPRECATED IN 7.15 + * REPLACED WITH `telemetry.sendUsageTo: staging | prod` + */ optInStatusUrl: schema.conditional( schema.contextRef('dist'), schema.literal(false), // Point to staging if it's not a distributable release schema.string({ - defaultValue: `https://telemetry-staging.elastic.co/opt_in_status/${ENDPOINT_VERSION}/send`, + defaultValue: TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.STAGING, }), schema.string({ - defaultValue: `https://telemetry.elastic.co/opt_in_status/${ENDPOINT_VERSION}/send`, + defaultValue: TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.PROD, }) ), sendUsageFrom: schema.oneOf([schema.literal('server'), schema.literal('browser')], { @@ -49,3 +70,16 @@ export const configSchema = schema.object({ }); export type TelemetryConfigType = TypeOf; + +export const config: PluginConfigDescriptor = { + schema: configSchema, + exposeToBrowser: { + enabled: true, + banner: true, + allowChangingOptInStatus: true, + optIn: true, + sendUsageFrom: true, + sendUsageTo: true, + }, + deprecations: () => [deprecateEndpointConfigs], +}; diff --git a/src/plugins/telemetry/server/config/deprecations.test.ts b/src/plugins/telemetry/server/config/deprecations.test.ts new file mode 100644 index 0000000000000..0823b521b23a7 --- /dev/null +++ b/src/plugins/telemetry/server/config/deprecations.test.ts @@ -0,0 +1,164 @@ +/* + * 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 { deprecateEndpointConfigs } from './deprecations'; +import type { TelemetryConfigType } from './config'; +import { TELEMETRY_ENDPOINT } from '../../common/constants'; +describe('deprecateEndpointConfigs', () => { + const fromPath = 'telemetry'; + const mockAddDeprecation = jest.fn(); + beforeEach(() => { + jest.clearAllMocks(); + }); + + function createMockRawConfig(telemetryConfig?: Partial) { + return { + elasticsearch: { username: 'kibana_system', password: 'changeme' }, + plugins: { paths: [] }, + server: { port: 5603, basePath: '/hln', rewriteBasePath: true }, + logging: { json: false }, + ...(telemetryConfig ? { telemetry: telemetryConfig } : {}), + }; + } + + it('returns void if telemetry.* config is not set', () => { + const rawConfig = createMockRawConfig(); + const result = deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(result).toBe(undefined); + }); + + it('sets "telemetryConfig.sendUsageTo: staging" if "telemetry.url" uses the staging endpoint', () => { + const rawConfig = createMockRawConfig({ + url: TELEMETRY_ENDPOINT.MAIN_CHANNEL.STAGING, + }); + const result = deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(result).toMatchInlineSnapshot(` + Object { + "set": Array [ + Object { + "path": "telemetry.sendUsageTo", + "value": "staging", + }, + ], + "unset": Array [ + Object { + "path": "telemetry.url", + }, + ], + } + `); + }); + + it('sets "telemetryConfig.sendUsageTo: prod" if "telemetry.url" uses the non-staging endpoint', () => { + const rawConfig = createMockRawConfig({ + url: 'random-endpoint', + }); + const result = deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(result).toMatchInlineSnapshot(` + Object { + "set": Array [ + Object { + "path": "telemetry.sendUsageTo", + "value": "prod", + }, + ], + "unset": Array [ + Object { + "path": "telemetry.url", + }, + ], + } + `); + }); + + it('sets "telemetryConfig.sendUsageTo: staging" if "telemetry.optInStatusUrl" uses the staging endpoint', () => { + const rawConfig = createMockRawConfig({ + optInStatusUrl: TELEMETRY_ENDPOINT.MAIN_CHANNEL.STAGING, + }); + const result = deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(result).toMatchInlineSnapshot(` + Object { + "set": Array [ + Object { + "path": "telemetry.sendUsageTo", + "value": "staging", + }, + ], + "unset": Array [ + Object { + "path": "telemetry.optInStatusUrl", + }, + ], + } + `); + }); + + it('sets "telemetryConfig.sendUsageTo: prod" if "telemetry.optInStatusUrl" uses the non-staging endpoint', () => { + const rawConfig = createMockRawConfig({ + optInStatusUrl: 'random-endpoint', + }); + const result = deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(result).toMatchInlineSnapshot(` + Object { + "set": Array [ + Object { + "path": "telemetry.sendUsageTo", + "value": "prod", + }, + ], + "unset": Array [ + Object { + "path": "telemetry.optInStatusUrl", + }, + ], + } + `); + }); + + it('registers deprecation when "telemetry.url" is set', () => { + const rawConfig = createMockRawConfig({ + url: TELEMETRY_ENDPOINT.MAIN_CHANNEL.PROD, + }); + deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(mockAddDeprecation).toBeCalledTimes(1); + expect(mockAddDeprecation.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + Object { + "correctiveActions": Object { + "manualSteps": Array [ + "Remove \\"telemetry.url\\" from the Kibana configuration.", + "To send usage to the staging endpoint add \\"telemetry.sendUsageTo: staging\\" to the Kibana configuration.", + ], + }, + "message": "\\"telemetry.url\\" has been deprecated. Set \\"telemetry.sendUsageTo: staging\\" to the Kibana configurations to send usage to the staging endpoint.", + }, + ] + `); + }); + + it('registers deprecation when "telemetry.optInStatusUrl" is set', () => { + const rawConfig = createMockRawConfig({ + optInStatusUrl: 'random-endpoint', + }); + deprecateEndpointConfigs(rawConfig, fromPath, mockAddDeprecation); + expect(mockAddDeprecation).toBeCalledTimes(1); + expect(mockAddDeprecation.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + Object { + "correctiveActions": Object { + "manualSteps": Array [ + "Remove \\"telemetry.optInStatusUrl\\" from the Kibana configuration.", + "To send usage to the staging endpoint add \\"telemetry.sendUsageTo: staging\\" to the Kibana configuration.", + ], + }, + "message": "\\"telemetry.optInStatusUrl\\" has been deprecated. Set \\"telemetry.sendUsageTo: staging\\" to the Kibana configurations to send usage to the staging endpoint.", + }, + ] + `); + }); +}); diff --git a/src/plugins/telemetry/server/config/deprecations.ts b/src/plugins/telemetry/server/config/deprecations.ts new file mode 100644 index 0000000000000..5507c3e1f6675 --- /dev/null +++ b/src/plugins/telemetry/server/config/deprecations.ts @@ -0,0 +1,63 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import type { ConfigDeprecation } from 'kibana/server'; +import type { TelemetryConfigType } from './config'; + +export const deprecateEndpointConfigs: ConfigDeprecation = ( + rawConfig, + fromPath, + addDeprecation +) => { + const telemetryConfig: TelemetryConfigType = rawConfig[fromPath]; + if (!telemetryConfig) { + return; + } + + const unset: Array<{ path: string }> = []; + const endpointConfigPaths = ['url', 'optInStatusUrl'] as const; + let useStaging = telemetryConfig.sendUsageTo === 'staging' ? true : false; + + for (const configPath of endpointConfigPaths) { + const configValue = telemetryConfig[configPath]; + const fullConfigPath = `telemetry.${configPath}`; + if (typeof configValue !== 'undefined') { + unset.push({ path: fullConfigPath }); + + if (/telemetry-staging\.elastic\.co/i.test(configValue)) { + useStaging = true; + } + + addDeprecation({ + message: i18n.translate('telemetry.endpointConfigs.deprecationMessage', { + defaultMessage: + '"{configPath}" has been deprecated. Set "telemetry.sendUsageTo: staging" to the Kibana configurations to send usage to the staging endpoint.', + values: { configPath: fullConfigPath }, + }), + correctiveActions: { + manualSteps: [ + i18n.translate('telemetry.endpointConfigs.deprecationManualStep1', { + defaultMessage: 'Remove "{configPath}" from the Kibana configuration.', + values: { configPath: fullConfigPath }, + }), + i18n.translate('telemetry.endpointConfigs.deprecationManualStep2', { + defaultMessage: + 'To send usage to the staging endpoint add "telemetry.sendUsageTo: staging" to the Kibana configuration.', + }), + ], + }, + }); + } + } + + return { + set: [{ path: 'telemetry.sendUsageTo', value: useStaging ? 'staging' : 'prod' }], + unset, + }; +}; diff --git a/src/plugins/telemetry/server/config/index.ts b/src/plugins/telemetry/server/config/index.ts new file mode 100644 index 0000000000000..19ccd73e17fcd --- /dev/null +++ b/src/plugins/telemetry/server/config/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { config } from './config'; +export type { TelemetryConfigType } from './config'; diff --git a/src/plugins/telemetry/server/fetcher.ts b/src/plugins/telemetry/server/fetcher.ts index fb188a2414b98..e15b5be2604ec 100644 --- a/src/plugins/telemetry/server/fetcher.ts +++ b/src/plugins/telemetry/server/fetcher.ts @@ -19,6 +19,7 @@ import { ICustomClusterClient, } from '../../../core/server'; import { + getTelemetryChannelEndpoint, getTelemetryOptIn, getTelemetrySendUsageFrom, getTelemetryFailureDetails, @@ -139,7 +140,10 @@ export class FetcherTask { const configTelemetrySendUsageFrom = config.sendUsageFrom; const allowChangingOptInStatus = config.allowChangingOptInStatus; const configTelemetryOptIn = typeof config.optIn === 'undefined' ? null : config.optIn; - const telemetryUrl = config.url; + const telemetryUrl = getTelemetryChannelEndpoint({ + channelName: 'main', + env: config.sendUsageTo, + }); const { failureCount, failureVersion } = getTelemetryFailureDetails({ telemetrySavedObject, }); @@ -208,17 +212,17 @@ export class FetcherTask { }); } - private async sendTelemetry(url: string, cluster: string): Promise { + private async sendTelemetry(telemetryUrl: string, cluster: string): Promise { this.logger.debug(`Sending usage stats.`); /** * send OPTIONS before sending usage data. * OPTIONS is less intrusive as it does not contain any payload and is used here to check if the endpoint is reachable. */ - await fetch(url, { + await fetch(telemetryUrl, { method: 'options', }); - await fetch(url, { + await fetch(telemetryUrl, { method: 'post', body: cluster, headers: { 'X-Elastic-Stack-Version': this.currentKibanaVersion }, diff --git a/src/plugins/telemetry/server/index.ts b/src/plugins/telemetry/server/index.ts index 530f7c499c3f2..6b56996c756aa 100644 --- a/src/plugins/telemetry/server/index.ts +++ b/src/plugins/telemetry/server/index.ts @@ -6,25 +6,13 @@ * Side Public License, v 1. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server'; +import type { PluginInitializerContext } from 'kibana/server'; +import type { TelemetryConfigType } from './config'; import { TelemetryPlugin } from './plugin'; -import { configSchema, TelemetryConfigType } from './config'; +export { config } from './config'; export type { TelemetryPluginSetup, TelemetryPluginStart } from './plugin'; -export const config: PluginConfigDescriptor = { - schema: configSchema, - exposeToBrowser: { - enabled: true, - url: true, - banner: true, - allowChangingOptInStatus: true, - optIn: true, - optInStatusUrl: true, - sendUsageFrom: true, - }, -}; - export const plugin = (initializerContext: PluginInitializerContext) => new TelemetryPlugin(initializerContext); export { getClusterUuids, getLocalStats } from './telemetry_collection'; diff --git a/src/plugins/telemetry/server/plugin.ts b/src/plugins/telemetry/server/plugin.ts index 40714bf4cf2be..d38f054a4402e 100644 --- a/src/plugins/telemetry/server/plugin.ts +++ b/src/plugins/telemetry/server/plugin.ts @@ -30,11 +30,11 @@ import { registerTelemetryUsageCollector, registerTelemetryPluginUsageCollector, } from './collectors'; -import { TelemetryConfigType } from './config'; +import type { TelemetryConfigType } from './config'; import { FetcherTask } from './fetcher'; import { handleOldSettings } from './handle_old_settings'; import { getTelemetrySavedObject } from './telemetry_repository'; -import { getTelemetryOptIn } from '../common/telemetry_config'; +import { getTelemetryOptIn, getTelemetryChannelEndpoint } from '../common/telemetry_config'; interface TelemetryPluginsDepsSetup { usageCollection: UsageCollectionSetup; @@ -117,8 +117,10 @@ export class TelemetryPlugin implements Plugin { - const config = await config$.pipe(take(1)).toPromise(); - return new URL(config.url); + const { sendUsageTo } = await config$.pipe(take(1)).toPromise(); + const telemetryUrl = getTelemetryChannelEndpoint({ env: sendUsageTo, channelName: 'main' }); + + return new URL(telemetryUrl); }, }; } diff --git a/src/plugins/telemetry/server/routes/telemetry_opt_in.ts b/src/plugins/telemetry/server/routes/telemetry_opt_in.ts index 196631f33384d..e3fad0642303c 100644 --- a/src/plugins/telemetry/server/routes/telemetry_opt_in.ts +++ b/src/plugins/telemetry/server/routes/telemetry_opt_in.ts @@ -83,15 +83,15 @@ export function registerTelemetryOptInRoutes({ ); if (config.sendUsageFrom === 'server') { - const optInStatusUrl = config.optInStatusUrl; + const { sendUsageTo } = config; sendTelemetryOptInStatus( telemetryCollectionManager, - { optInStatusUrl, newOptInStatus, currentKibanaVersion }, + { sendUsageTo, newOptInStatus, currentKibanaVersion }, statsGetterConfig ).catch((err) => { // The server is likely behind a firewall and can't reach the remote service logger.warn( - `Failed to notify "${optInStatusUrl}" from the server about the opt-in selection. Possibly blocked by a firewall? - Error: ${err.message}` + `Failed to notify the telemetry endpoint about the opt-in selection. Possibly blocked by a firewall? - Error: ${err.message}` ); }); } diff --git a/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.test.ts b/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.test.ts index 6660a36e76199..acc9a863af61b 100644 --- a/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.test.ts +++ b/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.test.ts @@ -10,30 +10,53 @@ jest.mock('node-fetch'); import fetch from 'node-fetch'; import { sendTelemetryOptInStatus } from './telemetry_opt_in_stats'; import { StatsGetterConfig } from 'src/plugins/telemetry_collection_manager/server'; - +import { TELEMETRY_ENDPOINT } from '../../common/constants'; describe('sendTelemetryOptInStatus', () => { + const mockStatsGetterConfig = { unencrypted: false } as StatsGetterConfig; + const mockTelemetryCollectionManager = { + getOptInStats: jest.fn().mockResolvedValue(['mock_opt_in_hashed_value']), + }; + + beforeEach(() => { + jest.clearAllMocks(); + }); + it('calls fetch with the opt in status returned from the telemetryCollectionManager', async () => { - const mockOptInStatus = ['mock_opt_in_hashed_value']; - const mockTelemetryCollectionManager = { - getOptInStats: jest.fn().mockResolvedValue(mockOptInStatus), - }; const mockConfig = { - optInStatusUrl: 'some_url', + sendUsageTo: 'prod' as const, newOptInStatus: true, currentKibanaVersion: 'mock_kibana_version', }; - const mockStatsGetterConfig = { - unencrypted: false, - }; const result = await sendTelemetryOptInStatus( mockTelemetryCollectionManager, mockConfig, - mockStatsGetterConfig as StatsGetterConfig + mockStatsGetterConfig ); expect(result).toBeUndefined(); expect(fetch).toBeCalledTimes(1); - expect(fetch).toBeCalledWith(mockConfig.optInStatusUrl, { + expect(fetch).toBeCalledWith(TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.PROD, { + method: 'post', + body: '["mock_opt_in_hashed_value"]', + headers: { 'X-Elastic-Stack-Version': mockConfig.currentKibanaVersion }, + }); + }); + + it('sends to staging endpoint on "sendUsageTo: staging"', async () => { + const mockConfig = { + sendUsageTo: 'staging' as const, + newOptInStatus: true, + currentKibanaVersion: 'mock_kibana_version', + }; + + await sendTelemetryOptInStatus( + mockTelemetryCollectionManager, + mockConfig, + mockStatsGetterConfig + ); + + expect(fetch).toBeCalledTimes(1); + expect(fetch).toBeCalledWith(TELEMETRY_ENDPOINT.OPT_IN_STATUS_CHANNEL.STAGING, { method: 'post', body: '["mock_opt_in_hashed_value"]', headers: { 'X-Elastic-Stack-Version': mockConfig.currentKibanaVersion }, diff --git a/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.ts b/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.ts index 77ec981d4c35b..f6b7eddcbe765 100644 --- a/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.ts +++ b/src/plugins/telemetry/server/routes/telemetry_opt_in_stats.ts @@ -14,9 +14,10 @@ import { TelemetryCollectionManagerPluginSetup, StatsGetterConfig, } from 'src/plugins/telemetry_collection_manager/server'; +import { getTelemetryChannelEndpoint } from '../../common/telemetry_config'; interface SendTelemetryOptInStatusConfig { - optInStatusUrl: string; + sendUsageTo: 'staging' | 'prod'; newOptInStatus: boolean; currentKibanaVersion: string; } @@ -26,7 +27,12 @@ export async function sendTelemetryOptInStatus( config: SendTelemetryOptInStatusConfig, statsGetterConfig: StatsGetterConfig ) { - const { optInStatusUrl, newOptInStatus, currentKibanaVersion } = config; + const { sendUsageTo, newOptInStatus, currentKibanaVersion } = config; + const optInStatusUrl = getTelemetryChannelEndpoint({ + env: sendUsageTo, + channelName: 'optInStatus', + }); + const optInStatus = await telemetryCollectionManager.getOptInStats( newOptInStatus, statsGetterConfig diff --git a/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap b/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap index 014142a2a3d06..7c9154cba4f88 100644 --- a/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap +++ b/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap @@ -311,9 +311,8 @@ exports[`TelemetryManagementSectionComponent renders null because allowChangingO "banner": true, "enabled": true, "optIn": true, - "optInStatusUrl": "", "sendUsageFrom": "browser", - "url": "", + "sendUsageTo": "staging", }, "fetchExample": [Function], "fetchTelemetry": [Function], diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx index fe6f8e254142b..b8332317e6b68 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx @@ -24,12 +24,11 @@ describe('TelemetryManagementSectionComponent', () => { const isSecurityExampleEnabled = jest.fn().mockReturnValue(true); const telemetryService = new TelemetryService({ config: { + sendUsageTo: 'staging', enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: true, - optInStatusUrl: '', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -60,12 +59,11 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: false, - optInStatusUrl: '', sendUsageFrom: 'browser', + sendUsageTo: 'staging', }, isScreenshotMode: false, reportOptInStatusChange: false, @@ -116,11 +114,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: false, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -165,11 +162,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: false, optIn: true, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -205,11 +201,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: false, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -246,11 +241,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: false, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -287,11 +281,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: false, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -328,11 +321,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: true, optIn: false, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, @@ -379,11 +371,10 @@ describe('TelemetryManagementSectionComponent', () => { const telemetryService = new TelemetryService({ config: { enabled: true, - url: '', banner: true, allowChangingOptInStatus: false, optIn: false, - optInStatusUrl: '', + sendUsageTo: 'staging', sendUsageFrom: 'browser', }, isScreenshotMode: false, diff --git a/src/plugins/telemetry_management_section/public/plugin.tsx b/src/plugins/telemetry_management_section/public/plugin.tsx index 24583260329a6..2e3b1beb64d3c 100644 --- a/src/plugins/telemetry_management_section/public/plugin.tsx +++ b/src/plugins/telemetry_management_section/public/plugin.tsx @@ -17,17 +17,6 @@ import { TelemetryManagementSectionWrapperProps, } from './components/telemetry_management_section_wrapper'; -export interface TelemetryPluginConfig { - enabled: boolean; - url: string; - banner: boolean; - allowChangingOptInStatus: boolean; - optIn: boolean | null; - optInStatusUrl: string; - sendUsageFrom: 'browser' | 'server'; - telemetryNotifyUserAboutOptInDefault?: boolean; -} - export interface TelemetryManagementSectionPluginDepsSetup { telemetry: TelemetryPluginSetup; advancedSettings: AdvancedSettingsSetup; diff --git a/src/plugins/vis_default_editor/kibana.json b/src/plugins/vis_default_editor/kibana.json index c89e5ec1abaff..93a5afed6a92e 100644 --- a/src/plugins/vis_default_editor/kibana.json +++ b/src/plugins/vis_default_editor/kibana.json @@ -3,7 +3,7 @@ "version": "kibana", "ui": true, "optionalPlugins": ["visualize"], - "requiredBundles": ["kibanaUtils", "kibanaReact", "data"], + "requiredBundles": ["kibanaUtils", "kibanaReact", "data", "fieldFormats"], "owner": { "name": "Kibana App", "githubTeam": "kibana-app" diff --git a/src/plugins/vis_default_editor/public/components/options/percentage_mode.tsx b/src/plugins/vis_default_editor/public/components/options/percentage_mode.tsx index 542055d185ec5..74f254c6176bc 100644 --- a/src/plugins/vis_default_editor/public/components/options/percentage_mode.tsx +++ b/src/plugins/vis_default_editor/public/components/options/percentage_mode.tsx @@ -12,7 +12,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFieldText, EuiFormRow, EuiLink } from '@elastic/eui'; import { SwitchOption } from './switch'; import { useKibana } from '../../../../kibana_react/public'; -import { UI_SETTINGS } from '../../../../data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../field_formats/common'; export interface PercentageModeOptionProps { setValue: ( @@ -31,7 +31,9 @@ function PercentageModeOption({ formatPattern, }: PercentageModeOptionProps) { const { services } = useKibana(); - const defaultPattern = services.uiSettings?.get(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN); + const defaultPattern = services.uiSettings?.get( + FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN + ); return ( <> diff --git a/src/plugins/vis_default_editor/tsconfig.json b/src/plugins/vis_default_editor/tsconfig.json index 27bb775c2d0e8..34003bced5ad0 100644 --- a/src/plugins/vis_default_editor/tsconfig.json +++ b/src/plugins/vis_default_editor/tsconfig.json @@ -16,5 +16,6 @@ { "path": "../visualize/tsconfig.json" }, { "path": "../kibana_utils/tsconfig.json" }, { "path": "../kibana_react/tsconfig.json" }, + { "path": "../field_formats/tsconfig.json" } ] } diff --git a/src/plugins/vis_type_metric/public/components/metric_vis_component.tsx b/src/plugins/vis_type_metric/public/components/metric_vis_component.tsx index 66be8febc496f..87ca902f6c090 100644 --- a/src/plugins/vis_type_metric/public/components/metric_vis_component.tsx +++ b/src/plugins/vis_type_metric/public/components/metric_vis_component.tsx @@ -11,7 +11,7 @@ import React, { Component } from 'react'; import { isColorDark } from '@elastic/eui'; import { MetricVisValue } from './metric_vis_value'; import { Input } from '../metric_vis_fn'; -import { FieldFormatsContentType, IFieldFormat } from '../../../data/public'; +import type { FieldFormatsContentType, IFieldFormat } from '../../../field_formats/common'; import { Datatable } from '../../../expressions/public'; import { getHeatmapColors } from '../../../charts/public'; import { VisParams, MetricVisMetric } from '../types'; diff --git a/src/plugins/vis_type_metric/tsconfig.json b/src/plugins/vis_type_metric/tsconfig.json index 7441848d5a430..bee666a5906cd 100644 --- a/src/plugins/vis_type_metric/tsconfig.json +++ b/src/plugins/vis_type_metric/tsconfig.json @@ -15,6 +15,7 @@ { "path": "../charts/tsconfig.json" }, { "path": "../expressions/tsconfig.json" }, { "path": "../kibana_utils/tsconfig.json" }, - { "path": "../vis_default_editor/tsconfig.json" } + { "path": "../vis_default_editor/tsconfig.json" }, + { "path": "../field_formats/tsconfig.json" } ] } diff --git a/src/plugins/vis_type_pie/public/pie_component.tsx b/src/plugins/vis_type_pie/public/pie_component.tsx index b79eed2087a16..c0f4a8a6112f8 100644 --- a/src/plugins/vis_type_pie/public/pie_component.tsx +++ b/src/plugins/vis_type_pie/public/pie_component.tsx @@ -26,7 +26,8 @@ import { ChartsPluginSetup, PaletteRegistry, } from '../../charts/public'; -import { DataPublicPluginStart, FieldFormat } from '../../data/public'; +import { DataPublicPluginStart } from '../../data/public'; +import type { FieldFormat } from '../../field_formats/common'; import type { PersistedState } from '../../visualizations/public'; import { Datatable, DatatableColumn, IInterpreterRenderHandlers } from '../../expressions/public'; import { DEFAULT_PERCENT_DECIMALS } from '../common'; diff --git a/src/plugins/vis_type_pie/public/utils/filter_helpers.ts b/src/plugins/vis_type_pie/public/utils/filter_helpers.ts index 251ff8acc698e..f1a4791821c12 100644 --- a/src/plugins/vis_type_pie/public/utils/filter_helpers.ts +++ b/src/plugins/vis_type_pie/public/utils/filter_helpers.ts @@ -8,7 +8,8 @@ import { LayerValue, SeriesIdentifier } from '@elastic/charts'; import { Datatable, DatatableColumn } from '../../../expressions/public'; -import { DataPublicPluginStart, FieldFormat } from '../../../data/public'; +import { DataPublicPluginStart } from '../../../data/public'; +import type { FieldFormat } from '../../../field_formats/common'; import { ClickTriggerEvent } from '../../../charts/public'; import { ValueClickContext } from '../../../embeddable/public'; import { BucketColumns } from '../types'; diff --git a/src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts b/src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts index e1029b11a7b75..5addae51dd011 100644 --- a/src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts +++ b/src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ import { AccessorFn } from '@elastic/charts'; -import { FieldFormatsStart } from '../../../data/public'; +import type { FieldFormatsStart } from '../../../field_formats/public'; import { DatatableColumn } from '../../../expressions/public'; import { Dimension } from '../types'; diff --git a/src/plugins/vis_type_pie/tsconfig.json b/src/plugins/vis_type_pie/tsconfig.json index f12db316f1972..69bd2855b9843 100644 --- a/src/plugins/vis_type_pie/tsconfig.json +++ b/src/plugins/vis_type_pie/tsconfig.json @@ -20,5 +20,6 @@ { "path": "../visualizations/tsconfig.json" }, { "path": "../usage_collection/tsconfig.json" }, { "path": "../vis_default_editor/tsconfig.json" }, + { "path": "../field_formats/tsconfig.json" } ] } \ No newline at end of file diff --git a/src/plugins/vis_type_table/public/legacy/agg_table/agg_table.test.js b/src/plugins/vis_type_table/public/legacy/agg_table/agg_table.test.js index cbc3db6585a7d..2f423538568bd 100644 --- a/src/plugins/vis_type_table/public/legacy/agg_table/agg_table.test.js +++ b/src/plugins/vis_type_table/public/legacy/agg_table/agg_table.test.js @@ -17,7 +17,7 @@ import { getFieldFormatsRegistry } from '../../../../data/public/test_utils'; import { coreMock } from '../../../../../core/public/mocks'; import { initAngularBootstrap } from '../../../../kibana_legacy/public/angular_bootstrap'; import { setUiSettings } from '../../../../data/public/services'; -import { UI_SETTINGS } from '../../../../data/public/'; +import { FORMATS_UI_SETTINGS } from '../../../../field_formats/common/'; import { CSV_SEPARATOR_SETTING, CSV_QUOTE_VALUES_SETTING } from '../../../../share/public'; import { setFormatService } from '../../services'; @@ -38,12 +38,12 @@ describe('Table Vis - AggTable Directive', function () { const defaultValues = { dateFormat: 'MMM D, YYYY @ HH:mm:ss.SSS', 'dateFormat:tz': 'UTC', - [UI_SETTINGS.SHORT_DOTS_ENABLE]: true, - [UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN]: '($0,0.[00])', - [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: '0,0.[000]', - [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0,0.[000]%', - [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: 'en', - [UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: {}, + [FORMATS_UI_SETTINGS.SHORT_DOTS_ENABLE]: true, + [FORMATS_UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN]: '($0,0.[00])', + [FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: '0,0.[000]', + [FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0,0.[000]%', + [FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: 'en', + [FORMATS_UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: {}, [CSV_SEPARATOR_SETTING]: ',', [CSV_QUOTE_VALUES_SETTING]: true, }; diff --git a/src/plugins/vis_type_table/public/types.ts b/src/plugins/vis_type_table/public/types.ts index 8f35909d3bfba..4df6f2b94e17b 100644 --- a/src/plugins/vis_type_table/public/types.ts +++ b/src/plugins/vis_type_table/public/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { IFieldFormat } from 'src/plugins/data/public'; +import type { IFieldFormat } from 'src/plugins/field_formats/common'; import { DatatableColumn, DatatableRow } from 'src/plugins/expressions'; import { ExpressionValueVisDimension } from 'src/plugins/visualizations/public'; import { TableVisParams } from '../common'; diff --git a/src/plugins/vis_type_table/public/utils/add_percentage_column.test.ts b/src/plugins/vis_type_table/public/utils/add_percentage_column.test.ts index 0280637acc099..51eef1446bac6 100644 --- a/src/plugins/vis_type_table/public/utils/add_percentage_column.test.ts +++ b/src/plugins/vis_type_table/public/utils/add_percentage_column.test.ts @@ -12,7 +12,7 @@ jest.mock('../services', () => ({ })), })); -import { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { TableContext } from '../types'; import { addPercentageColumn } from './add_percentage_column'; diff --git a/src/plugins/vis_type_table/tsconfig.json b/src/plugins/vis_type_table/tsconfig.json index ccff3c349cf21..50277d51e8748 100644 --- a/src/plugins/vis_type_table/tsconfig.json +++ b/src/plugins/vis_type_table/tsconfig.json @@ -24,5 +24,6 @@ { "path": "../kibana_legacy/tsconfig.json" }, { "path": "../kibana_react/tsconfig.json" }, { "path": "../vis_default_editor/tsconfig.json" }, + { "path": "../field_formats/tsconfig.json" } ] } diff --git a/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx b/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx index 40702c39deaf4..047de1bdb0708 100644 --- a/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx @@ -126,6 +126,7 @@ function TimelionInterval({ value, setValue, setValidity }: TimelionIntervalProp placeholder={i18n.translate('timelion.vis.selectIntervalPlaceholder', { defaultMessage: 'Select an interval', })} + data-test-subj="timelionIntervalComboBox" /> ); diff --git a/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx b/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx index 4690f4fe11e45..858ba0ad64add 100644 --- a/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_vis_component.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import React, { useEffect, useCallback, useMemo, useRef } from 'react'; +import React, { useCallback, useMemo, useRef } from 'react'; import { compact, last, map } from 'lodash'; import { Chart, @@ -14,13 +14,13 @@ import { Position, Axis, TooltipType, - PointerEvent, LegendPositionConfig, LayoutDirection, } from '@elastic/charts'; import { EuiTitle } from '@elastic/eui'; import { useKibana } from '../../../kibana_react/public'; +import { useActiveCursor } from '../../../charts/public'; import { AreaSeriesComponent, BarSeriesComponent } from './series'; @@ -33,7 +33,7 @@ import { } from '../helpers/panel_utils'; import { colors } from '../helpers/chart_constants'; -import { activeCursor$ } from '../helpers/active_cursor'; +import { getCharts } from '../helpers/plugin_services'; import type { Sheet } from '../helpers/timelion_request_handler'; import type { IInterpreterRenderHandlers } from '../../../expressions'; @@ -43,6 +43,15 @@ import type { Series } from '../helpers/timelion_request_handler'; import './timelion_vis.scss'; +declare global { + interface Window { + /** + * Flag used to enable debugState on elastic charts + */ + _echDebugStateFlag?: boolean; + } +} + interface TimelionVisComponentProps { interval: string; seriesList: Sheet; @@ -91,20 +100,14 @@ const TimelionVisComponent = ({ const kibana = useKibana(); const chartRef = useRef(null); const chart = seriesList.list; + const chartsService = getCharts(); - useEffect(() => { - const subscription = activeCursor$.subscribe((cursor: PointerEvent) => { - chartRef.current?.dispatchExternalPointerEvent(cursor); - }); - - return () => { - subscription.unsubscribe(); - }; - }, []); + const chartTheme = chartsService.theme.useChartsTheme(); + const chartBaseTheme = chartsService.theme.useChartsBaseTheme(); - const handleCursorUpdate = useCallback((cursor: PointerEvent) => { - activeCursor$.next(cursor); - }, []); + const handleCursorUpdate = useActiveCursor(chartsService.activeCursor, chartRef, { + isDateHistogram: true, + }); const brushEndListener = useCallback( ({ x }) => { @@ -174,7 +177,7 @@ const TimelionVisComponent = ({ }, [chart]); return ( -
    +
    {title && (

    {title}

    @@ -182,14 +185,15 @@ const TimelionVisComponent = ({ )} tickFormat(value), diff --git a/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts b/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts index 31ec504c3151b..58fcf510ff792 100644 --- a/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts +++ b/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts @@ -7,6 +7,7 @@ */ import type { IndexPatternsContract, ISearchStart } from 'src/plugins/data/public'; +import type { ChartsPluginStart } from 'src/plugins/charts/public'; import { createGetterSetter } from '../../../kibana_utils/public'; export const [getIndexPatterns, setIndexPatterns] = createGetterSetter( @@ -14,3 +15,5 @@ export const [getIndexPatterns, setIndexPatterns] = createGetterSetter('Search'); + +export const [getCharts, setCharts] = createGetterSetter('Charts'); diff --git a/src/plugins/vis_type_timelion/public/plugin.ts b/src/plugins/vis_type_timelion/public/plugin.ts index 93712ae4507fe..1784af4e77222 100644 --- a/src/plugins/vis_type_timelion/public/plugin.ts +++ b/src/plugins/vis_type_timelion/public/plugin.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { +import type { CoreSetup, CoreStart, Plugin, @@ -14,30 +14,29 @@ import { IUiSettingsClient, HttpSetup, } from 'kibana/public'; -import { Plugin as ExpressionsPlugin } from 'src/plugins/expressions/public'; -import { +import type { Plugin as ExpressionsPlugin } from 'src/plugins/expressions/public'; +import type { DataPublicPluginSetup, DataPublicPluginStart, TimefilterContract, } from 'src/plugins/data/public'; - -import { VisualizationsSetup } from '../../visualizations/public'; -import { ChartsPluginSetup } from '../../charts/public'; +import type { VisualizationsSetup } from 'src/plugins/visualizations/public'; +import type { ChartsPluginSetup, ChartsPluginStart } from 'src/plugins/charts/public'; import { getTimelionVisualizationConfig } from './timelion_vis_fn'; import { getTimelionVisDefinition } from './timelion_vis_type'; -import { setIndexPatterns, setDataSearch } from './helpers/plugin_services'; -import { ConfigSchema } from '../config'; +import { setIndexPatterns, setDataSearch, setCharts } from './helpers/plugin_services'; import { getArgValueSuggestions } from './helpers/arg_value_suggestions'; import { getTimelionVisRenderer } from './timelion_vis_renderer'; +import type { ConfigSchema } from '../config'; + /** @internal */ export interface TimelionVisDependencies extends Partial { uiSettings: IUiSettingsClient; http: HttpSetup; timefilter: TimefilterContract; - chartTheme: ChartsPluginSetup['theme']; } /** @internal */ @@ -51,6 +50,7 @@ export interface TimelionVisSetupDependencies { /** @internal */ export interface TimelionVisStartDependencies { data: DataPublicPluginStart; + charts: ChartsPluginStart; } /** @public */ @@ -82,7 +82,6 @@ export class TimelionVisPlugin http, uiSettings, timefilter: data.query.timefilter.timefilter, - chartTheme: charts.theme, }; expressions.registerFunction(() => getTimelionVisualizationConfig(dependencies)); @@ -94,9 +93,10 @@ export class TimelionVisPlugin }; } - public start(core: CoreStart, plugins: TimelionVisStartDependencies) { - setIndexPatterns(plugins.data.indexPatterns); - setDataSearch(plugins.data.search); + public start(core: CoreStart, { data, charts }: TimelionVisStartDependencies) { + setIndexPatterns(data.indexPatterns); + setDataSearch(data.search); + setCharts(charts); return { getArgValueSuggestions, diff --git a/src/plugins/vis_type_timeseries/kibana.json b/src/plugins/vis_type_timeseries/kibana.json index 3a2ad6bdd77cf..c172640a4c14e 100644 --- a/src/plugins/vis_type_timeseries/kibana.json +++ b/src/plugins/vis_type_timeseries/kibana.json @@ -6,7 +6,7 @@ "ui": true, "requiredPlugins": ["charts", "data", "expressions", "visualizations", "visualize"], "optionalPlugins": ["usageCollection"], - "requiredBundles": ["kibanaUtils", "kibanaReact"], + "requiredBundles": ["kibanaUtils", "kibanaReact", "fieldFormats"], "owner": { "name": "Kibana App", "githubTeam": "kibana-app" diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js b/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js index 04af5786d2e8e..9b9beae67e44f 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/tick_formatter.test.js @@ -10,6 +10,7 @@ import { createTickFormatter } from './tick_formatter'; import { getFieldFormatsRegistry } from '../../../../../data/public/test_utils'; import { setFieldFormats } from '../../../services'; import { UI_SETTINGS } from '../../../../../data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../field_formats/common'; const mockUiSettings = { get: (item) => { @@ -22,7 +23,7 @@ const mockUiSettings = { [UI_SETTINGS.QUERY_STRING_OPTIONS]: {}, [UI_SETTINGS.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX]: true, 'dateFormat:tz': 'Browser', - [UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: {}, + [FORMATS_UI_SETTINGS.FORMAT_DEFAULT_TYPE_MAP]: {}, }; const mockCore = { @@ -45,7 +46,7 @@ describe('createTickFormatter(format, template)', () => { test('returns a percent with percent formatter', () => { const config = { - [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0.[00]%', + [FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0.[00]%', }; const fn = createTickFormatter('percent', null, (key) => config[key]); expect(fn(0.5556)).toEqual('55.56%'); @@ -53,7 +54,7 @@ describe('createTickFormatter(format, template)', () => { test('returns a byte formatted string with byte formatter', () => { const config = { - [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0.0b', + [FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0.0b', }; const fn = createTickFormatter('bytes', null, (key) => config[key]); expect(fn(1500 ^ 10)).toEqual('1.5KB'); @@ -66,7 +67,7 @@ describe('createTickFormatter(format, template)', () => { test('returns a located string with custom locale setting', () => { const config = { - [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: 'fr', + [FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_LOCALE]: 'fr', }; const fn = createTickFormatter('0,0.0', null, (key) => config[key]); expect(fn(1500)).toEqual('1 500,0'); @@ -89,7 +90,7 @@ describe('createTickFormatter(format, template)', () => { test('returns formatted value if passed a bad template', () => { const config = { - [UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: '0,0.[00]', + [FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN]: '0,0.[00]', }; const fn = createTickFormatter('number', '{{value', (key) => config[key]); expect(fn(1.5556)).toEqual('1.56'); diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_types/table/vis.js b/src/plugins/vis_type_timeseries/public/application/components/vis_types/table/vis.js index 4db038de912f5..ba235a20b97ce 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_types/table/vis.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_types/table/vis.js @@ -15,7 +15,7 @@ import { createTickFormatter } from '../../lib/tick_formatter'; import { isSortable } from './is_sortable'; import { EuiToolTip, EuiIcon } from '@elastic/eui'; import { replaceVars } from '../../lib/replace_vars'; -import { fieldFormats } from '../../../../../../../plugins/data/public'; +import { FIELD_FORMAT_IDS } from '../../../../../../../plugins/field_formats/common'; import { FormattedMessage } from '@kbn/i18n/react'; import { getFieldFormats, getCoreStart } from '../../../../services'; import { getValueOrEmpty } from '../../../../../common/empty_label'; @@ -47,7 +47,7 @@ class TableVis extends Component { super(props); const fieldFormatsService = getFieldFormats(); - const DateFormat = fieldFormatsService.getType(fieldFormats.FIELD_FORMAT_IDS.DATE); + const DateFormat = fieldFormatsService.getType(FIELD_FORMAT_IDS.DATE); this.dateFormatter = new DateFormat({}, this.props.getConfig); } diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/config.js b/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/config.js index 81b8626261f43..01ba8b6e28114 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/config.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/config.js @@ -28,7 +28,7 @@ import { import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; import { SeriesConfigQueryBarWithIgnoreGlobalFilter } from '../../series_config_query_bar_with_ignore_global_filter'; import { PalettePicker } from '../../palette_picker'; -import { getChartsSetup } from '../../../../services'; +import { getCharts } from '../../../../services'; import { isPercentDisabled } from '../../lib/stacked'; import { STACKED_OPTIONS } from '../../../visualizations/constants/chart'; @@ -120,7 +120,7 @@ export const TimeseriesConfig = injectI18n(function (props) { const selectedChartTypeOption = chartTypeOptions.find((option) => { return model.chart_type === option.value; }); - const { palettes } = getChartsSetup(); + const { palettes } = getCharts(); const [palettesRegistry, setPalettesRegistry] = useState(null); useEffect(() => { diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.test.js b/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.test.js index b2aa4a6d0c9fe..fd155623d5da7 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_types/timeseries/vis.test.js @@ -11,14 +11,14 @@ import { shallow } from 'enzyme'; import { TimeSeries } from '../../../visualizations/views/timeseries'; import TimeseriesVisualization from './vis'; import { setFieldFormats } from '../../../../services'; -import { UI_SETTINGS } from '../../../../../../data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../field_formats/common'; import { getFieldFormatsRegistry } from '../../../../../../data/public/test_utils'; describe('TimeseriesVisualization', () => { describe('TimeSeries Y-Axis formatted value', () => { const config = { - [UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0.[00]%', - [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0.0b', + [FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN]: '0.[00]%', + [FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0.0b', }; const id = 'default'; const value = 500; diff --git a/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js b/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js index 76bf3ca9d1b6e..0f0879e847846 100644 --- a/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js +++ b/src/plugins/vis_type_timeseries/public/application/visualizations/views/timeseries/index.js @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import React, { useEffect, useRef, useCallback } from 'react'; +import React, { useRef, useCallback } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { labelDateFormatter } from '../../../components/lib/label_date_formatter'; @@ -23,8 +23,7 @@ import { } from '@elastic/charts'; import { EuiIcon } from '@elastic/eui'; import { getTimezone } from '../../../lib/get_timezone'; -import { activeCursor$ } from '../../lib/active_cursor'; -import { getUISettings, getChartsSetup } from '../../../../services'; +import { getUISettings, getCharts } from '../../../../services'; import { GRID_LINE_CONFIG, ICON_TYPES_MAP, STACKED_OPTIONS } from '../../constants'; import { AreaSeriesDecorator } from './decorators/area_decorator'; import { BarSeriesDecorator } from './decorators/bar_decorator'; @@ -33,7 +32,7 @@ import { getBaseTheme, getChartClasses } from './utils/theme'; import { TOOLTIP_MODES } from '../../../../../common/enums'; import { getValueOrEmpty } from '../../../../../common/empty_label'; import { getSplitByTermsColor } from '../../../lib/get_split_by_terms_color'; -import { renderEndzoneTooltip } from '../../../../../../charts/public'; +import { renderEndzoneTooltip, useActiveCursor } from '../../../../../../charts/public'; import { getAxisLabelString } from '../../../components/lib/get_axis_label_string'; import { calculateDomainForSeries } from './utils/series_domain_calculation'; @@ -48,10 +47,6 @@ const generateAnnotationData = (values, formatter) => const decorateFormatter = (formatter) => ({ value }) => formatter(value); -const handleCursorUpdate = (cursor) => { - activeCursor$.next(cursor); -}; - export const TimeSeries = ({ backgroundColor, showGrid, @@ -69,22 +64,17 @@ export const TimeSeries = ({ interval, isLastBucketDropped, }) => { - const chartRef = useRef(); - // const [palettesRegistry, setPalettesRegistry] = useState(null); - - useEffect(() => { - const updateCursor = (cursor) => { - if (chartRef.current) { - chartRef.current.dispatchExternalPointerEvent(cursor); - } - }; + // If the color isn't configured by the user, use the color mapping service + // to assign a color from the Kibana palette. Colors will be shared across the + // session, including dashboards. + const { theme: themeService, activeCursor: activeCursorService } = getCharts(); - const subscription = activeCursor$.subscribe(updateCursor); + const chartRef = useRef(); + const chartTheme = themeService.useChartsTheme(); - return () => { - subscription.unsubscribe(); - }; - }, []); + const handleCursorUpdate = useActiveCursor(activeCursorService, chartRef, { + isDateHistogram: true, + }); let tooltipFormatter = decorateFormatter(xAxisFormatter); if (!isLastBucketDropped) { @@ -104,11 +94,6 @@ export const TimeSeries = ({ // apply legend style change if bgColor is configured const classes = classNames(getChartClasses(backgroundColor)); - // If the color isn't configured by the user, use the color mapping service - // to assign a color from the Kibana palette. Colors will be shared across the - // session, including dashboards. - const { theme: themeService } = getChartsSetup(); - const baseTheme = getBaseTheme(themeService.useChartsBaseTheme(), backgroundColor); const onBrushEndListener = ({ x }) => { @@ -152,6 +137,7 @@ export const TimeSeries = ({ animateData={false} onPointerUpdate={handleCursorUpdate} theme={[ + chartTheme, hasBarChart ? {} : { diff --git a/src/plugins/vis_type_timeseries/public/plugin.ts b/src/plugins/vis_type_timeseries/public/plugin.ts index 479c3f47435cc..3cd090c7da829 100644 --- a/src/plugins/vis_type_timeseries/public/plugin.ts +++ b/src/plugins/vis_type_timeseries/public/plugin.ts @@ -20,23 +20,23 @@ import { setFieldFormats, setCoreStart, setDataStart, - setChartsSetup, + setCharts, } from './services'; import { DataPublicPluginStart } from '../../data/public'; -import { ChartsPluginSetup } from '../../charts/public'; +import { ChartsPluginStart } from '../../charts/public'; import { getTimeseriesVisRenderer } from './timeseries_vis_renderer'; /** @internal */ export interface MetricsPluginSetupDependencies { expressions: ReturnType; visualizations: VisualizationsSetup; - charts: ChartsPluginSetup; visualize: VisualizePluginSetup; } /** @internal */ export interface MetricsPluginStartDependencies { data: DataPublicPluginStart; + charts: ChartsPluginStart; } /** @internal */ @@ -49,7 +49,7 @@ export class MetricsPlugin implements Plugin { public setup( core: CoreSetup, - { expressions, visualizations, charts, visualize }: MetricsPluginSetupDependencies + { expressions, visualizations, visualize }: MetricsPluginSetupDependencies ) { visualize.visEditorsRegistry.register(TSVB_EDITOR_NAME, EditorController); expressions.registerFunction(createMetricsFn); @@ -59,11 +59,11 @@ export class MetricsPlugin implements Plugin { }) ); setUISettings(core.uiSettings); - setChartsSetup(charts); visualizations.createBaseVisualization(metricsVisDefinition); } - public start(core: CoreStart, { data }: MetricsPluginStartDependencies) { + public start(core: CoreStart, { data, charts }: MetricsPluginStartDependencies) { + setCharts(charts); setI18n(core.i18n); setFieldFormats(data.fieldFormats); setDataStart(data); diff --git a/src/plugins/vis_type_timeseries/public/services.ts b/src/plugins/vis_type_timeseries/public/services.ts index 22f99f95691de..da1fd0fbdc2d3 100644 --- a/src/plugins/vis_type_timeseries/public/services.ts +++ b/src/plugins/vis_type_timeseries/public/services.ts @@ -8,7 +8,7 @@ import { I18nStart, IUiSettingsClient, CoreStart } from 'src/core/public'; import { createGetterSetter } from '../../kibana_utils/public'; -import { ChartsPluginSetup } from '../../charts/public'; +import { ChartsPluginStart } from '../../charts/public'; import { DataPublicPluginStart } from '../../data/public'; export const [getUISettings, setUISettings] = createGetterSetter('UISettings'); @@ -23,6 +23,4 @@ export const [getDataStart, setDataStart] = createGetterSetter('I18n'); -export const [getChartsSetup, setChartsSetup] = createGetterSetter( - 'ChartsPluginSetup' -); +export const [getCharts, setCharts] = createGetterSetter('ChartsPluginStart'); diff --git a/src/plugins/vis_type_timeseries/public/timeseries_vis_renderer.tsx b/src/plugins/vis_type_timeseries/public/timeseries_vis_renderer.tsx index 7a358718c1495..3f324fcfc2f20 100644 --- a/src/plugins/vis_type_timeseries/public/timeseries_vis_renderer.tsx +++ b/src/plugins/vis_type_timeseries/public/timeseries_vis_renderer.tsx @@ -17,7 +17,7 @@ import { VisualizationContainer, PersistedState } from '../../visualizations/pub import type { TimeseriesVisData } from '../common/types'; import { isVisTableData } from '../common/vis_data_utils'; -import { getChartsSetup } from './services'; +import { getCharts } from './services'; import type { TimeseriesVisParams } from './types'; import type { ExpressionRenderDefinition } from '../../expressions/common'; @@ -49,7 +49,7 @@ export const getTimeseriesVisRenderer: (deps: { handlers.onDestroy(() => { unmountComponentAtNode(domNode); }); - const { palettes } = getChartsSetup(); + const { palettes } = getCharts(); const showNoResult = !checkIfDataExists(config.visData, config.visParams); const palettesService = await palettes.getPalettes(); diff --git a/src/plugins/vis_type_vislib/kibana.json b/src/plugins/vis_type_vislib/kibana.json index 26d20b1ff839f..412264a3e7270 100644 --- a/src/plugins/vis_type_vislib/kibana.json +++ b/src/plugins/vis_type_vislib/kibana.json @@ -4,7 +4,7 @@ "server": true, "ui": true, "requiredPlugins": ["charts", "data", "expressions", "visualizations", "kibanaLegacy"], - "requiredBundles": ["kibanaUtils", "visDefaultEditor", "visTypeXy", "visTypePie"], + "requiredBundles": ["kibanaUtils", "visDefaultEditor", "visTypeXy", "visTypePie", "fieldFormats"], "owner": { "name": "Kibana App", "githubTeam": "kibana-app" diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js index 5e1f0bfbb4464..04ab8db1cda8f 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js @@ -9,7 +9,7 @@ import { last } from 'lodash'; import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; -import { UI_SETTINGS } from '../../../../../../plugins/data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../plugins/field_formats/common'; import { getValueForPercentageMode } from '../../percentage_mode_transform'; function getMax(handler, config, isGauge) { @@ -55,7 +55,7 @@ export function pointSeriesTooltipFormatter() { if (isPercentageMode && !isSetColorRange) { const percentageFormatPattern = config.get( isGauge ? 'gauge.percentageFormatPattern' : 'percentageFormatPattern', - uiSettings.get(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN) + uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN) ); value = getValueForPercentageMode( value / getMax(handler, config, isGauge), diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts index 04afc86548f22..815d0e10aafb2 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts +++ b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { IFieldFormatsRegistry } from '../../../../../data/common'; +import { IFieldFormatsRegistry } from '../../../../../field_formats/common'; import { getPoint } from './_get_point'; import { setFormatService } from '../../../services'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js index b7f5b966a08c6..65f7df6459bfe 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js @@ -10,7 +10,7 @@ import d3 from 'd3'; import _ from 'lodash'; import { getHeatmapColors } from '../../../../../charts/public'; -import { UI_SETTINGS } from '../../../../../data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../field_formats/common'; import { getValueForPercentageMode } from '../../percentage_mode_transform'; const arcAngles = { @@ -73,7 +73,7 @@ export class MeterGauge { const isPercentageMode = this.gaugeConfig.percentageMode; const percentageFormatPattern = this.gaugeConfig.percentageFormatPattern || - this.uiSettings.get(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN); + this.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN); const colorsRange = this.gaugeConfig.colorsRange; const max = _.last(colorsRange).to; const labels = []; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js index 0dc1e18270f78..a25d408769273 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js @@ -13,7 +13,7 @@ import { isColorDark } from '@elastic/eui'; import { PointSeries } from './_point_series'; import { getHeatmapColors } from '../../../../../../plugins/charts/public'; -import { UI_SETTINGS } from '../../../../../../plugins/data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../plugins/field_formats/common'; import { getValueForPercentageMode } from '../../percentage_mode_transform'; const defaults = { @@ -54,7 +54,7 @@ export class HeatmapChart extends PointSeries { const percentageMode = cfg.get('percentageMode'); const percentageFormatPattern = cfg.get( 'percentageFormatPattern', - this.uiSettings.get(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN) + this.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN) ); const colorsNumber = cfg.get('colorsNumber'); const colorsRange = cfg.get('colorsRange'); diff --git a/src/plugins/vis_type_xy/public/components/xy_settings.tsx b/src/plugins/vis_type_xy/public/components/xy_settings.tsx index 6d1425f488a47..03455bae69506 100644 --- a/src/plugins/vis_type_xy/public/components/xy_settings.tsx +++ b/src/plugins/vis_type_xy/public/components/xy_settings.tsx @@ -11,6 +11,7 @@ import React, { FC } from 'react'; import { Direction, Settings, + SettingsSpecProps, DomainRange, Position, PartialTheme, @@ -49,6 +50,7 @@ type XYSettingsProps = Pick< | 'xAxis' | 'orderBucketsBySum' > & { + onPointerUpdate: SettingsSpecProps['onPointerUpdate']; xDomain?: DomainRange; adjustedXDomain?: DomainRange; showLegend: boolean; @@ -85,6 +87,7 @@ export const XYSettings: FC = ({ adjustedXDomain, showLegend, onElementClick, + onPointerUpdate, onBrushEnd, onRenderChange, legendAction, @@ -107,6 +110,9 @@ export const XYSettings: FC = ({ barSeriesStyle: { ...valueLabelsStyling, }, + crosshair: { + ...theme.crosshair, + }, axes: { axisTitle: { padding: { @@ -152,6 +158,7 @@ export const XYSettings: FC = ({ return ( ; visualizations: VisualizationsStart; data: DataPublicPluginStart; + charts: ChartsPluginStart; } type VisTypeXyCoreSetup = CoreSetup; @@ -86,11 +88,11 @@ export class VisTypeXyPlugin return {}; } - public start(core: CoreStart, { data }: VisTypeXyPluginStartDependencies) { + public start(core: CoreStart, { data, charts }: VisTypeXyPluginStartDependencies) { setFormatService(data.fieldFormats); setDataActions(data.actions); setDocLinks(core.docLinks); - + setActiveCursor(charts.activeCursor); return {}; } } diff --git a/src/plugins/vis_type_xy/public/services.ts b/src/plugins/vis_type_xy/public/services.ts index b5dd6152605dc..63bc55b288ae3 100644 --- a/src/plugins/vis_type_xy/public/services.ts +++ b/src/plugins/vis_type_xy/public/services.ts @@ -10,7 +10,7 @@ import { UiCounterMetricType } from '@kbn/analytics'; import { CoreSetup, DocLinksStart } from '../../../core/public'; import { createGetterSetter } from '../../kibana_utils/public'; import { DataPublicPluginStart } from '../../data/public'; -import { ChartsPluginSetup } from '../../charts/public'; +import { ChartsPluginSetup, ChartsPluginStart } from '../../charts/public'; export const [getUISettings, setUISettings] = createGetterSetter( 'xy core.uiSettings' @@ -28,6 +28,10 @@ export const [getThemeService, setThemeService] = createGetterSetter('xy charts.activeCursor'); + export const [getPalettesService, setPalettesService] = createGetterSetter< ChartsPluginSetup['palettes'] >('xy charts.palette'); diff --git a/src/plugins/vis_type_xy/public/vis_component.tsx b/src/plugins/vis_type_xy/public/vis_component.tsx index dd88822f7f0f3..2dffabb2ba0b9 100644 --- a/src/plugins/vis_type_xy/public/vis_component.tsx +++ b/src/plugins/vis_type_xy/public/vis_component.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'; +import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { Chart, @@ -32,7 +32,7 @@ import { } from '../../charts/public'; import { Datatable, IInterpreterRenderHandlers } from '../../expressions/public'; import type { PersistedState } from '../../visualizations/public'; - +import { useActiveCursor } from '../../charts/public'; import { VisParams } from './types'; import { getAdjustedDomain, @@ -47,7 +47,7 @@ import { } from './utils'; import { XYAxis, XYEndzones, XYCurrentTime, XYSettings, XYThresholdLine } from './components'; import { getConfig } from './config'; -import { getThemeService, getDataActions, getPalettesService } from './services'; +import { getThemeService, getDataActions, getPalettesService, getActiveCursor } from './services'; import { ChartType } from '../common'; import './_chart.scss'; @@ -77,6 +77,11 @@ const VisComponent = (props: VisComponentProps) => { return props.uiState?.get('vis.legendOpen', bwcLegendStateDefault) as boolean; }); const [palettesRegistry, setPalettesRegistry] = useState(null); + const chartRef = useRef(null); + + const handleCursorUpdate = useActiveCursor(getActiveCursor(), chartRef, { + datatables: [props.visData], + }); const onRenderChange = useCallback( (isRendered) => { @@ -333,7 +338,7 @@ const VisComponent = (props: VisComponentProps) => { showLegend={showLegend} legendPosition={legendPosition} /> - + { { + describe('Changing field formatter to Url', () => { before(async function () { await esArchiver.load('test/functional/fixtures/es_archiver/dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ @@ -48,13 +47,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await settings.clickIndexPatternLogstash(); await settings.filterField(fieldName); await settings.openControlsByName(fieldName); + await settings.toggleRow('formatRow'); await settings.setFieldFormat('url'); await settings.controlChangeSave(); }); it('applied on dashboard', async () => { await common.navigateToApp('dashboard'); - await dashboard.loadSavedDashboard('dashboard with everything'); + await dashboard.loadSavedDashboard('dashboard with table'); await dashboard.waitForRenderComplete(); const fieldLink = await visChart.getFieldLinkInVisTable(`${fieldName}: Descending`, 1); await clickFieldAndCheckUrl(fieldLink); diff --git a/test/functional/apps/discover/_indexpattern_without_timefield.ts b/test/functional/apps/discover/_indexpattern_without_timefield.ts index ff3ad0daf69db..74713553fa543 100644 --- a/test/functional/apps/discover/_indexpattern_without_timefield.ts +++ b/test/functional/apps/discover/_indexpattern_without_timefield.ts @@ -16,7 +16,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['common', 'timePicker', 'discover']); - describe('indexpattern without timefield', () => { + // Failing: See https://github.com/elastic/kibana/issues/107057 + describe.skip('indexpattern without timefield', () => { before(async () => { await security.testUser.setRoles(['kibana_admin', 'kibana_timefield']); await esArchiver.loadIfNeeded( diff --git a/test/functional/apps/management/_create_index_pattern_wizard.js b/test/functional/apps/management/_create_index_pattern_wizard.js index d4b49d74d1b90..b2f24e530cb12 100644 --- a/test/functional/apps/management/_create_index_pattern_wizard.js +++ b/test/functional/apps/management/_create_index_pattern_wizard.js @@ -6,8 +6,6 @@ * Side Public License, v 1. */ -import expect from '@kbn/expect'; - export default function ({ getService, getPageObjects }) { const kibanaServer = getService('kibanaServer'); const testSubjects = getService('testSubjects'); @@ -23,23 +21,6 @@ export default function ({ getService, getPageObjects }) { await PageObjects.settings.clickKibanaIndexPatterns(); }); - describe('step 1 next button', function () { - it('is disabled by default', async function () { - await (await testSubjects.find('createIndexPatternButton')).click(); - const btn = await PageObjects.settings.getCreateIndexPatternGoToStep2Button(); - const isEnabled = await btn.isEnabled(); - expect(isEnabled).not.to.be.ok(); - }); - - it('is enabled once an index pattern with matching indices has been entered', async function () { - await PageObjects.settings.setIndexPatternField(); - await PageObjects.common.sleep(1000); - const btn = await PageObjects.settings.getCreateIndexPatternGoToStep2Button(); - const isEnabled = await btn.isEnabled(); - expect(isEnabled).to.be.ok(); - }); - }); - describe('index alias', () => { before(async function () { await security.testUser.setRoles(['kibana_admin', 'test_alias1_reader']); diff --git a/test/functional/apps/management/_index_pattern_create_delete.js b/test/functional/apps/management/_index_pattern_create_delete.js index b195e4c8d5857..5be5cb3418bf8 100644 --- a/test/functional/apps/management/_index_pattern_create_delete.js +++ b/test/functional/apps/management/_index_pattern_create_delete.js @@ -14,6 +14,7 @@ export default function ({ getService, getPageObjects }) { const log = getService('log'); const retry = getService('retry'); const testSubjects = getService('testSubjects'); + const find = getService('find'); const PageObjects = getPageObjects(['settings', 'common', 'header']); describe('creating and deleting default index', function describeIndexTests() { @@ -29,6 +30,30 @@ export default function ({ getService, getPageObjects }) { }); }); + describe('can open and close editor', function () { + it('without creating index pattern', async function () { + await PageObjects.settings.clickKibanaIndexPatterns(); + await PageObjects.settings.clickAddNewIndexPatternButton(); + await testSubjects.click('closeFlyoutButton'); + await testSubjects.find('createIndexPatternButton'); + }); + }); + + describe('validation', function () { + it('can display errors', async function () { + await PageObjects.settings.clickAddNewIndexPatternButton(); + await PageObjects.settings.setIndexPatternField('log*'); + await (await PageObjects.settings.getSaveIndexPatternButton()).click(); + await find.byClassName('euiFormErrorText'); + }); + + it('can resolve errors and submit', async function () { + await PageObjects.settings.selectTimeFieldOption('@timestamp'); + await (await PageObjects.settings.getSaveIndexPatternButton()).click(); + await PageObjects.settings.removeIndexPattern(); + }); + }); + describe('special character handling', () => { it('should handle special charaters in template input', async () => { await PageObjects.settings.clickAddNewIndexPatternButton(); diff --git a/test/functional/apps/visualize/_point_series_options.ts b/test/functional/apps/visualize/_point_series_options.ts index ee64fdf7ddda3..08c26b1f3ee95 100644 --- a/test/functional/apps/visualize/_point_series_options.ts +++ b/test/functional/apps/visualize/_point_series_options.ts @@ -151,7 +151,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should put secondary axis on the right', async function () { - const length = await PageObjects.visChart.getRightValueAxesCount(); + const length = await PageObjects.visChart.getAxesCountByPosition('right'); expect(length).to.be(1); }); }); diff --git a/test/functional/apps/visualize/_timelion.ts b/test/functional/apps/visualize/_timelion.ts new file mode 100644 index 0000000000000..589559c717842 --- /dev/null +++ b/test/functional/apps/visualize/_timelion.ts @@ -0,0 +1,206 @@ +/* + * 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 expect from '@kbn/expect'; + +import type { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const { timePicker, visChart, visEditor, visualize } = getPageObjects([ + 'timePicker', + 'visChart', + 'visEditor', + 'visualize', + ]); + const monacoEditor = getService('monacoEditor'); + const kibanaServer = getService('kibanaServer'); + const elasticChart = getService('elasticChart'); + const find = getService('find'); + + describe('Timelion visualization', () => { + before(async () => { + await kibanaServer.uiSettings.update({ + 'timelion:legacyChartsLibrary': false, + }); + await visualize.initTests(true); + await visualize.navigateToNewAggBasedVisualization(); + await visualize.clickTimelion(); + await timePicker.setDefaultAbsoluteRange(); + }); + + const initVisualization = async (expression: string, interval: string = '12h') => { + await visEditor.setTimelionInterval(interval); + await monacoEditor.setCodeEditorValue(expression); + await visEditor.clickGo(); + }; + + it('should display correct data for specified index pattern and timefield', async () => { + await initVisualization('.es(index=long-window-logstash-*,timefield=@timestamp)'); + + const chartData = await visChart.getAreaChartData('q:* > count'); + expect(chartData).to.eql([3, 5, 2, 6, 1, 6, 1, 7, 0, 0]); + }); + + it('should display correct chart colors for multiple expressions', async () => { + const expectedColors = ['#01A4A4', '#FFCFDF', '#BFA7DA', '#AD7DE6']; + await initVisualization( + '.es(*), .es(*).color("#FFCFDF"), .es(*).color("#BFA7DA"), .es(*).color("#AD7DE6")' + ); + + const areas = (await elasticChart.getChartDebugData())?.areas; + expect(areas?.map(({ color }) => color)).to.eql(expectedColors); + }); + + it('should display correct chart data for average, min, max and cardinality aggregations', async () => { + await initVisualization( + '.es(index=logstash-*,metric=avg:bytes), .es(index=logstash-*,metric=min:bytes),' + + '.es(index=logstash-*,metric=max:bytes,), .es(index=logstash-*,metric=cardinality:bytes)', + '36h' + ); + + const firstAreaChartData = await visChart.getAreaChartData('q:* > avg(bytes)'); + const secondAreaChartData = await visChart.getAreaChartData('q:* > min(bytes)'); + const thirdAreaChartData = await visChart.getAreaChartData('q:* > max(bytes)'); + const forthAreaChartData = await visChart.getAreaChartData('q:* > cardinality(bytes)'); + + expect(firstAreaChartData).to.eql([5732.783676366217, 5721.775973559419]); + expect(secondAreaChartData).to.eql([0, 0]); + expect(thirdAreaChartData).to.eql([19985, 19986]); + expect(forthAreaChartData).to.eql([5019, 4958, 0, 0]); + }); + + it('should display correct chart data for expressions using functions', async () => { + const firstAreaExpectedChartData = [3, 2421, 2343, 2294, 2327, 2328, 2312, 7, 0, 0]; + const thirdAreaExpectedChartData = [200, 167, 199, 200, 200, 198, 108, 200, 200]; + const forthAreaExpectedChartData = [150, 50, 50, 50, 50, 50, 50, 150, 150, 150]; + await initVisualization( + '.es(*).label("initial"),' + + '.es(*).add(term=.es(*).multiply(-1).abs()).divide(2).label("add multiply abs divide"),' + + '.es(q="bytes<100").derivative().sum(200).min(200).label("query derivative min sum"),' + + '.es(*).if(operator=gt,if=200,then=50,else=150).label("condition")' + ); + + const firstAreaChartData = await visChart.getAreaChartData('initial'); + const secondAreaChartData = await visChart.getAreaChartData('add multiply abs divide'); + const thirdAreaChartData = await visChart.getAreaChartData('query derivative min sum'); + const forthAreaChartData = await visChart.getAreaChartData('condition'); + + expect(firstAreaChartData).to.eql(firstAreaExpectedChartData); + expect(secondAreaChartData).to.eql(firstAreaExpectedChartData); + expect(thirdAreaChartData).to.eql(thirdAreaExpectedChartData); + expect(forthAreaChartData).to.eql(forthAreaExpectedChartData); + }); + + it('should display correct chart title, data and labels for expressions with custom labels, yaxis and offset', async () => { + const firstAreaExpectedChartData = [13112352443.375292, 13095637741.055172]; + const secondAreaExpectedChartData = [ + [1442642400000, 5732.783676366217], + [1442772000000, 5721.775973559419], + ]; + const thirdAreaExpectedChartData = [ + [1442772000000, 5732.783676366217], + [1442901600000, 5721.775973559419], + ]; + await initVisualization( + '.es(index=logstash*,timefield="@timestamp",metric=avg:machine.ram).label("Average Machine RAM amount").yaxis(2,units=bytes,position=right),' + + '.es(index=logstash*,timefield="@timestamp",metric=avg:bytes).label("Average Bytes for request").yaxis(1,units=bytes,position=left),' + + '.es(index=logstash*,timefield="@timestamp",metric=avg:bytes, offset=-12h).label("Average Bytes for request with offset").yaxis(3,units=custom:BYTES_,position=right)', + '36h' + ); + + const leftAxesCount = await visChart.getAxesCountByPosition('left'); + const rightAxesCount = await visChart.getAxesCountByPosition('right'); + const firstAxesLabels = await visChart.getYAxisLabels(); + const secondAxesLabels = await visChart.getYAxisLabels(1); + const thirdAxesLabels = await visChart.getYAxisLabels(2); + const firstAreaChartData = await visChart.getAreaChartData('Average Machine RAM amount'); + const secondAreaChartData = await visChart.getAreaChartData( + 'Average Bytes for request', + undefined, + true + ); + const thirdAreaChartData = await visChart.getAreaChartData( + 'Average Bytes for request with offset', + undefined, + true + ); + + expect(leftAxesCount).to.be(1); + expect(rightAxesCount).to.be(2); + expect(firstAreaChartData).to.eql(firstAreaExpectedChartData); + expect(secondAreaChartData).to.eql(secondAreaExpectedChartData); + expect(thirdAreaChartData).to.eql(thirdAreaExpectedChartData); + expect(firstAxesLabels).to.eql(['12.19GB', '12.2GB', '12.21GB']); + expect(secondAxesLabels).to.eql(['5.59KB', '5.6KB']); + expect(thirdAxesLabels.toString()).to.be( + 'BYTES_5721,BYTES_5722,BYTES_5723,BYTES_5724,BYTES_5725,BYTES_5726,BYTES_5727,BYTES_5728,BYTES_5729,BYTES_5730,BYTES_5731,BYTES_5732,BYTES_5733' + ); + }); + + it('should display correct chart data for split expression', async () => { + await initVisualization('.es(index=logstash-*, split=geo.dest:3)', '1 day'); + + const firstAreaChartData = await visChart.getAreaChartData('q:* > geo.dest:CN > count'); + const secondAreaChartData = await visChart.getAreaChartData('q:* > geo.dest:IN > count'); + const thirdAreaChartData = await visChart.getAreaChartData('q:* > geo.dest:US > count'); + + expect(firstAreaChartData).to.eql([0, 905, 910, 850, 0]); + expect(secondAreaChartData).to.eql([0, 763, 699, 825, 0]); + expect(thirdAreaChartData).to.eql([0, 423, 386, 389, 0]); + }); + + it('should display two areas and one bar chart items', async () => { + await initVisualization('.es(*), .es(*), .es(*).bars(stack=true)'); + + const areasChartsCount = await visChart.getAreaSeriesCount(); + const barsChartsCount = await visChart.getHistogramSeriesCount(); + + expect(areasChartsCount).to.be(2); + expect(barsChartsCount).to.be(1); + }); + + describe('Legend', () => { + it('should correctly display the legend items names and position', async () => { + await initVisualization('.es(*).label("first series"), .es(*).label("second series")'); + + const legendNames = await visChart.getLegendEntries(); + const legendElement = await find.byClassName('echLegend'); + const isLegendTopPositioned = await legendElement.elementHasClass('echLegend--top'); + const isLegendLeftPositioned = await legendElement.elementHasClass('echLegend--left'); + + expect(legendNames).to.eql(['first series', 'second series']); + expect(isLegendTopPositioned).to.be(true); + expect(isLegendLeftPositioned).to.be(true); + }); + + it('should correctly display the legend position', async () => { + await initVisualization('.es(*).legend(position=se)'); + + const legendElement = await find.byClassName('echLegend'); + const isLegendBottomPositioned = await legendElement.elementHasClass('echLegend--bottom'); + const isLegendRightPositioned = await legendElement.elementHasClass('echLegend--right'); + + expect(isLegendBottomPositioned).to.be(true); + expect(isLegendRightPositioned).to.be(true); + }); + + it('should not display the legend', async () => { + await initVisualization('.es(*), .es(*).label("second series").legend(position=false)'); + + const isLegendElementExists = await find.existsByCssSelector('.echLegend'); + expect(isLegendElementExists).to.be(false); + }); + }); + + after( + async () => + await kibanaServer.uiSettings.update({ + 'timelion:legacyChartsLibrary': true, + }) + ); + }); +} diff --git a/test/functional/apps/visualize/_tsvb_time_series.ts b/test/functional/apps/visualize/_tsvb_time_series.ts index df6a879f5a0a9..e3d4fd989c753 100644 --- a/test/functional/apps/visualize/_tsvb_time_series.ts +++ b/test/functional/apps/visualize/_tsvb_time_series.ts @@ -172,7 +172,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { // click on specific coordinates await browser .getActions() - .move({ x: 100, y: 110, origin: el._webElement }) + .move({ x: 105, y: 110, origin: el._webElement }) .click() .perform(); diff --git a/test/functional/apps/visualize/index.ts b/test/functional/apps/visualize/index.ts index bc6160eba3846..4af871bd9347d 100644 --- a/test/functional/apps/visualize/index.ts +++ b/test/functional/apps/visualize/index.ts @@ -52,6 +52,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./_vertical_bar_chart')); loadTestFile(require.resolve('./_vertical_bar_chart_nontimeindex')); loadTestFile(require.resolve('./_pie_chart')); + loadTestFile(require.resolve('./_timelion')); }); describe('visualize ciGroup9', function () { diff --git a/test/functional/apps/visualize/legacy/index.ts b/test/functional/apps/visualize/legacy/index.ts index d474287860b25..37cf8a5950592 100644 --- a/test/functional/apps/visualize/legacy/index.ts +++ b/test/functional/apps/visualize/legacy/index.ts @@ -7,7 +7,7 @@ */ import { FtrProviderContext } from '../../../ftr_provider_context'; -import { UI_SETTINGS } from '../../../../../src/plugins/data/common'; +import { FORMATS_UI_SETTINGS } from '../../../../../src/plugins/field_formats/common'; export default function ({ getPageObjects, getService, loadTestFile }: FtrProviderContext) { const browser = getService('browser'); @@ -26,7 +26,7 @@ export default function ({ getPageObjects, getService, loadTestFile }: FtrProvid await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/visualize.json'); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', - [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b', + [FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b', }); }); 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 139da89e58d12..599ffbadaaea7 100644 --- a/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json +++ b/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json @@ -1135,6 +1135,49 @@ } } +{ + "type": "doc", + "value": { + "id": "dashboard:d2525040-3dcd-11e8-8660-4d65aa086b3b", + "index": ".kibana", + "source": { + "coreMigrationVersion": "7.14.0", + "dashboard": { + "description": "I have one of every visualization type since the last time I was created!", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" + }, + "optionsJSON": "{\"darkTheme\":false,\"hidePanelTitles\":false,\"useMargins\":true}", + "panelsJSON": "[{\"version\":\"7.3.0\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":15,\"w\":24,\"h\":15,\"i\":\"3\"},\"panelIndex\":\"3\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_3\"}]", + "refreshInterval": { + "display": "Off", + "pause": false, + "value": 0 + }, + "timeFrom": "Mon Apr 09 2018 17:56:08 GMT-0400", + "timeRestore": true, + "timeTo": "Wed Apr 11 2018 17:56:08 GMT-0400", + "title": "dashboard with table", + "version": 1 + }, + "migrationVersion": { + "dashboard": "7.14.0" + }, + "references": [ + { + "id": "4b5d6ef0-3dcb-11e8-8660-4d65aa086b3c", + "name": "3:panel_3", + "type": "visualization" + } + ], + "type": "dashboard", + "updated_at": "2018-04-16T16:05:02.915Z" + }, + "type": "_doc" + } +} + { "type": "doc", "value": { @@ -3468,4 +3511,4 @@ }, "type": "_doc" } -} \ No newline at end of file +} diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index cb8f198177017..9cdd33ef768f9 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -43,7 +43,10 @@ export class SettingsPageObject extends FtrService { async clickKibanaIndexPatterns() { this.log.debug('clickKibanaIndexPatterns link'); - await this.testSubjects.click('indexPatterns'); + const currentUrl = await this.browser.getCurrentUrl(); + if (!currentUrl.endsWith('indexPatterns')) { + await this.testSubjects.click('indexPatterns'); + } await this.header.waitUntilLoadingHasFinished(); } @@ -122,38 +125,28 @@ export class SettingsPageObject extends FtrService { } async getIndexPatternField() { - return await this.testSubjects.find('createIndexPatternNameInput'); - } - - async clickTimeFieldNameField() { - return await this.testSubjects.click('createIndexPatternTimeFieldSelect'); + return this.testSubjects.find('createIndexPatternNameInput'); } async getTimeFieldNameField() { - return await this.testSubjects.find('createIndexPatternTimeFieldSelect'); + const wrapperElement = await this.testSubjects.find('timestampField'); + return wrapperElement.findByTestSubject('comboBoxSearchInput'); } async selectTimeFieldOption(selection: string) { // open dropdown - await this.clickTimeFieldNameField(); - // close dropdown, keep focus - await this.clickTimeFieldNameField(); - await this.header.waitUntilLoadingHasFinished(); - return await this.retry.try(async () => { - this.log.debug(`selectTimeFieldOption(${selection})`); - const timeFieldOption = await this.getTimeFieldOption(selection); - await timeFieldOption.click(); - const selected = await timeFieldOption.isSelected(); - if (!selected) throw new Error('option not selected: ' + selected); - }); + const timefield = await this.getTimeFieldNameField(); + await timefield.click(); + await this.browser.pressKeys(selection); + await this.browser.pressKeys(this.browser.keys.TAB); } async getTimeFieldOption(selection: string) { return await this.find.displayedByCssSelector('option[value="' + selection + '"]'); } - async getCreateIndexPatternButton() { - return await this.testSubjects.find('createIndexPatternButton'); + async getSaveIndexPatternButton() { + return await this.testSubjects.find('saveIndexPatternButton'); } async getCreateButton() { @@ -350,25 +343,19 @@ export class SettingsPageObject extends FtrService { await this.header.waitUntilLoadingHasFinished(); await this.clickAddNewIndexPatternButton(); + await this.header.waitUntilLoadingHasFinished(); if (!isStandardIndexPattern) { - await this.clickCreateNewRollupButton(); + await this.selectRollupIndexPatternType(); } - await this.header.waitUntilLoadingHasFinished(); await this.retry.try(async () => { await this.setIndexPatternField(indexPatternName); }); - const btn = await this.getCreateIndexPatternGoToStep2Button(); - await this.retry.waitFor(`index pattern Go To Step 2 button to be enabled`, async () => { - return await btn.isEnabled(); - }); - await btn.click(); - await this.common.sleep(2000); if (timefield) { await this.selectTimeFieldOption(timefield); } - await (await this.getCreateIndexPatternButton()).click(); + await (await this.getSaveIndexPatternButton()).click(); }); await this.header.waitUntilLoadingHasFinished(); await this.retry.try(async () => { @@ -381,16 +368,38 @@ export class SettingsPageObject extends FtrService { } }); + if (!isStandardIndexPattern) { + const badges = await this.find.allByCssSelector('.euiBadge__text'); + const text = await badges[1].getVisibleText(); + expect(text).to.equal('Rollup'); + } + return await this.getIndexPatternIdFromUrl(); } async clickAddNewIndexPatternButton() { await this.common.scrollKibanaBodyTop(); - await this.testSubjects.click('createIndexPatternButton'); + + // if flyout is open + const flyoutView = await this.testSubjects.exists('createIndexPatternButtonFlyout'); + if (flyoutView) { + await this.testSubjects.click('createIndexPatternButtonFlyout'); + return; + } + + const tableView = await this.testSubjects.exists('createIndexPatternButton'); + if (tableView) { + await this.testSubjects.click('createIndexPatternButton'); + } + const flyoutView2 = await this.testSubjects.exists('createIndexPatternButtonFlyout'); + if (flyoutView2) { + await this.testSubjects.click('createIndexPatternButtonFlyout'); + } } - async clickCreateNewRollupButton() { - await this.testSubjects.click('createRollupIndexPatternButton'); + async selectRollupIndexPatternType() { + await this.testSubjects.click('typeField'); + await this.testSubjects.click('rollupType'); } async getIndexPatternIdFromUrl() { diff --git a/test/functional/page_objects/visualize_chart_page.ts b/test/functional/page_objects/visualize_chart_page.ts index 64b8c363fa6c2..bcee77a21c0b0 100644 --- a/test/functional/page_objects/visualize_chart_page.ts +++ b/test/functional/page_objects/visualize_chart_page.ts @@ -115,10 +115,10 @@ export class VisualizeChartPageObject extends FtrService { .map((tick) => $(tick).text().trim()); } - public async getYAxisLabels() { + public async getYAxisLabels(nth = 0) { if (await this.isNewLibraryChart(xyChartSelector)) { - const [yAxis] = (await this.getEsChartDebugState(xyChartSelector))?.axes?.y ?? []; - return yAxis?.labels; + const yAxis = (await this.getEsChartDebugState(xyChartSelector))?.axes?.y ?? []; + return yAxis[nth]?.labels; } const yAxis = await this.find.byCssSelector('.visAxis__column--y.visAxis__column--left'); @@ -141,14 +141,19 @@ export class VisualizeChartPageObject extends FtrService { * Gets the chart data and scales it based on chart height and label. * @param dataLabel data-label value * @param axis axis value, 'ValueAxis-1' by default + * @param shouldContainXAxisData boolean value for mapping points, false by default * * Returns an array of height values */ - public async getAreaChartData(dataLabel: string, axis = 'ValueAxis-1') { + public async getAreaChartData( + dataLabel: string, + axis = 'ValueAxis-1', + shouldContainXAxisData = false + ) { if (await this.isNewLibraryChart(xyChartSelector)) { const areas = (await this.getEsChartDebugState(xyChartSelector))?.areas ?? []; const points = areas.find(({ name }) => name === dataLabel)?.lines.y1.points ?? []; - return points.map(({ y }) => y); + return shouldContainXAxisData ? points.map(({ x, y }) => [x, y]) : points.map(({ y }) => y); } const yAxisRatio = await this.getChartYAxisRatio(axis); @@ -556,12 +561,12 @@ export class VisualizeChartPageObject extends FtrService { return values.filter((item) => item.length > 0); } - public async getRightValueAxesCount() { + public async getAxesCountByPosition(axesPosition: typeof Position[keyof typeof Position]) { if (await this.isNewLibraryChart(xyChartSelector)) { const yAxes = (await this.getEsChartDebugState(xyChartSelector))?.axes?.y ?? []; - return yAxes.filter(({ position }) => position === Position.Right).length; + return yAxes.filter(({ position }) => position === axesPosition).length; } - const axes = await this.find.allByCssSelector('.visAxis__column--right g.axis'); + const axes = await this.find.allByCssSelector(`.visAxis__column--${axesPosition} g.axis`); return axes.length; } @@ -576,6 +581,16 @@ export class VisualizeChartPageObject extends FtrService { await gauge.clickMouseButton({ xOffset: 0, yOffset }); } + public async getAreaSeriesCount() { + if (await this.isNewLibraryChart(xyChartSelector)) { + const areas = (await this.getEsChartDebugState(xyChartSelector))?.areas ?? []; + return areas.filter((area) => area.lines.y1.visible).length; + } + + const series = await this.find.allByCssSelector('.points.area'); + return series.length; + } + public async getHistogramSeriesCount() { if (await this.isNewLibraryChart(xyChartSelector)) { const bars = (await this.getEsChartDebugState(xyChartSelector))?.bars ?? []; diff --git a/test/functional/page_objects/visualize_editor_page.ts b/test/functional/page_objects/visualize_editor_page.ts index ab458c2c0fdc1..90fc320da3cda 100644 --- a/test/functional/page_objects/visualize_editor_page.ts +++ b/test/functional/page_objects/visualize_editor_page.ts @@ -532,4 +532,10 @@ export class VisualizeEditorPageObject extends FtrService { public async setSeriesType(seriesNth: number, type: string) { await this.find.selectValue(`select#seriesType${seriesNth}`, type); } + + public async setTimelionInterval(interval: string) { + const timelionIntervalComboBoxSelector = 'timelionIntervalComboBox'; + await this.comboBox.clearInputField(timelionIntervalComboBoxSelector); + await this.comboBox.setCustom(timelionIntervalComboBoxSelector, interval); + } } diff --git a/test/functional/page_objects/visualize_page.ts b/test/functional/page_objects/visualize_page.ts index 7e87312a70910..966a9d29b3264 100644 --- a/test/functional/page_objects/visualize_page.ts +++ b/test/functional/page_objects/visualize_page.ts @@ -8,7 +8,7 @@ import { FtrService } from '../ftr_provider_context'; import { VisualizeConstants } from '../../../src/plugins/visualize/public/application/visualize_constants'; -import { UI_SETTINGS } from '../../../src/plugins/data/common'; +import { FORMATS_UI_SETTINGS } from '../../../src/plugins/field_formats/common'; // TODO: Remove & Refactor to use the TTV page objects interface VisualizeSaveModalArgs { @@ -55,7 +55,7 @@ export class VisualizePageObject extends FtrService { await this.kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', - [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b', + [FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b', 'visualization:visualize:legacyChartsLibrary': !isNewLibrary, 'visualization:visualize:legacyPieChartsLibrary': !isNewLibrary, }); @@ -197,6 +197,10 @@ export class VisualizePageObject extends FtrService { return await this.hasVisType('tile_map'); } + public async clickTimelion() { + await this.clickVisType('timelion'); + } + public async clickTagCloud() { await this.clickVisType('tagcloud'); } diff --git a/test/functional/screenshots/baseline/tsvb_dashboard.png b/test/functional/screenshots/baseline/tsvb_dashboard.png index 8c922d9d176f7..a36cfffebf080 100644 Binary files a/test/functional/screenshots/baseline/tsvb_dashboard.png and b/test/functional/screenshots/baseline/tsvb_dashboard.png differ diff --git a/test/functional/services/monaco_editor.ts b/test/functional/services/monaco_editor.ts index d2afa1e3b6e92..90674e101fc4e 100644 --- a/test/functional/services/monaco_editor.ts +++ b/test/functional/services/monaco_editor.ts @@ -27,13 +27,13 @@ export class MonacoEditorService extends FtrService { return values[nthIndex] as string; } - public async setCodeEditorValue(nthIndex: number, value: string) { + public async setCodeEditorValue(value: string, nthIndex = 0) { await this.retry.try(async () => { await this.browser.execute( (editorIndex, codeEditorValue) => { const editor = (window as any).MonacoEnvironment.monaco.editor; const instance = editor.getModels()[editorIndex]; - instance.setValue(JSON.parse(codeEditorValue)); + instance.setValue(codeEditorValue); }, nthIndex, value diff --git a/test/scripts/jenkins_xpack_package_deb.sh b/test/scripts/jenkins_xpack_package_deb.sh index 42098a6464f53..626036e8db3f5 100755 --- a/test/scripts/jenkins_xpack_package_deb.sh +++ b/test/scripts/jenkins_xpack_package_deb.sh @@ -4,6 +4,7 @@ set -e source src/dev/ci_setup/setup_env.sh +mkdir -p target gsutil -q -m cp "gs://ci-artifacts.kibana.dev/package-testing/$GIT_COMMIT/kibana-*.deb" ./target export VAGRANT_CWD=test/package diff --git a/test/scripts/jenkins_xpack_package_docker.sh b/test/scripts/jenkins_xpack_package_docker.sh index 6cae225830380..c9f94b2c1eb4f 100755 --- a/test/scripts/jenkins_xpack_package_docker.sh +++ b/test/scripts/jenkins_xpack_package_docker.sh @@ -4,6 +4,7 @@ set -e source src/dev/ci_setup/setup_env.sh +mkdir -p target gsutil -q -m cp "gs://ci-artifacts.kibana.dev/package-testing/$GIT_COMMIT/kibana-[0-9]*-docker-image.tar.gz" ./target export VAGRANT_CWD=test/package diff --git a/test/scripts/jenkins_xpack_package_rpm.sh b/test/scripts/jenkins_xpack_package_rpm.sh index 6aa7754ee4b21..08095ce48c1e5 100755 --- a/test/scripts/jenkins_xpack_package_rpm.sh +++ b/test/scripts/jenkins_xpack_package_rpm.sh @@ -4,6 +4,7 @@ set -e source src/dev/ci_setup/setup_env.sh +mkdir -p target gsutil -q -m cp "gs://ci-artifacts.kibana.dev/package-testing/$GIT_COMMIT/kibana-*.rpm" ./target export VAGRANT_CWD=test/package diff --git a/tsconfig.json b/tsconfig.json index 082325306e379..3d6c29875c902 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,6 +31,7 @@ { "path": "./src/plugins/expressions/tsconfig.json" }, { "path": "./src/plugins/home/tsconfig.json" }, { "path": "./src/plugins/inspector/tsconfig.json" }, + { "path": "./src/plugins/interactive_setup/tsconfig.json" }, { "path": "./src/plugins/kibana_legacy/tsconfig.json" }, { "path": "./src/plugins/kibana_overview/tsconfig.json" }, { "path": "./src/plugins/kibana_react/tsconfig.json" }, @@ -70,6 +71,7 @@ { "path": "./src/plugins/visualize/tsconfig.json" }, { "path": "./src/plugins/index_pattern_management/tsconfig.json" }, { "path": "./src/plugins/index_pattern_field_editor/tsconfig.json" }, + { "path": "./src/plugins/index_pattern_editor/tsconfig.json" }, { "path": "./x-pack/plugins/actions/tsconfig.json" }, { "path": "./x-pack/plugins/alerting/tsconfig.json" }, { "path": "./x-pack/plugins/apm/tsconfig.json" }, diff --git a/tsconfig.refs.json b/tsconfig.refs.json index bbaf18d29ae2a..1807a7014e389 100644 --- a/tsconfig.refs.json +++ b/tsconfig.refs.json @@ -16,6 +16,7 @@ { "path": "./src/plugins/expressions/tsconfig.json" }, { "path": "./src/plugins/home/tsconfig.json" }, { "path": "./src/plugins/inspector/tsconfig.json" }, + { "path": "./src/plugins/interactive_setup/tsconfig.json" }, { "path": "./src/plugins/kibana_legacy/tsconfig.json" }, { "path": "./src/plugins/kibana_overview/tsconfig.json" }, { "path": "./src/plugins/kibana_react/tsconfig.json" }, @@ -56,6 +57,7 @@ { "path": "./src/plugins/visualizations/tsconfig.json" }, { "path": "./src/plugins/visualize/tsconfig.json" }, { "path": "./src/plugins/index_pattern_management/tsconfig.json" }, + { "path": "./src/plugins/index_pattern_editor/tsconfig.json" }, { "path": "./test/tsconfig.json" }, { "path": "./x-pack/plugins/actions/tsconfig.json" }, { "path": "./x-pack/plugins/alerting/tsconfig.json" }, diff --git a/typings/index.d.ts b/typings/index.d.ts index 2a5c5e3fa430f..85c001b26031b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -37,3 +37,4 @@ declare module 'react-syntax-highlighter/dist/cjs/prism-light'; // Monaco languages support declare module 'monaco-editor/esm/vs/basic-languages/markdown/markdown'; declare module 'monaco-editor/esm/vs/basic-languages/css/css'; +declare module 'monaco-editor/esm/vs/basic-languages/yaml/yaml'; diff --git a/x-pack/plugins/apm/common/connections.ts b/x-pack/plugins/apm/common/connections.ts index aa3863374337c..1fde50ce5489e 100644 --- a/x-pack/plugins/apm/common/connections.ts +++ b/x-pack/plugins/apm/common/connections.ts @@ -47,6 +47,10 @@ export interface ConnectionStatsItem { value: number | null; timeseries: Coordinate[]; }; + totalTime: { + value: number | null; + timeseries: Coordinate[]; + }; }; } diff --git a/x-pack/plugins/apm/common/service_map.ts b/x-pack/plugins/apm/common/service_map.ts index 303f6b02c0ea2..b8e6922414ebf 100644 --- a/x-pack/plugins/apm/common/service_map.ts +++ b/x-pack/plugins/apm/common/service_map.ts @@ -58,9 +58,9 @@ export interface Connection { destination: ConnectionNode; } -export interface ServiceNodeStats { - avgMemoryUsage: number | null; - avgCpuUsage: number | null; +export interface NodeStats { + avgMemoryUsage?: number | null; + avgCpuUsage?: number | null; transactionStats: { avgTransactionDuration: number | null; avgRequestsPerMinute: number | null; diff --git a/x-pack/plugins/apm/common/utils/formatters/datetime.ts b/x-pack/plugins/apm/common/utils/formatters/datetime.ts index 88f70753f47c8..df9cb38b5d009 100644 --- a/x-pack/plugins/apm/common/utils/formatters/datetime.ts +++ b/x-pack/plugins/apm/common/utils/formatters/datetime.ts @@ -108,7 +108,10 @@ function getFormatsAccordingToDateDifference( } export function asAbsoluteDateTime( - time: number, + /** + * timestamp in milliseconds or ISO timestamp + */ + time: number | string, timeUnit: TimeUnit = 'milliseconds' ) { const momentTime = moment(time); diff --git a/x-pack/plugins/apm/e2e/cypress/integration/apm.feature b/x-pack/plugins/apm/e2e/cypress/integration/apm.feature deleted file mode 100644 index 0cc8f00d48dfd..0000000000000 --- a/x-pack/plugins/apm/e2e/cypress/integration/apm.feature +++ /dev/null @@ -1,6 +0,0 @@ -Feature: APM - - Scenario: Transaction latency charts - Given a user browses the APM UI application - When the user inspects the opbeans-node service - Then should redirect to correct path diff --git a/x-pack/plugins/apm/e2e/cypress/support/step_definitions/apm.ts b/x-pack/plugins/apm/e2e/cypress/support/step_definitions/apm.ts deleted file mode 100644 index d41f4cf508396..0000000000000 --- a/x-pack/plugins/apm/e2e/cypress/support/step_definitions/apm.ts +++ /dev/null @@ -1,31 +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 { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'; -import { loginAndWaitForPage } from '../../integration/helpers'; - -/** The default time in ms to wait for a Cypress command to complete */ -export const DEFAULT_TIMEOUT = 60 * 1000; - -Given(`a user browses the APM UI application`, () => { - // Open service inventory page - loginAndWaitForPage(`/app/apm/services`, { - from: '2020-06-01T14:59:32.686Z', - to: '2020-06-16T16:59:36.219Z', - }); -}); - -When(`the user inspects the opbeans-node service`, () => { - // click opbeans-node service - cy.get(':contains(opbeans-node)', { timeout: DEFAULT_TIMEOUT }) - .last() - .click({ force: true }); -}); - -Then(`should redirect to correct path`, () => { - cy.url().should('contain', `/app/apm/services/opbeans-node/overview`); -}); diff --git a/x-pack/plugins/apm/public/components/app/Settings/agent_configurations/List/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/agent_configurations/List/index.tsx index 51a025df88d8e..140584a625b90 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/agent_configurations/List/index.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/agent_configurations/List/index.tsx @@ -127,10 +127,10 @@ export function AgentConfigurationList({ width: theme.eui.euiSizeXL, name: '', sortable: true, - render: (isApplied: boolean) => ( + render: (_, { applied_by_agent: appliedByAgent }) => ( ), @@ -177,7 +177,7 @@ export function AgentConfigurationList({ { defaultMessage: 'Service environment' } ), sortable: true, - render: (environment: string) => getOptionLabel(environment), + render: (_, { service }) => getOptionLabel(service.environment), }, { align: 'right', @@ -187,8 +187,8 @@ export function AgentConfigurationList({ { defaultMessage: 'Last updated' } ), sortable: true, - render: (value: number) => ( - + render: (_, item) => ( + ), }, ...(canSave diff --git a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/jobs_list.tsx b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/jobs_list.tsx index d520036d5f387..81a0da9792830 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/jobs_list.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/jobs_list.tsx @@ -43,7 +43,7 @@ const columns: Array> = [ 'xpack.apm.settings.anomalyDetection.jobList.actionColumnLabel', { defaultMessage: 'Action' } ), - render: (jobId: string) => ( + render: (_, { job_id: jobId }) => ( {i18n.translate( 'xpack.apm.settings.anomalyDetection.jobList.mlJobLinkText', diff --git a/x-pack/plugins/apm/public/components/app/Settings/customize_ui/custom_link/custom_link_table.tsx b/x-pack/plugins/apm/public/components/app/Settings/customize_ui/custom_link/custom_link_table.tsx index f49f27d94a085..4a242bb661e3a 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/customize_ui/custom_link/custom_link_table.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/customize_ui/custom_link/custom_link_table.tsx @@ -18,7 +18,7 @@ import React, { useState } from 'react'; import { CustomLink } from '../../../../../../common/custom_link/custom_link_types'; import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context'; import { LoadingStatePrompt } from '../../../../shared/LoadingStatePrompt'; -import { ManagedTable } from '../../../../shared/managed_table'; +import { ITableColumn, ManagedTable } from '../../../../shared/managed_table'; import { TimestampTooltip } from '../../../../shared/TimestampTooltip'; interface Props { @@ -31,7 +31,7 @@ export function CustomLinkTable({ items = [], onCustomLinkSelected }: Props) { const { core } = useApmPluginContext(); const canSave = core.application.capabilities.apm.save; - const columns = [ + const columns: Array> = [ { field: 'label', name: i18n.translate( diff --git a/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx b/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx index 1b696b847f75b..425506a3e035a 100644 --- a/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx +++ b/x-pack/plugins/apm/public/components/app/backend_detail_overview/backend_detail_dependencies_table.tsx @@ -15,6 +15,8 @@ import { getTimeRangeComparison } from '../../shared/time_comparison/get_time_ra import { DependenciesTable } from '../../shared/dependencies_table'; import { useApmBackendContext } from '../../../context/apm_backend/use_apm_backend_context'; import { ServiceLink } from '../../shared/service_link'; +import { useApmRouter } from '../../../hooks/use_apm_router'; +import { DependenciesTableServiceMapLink } from '../../shared/dependencies_table/dependencies_table_service_map_link'; export function BackendDetailDependenciesTable() { const { @@ -25,6 +27,16 @@ export function BackendDetailDependenciesTable() { query: { rangeFrom, rangeTo, kuery }, } = useApmParams('/backends/:backendName/overview'); + const router = useApmRouter(); + + const serviceMapLink = router.link('/service-map', { + query: { + rangeFrom, + rangeTo, + environment, + }, + }); + const { offset } = getTimeRangeComparison({ start, end, @@ -99,6 +111,7 @@ export function BackendDetailDependenciesTable() { )} status={status} compact={false} + link={} /> ); } diff --git a/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx b/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx index 513daa9289c8f..c89526b332084 100644 --- a/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx @@ -7,6 +7,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; +import { useApmRouter } from '../../../../hooks/use_apm_router'; import { getNodeName, NodeType } from '../../../../../common/connections'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; @@ -14,6 +15,7 @@ import { useFetcher } from '../../../../hooks/use_fetcher'; import { getTimeRangeComparison } from '../../../shared/time_comparison/get_time_range_comparison'; import { DependenciesTable } from '../../../shared/dependencies_table'; import { BackendLink } from '../../../shared/backend_link'; +import { DependenciesTableServiceMapLink } from '../../../shared/dependencies_table/dependencies_table_service_map_link'; export function BackendInventoryDependenciesTable() { const { @@ -24,6 +26,15 @@ export function BackendInventoryDependenciesTable() { query: { rangeFrom, rangeTo, kuery }, } = useApmParams('/backends'); + const router = useApmRouter(); + const serviceMapLink = router.link('/service-map', { + query: { + rangeFrom, + rangeTo, + environment, + }, + }); + const { offset } = getTimeRangeComparison({ start, end, @@ -40,11 +51,11 @@ export function BackendInventoryDependenciesTable() { return callApmApi({ endpoint: 'GET /api/apm/backends/top_backends', params: { - query: { start, end, environment, numBuckets: 20, offset }, + query: { start, end, environment, numBuckets: 20, offset, kuery }, }, }); }, - [start, end, environment, offset] + [start, end, environment, offset, kuery] ); const dependencies = @@ -96,6 +107,7 @@ export function BackendInventoryDependenciesTable() { )} status={status} compact={false} + link={} /> ); } 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 e53aaf97cdf75..24257bcefa7f1 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 @@ -75,6 +75,7 @@ export function ErrorDistribution({ distribution, title }: Props) { ); const tooltipProps: SettingsSpec['tooltip'] = { + stickTo: 'top', headerFormatter: (tooltip: TooltipValue) => { const serie = buckets.find((bucket) => bucket.x0 === tooltip.value); if (serie) { diff --git a/x-pack/plugins/apm/public/components/app/error_group_overview/List/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_overview/List/index.tsx index 6e181535cc05c..0575146a6bf5a 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_overview/List/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_overview/List/index.tsx @@ -17,7 +17,7 @@ import { truncate, unit } from '../../../../utils/style'; import { ErrorDetailLink } from '../../../shared/Links/apm/ErrorDetailLink'; import { ErrorOverviewLink } from '../../../shared/Links/apm/ErrorOverviewLink'; import { APMQueryParams } from '../../../shared/Links/url_helpers'; -import { ManagedTable } from '../../../shared/managed_table'; +import { ITableColumn, ManagedTable } from '../../../shared/managed_table'; import { TimestampTooltip } from '../../../shared/TimestampTooltip'; const GroupIdLink = euiStyled(ErrorDetailLink)` @@ -52,8 +52,8 @@ interface Props { function ErrorGroupList({ items, serviceName }: Props) { const { urlParams } = useUrlParams(); - const columns = useMemo( - () => [ + const columns = useMemo(() => { + return [ { name: ( <> @@ -80,7 +80,7 @@ function ErrorGroupList({ items, serviceName }: Props) { field: 'groupId', sortable: false, width: `${unit * 6}px`, - render: (groupId: string) => { + render: (_, { groupId }) => { return ( {groupId.slice(0, 5) || NOT_AVAILABLE_LABEL} @@ -94,7 +94,7 @@ function ErrorGroupList({ items, serviceName }: Props) { }), field: 'type', sortable: false, - render: (type: string) => { + render: (_, { type }) => { return ( { + render: (_, item: ErrorGroupItem) => { return ( - {message || NOT_AVAILABLE_LABEL} + {item.message || NOT_AVAILABLE_LABEL}
    @@ -151,8 +151,8 @@ function ErrorGroupList({ items, serviceName }: Props) { field: 'handled', sortable: false, align: 'right', - render: (isUnhandled: boolean) => - isUnhandled === false && ( + render: (_, { handled }) => + handled === false && ( {i18n.translate('xpack.apm.errorsTable.unhandledLabel', { defaultMessage: 'Unhandled', @@ -167,8 +167,10 @@ function ErrorGroupList({ items, serviceName }: Props) { field: 'occurrenceCount', sortable: true, dataType: 'number', - render: (value?: number) => - value ? numeral(value).format('0.[0]a') : NOT_AVAILABLE_LABEL, + render: (_, { occurrenceCount }) => + occurrenceCount + ? numeral(occurrenceCount).format('0.[0]a') + : NOT_AVAILABLE_LABEL, }, { field: 'latestOccurrenceAt', @@ -180,16 +182,15 @@ function ErrorGroupList({ items, serviceName }: Props) { } ), align: 'right', - render: (value?: number) => - value ? ( - + render: (_, { latestOccurrenceAt }) => + latestOccurrenceAt ? ( + ) : ( NOT_AVAILABLE_LABEL ), }, - ], - [serviceName, urlParams] - ); + ] as Array>; + }, [serviceName, urlParams]); return ( + + + +

    + {i18n.translate( + 'xpack.apm.serviceDependencies.breakdownChartTitle', + { + defaultMessage: 'Time spent by dependency', + } + )} +

    +
    + +
    +
    + + + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_dependencies/service_dependencies_breakdown_chart.tsx b/x-pack/plugins/apm/public/components/app/service_dependencies/service_dependencies_breakdown_chart.tsx new file mode 100644 index 0000000000000..a33b0db7c4baf --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_dependencies/service_dependencies_breakdown_chart.tsx @@ -0,0 +1,68 @@ +/* + * 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 { getVizColorForIndex } from '../../../../common/viz_colors'; +import { Coordinate, TimeSeries } from '../../../../typings/timeseries'; +import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; +import { useApmParams } from '../../../hooks/use_apm_params'; +import { useFetcher } from '../../../hooks/use_fetcher'; +import { useTimeRange } from '../../../hooks/use_time_range'; +import { BreakdownChart } from '../../shared/charts/breakdown_chart'; + +export function ServiceDependenciesBreakdownChart({ + height, +}: { + height: number; +}) { + const { start, end } = useTimeRange(); + const { serviceName } = useApmServiceContext(); + + const { + query: { kuery, environment }, + } = useApmParams('/services/:serviceName/dependencies'); + + const { data, status } = useFetcher( + (callApmApi) => { + return callApmApi({ + endpoint: 'GET /api/apm/services/{serviceName}/dependencies/breakdown', + params: { + path: { + serviceName, + }, + query: { + start, + end, + kuery, + environment, + }, + }, + }); + }, + [serviceName, start, end, kuery, environment] + ); + + const timeseries: Array> = + data?.breakdown.map((item, index) => { + return { + title: item.title, + data: item.data, + type: 'area', + color: getVizColorForIndex(index), + }; + }) ?? []; + + return ( + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx index ef0a5f2df0434..290e71a23bbb8 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx @@ -8,6 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useEffect } from 'react'; +import uuid from 'uuid'; import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public'; import { useAnomalyDetectionJobsContext } from '../../../context/anomaly_detection_jobs/use_anomaly_detection_jobs_context'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; @@ -16,26 +17,44 @@ import { useLocalStorage } from '../../../hooks/useLocalStorage'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; import { useUpgradeAssistantHref } from '../../shared/Links/kibana'; import { SearchBar } from '../../shared/search_bar'; +import { getTimeRangeComparison } from '../../shared/time_comparison/get_time_range_comparison'; import { NoServicesMessage } from './no_services_message'; import { ServiceList } from './service_list'; import { MLCallout } from './service_list/MLCallout'; const initialData = { - items: [], - hasHistoricalData: true, - hasLegacyData: false, + requestId: '', + mainStatisticsData: { + items: [], + hasHistoricalData: true, + hasLegacyData: false, + }, }; let hasDisplayedToast = false; function useServicesFetcher() { const { - urlParams: { environment, kuery, start, end }, + urlParams: { + environment, + kuery, + start, + end, + comparisonEnabled, + comparisonType, + }, } = useUrlParams(); const { core } = useApmPluginContext(); const upgradeAssistantHref = useUpgradeAssistantHref(); - const { data = initialData, status } = useFetcher( + const { offset } = getTimeRangeComparison({ + start, + end, + comparisonEnabled, + comparisonType, + }); + + const { data = initialData, status: mainStatisticsStatus } = useFetcher( (callApmApi) => { if (start && end) { return callApmApi({ @@ -48,14 +67,50 @@ function useServicesFetcher() { end, }, }, + }).then((mainStatisticsData) => { + return { + requestId: uuid(), + mainStatisticsData, + }; }); } }, [environment, kuery, start, end] ); + const { mainStatisticsData, requestId } = data; + + const { data: comparisonData, status: comparisonStatus } = useFetcher( + (callApmApi) => { + if (start && end && mainStatisticsData.items.length) { + return callApmApi({ + endpoint: 'GET /api/apm/services/detailed_statistics', + params: { + query: { + environment, + kuery, + start, + end, + serviceNames: JSON.stringify( + mainStatisticsData.items + .map(({ serviceName }) => serviceName) + // Service name is sorted to guarantee the same order every time this API is called so the result can be cached. + .sort() + ), + offset, + }, + }, + }); + } + }, + // only fetches detailed statistics when requestId is invalidated by main statistics api call or offset is changed + // eslint-disable-next-line react-hooks/exhaustive-deps + [requestId, offset], + { preservePreviousData: false } + ); + useEffect(() => { - if (data.hasLegacyData && !hasDisplayedToast) { + if (mainStatisticsData.hasLegacyData && !hasDisplayedToast) { hasDisplayedToast = true; core.notifications.toasts.addWarning({ @@ -82,14 +137,30 @@ function useServicesFetcher() { ), }); } - }, [data.hasLegacyData, upgradeAssistantHref, core.notifications.toasts]); + }, [ + mainStatisticsData.hasLegacyData, + upgradeAssistantHref, + core.notifications.toasts, + ]); - return { servicesData: data, servicesStatus: status }; + return { + servicesData: mainStatisticsData, + servicesStatus: mainStatisticsStatus, + comparisonData, + isLoading: + mainStatisticsStatus === FETCH_STATUS.LOADING || + comparisonStatus === FETCH_STATUS.LOADING, + }; } export function ServiceInventory() { const { core } = useApmPluginContext(); - const { servicesData, servicesStatus } = useServicesFetcher(); + const { + servicesData, + servicesStatus, + comparisonData, + isLoading, + } = useServicesFetcher(); const { anomalyDetectionJobsData, @@ -111,7 +182,7 @@ export function ServiceInventory() { return ( <> - + {displayMlCallout && ( @@ -120,12 +191,16 @@ export function ServiceInventory() { )} + !isLoading && ( + + ) } /> diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.tsx index 7ca56419f22bd..a2dc5feec44f8 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/no_services_message.tsx @@ -8,11 +8,10 @@ import { EuiEmptyPrompt, EuiLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { SetupInstructionsLink } from '../../shared/Links/SetupInstructionsLink'; -import { LoadingStatePrompt } from '../../shared/LoadingStatePrompt'; import { FETCH_STATUS } from '../../../hooks/use_fetcher'; import { ErrorStatePrompt } from '../../shared/ErrorStatePrompt'; import { useUpgradeAssistantHref } from '../../shared/Links/kibana'; +import { SetupInstructionsLink } from '../../shared/Links/SetupInstructionsLink'; interface Props { // any data submitted from APM agents found (not just in the given time range) @@ -23,10 +22,6 @@ interface Props { export function NoServicesMessage({ historicalDataFound, status }: Props) { const upgradeAssistantHref = useUpgradeAssistantHref(); - if (status === 'loading') { - return ; - } - if (status === 'failure') { return ; } diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/ServiceListMetric.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/ServiceListMetric.tsx index 6ffc6f3f9448e..af2cde7f861cc 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/ServiceListMetric.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/ServiceListMetric.tsx @@ -6,16 +6,26 @@ */ import React from 'react'; +import { Coordinate } from '../../../../../typings/timeseries'; import { SparkPlot } from '../../../shared/charts/spark_plot'; export function ServiceListMetric({ color, series, valueLabel, + comparisonSeries, }: { color: 'euiColorVis1' | 'euiColorVis0' | 'euiColorVis7'; - series?: Array<{ x: number; y: number | null }>; + series?: Coordinate[]; + comparisonSeries?: Coordinate[]; valueLabel: React.ReactNode; }) { - return ; + return ( + + ); } diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/__fixtures__/service_api_mock_data.ts b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/__fixtures__/service_api_mock_data.ts index e6ad70fc035d8..0f5edb5a4c9ce 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/__fixtures__/service_api_mock_data.ts +++ b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/__fixtures__/service_api_mock_data.ts @@ -14,18 +14,18 @@ export const items: ServiceListAPIResponse['items'] = [ serviceName: 'opbeans-node', transactionType: 'request', agentName: 'nodejs', - transactionsPerMinute: { value: 0, timeseries: [] }, - transactionErrorRate: { value: 46.06666666666667, timeseries: [] }, - avgResponseTime: { value: null, timeseries: [] }, + throughput: 0, + transactionErrorRate: 46.06666666666667, + latency: null, environments: ['test'], }, { serviceName: 'opbeans-python', transactionType: 'page-load', agentName: 'python', - transactionsPerMinute: { value: 86.93333333333334, timeseries: [] }, - transactionErrorRate: { value: 12.6, timeseries: [] }, - avgResponseTime: { value: 91535.42944785276, timeseries: [] }, + throughput: 86.93333333333334, + transactionErrorRate: 12.6, + latency: 91535.42944785276, environments: [], }, ]; diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/index.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/index.tsx index 1e945aca7c916..c2ba67356fb6b 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/index.tsx @@ -39,11 +39,8 @@ import { ServiceListMetric } from './ServiceListMetric'; type ServiceListAPIResponse = APIReturnType<'GET /api/apm/services'>; type Items = ServiceListAPIResponse['items']; +type ServicesDetailedStatisticsAPIResponse = APIReturnType<'GET /api/apm/services/detailed_statistics'>; -interface Props { - items: Items; - noItemsMessage?: React.ReactNode; -} type ServiceListItem = ValuesType; function formatString(value?: string | null) { @@ -67,9 +64,11 @@ const SERVICE_HEALTH_STATUS_ORDER = [ export function getServiceColumns({ query, showTransactionTypeColumn, + comparisonData, }: { query: Record; showTransactionTypeColumn: boolean; + comparisonData?: ServicesDetailedStatisticsAPIResponse; }): Array> { return [ { @@ -136,34 +135,40 @@ export function getServiceColumns({ ] : []), { - field: 'avgResponseTime', + field: 'latency', name: i18n.translate('xpack.apm.servicesTable.latencyAvgColumnLabel', { defaultMessage: 'Latency (avg.)', }), sortable: true, dataType: 'number', - render: (_, { avgResponseTime }) => ( + render: (_, { serviceName, latency }) => ( ), align: 'left', width: `${unit * 10}px`, }, { - field: 'transactionsPerMinute', + field: 'throughput', name: i18n.translate('xpack.apm.servicesTable.throughputColumnLabel', { defaultMessage: 'Throughput', }), sortable: true, dataType: 'number', - render: (_, { transactionsPerMinute }) => ( + render: (_, { serviceName, throughput }) => ( ), align: 'left', @@ -176,14 +181,16 @@ export function getServiceColumns({ }), sortable: true, dataType: 'number', - render: (_, { transactionErrorRate }) => { - const value = transactionErrorRate?.value; - - const valueLabel = asPercent(value, 1); - + render: (_, { serviceName, transactionErrorRate }) => { + const valueLabel = asPercent(transactionErrorRate, 1); return ( @@ -195,7 +202,19 @@ export function getServiceColumns({ ]; } -export function ServiceList({ items, noItemsMessage }: Props) { +interface Props { + items: Items; + comparisonData?: ServicesDetailedStatisticsAPIResponse; + noItemsMessage?: React.ReactNode; + isLoading: boolean; +} + +export function ServiceList({ + items, + noItemsMessage, + comparisonData, + isLoading, +}: Props) { const displayHealthStatus = items.some((item) => 'healthStatus' in item); const showTransactionTypeColumn = items.some( @@ -207,8 +226,9 @@ export function ServiceList({ items, noItemsMessage }: Props) { const { query } = useApmParams('/services'); const serviceColumns = useMemo( - () => getServiceColumns({ query, showTransactionTypeColumn }), - [query, showTransactionTypeColumn] + () => + getServiceColumns({ query, showTransactionTypeColumn, comparisonData }), + [query, showTransactionTypeColumn, comparisonData] ); const columns = displayHealthStatus @@ -253,6 +273,7 @@ export function ServiceList({ items, noItemsMessage }: Props) { item.transactionsPerMinute?.value ?? 0, + (item) => item.throughput ?? 0, ], [sortDirection, sortDirection] ) @@ -281,12 +302,12 @@ export function ServiceList({ items, noItemsMessage }: Props) { // Use `?? -1` here so `undefined` will appear after/before `0`. // In the table this will make the "N/A" items always at the // bottom/top. - case 'avgResponseTime': - return item.avgResponseTime?.value ?? -1; - case 'transactionsPerMinute': - return item.transactionsPerMinute?.value ?? -1; + case 'latency': + return item.latency ?? -1; + case 'throughput': + return item.throughput ?? -1; case 'transactionErrorRate': - return item.transactionErrorRate?.value ?? -1; + return item.transactionErrorRate ?? -1; default: return item[sortField as keyof typeof item]; } diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/service_list.test.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/service_list.test.tsx index c83f9995caf2e..70a6191a1d6b4 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/service_list/service_list.test.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/service_list/service_list.test.tsx @@ -28,13 +28,17 @@ describe('ServiceList', () => { it('renders empty state', () => { expect(() => - renderWithTheme(, { wrapper: Wrapper }) + renderWithTheme(, { + wrapper: Wrapper, + }) ).not.toThrowError(); }); it('renders with data', () => { expect(() => - renderWithTheme(, { wrapper: Wrapper }) + renderWithTheme(, { + wrapper: Wrapper, + }) ).not.toThrowError(); }); @@ -70,18 +74,24 @@ describe('ServiceList', () => { describe('without ML data', () => { it('does not render the health column', () => { - const { queryByText } = renderWithTheme(, { - wrapper: Wrapper, - }); + const { queryByText } = renderWithTheme( + , + { + wrapper: Wrapper, + } + ); const healthHeading = queryByText('Health'); expect(healthHeading).toBeNull(); }); it('sorts by throughput', async () => { - const { findByTitle } = renderWithTheme(, { - wrapper: Wrapper, - }); + const { findByTitle } = renderWithTheme( + , + { + wrapper: Wrapper, + } + ); expect(await findByTitle('Throughput')).toBeInTheDocument(); }); @@ -91,6 +101,7 @@ describe('ServiceList', () => { it('renders the health column', async () => { const { findByTitle } = renderWithTheme( ({ ...item, healthStatus: ServiceHealthStatus.warning, diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/Buttons.test.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/Buttons.test.tsx deleted file mode 100644 index f6376d201f2e1..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/Buttons.test.tsx +++ /dev/null @@ -1,41 +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, { ReactNode } from 'react'; -import { Buttons } from './Buttons'; -import { render } from '@testing-library/react'; -import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; - -function Wrapper({ children }: { children?: ReactNode }) { - return {children}; -} - -describe('Popover Buttons', () => { - it('renders', () => { - expect(() => - render(, { - wrapper: Wrapper, - }) - ).not.toThrowError(); - }); - - it('handles focus click', async () => { - const onFocusClick = jest.fn(); - const result = render( - , - { wrapper: Wrapper } - ); - const focusButton = await result.findByText('Focus map'); - - focusButton.click(); - - expect(onFocusClick).toHaveBeenCalledTimes(1); - }); -}); diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/Buttons.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/Buttons.tsx deleted file mode 100644 index c4ff430e23fe8..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/Buttons.tsx +++ /dev/null @@ -1,60 +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. - */ - -/* eslint-disable @elastic/eui/href-or-on-click */ - -import { EuiButton, EuiFlexItem } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import React, { MouseEvent } from 'react'; -import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { getAPMHref } from '../../../shared/Links/apm/APMLink'; -import { APMQueryParams } from '../../../shared/Links/url_helpers'; - -interface ButtonsProps { - onFocusClick?: (event: MouseEvent) => void; - selectedNodeServiceName: string; -} - -export function Buttons({ - onFocusClick = () => {}, - selectedNodeServiceName, -}: ButtonsProps) { - const { core } = useApmPluginContext(); - const { basePath } = core.http; - const urlParams = useUrlParams().urlParams as APMQueryParams; - - const detailsUrl = getAPMHref({ - basePath, - path: `/services/${selectedNodeServiceName}`, - query: urlParams, - }); - const focusUrl = getAPMHref({ - basePath, - path: `/services/${selectedNodeServiceName}/service-map`, - query: urlParams, - }); - - return ( - <> - - - {i18n.translate('xpack.apm.serviceMap.serviceDetailsButtonText', { - defaultMessage: 'Service Details', - })} - - - - - {i18n.translate('xpack.apm.serviceMap.focusMapButtonText', { - defaultMessage: 'Focus map', - })} - - - - ); -} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/Contents.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/Contents.tsx deleted file mode 100644 index 9030aeed7b13d..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/Contents.tsx +++ /dev/null @@ -1,91 +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 { - EuiFlexGroup, - EuiFlexItem, - EuiHorizontalRule, - EuiTitle, -} from '@elastic/eui'; -import cytoscape from 'cytoscape'; -import React, { MouseEvent } from 'react'; -import { Buttons } from './Buttons'; -import { Info } from './Info'; -import { ServiceStatsFetcher } from './ServiceStatsFetcher'; -import { popoverWidth } from '../cytoscape_options'; - -interface ContentsProps { - isService: boolean; - label: string; - onFocusClick: (event: MouseEvent) => void; - selectedNodeData: cytoscape.NodeDataDefinition; - selectedNodeServiceName: string; -} - -// IE 11 does not handle flex properties as expected. With browser detection, -// we can use regular div elements to render contents that are almost identical. -// -// This method of detecting IE is from a Stack Overflow answer: -// https://stackoverflow.com/a/21825207 -// -// @ts-expect-error `documentMode` is not recognized as a valid property of `document`. -const isIE11 = !!window.MSInputMethodContext && !!document.documentMode; - -function FlexColumnGroup(props: { - children: React.ReactNode; - style: React.CSSProperties; - direction: 'column'; - gutterSize: 's'; -}) { - if (isIE11) { - const { direction, gutterSize, ...rest } = props; - return
    ; - } - return ; -} -function FlexColumnItem(props: { children: React.ReactNode }) { - return isIE11 ?
    : ; -} - -export function Contents({ - selectedNodeData, - isService, - label, - onFocusClick, - selectedNodeServiceName, -}: ContentsProps) { - return ( - - - -

    {label}

    -
    - -
    - - {isService ? ( - - ) : ( - - )} - - {isService && ( - - )} -
    - ); -} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/Info.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/Info.tsx deleted file mode 100644 index 9577a02d68cf2..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/Info.tsx +++ /dev/null @@ -1,116 +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 { - EuiDescriptionList, - EuiDescriptionListTitle, - EuiDescriptionListDescription, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import cytoscape from 'cytoscape'; -import React, { Fragment } from 'react'; -import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; -import { - SPAN_SUBTYPE, - SPAN_TYPE, -} from '../../../../../common/elasticsearch_fieldnames'; -import { ExternalConnectionNode } from '../../../../../common/service_map'; - -const ItemRow = euiStyled.div` - line-height: 2; -`; - -const SubduedDescriptionListTitle = euiStyled(EuiDescriptionListTitle)` - &&& { - color: ${({ theme }) => theme.eui.euiTextSubduedColor}; - } -`; - -const ExternalResourcesList = euiStyled.section` - max-height: 360px; - overflow: auto; -`; - -interface InfoProps extends cytoscape.NodeDataDefinition { - type?: string; - subtype?: string; - className?: string; -} - -export function Info(data: InfoProps) { - // For nodes with span.type "db", convert it to "database". - // Otherwise leave it as-is. - const type = data[SPAN_TYPE] === 'db' ? 'database' : data[SPAN_TYPE]; - - // Externals should not have a subtype so make it undefined if the type is external. - const subtype = data[SPAN_TYPE] !== 'external' && data[SPAN_SUBTYPE]; - - const listItems = [ - { - title: i18n.translate('xpack.apm.serviceMap.typePopoverStat', { - defaultMessage: 'Type', - }), - description: type, - }, - { - title: i18n.translate('xpack.apm.serviceMap.subtypePopoverStat', { - defaultMessage: 'Subtype', - }), - description: subtype, - }, - ]; - - if (data.groupedConnections) { - return ( - - - {data.groupedConnections.map((resource: ExternalConnectionNode) => { - const title = - resource.label || resource['span.destination.service.resource']; - const desc = `${resource['span.type']} (${resource['span.subtype']})`; - return ( - - - {title} - - - {desc} - - - ); - })} - - - ); - } - - return ( - <> - {listItems.map( - ({ title, description }) => - description && ( -
    - - - {title} - - - {description} - - -
    - ) - )} - - ); -} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/Popover.stories.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/Popover.stories.tsx index 324a38ea5db39..faf807d4d4fc3 100644 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/Popover.stories.tsx +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/Popover.stories.tsx @@ -5,91 +5,158 @@ * 2.0. */ +import { Meta, Story } from '@storybook/react'; import cytoscape from 'cytoscape'; import { CoreStart } from 'kibana/public'; -import React, { ComponentType } from 'react'; +import React from 'react'; +import { MemoryRouter } from 'react-router-dom'; +import { Popover } from '.'; +import { createKibanaReactContext } from '../../../../../../../../src/plugins/kibana_react/public'; import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; import { MockUrlParamsContextProvider } from '../../../../context/url_params_context/mock_url_params_context_provider'; import { createCallApmApi } from '../../../../services/rest/createCallApmApi'; import { CytoscapeContext } from '../Cytoscape'; -import { Popover } from '.'; import exampleGroupedConnectionsData from '../__stories__/example_grouped_connections.json'; -export default { +interface Args { + nodeData: cytoscape.NodeDataDefinition; +} + +const stories: Meta = { title: 'app/ServiceMap/Popover', component: Popover, decorators: [ - (Story: ComponentType) => { + (StoryComponent) => { const coreMock = ({ http: { - get: async () => ({ - avgCpuUsage: 0.32809666568309237, - avgErrorRate: 0.556068173242986, - avgMemoryUsage: 0.5504868173242986, - transactionStats: { - avgRequestsPerMinute: 164.47222031860858, - avgTransactionDuration: 61634.38905590272, - }, - }), + get: () => { + return { + avgCpuUsage: 0.32809666568309237, + avgErrorRate: 0.556068173242986, + avgMemoryUsage: 0.5504868173242986, + transactionStats: { + avgRequestsPerMinute: 164.47222031860858, + avgTransactionDuration: 61634.38905590272, + }, + }; + }, }, + notifications: { toasts: { add: () => {} } }, + uiSettings: { get: () => ({}) }, } as unknown) as CoreStart; + const KibanaReactContext = createKibanaReactContext(coreMock); + createCallApmApi(coreMock); return ( - - -
    - -
    -
    -
    + + + + +
    + +
    +
    +
    +
    +
    + ); + }, + (StoryComponent, { args }) => { + const node = { + data: args?.nodeData!, + }; + + const cy = cytoscape({ + elements: [ + { data: { id: 'upstreamService' } }, + { + data: { + id: 'edge', + source: 'upstreamService', + target: node.data.id, + }, + }, + node, + ], + }); + + setTimeout(() => { + cy.$id(node.data.id!).select(); + }, 0); + + return ( + + + ); }, ], }; +export default stories; -export function Example() { +export const Backend: Story = () => { return ; -} -Example.decorators = [ - (Story: ComponentType) => { - const node = { - data: { id: 'example service', 'service.name': 'example service' }, - }; - - const cy = cytoscape({ elements: [node] }); - - setTimeout(() => { - cy.$id('example service').select(); - }, 0); +}; +Backend.args = { + nodeData: { + 'span.subtype': 'postgresql', + 'span.destination.service.resource': 'postgresql', + 'span.type': 'db', + id: '>postgresql', + label: 'postgresql', + }, +}; - return ( - - - - ); +export const BackendWithLongTitle: Story = () => { + return ; +}; +BackendWithLongTitle.args = { + nodeData: { + 'span.subtype': 'http', + 'span.destination.service.resource': + '8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243', + 'span.type': 'external', + id: '>8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243', + label: '8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243', }, -]; +}; -export function Externals() { +export const ExternalsList: Story = () => { return ; -} -Externals.decorators = [ - (Story: ComponentType) => { - const node = { - data: exampleGroupedConnectionsData, - }; - const cy = cytoscape({ elements: [node] }); +}; +ExternalsList.args = { + nodeData: exampleGroupedConnectionsData, +}; - setTimeout(() => { - cy.$id(exampleGroupedConnectionsData.id).select(); - }, 0); +export const Resource: Story = () => { + return ; +}; +Resource.args = { + nodeData: { + id: '>cdn.loom.com:443', + label: 'cdn.loom.com:443', + 'span.destination.service.resource': 'cdn.loom.com:443', + 'span.subtype': 'css', + 'span.type': 'resource', + }, +}; - return ( - - - - ); +export const Service: Story = () => { + return ; +}; +Service.args = { + nodeData: { + id: 'example service', + 'service.name': 'example service', + serviceAnomalyStats: { + serviceName: 'opbeans-java', + jobId: 'apm-production-802c-high_mean_transaction_duration', + transactionType: 'request', + actualValue: 16258.496000000017, + anomalyScore: 0, + healthStatus: 'healthy', + }, }, -]; +}; diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/ServiceStatsFetcher.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/ServiceStatsFetcher.tsx deleted file mode 100644 index 3155a65b06aca..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/ServiceStatsFetcher.tsx +++ /dev/null @@ -1,115 +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 { - EuiLoadingSpinner, - EuiFlexGroup, - EuiHorizontalRule, - EuiText, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { isNumber } from 'lodash'; -import { ServiceNodeStats } from '../../../../../common/service_map'; -import { ServiceStatsList } from './ServiceStatsList'; -import { useFetcher, FETCH_STATUS } from '../../../../hooks/use_fetcher'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { AnomalyDetection } from './anomaly_detection'; -import { ServiceAnomalyStats } from '../../../../../common/anomaly_detection'; - -interface ServiceStatsFetcherProps { - environment?: string; - serviceName: string; - serviceAnomalyStats: ServiceAnomalyStats | undefined; -} - -export function ServiceStatsFetcher({ - serviceName, - serviceAnomalyStats, -}: ServiceStatsFetcherProps) { - const { - urlParams: { environment, start, end }, - } = useUrlParams(); - - const { - data = { transactionStats: {} } as ServiceNodeStats, - status, - } = useFetcher( - (callApmApi) => { - if (serviceName && start && end) { - return callApmApi({ - endpoint: 'GET /api/apm/service-map/service/{serviceName}', - params: { - path: { serviceName }, - query: { environment, start, end }, - }, - }); - } - }, - [environment, serviceName, start, end], - { - preservePreviousData: false, - } - ); - - const isLoading = status === FETCH_STATUS.LOADING; - - if (isLoading) { - return ; - } - - const { - avgCpuUsage, - avgErrorRate, - avgMemoryUsage, - transactionStats: { avgRequestsPerMinute, avgTransactionDuration }, - } = data; - - const hasServiceData = [ - avgCpuUsage, - avgErrorRate, - avgMemoryUsage, - avgRequestsPerMinute, - avgTransactionDuration, - ].some((stat) => isNumber(stat)); - - if (!hasServiceData) { - return ( - - {i18n.translate('xpack.apm.serviceMap.popoverMetrics.noDataText', { - defaultMessage: `No data for selected environment. Try switching to another environment.`, - })} - - ); - } - return ( - <> - {serviceAnomalyStats && ( - <> - - - - )} - - - ); -} - -function LoadingSpinner() { - return ( - - - - ); -} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/ServiceStatsList.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/ServiceStatsList.tsx deleted file mode 100644 index 766debc6d5587..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/ServiceStatsList.tsx +++ /dev/null @@ -1,96 +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 { isNumber } from 'lodash'; -import React from 'react'; -import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; -import { - asDuration, - asPercent, - asTransactionRate, -} from '../../../../../common/utils/formatters'; -import { ServiceNodeStats } from '../../../../../common/service_map'; - -export const ItemRow = euiStyled('tr')` - line-height: 2; -`; - -export const ItemTitle = euiStyled('td')` - color: ${({ theme }) => theme.eui.euiTextSubduedColor}; - padding-right: 1rem; -`; - -export const ItemDescription = euiStyled('td')` - text-align: right; -`; - -type ServiceStatsListProps = ServiceNodeStats; - -export function ServiceStatsList({ - transactionStats, - avgErrorRate, - avgCpuUsage, - avgMemoryUsage, -}: ServiceStatsListProps) { - const listItems = [ - { - title: i18n.translate( - 'xpack.apm.serviceMap.avgTransDurationPopoverStat', - { - defaultMessage: 'Latency (avg.)', - } - ), - description: isNumber(transactionStats.avgTransactionDuration) - ? asDuration(transactionStats.avgTransactionDuration) - : null, - }, - { - title: i18n.translate( - 'xpack.apm.serviceMap.avgReqPerMinutePopoverMetric', - { - defaultMessage: 'Throughput (avg.)', - } - ), - description: asTransactionRate(transactionStats.avgRequestsPerMinute), - }, - { - title: i18n.translate('xpack.apm.serviceMap.errorRatePopoverStat', { - defaultMessage: 'Trans. error rate (avg.)', - }), - description: asPercent(avgErrorRate, 1, ''), - }, - { - title: i18n.translate('xpack.apm.serviceMap.avgCpuUsagePopoverStat', { - defaultMessage: 'CPU usage (avg.)', - }), - description: asPercent(avgCpuUsage, 1, ''), - }, - { - title: i18n.translate('xpack.apm.serviceMap.avgMemoryUsagePopoverStat', { - defaultMessage: 'Memory usage (avg.)', - }), - description: asPercent(avgMemoryUsage, 1, ''), - }, - ]; - - return ( - - - {listItems.map( - ({ title, description }) => - description && ( - - {title} - {description} - - ) - )} - -
    - ); -} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.tsx new file mode 100644 index 0000000000000..e0fef269f3faf --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/backend_contents.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 { EuiButton, EuiFlexItem } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { TypeOf } from '@kbn/typed-react-router-config'; +import React from 'react'; +import { ContentsProps } from '.'; +import { NodeStats } from '../../../../../common/service_map'; +import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useApmParams } from '../../../../hooks/use_apm_params'; +import { useApmRouter } from '../../../../hooks/use_apm_router'; +import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; +import { ApmRoutes } from '../../../routing/apm_route_config'; +import { StatsList } from './stats_list'; + +export function BackendContents({ nodeData }: ContentsProps) { + const { query } = useApmParams('/*'); + const apmRouter = useApmRouter(); + const { + urlParams: { environment, start, end }, + } = useUrlParams(); + + const backendName = nodeData.label; + + const { data = { transactionStats: {} } as NodeStats, status } = useFetcher( + (callApmApi) => { + if (backendName && start && end) { + return callApmApi({ + endpoint: 'GET /api/apm/service-map/backend/{backendName}', + params: { + path: { backendName }, + query: { + environment, + start, + end, + }, + }, + }); + } + }, + [environment, backendName, start, end], + { + preservePreviousData: false, + } + ); + + const isLoading = status === FETCH_STATUS.LOADING; + const detailsUrl = apmRouter.link('/backends/:backendName/overview', { + path: { backendName }, + query: query as TypeOf< + ApmRoutes, + '/backends/:backendName/overview' + >['query'], + }); + + return ( + <> + + + + + + {i18n.translate('xpack.apm.serviceMap.backendDetailsButtonText', { + defaultMessage: 'Backend Details', + })} + + + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/externals_list_contents.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/externals_list_contents.tsx new file mode 100644 index 0000000000000..c8ab7a653b201 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/externals_list_contents.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 { + EuiDescriptionList, + EuiDescriptionListDescription, + EuiDescriptionListTitle, + EuiFlexItem, +} from '@elastic/eui'; +import React, { Fragment } from 'react'; +import { ContentsProps } from '.'; +import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; +import { + SPAN_DESTINATION_SERVICE_RESOURCE, + SPAN_TYPE, + SPAN_SUBTYPE, +} from '../../../../../common/elasticsearch_fieldnames'; +import { ExternalConnectionNode } from '../../../../../common/service_map'; + +const ExternalResourcesList = euiStyled.section` + max-height: 360px; + overflow: auto; +`; + +export function ExternalsListContents({ nodeData }: ContentsProps) { + return ( + + + + {nodeData.groupedConnections.map( + (resource: ExternalConnectionNode) => { + const title = + resource.label || resource[SPAN_DESTINATION_SERVICE_RESOURCE]; + const desc = `${resource[SPAN_TYPE]} (${resource[SPAN_SUBTYPE]})`; + return ( + + + {title} + + + {desc} + + + ); + } + )} + + + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/index.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/index.tsx index 4999459b30dcf..df923730a2227 100644 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/index.tsx @@ -5,6 +5,14 @@ * 2.0. */ +import { + EuiFlexGroup, + EuiFlexItem, + EuiHorizontalRule, + EuiPopover, + EuiTitle, +} from '@elastic/eui'; +import cytoscape from 'cytoscape'; import React, { CSSProperties, MouseEvent, @@ -14,13 +22,39 @@ import React, { useRef, useState, } from 'react'; -import { EuiPopover } from '@elastic/eui'; -import cytoscape from 'cytoscape'; +import { + SERVICE_NAME, + SPAN_TYPE, +} from '../../../../../common/elasticsearch_fieldnames'; import { useTheme } from '../../../../hooks/use_theme'; -import { SERVICE_NAME } from '../../../../../common/elasticsearch_fieldnames'; import { CytoscapeContext } from '../Cytoscape'; -import { getAnimationOptions } from '../cytoscape_options'; -import { Contents } from './Contents'; +import { getAnimationOptions, popoverWidth } from '../cytoscape_options'; +import { BackendContents } from './backend_contents'; +import { ExternalsListContents } from './externals_list_contents'; +import { ResourceContents } from './resource_contents'; +import { ServiceContents } from './service_contents'; + +function getContentsComponent(selectedNodeData: cytoscape.NodeDataDefinition) { + if ( + selectedNodeData.groupedConnections && + Array.isArray(selectedNodeData.groupedConnections) + ) { + return ExternalsListContents; + } + if (selectedNodeData[SERVICE_NAME]) { + return ServiceContents; + } + if (selectedNodeData[SPAN_TYPE] === 'resource') { + return ResourceContents; + } + + return BackendContents; +} + +export interface ContentsProps { + nodeData: cytoscape.NodeDataDefinition; + onFocusClick: (event: MouseEvent) => void; +} interface PopoverProps { focusedServiceName?: string; @@ -42,7 +76,6 @@ export function Popover({ focusedServiceName }: PopoverProps) { const renderedWidth = selectedNode?.renderedWidth() ?? 0; const { x, y } = selectedNode?.renderedPosition() ?? { x: -10000, y: -10000 }; const isOpen = !!selectedNode; - const isService = selectedNode?.data(SERVICE_NAME) !== undefined; const triggerStyle: CSSProperties = { background: 'transparent', height: renderedHeight, @@ -58,9 +91,8 @@ export function Popover({ focusedServiceName }: PopoverProps) { transform: `translate(${x}px, ${translateY}px)`, }; const selectedNodeData = selectedNode?.data() ?? {}; - const selectedNodeServiceName = selectedNodeData.id; - const label = selectedNodeData.label || selectedNodeServiceName; const popoverRef = useRef(null); + const selectedNodeId = selectedNodeData.id; // Set up Cytoscape event handlers useEffect(() => { @@ -99,19 +131,21 @@ export function Popover({ focusedServiceName }: PopoverProps) { if (cy) { cy.animate({ ...getAnimationOptions(theme), - center: { eles: cy.getElementById(selectedNodeServiceName) }, + center: { eles: cy.getElementById(selectedNodeId) }, }); } }, - [cy, selectedNodeServiceName, theme] + [cy, selectedNodeId, theme] ); - const isAlreadyFocused = focusedServiceName === selectedNodeServiceName; + const isAlreadyFocused = focusedServiceName === selectedNodeId; const onFocusClick = isAlreadyFocused ? centerSelectedNode : (_event: MouseEvent) => deselect(); + const ContentsComponent = getContentsComponent(selectedNodeData); + return ( - + + + +

    + {selectedNodeData.label ?? selectedNodeId} +

    +
    + +
    + +
    ); } diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/popover.test.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/popover.test.tsx new file mode 100644 index 0000000000000..9678258c4740c --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/popover.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 { composeStories } from '@storybook/testing-react'; +import { render, screen, waitFor } from '@testing-library/react'; +import React from 'react'; +import * as stories from './Popover.stories'; + +const { Backend, ExternalsList, Resource, Service } = composeStories(stories); + +describe('Popover', () => { + describe('with backend data', () => { + it('renders a backend link', async () => { + render(); + + await waitFor(() => { + expect( + screen.getByRole('link', { name: /backend details/i }) + ).toBeInTheDocument(); + }); + }); + }); + + describe('with externals list data', () => { + it('renders an externals list', async () => { + render(); + + await waitFor(() => { + expect( + screen.getByText(/813-mam-392.mktoresp.com:443/) + ).toBeInTheDocument(); + }); + }); + }); + + describe('with resource data', () => { + it('renders with no buttons', async () => { + render(); + + await waitFor(() => { + expect(screen.queryByRole('link')).not.toBeInTheDocument(); + }); + }); + }); + + describe('with service data', () => { + it('renders contents for a service', async () => { + render(); + + await waitFor(() => { + expect( + screen.getByRole('link', { name: /service details/i }) + ).toBeInTheDocument(); + }); + }); + }); +}); diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/resource_contents.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/resource_contents.tsx new file mode 100644 index 0000000000000..e0cfb8f16f61d --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/resource_contents.tsx @@ -0,0 +1,69 @@ +/* + * 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 { + EuiDescriptionListDescription, + EuiDescriptionListTitle, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import type { ContentsProps } from '.'; +import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; +import { + SPAN_SUBTYPE, + SPAN_TYPE, +} from '../../../../../common/elasticsearch_fieldnames'; + +const ItemRow = euiStyled.div` + line-height: 2; +`; + +const SubduedDescriptionListTitle = euiStyled(EuiDescriptionListTitle)` + &&& { + color: ${({ theme }) => theme.eui.euiTextSubduedColor}; + } +`; + +export function ResourceContents({ nodeData }: ContentsProps) { + const subtype = nodeData[SPAN_SUBTYPE]; + const type = nodeData[SPAN_TYPE]; + + const listItems = [ + { + title: i18n.translate('xpack.apm.serviceMap.typePopoverStat', { + defaultMessage: 'Type', + }), + description: type, + }, + { + title: i18n.translate('xpack.apm.serviceMap.subtypePopoverStat', { + defaultMessage: 'Subtype', + }), + description: subtype, + }, + ]; + + return ( + <> + {listItems.map( + ({ title, description }) => + description && ( +
    + + + {title} + + + {description} + + +
    + ) + )} + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/service_contents.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/service_contents.tsx new file mode 100644 index 0000000000000..b486e5e19fb03 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/service_contents.tsx @@ -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. + */ + +/* eslint-disable @elastic/eui/href-or-on-click */ + +import { EuiButton, EuiFlexItem, EuiHorizontalRule } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import type { ContentsProps } from '.'; +import { NodeStats } from '../../../../../common/service_map'; +import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useApmRouter } from '../../../../hooks/use_apm_router'; +import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; +import { AnomalyDetection } from './anomaly_detection'; +import { StatsList } from './stats_list'; + +export function ServiceContents({ onFocusClick, nodeData }: ContentsProps) { + const apmRouter = useApmRouter(); + + const { + urlParams: { environment, start, end }, + } = useUrlParams(); + + const serviceName = nodeData.id!; + + const { data = { transactionStats: {} } as NodeStats, status } = useFetcher( + (callApmApi) => { + if (serviceName && start && end) { + return callApmApi({ + endpoint: 'GET /api/apm/service-map/service/{serviceName}', + params: { + path: { serviceName }, + query: { environment, start, end }, + }, + }); + } + }, + [environment, serviceName, start, end], + { + preservePreviousData: false, + } + ); + + const isLoading = status === FETCH_STATUS.LOADING; + + const detailsUrl = apmRouter.link('/services/:serviceName', { + path: { serviceName }, + }); + + const focusUrl = apmRouter.link('/services/:serviceName/service-map', { + path: { serviceName }, + }); + + const { serviceAnomalyStats } = nodeData; + + return ( + <> + + {serviceAnomalyStats && ( + <> + + + + )} + + + + + {i18n.translate('xpack.apm.serviceMap.serviceDetailsButtonText', { + defaultMessage: 'Service Details', + })} + + + + + {i18n.translate('xpack.apm.serviceMap.focusMapButtonText', { + defaultMessage: 'Focus map', + })} + + + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/service_stats_list.stories.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/service_stats_list.stories.tsx deleted file mode 100644 index f1a89043f826e..0000000000000 --- a/x-pack/plugins/apm/public/components/app/service_map/Popover/service_stats_list.stories.tsx +++ /dev/null @@ -1,56 +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 { ServiceStatsList } from './ServiceStatsList'; - -export default { - title: 'app/ServiceMap/Popover/ServiceStatsList', - component: ServiceStatsList, -}; - -export function Example() { - return ( - - ); -} - -export function SomeNullValues() { - return ( - - ); -} - -export function AllNullValues() { - return ( - - ); -} diff --git a/x-pack/plugins/apm/public/components/app/service_map/Popover/stats_list.tsx b/x-pack/plugins/apm/public/components/app/service_map/Popover/stats_list.tsx new file mode 100644 index 0000000000000..88915b9bc9f34 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_map/Popover/stats_list.tsx @@ -0,0 +1,139 @@ +/* + * 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 { EuiFlexGroup, EuiLoadingSpinner, EuiText } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { isNumber } from 'lodash'; +import React from 'react'; +import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; +import { NodeStats } from '../../../../../common/service_map'; +import { + asDuration, + asPercent, + asTransactionRate, +} from '../../../../../common/utils/formatters'; + +export const ItemRow = euiStyled.tr` + line-height: 2; +`; + +export const ItemTitle = euiStyled.td` + color: ${({ theme }) => theme.eui.euiTextSubduedColor}; + padding-right: 1rem; +`; + +export const ItemDescription = euiStyled.td` + text-align: right; +`; + +function LoadingSpinner() { + return ( + + + + ); +} + +function NoDataMessage() { + return ( + + {i18n.translate('xpack.apm.serviceMap.popover.noDataText', { + defaultMessage: `No data for selected environment. Try switching to another environment.`, + })} + + ); +} + +interface StatsListProps { + isLoading: boolean; + data: NodeStats; +} + +export function StatsList({ data, isLoading }: StatsListProps) { + const { + avgCpuUsage, + avgErrorRate, + avgMemoryUsage, + transactionStats: { avgRequestsPerMinute, avgTransactionDuration }, + } = data; + + const hasData = [ + avgCpuUsage, + avgErrorRate, + avgMemoryUsage, + avgRequestsPerMinute, + avgTransactionDuration, + ].some((stat) => isNumber(stat)); + + if (isLoading) { + return ; + } + + if (!hasData) { + return ; + } + + const items = [ + { + title: i18n.translate( + 'xpack.apm.serviceMap.avgTransDurationPopoverStat', + { + defaultMessage: 'Latency (avg.)', + } + ), + description: isNumber(avgTransactionDuration) + ? asDuration(avgTransactionDuration) + : null, + }, + { + title: i18n.translate( + 'xpack.apm.serviceMap.avgReqPerMinutePopoverMetric', + { + defaultMessage: 'Throughput (avg.)', + } + ), + description: asTransactionRate(avgRequestsPerMinute), + }, + { + title: i18n.translate('xpack.apm.serviceMap.errorRatePopoverStat', { + defaultMessage: 'Trans. error rate (avg.)', + }), + description: asPercent(avgErrorRate, 1, ''), + }, + { + title: i18n.translate('xpack.apm.serviceMap.avgCpuUsagePopoverStat', { + defaultMessage: 'CPU usage (avg.)', + }), + description: asPercent(avgCpuUsage, 1, ''), + }, + { + title: i18n.translate('xpack.apm.serviceMap.avgMemoryUsagePopoverStat', { + defaultMessage: 'Memory usage (avg.)', + }), + description: asPercent(avgMemoryUsage, 1, ''), + }, + ]; + + return ( + + + {items.map(({ title, description }) => { + return description ? ( + + {title} + {description} + + ) : null; + })} + +
    + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_node_overview/index.tsx b/x-pack/plugins/apm/public/components/app/service_node_overview/index.tsx index 6431a8ad6d01c..4346b391b3666 100644 --- a/x-pack/plugins/apm/public/components/app/service_node_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_node_overview/index.tsx @@ -79,7 +79,7 @@ function ServiceNodeOverview() { ), field: 'name', sortable: true, - render: (name: string) => { + render: (_, { name }) => { const { displayedName, tooltip } = name === SERVICE_NODE_NAME_MISSING ? { @@ -112,7 +112,7 @@ function ServiceNodeOverview() { }), field: 'cpu', sortable: true, - render: (value: number | null) => asPercent(value, 1), + render: (_, { cpu }) => asPercent(cpu, 1), }, { name: i18n.translate('xpack.apm.jvmsTable.heapMemoryColumnLabel', { diff --git a/x-pack/plugins/apm/public/components/app/service_overview/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/index.tsx index 11cc569af8609..620eefda05b27 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/index.tsx @@ -19,7 +19,7 @@ import { ServiceOverviewDependenciesTable } from './service_overview_dependencie import { ServiceOverviewErrorsTable } from './service_overview_errors_table'; import { ServiceOverviewInstancesChartAndTable } from './service_overview_instances_chart_and_table'; import { ServiceOverviewThroughputChart } from './service_overview_throughput_chart'; -import { ServiceOverviewTransactionsTable } from './service_overview_transactions_table'; +import { TransactionsTable } from '../../shared/transactions_table'; /** * The height a chart should be if it's next to a table with 5 rows and a title. @@ -57,7 +57,7 @@ export function ServiceOverview() {
    - + diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx index c3d74ec4baeaf..d9df9acf9ff65 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_dependencies_table/index.tsx @@ -5,8 +5,10 @@ * 2.0. */ +import { EuiLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; +import { useApmRouter } from '../../../../hooks/use_apm_router'; import { getNodeName, NodeType } from '../../../../../common/connections'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; @@ -30,8 +32,9 @@ export function ServiceOverviewDependenciesTable() { } = useUrlParams(); const { + query, query: { kuery, rangeFrom, rangeTo }, - } = useApmParams('/services/:serviceName/overview'); + } = useApmParams('/services/:serviceName/*'); const { offset } = getTimeRangeComparison({ start, @@ -42,6 +45,15 @@ export function ServiceOverviewDependenciesTable() { const { serviceName, transactionType } = useApmServiceContext(); + const router = useApmRouter(); + + const dependenciesLink = router.link('/services/:serviceName/dependencies', { + path: { + serviceName, + }, + query, + }); + const { data, status } = useFetcher( (callApmApi) => { if (!start || !end) { @@ -109,7 +121,7 @@ export function ServiceOverviewDependenciesTable() { title={i18n.translate( 'xpack.apm.serviceOverview.dependenciesTableTitle', { - defaultMessage: 'Dependencies', + defaultMessage: 'Downstream services and backends', } )} nameColumnTitle={i18n.translate( @@ -118,8 +130,15 @@ export function ServiceOverviewDependenciesTable() { defaultMessage: 'Backend', } )} - serviceName={serviceName} status={status} + link={ + + {i18n.translate( + 'xpack.apm.serviceOverview.dependenciesTableTabLink', + { defaultMessage: 'View dependencies' } + )} + + } /> ); } diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx index b458f6147b3f1..cd2c70b0f10b7 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx @@ -51,14 +51,14 @@ export function getColumns({ }, }, { - field: 'last_seen', + field: 'lastSeen', name: i18n.translate( 'xpack.apm.serviceOverview.errorsTableColumnLastSeen', { defaultMessage: 'Last seen', } ), - render: (_, { last_seen: lastSeen }) => { + render: (_, { lastSeen }) => { return ; }, width: `${unit * 9}px`, diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx index 5c3384df567fe..c8604be50ee15 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx @@ -32,7 +32,7 @@ type ErrorGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceNam type ErrorGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>; type SortDirection = 'asc' | 'desc'; -type SortField = 'name' | 'last_seen' | 'occurrences'; +type SortField = 'name' | 'lastSeen' | 'occurrences'; const PAGE_SIZE = 5; const DEFAULT_SORT = { diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx index 719409b0f97ff..a6ef16fe85510 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx @@ -25,14 +25,6 @@ interface ServiceOverviewInstancesChartAndTableProps { serviceName: string; } -export interface MainStatsServiceInstanceItem { - serviceNodeName: string; - errorRate: number; - throughput: number; - latency: number; - cpuUsage: number; - memoryUsage: number; -} type ApiResponseMainStats = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics'>; type ApiResponseDetailedStats = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx index f9600b9d7f418..1ff896cff57f7 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx @@ -30,10 +30,11 @@ import { SparkPlot } from '../../../shared/charts/spark_plot'; import { MetricOverviewLink } from '../../../shared/Links/apm/MetricOverviewLink'; import { ServiceNodeMetricOverviewLink } from '../../../shared/Links/apm/ServiceNodeMetricOverviewLink'; import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip'; -import { getLatencyColumnLabel } from '../get_latency_column_label'; -import { MainStatsServiceInstanceItem } from '../service_overview_instances_chart_and_table'; +import { getLatencyColumnLabel } from '../../../shared/transactions_table/get_latency_column_label'; import { InstanceActionsMenu } from './instance_actions_menu'; +type ServiceInstanceMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics'>; +type MainStatsServiceInstanceItem = ServiceInstanceMainStatistics['currentPeriod'][0]; type ServiceInstanceDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; export function getColumns({ diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx index bfd5fea82c6cd..91955dbea47e5 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx @@ -20,7 +20,6 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { TableFetchWrapper } from '../../../shared/table_fetch_wrapper'; import { PAGE_SIZE, - MainStatsServiceInstanceItem, SortDirection, SortField, } from '../service_overview_instances_chart_and_table'; @@ -28,6 +27,8 @@ import { OverviewTableContainer } from '../../../shared/overview_table_container import { getColumns } from './get_columns'; import { InstanceDetails } from './intance_details'; +type ServiceInstanceMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics'>; +type MainStatsServiceInstanceItem = ServiceInstanceMainStatistics['currentPeriod'][0]; type ServiceInstanceDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; export interface TableOptions { diff --git a/x-pack/plugins/apm/public/components/app/trace_overview/index.tsx b/x-pack/plugins/apm/public/components/app/trace_overview/index.tsx index ccb5fea72432c..eed0750a9e390 100644 --- a/x-pack/plugins/apm/public/components/app/trace_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/trace_overview/index.tsx @@ -15,8 +15,6 @@ import { TraceList } from './trace_list'; type TracesAPIResponse = APIReturnType<'GET /api/apm/traces'>; const DEFAULT_RESPONSE: TracesAPIResponse = { items: [], - isAggregationAccurate: true, - bucketSize: 0, }; export function TraceOverview() { diff --git a/x-pack/plugins/apm/public/components/app/trace_overview/trace_list.tsx b/x-pack/plugins/apm/public/components/app/trace_overview/trace_list.tsx index f1c8df553abf7..231c49a9a2197 100644 --- a/x-pack/plugins/apm/public/components/app/trace_overview/trace_list.tsx +++ b/x-pack/plugins/apm/public/components/app/trace_overview/trace_list.tsx @@ -73,7 +73,8 @@ const traceListColumns: Array> = [ }), sortable: true, dataType: 'number', - render: (time: number) => asMillisecondDuration(time), + render: (_, { averageResponseTime }) => + asMillisecondDuration(averageResponseTime), }, { field: 'transactionsPerMinute', @@ -82,7 +83,8 @@ const traceListColumns: Array> = [ }), sortable: true, dataType: 'number', - render: (value: number) => asTransactionRate(value), + render: (_, { transactionsPerMinute }) => + asTransactionRate(transactionsPerMinute), }, { field: 'impact', @@ -112,7 +114,7 @@ const traceListColumns: Array> = [ width: '20%', align: 'left', sortable: true, - render: (value: number) => , + render: (_, { impact }) => , }, ]; diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/Distribution/index.tsx index a2db4cc87a81b..4ff094c025451 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/Distribution/index.tsx @@ -135,6 +135,7 @@ export function TransactionDistribution({ const bucketsMap = keyBy(buckets, 'x0'); const tooltip: SettingsSpec['tooltip'] = { + stickTo: 'top', customTooltip: (props: TooltipInfo) => { const datum = props.header?.datum as IChartPoint; const selectedDistribution = distributionMap[datum?.x0]; diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/span_flyout/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/span_flyout/index.tsx index 93acf38a094bc..50fc56dff7f85 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/span_flyout/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/span_flyout/index.tsx @@ -8,6 +8,7 @@ import { EuiBadge, EuiButtonEmpty, + EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiFlyoutBody, @@ -21,6 +22,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { Fragment } from 'react'; +import { CompositeSpanDurationSummaryItem } from '../../../../../../shared/Summary/CompositeSpanDurationSummaryItem'; import { euiStyled } from '../../../../../../../../../../../src/plugins/kibana_react/common'; import { Span } from '../../../../../../../../typings/es_schemas/ui/span'; import { Transaction } from '../../../../../../../../typings/es_schemas/ui/transaction'; @@ -123,7 +125,6 @@ export function SpanFlyout({ - @@ -137,6 +138,21 @@ export function SpanFlyout({ + {span.span.composite && ( + + + + {i18n.translate( + 'xpack.apm.transactionDetails.spanFlyout.compositeExampleWarning', + { + defaultMessage: + 'This is a sample document for a group of consecutive, similar spans', + } + )} + + + + )} @@ -144,11 +160,19 @@ export function SpanFlyout({ , - , + <> + + {span.span.composite && ( + + )} + , <> {spanHttpUrl && ( diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_helpers/waterfall_helpers.ts b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_helpers/waterfall_helpers.ts index 9ace59fae6320..b6e427e8cc0a1 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_helpers/waterfall_helpers.ts +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_helpers/waterfall_helpers.ts @@ -7,12 +7,13 @@ import { euiPaletteColorBlind } from '@elastic/eui'; import { first, flatten, groupBy, isEmpty, sortBy, sum, uniq } from 'lodash'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { TraceAPIResponse } from '../../../../../../../../server/lib/traces/get_trace'; +import { APIReturnType } from '../../../../../../../services/rest/createCallApmApi'; import { APMError } from '../../../../../../../../typings/es_schemas/ui/apm_error'; import { Span } from '../../../../../../../../typings/es_schemas/ui/span'; import { Transaction } from '../../../../../../../../typings/es_schemas/ui/transaction'; +type TraceAPIResponse = APIReturnType<'GET /api/apm/traces/{traceId}'>; + interface IWaterfallGroup { [key: string]: IWaterfallSpanOrTransaction[]; } diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_item.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_item.tsx index a2c2c869a079c..cd892ae2a16eb 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_item.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/Waterfall/waterfall_item.tsx @@ -147,7 +147,15 @@ function HttpStatusCode({ item }: { item: IWaterfallSpanOrTransaction }) { function NameLabel({ item }: { item: IWaterfallSpanOrTransaction }) { switch (item.docType) { case 'span': - return {item.doc.span.name}; + let name = item.doc.span.name; + if (item.doc.span.composite) { + const compositePrefix = + item.doc.span.composite.compression_strategy === 'exact_match' + ? 'x' + : ''; + name = `${item.doc.span.composite.count}${compositePrefix} ${name}`; + } + return {name}; case 'transaction': return ( @@ -182,6 +190,9 @@ export function WaterfallItem({ } ); + const isCompositeSpan = item.docType === 'span' && item.doc.span.composite; + const itemBarStyle = getItemBarStyle(item, color, width, left); + return ( ); } + +function getItemBarStyle( + item: IWaterfallSpanOrTransaction, + color: string, + width: number, + left: number +): React.CSSProperties { + let itemBarStyle = { left: `${left}%`, width: `${width}%` }; + + if (item.docType === 'span' && item.doc.span.composite) { + const percNumItems = 100.0 / item.doc.span.composite.count; + const spanSumRatio = + item.doc.span.composite.sum.us / item.doc.span.duration.us; + const percDuration = percNumItems * spanSumRatio; + + itemBarStyle = { + ...itemBarStyle, + ...{ + backgroundImage: + `repeating-linear-gradient(90deg, ${color},` + + ` ${color} max(${percDuration}%,3px),` + + ` transparent max(${percDuration}%,3px),` + + ` transparent max(${percNumItems}%,max(${percDuration}%,3px) + 3px))`, + }, + }; + } + + return itemBarStyle; +} diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/WaterfallContainer.stories.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/WaterfallContainer.stories.tsx index 20ca3194fbfdf..f8abff2c9609c 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/WaterfallContainer.stories.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/WaterfallContainer.stories.tsx @@ -7,9 +7,8 @@ import React, { ComponentType } from 'react'; import { MemoryRouter } from 'react-router-dom'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { TraceAPIResponse } from '../../../../../../server/lib/traces/get_trace'; import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context'; +import { APIReturnType } from '../../../../../services/rest/createCallApmApi'; import { WaterfallContainer } from './index'; import { getWaterfall } from './Waterfall/waterfall_helpers/waterfall_helpers'; import { @@ -20,6 +19,8 @@ import { urlParams, } from './waterfallContainer.stories.data'; +type TraceAPIResponse = APIReturnType<'GET /api/apm/traces/{traceId}'>; + export default { title: 'app/TransactionDetails/Waterfall', component: WaterfallContainer, diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx index 819292095403a..a0c2108948f23 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx @@ -5,15 +5,7 @@ * 2.0. */ -import { - EuiCallOut, - EuiCode, - EuiPanel, - EuiSpacer, - EuiTitle, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiPanel, EuiSpacer } from '@elastic/eui'; import { Location } from 'history'; import React from 'react'; import { useLocation } from 'react-router-dom'; @@ -21,11 +13,9 @@ import { useApmServiceContext } from '../../../context/apm_service/use_apm_servi import { IUrlParams } from '../../../context/url_params_context/types'; import { useUrlParams } from '../../../context/url_params_context/use_url_params'; import { TransactionCharts } from '../../shared/charts/transaction_charts'; -import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink'; import { fromQuery, toQuery } from '../../shared/Links/url_helpers'; -import { TransactionList } from './transaction_list'; +import { TransactionsTable } from '../../shared/transactions_table'; import { useRedirect } from './useRedirect'; -import { useTransactionListFetcher } from './use_transaction_list'; function getRedirectLocation({ location, @@ -57,11 +47,6 @@ export function TransactionOverview() { // redirect to first transaction type useRedirect(getRedirectLocation({ location, transactionType, urlParams })); - const { - transactionListData, - transactionListStatus, - } = useTransactionListFetcher(); - // TODO: improve urlParams typings. // `serviceName` or `transactionType` will never be undefined here, and this check should not be needed if (!serviceName) { @@ -73,50 +58,10 @@ export function TransactionOverview() { - -

    Transactions

    -
    - - {!transactionListData.isAggregationAccurate && ( - -

    - xpack.apm.ui.transactionGroupBucketSize - ), - }} - /> - - - {i18n.translate( - 'xpack.apm.transactionCardinalityWarning.docsLink', - { defaultMessage: 'Learn more in the docs' } - )} - -

    -
    - )} - -
    diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_list/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_list/index.tsx deleted file mode 100644 index dc3bf924d6fdc..0000000000000 --- a/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_list/index.tsx +++ /dev/null @@ -1,162 +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 { EuiToolTip, EuiIconTip } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import React, { useMemo } from 'react'; -import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { APIReturnType } from '../../../../services/rest/createCallApmApi'; -import { - asMillisecondDuration, - asTransactionRate, -} from '../../../../../common/utils/formatters'; -import { truncate } from '../../../../utils/style'; -import { ImpactBar } from '../../../shared/ImpactBar'; -import { ITableColumn, ManagedTable } from '../../../shared/managed_table'; -import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt'; -import { EmptyMessage } from '../../../shared/EmptyMessage'; -import { TransactionDetailLink } from '../../../shared/Links/apm/transaction_detail_link'; - -type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups'>['items'][0]; - -// Truncate both the link and the child span (the tooltip anchor.) The link so -// it doesn't overflow, and the anchor so we get the ellipsis. -const TransactionNameLink = euiStyled(TransactionDetailLink)` - font-family: ${({ theme }) => theme.eui.euiCodeFontFamily}; - white-space: nowrap; - ${truncate('100%')}; - - > span { - ${truncate('100%')}; - } -`; - -interface Props { - items: TransactionGroup[]; - isLoading: boolean; -} - -export function TransactionList({ items, isLoading }: Props) { - const { - urlParams: { latencyAggregationType }, - } = useUrlParams(); - const columns: Array> = useMemo( - () => [ - { - field: 'name', - name: i18n.translate('xpack.apm.transactionsTable.nameColumnLabel', { - defaultMessage: 'Name', - }), - width: '50%', - sortable: true, - render: ( - _, - { serviceName, transactionName, transactionType }: TransactionGroup - ) => { - return ( - - - <>{transactionName} - - - ); - }, - }, - { - field: 'averageResponseTime', - name: i18n.translate( - 'xpack.apm.transactionsTable.avgDurationColumnLabel', - { - defaultMessage: 'Avg. duration', - } - ), - sortable: true, - dataType: 'number', - render: (time: number) => asMillisecondDuration(time), - }, - { - field: 'p95', - name: i18n.translate( - 'xpack.apm.transactionsTable.95thPercentileColumnLabel', - { - defaultMessage: '95th percentile', - } - ), - sortable: true, - dataType: 'number', - render: (time: number) => asMillisecondDuration(time), - }, - { - field: 'transactionsPerMinute', - name: i18n.translate( - 'xpack.apm.transactionsTable.throughputColumnLabel', - { defaultMessage: 'Throughput' } - ), - sortable: true, - dataType: 'number', - render: (value: number) => asTransactionRate(value), - }, - { - field: 'impact', - name: ( - <> - {i18n.translate('xpack.apm.transactionsTable.impactColumnLabel', { - defaultMessage: 'Impact', - })}{' '} - - - ), - sortable: true, - dataType: 'number', - render: (value: number) => , - }, - ], - [latencyAggregationType] - ); - - const noItemsMessage = ( - - ); - - return ( - : noItemsMessage} - columns={columns} - items={items} - initialSortField="impact" - initialSortDirection="desc" - initialPageSize={25} - /> - ); -} diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_list/transaction_list.stories.tsx b/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_list/transaction_list.stories.tsx deleted file mode 100644 index 0253e39b99503..0000000000000 --- a/x-pack/plugins/apm/public/components/app/transaction_overview/transaction_list/transaction_list.stories.tsx +++ /dev/null @@ -1,50 +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, { ComponentType } from 'react'; -import { MemoryRouter } from 'react-router-dom'; -import { APIReturnType } from '../../../../services/rest/createCallApmApi'; -import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; -import { TransactionList } from './'; - -type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups'>['items'][0]; - -export default { - title: 'app/TransactionOverview/TransactionList', - component: TransactionList, - decorators: [ - (Story: ComponentType) => ( - - - - - - ), - ], -}; - -export function SingleRow() { - const items: TransactionGroup[] = [ - { - key: { - ['service.name']: 'adminconsole', - ['transaction.name']: - 'GET /api/v1/regions/azure-eastus2/clusters/elasticsearch/xc18de071deb4262be54baebf5f6a1ce/proxy/_snapshot/found-snapshots/_all', - }, - transactionName: - 'GET /api/v1/regions/azure-eastus2/clusters/elasticsearch/xc18de071deb4262be54baebf5f6a1ce/proxy/_snapshot/found-snapshots/_all', - serviceName: 'adminconsole', - transactionType: 'request', - p95: 11974156, - averageResponseTime: 8087434.558974359, - transactionsPerMinute: 0.40625, - impact: 100, - }, - ]; - - return ; -} diff --git a/x-pack/plugins/apm/public/components/app/transaction_overview/use_transaction_list.ts b/x-pack/plugins/apm/public/components/app/transaction_overview/use_transaction_list.ts deleted file mode 100644 index 59207a6a499a2..0000000000000 --- a/x-pack/plugins/apm/public/components/app/transaction_overview/use_transaction_list.ts +++ /dev/null @@ -1,53 +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 { APIReturnType } from '../../../services/rest/createCallApmApi'; -import { useFetcher } from '../../../hooks/use_fetcher'; -import { useUrlParams } from '../../../context/url_params_context/use_url_params'; -import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; - -type TransactionsAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups'>; - -const DEFAULT_RESPONSE: Partial = { - items: undefined, - isAggregationAccurate: true, - bucketSize: 0, -}; - -export function useTransactionListFetcher() { - const { - urlParams: { environment, kuery, transactionType, start, end }, - } = useUrlParams(); - const { serviceName } = useApmServiceContext(); - - const { data = DEFAULT_RESPONSE, error, status } = useFetcher( - (callApmApi) => { - if (serviceName && start && end && transactionType) { - return callApmApi({ - endpoint: 'GET /api/apm/services/{serviceName}/transactions/groups', - params: { - path: { serviceName }, - query: { - environment, - kuery, - start, - end, - transactionType, - }, - }, - }); - } - }, - [environment, kuery, serviceName, start, end, transactionType] - ); - - return { - transactionListData: data, - transactionListStatus: status, - transactionListError: error, - }; -} diff --git a/x-pack/plugins/apm/public/components/routing/service_detail/index.tsx b/x-pack/plugins/apm/public/components/routing/service_detail/index.tsx index 19db296c428c8..5771d21b77a3a 100644 --- a/x-pack/plugins/apm/public/components/routing/service_detail/index.tsx +++ b/x-pack/plugins/apm/public/components/routing/service_detail/index.tsx @@ -21,6 +21,7 @@ import { ServiceNodeMetrics } from '../../app/service_node_metrics'; import { ServiceMap } from '../../app/service_map'; import { TransactionDetails } from '../../app/transaction_details'; import { ServiceProfiling } from '../../app/service_profiling'; +import { ServiceDependencies } from '../../app/service_dependencies'; function page({ path, @@ -101,6 +102,7 @@ export const serviceDetail = { element: , searchBarOptions: { showTransactionTypeSelector: true, + showTimeComparison: true, }, }), children: [ @@ -125,6 +127,17 @@ export const serviceDetail = { }, ], }, + page({ + path: '/dependencies', + element: , + tab: 'dependencies', + title: i18n.translate('xpack.apm.views.dependencies.title', { + defaultMessage: 'Dependencies', + }), + searchBarOptions: { + showTimeComparison: true, + }, + }), { ...page({ path: '/errors', diff --git a/x-pack/plugins/apm/public/components/routing/service_detail/redirect_to_default_service_route_view.tsx b/x-pack/plugins/apm/public/components/routing/service_detail/redirect_to_default_service_route_view.tsx index 37ec76f2b299e..66595430f618d 100644 --- a/x-pack/plugins/apm/public/components/routing/service_detail/redirect_to_default_service_route_view.tsx +++ b/x-pack/plugins/apm/public/components/routing/service_detail/redirect_to_default_service_route_view.tsx @@ -4,17 +4,12 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import qs from 'query-string'; import React from 'react'; import { Redirect } from 'react-router-dom'; -import qs from 'query-string'; -import { enableServiceOverview } from '../../../../common/ui_settings_keys'; -import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { useApmParams } from '../../../hooks/use_apm_params'; export function RedirectToDefaultServiceRouteView() { - const { - core: { uiSettings }, - } = useApmPluginContext(); const { path: { serviceName }, query, @@ -22,14 +17,7 @@ export function RedirectToDefaultServiceRouteView() { const search = qs.stringify(query); - if (uiSettings.get(enableServiceOverview)) { - return ( - - ); - } return ( - + ); } diff --git a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx index ee5ed91dfb463..d92d7a8d94922 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/index.tsx @@ -20,7 +20,6 @@ import { isJavaAgentName, isRumAgentName, } from '../../../../../common/agent_name'; -import { enableServiceOverview } from '../../../../../common/ui_settings_keys'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { ApmServiceContextProvider } from '../../../../context/apm_service/apm_service_context'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; @@ -37,6 +36,7 @@ type Tab = NonNullable[0] & { key: | 'overview' | 'transactions' + | 'dependencies' | 'errors' | 'metrics' | 'nodes' @@ -124,7 +124,7 @@ function TemplateWithContext({ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) { const { agentName } = useApmServiceContext(); - const { core, config } = useApmPluginContext(); + const { config } = useApmPluginContext(); const router = useApmRouter(); @@ -151,7 +151,6 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) { label: i18n.translate('xpack.apm.serviceDetails.overviewTabLabel', { defaultMessage: 'Overview', }), - hidden: !core.uiSettings.get(enableServiceOverview), }, { key: 'transactions', @@ -163,6 +162,16 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) { defaultMessage: 'Transactions', }), }, + { + key: 'dependencies', + href: router.link('/services/:serviceName/dependencies', { + path: { serviceName }, + query, + }), + label: i18n.translate('xpack.apm.serviceDetails.dependenciesTabLabel', { + defaultMessage: 'Dependencies', + }), + }, { key: 'errors', href: router.link('/services/:serviceName/errors', { diff --git a/x-pack/plugins/apm/public/components/routing/track_pageview.tsx b/x-pack/plugins/apm/public/components/routing/track_pageview.tsx index 20e02a505bc43..7f4a03cae90be 100644 --- a/x-pack/plugins/apm/public/components/routing/track_pageview.tsx +++ b/x-pack/plugins/apm/public/components/routing/track_pageview.tsx @@ -11,8 +11,8 @@ import { useTrackPageview } from '../../../../observability/public'; export function TrackPageview({ children }: { children: React.ReactElement }) { const routePath = useRoutePath(); - useTrackPageview({ app: 'apm', path: routePath }); - useTrackPageview({ app: 'apm', path: routePath, delay: 15000 }); + useTrackPageview({ app: 'apm', path: routePath }, [routePath]); + useTrackPageview({ app: 'apm', path: routePath, delay: 15000 }, [routePath]); return children; } diff --git a/x-pack/plugins/apm/public/components/shared/Summary/CompositeSpanDurationSummaryItem.tsx b/x-pack/plugins/apm/public/components/shared/Summary/CompositeSpanDurationSummaryItem.tsx new file mode 100644 index 0000000000000..34f9a631e62aa --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/Summary/CompositeSpanDurationSummaryItem.tsx @@ -0,0 +1,40 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { EuiToolTip, EuiText } from '@elastic/eui'; +import { asDuration } from '../../../../common/utils/formatters'; + +interface Props { + count: number; + durationSum: number; +} + +function CompositeSpanDurationSummaryItem({ count, durationSum }: Props) { + const avgDuration = durationSum / count; + + return ( + + + {i18n.translate('xpack.apm.compositeSpanCallsLabel', { + defaultMessage: `, {count} calls, on avg. {duration}`, + values: { + count, + duration: asDuration(avgDuration), + }, + })} + + + ); +} + +export { CompositeSpanDurationSummaryItem }; diff --git a/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx b/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx index 6939aaf49373e..dc1a62e591b17 100644 --- a/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx +++ b/x-pack/plugins/apm/public/components/shared/Summary/TransactionSummary.tsx @@ -11,7 +11,6 @@ import { Summary } from './'; import { TimestampTooltip } from '../TimestampTooltip'; import { DurationSummaryItem } from './DurationSummaryItem'; import { ErrorCountSummaryItemBadge } from './error_count_summary_item_badge'; -import { isRumAgentName } from '../../../../common/agent_name'; import { HttpInfoSummaryItem } from './http_info_summary_item'; import { TransactionResultSummaryItem } from './TransactionResultSummaryItem'; import { UserAgentSummaryItem } from './UserAgentSummaryItem'; @@ -24,10 +23,7 @@ interface Props { function getTransactionResultSummaryItem(transaction: Transaction) { const result = transaction.transaction.result; - const isRumAgent = isRumAgentName(transaction.agent.name); - const url = isRumAgent - ? transaction.transaction.page?.url - : transaction.url?.full; + const url = transaction.url?.full || transaction.transaction?.page?.url; if (url) { const method = transaction.http?.request?.method; diff --git a/x-pack/plugins/apm/public/components/shared/TimestampTooltip/index.tsx b/x-pack/plugins/apm/public/components/shared/TimestampTooltip/index.tsx index 17c802ab6a381..c4ba189221c85 100644 --- a/x-pack/plugins/apm/public/components/shared/TimestampTooltip/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/TimestampTooltip/index.tsx @@ -15,9 +15,9 @@ import { interface Props { /** - * timestamp in milliseconds + * timestamp in milliseconds or ISO timestamp */ - time: number; + time: number | string; timeUnit?: TimeUnit; } diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx b/x-pack/plugins/apm/public/components/shared/charts/breakdown_chart/index.tsx similarity index 86% rename from x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx rename to x-pack/plugins/apm/public/components/shared/charts/breakdown_chart/index.tsx index a68373892e78b..f39c39113fedc 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/transaction_breakdown_chart_contents.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/breakdown_chart/index.tsx @@ -13,27 +13,28 @@ import { CurveType, LineAnnotation, niceTimeFormatter, - Placement, Position, ScaleType, Settings, + TickFormatter, } from '@elastic/charts'; import { EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import moment from 'moment'; import React from 'react'; import { useHistory } from 'react-router-dom'; +import { Annotation } from '../../../../../common/annotations'; import { useChartTheme } from '../../../../../../observability/public'; import { asAbsoluteDateTime, + asDuration, asPercent, } from '../../../../../common/utils/formatters'; import { Coordinate, TimeSeries } from '../../../../../typings/timeseries'; +import { useChartPointerEventContext } from '../../../../context/chart_pointer_event/use_chart_pointer_event_context'; +import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; import { useTheme } from '../../../../hooks/use_theme'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { useAnnotationsContext } from '../../../../context/annotations/use_annotations_context'; -import { useChartPointerEventContext } from '../../../../context/chart_pointer_event/use_chart_pointer_event_context'; import { unit } from '../../../../utils/style'; import { ChartContainer } from '../../charts/chart_container'; import { isTimeseriesEmpty, onBrushEnd } from '../../charts/helper/helper'; @@ -42,17 +43,23 @@ interface Props { fetchStatus: FETCH_STATUS; height?: number; showAnnotations: boolean; + annotations: Annotation[]; timeseries?: Array>; + yAxisType: 'duration' | 'percentage'; } -export function TransactionBreakdownChartContents({ +const asPercentBound = (y: number | null) => asPercent(y, 1); +const asDurationBound = (y: number | null) => asDuration(y); + +export function BreakdownChart({ fetchStatus, height = unit * 16, showAnnotations, + annotations, timeseries, + yAxisType, }: Props) { const history = useHistory(); - const { annotations } = useAnnotationsContext(); const chartTheme = useChartTheme(); const { chartRef, setPointerEvent } = useChartPointerEventContext(); @@ -69,10 +76,14 @@ export function TransactionBreakdownChartContents({ const isEmpty = isTimeseriesEmpty(timeseries); + const yTickFormat: TickFormatter = + yAxisType === 'duration' ? asDurationBound : asPercentBound; + return ( onBrushEnd({ x, history })} showLegend showLegendExtra @@ -82,7 +93,9 @@ export function TransactionBreakdownChartContents({ flatLegend onPointerUpdate={setPointerEvent} externalPointerEvents={{ - tooltip: { visible: true, placement: Placement.Bottom }, + tooltip: { + visible: true, + }, }} /> asPercent(y ?? 0, 1)} + tickFormat={yTickFormat} /> {showAnnotations && ( @@ -131,7 +144,9 @@ export function TransactionBreakdownChartContents({ yAccessors={['y']} data={serie.data} stackAccessors={['x']} - stackMode={'percentage'} + stackMode={ + yAxisType === 'percentage' ? 'percentage' : undefined + } color={serie.areaColor} curve={CurveType.CURVE_MONOTONE_X} /> diff --git a/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.test.tsx index b2d2f360a5fd4..4f3ac31517020 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.test.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.test.tsx @@ -5,7 +5,19 @@ * 2.0. */ -import { ALERT_SEVERITY_LEVEL } from '@kbn/rule-data-utils/target/technical_field_names'; +import { + ALERT_DURATION, + ALERT_EVALUATION_THRESHOLD, + ALERT_EVALUATION_VALUE, + ALERT_ID, + ALERT_PRODUCER, + ALERT_OWNER, + ALERT_SEVERITY_LEVEL, + ALERT_START, + ALERT_STATUS, + ALERT_UUID, + SPACE_IDS, +} from '@kbn/rule-data-utils'; import { ValuesType } from 'utility-types'; import { EuiTheme } from '../../../../../../../../src/plugins/kibana_react/common'; import { ObservabilityRuleTypeRegistry } from '../../../../../../observability/public'; @@ -22,29 +34,29 @@ const theme = ({ eui: { euiColorDanger, euiColorWarning }, } as unknown) as EuiTheme; const alert: Alert = { + [SPACE_IDS]: ['space-id'], 'rule.id': ['apm.transaction_duration'], - 'kibana.rac.alert.evaluation.value': [2057657.39], + [ALERT_EVALUATION_VALUE]: [2057657.39], 'service.name': ['frontend-rum'], 'rule.name': ['Latency threshold | frontend-rum'], - 'kibana.rac.alert.duration.us': [62879000], - 'kibana.rac.alert.status': ['open'], + [ALERT_DURATION]: [62879000], + [ALERT_STATUS]: ['open'], tags: ['apm', 'service.name:frontend-rum'], 'transaction.type': ['page-load'], - 'kibana.rac.alert.producer': ['apm'], - 'kibana.rac.alert.uuid': ['af2ae371-df79-4fca-b0eb-a2dbd9478180'], + [ALERT_PRODUCER]: ['apm'], + [ALERT_UUID]: ['af2ae371-df79-4fca-b0eb-a2dbd9478180'], + [ALERT_OWNER]: ['apm'], 'rule.uuid': ['82e0ee40-c2f4-11eb-9a42-a9da66a1722f'], 'event.action': ['active'], '@timestamp': ['2021-06-01T16:16:05.183Z'], - 'kibana.rac.alert.id': ['apm.transaction_duration_All'], + [ALERT_ID]: ['apm.transaction_duration_All'], 'processor.event': ['transaction'], - 'kibana.rac.alert.evaluation.threshold': [500000], - 'kibana.rac.alert.start': ['2021-06-01T16:15:02.304Z'], + [ALERT_EVALUATION_THRESHOLD]: [500000], + [ALERT_START]: ['2021-06-01T16:15:02.304Z'], 'event.kind': ['state'], 'rule.category': ['Latency threshold'], }; -const chartStartTime = new Date( - alert['kibana.rac.alert.start']![0] as string -).getTime(); +const chartStartTime = new Date(alert[ALERT_START]![0] as string).getTime(); const getFormatter: ObservabilityRuleTypeRegistry['getFormatter'] = () => () => ({ link: '/', reason: 'a good reason', diff --git a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx index 6128526c577e4..ae3c871e25a1a 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx @@ -7,10 +7,13 @@ import { TooltipInfo } from '@elastic/charts'; import React from 'react'; +import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; -import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; import { CustomTooltip } from './custom_tooltip'; +type ServiceInstanceMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics'>; +type MainStatsServiceInstanceItem = ServiceInstanceMainStatistics['currentPeriod'][0]; + function getLatencyFormatter(props: TooltipInfo) { const maxLatency = Math.max( ...props.values.map((value) => { diff --git a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx index 027f764317e46..a0197c2f50c96 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx @@ -9,13 +9,16 @@ import { TooltipInfo } from '@elastic/charts'; import { EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; +import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { getServiceNodeName } from '../../../../../common/service_nodes'; import { asTransactionRate, TimeFormatter, } from '../../../../../common/utils/formatters'; import { useTheme } from '../../../../hooks/use_theme'; -import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; + +type ServiceInstanceMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics'>; +type MainStatsServiceInstanceItem = ServiceInstanceMainStatistics['currentPeriod'][0]; const latencyLabel = i18n.translate( 'xpack.apm.instancesLatencyDistributionChartTooltipLatencyLabel', diff --git a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx index 0ad4be17e35cb..b7d1d37d2c0d0 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx @@ -61,6 +61,7 @@ export function InstancesLatencyDistributionChart({ const latencyFormatter = getDurationFormatter(maxLatency); const tooltip: TooltipProps = { + stickTo: 'center', type: TooltipType.Follow, snap: false, customTooltip: (props: TooltipInfo) => ( diff --git a/x-pack/plugins/apm/public/components/shared/charts/latency_chart/latency_chart.stories.tsx b/x-pack/plugins/apm/public/components/shared/charts/latency_chart/latency_chart.stories.tsx index 1439e59877ea4..71d517ad53871 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/latency_chart/latency_chart.stories.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/latency_chart/latency_chart.stories.tsx @@ -5,6 +5,16 @@ * 2.0. */ +import { + ALERT_DURATION, + ALERT_EVALUATION_THRESHOLD, + ALERT_EVALUATION_VALUE, + ALERT_ID, + ALERT_SEVERITY_LEVEL, + ALERT_START, + ALERT_STATUS, + ALERT_UUID, +} from '@kbn/rule-data-utils'; import { StoryContext } from '@storybook/react'; import React, { ComponentType } from 'react'; import { MemoryRouter, Route } from 'react-router-dom'; @@ -111,66 +121,66 @@ Example.args = { alerts: [ { 'rule.id': ['apm.transaction_duration'], - 'kibana.rac.alert.evaluation.value': [2001708.19], + [ALERT_EVALUATION_VALUE]: [2001708.19], 'service.name': ['frontend-rum'], 'rule.name': ['Latency threshold | frontend-rum'], - 'kibana.rac.alert.duration.us': [10000000000], - 'kibana.rac.alert.status': ['open'], + [ALERT_DURATION]: [10000000000], + [ALERT_STATUS]: ['open'], tags: ['apm', 'service.name:frontend-rum'], 'transaction.type': ['page-load'], - 'kibana.rac.alert.producer': ['apm'], - 'kibana.rac.alert.uuid': ['af2ae371-df79-4fca-b0eb-a2dbd9478180'], + 'kibana.alert.producer': ['apm'], + [ALERT_UUID]: ['af2ae371-df79-4fca-b0eb-a2dbd9478180'], 'rule.uuid': ['82e0ee40-c2f4-11eb-9a42-a9da66a1722f'], 'event.action': ['active'], '@timestamp': ['2021-06-01T20:27:48.833Z'], - 'kibana.rac.alert.id': ['apm.transaction_duration_All'], + [ALERT_ID]: ['apm.transaction_duration_All'], 'processor.event': ['transaction'], - 'kibana.rac.alert.evaluation.threshold': [500000], - 'kibana.rac.alert.start': ['2021-06-02T04:00:00.000Z'], + [ALERT_EVALUATION_THRESHOLD]: [500000], + [ALERT_START]: ['2021-06-02T04:00:00.000Z'], 'event.kind': ['state'], 'rule.category': ['Latency threshold'], }, { 'rule.id': ['apm.transaction_duration'], - 'kibana.rac.alert.evaluation.value': [2001708.19], + [ALERT_EVALUATION_VALUE]: [2001708.19], 'service.name': ['frontend-rum'], 'rule.name': ['Latency threshold | frontend-rum'], - 'kibana.rac.alert.duration.us': [10000000000], - 'kibana.rac.alert.status': ['open'], + [ALERT_DURATION]: [10000000000], + [ALERT_STATUS]: ['open'], tags: ['apm', 'service.name:frontend-rum'], 'transaction.type': ['page-load'], - 'kibana.rac.alert.producer': ['apm'], - 'kibana.rac.alert.severity.level': ['warning'], - 'kibana.rac.alert.uuid': ['af2ae371-df79-4fca-b0eb-a2dbd9478181'], + 'kibana.alert.producer': ['apm'], + [ALERT_SEVERITY_LEVEL]: ['warning'], + [ALERT_UUID]: ['af2ae371-df79-4fca-b0eb-a2dbd9478181'], 'rule.uuid': ['82e0ee40-c2f4-11eb-9a42-a9da66a1722f'], 'event.action': ['active'], '@timestamp': ['2021-06-01T20:27:48.833Z'], - 'kibana.rac.alert.id': ['apm.transaction_duration_All'], + [ALERT_ID]: ['apm.transaction_duration_All'], 'processor.event': ['transaction'], - 'kibana.rac.alert.evaluation.threshold': [500000], - 'kibana.rac.alert.start': ['2021-06-02T10:45:00.000Z'], + [ALERT_EVALUATION_THRESHOLD]: [500000], + [ALERT_START]: ['2021-06-02T10:45:00.000Z'], 'event.kind': ['state'], 'rule.category': ['Latency threshold'], }, { 'rule.id': ['apm.transaction_duration'], - 'kibana.rac.alert.evaluation.value': [2001708.19], + [ALERT_EVALUATION_VALUE]: [2001708.19], 'service.name': ['frontend-rum'], 'rule.name': ['Latency threshold | frontend-rum'], - 'kibana.rac.alert.duration.us': [1000000000], - 'kibana.rac.alert.status': ['open'], + [ALERT_DURATION]: [1000000000], + [ALERT_STATUS]: ['open'], tags: ['apm', 'service.name:frontend-rum'], 'transaction.type': ['page-load'], - 'kibana.rac.alert.producer': ['apm'], - 'kibana.rac.alert.severity.level': ['critical'], - 'kibana.rac.alert.uuid': ['af2ae371-df79-4fca-b0eb-a2dbd9478182'], + 'kibana.alert.producer': ['apm'], + [ALERT_SEVERITY_LEVEL]: ['critical'], + [ALERT_UUID]: ['af2ae371-df79-4fca-b0eb-a2dbd9478182'], 'rule.uuid': ['82e0ee40-c2f4-11eb-9a42-a9da66a1722f'], 'event.action': ['active'], '@timestamp': ['2021-06-01T20:27:48.833Z'], - 'kibana.rac.alert.id': ['apm.transaction_duration_All'], + [ALERT_ID]: ['apm.transaction_duration_All'], 'processor.event': ['transaction'], - 'kibana.rac.alert.evaluation.threshold': [500000], - 'kibana.rac.alert.start': ['2021-06-02T16:50:00.000Z'], + [ALERT_EVALUATION_THRESHOLD]: [500000], + [ALERT_START]: ['2021-06-02T16:50:00.000Z'], 'event.kind': ['state'], 'rule.category': ['Latency threshold'], }, diff --git a/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx b/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx index 9667bbd33cc73..65ecdec0f36a5 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx @@ -15,7 +15,6 @@ import { LineAnnotation, LineSeries, niceTimeFormatter, - Placement, Position, RectAnnotation, ScaleType, @@ -36,17 +35,17 @@ import { RectCoordinate, TimeSeries, } from '../../../../typings/timeseries'; -import { FETCH_STATUS } from '../../../hooks/use_fetcher'; -import { useTheme } from '../../../hooks/use_theme'; import { useAnnotationsContext } from '../../../context/annotations/use_annotations_context'; +import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; +import { APMServiceAlert } from '../../../context/apm_service/apm_service_context'; import { useChartPointerEventContext } from '../../../context/chart_pointer_event/use_chart_pointer_event_context'; +import { FETCH_STATUS } from '../../../hooks/use_fetcher'; +import { useTheme } from '../../../hooks/use_theme'; +import { getLatencyChartSelector } from '../../../selectors/latency_chart_selectors'; import { unit } from '../../../utils/style'; import { ChartContainer } from './chart_container'; -import { onBrushEnd, isTimeseriesEmpty } from './helper/helper'; -import { getLatencyChartSelector } from '../../../selectors/latency_chart_selectors'; -import { APMServiceAlert } from '../../../context/apm_service/apm_service_context'; import { getAlertAnnotations } from './helper/get_alert_annotations'; -import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; +import { isTimeseriesEmpty, onBrushEnd } from './helper/helper'; interface Props { id: string; @@ -115,6 +114,7 @@ export function TimeseriesChart({ > onBrushEnd({ x, history })} theme={{ ...chartTheme, @@ -125,7 +125,7 @@ export function TimeseriesChart({ }} onPointerUpdate={setPointerEvent} externalPointerEvents={{ - tooltip: { visible: true, placement: Placement.Right }, + tooltip: { visible: true }, }} showLegend showLegendExtra diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/index.tsx index 40c5e39589fb1..0e2b1e185f9d9 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_breakdown_chart/index.tsx @@ -8,8 +8,9 @@ import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; +import { useAnnotationsContext } from '../../../../context/annotations/use_annotations_context'; import { useTransactionBreakdown } from './use_transaction_breakdown'; -import { TransactionBreakdownChartContents } from './transaction_breakdown_chart_contents'; +import { BreakdownChart } from '../breakdown_chart'; export function TransactionBreakdownChart({ height, @@ -19,6 +20,7 @@ export function TransactionBreakdownChart({ showAnnotations?: boolean; }) { const { data, status } = useTransactionBreakdown(); + const { annotations } = useAnnotationsContext(); const { timeseries } = data; return ( @@ -34,11 +36,13 @@ export function TransactionBreakdownChart({
    - diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx index 019a25b1e9ed3..3135be151fce7 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/index.tsx @@ -5,32 +5,16 @@ * 2.0. */ -import { - EuiFlexGrid, - EuiFlexItem, - EuiPanel, - EuiSpacer, - EuiTitle, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; +import { EuiFlexGrid, EuiFlexItem, EuiPanel, EuiSpacer } from '@elastic/eui'; import React from 'react'; -import { asTransactionRate } from '../../../../../common/utils/formatters'; import { AnnotationsContextProvider } from '../../../../context/annotations/annotations_context'; import { ChartPointerEventContextProvider } from '../../../../context/chart_pointer_event/chart_pointer_event_context'; -import { useTransactionThroughputChartsFetcher } from '../../../../hooks/use_transaction_throughput_chart_fetcher'; +import { ServiceOverviewThroughputChart } from '../../../app/service_overview/service_overview_throughput_chart'; import { LatencyChart } from '../latency_chart'; -import { TimeseriesChart } from '../timeseries_chart'; import { TransactionBreakdownChart } from '../transaction_breakdown_chart'; import { TransactionErrorRateChart } from '../transaction_error_rate_chart/'; export function TransactionCharts() { - const { - throughputChartsData, - throughputChartsStatus, - } = useTransactionThroughputChartsFetcher(); - - const { throughputTimeseries } = throughputChartsData; - return ( <> @@ -43,22 +27,7 @@ export function TransactionCharts() { - - - - {i18n.translate( - 'xpack.apm.metrics.transactionChart.throughputLabel', - { defaultMessage: 'Throughput' } - )} - - - - + diff --git a/x-pack/plugins/apm/public/components/shared/dependencies_table/dependencies_table_service_map_link.tsx b/x-pack/plugins/apm/public/components/shared/dependencies_table/dependencies_table_service_map_link.tsx new file mode 100644 index 0000000000000..4086551611433 --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/dependencies_table/dependencies_table_service_map_link.tsx @@ -0,0 +1,19 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { EuiLink } from '@elastic/eui'; + +export function DependenciesTableServiceMapLink({ href }: { href: string }) { + return ( + + {i18n.translate('xpack.apm.dependenciesTable.serviceMapLinkText', { + defaultMessage: 'View service map', + })} + + ); +} diff --git a/x-pack/plugins/apm/public/components/shared/dependencies_table/index.tsx b/x-pack/plugins/apm/public/components/shared/dependencies_table/index.tsx index 5aeb9549fb3a2..a599a3bd0aa62 100644 --- a/x-pack/plugins/apm/public/components/shared/dependencies_table/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/dependencies_table/index.tsx @@ -24,7 +24,6 @@ import { FETCH_STATUS } from '../../../hooks/use_fetcher'; import { unit } from '../../../utils/style'; import { SparkPlot } from '../charts/spark_plot'; import { ImpactBar } from '../ImpactBar'; -import { ServiceMapLink } from '../Links/apm/ServiceMapLink'; import { TableFetchWrapper } from '../table_fetch_wrapper'; import { TruncateWithTooltip } from '../truncate_with_tooltip'; import { OverviewTableContainer } from '../overview_table_container'; @@ -39,7 +38,7 @@ export type DependenciesItem = Omit< interface Props { dependencies: DependenciesItem[]; - serviceName?: string; + link: React.ReactNode; title: React.ReactNode; nameColumnTitle: React.ReactNode; status: FETCH_STATUS; @@ -49,7 +48,7 @@ interface Props { export function DependenciesTable(props: Props) { const { dependencies, - serviceName, + link, title, nameColumnTitle, status, @@ -69,8 +68,8 @@ export function DependenciesTable(props: Props) { field: 'name', name: nameColumnTitle, render: (_, item) => { - const { name, link } = item; - return ; + const { name, link: itemLink } = item; + return ; }, sortable: true, }, @@ -177,16 +176,7 @@ export function DependenciesTable(props: Props) {

    {title}

    - - - {i18n.translate( - 'xpack.apm.dependenciesTable.serviceMapLinkText', - { - defaultMessage: 'View service map', - } - )} - - + {link} diff --git a/x-pack/plugins/apm/public/components/shared/managed_table/__snapshots__/managed_table.test.tsx.snap b/x-pack/plugins/apm/public/components/shared/managed_table/__snapshots__/managed_table.test.tsx.snap index 55e0bc0fe2431..1e01c00543949 100644 --- a/x-pack/plugins/apm/public/components/shared/managed_table/__snapshots__/managed_table.test.tsx.snap +++ b/x-pack/plugins/apm/public/components/shared/managed_table/__snapshots__/managed_table.test.tsx.snap @@ -33,6 +33,7 @@ exports[`ManagedTable should render a page-full of items, with defaults 1`] = ` }, ] } + loading={false} noItemsMessage="No items found" onChange={[Function]} pagination={ @@ -81,6 +82,7 @@ exports[`ManagedTable should render when specifying initial values 1`] = ` }, ] } + loading={false} noItemsMessage="No items found" onChange={[Function]} pagination={ diff --git a/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx b/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx index 3d1527a473740..af8b317f5ec33 100644 --- a/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/managed_table/index.tsx @@ -21,6 +21,7 @@ export interface ITableColumn { align?: string; width?: string; sortable?: boolean; + truncateText?: boolean; render?: (value: any, item: T) => unknown; } @@ -40,6 +41,7 @@ interface Props { sortDirection: 'asc' | 'desc' ) => T[]; pagination?: boolean; + isLoading?: boolean; } function defaultSortFn( @@ -64,6 +66,7 @@ function UnoptimizedManagedTable(props: Props) { sortItems = true, sortFn = defaultSortFn, pagination = true, + isLoading = false, } = props; const { @@ -125,6 +128,7 @@ function UnoptimizedManagedTable(props: Props) { return ( >} // EuiBasicTableColumn is stricter than ITableColumn diff --git a/x-pack/plugins/apm/public/components/shared/search_bar.tsx b/x-pack/plugins/apm/public/components/shared/search_bar.tsx index afdf4c12f41a5..b356f68dba2f0 100644 --- a/x-pack/plugins/apm/public/components/shared/search_bar.tsx +++ b/x-pack/plugins/apm/public/components/shared/search_bar.tsx @@ -11,6 +11,7 @@ import { EuiFlexItem, EuiLink, EuiSpacer, + EuiFlexGroupProps, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -83,23 +84,26 @@ export function SearchBar({ showTimeComparison = false, showTransactionTypeSelector = false, }: Props) { - const { isSmall, isMedium, isLarge, isXl, isXXL } = useBreakPoints(); + const { isSmall, isMedium, isLarge, isXl, isXXL, isXXXL } = useBreakPoints(); if (hidden) { return null; } + const searchBarDirection: EuiFlexGroupProps['direction'] = + isXXXL || (!isXl && !showTimeComparison) ? 'row' : 'column'; + return ( <> @@ -116,15 +120,15 @@ export function SearchBar({ )} - + {showTimeComparison && ( - + )} diff --git a/x-pack/plugins/apm/public/components/shared/span_icon/get_span_icon.ts b/x-pack/plugins/apm/public/components/shared/span_icon/get_span_icon.ts index 93021fe177f6b..2abb7d03bce80 100644 --- a/x-pack/plugins/apm/public/components/shared/span_icon/get_span_icon.ts +++ b/x-pack/plugins/apm/public/components/shared/span_icon/get_span_icon.ts @@ -40,6 +40,7 @@ export const spanTypeIcons: { aws: { servicename: awsIcon, }, + cache: { redis: redisIcon }, db: { cassandra: cassandraIcon, cosmosdb: azureIcon, diff --git a/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx b/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx index d7dfd3de2b628..f8accc1d48b9a 100644 --- a/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx @@ -150,7 +150,7 @@ export function getSelectOptions({ export function TimeComparison() { const trackApmEvent = useUiTracker({ app: 'apm' }); const history = useHistory(); - const { isMedium, isLarge } = useBreakPoints(); + const { isSmall } = useBreakPoints(); const { urlParams: { comparisonEnabled, comparisonType, exactStart, exactEnd }, } = useUrlParams(); @@ -191,7 +191,7 @@ export function TimeComparison() { return ( ; diff --git a/x-pack/plugins/apm/public/components/app/service_overview/get_latency_column_label.ts b/x-pack/plugins/apm/public/components/shared/transactions_table/get_latency_column_label.ts similarity index 100% rename from x-pack/plugins/apm/public/components/app/service_overview/get_latency_column_label.ts rename to x-pack/plugins/apm/public/components/shared/transactions_table/get_latency_column_label.ts diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx b/x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx similarity index 61% rename from x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx rename to x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx index b2d7424f1aa49..7f1dc2cc150d7 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/transactions_table/index.tsx @@ -15,33 +15,57 @@ import { i18n } from '@kbn/i18n'; import { orderBy } from 'lodash'; import React, { useState } from 'react'; import uuid from 'uuid'; -import { APIReturnType } from '../../../../services/rest/createCallApmApi'; -import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; -import { TransactionOverviewLink } from '../../../shared/Links/apm/transaction_overview_link'; -import { TableFetchWrapper } from '../../../shared/table_fetch_wrapper'; -import { getTimeRangeComparison } from '../../../shared/time_comparison/get_time_range_comparison'; -import { OverviewTableContainer } from '../../../shared/overview_table_container'; +import { EuiCallOut } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiCode } from '@elastic/eui'; +import { APIReturnType } from '../../../services/rest/createCallApmApi'; +import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context'; +import { useUrlParams } from '../../../context/url_params_context/use_url_params'; +import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; +import { TransactionOverviewLink } from '../Links/apm/transaction_overview_link'; +import { TableFetchWrapper } from '../table_fetch_wrapper'; +import { getTimeRangeComparison } from '../time_comparison/get_time_range_comparison'; +import { OverviewTableContainer } from '../overview_table_container'; import { getColumns } from './get_columns'; +import { ElasticDocsLink } from '../Links/ElasticDocsLink'; type ApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>; -const INITIAL_STATE = { - transactionGroups: [] as ApiResponse['transactionGroups'], - isAggregationAccurate: true, + +interface InitialState { + requestId: string; + mainStatisticsData: ApiResponse & { + transactionGroupsTotalItems: number; + }; +} + +const INITIAL_STATE: InitialState = { requestId: '', - transactionGroupsTotalItems: 0, + mainStatisticsData: { + transactionGroups: [], + isAggregationAccurate: true, + bucketSize: 0, + transactionGroupsTotalItems: 0, + }, }; type SortField = 'name' | 'latency' | 'throughput' | 'errorRate' | 'impact'; type SortDirection = 'asc' | 'desc'; -const PAGE_SIZE = 5; const DEFAULT_SORT = { direction: 'desc' as const, field: 'impact' as const, }; -export function ServiceOverviewTransactionsTable() { +interface Props { + hideViewTransactionsLink?: boolean; + numberOfTransactionsPerPage?: number; + showAggregationAccurateCallout?: boolean; +} + +export function TransactionsTable({ + hideViewTransactionsLink = false, + numberOfTransactionsPerPage = 5, + showAggregationAccurateCallout = false, +}: Props) { const [tableOptions, setTableOptions] = useState<{ pageIndex: number; sort: { @@ -100,14 +124,19 @@ export function ServiceOverviewTransactionsTable() { response.transactionGroups, field, direction - ).slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE); + ).slice( + pageIndex * numberOfTransactionsPerPage, + (pageIndex + 1) * numberOfTransactionsPerPage + ); return { - ...response, // Everytime the main statistics is refetched, updates the requestId making the detailed API to be refetched. requestId: uuid(), - transactionGroupsTotalItems: response.transactionGroups.length, - transactionGroups: currentPageTransactionGroups, + mainStatisticsData: { + ...response, + transactionGroups: currentPageTransactionGroups, + transactionGroupsTotalItems: response.transactionGroups.length, + }, }; }); }, @@ -130,7 +159,15 @@ export function ServiceOverviewTransactionsTable() { ] ); - const { transactionGroups, requestId, transactionGroupsTotalItems } = data; + const { + requestId, + mainStatisticsData: { + transactionGroups, + isAggregationAccurate, + bucketSize, + transactionGroupsTotalItems, + }, + } = data; const { data: transactionGroupDetailedStatistics, @@ -186,7 +223,7 @@ export function ServiceOverviewTransactionsTable() { const pagination = { pageIndex, - pageSize: PAGE_SIZE, + pageSize: numberOfTransactionsPerPage, totalItemCount: transactionGroupsTotalItems, hidePerPageOptions: true, }; @@ -207,22 +244,62 @@ export function ServiceOverviewTransactionsTable() { - - - {i18n.translate( - 'xpack.apm.serviceOverview.transactionsTableLinkText', - { - defaultMessage: 'View transactions', - } - )} - - + {!hideViewTransactionsLink && ( + + + {i18n.translate( + 'xpack.apm.serviceOverview.transactionsTableLinkText', + { + defaultMessage: 'View transactions', + } + )} + + + )} + {showAggregationAccurateCallout && !isAggregationAccurate && ( + + +

    + xpack.apm.ui.transactionGroupBucketSize + ), + }} + /> + + + {i18n.translate( + 'xpack.apm.transactionCardinalityWarning.docsLink', + { defaultMessage: 'Learn more in the docs' } + )} + +

    +
    +
    + )} diff --git a/x-pack/plugins/apm/public/hooks/use_break_points.test.ts b/x-pack/plugins/apm/public/hooks/use_break_points.test.ts new file mode 100644 index 0000000000000..66cfd3119a26b --- /dev/null +++ b/x-pack/plugins/apm/public/hooks/use_break_points.test.ts @@ -0,0 +1,153 @@ +/* + * 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 { getScreenSizes } from './use_break_points'; + +describe('use_break_points', () => { + describe('getScreenSizes', () => { + it('return xs when within 0px - 5740x', () => { + expect(getScreenSizes(0)).toEqual({ + isXSmall: true, + isSmall: true, + isMedium: true, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + expect(getScreenSizes(574)).toEqual({ + isXSmall: true, + isSmall: true, + isMedium: true, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + }); + it('return s when within 575px - 767px', () => { + expect(getScreenSizes(575)).toEqual({ + isXSmall: false, + isSmall: true, + isMedium: true, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + expect(getScreenSizes(767)).toEqual({ + isXSmall: false, + isSmall: true, + isMedium: true, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + }); + it('return m when within 768px - 991', () => { + expect(getScreenSizes(768)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: true, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + expect(getScreenSizes(991)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: true, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + }); + it('return l when within 992px - 1199px', () => { + expect(getScreenSizes(992)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + expect(getScreenSizes(1199)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: true, + isXl: true, + isXXL: true, + isXXXL: false, + }); + }); + it('return xl when within 1200px - 1599px', () => { + expect(getScreenSizes(1200)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: false, + isXl: true, + isXXL: true, + isXXXL: false, + }); + expect(getScreenSizes(1599)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: false, + isXl: true, + isXXL: true, + isXXXL: false, + }); + }); + it('return xxl when within 1600px - 1999px', () => { + expect(getScreenSizes(1600)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: false, + isXl: false, + isXXL: true, + isXXXL: false, + }); + expect(getScreenSizes(1999)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: false, + isXl: false, + isXXL: true, + isXXXL: false, + }); + }); + it('return xxxl when greater than or equals to 2000px', () => { + expect(getScreenSizes(2000)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: false, + isXl: false, + isXXL: false, + isXXXL: true, + }); + expect(getScreenSizes(3000)).toEqual({ + isXSmall: false, + isSmall: false, + isMedium: false, + isLarge: false, + isXl: false, + isXXL: false, + isXXXL: true, + }); + }); + }); +}); diff --git a/x-pack/plugins/apm/public/hooks/use_break_points.ts b/x-pack/plugins/apm/public/hooks/use_break_points.ts index fb8dc8f6a55b8..e6e7dc2dff899 100644 --- a/x-pack/plugins/apm/public/hooks/use_break_points.ts +++ b/x-pack/plugins/apm/public/hooks/use_break_points.ts @@ -8,20 +8,17 @@ import { useState } from 'react'; import useWindowSize from 'react-use/lib/useWindowSize'; import useDebounce from 'react-use/lib/useDebounce'; -import { isWithinMaxBreakpoint } from '@elastic/eui'; +import { isWithinMaxBreakpoint, isWithinMinBreakpoint } from '@elastic/eui'; -function isMinXXL(windowWidth: number) { - return windowWidth >= 1600; -} - -function getScreenSizes(windowWidth: number) { - const isXXL = isMinXXL(windowWidth); +export function getScreenSizes(windowWidth: number) { return { + isXSmall: isWithinMaxBreakpoint(windowWidth, 'xs'), isSmall: isWithinMaxBreakpoint(windowWidth, 's'), isMedium: isWithinMaxBreakpoint(windowWidth, 'm'), isLarge: isWithinMaxBreakpoint(windowWidth, 'l'), - isXl: isWithinMaxBreakpoint(windowWidth, 'xl') && !isXXL, - isXXL, + isXl: isWithinMaxBreakpoint(windowWidth, 1599), + isXXL: isWithinMaxBreakpoint(windowWidth, 1999), + isXXXL: isWithinMinBreakpoint(windowWidth, 2000), }; } diff --git a/x-pack/plugins/apm/public/hooks/use_transaction_throughput_chart_fetcher.ts b/x-pack/plugins/apm/public/hooks/use_transaction_throughput_chart_fetcher.ts deleted file mode 100644 index 72e469178a100..0000000000000 --- a/x-pack/plugins/apm/public/hooks/use_transaction_throughput_chart_fetcher.ts +++ /dev/null @@ -1,63 +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 { useMemo } from 'react'; -import { useFetcher } from './use_fetcher'; -import { useUrlParams } from '../context/url_params_context/use_url_params'; -import { getThroughputChartSelector } from '../selectors/throughput_chart_selectors'; -import { useTheme } from './use_theme'; -import { useApmServiceContext } from '../context/apm_service/use_apm_service_context'; - -export function useTransactionThroughputChartsFetcher() { - const { transactionType, serviceName } = useApmServiceContext(); - const theme = useTheme(); - const { - urlParams: { environment, kuery, start, end, transactionName }, - } = useUrlParams(); - - const { data, error, status } = useFetcher( - (callApmApi) => { - if (transactionType && serviceName && start && end) { - return callApmApi({ - endpoint: - 'GET /api/apm/services/{serviceName}/transactions/charts/throughput', - params: { - path: { serviceName }, - query: { - environment, - kuery, - start, - end, - transactionType, - transactionName, - }, - }, - }); - } - }, - [ - environment, - kuery, - serviceName, - start, - end, - transactionName, - transactionType, - ] - ); - - const memoizedData = useMemo( - () => getThroughputChartSelector({ throughputChart: data, theme }), - [data, theme] - ); - - return { - throughputChartsData: memoizedData, - throughputChartsStatus: status, - throughputChartsError: error, - }; -} diff --git a/x-pack/plugins/apm/public/selectors/throughput_chart_selectors.test.ts b/x-pack/plugins/apm/public/selectors/throughput_chart_selectors.test.ts deleted file mode 100644 index b76b77abaa7bd..0000000000000 --- a/x-pack/plugins/apm/public/selectors/throughput_chart_selectors.test.ts +++ /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 { EuiTheme } from '../../../../../src/plugins/kibana_react/common'; -import { - getThroughputChartSelector, - ThroughputChartsResponse, -} from './throughput_chart_selectors'; - -const theme = { - eui: { - euiColorVis1: 'green', - euiColorVis2: 'black', - euiColorVis3: 'gray', - euiColorVis4: 'blue', - euiColorVis6: 'red', - euiColorVis8: 'yellow', - euiColorSecondary: 'white', - euiColorDanger: 'purple', - }, -} as EuiTheme; - -const throughputData = { - throughputTimeseries: [ - { key: 'HTTP 2xx', avg: 1, dataPoints: [{ x: 1, y: 2 }] }, - { key: 'HTTP 4xx', avg: 1, dataPoints: [{ x: 1, y: 2 }] }, - { key: 'HTTP 5xx', avg: 1, dataPoints: [{ x: 1, y: 2 }] }, - ], -} as ThroughputChartsResponse; - -describe('getThroughputChartSelector', () => { - it('returns default values when data is undefined', () => { - const throughputTimeseries = getThroughputChartSelector({ theme }); - expect(throughputTimeseries).toEqual({ throughputTimeseries: [] }); - }); - - it('returns default values when timeseries is empty', () => { - const throughputTimeseries = getThroughputChartSelector({ - theme, - throughputChart: { throughputTimeseries: [] }, - }); - expect(throughputTimeseries).toEqual({ throughputTimeseries: [] }); - }); - - it('return throughput time series', () => { - const throughputTimeseries = getThroughputChartSelector({ - theme, - throughputChart: throughputData, - }); - - expect(throughputTimeseries).toEqual({ - throughputTimeseries: [ - { - title: 'HTTP 2xx', - data: [{ x: 1, y: 2 }], - legendValue: '1.0 tpm', - type: 'linemark', - color: '#327a42', - }, - { - title: 'HTTP 4xx', - data: [{ x: 1, y: 2 }], - legendValue: '1.0 tpm', - type: 'linemark', - color: '#f5a700', - }, - { - title: 'HTTP 5xx', - data: [{ x: 1, y: 2 }], - legendValue: '1.0 tpm', - type: 'linemark', - color: '#c23c2b', - }, - ], - }); - }); -}); diff --git a/x-pack/plugins/apm/public/selectors/throughput_chart_selectors.ts b/x-pack/plugins/apm/public/selectors/throughput_chart_selectors.ts deleted file mode 100644 index f334212536778..0000000000000 --- a/x-pack/plugins/apm/public/selectors/throughput_chart_selectors.ts +++ /dev/null @@ -1,84 +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 { difference, zipObject } from 'lodash'; -import { EuiTheme } from '../../../../../src/plugins/kibana_react/common'; -import { asTransactionRate } from '../../common/utils/formatters'; -import { Coordinate, TimeSeries } from '../../typings/timeseries'; -import { APIReturnType } from '../services/rest/createCallApmApi'; -import { httpStatusCodeToColor } from '../utils/httpStatusCodeToColor'; - -export type ThroughputChartsResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/charts/throughput'>; - -export interface ThroughputChart { - throughputTimeseries: Array>; -} - -export function getThroughputChartSelector({ - theme, - throughputChart, -}: { - theme: EuiTheme; - throughputChart?: ThroughputChartsResponse; -}): ThroughputChart { - if (!throughputChart) { - return { throughputTimeseries: [] }; - } - - return { - throughputTimeseries: getThroughputTimeseries({ throughputChart, theme }), - }; -} - -function getThroughputTimeseries({ - throughputChart, - theme, -}: { - theme: EuiTheme; - throughputChart: ThroughputChartsResponse; -}) { - const { throughputTimeseries } = throughputChart; - const bucketKeys = throughputTimeseries.map(({ key }) => key); - const getColor = getColorByKey(bucketKeys, theme); - - return throughputTimeseries.map((bucket) => { - return { - title: bucket.key, - data: bucket.dataPoints, - legendValue: asTransactionRate(bucket.avg), - type: 'linemark', - color: getColor(bucket.key), - }; - }); -} - -function colorMatch(key: string, theme: EuiTheme) { - if (/ok|success/i.test(key)) { - return theme.eui.euiColorSecondary; - } else if (/error|fail/i.test(key)) { - return theme.eui.euiColorDanger; - } -} - -function getColorByKey(keys: string[], theme: EuiTheme) { - const assignedColors = ['HTTP 2xx', 'HTTP 3xx', 'HTTP 4xx', 'HTTP 5xx']; - - const unknownKeys = difference(keys, assignedColors); - const unassignedColors: Record = zipObject(unknownKeys, [ - theme.eui.euiColorVis1, - theme.eui.euiColorVis3, - theme.eui.euiColorVis4, - theme.eui.euiColorVis6, - theme.eui.euiColorVis2, - theme.eui.euiColorVis8, - ]); - - return (key: string) => - colorMatch(key, theme) || - httpStatusCodeToColor(key) || - unassignedColors[key]; -} diff --git a/x-pack/plugins/apm/public/services/rest/createCallApmApi.ts b/x-pack/plugins/apm/public/services/rest/createCallApmApi.ts index 0e82d70faf1e1..217d7e050369d 100644 --- a/x-pack/plugins/apm/public/services/rest/createCallApmApi.ts +++ b/x-pack/plugins/apm/public/services/rest/createCallApmApi.ts @@ -10,12 +10,17 @@ import * as t from 'io-ts'; import type { ClientRequestParamsOf, EndpointOf, + formatRequest as formatRequestType, ReturnOf, RouteRepositoryClient, ServerRouteRepository, ServerRoute, } from '@kbn/server-route-repository'; -import { formatRequest } from '@kbn/server-route-repository/target/format_request'; +// @ts-expect-error cannot find module or correspondent type declarations +// The code and types are at separated folders on @kbn/server-route-repository +// so in order to do targeted imports they must me imported separately, and +// an error is expected here +import { formatRequest } from '@kbn/server-route-repository/target_node/format_request'; import { FetchOptions } from '../../../common/fetch_options'; import { callApi } from './callApi'; import type { @@ -81,7 +86,10 @@ export function createCallApmApi(core: CoreStart | CoreSetup) { params?: Partial>; }; - const { method, pathname } = formatRequest(endpoint, params?.path); + const { method, pathname } = formatRequest( + endpoint, + params?.path + ) as ReturnType; return callApi(core, { ...opts, diff --git a/x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts b/x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts index 4fbd521ea4443..ae8a6db903d8a 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts +++ b/x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts @@ -5,7 +5,10 @@ * 2.0. */ -import { SPAN_DESTINATION_SERVICE_RESOURCE } from '../../../common/elasticsearch_fieldnames'; +import { + SPAN_DESTINATION_SERVICE_RESOURCE, + SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT, +} from '../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../common/utils/environment_query'; import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { ProcessorEvent } from '../../../common/processor_event'; @@ -63,7 +66,10 @@ export async function getThroughputChartsForBackend({ }), aggs: { throughput: { - rate: {}, + rate: { + field: SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT, + unit: 'minute', + }, }, }, }, diff --git a/x-pack/plugins/apm/server/lib/backends/get_top_backends.ts b/x-pack/plugins/apm/server/lib/backends/get_top_backends.ts index 2f9af0bafd37c..9b361774b8a9f 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_top_backends.ts +++ b/x-pack/plugins/apm/server/lib/backends/get_top_backends.ts @@ -5,10 +5,11 @@ * 2.0. */ +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 { NodeType } from '../../../common/connections'; import { Setup } from '../helpers/setup_request'; export async function getTopBackends({ @@ -18,6 +19,7 @@ export async function getTopBackends({ numBuckets, environment, offset, + kuery, }: { setup: Setup; start: number; @@ -25,13 +27,14 @@ export async function getTopBackends({ numBuckets: number; environment?: string; offset?: string; + kuery?: string; }) { const statsItems = await getConnectionStats({ setup, start, end, numBuckets, - filter: [...environmentQuery(environment)], + filter: [...environmentQuery(environment), ...kqlQuery(kuery)], offset, collapseBy: 'downstream', }); diff --git a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts index 94a23f6218e5d..4f48f3388c017 100644 --- a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts +++ b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts @@ -119,6 +119,16 @@ export const getStats = async ({ }, }, }, + total_latency_sum: { + sum: { + field: SPAN_DESTINATION_SERVICE_RESPONSE_TIME_SUM, + }, + }, + total_latency_count: { + sum: { + field: SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT, + }, + }, timeseries: { date_histogram: { field: '@timestamp', @@ -126,6 +136,7 @@ export const getStats = async ({ start: startWithOffset, end: endWithOffset, numBuckets, + minBucketSize: 60, }).intervalString, extended_bounds: { min: startWithOffset, diff --git a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/index.ts b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/index.ts index 37fcd9877327b..03b94defda6dd 100644 --- a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/index.ts +++ b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/index.ts @@ -113,6 +113,13 @@ export function getConnectionStats({ y: point.count > 0 ? point.latency_sum / point.count : null, })), }, + totalTime: { + value: mergedStats.value.latency_sum, + timeseries: mergedStats.timeseries.map((point) => ({ + x: point.x, + y: point.latency_sum, + })), + }, throughput: { value: mergedStats.value.count > 0 diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_backend_node_info.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_backend_node_info.ts new file mode 100644 index 0000000000000..17c3191d80ff4 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map_backend_node_info.ts @@ -0,0 +1,103 @@ +/* + * 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 { rangeQuery } from '../../../../observability/server'; +import { + EVENT_OUTCOME, + SPAN_DESTINATION_SERVICE_RESOURCE, + SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT, + SPAN_DESTINATION_SERVICE_RESPONSE_TIME_SUM, +} from '../../../common/elasticsearch_fieldnames'; +import { EventOutcome } from '../../../common/event_outcome'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { environmentQuery } from '../../../common/utils/environment_query'; +import { withApmSpan } from '../../utils/with_apm_span'; +import { calculateThroughput } from '../helpers/calculate_throughput'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; + +interface Options { + setup: Setup & SetupTimeRange; + environment?: string; + backendName: string; +} + +export function getServiceMapBackendNodeInfo({ + environment, + backendName, + setup, +}: Options) { + return withApmSpan('get_service_map_backend_node_stats', async () => { + const { apmEventClient, start, end } = setup; + + const response = await apmEventClient.search( + 'get_service_map_backend_node_stats', + { + apm: { + events: [ProcessorEvent.metric], + }, + body: { + size: 0, + query: { + bool: { + filter: [ + { term: { [SPAN_DESTINATION_SERVICE_RESOURCE]: backendName } }, + ...rangeQuery(start, end), + ...environmentQuery(environment), + ], + }, + }, + aggs: { + latency_sum: { + sum: { + field: SPAN_DESTINATION_SERVICE_RESPONSE_TIME_SUM, + }, + }, + count: { + sum: { + field: SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT, + }, + }, + [EVENT_OUTCOME]: { + terms: { field: EVENT_OUTCOME, include: [EventOutcome.failure] }, + }, + }, + }, + } + ); + + const count = response.aggregations?.count.value ?? 0; + const errorCount = + response.aggregations?.[EVENT_OUTCOME].buckets[0]?.doc_count ?? 0; + const latencySum = response.aggregations?.latency_sum.value ?? 0; + + const avgErrorRate = errorCount / count; + const avgTransactionDuration = latencySum / count; + const avgRequestsPerMinute = calculateThroughput({ + start, + end, + value: count, + }); + + if (count === 0) { + return { + avgErrorRate: null, + transactionStats: { + avgRequestsPerMinute: null, + avgTransactionDuration: null, + }, + }; + } + + return { + avgErrorRate, + transactionStats: { + avgRequestsPerMinute, + avgTransactionDuration, + }, + }; + }); +} diff --git a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap index 2f653e2c4df1d..be664529abab4 100644 --- a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap +++ b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap @@ -142,33 +142,6 @@ Array [ }, }, }, - "timeseries": Object { - "aggs": Object { - "avg_duration": Object { - "avg": Object { - "field": "transaction.duration.us", - }, - }, - "outcomes": Object { - "terms": Object { - "field": "event.outcome", - "include": Array [ - "failure", - "success", - ], - }, - }, - }, - "date_histogram": Object { - "extended_bounds": Object { - "max": 1528977600000, - "min": 1528113600000, - }, - "field": "@timestamp", - "fixed_interval": "43200s", - "min_doc_count": 0, - }, - }, }, "terms": Object { "field": "transaction.type", diff --git a/x-pack/plugins/apm/server/lib/services/get_service_dependencies_breakdown.ts b/x-pack/plugins/apm/server/lib/services/get_service_dependencies_breakdown.ts new file mode 100644 index 0000000000000..8ebf6b7e017d4 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/services/get_service_dependencies_breakdown.ts @@ -0,0 +1,54 @@ +/* + * 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 { sortBy, take } from 'lodash'; +import { getNodeName } from '../../../common/connections'; +import { kqlQuery } from '../../../../observability/server'; +import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; +import { environmentQuery } from '../../../common/utils/environment_query'; +import { Setup } from '../helpers/setup_request'; +import { getConnectionStats } from '../connections/get_connection_stats'; + +export async function getServiceDependenciesBreakdown({ + setup, + start, + end, + serviceName, + environment, + kuery, +}: { + setup: Setup; + start: number; + end: number; + serviceName: string; + environment?: string; + kuery?: string; +}) { + const items = await getConnectionStats({ + setup, + start, + end, + numBuckets: 100, + collapseBy: 'downstream', + filter: [ + ...environmentQuery(environment), + ...kqlQuery(kuery), + { term: { [SERVICE_NAME]: serviceName } }, + ], + }); + + return take( + sortBy(items, (item) => item.stats.totalTime ?? 0).reverse(), + 20 + ).map((item) => { + const { stats, location } = item; + + return { + title: getNodeName(location), + data: stats.totalTime.timeseries, + }; + }); +} diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts index 0e4ed72814cbb..0d50e14fc89b0 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts @@ -82,7 +82,7 @@ export async function getServiceErrorGroupMainStatistics({ response.aggregations?.error_groups.buckets.map((bucket) => ({ group_id: bucket.key as string, name: getErrorName(bucket.sample.hits.hits[0]._source), - last_seen: new Date( + lastSeen: new Date( bucket.sample.hits.hits[0]?._source['@timestamp'] ).getTime(), occurrences: bucket.doc_count, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts index b89bc86e29172..a58539da722c3 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/index.ts @@ -47,7 +47,7 @@ export async function getServiceErrorGroups({ pageIndex: number; numBuckets: number; sortDirection: 'asc' | 'desc'; - sortField: 'name' | 'last_seen' | 'occurrences'; + sortField: 'name' | 'lastSeen' | 'occurrences'; transactionType: string; }) { return withApmSpan('get_service_error_groups', async () => { @@ -108,7 +108,7 @@ export async function getServiceErrorGroups({ response.aggregations?.error_groups.buckets.map((bucket) => ({ group_id: bucket.key as string, name: getErrorName(bucket.sample.hits.hits[0]._source), - last_seen: new Date( + lastSeen: new Date( bucket.sample.hits.hits[0]?._source['@timestamp'] ).getTime(), occurrences: { diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts b/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts index 1479b0fdbb73c..4d67a0a2b43ad 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts @@ -19,11 +19,6 @@ import { getProcessorEventForAggregatedTransactions, } from '../helpers/aggregated_transactions'; -export interface KeyValue { - key: string; - value: any | undefined; -} - export async function getServiceInstanceMetadataDetails({ serviceName, serviceNodeName, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts index 223abf972ee24..e3f2795eb38e8 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts @@ -52,7 +52,8 @@ export async function getServiceTransactionGroups({ transactionType: string; latencyAggregationType: LatencyAggregationType; }) { - const { apmEventClient, start, end } = setup; + const { apmEventClient, start, end, config } = setup; + const bucketSize = config['xpack.apm.ui.transactionGroupBucketSize']; const field = getTransactionDurationFieldForAggregatedTransactions( searchAggregatedTransactions @@ -89,7 +90,7 @@ export async function getServiceTransactionGroups({ transaction_groups: { terms: { field: TRANSACTION_NAME, - size: 500, + size: bucketSize, order: { _count: 'desc' }, }, aggs: { @@ -147,5 +148,6 @@ export async function getServiceTransactionGroups({ isAggregationAccurate: (response.aggregations?.transaction_groups.sum_other_doc_count ?? 0) === 0, + bucketSize, }; } diff --git a/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts b/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts index c2121dbba97ef..edc9e5cf90026 100644 --- a/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts +++ b/x-pack/plugins/apm/server/lib/services/get_services/get_service_transaction_stats.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { kqlQuery, rangeQuery } from '../../../../../observability/server'; import { AGENT_NAME, SERVICE_ENVIRONMENT, @@ -15,7 +16,6 @@ import { TRANSACTION_PAGE_LOAD, TRANSACTION_REQUEST, } from '../../../../common/transaction_types'; -import { kqlQuery, rangeQuery } from '../../../../../observability/server'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { AgentName } from '../../../../typings/es_schemas/ui/fields/agent'; import { @@ -24,7 +24,6 @@ import { getTransactionDurationFieldForAggregatedTransactions, } from '../../helpers/aggregated_transactions'; import { calculateThroughput } from '../../helpers/calculate_throughput'; -import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; import { calculateTransactionErrorPercentage, getOutcomeAggregation, @@ -111,20 +110,6 @@ export async function getServiceTransactionStats({ }, }, }, - timeseries: { - date_histogram: { - field: '@timestamp', - fixed_interval: getBucketSizeForAggregatedTransactions({ - start, - end, - numBuckets: 20, - searchAggregatedTransactions, - }).intervalString, - min_doc_count: 0, - extended_bounds: { min: start, max: end }, - }, - aggs: metrics, - }, }, }, }, @@ -151,43 +136,15 @@ export async function getServiceTransactionStats({ agentName: topTransactionTypeBucket.sample.top[0].metrics[ AGENT_NAME ] as AgentName, - avgResponseTime: { - value: topTransactionTypeBucket.avg_duration.value, - timeseries: topTransactionTypeBucket.timeseries.buckets.map( - (dateBucket) => ({ - x: dateBucket.key, - y: dateBucket.avg_duration.value, - }) - ), - }, - transactionErrorRate: { - value: calculateTransactionErrorPercentage( - topTransactionTypeBucket.outcomes - ), - timeseries: topTransactionTypeBucket.timeseries.buckets.map( - (dateBucket) => ({ - x: dateBucket.key, - y: calculateTransactionErrorPercentage(dateBucket.outcomes), - }) - ), - }, - transactionsPerMinute: { - value: calculateThroughput({ - start, - end, - value: topTransactionTypeBucket.doc_count, - }), - timeseries: topTransactionTypeBucket.timeseries.buckets.map( - (dateBucket) => ({ - x: dateBucket.key, - y: calculateThroughput({ - start, - end, - value: dateBucket.doc_count, - }), - }) - ), - }, + latency: topTransactionTypeBucket.avg_duration.value, + transactionErrorRate: calculateTransactionErrorPercentage( + topTransactionTypeBucket.outcomes + ), + throughput: calculateThroughput({ + start, + end, + value: topTransactionTypeBucket.doc_count, + }), }; }) ?? [] ); diff --git a/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts new file mode 100644 index 0000000000000..d339641069eb5 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/get_service_transaction_detailed_statistics.ts @@ -0,0 +1,168 @@ +/* + * 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 { keyBy } from 'lodash'; +import { kqlQuery, rangeQuery } from '../../../../../observability/server'; +import { + SERVICE_NAME, + TRANSACTION_TYPE, +} from '../../../../common/elasticsearch_fieldnames'; +import { + TRANSACTION_PAGE_LOAD, + TRANSACTION_REQUEST, +} from '../../../../common/transaction_types'; +import { environmentQuery } from '../../../../common/utils/environment_query'; +import { getOffsetInMs } from '../../../../common/utils/get_offset_in_ms'; +import { + getDocumentTypeFilterForAggregatedTransactions, + getProcessorEventForAggregatedTransactions, + getTransactionDurationFieldForAggregatedTransactions, +} from '../../helpers/aggregated_transactions'; +import { calculateThroughput } from '../../helpers/calculate_throughput'; +import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; +import { Setup, SetupTimeRange } from '../../helpers/setup_request'; +import { + calculateTransactionErrorPercentage, + getOutcomeAggregation, +} from '../../helpers/transaction_error_rate'; + +export async function getServiceTransactionDetailedStatistics({ + serviceNames, + environment, + kuery, + setup, + searchAggregatedTransactions, + offset, +}: { + serviceNames: string[]; + environment?: string; + kuery?: string; + setup: Setup & SetupTimeRange; + searchAggregatedTransactions: boolean; + offset?: string; +}) { + const { apmEventClient, start, end } = setup; + const { offsetInMs, startWithOffset, endWithOffset } = getOffsetInMs({ + start, + end, + offset, + }); + + const outcomes = getOutcomeAggregation(); + + const metrics = { + avg_duration: { + avg: { + field: getTransactionDurationFieldForAggregatedTransactions( + searchAggregatedTransactions + ), + }, + }, + outcomes, + }; + + const response = await apmEventClient.search( + 'get_service_transaction_stats', + { + apm: { + events: [ + getProcessorEventForAggregatedTransactions( + searchAggregatedTransactions + ), + ], + }, + body: { + size: 0, + query: { + bool: { + filter: [ + ...getDocumentTypeFilterForAggregatedTransactions( + searchAggregatedTransactions + ), + ...rangeQuery(startWithOffset, endWithOffset), + ...environmentQuery(environment), + ...kqlQuery(kuery), + ], + }, + }, + aggs: { + services: { + terms: { + field: SERVICE_NAME, + include: serviceNames, + size: serviceNames.length, + }, + aggs: { + transactionType: { + terms: { + field: TRANSACTION_TYPE, + }, + aggs: { + ...metrics, + timeseries: { + date_histogram: { + field: '@timestamp', + fixed_interval: getBucketSizeForAggregatedTransactions({ + start: startWithOffset, + end: endWithOffset, + numBuckets: 20, + searchAggregatedTransactions, + }).intervalString, + min_doc_count: 0, + extended_bounds: { + min: startWithOffset, + max: endWithOffset, + }, + }, + aggs: metrics, + }, + }, + }, + }, + }, + }, + }, + } + ); + + return keyBy( + response.aggregations?.services.buckets.map((bucket) => { + const topTransactionTypeBucket = + bucket.transactionType.buckets.find( + ({ key }) => + key === TRANSACTION_REQUEST || key === TRANSACTION_PAGE_LOAD + ) ?? bucket.transactionType.buckets[0]; + + return { + serviceName: bucket.key as string, + latency: topTransactionTypeBucket.timeseries.buckets.map( + (dateBucket) => ({ + x: dateBucket.key + offsetInMs, + y: dateBucket.avg_duration.value, + }) + ), + transactionErrorRate: topTransactionTypeBucket.timeseries.buckets.map( + (dateBucket) => ({ + x: dateBucket.key + offsetInMs, + y: calculateTransactionErrorPercentage(dateBucket.outcomes), + }) + ), + throughput: topTransactionTypeBucket.timeseries.buckets.map( + (dateBucket) => ({ + x: dateBucket.key + offsetInMs, + y: calculateThroughput({ + start, + end, + value: dateBucket.doc_count, + }), + }) + ), + }; + }) ?? [], + 'serviceName' + ); +} diff --git a/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/index.ts b/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/index.ts new file mode 100644 index 0000000000000..d4ce90c79f4a6 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/services/get_services_detailed_statistics/index.ts @@ -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 { withApmSpan } from '../../../utils/with_apm_span'; +import { Setup, SetupTimeRange } from '../../helpers/setup_request'; +import { getServiceTransactionDetailedStatistics } from './get_service_transaction_detailed_statistics'; + +export async function getServicesDetailedStatistics({ + serviceNames, + environment, + kuery, + setup, + searchAggregatedTransactions, + offset, +}: { + serviceNames: string[]; + environment?: string; + kuery?: string; + setup: Setup & SetupTimeRange; + searchAggregatedTransactions: boolean; + offset?: string; +}) { + return withApmSpan('get_service_detailed_statistics', async () => { + const commonProps = { + serviceNames, + environment, + kuery, + setup, + searchAggregatedTransactions, + }; + + const [currentPeriod, previousPeriod] = await Promise.all([ + getServiceTransactionDetailedStatistics(commonProps), + offset + ? getServiceTransactionDetailedStatistics({ ...commonProps, offset }) + : {}, + ]); + + return { currentPeriod, previousPeriod }; + }); +} diff --git a/x-pack/plugins/apm/server/lib/traces/get_trace.ts b/x-pack/plugins/apm/server/lib/traces/get_trace.ts index 3c60cd84fca39..a0cc6b7241d4e 100644 --- a/x-pack/plugins/apm/server/lib/traces/get_trace.ts +++ b/x-pack/plugins/apm/server/lib/traces/get_trace.ts @@ -5,11 +5,9 @@ * 2.0. */ -import { PromiseReturnType } from '../../../../observability/typings/common'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { getTraceItems } from './get_trace_items'; -export type TraceAPIResponse = PromiseReturnType; export async function getTrace(traceId: string, setup: Setup & SetupTimeRange) { const { errorsPerTransaction, ...trace } = await getTraceItems( traceId, diff --git a/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts b/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts index 026cf9dcceb79..6c957df313866 100644 --- a/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts +++ b/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts @@ -15,15 +15,10 @@ import { TRANSACTION_ID, ERROR_LOG_LEVEL, } from '../../../common/elasticsearch_fieldnames'; -import { APMError } from '../../../typings/es_schemas/ui/apm_error'; import { rangeQuery } from '../../../../observability/server'; import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { PromiseValueType } from '../../../typings/common'; -export interface ErrorsPerTransaction { - [transactionId: string]: number; -} - export async function getTraceItems( traceId: string, setup: Setup & SetupTimeRange @@ -96,10 +91,7 @@ export async function getTraceItems( const items = traceResponse.hits.hits.map((hit) => hit._source); - const errorFrequencies: { - errorsPerTransaction: ErrorsPerTransaction; - errorDocs: APMError[]; - } = { + const errorFrequencies = { errorDocs: errorResponse.hits.hits.map(({ _source }) => _source), errorsPerTransaction: errorResponse.aggregations?.by_transaction_id.buckets.reduce( @@ -109,7 +101,7 @@ export async function getTraceItems( [current.key]: current.doc_count, }; }, - {} as ErrorsPerTransaction + {} as Record ) ?? {}, }; diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap index a4ff487645a4b..5e3bbdf6ee06e 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap +++ b/x-pack/plugins/apm/server/lib/transaction_groups/__snapshots__/queries.test.ts.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`transaction group queries fetches top traces 1`] = ` +exports[`transaction group queries fetches metrics top traces 1`] = ` Array [ Object { "apm": Object { "events": Array [ - "transaction", + "metric", ], }, "body": Object { @@ -49,6 +49,11 @@ Array [ "query": Object { "bool": Object { "filter": Array [ + Object { + "exists": Object { + "field": "transaction.duration.histogram", + }, + }, Object { "range": Object { "@timestamp": Object { @@ -58,14 +63,13 @@ Array [ }, }, }, - ], - "must_not": Array [ Object { - "exists": Object { - "field": "parent.id", + "term": Object { + "transaction.root": true, }, }, ], + "must_not": Array [], }, }, "size": 0, @@ -74,7 +78,7 @@ Array [ Object { "apm": Object { "events": Array [ - "transaction", + "metric", ], }, "body": Object { @@ -83,7 +87,7 @@ Array [ "aggs": Object { "avg": Object { "avg": Object { - "field": "transaction.duration.us", + "field": "transaction.duration.histogram", }, }, }, @@ -111,6 +115,11 @@ Array [ "query": Object { "bool": Object { "filter": Array [ + Object { + "exists": Object { + "field": "transaction.duration.histogram", + }, + }, Object { "range": Object { "@timestamp": Object { @@ -120,14 +129,13 @@ Array [ }, }, }, - ], - "must_not": Array [ Object { - "exists": Object { - "field": "parent.id", + "term": Object { + "transaction.root": true, }, }, ], + "must_not": Array [], }, }, "size": 0, @@ -136,7 +144,7 @@ Array [ Object { "apm": Object { "events": Array [ - "transaction", + "metric", ], }, "body": Object { @@ -145,7 +153,7 @@ Array [ "aggs": Object { "sum": Object { "sum": Object { - "field": "transaction.duration.us", + "field": "transaction.duration.histogram", }, }, }, @@ -173,6 +181,11 @@ Array [ "query": Object { "bool": Object { "filter": Array [ + Object { + "exists": Object { + "field": "transaction.duration.histogram", + }, + }, Object { "range": Object { "@timestamp": Object { @@ -182,14 +195,13 @@ Array [ }, }, }, - ], - "must_not": Array [ Object { - "exists": Object { - "field": "parent.id", + "term": Object { + "transaction.root": true, }, }, ], + "must_not": Array [], }, }, "size": 0, @@ -198,7 +210,7 @@ Array [ ] `; -exports[`transaction group queries fetches top transactions 1`] = ` +exports[`transaction group queries fetches top traces 1`] = ` Array [ Object { "apm": Object { @@ -223,25 +235,30 @@ Array [ }, }, }, - "terms": Object { - "field": "transaction.name", - "size": 101, + "composite": Object { + "size": 10000, + "sources": Array [ + Object { + "service.name": Object { + "terms": Object { + "field": "service.name", + }, + }, + }, + Object { + "transaction.name": Object { + "terms": Object { + "field": "transaction.name", + }, + }, + }, + ], }, }, }, "query": Object { "bool": Object { "filter": Array [ - Object { - "term": Object { - "service.name": "foo", - }, - }, - Object { - "term": Object { - "transaction.type": "bar", - }, - }, Object { "range": Object { "@timestamp": Object { @@ -252,6 +269,13 @@ Array [ }, }, ], + "must_not": Array [ + Object { + "exists": Object { + "field": "parent.id", + }, + }, + ], }, }, "size": 0, @@ -273,25 +297,30 @@ Array [ }, }, }, - "terms": Object { - "field": "transaction.name", - "size": 101, + "composite": Object { + "size": 10000, + "sources": Array [ + Object { + "service.name": Object { + "terms": Object { + "field": "service.name", + }, + }, + }, + Object { + "transaction.name": Object { + "terms": Object { + "field": "transaction.name", + }, + }, + }, + ], }, }, }, "query": Object { "bool": Object { "filter": Array [ - Object { - "term": Object { - "service.name": "foo", - }, - }, - Object { - "term": Object { - "transaction.type": "bar", - }, - }, Object { "range": Object { "@timestamp": Object { @@ -302,6 +331,13 @@ Array [ }, }, ], + "must_not": Array [ + Object { + "exists": Object { + "field": "parent.id", + }, + }, + ], }, }, "size": 0, @@ -323,81 +359,30 @@ Array [ }, }, }, - "terms": Object { - "field": "transaction.name", - "size": 101, - }, - }, - }, - "query": Object { - "bool": Object { - "filter": Array [ - Object { - "term": Object { - "service.name": "foo", - }, - }, - Object { - "term": Object { - "transaction.type": "bar", - }, - }, - Object { - "range": Object { - "@timestamp": Object { - "format": "epoch_millis", - "gte": 1528113600000, - "lte": 1528977600000, + "composite": Object { + "size": 10000, + "sources": Array [ + Object { + "service.name": Object { + "terms": Object { + "field": "service.name", + }, }, }, - }, - ], - }, - }, - "size": 0, - }, - }, - Object { - "apm": Object { - "events": Array [ - "transaction", - ], - }, - "body": Object { - "aggs": Object { - "transaction_groups": Object { - "aggs": Object { - "p95": Object { - "percentiles": Object { - "field": "transaction.duration.us", - "hdr": Object { - "number_of_significant_value_digits": 2, + Object { + "transaction.name": Object { + "terms": Object { + "field": "transaction.name", + }, }, - "percents": Array [ - 95, - ], }, - }, - }, - "terms": Object { - "field": "transaction.name", - "size": 101, + ], }, }, }, "query": Object { "bool": Object { "filter": Array [ - Object { - "term": Object { - "service.name": "foo", - }, - }, - Object { - "term": Object { - "transaction.type": "bar", - }, - }, Object { "range": Object { "@timestamp": Object { @@ -408,6 +393,13 @@ Array [ }, }, ], + "must_not": Array [ + Object { + "exists": Object { + "field": "parent.id", + }, + }, + ], }, }, "size": 0, diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts index 85f36b3999060..fc1e800bb0543 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts @@ -5,73 +5,148 @@ * 2.0. */ -import { sortBy, take } from 'lodash'; +import { QueryDslQueryContainer } from '@elastic/elasticsearch/api/types'; +import { sortBy } from 'lodash'; import moment from 'moment'; import { Unionize } from 'utility-types'; -import { asMutableArray } from '../../../common/utils/as_mutable_array'; import { AggregationOptionsByType } from '../../../../../../src/core/types/elasticsearch'; -import { PromiseReturnType } from '../../../../observability/typings/common'; +import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { + PARENT_ID, SERVICE_NAME, TRANSACTION_NAME, + TRANSACTION_ROOT, } from '../../../common/elasticsearch_fieldnames'; +import { asMutableArray } from '../../../common/utils/as_mutable_array'; +import { environmentQuery } from '../../../common/utils/environment_query'; import { joinByKey } from '../../../common/utils/join_by_key'; -import { getTransactionGroupsProjection } from '../../projections/transaction_groups'; -import { mergeProjection } from '../../projections/util/merge_projection'; import { withApmSpan } from '../../utils/with_apm_span'; -import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { - getAverages, - getCounts, - getPercentiles, - getSums, -} from './get_transaction_group_stats'; + getDocumentTypeFilterForAggregatedTransactions, + getProcessorEventForAggregatedTransactions, +} from '../helpers/aggregated_transactions'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; +import { getAverages, getCounts, getSums } from './get_transaction_group_stats'; -interface TopTransactionOptions { +export interface TopTraceOptions { environment?: string; kuery?: string; - type: 'top_transactions'; - serviceName: string; - transactionType: string; transactionName?: string; searchAggregatedTransactions: boolean; } -interface TopTraceOptions { - environment?: string; - kuery?: string; - type: 'top_traces'; - transactionName?: string; - searchAggregatedTransactions: boolean; -} +type Key = Record<'service.name' | 'transaction.name', string>; -export type Options = TopTransactionOptions | TopTraceOptions; +export interface TransactionGroup { + key: Key; + serviceName: string; + transactionName: string; + transactionType: string; + averageResponseTime: number | null | undefined; + transactionsPerMinute: number; + impact: number; +} -export type ESResponse = PromiseReturnType; +export type ESResponse = Promise<{ items: TransactionGroup[] }>; -export type TransactionGroupRequestBase = ReturnType< - typeof getTransactionGroupsProjection -> & { +export type TransactionGroupRequestBase = ReturnType & { body: { aggs: { - transaction_groups: Unionize< - Pick - >; + transaction_groups: Unionize>; }; }; }; +function getRequest( + topTraceOptions: TopTraceOptions, + setup: TransactionGroupSetup +) { + const { start, end } = setup; + + const { + searchAggregatedTransactions, + environment, + kuery, + transactionName, + } = topTraceOptions; + + const transactionNameFilter = transactionName + ? [{ term: { [TRANSACTION_NAME]: transactionName } }] + : []; + + return { + apm: { + events: [ + getProcessorEventForAggregatedTransactions( + searchAggregatedTransactions + ), + ], + }, + body: { + size: 0, + query: { + bool: { + filter: [ + ...transactionNameFilter, + ...getDocumentTypeFilterForAggregatedTransactions( + searchAggregatedTransactions + ), + ...rangeQuery(start, end), + ...environmentQuery(environment), + ...kqlQuery(kuery), + ...(searchAggregatedTransactions + ? [ + { + term: { + [TRANSACTION_ROOT]: true, + }, + }, + ] + : []), + ] as QueryDslQueryContainer[], + must_not: [ + ...(!searchAggregatedTransactions + ? [ + { + exists: { + field: PARENT_ID, + }, + }, + ] + : []), + ], + }, + }, + aggs: { + transaction_groups: { + composite: { + sources: asMutableArray([ + { [SERVICE_NAME]: { terms: { field: SERVICE_NAME } } }, + { + [TRANSACTION_NAME]: { + terms: { field: TRANSACTION_NAME }, + }, + }, + ] as const), + // traces overview is hardcoded to 10000 + size: 10000, + }, + }, + }, + }, + }; +} + export type TransactionGroupSetup = Setup & SetupTimeRange; function getItemsWithRelativeImpact( setup: TransactionGroupSetup, items: Array<{ sum?: number | null; - key: string | Record<'service.name' | 'transaction.name', string>; + key: Key; avg?: number | null; count?: number | null; transactionType?: string; - p95?: number | null; }> ) { const values = items @@ -94,137 +169,47 @@ function getItemsWithRelativeImpact( item.sum !== null && item.sum !== undefined ? ((item.sum - min) / (max - min)) * 100 || 0 : 0, - p95: item.p95, }; }); return itemsWithRelativeImpact; } -export function transactionGroupsFetcher( - options: Options, - setup: TransactionGroupSetup, - bucketSize: number -) { - const spanName = - options.type === 'top_traces' ? 'get_top_traces' : 'get_top_transactions'; - - return withApmSpan(spanName, async () => { - const projection = getTransactionGroupsProjection({ - setup, - options, - }); - - const isTopTraces = options.type === 'top_traces'; - - // @ts-expect-error - delete projection.body.aggs; - - // traces overview is hardcoded to 10000 - // transactions overview: 1 extra bucket is added to check whether the total number of buckets exceed the specified bucket size. - const expectedBucketSize = isTopTraces ? 10000 : bucketSize; - const size = isTopTraces ? 10000 : expectedBucketSize + 1; - - const request = mergeProjection(projection, { - body: { - size: 0, - aggs: { - transaction_groups: { - ...(isTopTraces - ? { - composite: { - sources: asMutableArray([ - { [SERVICE_NAME]: { terms: { field: SERVICE_NAME } } }, - { - [TRANSACTION_NAME]: { - terms: { field: TRANSACTION_NAME }, - }, - }, - ] as const), - size, - }, - } - : { - terms: { - field: TRANSACTION_NAME, - size, - }, - }), - }, - }, - }, - }); +export function topTransactionGroupsFetcher( + topTraceOptions: TopTraceOptions, + setup: TransactionGroupSetup +): Promise<{ items: TransactionGroup[] }> { + return withApmSpan('get_top_traces', async () => { + const request = getRequest(topTraceOptions, setup); const params = { request, setup, - searchAggregatedTransactions: options.searchAggregatedTransactions, + searchAggregatedTransactions: + topTraceOptions.searchAggregatedTransactions, }; - const [counts, averages, sums, percentiles] = await Promise.all([ + const [counts, averages, sums] = await Promise.all([ getCounts(params), getAverages(params), getSums(params), - !isTopTraces ? getPercentiles(params) : Promise.resolve(undefined), ]); - const stats = [ - ...averages, - ...counts, - ...sums, - ...(percentiles ? percentiles : []), - ]; + const stats = [...averages, ...counts, ...sums]; const items = joinByKey(stats, 'key'); const itemsWithRelativeImpact = getItemsWithRelativeImpact(setup, items); - const defaultServiceName = - options.type === 'top_transactions' ? options.serviceName : undefined; - - const itemsWithKeys: TransactionGroup[] = itemsWithRelativeImpact.map( - (item) => { - let transactionName: string; - let serviceName: string; - - if (typeof item.key === 'string') { - transactionName = item.key; - serviceName = defaultServiceName!; - } else { - transactionName = item.key[TRANSACTION_NAME]; - serviceName = item.key[SERVICE_NAME]; - } - - return { - ...item, - transactionName, - serviceName, - }; - } - ); + const itemsWithKeys = itemsWithRelativeImpact.map((item) => ({ + ...item, + transactionName: item.key[TRANSACTION_NAME], + serviceName: item.key[SERVICE_NAME], + })); return { - items: take( - // sort by impact by default so most impactful services are not cut off - sortBy(itemsWithKeys, 'impact').reverse(), - bucketSize - ), - // The aggregation is considered accurate if the configured bucket size is larger or equal to the number of buckets returned - // the actual number of buckets retrieved are `bucketsize + 1` to detect whether it's above the limit - isAggregationAccurate: - expectedBucketSize >= itemsWithRelativeImpact.length, - bucketSize, + // sort by impact by default so most impactful services are not cut off + items: sortBy(itemsWithKeys, 'impact').reverse(), }; }); } - -export interface TransactionGroup { - key: string | Record<'service.name' | 'transaction.name', string>; - serviceName: string; - transactionName: string; - transactionType: string; - averageResponseTime: number | null | undefined; - transactionsPerMinute: number; - p95: number | null | undefined; - impact: number; -} diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts index 34fd86f2fc598..980d8f10610c8 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/get_transaction_group_stats.ts @@ -18,7 +18,7 @@ interface MetricParams { searchAggregatedTransactions: boolean; } -type BucketKey = string | Record; +type BucketKey = Record; function mergeRequestWithAggs< TRequestBase extends TransactionGroupRequestBase, @@ -131,35 +131,3 @@ export async function getSums({ }; }); } - -export async function getPercentiles({ - request, - setup, - searchAggregatedTransactions, -}: MetricParams) { - const params = mergeRequestWithAggs(request, { - p95: { - percentiles: { - field: getTransactionDurationFieldForAggregatedTransactions( - searchAggregatedTransactions - ), - hdr: { number_of_significant_value_digits: 2 }, - percents: [95], - }, - }, - }); - - const response = await setup.apmEventClient.search( - 'get_transaction_group_latency_percentiles', - params - ); - - return arrayUnionToCallable( - response.aggregations?.transaction_groups.buckets ?? [] - ).map((bucket) => { - return { - key: bucket.key as BucketKey, - p95: Object.values(bucket.p95.values)[0], - }; - }); -} diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/index.ts b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts index ba2adb4172fcf..7bee3b358a4c3 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/index.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/index.ts @@ -6,12 +6,11 @@ */ import { Setup, SetupTimeRange } from '../helpers/setup_request'; -import { transactionGroupsFetcher, Options } from './fetcher'; +import { topTransactionGroupsFetcher, TopTraceOptions } from './fetcher'; -export async function getTransactionGroupList( - options: Options, +export async function getTopTransactionGroupList( + options: TopTraceOptions, setup: Setup & SetupTimeRange ) { - const bucketSize = setup.config['xpack.apm.ui.transactionGroupBucketSize']; - return await transactionGroupsFetcher(options, setup, bucketSize); + return await topTransactionGroupsFetcher(options, setup); } diff --git a/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts index 5c1754cd36ef4..18f1c1bee50dc 100644 --- a/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts +++ b/x-pack/plugins/apm/server/lib/transaction_groups/queries.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { transactionGroupsFetcher } from './fetcher'; +import { topTransactionGroupsFetcher } from './fetcher'; import { SearchParamsMock, inspectSearchParams, @@ -18,18 +18,13 @@ describe('transaction group queries', () => { mock.teardown(); }); - it('fetches top transactions', async () => { - const bucketSize = 100; + it('fetches top traces', async () => { mock = await inspectSearchParams((setup) => - transactionGroupsFetcher( + topTransactionGroupsFetcher( { - type: 'top_transactions', - serviceName: 'foo', - transactionType: 'bar', searchAggregatedTransactions: false, }, - setup, - bucketSize + setup ) ); @@ -37,17 +32,13 @@ describe('transaction group queries', () => { expect(allParams).toMatchSnapshot(); }); - - it('fetches top traces', async () => { - const bucketSize = 100; + it('fetches metrics top traces', async () => { mock = await inspectSearchParams((setup) => - transactionGroupsFetcher( + topTransactionGroupsFetcher( { - type: 'top_traces', - searchAggregatedTransactions: false, + searchAggregatedTransactions: true, }, - setup, - bucketSize + setup ) ); diff --git a/x-pack/plugins/apm/server/lib/transactions/get_throughput_charts/index.ts b/x-pack/plugins/apm/server/lib/transactions/get_throughput_charts/index.ts deleted file mode 100644 index d5fff20496280..0000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/get_throughput_charts/index.ts +++ /dev/null @@ -1,140 +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 { ESFilter } from '../../../../../../../src/core/types/elasticsearch'; -import { PromiseReturnType } from '../../../../../observability/typings/common'; -import { - SERVICE_NAME, - TRANSACTION_NAME, - TRANSACTION_RESULT, - TRANSACTION_TYPE, -} from '../../../../common/elasticsearch_fieldnames'; -import { kqlQuery, rangeQuery } from '../../../../../observability/server'; -import { environmentQuery } from '../../../../common/utils/environment_query'; -import { - getDocumentTypeFilterForAggregatedTransactions, - getProcessorEventForAggregatedTransactions, -} from '../../../lib/helpers/aggregated_transactions'; -import { Setup, SetupTimeRange } from '../../../lib/helpers/setup_request'; -import { getBucketSizeForAggregatedTransactions } from '../../helpers/get_bucket_size_for_aggregated_transactions'; -import { getThroughputBuckets } from './transform'; - -export type ThroughputChartsResponse = PromiseReturnType< - typeof searchThroughput ->; - -function searchThroughput({ - environment, - kuery, - serviceName, - transactionType, - transactionName, - setup, - searchAggregatedTransactions, - intervalString, -}: { - environment?: string; - kuery?: string; - serviceName: string; - transactionType: string; - transactionName: string | undefined; - setup: Setup & SetupTimeRange; - searchAggregatedTransactions: boolean; - intervalString: string; -}) { - const { start, end, apmEventClient } = setup; - - const filter: ESFilter[] = [ - { term: { [SERVICE_NAME]: serviceName } }, - { term: { [TRANSACTION_TYPE]: transactionType } }, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), - ...rangeQuery(start, end), - ...environmentQuery(environment), - ...kqlQuery(kuery), - ]; - - if (transactionName) { - filter.push({ term: { [TRANSACTION_NAME]: transactionName } }); - } - - const params = { - apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], - }, - body: { - size: 0, - query: { bool: { filter } }, - aggs: { - throughput: { - terms: { field: TRANSACTION_RESULT, missing: '' }, - aggs: { - timeseries: { - date_histogram: { - field: '@timestamp', - fixed_interval: intervalString, - min_doc_count: 0, - extended_bounds: { min: start, max: end }, - }, - }, - }, - }, - }, - }, - }; - - return apmEventClient.search('get_transaction_throughput_series', params); -} - -export async function getThroughputCharts({ - environment, - kuery, - serviceName, - transactionType, - transactionName, - setup, - searchAggregatedTransactions, -}: { - environment?: string; - kuery?: string; - serviceName: string; - transactionType: string; - transactionName: string | undefined; - setup: Setup & SetupTimeRange; - searchAggregatedTransactions: boolean; -}) { - const { bucketSize, intervalString } = getBucketSizeForAggregatedTransactions( - { - ...setup, - searchAggregatedTransactions, - } - ); - - const response = await searchThroughput({ - environment, - kuery, - serviceName, - transactionType, - transactionName, - setup, - searchAggregatedTransactions, - intervalString, - }); - - return { - throughputTimeseries: getThroughputBuckets({ - throughputResultBuckets: response.aggregations?.throughput.buckets, - bucketSize, - setupTimeRange: setup, - }), - }; -} diff --git a/x-pack/plugins/apm/server/lib/transactions/get_throughput_charts/transform.ts b/x-pack/plugins/apm/server/lib/transactions/get_throughput_charts/transform.ts deleted file mode 100644 index 1f26e65c460e5..0000000000000 --- a/x-pack/plugins/apm/server/lib/transactions/get_throughput_charts/transform.ts +++ /dev/null @@ -1,55 +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 { sortBy } from 'lodash'; -import { NOT_AVAILABLE_LABEL } from '../../../../common/i18n'; -import { ThroughputChartsResponse } from '.'; -import { calculateThroughput } from '../../helpers/calculate_throughput'; -import { SetupTimeRange } from '../../helpers/setup_request'; - -type ThroughputResultBuckets = Required['aggregations']['throughput']['buckets']; - -export function getThroughputBuckets({ - throughputResultBuckets = [], - bucketSize, - setupTimeRange, -}: { - throughputResultBuckets?: ThroughputResultBuckets; - bucketSize: number; - setupTimeRange: SetupTimeRange; -}) { - const { start, end } = setupTimeRange; - const buckets = throughputResultBuckets.map( - ({ key: resultKey, timeseries }) => { - const dataPoints = timeseries.buckets.map((bucket) => { - return { - x: bucket.key, - // divide by minutes - y: bucket.doc_count / (bucketSize / 60), - }; - }); - - // Handle empty string result keys - const key = - resultKey === '' ? NOT_AVAILABLE_LABEL : (resultKey as string); - - const docCountTotal = timeseries.buckets - .map((bucket) => bucket.doc_count) - .reduce((a, b) => a + b, 0); - - // calculate average throughput - const avg = calculateThroughput({ start, end, value: docCountTotal }); - - return { key, dataPoints, avg }; - } - ); - - return sortBy( - buckets, - (bucket) => bucket.key.toString().replace(/^HTTP (\d)xx$/, '00$1') // ensure that HTTP 3xx are sorted at the top - ); -} diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index d28e43d9cb976..24d41e2574bbe 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -33,7 +33,6 @@ import { createApmAgentConfigurationIndex } from './lib/settings/agent_configura import { getApmIndices } from './lib/settings/apm_indices/get_apm_indices'; import { createApmCustomLinkIndex } from './lib/settings/custom_link/create_custom_link_index'; import { apmIndices, apmTelemetry, apmServerSettings } from './saved_objects'; -import { uiSettings } from './ui_settings'; import type { ApmPluginRequestHandlerContext, APMRouteHandlerResources, @@ -81,8 +80,6 @@ export class APMPlugin core.savedObjects.registerType(apmTelemetry); core.savedObjects.registerType(apmServerSettings); - core.uiSettings.register(uiSettings); - const currentConfig = mergeConfigs( plugins.apmOss.config, this.initContext.config.get() @@ -133,20 +130,23 @@ export class APMPlugin settings: { number_of_shards: 1, }, - mappings: mappingFromFieldMap({ - [SERVICE_NAME]: { - type: 'keyword', - }, - [SERVICE_ENVIRONMENT]: { - type: 'keyword', - }, - [TRANSACTION_TYPE]: { - type: 'keyword', - }, - [PROCESSOR_EVENT]: { - type: 'keyword', + mappings: mappingFromFieldMap( + { + [SERVICE_NAME]: { + type: 'keyword', + }, + [SERVICE_ENVIRONMENT]: { + type: 'keyword', + }, + [TRANSACTION_TYPE]: { + type: 'keyword', + }, + [PROCESSOR_EVENT]: { + type: 'keyword', + }, }, - }), + 'strict' + ), }, }, }); diff --git a/x-pack/plugins/apm/server/projections/transaction_groups.ts b/x-pack/plugins/apm/server/projections/transaction_groups.ts deleted file mode 100644 index 2381c2964c96a..0000000000000 --- a/x-pack/plugins/apm/server/projections/transaction_groups.ts +++ /dev/null @@ -1,61 +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 { omit } from 'lodash'; -import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request'; -import { - TRANSACTION_NAME, - PARENT_ID, - TRANSACTION_ROOT, -} from '../../common/elasticsearch_fieldnames'; -import { Options } from '../../server/lib/transaction_groups/fetcher'; -import { getTransactionsProjection } from './transactions'; -import { mergeProjection } from './util/merge_projection'; - -export function getTransactionGroupsProjection({ - setup, - options, -}: { - setup: Setup & SetupTimeRange; - options: Options; -}) { - const transactionsProjection = getTransactionsProjection({ - setup, - ...(omit(options, 'type') as Omit), - }); - - if (options.type === 'top_traces') { - if (options.searchAggregatedTransactions) { - transactionsProjection.body.query.bool.filter.push({ - term: { - [TRANSACTION_ROOT]: true, - }, - }); - } else { - // @ts-expect-error: Property 'must_not' does not exist on type '{ filter: ESFilter[]; }'. - transactionsProjection.body.query.bool.must_not = [ - { - exists: { - field: PARENT_ID, - }, - }, - ]; - } - } - - return mergeProjection(transactionsProjection, { - body: { - aggs: { - transactions: { - terms: { - field: TRANSACTION_NAME, - }, - }, - }, - }, - }); -} diff --git a/x-pack/plugins/apm/server/projections/transactions.ts b/x-pack/plugins/apm/server/projections/transactions.ts deleted file mode 100644 index 1efd9679cae9c..0000000000000 --- a/x-pack/plugins/apm/server/projections/transactions.ts +++ /dev/null @@ -1,79 +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 { QueryDslQueryContainer } from '@elastic/elasticsearch/api/types'; -import { Setup, SetupTimeRange } from '../../server/lib/helpers/setup_request'; -import { - SERVICE_NAME, - TRANSACTION_TYPE, - TRANSACTION_NAME, -} from '../../common/elasticsearch_fieldnames'; -import { rangeQuery, kqlQuery } from '../../../observability/server'; -import { environmentQuery } from '../../common/utils/environment_query'; -import { - getProcessorEventForAggregatedTransactions, - getDocumentTypeFilterForAggregatedTransactions, -} from '../lib/helpers/aggregated_transactions'; - -export function getTransactionsProjection({ - environment, - kuery, - setup, - serviceName, - transactionName, - transactionType, - searchAggregatedTransactions, -}: { - environment?: string; - kuery?: string; - setup: Setup & SetupTimeRange; - serviceName?: string; - transactionName?: string; - transactionType?: string; - searchAggregatedTransactions: boolean; -}) { - const { start, end } = setup; - - const transactionNameFilter = transactionName - ? [{ term: { [TRANSACTION_NAME]: transactionName } }] - : []; - const transactionTypeFilter = transactionType - ? [{ term: { [TRANSACTION_TYPE]: transactionType } }] - : []; - const serviceNameFilter = serviceName - ? [{ term: { [SERVICE_NAME]: serviceName } }] - : []; - - const bool = { - filter: [ - ...serviceNameFilter, - ...transactionNameFilter, - ...transactionTypeFilter, - ...getDocumentTypeFilterForAggregatedTransactions( - searchAggregatedTransactions - ), - ...rangeQuery(start, end), - ...environmentQuery(environment), - ...kqlQuery(kuery), - ] as QueryDslQueryContainer[], - }; - - return { - apm: { - events: [ - getProcessorEventForAggregatedTransactions( - searchAggregatedTransactions - ), - ], - }, - body: { - query: { - bool, - }, - }, - }; -} diff --git a/x-pack/plugins/apm/server/routes/backends.ts b/x-pack/plugins/apm/server/routes/backends.ts index c738e9aa64007..e673770dbbc1a 100644 --- a/x-pack/plugins/apm/server/routes/backends.ts +++ b/x-pack/plugins/apm/server/routes/backends.ts @@ -25,7 +25,7 @@ const topBackendsRoute = createApmServerRoute({ query: t.intersection([rangeRt, t.type({ numBuckets: toNumberRt })]), }), t.partial({ - query: t.intersection([environmentRt, offsetRt]), + query: t.intersection([environmentRt, offsetRt, kueryRt]), }), ]), options: { @@ -35,9 +35,9 @@ const topBackendsRoute = createApmServerRoute({ const setup = await setupRequest(resources); const { start, end } = setup; - const { environment, offset, numBuckets } = resources.params.query; + const { environment, offset, numBuckets, kuery } = resources.params.query; - const opts = { setup, start, end, numBuckets, environment }; + const opts = { setup, start, end, numBuckets, environment, kuery }; const [currentBackends, previousBackends] = await Promise.all([ getTopBackends(opts), diff --git a/x-pack/plugins/apm/server/routes/register_routes/index.test.ts b/x-pack/plugins/apm/server/routes/register_routes/index.test.ts index b9dece866fae5..b748d187c5e47 100644 --- a/x-pack/plugins/apm/server/routes/register_routes/index.test.ts +++ b/x-pack/plugins/apm/server/routes/register_routes/index.test.ts @@ -7,7 +7,7 @@ import { jsonRt } from '@kbn/io-ts-utils'; import { createServerRouteRepository } from '@kbn/server-route-repository'; -import { ServerRoute } from '@kbn/server-route-repository/target/typings'; +import { ServerRoute } from '@kbn/server-route-repository'; import * as t from 'io-ts'; import { CoreSetup, Logger } from 'src/core/server'; import { APMConfig } from '../..'; diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts index 267479de4c102..023753932d21f 100644 --- a/x-pack/plugins/apm/server/routes/service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map.ts @@ -7,16 +7,17 @@ import Boom from '@hapi/boom'; import * as t from 'io-ts'; +import { isActivePlatinumLicense } from '../../common/license_check'; import { invalidLicenseMessage } from '../../common/service_map'; +import { notifyFeatureUsage } from '../feature'; +import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; 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 { environmentRt, rangeRt } from './default_api_types'; -import { notifyFeatureUsage } from '../feature'; -import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; -import { isActivePlatinumLicense } from '../../common/license_check'; import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { environmentRt, rangeRt } from './default_api_types'; const serviceMapRoute = createApmServerRoute({ endpoint: 'GET /api/apm/service-map', @@ -100,6 +101,40 @@ const serviceMapServiceNodeRoute = createApmServerRoute({ }, }); +const serviceMapBackendNodeRoute = createApmServerRoute({ + endpoint: 'GET /api/apm/service-map/backend/{backendName}', + params: t.type({ + path: t.type({ + backendName: t.string, + }), + query: t.intersection([environmentRt, rangeRt]), + }), + options: { tags: ['access:apm'] }, + handler: async (resources) => { + const { config, context, params } = resources; + + if (!config['xpack.apm.serviceMapEnabled']) { + throw Boom.notFound(); + } + if (!isActivePlatinumLicense(context.licensing.license)) { + throw Boom.forbidden(invalidLicenseMessage); + } + const setup = await setupRequest(resources); + + const { + path: { backendName }, + query: { environment }, + } = params; + + return getServiceMapBackendNodeInfo({ + environment, + setup, + backendName, + }); + }, +}); + export const serviceMapRouteRepository = createApmServerRouteRepository() .add(serviceMapRoute) - .add(serviceMapServiceNodeRoute); + .add(serviceMapServiceNodeRoute) + .add(serviceMapBackendNodeRoute); diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts index 460aa13feea2b..f5156fe85fbf5 100644 --- a/x-pack/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services.ts @@ -41,6 +41,8 @@ import { rangeRt, } from './default_api_types'; import { offsetPreviousPeriodCoordinates } from '../../common/utils/offset_previous_period_coordinate'; +import { getServicesDetailedStatistics } from '../lib/services/get_services_detailed_statistics'; +import { getServiceDependenciesBreakdown } from '../lib/services/get_service_dependencies_breakdown'; const servicesRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services', @@ -67,6 +69,42 @@ const servicesRoute = createApmServerRoute({ }, }); +const servicesDetailedStatisticsRoute = createApmServerRoute({ + endpoint: 'GET /api/apm/services/detailed_statistics', + params: t.type({ + query: t.intersection([ + environmentRt, + kueryRt, + rangeRt, + offsetRt, + t.type({ serviceNames: jsonRt.pipe(t.array(t.string)) }), + ]), + }), + options: { tags: ['access:apm'] }, + handler: async (resources) => { + const setup = await setupRequest(resources); + const { params } = resources; + const { environment, kuery, offset, serviceNames } = params.query; + const searchAggregatedTransactions = await getSearchAggregatedTransactions({ + ...setup, + kuery, + }); + + if (!serviceNames.length) { + throw Boom.badRequest(`serviceNames cannot be empty`); + } + + return getServicesDetailedStatistics({ + environment, + kuery, + setup, + searchAggregatedTransactions, + offset, + serviceNames, + }); + }, +}); + const serviceMetadataDetailsRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services/{serviceName}/metadata/details', params: t.type({ @@ -655,6 +693,38 @@ export const serviceDependenciesRoute = createApmServerRoute({ }, }); +export const serviceDependenciesBreakdownRoute = createApmServerRoute({ + endpoint: 'GET /api/apm/services/{serviceName}/dependencies/breakdown', + params: t.type({ + path: t.type({ + serviceName: t.string, + }), + query: t.intersection([environmentRt, rangeRt, kueryRt]), + }), + options: { + tags: ['access:apm'], + }, + handler: async (resources) => { + const setup = await setupRequest(resources); + const { params } = resources; + const { serviceName } = params.path; + const { environment, start, end, kuery } = params.query; + + const breakdown = await getServiceDependenciesBreakdown({ + setup, + start, + end, + serviceName, + environment, + kuery, + }); + + return { + breakdown, + }; + }, +}); + const serviceProfilingTimelineRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services/{serviceName}/profiling/timeline', params: t.type({ @@ -770,6 +840,7 @@ const serviceAlertsRoute = createApmServerRoute({ export const serviceRouteRepository = createApmServerRouteRepository() .add(servicesRoute) + .add(servicesDetailedStatisticsRoute) .add(serviceMetadataDetailsRoute) .add(serviceMetadataIconsRoute) .add(serviceAgentNameRoute) @@ -784,6 +855,7 @@ export const serviceRouteRepository = createApmServerRouteRepository() .add(serviceInstancesMainStatisticsRoute) .add(serviceInstancesDetailedStatisticsRoute) .add(serviceDependenciesRoute) + .add(serviceDependenciesBreakdownRoute) .add(serviceProfilingTimelineRoute) .add(serviceProfilingStatisticsRoute) .add(serviceAlertsRoute); diff --git a/x-pack/plugins/apm/server/routes/traces.ts b/x-pack/plugins/apm/server/routes/traces.ts index bed7252dd20fd..11747c847fcbd 100644 --- a/x-pack/plugins/apm/server/routes/traces.ts +++ b/x-pack/plugins/apm/server/routes/traces.ts @@ -8,7 +8,7 @@ import * as t from 'io-ts'; import { setupRequest } from '../lib/helpers/setup_request'; import { getTrace } from '../lib/traces/get_trace'; -import { getTransactionGroupList } from '../lib/transaction_groups'; +import { getTopTransactionGroupList } from '../lib/transaction_groups'; import { createApmServerRoute } from './create_apm_server_route'; import { environmentRt, kueryRt, rangeRt } from './default_api_types'; import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; @@ -31,8 +31,8 @@ const tracesRoute = createApmServerRoute({ kuery, }); - return getTransactionGroupList( - { environment, kuery, type: 'top_traces', searchAggregatedTransactions }, + return getTopTransactionGroupList( + { environment, kuery, searchAggregatedTransactions }, setup ); }, diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions.ts index c20de31847e8a..f211e722958c5 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { jsonRt } from '@kbn/io-ts-utils'; +import { jsonRt, toNumberRt } from '@kbn/io-ts-utils'; import * as t from 'io-ts'; -import { toNumberRt } from '@kbn/io-ts-utils'; import { LatencyAggregationType, latencyAggregationTypeRt, @@ -20,61 +19,16 @@ import { getTransactionBreakdown } from '../lib/transactions/breakdown'; import { getTransactionDistribution } from '../lib/transactions/distribution'; import { getAnomalySeries } from '../lib/transactions/get_anomaly_data'; import { getLatencyPeriods } from '../lib/transactions/get_latency_charts'; -import { getThroughputCharts } from '../lib/transactions/get_throughput_charts'; -import { getTransactionGroupList } from '../lib/transaction_groups'; 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 { comparisonRangeRt, environmentRt, - rangeRt, kueryRt, + rangeRt, } from './default_api_types'; -/** - * Returns a list of transactions grouped by name - * //TODO: delete this once we moved away from the old table in the transaction overview page. It should be replaced by /transactions/groups/main_statistics/ - */ -const transactionGroupsRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/services/{serviceName}/transactions/groups', - params: t.type({ - path: t.type({ - serviceName: t.string, - }), - query: t.intersection([ - t.type({ transactionType: t.string }), - environmentRt, - kueryRt, - rangeRt, - ]), - }), - options: { tags: ['access:apm'] }, - handler: async (resources) => { - const setup = await setupRequest(resources); - const { params } = resources; - const { serviceName } = params.path; - const { environment, kuery, transactionType } = params.query; - - const searchAggregatedTransactions = await getSearchAggregatedTransactions({ - ...setup, - kuery, - }); - - return getTransactionGroupList( - { - environment, - kuery, - type: 'top_transactions', - serviceName, - transactionType, - searchAggregatedTransactions, - }, - setup - ); - }, -}); - const transactionGroupsMainStatisticsRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics', @@ -250,51 +204,6 @@ const transactionLatencyChartsRoute = createApmServerRoute({ }, }); -const transactionThroughputChartsRoute = createApmServerRoute({ - endpoint: - 'GET /api/apm/services/{serviceName}/transactions/charts/throughput', - params: t.type({ - path: t.type({ - serviceName: t.string, - }), - query: t.intersection([ - t.type({ transactionType: t.string }), - t.partial({ transactionName: t.string }), - environmentRt, - kueryRt, - rangeRt, - ]), - }), - options: { tags: ['access:apm'] }, - handler: async (resources) => { - const setup = await setupRequest(resources); - const { params } = resources; - - const { serviceName } = params.path; - const { - environment, - kuery, - transactionType, - transactionName, - } = params.query; - - const searchAggregatedTransactions = await getSearchAggregatedTransactions({ - ...setup, - kuery, - }); - - return await getThroughputCharts({ - environment, - kuery, - serviceName, - transactionType, - transactionName, - setup, - searchAggregatedTransactions, - }); - }, -}); - const transactionChartsDistributionRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services/{serviceName}/transactions/charts/distribution', @@ -435,11 +344,9 @@ const transactionChartsErrorRateRoute = createApmServerRoute({ }); export const transactionRouteRepository = createApmServerRouteRepository() - .add(transactionGroupsRoute) .add(transactionGroupsMainStatisticsRoute) .add(transactionGroupsDetailedStatisticsRoute) .add(transactionLatencyChartsRoute) - .add(transactionThroughputChartsRoute) .add(transactionChartsDistributionRoute) .add(transactionChartsBreakdownRoute) .add(transactionChartsErrorRateRoute); diff --git a/x-pack/plugins/apm/server/ui_settings.ts b/x-pack/plugins/apm/server/ui_settings.ts deleted file mode 100644 index 0161b11cf0784..0000000000000 --- a/x-pack/plugins/apm/server/ui_settings.ts +++ /dev/null @@ -1,32 +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 { schema } from '@kbn/config-schema'; -import { i18n } from '@kbn/i18n'; -import { UiSettingsParams } from '../../../../src/core/types'; -import { observabilityFeatureId } from '../../observability/common'; -import { enableServiceOverview } from '../common/ui_settings_keys'; - -/** - * uiSettings definitions for APM. - */ -export const uiSettings: Record> = { - [enableServiceOverview]: { - category: [observabilityFeatureId], - name: i18n.translate('xpack.apm.enableServiceOverviewExperimentName', { - defaultMessage: 'APM Service overview', - }), - value: true, - description: i18n.translate( - 'xpack.apm.enableServiceOverviewExperimentDescription', - { - defaultMessage: 'Enable the Overview tab for services in APM.', - } - ), - schema: schema.boolean(), - }, -}; diff --git a/x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts b/x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts index 6b6f94779a9af..4865396cae7b2 100644 --- a/x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts +++ b/x-pack/plugins/apm/typings/es_schemas/raw/span_raw.ts @@ -54,6 +54,11 @@ export interface SpanRaw extends APMBaseDoc { body?: string; headers?: Record; }; + composite?: { + count: number; + sum: { us: number }; + compression_strategy: string; + }; }; timestamp: TimestampUs; transaction?: { diff --git a/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts index 06376bf1d750b..76176f6ba2133 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/elements/metric/index.ts @@ -8,7 +8,7 @@ import { openSans } from '../../../common/lib/fonts'; import { ElementFactory } from '../../../types'; import { SetupInitializer } from '../../plugin'; -import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../src/plugins/field_formats/common'; export const metricElementInitializer: SetupInitializer = (core, setup) => { return () => ({ @@ -22,10 +22,10 @@ export const metricElementInitializer: SetupInitializer = (core, expression: `filters | demodata | math "unique(country)" - | metric "Countries" - metricFont={font size=48 family="${openSans.value}" color="#000000" align="center" lHeight=48} + | metric "Countries" + metricFont={font size=48 family="${openSans.value}" color="#000000" align="center" lHeight=48} labelFont={font size=14 family="${openSans.value}" color="#000000" align="center"} - metricFormat="${core.uiSettings.get(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN)}" + metricFormat="${core.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN)}" | render`, }); }; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts index a34930a5d18a8..b46307ef92502 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/index.ts @@ -35,7 +35,6 @@ import { lte } from './lte'; import { mapCenter } from './map_center'; import { neq } from './neq'; import { ply } from './ply'; -import { progress } from './progress'; import { render } from './render'; import { replace } from './replace'; import { rounddate } from './rounddate'; @@ -83,7 +82,6 @@ export const functions = [ mapCenter, neq, ply, - progress, render, replace, rounddate, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.test.js b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.test.js deleted file mode 100644 index 567421a969d92..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.test.js +++ /dev/null @@ -1,175 +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 expect from '@kbn/expect'; -import { - functionWrapper, - fontStyle, -} from '../../../../../../src/plugins/presentation_util/common/lib'; -import { getFunctionErrors } from '../../../i18n'; -import { progress } from './progress'; - -const errors = getFunctionErrors().progress; - -// TODO: this test was not running and is not up to date -describe.skip('progress', () => { - const fn = functionWrapper(progress); - - const value = 0.33; - - it('returns a render as progress', () => { - const result = fn(0.2); - expect(result).to.have.property('type', 'render').and.to.have.property('as', 'progress'); - }); - - it('sets the progress to context', () => { - const result = fn(0.58); - expect(result.value).to.have.property('value', 0.58); - }); - - it(`throws when context is outside of the valid range`, () => { - expect(fn) - .withArgs(3) - .to.throwException(new RegExp(errors.invalidValue(3).message)); - }); - - describe('args', () => { - describe('shape', () => { - it('sets the progress element shape', () => { - const result = fn(value, { - shape: 'wheel', - }); - expect(result.value).to.have.property('shape', 'wheel'); - }); - - it(`defaults to 'gauge'`, () => { - const result = fn(value); - expect(result.value).to.have.property('shape', 'gauge'); - }); - }); - - describe('max', () => { - it('sets the maximum value', () => { - const result = fn(value, { - max: 2, - }); - expect(result.value).to.have.property('max', 2); - }); - - it('defaults to 1', () => { - const result = fn(value); - expect(result.value).to.have.property('max', 1); - }); - - it('throws if max <= 0', () => { - expect(fn) - .withArgs(value, { max: -0.5 }) - .to.throwException(new RegExp(errors.invalidMaxValue(-0.5).message)); - }); - }); - - describe('valueColor', () => { - it('sets the color of the progress bar', () => { - const result = fn(value, { - valueColor: '#000000', - }); - expect(result.value).to.have.property('valueColor', '#000000'); - }); - - it(`defaults to '#1785b0'`, () => { - const result = fn(value); - expect(result.value).to.have.property('valueColor', '#1785b0'); - }); - }); - - describe('barColor', () => { - it('sets the color of the background bar', () => { - const result = fn(value, { - barColor: '#FFFFFF', - }); - expect(result.value).to.have.property('barColor', '#FFFFFF'); - }); - - it(`defaults to '#f0f0f0'`, () => { - const result = fn(value); - expect(result.value).to.have.property('barColor', '#f0f0f0'); - }); - }); - - describe('valueWeight', () => { - it('sets the thickness of the bars', () => { - const result = fn(value, { - valuWeight: 100, - }); - - expect(result.value).to.have.property('valuWeight', 100); - }); - - it(`defaults to 20`, () => { - const result = fn(value); - expect(result.value).to.have.property('barWeight', 20); - }); - }); - - describe('barWeight', () => { - it('sets the thickness of the bars', () => { - const result = fn(value, { - barWeight: 50, - }); - - expect(result.value).to.have.property('barWeight', 50); - }); - - it(`defaults to 20`, () => { - const result = fn(value); - expect(result.value).to.have.property('barWeight', 20); - }); - }); - - describe('label', () => { - it('sets the label of the progress', () => { - const result = fn(value, { label: 'foo' }); - - expect(result.value).to.have.property('label', 'foo'); - }); - - it('hides the label if false', () => { - const result = fn(value, { - label: false, - }); - expect(result.value).to.have.property('label', ''); - }); - - it('defaults to true which sets the context as the label', () => { - const result = fn(value); - expect(result.value).to.have.property('label', '0.33'); - }); - }); - - describe('font', () => { - it('sets the font style for the label', () => { - const result = fn(value, { - font: fontStyle, - }); - - expect(result.value).to.have.property('font'); - expect(result.value.font).to.have.keys(Object.keys(fontStyle)); - expect(result.value.font.spec).to.have.keys(Object.keys(fontStyle.spec)); - }); - - it('sets fill to color', () => { - const result = fn(value, { - font: fontStyle, - }); - expect(result.value.font.spec).to.have.property('fill', fontStyle.spec.color); - }); - - // TODO: write test when using an instance of the interpreter - // it("sets a default style for the label when not provided", () => {}); - }); - }); -}); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts deleted file mode 100644 index 3e78b6dd83947..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/common/progress.ts +++ /dev/null @@ -1,130 +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 { get } from 'lodash'; -import { openSans } from '../../../common/lib/fonts'; -import { Render, Style, ExpressionFunctionDefinition } from '../../../types'; -import { getFunctionHelp, getFunctionErrors } from '../../../i18n'; - -export enum Shape { - GAUGE = 'gauge', - HORIZONTAL_BAR = 'horizontalBar', - HORIZONTAL_PILL = 'horizontalPill', - SEMICIRCLE = 'semicircle', - UNICORN = 'unicorn', - VERTICAL_BAR = 'verticalBar', - VERTICAL_PILL = 'verticalPill', - WHEEL = 'wheel', -} - -export interface Arguments { - barColor: string; - barWeight: number; - font: Style; - label: boolean | string; - max: number; - shape: Shape; - valueColor: string; - valueWeight: number; -} - -export type Output = Arguments & { - value: number; -}; - -export function progress(): ExpressionFunctionDefinition< - 'progress', - number, - Arguments, - Render -> { - const { help, args: argHelp } = getFunctionHelp().progress; - const errors = getFunctionErrors().progress; - - return { - name: 'progress', - aliases: [], - type: 'render', - inputTypes: ['number'], - help, - args: { - shape: { - aliases: ['_'], - types: ['string'], - help: argHelp.shape, - options: Object.values(Shape), - default: 'gauge', - }, - barColor: { - types: ['string'], - help: argHelp.barColor, - default: `#f0f0f0`, - }, - barWeight: { - types: ['number'], - help: argHelp.barWeight, - default: 20, - }, - font: { - types: ['style'], - help: argHelp.font, - default: `{font size=24 family="${openSans.value}" color="#000000" align=center}`, - }, - label: { - types: ['boolean', 'string'], - help: argHelp.label, - default: true, - }, - max: { - types: ['number'], - help: argHelp.max, - default: 1, - }, - valueColor: { - types: ['string'], - help: argHelp.valueColor, - default: `#1785b0`, - }, - valueWeight: { - types: ['number'], - help: argHelp.valueWeight, - default: 20, - }, - }, - fn: (value, args) => { - if (args.max <= 0) { - throw errors.invalidMaxValue(args.max); - } - if (value > args.max || value < 0) { - throw errors.invalidValue(value, args.max); - } - - let label = ''; - if (args.label) { - label = typeof args.label === 'string' ? args.label : `${value}`; - } - - let font: Style = {} as Style; - - if (get(args, 'font.spec')) { - font = { ...args.font }; - font.spec.fill = args.font.spec.color; // SVG uses fill for font color - } - - return { - type: 'render', - as: 'progress', - value: { - value, - ...args, - label, - font, - }, - }; - }, - }; -} diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/core.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/core.ts index 5ec2af8d7773f..d7bde45f90d77 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/core.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/core.ts @@ -8,10 +8,9 @@ import { markdown } from './markdown'; import { pie } from './pie'; import { plot } from './plot'; -import { progress } from './progress'; import { text } from './text'; import { table } from './table'; -export const renderFunctions = [markdown, pie, plot, progress, table, text]; +export const renderFunctions = [markdown, pie, plot, table, text]; export const renderFunctionFactories = []; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts index 57d5ae69c99bb..94aadf6598b5a 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/external.ts @@ -10,7 +10,10 @@ import { metricRenderer } from '../../../../../src/plugins/expression_metric/pub import { errorRenderer, debugRenderer } from '../../../../../src/plugins/expression_error/public'; import { repeatImageRenderer } from '../../../../../src/plugins/expression_repeat_image/public'; import { revealImageRenderer } from '../../../../../src/plugins/expression_reveal_image/public'; -import { shapeRenderer } from '../../../../../src/plugins/expression_shape/public'; +import { + shapeRenderer, + progressRenderer, +} from '../../../../../src/plugins/expression_shape/public'; export const renderFunctions = [ debugRenderer, @@ -20,6 +23,7 @@ export const renderFunctions = [ revealImageRenderer, shapeRenderer, repeatImageRenderer, + progressRenderer, ]; export const renderFunctionFactories = []; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/components/__stories__/__snapshots__/time_filter.stories.storyshot b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/components/__stories__/__snapshots__/time_filter.stories.storyshot index 422a61d4ef03e..a712563966e0b 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/components/__stories__/__snapshots__/time_filter.stories.storyshot +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/filters/time_filter/components/__stories__/__snapshots__/time_filter.stories.storyshot @@ -164,6 +164,7 @@ exports[`Storyshots renderers/TimeFilter with absolute time bounds 1`] = ` >
    @@ -440,6 +441,7 @@ exports[`Storyshots renderers/TimeFilter with relative time bounds 1`] = ` >
    diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/__stories__/__snapshots__/progress.stories.storyshot b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/__stories__/__snapshots__/progress.stories.storyshot deleted file mode 100644 index 1fe884656ef3b..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/__stories__/__snapshots__/progress.stories.storyshot +++ /dev/null @@ -1,14 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Storyshots renderers/progress default 1`] = ` -
    - -
    -`; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.ts deleted file mode 100644 index 33565b8b34dae..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/index.ts +++ /dev/null @@ -1,126 +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 { getId } from '../../../public/lib/get_id'; -import { RendererStrings } from '../../../i18n'; -import { shapes } from './shapes'; -import { Output as Arguments } from '../../functions/common/progress'; -import { RendererFactory } from '../../../types'; - -const { progress: strings } = RendererStrings; - -export const progress: RendererFactory = () => ({ - name: 'progress', - displayName: strings.getDisplayName(), - help: strings.getHelpDescription(), - reuseDomNode: true, - render(domNode, config, handlers) { - const { shape, value, max, valueColor, barColor, valueWeight, barWeight, label, font } = config; - const percent = value / max; - const shapeDef = shapes[shape]; - const offset = Math.max(valueWeight, barWeight); - - if (shapeDef) { - const parser = new DOMParser(); - const shapeSvg = parser - .parseFromString(shapeDef, 'image/svg+xml') - .getElementsByTagName('svg') - .item(0)!; - - const initialViewBox = shapeSvg - .getAttribute('viewBox')! - .split(' ') - .map((v) => parseInt(v, 10)); - let [minX, minY, width, height] = initialViewBox; - - if (shape !== 'horizontalBar') { - minX -= offset / 2; - width += offset; - } - - if (shape === 'semicircle') { - minY -= offset / 2; - height += offset / 2; - } else if (shape !== 'verticalBar') { - minY -= offset / 2; - height += offset; - } - - shapeSvg.setAttribute('className', 'canvasProgress'); - - const svgId = getId('svg'); - shapeSvg.id = svgId; - - const bar = shapeSvg.getElementsByTagName('path').item(0)!; - bar.setAttribute('className', 'canvasProgress__background'); - bar.setAttribute('fill', 'none'); - bar.setAttribute('stroke', barColor); - bar.setAttribute('stroke-width', `${barWeight}px`); - - const valueSvg = bar.cloneNode(true) as SVGPathElement; - valueSvg.setAttribute('className', 'canvasProgress__value'); - valueSvg.setAttribute('stroke', valueColor); - valueSvg.setAttribute('stroke-width', `${valueWeight}px`); - - const length = valueSvg.getTotalLength(); - const to = length * (1 - percent); - valueSvg.setAttribute('stroke-dasharray', String(length)); - valueSvg.setAttribute('stroke-dashoffset', String(Math.max(0, to))); - - shapeSvg.appendChild(valueSvg); - - const text = shapeSvg.getElementsByTagName('text').item(0); - - if (label && text) { - text.textContent = String(label); - text.setAttribute('className', 'canvasProgress__label'); - - if (shape === 'horizontalPill') { - text.setAttribute('x', String(parseInt(text.getAttribute('x')!, 10) + offset / 2)); - } - if (shape === 'verticalPill') { - text.setAttribute('y', String(parseInt(text.getAttribute('y')!, 10) - offset / 2)); - } - - Object.assign(text.style, font.spec); - shapeSvg.appendChild(text); - domNode.appendChild(shapeSvg); - - const { width: labelWidth, height: labelHeight } = text.getBBox(); - - if (shape === 'horizontalBar' || shape === 'horizontalPill') { - text.setAttribute('x', String(parseInt(text.getAttribute('x')!, 10))); - width += labelWidth; - } - if (shape === 'verticalBar' || shape === 'verticalPill') { - if (labelWidth > width) { - minX = -labelWidth / 2; - width = labelWidth; - } - minY -= labelHeight; - height += labelHeight; - } - } - - shapeSvg.setAttribute('viewBox', [minX, minY, width, height].join(' ')); - shapeSvg.setAttribute('width', String(domNode.offsetWidth)); - shapeSvg.setAttribute('height', String(domNode.offsetHeight)); - - if (domNode.firstChild) { - domNode.removeChild(domNode.firstChild); - } - domNode.appendChild(shapeSvg); - - handlers.onResize(() => { - shapeSvg.setAttribute('width', String(domNode.offsetWidth)); - shapeSvg.setAttribute('height', String(domNode.offsetHeight)); - }); - } - - handlers.done(); - }, -}); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/gauge.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/gauge.svg deleted file mode 100644 index 1aa07d8c23d73..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/gauge.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/horizontal_bar.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/horizontal_bar.svg deleted file mode 100644 index 63e5c8a28d774..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/horizontal_bar.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/horizontal_pill.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/horizontal_pill.svg deleted file mode 100644 index 1dcb9e3816e6e..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/horizontal_pill.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.ts deleted file mode 100644 index 7ccc615dff252..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/index.ts +++ /dev/null @@ -1,26 +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 gauge from '!!raw-loader!./gauge.svg'; -import horizontalBar from '!!raw-loader!./horizontal_bar.svg'; -import horizontalPill from '!!raw-loader!./horizontal_pill.svg'; -import semicircle from '!!raw-loader!./semicircle.svg'; -import unicorn from '!!raw-loader!./unicorn.svg'; -import verticalBar from '!!raw-loader!./vertical_bar.svg'; -import verticalPill from '!!raw-loader!./vertical_pill.svg'; -import wheel from '!!raw-loader!./wheel.svg'; - -export const shapes = { - gauge, - horizontalBar, - horizontalPill, - semicircle, - unicorn, - verticalBar, - verticalPill, - wheel, -}; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/semicircle.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/semicircle.svg deleted file mode 100644 index 5538275825da7..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/semicircle.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/unicorn.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/unicorn.svg deleted file mode 100644 index a6b2a91f3b5a0..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/unicorn.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/vertical_bar.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/vertical_bar.svg deleted file mode 100644 index 9d9b20aa5198c..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/vertical_bar.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/vertical_pill.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/vertical_pill.svg deleted file mode 100644 index f87b8a06f2ddf..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/vertical_pill.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/wheel.svg b/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/wheel.svg deleted file mode 100644 index 9d1f9ac0c2628..0000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/progress/shapes/wheel.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/axis_config/__stories__/__snapshots__/extended_template.stories.storyshot b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/axis_config/__stories__/__snapshots__/extended_template.stories.storyshot index c2f9d88724609..f7c50907424fd 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/axis_config/__stories__/__snapshots__/extended_template.stories.storyshot +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/axis_config/__stories__/__snapshots__/extended_template.stories.storyshot @@ -169,6 +169,7 @@ exports[`Storyshots arguments/AxisConfig/components extended disabled 1`] = ` >

    Switch on to view axis settings diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts index 90f5da78f79b2..7c7d573bcd76c 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/number_format/index.ts @@ -11,7 +11,7 @@ import { templateFromReactComponent } from '../../../../public/lib/template_from import { ArgumentFactory } from '../../../../types/arguments'; import { ArgumentStrings } from '../../../../i18n'; import { SetupInitializer } from '../../../plugin'; -import { UI_SETTINGS } from '../../../../../../../src/plugins/data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../../src/plugins/field_formats/common'; const { NumberFormat: strings } = ArgumentStrings; @@ -20,11 +20,11 @@ export const numberFormatInitializer: SetupInitializer { const formatMap = { - NUMBER: core.uiSettings.get(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN), - PERCENT: core.uiSettings.get(UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN), - CURRENCY: core.uiSettings.get(UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN), + NUMBER: core.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN), + PERCENT: core.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_PERCENT_DEFAULT_PATTERN), + CURRENCY: core.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_CURRENCY_DEFAULT_PATTERN), DURATION: '00:00:00', - BYTES: core.uiSettings.get(UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN), + BYTES: core.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN), }; const numberFormats = [ diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts index 501c3fb464c90..775588226aa80 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/views/metric.ts @@ -8,7 +8,7 @@ import { openSans } from '../../../common/lib/fonts'; import { ViewStrings } from '../../../i18n'; import { SetupInitializer } from '../../plugin'; -import { UI_SETTINGS } from '../../../../../../src/plugins/data/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../src/plugins/field_formats/common'; const { Metric: strings } = ViewStrings; @@ -24,7 +24,7 @@ export const metricInitializer: SetupInitializer = (core, plugin) => { displayName: strings.getMetricFormatDisplayName(), help: strings.getMetricFormatHelp(), argType: 'numberFormat', - default: `"${core.uiSettings.get(UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN)}"`, + default: `"${core.uiSettings.get(FORMATS_UI_SETTINGS.FORMAT_NUMBER_DEFAULT_PATTERN)}"`, }, { name: '_', diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/views/progress.js b/x-pack/plugins/canvas/canvas_plugin_src/uis/views/progress.js index 9246f79e39287..340b770db1e6a 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/views/progress.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/views/progress.js @@ -6,7 +6,7 @@ */ import { openSans } from '../../../common/lib/fonts'; -import { shapes } from '../../renderers/progress/shapes'; +import { getAvailableProgressShapes } from '../../../../../../src/plugins/expression_shape/common'; import { ViewStrings } from '../../../i18n'; const { Progress: strings } = ViewStrings; @@ -23,7 +23,7 @@ export const progress = () => ({ help: strings.getShapeHelp(), argType: 'select', options: { - choices: Object.keys(shapes).map((key) => ({ + choices: getAvailableProgressShapes().map((key) => ({ value: key, //turns camel into title case name: key[0].toUpperCase() + key.slice(1).replace(/([A-Z])/g, ' $1'), diff --git a/x-pack/plugins/canvas/i18n/functions/dict/progress.ts b/x-pack/plugins/canvas/i18n/functions/dict/progress.ts deleted file mode 100644 index f644431774cc6..0000000000000 --- a/x-pack/plugins/canvas/i18n/functions/dict/progress.ts +++ /dev/null @@ -1,88 +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 { progress } from '../../../canvas_plugin_src/functions/common/progress'; -import { FunctionHelp } from '../function_help'; -import { FunctionFactory } from '../../../types'; - -import { Shape } from '../../../canvas_plugin_src/functions/common/progress'; -import { CSS, FONT_FAMILY, FONT_WEIGHT, BOOLEAN_TRUE, BOOLEAN_FALSE } from '../../constants'; - -export const help: FunctionHelp> = { - help: i18n.translate('xpack.canvas.functions.progressHelpText', { - defaultMessage: 'Configures a progress element.', - }), - args: { - barColor: i18n.translate('xpack.canvas.functions.progress.args.barColorHelpText', { - defaultMessage: 'The color of the background bar.', - }), - barWeight: i18n.translate('xpack.canvas.functions.progress.args.barWeightHelpText', { - defaultMessage: 'The thickness of the background bar.', - }), - font: i18n.translate('xpack.canvas.functions.progress.args.fontHelpText', { - defaultMessage: - 'The {CSS} font properties for the label. For example, {FONT_FAMILY} or {FONT_WEIGHT}.', - values: { - CSS, - FONT_FAMILY, - FONT_WEIGHT, - }, - }), - label: i18n.translate('xpack.canvas.functions.progress.args.labelHelpText', { - defaultMessage: - 'To show or hide the label, use {BOOLEAN_TRUE} or {BOOLEAN_FALSE}. Alternatively, provide a string to display as a label.', - values: { - BOOLEAN_TRUE, - BOOLEAN_FALSE, - }, - }), - max: i18n.translate('xpack.canvas.functions.progress.args.maxHelpText', { - defaultMessage: 'The maximum value of the progress element.', - }), - shape: i18n.translate('xpack.canvas.functions.progress.args.shapeHelpText', { - defaultMessage: `Select {list}, or {end}.`, - values: { - list: Object.values(Shape) - .slice(0, -1) - .map((shape) => `\`"${shape}"\``) - .join(', '), - end: `\`"${Object.values(Shape).slice(-1)[0]}"\``, - }, - }), - valueColor: i18n.translate('xpack.canvas.functions.progress.args.valueColorHelpText', { - defaultMessage: 'The color of the progress bar.', - }), - valueWeight: i18n.translate('xpack.canvas.functions.progress.args.valueWeightHelpText', { - defaultMessage: 'The thickness of the progress bar.', - }), - }, -}; - -export const errors = { - invalidMaxValue: (max: number) => - new Error( - i18n.translate('xpack.canvas.functions.progress.invalidMaxValueErrorMessage', { - defaultMessage: "Invalid {arg} value: '{max, number}'. '{arg}' must be greater than 0", - values: { - arg: 'max', - max, - }, - }) - ), - invalidValue: (value: number, max: number = 1) => - new Error( - i18n.translate('xpack.canvas.functions.progress.invalidValueErrorMessage', { - defaultMessage: - "Invalid value: '{value, number}'. Value must be between 0 and {max, number}", - values: { - value, - max, - }, - }) - ), -}; diff --git a/x-pack/plugins/canvas/i18n/functions/function_errors.ts b/x-pack/plugins/canvas/i18n/functions/function_errors.ts index 1e515ece63569..1502a0fda5fdc 100644 --- a/x-pack/plugins/canvas/i18n/functions/function_errors.ts +++ b/x-pack/plugins/canvas/i18n/functions/function_errors.ts @@ -17,7 +17,6 @@ import { errors as getCell } from './dict/get_cell'; import { errors as joinRows } from './dict/join_rows'; import { errors as ply } from './dict/ply'; import { errors as pointseries } from './dict/pointseries'; -import { errors as progress } from './dict/progress'; import { errors as timefilter } from './dict/timefilter'; import { errors as to } from './dict/to'; @@ -34,7 +33,6 @@ export const getFunctionErrors = () => ({ joinRows, ply, pointseries, - progress, timefilter, to, }); diff --git a/x-pack/plugins/canvas/i18n/functions/function_help.ts b/x-pack/plugins/canvas/i18n/functions/function_help.ts index 08acecad37796..5eae785fefa2e 100644 --- a/x-pack/plugins/canvas/i18n/functions/function_help.ts +++ b/x-pack/plugins/canvas/i18n/functions/function_help.ts @@ -51,7 +51,6 @@ import { help as pie } from './dict/pie'; import { help as plot } from './dict/plot'; import { help as ply } from './dict/ply'; import { help as pointseries } from './dict/pointseries'; -import { help as progress } from './dict/progress'; import { help as render } from './dict/render'; import { help as replace } from './dict/replace'; import { help as rounddate } from './dict/rounddate'; @@ -207,7 +206,6 @@ export const getFunctionHelp = (): FunctionHelpDict => ({ plot, ply, pointseries, - progress, render, replace, rounddate, diff --git a/x-pack/plugins/canvas/i18n/renderers.ts b/x-pack/plugins/canvas/i18n/renderers.ts index 03e0ab3a19ae3..3cf2f99051c81 100644 --- a/x-pack/plugins/canvas/i18n/renderers.ts +++ b/x-pack/plugins/canvas/i18n/renderers.ts @@ -89,16 +89,6 @@ export const RendererStrings = { defaultMessage: 'Render an XY plot from your data', }), }, - progress: { - getDisplayName: () => - i18n.translate('xpack.canvas.renderer.progress.displayName', { - defaultMessage: 'Progress indicator', - }), - getHelpDescription: () => - i18n.translate('xpack.canvas.renderer.progress.helpDescription', { - defaultMessage: 'Render a progress indicator that reveals a percentage of an element', - }), - }, table: { getDisplayName: () => i18n.translate('xpack.canvas.renderer.table.displayName', { diff --git a/x-pack/plugins/canvas/kibana.json b/x-pack/plugins/canvas/kibana.json index 263284564de80..c465176e7ed01 100644 --- a/x-pack/plugins/canvas/kibana.json +++ b/x-pack/plugins/canvas/kibana.json @@ -36,6 +36,7 @@ "lens", "maps", "savedObjects", - "visualizations" + "visualizations", + "fieldFormats" ] } diff --git a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot index 138f8a2af68f0..19b44540943b3 100644 --- a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset.stories.storyshot @@ -43,6 +43,7 @@ exports[`Storyshots components/Assets/Asset airplane 1`] = `
    ( @@ -229,6 +230,7 @@ exports[`Storyshots components/Assets/Asset marker 1`] = `
    ( diff --git a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot index d567d3cf85f13..05ef9df1c8601 100644 --- a/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/asset_manager/__stories__/__snapshots__/asset_manager.stories.storyshot @@ -95,6 +95,7 @@ exports[`Storyshots components/Assets/AssetManager no assets 1`] = ` >

    Below are the image assets in this workpad. Any assets that are currently in use cannot be determined at this time. To reclaim space, delete assets. @@ -278,6 +279,7 @@ exports[`Storyshots components/Assets/AssetManager two assets 1`] = ` >

    Below are the image assets in this workpad. Any assets that are currently in use cannot be determined at this time. To reclaim space, delete assets. @@ -325,6 +327,7 @@ exports[`Storyshots components/Assets/AssetManager two assets 1`] = `
    ( @@ -500,6 +503,7 @@ exports[`Storyshots components/Assets/AssetManager two assets 1`] = `
    ( diff --git a/x-pack/plugins/canvas/public/components/asset_manager/asset_manager.ts b/x-pack/plugins/canvas/public/components/asset_manager/asset_manager.ts index e3824798d1df1..6c658f728e73c 100644 --- a/x-pack/plugins/canvas/public/components/asset_manager/asset_manager.ts +++ b/x-pack/plugins/canvas/public/components/asset_manager/asset_manager.ts @@ -8,12 +8,11 @@ import { Dispatch } from 'redux'; import { connect } from 'react-redux'; import { get } from 'lodash'; - -import { getId } from '../../lib/get_id'; // @ts-expect-error untyped local import { findExistingAsset } from '../../lib/find_existing_asset'; import { VALID_IMAGE_TYPES } from '../../../common/lib/constants'; import { encode } from '../../../../../../src/plugins/presentation_util/public'; +import { getId } from '../../lib/get_id'; // @ts-expect-error untyped local import { elementsRegistry } from '../../lib/elements_registry'; // @ts-expect-error untyped local diff --git a/x-pack/plugins/canvas/public/components/datasource/__stories__/__snapshots__/datasource_component.stories.storyshot b/x-pack/plugins/canvas/public/components/datasource/__stories__/__snapshots__/datasource_component.stories.storyshot index 836047959caee..6e665f48b3e9a 100644 --- a/x-pack/plugins/canvas/public/components/datasource/__stories__/__snapshots__/datasource_component.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/datasource/__stories__/__snapshots__/datasource_component.stories.storyshot @@ -41,6 +41,7 @@ exports[`Storyshots components/datasource/DatasourceComponent datasource with ex >

    The datasource has an argument controlled by an expression. Use the expression editor to modify the datasource. diff --git a/x-pack/plugins/canvas/public/components/home/hooks/use_upload_workpad.ts b/x-pack/plugins/canvas/public/components/home/hooks/use_upload_workpad.ts index 5c01ce631f5a7..caec30e083d40 100644 --- a/x-pack/plugins/canvas/public/components/home/hooks/use_upload_workpad.ts +++ b/x-pack/plugins/canvas/public/components/home/hooks/use_upload_workpad.ts @@ -12,6 +12,7 @@ import { i18n } from '@kbn/i18n'; import { CANVAS, JSON as JSONString } from '../../../../i18n/constants'; import { useNotifyService } from '../../../services'; import { getId } from '../../../lib/get_id'; + import { useCreateWorkpad } from './use_create_workpad'; import type { CanvasWorkpad } from '../../../../types'; diff --git a/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/empty_prompt.stories.storyshot b/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/empty_prompt.stories.storyshot index c6468cf5a6f0a..6d782713d8fc1 100644 --- a/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/empty_prompt.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/empty_prompt.stories.storyshot @@ -34,6 +34,7 @@ exports[`Storyshots Home/Components/Empty Prompt Empty Prompt 1`] = `

    = ({ shape }) => { const [shapeData, setShapeData] = useState(getDefaultShapeData()); const shapeRef = useCallback>((node) => { - if (node !== null) setShapeData(node.getData()); + if (node !== null) { + setShapeData(node.getData()); + } }, []); if (!shape) return
    ; diff --git a/x-pack/plugins/canvas/public/components/tool_tip_shortcut/__stories__/__snapshots__/tool_tip_shortcut.stories.storyshot b/x-pack/plugins/canvas/public/components/tool_tip_shortcut/__stories__/__snapshots__/tool_tip_shortcut.stories.storyshot index aee1e2148e8c4..ca958a1042b46 100644 --- a/x-pack/plugins/canvas/public/components/tool_tip_shortcut/__stories__/__snapshots__/tool_tip_shortcut.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/tool_tip_shortcut/__stories__/__snapshots__/tool_tip_shortcut.stories.storyshot @@ -18,6 +18,7 @@ exports[`Storyshots components/ToolTipShortcut with alt 1`] = ` >
    ⌥ + P
    @@ -44,6 +45,7 @@ exports[`Storyshots components/ToolTipShortcut with cmd 1`] = ` >
    ⌘ + D
    @@ -70,6 +72,7 @@ exports[`Storyshots components/ToolTipShortcut with down arrow 1`] = ` >
    ⌘ + SHIFT + ↓
    @@ -96,6 +99,7 @@ exports[`Storyshots components/ToolTipShortcut with left arrow 1`] = ` >
    @@ -122,6 +126,7 @@ exports[`Storyshots components/ToolTipShortcut with right arrow 1`] = ` >
    @@ -148,6 +153,7 @@ exports[`Storyshots components/ToolTipShortcut with shortcut 1`] = ` >
    G
    @@ -174,6 +180,7 @@ exports[`Storyshots components/ToolTipShortcut with up arrow 1`] = ` >
    ⌘ + SHIFT + ↑
    diff --git a/x-pack/plugins/canvas/public/components/var_config/__stories__/__snapshots__/delete_var.stories.storyshot b/x-pack/plugins/canvas/public/components/var_config/__stories__/__snapshots__/delete_var.stories.storyshot index a83682140693d..f5351b0d8ea5f 100644 --- a/x-pack/plugins/canvas/public/components/var_config/__stories__/__snapshots__/delete_var.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/var_config/__stories__/__snapshots__/delete_var.stories.storyshot @@ -46,6 +46,7 @@ Array [ >
    Deleting this variable may adversely affect the workpad. Are you sure you wish to continue?
    diff --git a/x-pack/plugins/canvas/public/components/workpad_header/element_menu/element_menu.component.tsx b/x-pack/plugins/canvas/public/components/workpad_header/element_menu/element_menu.component.tsx index 2907e8c4d5dd7..937912570b77f 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/element_menu/element_menu.component.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_header/element_menu/element_menu.component.tsx @@ -15,11 +15,11 @@ import { EuiContextMenuPanelItemDescriptor, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { getId } from '../../../lib/get_id'; import { Popover, ClosePopoverFn } from '../../popover'; import { CONTEXT_MENU_TOP_BORDER_CLASSNAME } from '../../../../common/lib'; import { ElementSpec } from '../../../../types'; import { flattenPanelTree } from '../../../lib/flatten_panel_tree'; -import { getId } from '../../../lib/get_id'; import { AssetManager } from '../../asset_manager'; import { SavedElementsModal } from '../../saved_elements_modal'; diff --git a/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js b/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js index e42578211d863..f620de03bea4c 100644 --- a/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js +++ b/x-pack/plugins/canvas/public/lib/aeroelastic/layout_functions.js @@ -5,6 +5,8 @@ * 2.0. */ +import { getId as rawGetId } from '../get_id'; + import { insideAABB, landmarkPoint, shapesAt } from './geometry'; import { @@ -40,8 +42,6 @@ import { removeDuplicates, } from './functional'; -import { getId as rawGetId } from './../../lib/get_id'; - const idMap = {}; const getId = (name, extension) => { // ensures that `axisAlignedBoundingBoxShape` is pure-ish - a new call with the same input will not yield a new id diff --git a/x-pack/plugins/canvas/public/services/storybook/workpad.ts b/x-pack/plugins/canvas/public/services/storybook/workpad.ts index cdf4137e1d84c..3ecac4b49310e 100644 --- a/x-pack/plugins/canvas/public/services/storybook/workpad.ts +++ b/x-pack/plugins/canvas/public/services/storybook/workpad.ts @@ -9,7 +9,6 @@ import moment from 'moment'; import { action } from '@storybook/addon-actions'; import { PluginServiceFactory } from '../../../../../../src/plugins/presentation_util/public'; - import { getId } from '../../lib/get_id'; // @ts-expect-error import { getDefaultWorkpad } from '../../state/defaults'; diff --git a/x-pack/plugins/canvas/shareable_runtime/components/__stories__/__snapshots__/canvas.stories.storyshot b/x-pack/plugins/canvas/shareable_runtime/components/__stories__/__snapshots__/canvas.stories.storyshot index d23371d0c3499..c5b6d768c89d8 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/__stories__/__snapshots__/canvas.stories.storyshot +++ b/x-pack/plugins/canvas/shareable_runtime/components/__stories__/__snapshots__/canvas.stories.storyshot @@ -1344,6 +1344,7 @@ exports[`Storyshots shareables/Canvas component 1`] = ` >
    Page 1 @@ -2826,6 +2828,7 @@ exports[`Storyshots shareables/Canvas contextual: austin 1`] = ` >
    Page 1 @@ -3124,6 +3128,7 @@ exports[`Storyshots shareables/Canvas contextual: hello 1`] = ` >
    Page 1 diff --git a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot index 57af8bcb4fecf..3f89e485e1ba0 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot +++ b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/footer.stories.storyshot @@ -1297,6 +1297,7 @@ exports[`Storyshots shareables/Footer contextual: austin 1`] = ` >
    Page 1 @@ -1549,6 +1551,7 @@ exports[`Storyshots shareables/Footer contextual: hello 1`] = ` >
    Page 1 diff --git a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/page_controls.stories.storyshot b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/page_controls.stories.storyshot index 81b0ee9cca832..791e1bd9081af 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/page_controls.stories.storyshot +++ b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/page_controls.stories.storyshot @@ -58,6 +58,7 @@ exports[`Storyshots shareables/Footer/PageControls component 1`] = ` >
    Page 1 @@ -155,6 +156,7 @@ exports[`Storyshots shareables/Footer/PageControls contextual: austin 1`] = ` >
    Page 1 @@ -252,6 +254,7 @@ exports[`Storyshots shareables/Footer/PageControls contextual: hello 1`] = ` >
    Page 1 diff --git a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/title.stories.storyshot b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/title.stories.storyshot index 7d27ac836e130..2b326fd0ec51a 100644 --- a/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/title.stories.storyshot +++ b/x-pack/plugins/canvas/shareable_runtime/components/footer/__stories__/__snapshots__/title.stories.storyshot @@ -51,6 +51,7 @@ exports[`Storyshots shareables/Footer/Title component 1`] = ` >
    ; export type ExternalServiceResponse = rt.TypeOf; -export type ESCaseAttributes = Omit & { connector: ESCaseConnector }; -export type ESCasePatchRequest = Omit & { - connector?: ESCaseConnector; -}; - export type AllTagsFindRequest = rt.TypeOf; export type AllReportersFindRequest = AllTagsFindRequest; diff --git a/x-pack/plugins/cases/common/api/cases/configure.ts b/x-pack/plugins/cases/common/api/cases/configure.ts index 6c92702c523b4..bf67624df8508 100644 --- a/x-pack/plugins/cases/common/api/cases/configure.ts +++ b/x-pack/plugins/cases/common/api/cases/configure.ts @@ -8,7 +8,7 @@ import * as rt from 'io-ts'; import { UserRT } from '../user'; -import { CaseConnectorRt, ConnectorMappingsRt, ESCaseConnector } from '../connectors'; +import { CaseConnectorRt, ConnectorMappingsRt } from '../connectors'; // TODO: we will need to add this type rt.literal('close-by-third-party') const ClosureTypeRT = rt.union([rt.literal('close-by-user'), rt.literal('close-by-pushing')]); @@ -83,8 +83,4 @@ export type CasesConfigureAttributes = rt.TypeOf; export type CasesConfigurationsResponse = rt.TypeOf; -export type ESCasesConfigureAttributes = Omit & { - connector: ESCaseConnector; -}; - export type GetConfigureFindRequest = rt.TypeOf; diff --git a/x-pack/plugins/cases/common/api/connectors/index.ts b/x-pack/plugins/cases/common/api/connectors/index.ts index cee432b17933b..77af90b5d08cb 100644 --- a/x-pack/plugins/cases/common/api/connectors/index.ts +++ b/x-pack/plugins/cases/common/api/connectors/index.ts @@ -73,6 +73,8 @@ const ConnectorNoneTypeFieldsRt = rt.type({ fields: rt.null, }); +export const noneConnectorId: string = 'none'; + export const ConnectorTypeFieldsRt = rt.union([ ConnectorJiraTypeFieldsRt, ConnectorNoneTypeFieldsRt, @@ -102,16 +104,3 @@ export type ConnectorServiceNowSIRTypeFields = rt.TypeOf; - -export type ESConnectorFields = Array<{ - key: string; - value: unknown; -}>; - -export type ESCaseConnectorTypes = ConnectorTypes; -export interface ESCaseConnector { - id: string; - name: string; - type: ESCaseConnectorTypes; - fields: ESConnectorFields | null; -} diff --git a/x-pack/plugins/cases/kibana.json b/x-pack/plugins/cases/kibana.json index 6439f28b958d0..f72f0e012bd80 100644 --- a/x-pack/plugins/cases/kibana.json +++ b/x-pack/plugins/cases/kibana.json @@ -1,7 +1,7 @@ { "configPath":[ - "cases", - "xpack" + "xpack", + "cases" ], "description":"The Case management system in Kibana", "extraPublicDirs":[ diff --git a/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.test.tsx b/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.test.tsx index 47c683becb244..0e548fd53c89d 100644 --- a/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.test.tsx @@ -7,20 +7,27 @@ import React from 'react'; import { mount } from 'enzyme'; -import { AllCasesGeneric } from './all_cases_generic'; +import { act } from 'react-dom/test-utils'; +import { AllCasesGeneric } from './all_cases_generic'; import { TestProviders } from '../../common/mock'; import { useGetTags } from '../../containers/use_get_tags'; import { useGetReporters } from '../../containers/use_get_reporters'; import { useGetActionLicense } from '../../containers/use_get_action_license'; +import { useConnectors } from '../../containers/configure/use_connectors'; +import { useKibana } from '../../common/lib/kibana'; import { StatusAll } from '../../containers/types'; import { CaseStatuses, SECURITY_SOLUTION_OWNER } from '../../../common'; -import { act } from 'react-dom/test-utils'; +import { connectorsMock } from '../../containers/mock'; +import { actionTypeRegistryMock } from '../../../../triggers_actions_ui/public/application/action_type_registry.mock'; +import { triggersActionsUiMock } from '../../../../triggers_actions_ui/public/mocks'; jest.mock('../../containers/use_get_reporters'); jest.mock('../../containers/use_get_tags'); jest.mock('../../containers/use_get_action_license'); +jest.mock('../../containers/configure/use_connectors'); jest.mock('../../containers/api'); +jest.mock('../../common/lib/kibana'); const createCaseNavigation = { href: '', onClick: jest.fn() }; @@ -34,26 +41,34 @@ const alertDataMock = { alertId: 'alert-id', owner: SECURITY_SOLUTION_OWNER, }; + +const useKibanaMock = useKibana as jest.Mocked; +const useConnectorsMock = useConnectors as jest.Mock; +const mockTriggersActionsUiService = triggersActionsUiMock.createStart(); + jest.mock('../../common/lib/kibana', () => { const originalModule = jest.requireActual('../../common/lib/kibana'); return { ...originalModule, useKibana: () => ({ services: { - triggersActionsUi: { - actionTypeRegistry: { - get: jest.fn().mockReturnValue({ - actionTypeTitle: '.jira', - iconClass: 'logoSecurity', - }), - }, - }, + triggersActionsUi: mockTriggersActionsUiService, }, }), }; }); describe('AllCasesGeneric ', () => { + const { createMockActionTypeModel } = actionTypeRegistryMock; + + beforeAll(() => { + connectorsMock.forEach((connector) => + useKibanaMock().services.triggersActionsUi.actionTypeRegistry.register( + createMockActionTypeModel({ id: connector.actionTypeId, iconClass: 'logoSecurity' }) + ) + ); + }); + beforeEach(() => { jest.resetAllMocks(); (useGetTags as jest.Mock).mockReturnValue({ tags: ['coke', 'pepsi'], fetchTags: jest.fn() }); @@ -68,6 +83,7 @@ describe('AllCasesGeneric ', () => { actionLicense: null, isLoading: false, }); + useConnectorsMock.mockImplementation(() => ({ connectors: connectorsMock, loading: false })); }); it('renders the first available status when hiddenStatus is given', () => 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 477ea27be99bf..72491a2bc1e31 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 @@ -37,6 +37,7 @@ import { CasesTableFilters } from './table_filters'; import { EuiBasicTableOnChange } from './types'; import { CasesTable } from './table'; +import { useConnectors } from '../../containers/configure/use_connectors'; const ProgressLoader = styled(EuiProgress)` ${({ $isShow }: { $isShow: boolean }) => @@ -103,6 +104,7 @@ export const AllCasesGeneric = React.memo( // Post Comment to Case const { postComment, isLoading: isCommentUpdating } = usePostComment(); + const { connectors } = useConnectors({ toastPermissionsErrors: false }); const sorting = useMemo( () => ({ @@ -203,6 +205,7 @@ export const AllCasesGeneric = React.memo( refreshCases, showActions, userCanCrud, + connectors, }); const itemIdToExpandedRowMap = useMemo( diff --git a/x-pack/plugins/cases/public/components/all_cases/columns.test.tsx b/x-pack/plugins/cases/public/components/all_cases/columns.test.tsx index 0f0189f2d29c2..015ba877a2749 100644 --- a/x-pack/plugins/cases/public/components/all_cases/columns.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/columns.test.tsx @@ -10,51 +10,69 @@ import { mount } from 'enzyme'; import '../../common/mock/match_media'; import { ExternalServiceColumn } from './columns'; - import { useGetCasesMockState } from '../../containers/mock'; +import { useKibana } from '../../common/lib/kibana'; +import { actionTypeRegistryMock } from '../../../../triggers_actions_ui/public/application/action_type_registry.mock'; +import { connectors } from '../configure_cases/__mock__'; -jest.mock('../../common/lib/kibana', () => { - const originalModule = jest.requireActual('../../common/lib/kibana'); - return { - ...originalModule, - useKibana: () => ({ - services: { - triggersActionsUi: { - actionTypeRegistry: { - get: jest.fn().mockReturnValue({ - actionTypeTitle: '.jira', - iconClass: 'logoSecurity', - }), - }, - }, - }, - }), - }; -}); +jest.mock('../../common/lib/kibana'); +const useKibanaMock = useKibana as jest.Mocked; describe('ExternalServiceColumn ', () => { + const { createMockActionTypeModel } = actionTypeRegistryMock; + + beforeAll(() => { + connectors.forEach((connector) => + useKibanaMock().services.triggersActionsUi.actionTypeRegistry.register( + createMockActionTypeModel({ id: connector.actionTypeId, iconClass: 'logoSecurity' }) + ) + ); + }); + it('Not pushed render', () => { const wrapper = mount( - + ); expect( wrapper.find(`[data-test-subj="case-table-column-external-notPushed"]`).last().exists() ).toBeTruthy(); }); + it('Up to date', () => { const wrapper = mount( - + ); expect( wrapper.find(`[data-test-subj="case-table-column-external-upToDate"]`).last().exists() ).toBeTruthy(); }); + it('Needs update', () => { const wrapper = mount( - + ); expect( wrapper.find(`[data-test-subj="case-table-column-external-requiresUpdate"]`).last().exists() ).toBeTruthy(); }); + + it('it does not throw when accessing the icon if the connector type is not registered', () => { + // If the component throws the test will fail + expect(() => + mount( + + ) + ).not.toThrowError(); + }); }); 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 140dbf2f53c25..8b755b0c60968 100644 --- a/x-pack/plugins/cases/public/components/all_cases/columns.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/columns.tsx @@ -21,7 +21,14 @@ import { import { RIGHT_ALIGNMENT } from '@elastic/eui/lib/services'; import styled from 'styled-components'; -import { CaseStatuses, CaseType, DeleteCase, Case, SubCase } from '../../../common'; +import { + CaseStatuses, + CaseType, + DeleteCase, + Case, + SubCase, + ActionConnector, +} from '../../../common'; import { getEmptyTagValue } from '../empty_value'; import { FormattedRelativePreferenceDate } from '../formatted_date'; import { CaseDetailsHrefSchema, CaseDetailsLink, CasesNavigation } from '../links'; @@ -35,6 +42,7 @@ import { ConfirmDeleteCaseModal } from '../confirm_delete_case'; import { useKibana } from '../../common/lib/kibana'; import { StatusContextMenu } from '../case_action_bar/status_context_menu'; import { TruncatedText } from '../truncated_text'; +import { getConnectorIcon } from '../utils'; export type CasesColumns = | EuiTableActionsColumnType @@ -66,6 +74,7 @@ export interface GetCasesColumn { refreshCases?: (a?: boolean) => void; showActions: boolean; userCanCrud: boolean; + connectors?: ActionConnector[]; } export const useCasesColumns = ({ caseDetailsNavigation, @@ -77,6 +86,7 @@ export const useCasesColumns = ({ refreshCases, showActions, userCanCrud, + connectors = [], }: GetCasesColumn): CasesColumns[] => { // Delete case const { @@ -266,7 +276,7 @@ export const useCasesColumns = ({ name: i18n.EXTERNAL_INCIDENT, render: (theCase: Case) => { if (theCase.id != null) { - return ; + return ; } return getEmptyTagValue(); }, @@ -325,6 +335,7 @@ export const useCasesColumns = ({ interface Props { theCase: Case; + connectors: ActionConnector[]; } const IconWrapper = styled.span` @@ -335,26 +346,31 @@ const IconWrapper = styled.span` width: 20px !important; } `; -export const ExternalServiceColumn: React.FC = ({ theCase }) => { + +export const ExternalServiceColumn: React.FC = ({ theCase, connectors }) => { const { triggersActionsUi } = useKibana().services; if (theCase.externalService == null) { return renderStringField(i18n.NOT_PUSHED, `case-table-column-external-notPushed`); } + const lastPushedConnector: ActionConnector | undefined = connectors.find( + (connector) => connector.id === theCase.externalService?.connectorId + ); const lastCaseUpdate = theCase.updatedAt != null ? new Date(theCase.updatedAt) : null; const lastCasePush = theCase.externalService?.pushedAt != null ? new Date(theCase.externalService?.pushedAt) : null; const hasDataToPush = lastCasePush === null || (lastCaseUpdate != null && lastCasePush.getTime() < lastCaseUpdate?.getTime()); + return (

    ; +const useConnectorsMock = useConnectors as jest.Mock; + +const mockTriggersActionsUiService = triggersActionsUiMock.createStart(); jest.mock('../../common/lib/kibana', () => { const originalModule = jest.requireActual('../../common/lib/kibana'); @@ -42,14 +58,7 @@ jest.mock('../../common/lib/kibana', () => { ...originalModule, useKibana: () => ({ services: { - triggersActionsUi: { - actionTypeRegistry: { - get: jest.fn().mockReturnValue({ - actionTypeTitle: '.jira', - iconClass: 'logoSecurity', - }), - }, - }, + triggersActionsUi: mockTriggersActionsUiService, }, }), }; @@ -139,6 +148,16 @@ describe('AllCasesGeneric', () => { userCanCrud: true, }; + const { createMockActionTypeModel } = actionTypeRegistryMock; + + beforeAll(() => { + connectorsMock.forEach((connector) => + useKibanaMock().services.triggersActionsUi.actionTypeRegistry.register( + createMockActionTypeModel({ id: connector.actionTypeId, iconClass: 'logoSecurity' }) + ) + ); + }); + beforeEach(() => { jest.clearAllMocks(); useUpdateCasesMock.mockReturnValue(defaultUpdateCases); @@ -146,6 +165,7 @@ describe('AllCasesGeneric', () => { useDeleteCasesMock.mockReturnValue(defaultDeleteCases); useGetCasesStatusMock.mockReturnValue(defaultCasesStatus); useGetActionLicenseMock.mockReturnValue(defaultActionLicense); + useConnectorsMock.mockImplementation(() => ({ connectors: connectorsMock, loading: false })); moment.tz.setDefault('UTC'); }); diff --git a/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.test.tsx b/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.test.tsx index 141be31a093f1..8eae574776e2e 100644 --- a/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.test.tsx +++ b/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.test.tsx @@ -13,6 +13,7 @@ import { ConnectorsDropdown, Props } from './connectors_dropdown'; import { TestProviders } from '../../common/mock'; import { connectors } from './__mock__'; import { useKibana } from '../../common/lib/kibana'; +import { actionTypeRegistryMock } from '../../../../triggers_actions_ui/public/application/action_type_registry.mock'; jest.mock('../../common/lib/kibana'); const useKibanaMock = useKibana as jest.Mocked; @@ -27,11 +28,14 @@ describe('ConnectorsDropdown', () => { selectedConnector: 'none', }; + const { createMockActionTypeModel } = actionTypeRegistryMock; + beforeAll(() => { - useKibanaMock().services.triggersActionsUi.actionTypeRegistry.get = jest.fn().mockReturnValue({ - actionTypeTitle: '.servicenow', - iconClass: 'logoSecurity', - }); + connectors.forEach((connector) => + useKibanaMock().services.triggersActionsUi.actionTypeRegistry.register( + createMockActionTypeModel({ id: connector.actionTypeId, iconClass: 'logoSecurity' }) + ) + ); wrapper = mount(, { wrappingComponent: TestProviders }); }); @@ -219,4 +223,26 @@ describe('ConnectorsDropdown', () => { options.some((o) => o['data-test-subj'] === 'dropdown-connector-servicenow-sir') ).toBeFalsy(); }); + + test('it does not throw when accessing the icon if the connector type is not registered', () => { + expect(() => + mount( + , + { + wrappingComponent: TestProviders, + } + ) + ).not.toThrowError(); + }); }); diff --git a/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.tsx b/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.tsx index d26ec06d696fc..3cab2afd41f41 100644 --- a/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.tsx +++ b/x-pack/plugins/cases/public/components/configure_cases/connectors_dropdown.tsx @@ -13,6 +13,7 @@ import { ConnectorTypes } from '../../../common'; import { ActionConnector } from '../../containers/configure/types'; import * as i18n from './translations'; import { useKibana } from '../../common/lib/kibana'; +import { getConnectorIcon } from '../utils'; export interface Props { connectors: ActionConnector[]; @@ -81,10 +82,7 @@ const ConnectorsDropdownComponent: React.FC = ({ diff --git a/x-pack/plugins/cases/public/components/connectors/card.test.tsx b/x-pack/plugins/cases/public/components/connectors/card.test.tsx new file mode 100644 index 0000000000000..b5d70a6781916 --- /dev/null +++ b/x-pack/plugins/cases/public/components/connectors/card.test.tsx @@ -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 React from 'react'; +import { mount } from 'enzyme'; + +import { ConnectorTypes } from '../../../common'; +import { useKibana } from '../../common/lib/kibana'; +import { actionTypeRegistryMock } from '../../../../triggers_actions_ui/public/application/action_type_registry.mock'; +import { connectors } from '../configure_cases/__mock__'; +import { ConnectorCard } from './card'; + +jest.mock('../../common/lib/kibana'); +const useKibanaMock = useKibana as jest.Mocked; + +describe('ConnectorCard ', () => { + const { createMockActionTypeModel } = actionTypeRegistryMock; + + beforeAll(() => { + connectors.forEach((connector) => + useKibanaMock().services.triggersActionsUi.actionTypeRegistry.register( + createMockActionTypeModel({ id: connector.actionTypeId, iconClass: 'logoSecurity' }) + ) + ); + }); + + it('it does not throw when accessing the icon if the connector type is not registered', () => { + expect(() => + mount( + + ) + ).not.toThrowError(); + }); +}); diff --git a/x-pack/plugins/cases/public/components/connectors/card.tsx b/x-pack/plugins/cases/public/components/connectors/card.tsx index b27c7207e7b8a..86cd90dafb376 100644 --- a/x-pack/plugins/cases/public/components/connectors/card.tsx +++ b/x-pack/plugins/cases/public/components/connectors/card.tsx @@ -11,6 +11,7 @@ import styled from 'styled-components'; import { ConnectorTypes } from '../../../common'; import { useKibana } from '../../common/lib/kibana'; +import { getConnectorIcon } from '../utils'; interface ConnectorCardProps { connectorType: ConnectorTypes; @@ -47,16 +48,13 @@ const ConnectorCardDisplay: React.FC = ({ ), [listItems] ); + const icon = useMemo( - () => ( - - ), + () => , // eslint-disable-next-line react-hooks/exhaustive-deps [connectorType] ); + return ( <> {isLoading && } diff --git a/x-pack/plugins/cases/public/components/create/connector.test.tsx b/x-pack/plugins/cases/public/components/create/connector.test.tsx index bc6d5c8717ece..1b480c3f5d78a 100644 --- a/x-pack/plugins/cases/public/components/create/connector.test.tsx +++ b/x-pack/plugins/cases/public/components/create/connector.test.tsx @@ -21,20 +21,18 @@ import { schema, FormProps } from './schema'; import { TestProviders } from '../../common/mock'; import { useCaseConfigure } from '../../containers/configure/use_configure'; import { useCaseConfigureResponse } from '../configure_cases/__mock__'; +import { triggersActionsUiMock } from '../../../../triggers_actions_ui/public/mocks'; +import { actionTypeRegistryMock } from '../../../../triggers_actions_ui/public/application/action_type_registry.mock'; +import { useKibana } from '../../common/lib/kibana'; + +const mockTriggersActionsUiService = triggersActionsUiMock.createStart(); jest.mock('../../common/lib/kibana', () => ({ useKibana: () => ({ services: { notifications: {}, http: {}, - triggersActionsUi: { - actionTypeRegistry: { - get: jest.fn().mockReturnValue({ - actionTypeTitle: 'test', - iconClass: 'logoSecurity', - }), - }, - }, + triggersActionsUi: mockTriggersActionsUiService, }, }), })); @@ -48,6 +46,7 @@ const useGetIncidentTypesMock = useGetIncidentTypes as jest.Mock; const useGetSeverityMock = useGetSeverity as jest.Mock; const useGetChoicesMock = useGetChoices as jest.Mock; const useCaseConfigureMock = useCaseConfigure as jest.Mock; +const useKibanaMock = useKibana as jest.Mocked; const useGetIncidentTypesResponse = { isLoading: false, @@ -87,6 +86,16 @@ describe('Connector', () => { return

    {children}
    ; }; + const { createMockActionTypeModel } = actionTypeRegistryMock; + + beforeAll(() => { + connectorsMock.forEach((connector) => + useKibanaMock().services.triggersActionsUi.actionTypeRegistry.register( + createMockActionTypeModel({ id: connector.actionTypeId, iconClass: 'logoSecurity' }) + ) + ); + }); + beforeEach(() => { jest.resetAllMocks(); useGetIncidentTypesMock.mockReturnValue(useGetIncidentTypesResponse); diff --git a/x-pack/plugins/cases/public/components/markdown_editor/translations.ts b/x-pack/plugins/cases/public/components/markdown_editor/translations.ts index ad8c51f966172..8d366506dfe40 100644 --- a/x-pack/plugins/cases/public/components/markdown_editor/translations.ts +++ b/x-pack/plugins/cases/public/components/markdown_editor/translations.ts @@ -7,9 +7,6 @@ import { i18n } from '@kbn/i18n'; -export const MARKDOWN = i18n.translate('xpack.cases.markdownEditor.markdown', { - defaultMessage: 'Markdown', -}); export const PREVIEW = i18n.translate('xpack.cases.markdownEditor.preview', { defaultMessage: 'Preview', }); diff --git a/x-pack/plugins/cases/public/components/user_action_tree/helpers.tsx b/x-pack/plugins/cases/public/components/user_action_tree/helpers.tsx index 609183aa5c4ef..744b14926b358 100644 --- a/x-pack/plugins/cases/public/components/user_action_tree/helpers.tsx +++ b/x-pack/plugins/cases/public/components/user_action_tree/helpers.tsx @@ -157,10 +157,11 @@ export const getPushedServiceLabelTitle = (action: CaseUserActions, firstPush: b export const getPushInfo = ( caseServices: CaseServices, - parsedValue: { connector_id: string; connector_name: string }, + // a JSON parse failure will result in null for parsedValue + parsedValue: { connector_id: string | null; connector_name: string } | null, index: number ) => - parsedValue != null + parsedValue != null && parsedValue.connector_id != null ? { firstPush: caseServices[parsedValue.connector_id]?.firstPushIndex === index, parsedConnectorId: parsedValue.connector_id, diff --git a/x-pack/plugins/cases/public/components/utils.test.ts b/x-pack/plugins/cases/public/components/utils.test.ts new file mode 100644 index 0000000000000..496dc8d8c8066 --- /dev/null +++ b/x-pack/plugins/cases/public/components/utils.test.ts @@ -0,0 +1,40 @@ +/* + * 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 { actionTypeRegistryMock } from '../../../triggers_actions_ui/public/application/action_type_registry.mock'; +import { triggersActionsUiMock } from '../../../triggers_actions_ui/public/mocks'; +import { getConnectorIcon } from './utils'; + +describe('Utils', () => { + describe('getConnectorIcon', () => { + const { createMockActionTypeModel } = actionTypeRegistryMock; + const mockTriggersActionsUiService = triggersActionsUiMock.createStart(); + mockTriggersActionsUiService.actionTypeRegistry.register( + createMockActionTypeModel({ id: '.test', iconClass: 'test' }) + ); + + it('it returns the correct icon class', () => { + expect(getConnectorIcon(mockTriggersActionsUiService, '.test')).toBe('test'); + }); + + it('it returns an empty string if the type is undefined', () => { + expect(getConnectorIcon(mockTriggersActionsUiService)).toBe(''); + }); + + it('it returns an empty string if the type is not registered', () => { + expect(getConnectorIcon(mockTriggersActionsUiService, '.not-registered')).toBe(''); + }); + + it('it returns an empty string if it throws', () => { + mockTriggersActionsUiService.actionTypeRegistry.get = () => { + throw new Error(); + }; + + expect(getConnectorIcon(mockTriggersActionsUiService, '.not-registered')).toBe(''); + }); + }); +}); diff --git a/x-pack/plugins/cases/public/components/utils.ts b/x-pack/plugins/cases/public/components/utils.ts index 033529c27a2d4..5f7480cb84f7c 100644 --- a/x-pack/plugins/cases/public/components/utils.ts +++ b/x-pack/plugins/cases/public/components/utils.ts @@ -5,8 +5,10 @@ * 2.0. */ +import { IconType } from '@elastic/eui'; import { ConnectorTypes } from '../../common'; import { FieldConfig, ValidationConfig } from '../common/shared_imports'; +import { StartPlugins } from '../types'; import { connectorValidator as swimlaneConnectorValidator } from './connectors/swimlane/validator'; import { CaseActionConnector } from './types'; @@ -41,3 +43,28 @@ export const getConnectorsFormValidators = ({ }, ], }); + +export const getConnectorIcon = ( + triggersActionsUi: StartPlugins['triggersActionsUi'], + type?: string +): IconType => { + /** + * triggersActionsUi.actionTypeRegistry.get will throw an error if the type is not registered. + * This will break Kibana if not handled properly. + */ + const emptyResponse = ''; + + if (type == null) { + return emptyResponse; + } + + try { + if (triggersActionsUi.actionTypeRegistry.has(type)) { + return triggersActionsUi.actionTypeRegistry.get(type).iconClass; + } + } catch { + return emptyResponse; + } + + return emptyResponse; +}; diff --git a/x-pack/plugins/cases/server/client/cases/create.ts b/x-pack/plugins/cases/server/client/cases/create.ts index 03ea76ede5c2e..887990fef8938 100644 --- a/x-pack/plugins/cases/server/client/cases/create.ts +++ b/x-pack/plugins/cases/server/client/cases/create.ts @@ -25,15 +25,9 @@ import { MAX_TITLE_LENGTH, } from '../../../common'; import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; -import { getConnectorFromConfiguration } from '../utils'; import { Operations } from '../../authorization'; -import { - createCaseError, - flattenCaseSavedObject, - transformCaseConnectorToEsConnector, - transformNewCase, -} from '../../common'; +import { createCaseError, flattenCaseSavedObject, transformNewCase } from '../../common'; import { CasesClientArgs } from '..'; /** @@ -48,7 +42,6 @@ export const create = async ( const { unsecuredSavedObjectsClient, caseService, - caseConfigureService, userActionService, user, logger, @@ -90,10 +83,6 @@ export const create = async ( // eslint-disable-next-line @typescript-eslint/naming-convention const { username, full_name, email } = user; const createdDate = new Date().toISOString(); - const myCaseConfigure = await caseConfigureService.find({ - unsecuredSavedObjectsClient, - }); - const caseConfigureConnector = getConnectorFromConfiguration(myCaseConfigure); const newCase = await caseService.postNewCase({ unsecuredSavedObjectsClient, @@ -103,7 +92,7 @@ export const create = async ( username, full_name, email, - connector: transformCaseConnectorToEsConnector(query.connector ?? caseConfigureConnector), + connector: query.connector, }), id: savedObjectID, }); diff --git a/x-pack/plugins/cases/server/client/cases/get.ts b/x-pack/plugins/cases/server/client/cases/get.ts index 4f8713704361b..d440cecd27e9b 100644 --- a/x-pack/plugins/cases/server/client/cases/get.ts +++ b/x-pack/plugins/cases/server/client/cases/get.ts @@ -13,7 +13,6 @@ import { SavedObject } from 'kibana/server'; import { CaseResponseRt, CaseResponse, - ESCaseAttributes, User, UsersRt, AllTagsFindRequest, @@ -27,6 +26,7 @@ import { ENABLE_CASE_CONNECTOR, CasesByAlertId, CasesByAlertIdRt, + CaseAttributes, } from '../../../common'; import { countAlertsForID, createCaseError, flattenCaseSavedObject } from '../../common'; import { CasesClientArgs } from '..'; @@ -171,7 +171,7 @@ export const get = async ( ); } - let theCase: SavedObject; + let theCase: SavedObject; let subCaseIds: string[] = []; if (ENABLE_CASE_CONNECTOR) { const [caseInfo, subCasesForCaseId] = await Promise.all([ diff --git a/x-pack/plugins/cases/server/client/cases/push.ts b/x-pack/plugins/cases/server/client/cases/push.ts index 9e2066984a9da..3048cf01bb3ba 100644 --- a/x-pack/plugins/cases/server/client/cases/push.ts +++ b/x-pack/plugins/cases/server/client/cases/push.ts @@ -14,10 +14,10 @@ import { CaseResponse, CaseStatuses, ExternalServiceResponse, - ESCaseAttributes, - ESCasesConfigureAttributes, CaseType, ENABLE_CASE_CONNECTOR, + CasesConfigureAttributes, + CaseAttributes, } from '../../../common'; import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; @@ -33,8 +33,8 @@ import { casesConnectors } from '../../connectors'; * In the future we could allow push to close all the sub cases of a collection but that's not currently supported. */ function shouldCloseByPush( - configureSettings: SavedObjectsFindResponse, - caseInfo: SavedObject + configureSettings: SavedObjectsFindResponse, + caseInfo: SavedObject ): boolean { return ( configureSettings.total > 0 && @@ -186,6 +186,7 @@ export const push = async ( const [updatedCase, updatedComments] = await Promise.all([ caseService.patchCase({ + originalCase: myCase, unsecuredSavedObjectsClient, caseId, updatedAttributes: { diff --git a/x-pack/plugins/cases/server/client/cases/update.ts b/x-pack/plugins/cases/server/client/cases/update.ts index afe43171563ce..ed19444414d57 100644 --- a/x-pack/plugins/cases/server/client/cases/update.ts +++ b/x-pack/plugins/cases/server/client/cases/update.ts @@ -34,13 +34,12 @@ import { CommentAttributes, CommentType, ENABLE_CASE_CONNECTOR, - ESCaseAttributes, - ESCasePatchRequest, excess, MAX_CONCURRENT_SEARCHES, SUB_CASE_SAVED_OBJECT, throwErrors, MAX_TITLE_LENGTH, + CaseAttributes, } from '../../../common'; import { buildCaseUserActions } from '../../services/user_actions/helpers'; import { getCaseToUpdate } from '../utils'; @@ -51,7 +50,6 @@ import { createCaseError, flattenCaseSavedObject, isCommentRequestTypeAlertOrGenAlert, - transformCaseConnectorToEsConnector, } from '../../common'; import { UpdateAlertRequest } from '../alerts/types'; import { CasesClientInternal } from '../client_internal'; @@ -61,17 +59,14 @@ import { Operations, OwnerEntity } from '../../authorization'; /** * Throws an error if any of the requests attempt to update a collection style cases' status field. */ -function throwIfUpdateStatusOfCollection( - requests: ESCasePatchRequest[], - casesMap: Map> -) { +function throwIfUpdateStatusOfCollection(requests: UpdateRequestWithOriginalCase[]) { const requestsUpdatingStatusOfCollection = requests.filter( - (req) => - req.status !== undefined && casesMap.get(req.id)?.attributes.type === CaseType.collection + ({ updateReq, originalCase }) => + updateReq.status !== undefined && originalCase.attributes.type === CaseType.collection ); if (requestsUpdatingStatusOfCollection.length > 0) { - const ids = requestsUpdatingStatusOfCollection.map((req) => req.id); + const ids = requestsUpdatingStatusOfCollection.map(({ updateReq }) => updateReq.id); throw Boom.badRequest( `Updating the status of a collection is not allowed ids: [${ids.join(', ')}]` ); @@ -81,18 +76,14 @@ function throwIfUpdateStatusOfCollection( /** * Throws an error if any of the requests attempt to update a collection style case to an individual one. */ -function throwIfUpdateTypeCollectionToIndividual( - requests: ESCasePatchRequest[], - casesMap: Map> -) { +function throwIfUpdateTypeCollectionToIndividual(requests: UpdateRequestWithOriginalCase[]) { const requestsUpdatingTypeCollectionToInd = requests.filter( - (req) => - req.type === CaseType.individual && - casesMap.get(req.id)?.attributes.type === CaseType.collection + ({ updateReq, originalCase }) => + updateReq.type === CaseType.individual && originalCase.attributes.type === CaseType.collection ); if (requestsUpdatingTypeCollectionToInd.length > 0) { - const ids = requestsUpdatingTypeCollectionToInd.map((req) => req.id); + const ids = requestsUpdatingTypeCollectionToInd.map(({ updateReq }) => updateReq.id); throw Boom.badRequest( `Converting a collection to an individual case is not allowed ids: [${ids.join(', ')}]` ); @@ -102,11 +93,11 @@ function throwIfUpdateTypeCollectionToIndividual( /** * Throws an error if any of the requests attempt to update the type of a case. */ -function throwIfUpdateType(requests: ESCasePatchRequest[]) { - const requestsUpdatingType = requests.filter((req) => req.type !== undefined); +function throwIfUpdateType(requests: UpdateRequestWithOriginalCase[]) { + const requestsUpdatingType = requests.filter(({ updateReq }) => updateReq.type !== undefined); if (requestsUpdatingType.length > 0) { - const ids = requestsUpdatingType.map((req) => req.id); + const ids = requestsUpdatingType.map(({ updateReq }) => updateReq.id); throw Boom.badRequest( `Updating the type of a case when sub cases are disabled is not allowed ids: [${ids.join( ', ' @@ -118,11 +109,11 @@ function throwIfUpdateType(requests: ESCasePatchRequest[]) { /** * Throws an error if any of the requests attempt to update the owner of a case. */ -function throwIfUpdateOwner(requests: ESCasePatchRequest[]) { - const requestsUpdatingOwner = requests.filter((req) => req.owner !== undefined); +function throwIfUpdateOwner(requests: UpdateRequestWithOriginalCase[]) { + const requestsUpdatingOwner = requests.filter(({ updateReq }) => updateReq.owner !== undefined); if (requestsUpdatingOwner.length > 0) { - const ids = requestsUpdatingOwner.map((req) => req.id); + const ids = requestsUpdatingOwner.map(({ updateReq }) => updateReq.id); throw Boom.badRequest(`Updating the owner of a case is not allowed ids: [${ids.join(', ')}]`); } } @@ -136,14 +127,14 @@ async function throwIfInvalidUpdateOfTypeWithAlerts({ caseService, unsecuredSavedObjectsClient, }: { - requests: ESCasePatchRequest[]; + requests: UpdateRequestWithOriginalCase[]; caseService: CasesService; unsecuredSavedObjectsClient: SavedObjectsClientContract; }) { - const getAlertsForID = async (caseToUpdate: ESCasePatchRequest) => { + const getAlertsForID = async ({ updateReq }: UpdateRequestWithOriginalCase) => { const alerts = await caseService.getAllCaseComments({ unsecuredSavedObjectsClient, - id: caseToUpdate.id, + id: updateReq.id, options: { fields: [], // there should never be generated alerts attached to an individual case but we'll check anyway @@ -159,11 +150,14 @@ async function throwIfInvalidUpdateOfTypeWithAlerts({ }, }); - return { id: caseToUpdate.id, alerts }; + return { id: updateReq.id, alerts }; }; - const requestsUpdatingTypeField = requests.filter((req) => req.type === CaseType.collection); - const getAlertsMapper = async (caseToUpdate: ESCasePatchRequest) => getAlertsForID(caseToUpdate); + const requestsUpdatingTypeField = requests.filter( + ({ updateReq }) => updateReq.type === CaseType.collection + ); + const getAlertsMapper = async (caseToUpdate: UpdateRequestWithOriginalCase) => + getAlertsForID(caseToUpdate); // Ensuring we don't too many concurrent get running. const casesAlertTotals = await pMap(requestsUpdatingTypeField, getAlertsMapper, { concurrency: MAX_CONCURRENT_SEARCHES, @@ -185,13 +179,13 @@ async function throwIfInvalidUpdateOfTypeWithAlerts({ /** * Throws an error if any of the requests updates a title and the length is over MAX_TITLE_LENGTH. */ -function throwIfTitleIsInvalid(requests: ESCasePatchRequest[]) { +function throwIfTitleIsInvalid(requests: UpdateRequestWithOriginalCase[]) { const requestsInvalidTitle = requests.filter( - (req) => req.title !== undefined && req.title.length > MAX_TITLE_LENGTH + ({ updateReq }) => updateReq.title !== undefined && updateReq.title.length > MAX_TITLE_LENGTH ); if (requestsInvalidTitle.length > 0) { - const ids = requestsInvalidTitle.map((req) => req.id); + const ids = requestsInvalidTitle.map(({ updateReq }) => updateReq.id); throw Boom.badRequest( `The length of the title is too long. The maximum length is ${MAX_TITLE_LENGTH}, ids: [${ids.join( ', ' @@ -218,11 +212,11 @@ async function getAlertComments({ caseService, unsecuredSavedObjectsClient, }: { - casesToSync: ESCasePatchRequest[]; + casesToSync: UpdateRequestWithOriginalCase[]; caseService: CasesService; unsecuredSavedObjectsClient: SavedObjectsClientContract; }): Promise> { - const idsOfCasesToSync = casesToSync.map((casePatchReq) => casePatchReq.id); + const idsOfCasesToSync = casesToSync.map(({ updateReq }) => updateReq.id); // getAllCaseComments will by default get all the comments, unless page or perPage fields are set return caseService.getAllCaseComments({ @@ -310,14 +304,12 @@ function getSyncStatusForComment({ async function updateAlerts({ casesWithSyncSettingChangedToOn, casesWithStatusChangedAndSynced, - casesMap, caseService, unsecuredSavedObjectsClient, casesClientInternal, }: { - casesWithSyncSettingChangedToOn: ESCasePatchRequest[]; - casesWithStatusChangedAndSynced: ESCasePatchRequest[]; - casesMap: Map>; + casesWithSyncSettingChangedToOn: UpdateRequestWithOriginalCase[]; + casesWithStatusChangedAndSynced: UpdateRequestWithOriginalCase[]; caseService: CasesService; unsecuredSavedObjectsClient: SavedObjectsClientContract; casesClientInternal: CasesClientInternal; @@ -331,11 +323,8 @@ async function updateAlerts({ // build a map of case id to the status it has // this will have collections in it but the alerts should be associated to sub cases and not collections so it shouldn't // matter. - const casesToSyncToStatus = casesToSync.reduce((acc, caseInfo) => { - acc.set( - caseInfo.id, - caseInfo.status ?? casesMap.get(caseInfo.id)?.attributes.status ?? CaseStatuses.open - ); + const casesToSyncToStatus = casesToSync.reduce((acc, { updateReq, originalCase }) => { + acc.set(updateReq.id, updateReq.status ?? originalCase.attributes.status ?? CaseStatuses.open); return acc; }, new Map()); @@ -376,7 +365,7 @@ async function updateAlerts({ } function partitionPatchRequest( - casesMap: Map>, + casesMap: Map>, patchReqCases: CasePatchRequest[] ): { nonExistingCases: CasePatchRequest[]; @@ -409,6 +398,11 @@ function partitionPatchRequest( }; } +interface UpdateRequestWithOriginalCase { + updateReq: CasePatchRequest; + originalCase: SavedObject; +} + /** * Updates the specified cases with new values * @@ -441,7 +435,7 @@ export const update = async ( const casesMap = myCases.saved_objects.reduce((acc, so) => { acc.set(so.id, so); return acc; - }, new Map>()); + }, new Map>()); const { nonExistingCases, conflictedCases, casesToAuthorize } = partitionPatchRequest( casesMap, @@ -469,38 +463,41 @@ export const update = async ( ); } - const updateCases: ESCasePatchRequest[] = query.cases.map((updateCase) => { - const currentCase = myCases.saved_objects.find((c) => c.id === updateCase.id); - const { connector, ...thisCase } = updateCase; - return currentCase != null - ? getCaseToUpdate(currentCase.attributes, { - ...thisCase, - ...(connector != null - ? { connector: transformCaseConnectorToEsConnector(connector) } - : {}), - }) - : { id: thisCase.id, version: thisCase.version }; - }); + const updateCases: UpdateRequestWithOriginalCase[] = query.cases.reduce( + (acc: UpdateRequestWithOriginalCase[], updateCase) => { + const originalCase = casesMap.get(updateCase.id); - const updateFilterCases = updateCases.filter((updateCase) => { - const { id, version, ...updateCaseAttributes } = updateCase; - return Object.keys(updateCaseAttributes).length > 0; - }); + if (!originalCase) { + return acc; + } + + const fieldsToUpdate = getCaseToUpdate(originalCase.attributes, updateCase); - if (updateFilterCases.length <= 0) { + const { id, version, ...restFields } = fieldsToUpdate; + + if (Object.keys(restFields).length > 0) { + acc.push({ originalCase, updateReq: fieldsToUpdate }); + } + + return acc; + }, + [] + ); + + if (updateCases.length <= 0) { throw Boom.notAcceptable('All update fields are identical to current version.'); } if (!ENABLE_CASE_CONNECTOR) { - throwIfUpdateType(updateFilterCases); + throwIfUpdateType(updateCases); } - throwIfUpdateOwner(updateFilterCases); - throwIfTitleIsInvalid(updateFilterCases); - throwIfUpdateStatusOfCollection(updateFilterCases, casesMap); - throwIfUpdateTypeCollectionToIndividual(updateFilterCases, casesMap); + throwIfUpdateOwner(updateCases); + throwIfTitleIsInvalid(updateCases); + throwIfUpdateStatusOfCollection(updateCases); + throwIfUpdateTypeCollectionToIndividual(updateCases); await throwIfInvalidUpdateOfTypeWithAlerts({ - requests: updateFilterCases, + requests: updateCases, caseService, unsecuredSavedObjectsClient, }); @@ -510,9 +507,9 @@ export const update = async ( const updatedDt = new Date().toISOString(); const updatedCases = await caseService.patchCases({ unsecuredSavedObjectsClient, - cases: updateFilterCases.map((thisCase) => { + cases: updateCases.map(({ updateReq, originalCase }) => { // intentionally removing owner from the case so that we don't accidentally allow it to be updated - const { id: caseId, version, owner, ...updateCaseAttributes } = thisCase; + const { id: caseId, version, owner, ...updateCaseAttributes } = updateReq; let closedInfo = {}; if (updateCaseAttributes.status && updateCaseAttributes.status === CaseStatuses.closed) { closedInfo = { @@ -531,6 +528,7 @@ export const update = async ( } return { caseId, + originalCase, updatedAttributes: { ...updateCaseAttributes, ...closedInfo, @@ -544,25 +542,23 @@ export const update = async ( // If a status update occurred and the case is synced then we need to update all alerts' status // attached to the case to the new status. - const casesWithStatusChangedAndSynced = updateFilterCases.filter((caseToUpdate) => { - const currentCase = myCases.saved_objects.find((c) => c.id === caseToUpdate.id); + const casesWithStatusChangedAndSynced = updateCases.filter(({ updateReq, originalCase }) => { return ( - currentCase != null && - caseToUpdate.status != null && - currentCase.attributes.status !== caseToUpdate.status && - currentCase.attributes.settings.syncAlerts + originalCase != null && + updateReq.status != null && + originalCase.attributes.status !== updateReq.status && + originalCase.attributes.settings.syncAlerts ); }); // If syncAlerts setting turned on we need to update all alerts' status // attached to the case to the current status. - const casesWithSyncSettingChangedToOn = updateFilterCases.filter((caseToUpdate) => { - const currentCase = myCases.saved_objects.find((c) => c.id === caseToUpdate.id); + const casesWithSyncSettingChangedToOn = updateCases.filter(({ updateReq, originalCase }) => { return ( - currentCase != null && - caseToUpdate.settings?.syncAlerts != null && - currentCase.attributes.settings.syncAlerts !== caseToUpdate.settings.syncAlerts && - caseToUpdate.settings.syncAlerts + originalCase != null && + updateReq.settings?.syncAlerts != null && + originalCase.attributes.settings.syncAlerts !== updateReq.settings.syncAlerts && + updateReq.settings.syncAlerts ); }); @@ -573,7 +569,6 @@ export const update = async ( caseService, unsecuredSavedObjectsClient, casesClientInternal, - casesMap, }); const returnUpdatedCase = myCases.saved_objects diff --git a/x-pack/plugins/cases/server/client/configure/client.ts b/x-pack/plugins/cases/server/client/configure/client.ts index e8ff984fef994..ad7e1322c9e06 100644 --- a/x-pack/plugins/cases/server/client/configure/client.ts +++ b/x-pack/plugins/cases/server/client/configure/client.ts @@ -20,13 +20,13 @@ import { CaseConfigurationsResponseRt, CaseConfigureResponseRt, CasesConfigurationsResponse, + CasesConfigureAttributes, CasesConfigurePatch, CasesConfigurePatchRt, CasesConfigureRequest, CasesConfigureResponse, ConnectorMappings, ConnectorMappingsAttributes, - ESCasesConfigureAttributes, excess, GetConfigureFindRequest, GetConfigureFindRequestRt, @@ -34,11 +34,7 @@ import { SUPPORTED_CONNECTORS, throwErrors, } from '../../../common'; -import { - createCaseError, - transformCaseConnectorToEsConnector, - transformESConnectorToCaseConnector, -} from '../../common'; +import { createCaseError } from '../../common'; import { CasesClientInternal } from '../client_internal'; import { CasesClientArgs } from '../types'; import { getMappings } from './get_mappings'; @@ -174,7 +170,7 @@ async function get( const configurations = await pMap( myCaseConfigure.saved_objects, - async (configuration: SavedObject) => { + async (configuration: SavedObject) => { const { connector, ...caseConfigureWithoutConnector } = configuration?.attributes ?? { connector: null, }; @@ -184,7 +180,7 @@ async function get( if (connector != null) { try { mappings = await casesClientInternal.configuration.getMappings({ - connector: transformESConnectorToCaseConnector(connector), + connector, }); } catch (e) { error = e.isBoom @@ -195,7 +191,7 @@ async function get( return { ...caseConfigureWithoutConnector, - connector: transformESConnectorToCaseConnector(connector), + connector, mappings: mappings.length > 0 ? mappings[0].attributes.mappings : [], version: configuration.version ?? '', error, @@ -292,11 +288,9 @@ async function update( try { const resMappings = await casesClientInternal.configuration.getMappings({ - connector: - connector != null - ? connector - : transformESConnectorToCaseConnector(configuration.attributes.connector), + connector: connector != null ? connector : configuration.attributes.connector, }); + mappings = resMappings.length > 0 ? resMappings[0].attributes.mappings : []; if (connector != null) { @@ -325,18 +319,17 @@ async function update( configurationId: configuration.id, updatedAttributes: { ...queryWithoutVersionAndConnector, - ...(connector != null ? { connector: transformCaseConnectorToEsConnector(connector) } : {}), + ...(connector != null && { connector }), updated_at: updateDate, updated_by: user, }, + originalConfiguration: configuration, }); return CaseConfigureResponseRt.encode({ ...configuration.attributes, ...patch.attributes, - connector: transformESConnectorToCaseConnector( - patch.attributes.connector ?? configuration.attributes.connector - ), + connector: patch.attributes.connector ?? configuration.attributes.connector, mappings, version: patch.version ?? '', error, @@ -397,7 +390,7 @@ async function create( ); if (myCaseConfigure.saved_objects.length > 0) { - const deleteConfigurationMapper = async (c: SavedObject) => + const deleteConfigurationMapper = async (c: SavedObject) => caseConfigureService.delete({ unsecuredSavedObjectsClient, configurationId: c.id }); // Ensuring we don't too many concurrent deletions running. @@ -431,7 +424,7 @@ async function create( unsecuredSavedObjectsClient, attributes: { ...configuration, - connector: transformCaseConnectorToEsConnector(configuration.connector), + connector: configuration.connector, created_at: creationDate, created_by: user, updated_at: null, @@ -443,7 +436,7 @@ async function create( return CaseConfigureResponseRt.encode({ ...post.attributes, // Reserve for future implementations - connector: transformESConnectorToCaseConnector(post.attributes.connector), + connector: post.attributes.connector, mappings, version: post.version ?? '', error, diff --git a/x-pack/plugins/cases/server/client/sub_cases/update.ts b/x-pack/plugins/cases/server/client/sub_cases/update.ts index be671a8087f8e..c8cb96cbb6b8c 100644 --- a/x-pack/plugins/cases/server/client/sub_cases/update.ts +++ b/x-pack/plugins/cases/server/client/sub_cases/update.ts @@ -23,7 +23,6 @@ import { CaseStatuses, CommentAttributes, CommentType, - ESCaseAttributes, excess, SUB_CASE_SAVED_OBJECT, SubCaseAttributes, @@ -35,6 +34,7 @@ import { SubCasesResponseRt, throwErrors, User, + CaseAttributes, } from '../../../common'; import { getCaseToUpdate } from '../utils'; import { buildSubCaseUserActions } from '../../services/user_actions/helpers'; @@ -124,7 +124,7 @@ async function getParentCases({ unsecuredSavedObjectsClient: SavedObjectsClientContract; subCaseIDs: string[]; subCasesMap: Map>; -}): Promise>> { +}): Promise>> { const parentIDInfo = getParentIDs({ subCaseIDs, subCasesMap }); const parentCases = await caseService.getCases({ @@ -148,7 +148,7 @@ async function getParentCases({ acc.set(subCaseId, so); }); return acc; - }, new Map>()); + }, new Map>()); } function getValidUpdateRequests( diff --git a/x-pack/plugins/cases/server/client/utils.test.ts b/x-pack/plugins/cases/server/client/utils.test.ts index c8ed1f4f0efa6..45ea6bacb0f51 100644 --- a/x-pack/plugins/cases/server/client/utils.test.ts +++ b/x-pack/plugins/cases/server/client/utils.test.ts @@ -5,113 +5,12 @@ * 2.0. */ -import { SavedObjectsFindResponse } from 'kibana/server'; -import { - CaseConnector, - CaseType, - ConnectorTypes, - ESCaseConnector, - ESCasesConfigureAttributes, -} from '../../common/api'; -import { mockCaseConfigure } from '../routes/api/__fixtures__'; +import { CaseConnector, CaseType, ConnectorTypes } from '../../common/api'; import { newCase } from '../routes/api/__mocks__/request_responses'; -import { - transformCaseConnectorToEsConnector, - transformESConnectorToCaseConnector, - transformNewCase, -} from '../common'; -import { getConnectorFromConfiguration, sortToSnake } from './utils'; +import { transformNewCase } from '../common'; +import { sortToSnake } from './utils'; describe('utils', () => { - const caseConnector: CaseConnector = { - id: '123', - name: 'Jira', - type: ConnectorTypes.jira, - fields: { issueType: 'Task', priority: 'High', parent: null }, - }; - - const esCaseConnector: ESCaseConnector = { - id: '123', - name: 'Jira', - type: ConnectorTypes.jira, - fields: [ - { key: 'issueType', value: 'Task' }, - { key: 'priority', value: 'High' }, - { key: 'parent', value: null }, - ], - }; - - const caseConfigure: SavedObjectsFindResponse = { - saved_objects: [{ ...mockCaseConfigure[0], score: 0 }], - total: 1, - per_page: 20, - page: 1, - }; - - describe('transformCaseConnectorToEsConnector', () => { - it('transform correctly', () => { - expect(transformCaseConnectorToEsConnector(caseConnector)).toEqual(esCaseConnector); - }); - - it('transform correctly with null attributes', () => { - // @ts-ignore this is case the connector does not exist for old cases object or configurations - expect(transformCaseConnectorToEsConnector(null)).toEqual({ - id: 'none', - name: 'none', - type: ConnectorTypes.none, - fields: [], - }); - }); - }); - - describe('transformESConnectorToCaseConnector', () => { - it('transform correctly', () => { - expect(transformESConnectorToCaseConnector(esCaseConnector)).toEqual(caseConnector); - }); - - it('transform correctly with null attributes', () => { - // @ts-ignore this is case the connector does not exist for old cases object or configurations - expect(transformESConnectorToCaseConnector(null)).toEqual({ - id: 'none', - name: 'none', - type: ConnectorTypes.none, - fields: null, - }); - }); - }); - - describe('getConnectorFromConfiguration', () => { - it('transform correctly', () => { - expect(getConnectorFromConfiguration(caseConfigure)).toEqual({ - id: '789', - name: 'My connector 3', - type: ConnectorTypes.jira, - fields: null, - }); - }); - - it('transform correctly with no connector', () => { - const caseConfigureNoConnector: SavedObjectsFindResponse = { - ...caseConfigure, - saved_objects: [ - { - ...mockCaseConfigure[0], - // @ts-ignore this is case the connector does not exist for old cases object or configurations - attributes: { ...mockCaseConfigure[0].attributes, connector: null }, - score: 0, - }, - ], - }; - - expect(getConnectorFromConfiguration(caseConfigureNoConnector)).toEqual({ - id: 'none', - name: 'none', - type: ConnectorTypes.none, - fields: null, - }); - }); - }); - describe('sortToSnake', () => { it('it transforms status correctly', () => { expect(sortToSnake('status')).toBe('status'); @@ -139,15 +38,11 @@ describe('utils', () => { }); describe('transformNewCase', () => { - const connector: ESCaseConnector = { + const connector: CaseConnector = { id: '123', name: 'My connector', type: ConnectorTypes.jira, - fields: [ - { key: 'issueType', value: 'Task' }, - { key: 'priority', value: 'High' }, - { key: 'parent', value: null }, - ], + fields: { issueType: 'Task', priority: 'High', parent: null }, }; it('transform correctly', () => { const myCase = { @@ -166,20 +61,11 @@ describe('utils', () => { "closed_at": null, "closed_by": null, "connector": Object { - "fields": Array [ - Object { - "key": "issueType", - "value": "Task", - }, - Object { - "key": "priority", - "value": "High", - }, - Object { - "key": "parent", - "value": null, - }, - ], + "fields": Object { + "issueType": "Task", + "parent": null, + "priority": "High", + }, "id": "123", "name": "My connector", "type": ".jira", @@ -223,20 +109,11 @@ describe('utils', () => { "closed_at": null, "closed_by": null, "connector": Object { - "fields": Array [ - Object { - "key": "issueType", - "value": "Task", - }, - Object { - "key": "priority", - "value": "High", - }, - Object { - "key": "parent", - "value": null, - }, - ], + "fields": Object { + "issueType": "Task", + "parent": null, + "priority": "High", + }, "id": "123", "name": "My connector", "type": ".jira", @@ -283,20 +160,11 @@ describe('utils', () => { "closed_at": null, "closed_by": null, "connector": Object { - "fields": Array [ - Object { - "key": "issueType", - "value": "Task", - }, - Object { - "key": "priority", - "value": "High", - }, - Object { - "key": "parent", - "value": null, - }, - ], + "fields": Object { + "issueType": "Task", + "parent": null, + "priority": "High", + }, "id": "123", "name": "My connector", "type": ".jira", diff --git a/x-pack/plugins/cases/server/client/utils.ts b/x-pack/plugins/cases/server/client/utils.ts index 0e7a21816de4c..a6fd9984bfea6 100644 --- a/x-pack/plugins/cases/server/client/utils.ts +++ b/x-pack/plugins/cases/server/client/utils.ts @@ -12,20 +12,16 @@ import { fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; import { pipe } from 'fp-ts/lib/pipeable'; -import { SavedObjectsFindResponse } from 'kibana/server'; import { nodeBuilder, KueryNode } from '../../../../../src/plugins/data/common'; import { esKuery } from '../../../../../src/plugins/data/server'; import { AlertCommentRequestRt, ActionsCommentRequestRt, CASE_SAVED_OBJECT, - CaseConnector, CaseStatuses, CaseType, CommentRequest, - ConnectorTypes, ContextTypeUserRt, - ESCasesConfigureAttributes, excess, OWNER_FIELD, SUB_CASE_SAVED_OBJECT, @@ -437,31 +433,6 @@ export const getCaseToUpdate = ( { id: queryCase.id, version: queryCase.version } ); -export const getNoneCaseConnector = () => ({ - id: 'none', - name: 'none', - type: ConnectorTypes.none, - fields: null, -}); - -export const getConnectorFromConfiguration = ( - caseConfigure: SavedObjectsFindResponse -): CaseConnector => { - let caseConnector = getNoneCaseConnector(); - if ( - caseConfigure.saved_objects.length > 0 && - caseConfigure.saved_objects[0].attributes.connector - ) { - caseConnector = { - id: caseConfigure.saved_objects[0].attributes.connector.id, - name: caseConfigure.saved_objects[0].attributes.connector.name, - type: caseConfigure.saved_objects[0].attributes.connector.type, - fields: null, - }; - } - return caseConnector; -}; - enum SortFieldCase { closedAt = 'closed_at', createdAt = 'created_at', diff --git a/x-pack/plugins/cases/server/common/constants.ts b/x-pack/plugins/cases/server/common/constants.ts new file mode 100644 index 0000000000000..1f6af310d6ece --- /dev/null +++ b/x-pack/plugins/cases/server/common/constants.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +/** + * The name of the saved object reference indicating the action connector ID. This is stored in the Saved Object reference + * field's name property. + */ +export const CONNECTOR_ID_REFERENCE_NAME = 'connectorId'; + +/** + * The name of the saved object reference indicating the action connector ID that was used to push a case. + */ +export const PUSH_CONNECTOR_ID_REFERENCE_NAME = 'pushConnectorId'; diff --git a/x-pack/plugins/cases/server/common/index.ts b/x-pack/plugins/cases/server/common/index.ts index 324c7e7ffd1a8..ae9af177c1bb4 100644 --- a/x-pack/plugins/cases/server/common/index.ts +++ b/x-pack/plugins/cases/server/common/index.ts @@ -9,3 +9,4 @@ export * from './models'; export * from './utils'; export * from './types'; export * from './error'; +export * from './constants'; diff --git a/x-pack/plugins/cases/server/common/models/commentable_case.ts b/x-pack/plugins/cases/server/common/models/commentable_case.ts index e082a0b290f16..03d6e5b8cea63 100644 --- a/x-pack/plugins/cases/server/common/models/commentable_case.ts +++ b/x-pack/plugins/cases/server/common/models/commentable_case.ts @@ -25,18 +25,13 @@ import { CommentPatchRequest, CommentRequest, CommentType, - ESCaseAttributes, MAX_DOCS_PER_PAGE, SUB_CASE_SAVED_OBJECT, SubCaseAttributes, User, + CaseAttributes, } from '../../../common'; -import { - transformESConnectorToCaseConnector, - flattenCommentSavedObjects, - flattenSubCaseSavedObject, - transformNewComment, -} from '..'; +import { flattenCommentSavedObjects, flattenSubCaseSavedObject, transformNewComment } from '..'; import { AttachmentService, CasesService } from '../../services'; import { createCaseError } from '../error'; import { countAlertsForID } from '../index'; @@ -52,7 +47,7 @@ interface NewCommentResp { } interface CommentableCaseParams { - collection: SavedObject; + collection: SavedObject; subCase?: SavedObject; unsecuredSavedObjectsClient: SavedObjectsClientContract; caseService: CasesService; @@ -65,7 +60,7 @@ interface CommentableCaseParams { * a Sub Case, Case, and Collection. */ export class CommentableCase { - private readonly collection: SavedObject; + private readonly collection: SavedObject; private readonly subCase?: SavedObject; private readonly unsecuredSavedObjectsClient: SavedObjectsClientContract; private readonly caseService: CasesService; @@ -168,6 +163,7 @@ export class CommentableCase { } const updatedCase = await this.caseService.patchCase({ + originalCase: this.collection, unsecuredSavedObjectsClient: this.unsecuredSavedObjectsClient, caseId: this.collection.id, updatedAttributes: { @@ -305,7 +301,6 @@ export class CommentableCase { version: this.collection.version ?? '0', totalComment, ...this.collection.attributes, - connector: transformESConnectorToCaseConnector(this.collection.attributes.connector), }; } diff --git a/x-pack/plugins/cases/server/common/utils.test.ts b/x-pack/plugins/cases/server/common/utils.test.ts index 322e45094eda4..46ba33a74acd6 100644 --- a/x-pack/plugins/cases/server/common/utils.test.ts +++ b/x-pack/plugins/cases/server/common/utils.test.ts @@ -14,11 +14,7 @@ import { CommentRequest, CommentType, } from '../../common/api'; -import { - mockCaseComments, - mockCases, - mockCaseNoConnectorId, -} from '../routes/api/__fixtures__/mock_saved_objects'; +import { mockCaseComments, mockCases } from '../routes/api/__fixtures__/mock_saved_objects'; import { flattenCaseSavedObject, transformNewComment, @@ -470,14 +466,13 @@ describe('common utils', () => { `); }); - it('inserts missing connector', () => { + it('leaves the connector.id in the attributes', () => { const extraCaseData = { totalComment: 2, }; const res = flattenCaseSavedObject({ - // @ts-ignore this is to update old case saved objects to include connector - savedObject: mockCaseNoConnectorId, + savedObject: mockCases[0], ...extraCaseData, }); @@ -500,7 +495,8 @@ describe('common utils', () => { }, "description": "This is a brand new case of a bad meanie defacing data", "external_service": null, - "id": "mock-no-connector_id", + "id": "mock-id-1", + "owner": "securitySolution", "settings": Object { "syncAlerts": true, }, @@ -513,6 +509,7 @@ describe('common utils', () => { "title": "Super Bad Security Issue", "totalAlerts": 0, "totalComment": 2, + "type": "individual", "updated_at": "2019-11-25T21:54:48.952Z", "updated_by": Object { "email": "testemail@elastic.co", diff --git a/x-pack/plugins/cases/server/common/utils.ts b/x-pack/plugins/cases/server/common/utils.ts index 13d3f3768f391..bce37764467df 100644 --- a/x-pack/plugins/cases/server/common/utils.ts +++ b/x-pack/plugins/cases/server/common/utils.ts @@ -12,6 +12,7 @@ import { AlertInfo } from '.'; import { AssociationType, + CaseAttributes, CaseConnector, CaseResponse, CasesClientPostRequest, @@ -24,11 +25,8 @@ import { CommentResponse, CommentsResponse, CommentType, - ConnectorTypeFields, + ConnectorTypes, ENABLE_CASE_CONNECTOR, - ESCaseAttributes, - ESCaseConnector, - ESConnectorFields, SubCaseAttributes, SubCaseResponse, SubCasesFindResponse, @@ -55,13 +53,13 @@ export const transformNewCase = ({ newCase, username, }: { - connector: ESCaseConnector; + connector: CaseConnector; createdDate: string; email?: string | null; full_name?: string | null; newCase: CasesClientPostRequest; username?: string | null; -}): ESCaseAttributes => ({ +}): CaseAttributes => ({ ...newCase, closed_at: null, closed_by: null, @@ -135,7 +133,7 @@ export const flattenCaseSavedObject = ({ subCases, subCaseIds, }: { - savedObject: SavedObject; + savedObject: SavedObject; comments?: Array>; totalComment?: number; totalAlerts?: number; @@ -148,7 +146,6 @@ export const flattenCaseSavedObject = ({ totalComment, totalAlerts, ...savedObject.attributes, - connector: transformESConnectorToCaseConnector(savedObject.attributes.connector), subCases, subCaseIds: !isEmpty(subCaseIds) ? subCaseIds : undefined, }); @@ -196,47 +193,6 @@ export const flattenCommentSavedObject = ( ...savedObject.attributes, }); -export const transformCaseConnectorToEsConnector = (connector: CaseConnector): ESCaseConnector => ({ - id: connector?.id ?? 'none', - name: connector?.name ?? 'none', - type: connector?.type ?? '.none', - fields: - connector?.fields != null - ? Object.entries(connector.fields).reduce( - (acc, [key, value]) => [ - ...acc, - { - key, - value, - }, - ], - [] - ) - : [], -}); - -export const transformESConnectorToCaseConnector = (connector?: ESCaseConnector): CaseConnector => { - const connectorTypeField = { - type: connector?.type ?? '.none', - fields: - connector && connector.fields != null && connector.fields.length > 0 - ? connector.fields.reduce( - (fields, { key, value }) => ({ - ...fields, - [key]: value, - }), - {} - ) - : null, - } as ConnectorTypeFields; - - return { - id: connector?.id ?? 'none', - name: connector?.name ?? 'none', - ...connectorTypeField, - }; -}; - export const getIDsAndIndicesAsArrays = ( comment: CommentRequestAlertType ): { ids: string[]; indices: string[] } => { @@ -430,3 +386,15 @@ export function checkEnabledCaseConnectorOrThrow(subCaseID: string | undefined) ); } } + +/** + * Returns a connector that indicates that no connector was set. + * + * @returns the 'none' connector + */ +export const getNoneCaseConnector = () => ({ + id: 'none', + name: 'none', + type: ConnectorTypes.none, + fields: null, +}); diff --git a/x-pack/plugins/cases/server/routes/api/__fixtures__/mock_saved_objects.ts b/x-pack/plugins/cases/server/routes/api/__fixtures__/mock_saved_objects.ts index 625324312e6b9..1551f0fa611b7 100644 --- a/x-pack/plugins/cases/server/routes/api/__fixtures__/mock_saved_objects.ts +++ b/x-pack/plugins/cases/server/routes/api/__fixtures__/mock_saved_objects.ts @@ -8,17 +8,16 @@ import { SavedObject } from 'kibana/server'; import { AssociationType, + CaseAttributes, CaseStatuses, CaseType, CommentAttributes, CommentType, ConnectorTypes, - ESCaseAttributes, - ESCasesConfigureAttributes, SECURITY_SOLUTION_OWNER, } from '../../../../common'; -export const mockCases: Array> = [ +export const mockCases: Array> = [ { type: 'cases', id: 'mock-id-1', @@ -29,7 +28,7 @@ export const mockCases: Array> = [ id: 'none', name: 'none', type: ConnectorTypes.none, - fields: [], + fields: null, }, created_at: '2019-11-25T21:54:48.952Z', created_by: { @@ -68,7 +67,7 @@ export const mockCases: Array> = [ id: 'none', name: 'none', type: ConnectorTypes.none, - fields: [], + fields: null, }, created_at: '2019-11-25T22:32:00.900Z', created_by: { @@ -107,11 +106,7 @@ export const mockCases: Array> = [ id: '123', name: 'My connector', type: ConnectorTypes.jira, - fields: [ - { key: 'issueType', value: 'Task' }, - { key: 'priority', value: 'High' }, - { key: 'parent', value: null }, - ], + fields: { issueType: 'Task', priority: 'High', parent: null }, }, created_at: '2019-11-25T22:32:17.947Z', created_by: { @@ -154,11 +149,7 @@ export const mockCases: Array> = [ id: '123', name: 'My connector', type: ConnectorTypes.jira, - fields: [ - { key: 'issueType', value: 'Task' }, - { key: 'priority', value: 'High' }, - { key: 'parent', value: null }, - ], + fields: { issueType: 'Task', priority: 'High', parent: null }, }, created_at: '2019-11-25T22:32:17.947Z', created_by: { @@ -189,38 +180,6 @@ export const mockCases: Array> = [ }, ]; -export const mockCaseNoConnectorId: SavedObject> = { - type: 'cases', - id: 'mock-no-connector_id', - attributes: { - closed_at: null, - closed_by: null, - created_at: '2019-11-25T21:54:48.952Z', - created_by: { - full_name: 'elastic', - email: 'testemail@elastic.co', - username: 'elastic', - }, - description: 'This is a brand new case of a bad meanie defacing data', - external_service: null, - title: 'Super Bad Security Issue', - status: CaseStatuses.open, - tags: ['defacement'], - updated_at: '2019-11-25T21:54:48.952Z', - updated_by: { - full_name: 'elastic', - email: 'testemail@elastic.co', - username: 'elastic', - }, - settings: { - syncAlerts: true, - }, - }, - references: [], - updated_at: '2019-11-25T21:54:48.952Z', - version: 'WzAsMV0=', -}; - export const mockCasesErrorTriggerData = [ { id: 'valid-id', @@ -446,35 +405,3 @@ export const mockCaseComments: Array> = [ version: 'WzYsMV0=', }, ]; - -export const mockCaseConfigure: Array> = [ - { - type: 'cases-configure', - id: 'mock-configuration-1', - attributes: { - connector: { - id: '789', - name: 'My connector 3', - type: ConnectorTypes.jira, - fields: null, - }, - closure_type: 'close-by-user', - created_at: '2020-04-09T09:43:51.778Z', - created_by: { - full_name: 'elastic', - email: 'testemail@elastic.co', - username: 'elastic', - }, - updated_at: '2020-04-09T09:43:51.778Z', - updated_by: { - full_name: 'elastic', - email: 'testemail@elastic.co', - username: 'elastic', - }, - owner: SECURITY_SOLUTION_OWNER, - }, - references: [], - updated_at: '2020-04-09T09:43:51.778Z', - version: 'WzYsMV0=', - }, -]; diff --git a/x-pack/plugins/cases/server/saved_object_types/cases.ts b/x-pack/plugins/cases/server/saved_object_types/cases.ts index 869437f125ca0..199017c36fa3e 100644 --- a/x-pack/plugins/cases/server/saved_object_types/cases.ts +++ b/x-pack/plugins/cases/server/saved_object_types/cases.ts @@ -52,9 +52,6 @@ export const caseSavedObjectType: SavedObjectsType = { }, connector: { properties: { - id: { - type: 'keyword', - }, name: { type: 'text', }, @@ -91,9 +88,6 @@ export const caseSavedObjectType: SavedObjectsType = { }, }, }, - connector_id: { - type: 'keyword', - }, connector_name: { type: 'keyword', }, diff --git a/x-pack/plugins/cases/server/saved_object_types/configure.ts b/x-pack/plugins/cases/server/saved_object_types/configure.ts index e88ecb93d9d65..a763a8243cc2d 100644 --- a/x-pack/plugins/cases/server/saved_object_types/configure.ts +++ b/x-pack/plugins/cases/server/saved_object_types/configure.ts @@ -33,9 +33,6 @@ export const caseConfigureSavedObjectType: SavedObjectsType = { }, connector: { properties: { - id: { - type: 'keyword', - }, name: { type: 'text', }, diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts new file mode 100644 index 0000000000000..bca12a86a544e --- /dev/null +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.test.ts @@ -0,0 +1,351 @@ +/* + * 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 { SavedObjectSanitizedDoc } from 'kibana/server'; +import { + CaseAttributes, + CaseFullExternalService, + CASE_SAVED_OBJECT, + ConnectorTypes, + noneConnectorId, +} from '../../../common'; +import { getNoneCaseConnector } from '../../common'; +import { createExternalService, ESCaseConnectorWithId } from '../../services/test_utils'; +import { caseConnectorIdMigration } from './cases'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const create_7_14_0_case = ({ + connector, + externalService, +}: { connector?: ESCaseConnectorWithId; externalService?: CaseFullExternalService } = {}) => ({ + type: CASE_SAVED_OBJECT, + id: '1', + attributes: { + connector, + external_service: externalService, + }, +}); + +describe('7.15.0 connector ID migration', () => { + it('does not create a reference when the connector.id is none', () => { + const caseSavedObject = create_7_14_0_case({ connector: getNoneCaseConnector() }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + expect(migratedConnector.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "name": "none", + "type": ".none", + } + `); + }); + + it('does not create a reference when the connector is undefined', () => { + const caseSavedObject = create_7_14_0_case(); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + expect(migratedConnector.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "name": "none", + "type": ".none", + } + `); + }); + + it('sets the connector to the default none connector if the connector.id is undefined', () => { + const caseSavedObject = create_7_14_0_case({ + connector: { + fields: null, + name: ConnectorTypes.jira, + type: ConnectorTypes.jira, + } as ESCaseConnectorWithId, + }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + expect(migratedConnector.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "name": "none", + "type": ".none", + } + `); + }); + + it('does not create a reference when the external_service is null', () => { + const caseSavedObject = create_7_14_0_case({ externalService: null }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.external_service).toBeNull(); + }); + + it('does not create a reference when the external_service is undefined and sets external_service to null', () => { + const caseSavedObject = create_7_14_0_case(); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.external_service).toBeNull(); + }); + + it('does not create a reference when the external_service.connector_id is none', () => { + const caseSavedObject = create_7_14_0_case({ + externalService: createExternalService({ connector_id: noneConnectorId }), + }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('preserves the existing references when migrating', () => { + const caseSavedObject = { + ...create_7_14_0_case(), + references: [{ id: '1', name: 'awesome', type: 'hello' }], + }; + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(1); + expect(migratedConnector.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "awesome", + "type": "hello", + }, + ] + `); + }); + + it('creates a connector reference and removes the connector.id field', () => { + const caseSavedObject = create_7_14_0_case({ + connector: { + id: '123', + fields: null, + name: 'connector', + type: ConnectorTypes.jira, + }, + }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(1); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + expect(migratedConnector.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "name": "connector", + "type": ".jira", + } + `); + expect(migratedConnector.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "123", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + + it('creates a push connector reference and removes the connector_id field', () => { + const caseSavedObject = create_7_14_0_case({ + externalService: { + connector_id: '100', + connector_name: '.jira', + external_id: '100', + external_title: 'awesome', + external_url: 'http://www.google.com', + pushed_at: '2019-11-25T21:54:48.952Z', + pushed_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + }, + }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(1); + expect(migratedConnector.attributes.external_service).not.toHaveProperty('connector_id'); + expect(migratedConnector.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + expect(migratedConnector.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + + it('does not create a reference and preserves the existing external_service fields when connector_id is null', () => { + const caseSavedObject = create_7_14_0_case({ + externalService: { + connector_id: null, + connector_name: '.jira', + external_id: '100', + external_title: 'awesome', + external_url: 'http://www.google.com', + pushed_at: '2019-11-25T21:54:48.952Z', + pushed_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + }, + }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.external_service).not.toHaveProperty('connector_id'); + expect(migratedConnector.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('migrates both connector and external_service when provided', () => { + const caseSavedObject = create_7_14_0_case({ + externalService: { + connector_id: '100', + connector_name: '.jira', + external_id: '100', + external_title: 'awesome', + external_url: 'http://www.google.com', + pushed_at: '2019-11-25T21:54:48.952Z', + pushed_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + }, + connector: { + id: '123', + fields: null, + name: 'connector', + type: ConnectorTypes.jira, + }, + }); + + const migratedConnector = caseConnectorIdMigration( + caseSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(2); + expect(migratedConnector.attributes.external_service).not.toHaveProperty('connector_id'); + expect(migratedConnector.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + expect(migratedConnector.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "name": "connector", + "type": ".jira", + } + `); + expect(migratedConnector.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "123", + "name": "connectorId", + "type": "action", + }, + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); +}); diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts new file mode 100644 index 0000000000000..8296de57b37a9 --- /dev/null +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/cases.ts @@ -0,0 +1,135 @@ +/* + * 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. + */ + +/* eslint-disable @typescript-eslint/naming-convention */ + +import { addOwnerToSO, SanitizedCaseOwner } from '.'; +import { + SavedObjectUnsanitizedDoc, + SavedObjectSanitizedDoc, +} from '../../../../../../src/core/server'; +import { ESConnectorFields } from '../../services'; +import { ConnectorTypes, CaseType } from '../../../common'; +import { transformConnectorIdToReference, transformPushConnectorIdToReference } from './utils'; + +interface UnsanitizedCaseConnector { + connector_id: string; +} + +interface SanitizedCaseConnector { + connector: { + id: string; + name: string | null; + type: string | null; + fields: null | ESConnectorFields; + }; +} + +interface SanitizedCaseSettings { + settings: { + syncAlerts: boolean; + }; +} + +interface SanitizedCaseType { + type: string; +} + +interface ConnectorIdFields { + connector?: { id?: string }; + external_service?: { connector_id?: string | null } | null; +} + +export const caseConnectorIdMigration = ( + doc: SavedObjectUnsanitizedDoc +): SavedObjectSanitizedDoc => { + // removing the id field since it will be stored in the references instead + const { connector, external_service, ...restAttributes } = doc.attributes; + + const { transformedConnector, references: connectorReferences } = transformConnectorIdToReference( + connector + ); + + const { + transformedPushConnector, + references: pushConnectorReferences, + } = transformPushConnectorIdToReference(external_service); + + const { references = [] } = doc; + + return { + ...doc, + attributes: { + ...restAttributes, + ...transformedConnector, + ...transformedPushConnector, + }, + references: [...references, ...connectorReferences, ...pushConnectorReferences], + }; +}; + +export const caseMigrations = { + '7.10.0': ( + doc: SavedObjectUnsanitizedDoc + ): SavedObjectSanitizedDoc => { + const { connector_id, ...attributesWithoutConnectorId } = doc.attributes; + + return { + ...doc, + attributes: { + ...attributesWithoutConnectorId, + connector: { + id: connector_id ?? 'none', + name: 'none', + type: ConnectorTypes.none, + fields: null, + }, + }, + references: doc.references || [], + }; + }, + '7.11.0': ( + doc: SavedObjectUnsanitizedDoc> + ): SavedObjectSanitizedDoc => { + return { + ...doc, + attributes: { + ...doc.attributes, + settings: { + syncAlerts: true, + }, + }, + references: doc.references || [], + }; + }, + '7.12.0': ( + doc: SavedObjectUnsanitizedDoc + ): SavedObjectSanitizedDoc => { + const { fields, type } = doc.attributes.connector; + return { + ...doc, + attributes: { + ...doc.attributes, + type: CaseType.individual, + connector: { + ...doc.attributes.connector, + fields: + Array.isArray(fields) && fields.length > 0 && type === ConnectorTypes.serviceNowITSM + ? [...fields, { key: 'category', value: null }, { key: 'subcategory', value: null }] + : fields, + }, + }, + references: doc.references || [], + }; + }, + '7.14.0': ( + doc: SavedObjectUnsanitizedDoc> + ): SavedObjectSanitizedDoc => { + return addOwnerToSO(doc); + }, + '7.15.0': caseConnectorIdMigration, +}; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts new file mode 100644 index 0000000000000..4467b499817a5 --- /dev/null +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.test.ts @@ -0,0 +1,126 @@ +/* + * 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 { SavedObjectSanitizedDoc } from 'kibana/server'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { + CASE_CONFIGURE_SAVED_OBJECT, + ConnectorTypes, + SECURITY_SOLUTION_OWNER, +} from '../../../common'; +import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { ESCaseConnectorWithId } from '../../services/test_utils'; +import { ESCasesConfigureAttributes } from '../../services/configure/types'; +import { configureConnectorIdMigration } from './configuration'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const create_7_14_0_configSchema = (connector?: ESCaseConnectorWithId) => ({ + type: CASE_CONFIGURE_SAVED_OBJECT, + id: '1', + attributes: { + connector, + closure_type: 'close-by-pushing', + owner: SECURITY_SOLUTION_OWNER, + created_at: '2020-04-09T09:43:51.778Z', + created_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + updated_at: '2020-04-09T09:43:51.778Z', + updated_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + }, +}); + +describe('7.15.0 connector ID migration', () => { + it('does not create a reference when the connector ID is none', () => { + const configureSavedObject = create_7_14_0_configSchema(getNoneCaseConnector()); + + const migratedConnector = configureConnectorIdMigration( + configureSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + }); + + it('does not create a reference when the connector is undefined and defaults it to the none connector', () => { + const configureSavedObject = create_7_14_0_configSchema(); + + const migratedConnector = configureConnectorIdMigration( + configureSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references.length).toBe(0); + expect(migratedConnector.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "name": "none", + "type": ".none", + } + `); + }); + + it('creates a reference using the connector id', () => { + const configureSavedObject = create_7_14_0_configSchema({ + id: '123', + fields: null, + name: 'connector', + type: ConnectorTypes.jira, + }); + + const migratedConnector = configureConnectorIdMigration( + configureSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector.references).toEqual([ + { id: '123', type: ACTION_SAVED_OBJECT_TYPE, name: CONNECTOR_ID_REFERENCE_NAME }, + ]); + expect(migratedConnector.attributes.connector).not.toHaveProperty('id'); + }); + + it('returns the other attributes and default connector when the connector is undefined', () => { + const configureSavedObject = create_7_14_0_configSchema(); + + const migratedConnector = configureConnectorIdMigration( + configureSavedObject + ) as SavedObjectSanitizedDoc; + + expect(migratedConnector).toMatchInlineSnapshot(` + Object { + "attributes": Object { + "closure_type": "close-by-pushing", + "connector": Object { + "fields": null, + "name": "none", + "type": ".none", + }, + "created_at": "2020-04-09T09:43:51.778Z", + "created_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + "owner": "securitySolution", + "updated_at": "2020-04-09T09:43:51.778Z", + "updated_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + }, + "id": "1", + "references": Array [], + "type": "cases-configure", + } + `); + }); +}); diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts new file mode 100644 index 0000000000000..3209feb2a9a9b --- /dev/null +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/configuration.ts @@ -0,0 +1,78 @@ +/* + * 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. + */ + +/* eslint-disable @typescript-eslint/naming-convention */ + +import { + SavedObjectUnsanitizedDoc, + SavedObjectSanitizedDoc, +} from '../../../../../../src/core/server'; +import { ConnectorTypes } from '../../../common'; +import { addOwnerToSO, SanitizedCaseOwner } from '.'; +import { transformConnectorIdToReference } from './utils'; + +interface UnsanitizedConfigureConnector { + connector_id: string; + connector_name: string; +} + +interface SanitizedConfigureConnector { + connector: { + id: string; + name: string | null; + type: string | null; + fields: null; + }; +} + +export const configureConnectorIdMigration = ( + doc: SavedObjectUnsanitizedDoc<{ connector?: { id: string } }> +): SavedObjectSanitizedDoc => { + // removing the id field since it will be stored in the references instead + const { connector, ...restAttributes } = doc.attributes; + const { transformedConnector, references: connectorReferences } = transformConnectorIdToReference( + connector + ); + const { references = [] } = doc; + + return { + ...doc, + attributes: { + ...restAttributes, + ...transformedConnector, + }, + references: [...references, ...connectorReferences], + }; +}; + +export const configureMigrations = { + '7.10.0': ( + doc: SavedObjectUnsanitizedDoc + ): SavedObjectSanitizedDoc => { + const { connector_id, connector_name, ...restAttributes } = doc.attributes; + + return { + ...doc, + attributes: { + ...restAttributes, + connector: { + id: connector_id ?? 'none', + name: connector_name ?? 'none', + type: ConnectorTypes.none, + fields: null, + }, + }, + references: doc.references || [], + }; + }, + '7.14.0': ( + doc: SavedObjectUnsanitizedDoc> + ): SavedObjectSanitizedDoc => { + return addOwnerToSO(doc); + }, + '7.15.0': configureConnectorIdMigration, +}; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/index.ts similarity index 53% rename from x-pack/plugins/cases/server/saved_object_types/migrations.ts rename to x-pack/plugins/cases/server/saved_object_types/migrations/index.ts index e4b201b21b756..7be87c3abc989 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/index.ts @@ -7,42 +7,19 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { SavedObjectUnsanitizedDoc, SavedObjectSanitizedDoc } from '../../../../../src/core/server'; +import { + SavedObjectUnsanitizedDoc, + SavedObjectSanitizedDoc, +} from '../../../../../../src/core/server'; import { ConnectorTypes, CommentType, - CaseType, AssociationType, - ESConnectorFields, SECURITY_SOLUTION_OWNER, -} from '../../common'; - -interface UnsanitizedCaseConnector { - connector_id: string; -} - -interface UnsanitizedConfigureConnector { - connector_id: string; - connector_name: string; -} - -interface SanitizedCaseConnector { - connector: { - id: string; - name: string | null; - type: string | null; - fields: null | ESConnectorFields; - }; -} +} from '../../../common'; -interface SanitizedConfigureConnector { - connector: { - id: string; - name: string | null; - type: string | null; - fields: null; - }; -} +export { caseMigrations } from './cases'; +export { configureMigrations } from './configuration'; interface UserActions { action_field: string[]; @@ -50,21 +27,11 @@ interface UserActions { old_value: string; } -interface SanitizedCaseSettings { - settings: { - syncAlerts: boolean; - }; -} - -interface SanitizedCaseType { - type: string; -} - -interface SanitizedCaseOwner { +export interface SanitizedCaseOwner { owner: string; } -const addOwnerToSO = >( +export const addOwnerToSO = >( doc: SavedObjectUnsanitizedDoc ): SavedObjectSanitizedDoc => ({ ...doc, @@ -75,94 +42,6 @@ const addOwnerToSO = >( references: doc.references || [], }); -export const caseMigrations = { - '7.10.0': ( - doc: SavedObjectUnsanitizedDoc - ): SavedObjectSanitizedDoc => { - const { connector_id, ...attributesWithoutConnectorId } = doc.attributes; - - return { - ...doc, - attributes: { - ...attributesWithoutConnectorId, - connector: { - id: connector_id ?? 'none', - name: 'none', - type: ConnectorTypes.none, - fields: null, - }, - }, - references: doc.references || [], - }; - }, - '7.11.0': ( - doc: SavedObjectUnsanitizedDoc> - ): SavedObjectSanitizedDoc => { - return { - ...doc, - attributes: { - ...doc.attributes, - settings: { - syncAlerts: true, - }, - }, - references: doc.references || [], - }; - }, - '7.12.0': ( - doc: SavedObjectUnsanitizedDoc - ): SavedObjectSanitizedDoc => { - const { fields, type } = doc.attributes.connector; - return { - ...doc, - attributes: { - ...doc.attributes, - type: CaseType.individual, - connector: { - ...doc.attributes.connector, - fields: - Array.isArray(fields) && fields.length > 0 && type === ConnectorTypes.serviceNowITSM - ? [...fields, { key: 'category', value: null }, { key: 'subcategory', value: null }] - : fields, - }, - }, - references: doc.references || [], - }; - }, - '7.14.0': ( - doc: SavedObjectUnsanitizedDoc> - ): SavedObjectSanitizedDoc => { - return addOwnerToSO(doc); - }, -}; - -export const configureMigrations = { - '7.10.0': ( - doc: SavedObjectUnsanitizedDoc - ): SavedObjectSanitizedDoc => { - const { connector_id, connector_name, ...restAttributes } = doc.attributes; - - return { - ...doc, - attributes: { - ...restAttributes, - connector: { - id: connector_id ?? 'none', - name: connector_name ?? 'none', - type: ConnectorTypes.none, - fields: null, - }, - }, - references: doc.references || [], - }; - }, - '7.14.0': ( - doc: SavedObjectUnsanitizedDoc> - ): SavedObjectSanitizedDoc => { - return addOwnerToSO(doc); - }, -}; - export const userActionsMigrations = { '7.10.0': (doc: SavedObjectUnsanitizedDoc): SavedObjectSanitizedDoc => { const { action_field, new_value, old_value, ...restAttributes } = doc.attributes; diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/utils.test.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/utils.test.ts new file mode 100644 index 0000000000000..f591bef6b3236 --- /dev/null +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/utils.test.ts @@ -0,0 +1,229 @@ +/* + * 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 { noneConnectorId } from '../../../common'; +import { createExternalService, createJiraConnector } from '../../services/test_utils'; +import { transformConnectorIdToReference, transformPushConnectorIdToReference } from './utils'; + +describe('migration utils', () => { + describe('transformConnectorIdToReference', () => { + it('returns the default none connector when the connector is undefined', () => { + expect(transformConnectorIdToReference().transformedConnector).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": null, + "name": "none", + "type": ".none", + }, + } + `); + }); + + it('returns the default none connector when the id is undefined', () => { + expect(transformConnectorIdToReference({ id: undefined }).transformedConnector) + .toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": null, + "name": "none", + "type": ".none", + }, + } + `); + }); + + it('returns the default none connector when the id is none', () => { + expect(transformConnectorIdToReference({ id: noneConnectorId }).transformedConnector) + .toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": null, + "name": "none", + "type": ".none", + }, + } + `); + }); + + it('returns the default none connector when the id is none and other fields are defined', () => { + expect( + transformConnectorIdToReference({ ...createJiraConnector(), id: noneConnectorId }) + .transformedConnector + ).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": null, + "name": "none", + "type": ".none", + }, + } + `); + }); + + it('returns an empty array of references when the connector is undefined', () => { + expect(transformConnectorIdToReference().references.length).toBe(0); + }); + + it('returns an empty array of references when the id is undefined', () => { + expect(transformConnectorIdToReference({ id: undefined }).references.length).toBe(0); + }); + + it('returns an empty array of references when the id is the none connector', () => { + expect(transformConnectorIdToReference({ id: noneConnectorId }).references.length).toBe(0); + }); + + it('returns an empty array of references when the id is the none connector and other fields are defined', () => { + expect( + transformConnectorIdToReference({ ...createJiraConnector(), id: noneConnectorId }) + .references.length + ).toBe(0); + }); + + it('returns a jira connector', () => { + const transformedFields = transformConnectorIdToReference(createJiraConnector()); + expect(transformedFields.transformedConnector).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "name": ".jira", + "type": ".jira", + }, + } + `); + expect(transformedFields.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + }); + + describe('transformPushConnectorIdToReference', () => { + it('sets external_service to null when it is undefined', () => { + expect(transformPushConnectorIdToReference().transformedPushConnector).toMatchInlineSnapshot(` + Object { + "external_service": null, + } + `); + }); + + it('sets external_service to null when it is null', () => { + expect(transformPushConnectorIdToReference(null).transformedPushConnector) + .toMatchInlineSnapshot(` + Object { + "external_service": null, + } + `); + }); + + it('returns an object when external_service is defined but connector_id is undefined', () => { + expect( + transformPushConnectorIdToReference({ connector_id: undefined }).transformedPushConnector + ).toMatchInlineSnapshot(` + Object { + "external_service": Object {}, + } + `); + }); + + it('returns an object when external_service is defined but connector_id is null', () => { + expect(transformPushConnectorIdToReference({ connector_id: null }).transformedPushConnector) + .toMatchInlineSnapshot(` + Object { + "external_service": Object {}, + } + `); + }); + + it('returns an object when external_service is defined but connector_id is none', () => { + const otherFields = { otherField: 'hi' }; + + expect( + transformPushConnectorIdToReference({ ...otherFields, connector_id: noneConnectorId }) + .transformedPushConnector + ).toMatchInlineSnapshot(` + Object { + "external_service": Object { + "otherField": "hi", + }, + } + `); + }); + + it('returns an empty array of references when the external_service is undefined', () => { + expect(transformPushConnectorIdToReference().references.length).toBe(0); + }); + + it('returns an empty array of references when the external_service is null', () => { + expect(transformPushConnectorIdToReference(null).references.length).toBe(0); + }); + + it('returns an empty array of references when the connector_id is undefined', () => { + expect( + transformPushConnectorIdToReference({ connector_id: undefined }).references.length + ).toBe(0); + }); + + it('returns an empty array of references when the connector_id is null', () => { + expect( + transformPushConnectorIdToReference({ connector_id: undefined }).references.length + ).toBe(0); + }); + + it('returns an empty array of references when the connector_id is the none connector', () => { + expect( + transformPushConnectorIdToReference({ connector_id: noneConnectorId }).references.length + ).toBe(0); + }); + + it('returns an empty array of references when the connector_id is the none connector and other fields are defined', () => { + expect( + transformPushConnectorIdToReference({ + ...createExternalService(), + connector_id: noneConnectorId, + }).references.length + ).toBe(0); + }); + + it('returns the external_service connector', () => { + const transformedFields = transformPushConnectorIdToReference(createExternalService()); + expect(transformedFields.transformedPushConnector).toMatchInlineSnapshot(` + Object { + "external_service": Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + }, + } + `); + expect(transformedFields.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + }); +}); diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/utils.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/utils.ts new file mode 100644 index 0000000000000..0100a04cde679 --- /dev/null +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/utils.ts @@ -0,0 +1,73 @@ +/* + * 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. + */ + +/* eslint-disable @typescript-eslint/naming-convention */ + +import { noneConnectorId } from '../../../common'; +import { SavedObjectReference } from '../../../../../../src/core/server'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { + getNoneCaseConnector, + CONNECTOR_ID_REFERENCE_NAME, + PUSH_CONNECTOR_ID_REFERENCE_NAME, +} from '../../common'; + +export const transformConnectorIdToReference = (connector?: { + id?: string; +}): { transformedConnector: Record; references: SavedObjectReference[] } => { + const { id: connectorId, ...restConnector } = connector ?? {}; + + const references = createConnectorReference( + connectorId, + ACTION_SAVED_OBJECT_TYPE, + CONNECTOR_ID_REFERENCE_NAME + ); + + const { id: ignoreNoneId, ...restNoneConnector } = getNoneCaseConnector(); + const connectorFieldsToReturn = + connector && references.length > 0 ? restConnector : restNoneConnector; + + return { + transformedConnector: { + connector: connectorFieldsToReturn, + }, + references, + }; +}; + +const createConnectorReference = ( + id: string | null | undefined, + type: string, + name: string +): SavedObjectReference[] => { + return id && id !== noneConnectorId + ? [ + { + id, + type, + name, + }, + ] + : []; +}; + +export const transformPushConnectorIdToReference = ( + external_service?: { connector_id?: string | null } | null +): { transformedPushConnector: Record; references: SavedObjectReference[] } => { + const { connector_id: pushConnectorId, ...restExternalService } = external_service ?? {}; + + const references = createConnectorReference( + pushConnectorId, + ACTION_SAVED_OBJECT_TYPE, + PUSH_CONNECTOR_ID_REFERENCE_NAME + ); + + return { + transformedPushConnector: { external_service: external_service ? restExternalService : null }, + references, + }; +}; diff --git a/x-pack/plugins/cases/server/services/cases/index.test.ts b/x-pack/plugins/cases/server/services/cases/index.test.ts new file mode 100644 index 0000000000000..bf7eeda7e0e2e --- /dev/null +++ b/x-pack/plugins/cases/server/services/cases/index.test.ts @@ -0,0 +1,1167 @@ +/* + * 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. + */ + +/** + * This test file references connector_id and connector.id. The connector_id is a field within the external_service + * object. It holds the action connector's id that was used to push the case to the external service. The connector.id + * field also holds an action connector's id. This id is the currently configured connector for the case. The next + * time the case is pushed it will use this connector to push the case. The connector_id can be different from the + * connector.id. + */ + +import { + CaseAttributes, + CaseConnector, + CaseFullExternalService, + CASE_SAVED_OBJECT, +} from '../../../common'; +import { savedObjectsClientMock } from '../../../../../../src/core/server/mocks'; +import { + SavedObject, + SavedObjectReference, + SavedObjectsCreateOptions, + SavedObjectsFindResult, + SavedObjectsUpdateOptions, + SavedObjectsUpdateResponse, +} from 'kibana/server'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { loggerMock } from '@kbn/logging/target/mocks'; +import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { CasesService } from '.'; +import { + createESJiraConnector, + createJiraConnector, + ESCaseConnectorWithId, + createExternalService, + createSavedObjectReferences, + createCaseSavedObjectResponse, + basicCaseFields, +} from '../test_utils'; +import { ESCaseAttributes } from './types'; + +const createUpdateSOResponse = ({ + connector, + externalService, +}: { + connector?: ESCaseConnectorWithId; + externalService?: CaseFullExternalService; +} = {}): SavedObjectsUpdateResponse => { + const references: SavedObjectReference[] = createSavedObjectReferences({ + connector, + externalService, + }); + + let attributes: Partial = {}; + + if (connector) { + const { id, ...restConnector } = connector; + attributes = { ...attributes, connector: { ...restConnector } }; + } + + if (externalService) { + const { connector_id: id, ...restService } = externalService; + attributes = { ...attributes, external_service: { ...restService } }; + } else if (externalService === null) { + attributes = { ...attributes, external_service: null }; + } + + return { + type: CASE_SAVED_OBJECT, + id: '1', + attributes, + references, + }; +}; + +const createFindSO = ( + params: { + connector?: ESCaseConnectorWithId; + externalService?: CaseFullExternalService; + } = {} +): SavedObjectsFindResult => ({ + ...createCaseSavedObjectResponse(params), + score: 0, +}); + +const createSOFindResponse = (savedObjects: Array>) => ({ + saved_objects: savedObjects, + total: savedObjects.length, + per_page: savedObjects.length, + page: 1, +}); + +const createCaseUpdateParams = ( + connector?: CaseConnector, + externalService?: CaseFullExternalService +): Partial => ({ + ...(connector && { connector }), + ...(externalService && { external_service: externalService }), +}); + +const createCasePostParams = ( + connector: CaseConnector, + externalService?: CaseFullExternalService +): CaseAttributes => ({ + ...basicCaseFields, + connector, + ...(externalService ? { external_service: externalService } : { external_service: null }), +}); + +const createCasePatchParams = ({ + connector, + externalService, +}: { + connector?: CaseConnector; + externalService?: CaseFullExternalService; +} = {}): Partial => ({ + ...basicCaseFields, + connector, + ...(externalService && { external_service: externalService }), +}); + +describe('CasesService', () => { + const unsecuredSavedObjectsClient = savedObjectsClientMock.create(); + const mockLogger = loggerMock.create(); + + let service: CasesService; + + beforeEach(() => { + jest.resetAllMocks(); + service = new CasesService(mockLogger); + }); + + describe('transforms the external model to the Elasticsearch model', () => { + describe('patch', () => { + it('includes the passed in fields', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePostParams(createJiraConnector(), createExternalService()), + originalCase: {} as SavedObject, + }); + + const { + connector: ignoreConnector, + external_service: ignoreExternalService, + ...restUpdateAttributes + } = unsecuredSavedObjectsClient.update.mock.calls[0][2] as Partial; + expect(restUpdateAttributes).toMatchInlineSnapshot(` + Object { + "closed_at": null, + "closed_by": null, + "created_at": "2019-11-25T21:54:48.952Z", + "created_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + "description": "This is a brand new case of a bad meanie defacing data", + "owner": "securitySolution", + "settings": Object { + "syncAlerts": true, + }, + "status": "open", + "tags": Array [ + "defacement", + ], + "title": "Super Bad Security Issue", + "type": "individual", + "updated_at": "2019-11-25T21:54:48.952Z", + "updated_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('transforms the connector.fields to an array of key/value pairs', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePostParams(createJiraConnector(), createExternalService()), + originalCase: {} as SavedObject, + }); + + const { connector } = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + expect(connector?.fields).toMatchInlineSnapshot(` + Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ] + `); + }); + + it('preserves the connector fields but does not have the id', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePostParams(createJiraConnector(), createExternalService()), + originalCase: {} as SavedObject, + }); + + const { connector } = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + expect(connector).toMatchInlineSnapshot(` + Object { + "fields": Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ], + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('removes the connector id and adds it to the references', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(createJiraConnector()), + originalCase: {} as SavedObject, + }); + + const updateAttributes = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + expect(updateAttributes.connector).not.toHaveProperty('id'); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + + it('removes the external_service connector_id and adds it to the references', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePostParams(getNoneCaseConnector(), createExternalService()), + originalCase: {} as SavedObject, + }); + + const updateAttributes = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + expect(updateAttributes.external_service).not.toHaveProperty('connector_id'); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + + it('builds references for external service connector id, case connector id, and includes the existing references', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePostParams(createJiraConnector(), createExternalService()), + originalCase: { + references: [{ id: 'a', name: 'awesome', type: 'hello' }], + } as SavedObject, + }); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "a", + "name": "awesome", + "type": "hello", + }, + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + + it('builds references for connector_id and preserves the existing connector.id reference', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePatchParams({ externalService: createExternalService() }), + originalCase: { + references: [ + { id: '1', name: CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ], + } as SavedObject, + }); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + + it('preserves the external_service fields except for the connector_id', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCasePostParams(getNoneCaseConnector(), createExternalService()), + originalCase: {} as SavedObject, + }); + + const updateAttributes = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + expect(updateAttributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('creates an empty updatedAttributes when there is no connector or external_service as input', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(unsecuredSavedObjectsClient.update.mock.calls[0][2]).toMatchInlineSnapshot( + `Object {}` + ); + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toBeUndefined(); + }); + + it('creates a updatedAttributes field with the none connector', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(getNoneCaseConnector()), + originalCase: {} as SavedObject, + }); + + expect(unsecuredSavedObjectsClient.update.mock.calls[0][2]).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": Array [], + "name": "none", + "type": ".none", + }, + } + `); + }); + }); + + describe('post', () => { + it('creates a null external_service field when the attribute was null in the creation parameters', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams(createJiraConnector()), + id: '1', + }); + + const postAttributes = unsecuredSavedObjectsClient.create.mock + .calls[0][1] as CaseAttributes; + expect(postAttributes.external_service).toMatchInlineSnapshot(`null`); + }); + + it('includes the creation attributes excluding the connector.id and connector_id', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams(createJiraConnector(), createExternalService()), + id: '1', + }); + + const creationAttributes = unsecuredSavedObjectsClient.create.mock + .calls[0][1] as ESCaseAttributes; + expect(creationAttributes.connector).not.toHaveProperty('id'); + expect(creationAttributes.external_service).not.toHaveProperty('connector_id'); + expect(creationAttributes).toMatchInlineSnapshot(` + Object { + "closed_at": null, + "closed_by": null, + "connector": Object { + "fields": Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ], + "name": ".jira", + "type": ".jira", + }, + "created_at": "2019-11-25T21:54:48.952Z", + "created_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + "description": "This is a brand new case of a bad meanie defacing data", + "external_service": Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + }, + "owner": "securitySolution", + "settings": Object { + "syncAlerts": true, + }, + "status": "open", + "tags": Array [ + "defacement", + ], + "title": "Super Bad Security Issue", + "type": "individual", + "updated_at": "2019-11-25T21:54:48.952Z", + "updated_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + expect(unsecuredSavedObjectsClient.create.mock.calls[0][2]).toMatchInlineSnapshot(` + Object { + "id": "1", + "references": Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ], + } + `); + }); + + it('moves the connector.id and connector_id to the references', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams(createJiraConnector(), createExternalService()), + id: '1', + }); + + const creationOptions = unsecuredSavedObjectsClient.create.mock + .calls[0][2] as SavedObjectsCreateOptions; + expect(creationOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + + it('sets fields to an empty array when it is not included with the connector', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams( + createJiraConnector({ setFieldsToNull: true }), + createExternalService() + ), + id: '1', + }); + + const postAttributes = unsecuredSavedObjectsClient.create.mock + .calls[0][1] as CaseAttributes; + expect(postAttributes.connector.fields).toEqual([]); + }); + + it('does not create a reference for a none connector', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams(getNoneCaseConnector()), + id: '1', + }); + + const creationOptions = unsecuredSavedObjectsClient.create.mock + .calls[0][2] as SavedObjectsCreateOptions; + expect(creationOptions.references).toEqual([]); + }); + + it('does not create a reference for an external_service field that is null', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams(getNoneCaseConnector()), + id: '1', + }); + + const creationOptions = unsecuredSavedObjectsClient.create.mock + .calls[0][2] as SavedObjectsCreateOptions; + expect(creationOptions.references).toEqual([]); + }); + }); + }); + + describe('transforms the Elasticsearch model to the external model', () => { + describe('bulkPatch', () => { + it('formats the update saved object by including the passed in fields and transforming the connector.fields', async () => { + unsecuredSavedObjectsClient.bulkUpdate.mockReturnValue( + Promise.resolve({ + saved_objects: [ + createCaseSavedObjectResponse({ + connector: createESJiraConnector(), + externalService: createExternalService(), + }), + createCaseSavedObjectResponse({ + connector: createESJiraConnector({ id: '2' }), + externalService: createExternalService({ connector_id: '200' }), + }), + ], + }) + ); + + const res = await service.patchCases({ + unsecuredSavedObjectsClient, + cases: [ + { + caseId: '1', + updatedAttributes: createCasePostParams( + createJiraConnector(), + createExternalService() + ), + originalCase: {} as SavedObject, + }, + ], + }); + + expect(res.saved_objects[0].attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "id": "1", + "name": ".jira", + "type": ".jira", + } + `); + expect( + res.saved_objects[1].attributes.external_service?.connector_id + ).toMatchInlineSnapshot(`"200"`); + + expect(res.saved_objects[1].attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "id": "2", + "name": ".jira", + "type": ".jira", + } + `); + expect( + res.saved_objects[0].attributes.external_service?.connector_id + ).toMatchInlineSnapshot(`"100"`); + }); + }); + + describe('patch', () => { + it('returns an object with a none connector and without a reference when it was set to a none connector in the update', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateSOResponse({ connector: getNoneCaseConnector() })) + ); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + }, + } + `); + expect(res.references).toMatchInlineSnapshot(`Array []`); + }); + + it('returns an object with a null external service and without a reference when it was set to null in the update', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateSOResponse({ externalService: null })) + ); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes).toMatchInlineSnapshot(` + Object { + "external_service": null, + } + `); + expect(res.references).toMatchInlineSnapshot(`Array []`); + }); + + it('returns an empty object when neither the connector or external service was updated', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateSOResponse()) + ); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes).toMatchInlineSnapshot(`Object {}`); + expect(res.references).toMatchInlineSnapshot(`Array []`); + }); + + it('returns an undefined connector if it is not returned by the update', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res).toMatchInlineSnapshot(` + Object { + "attributes": Object {}, + } + `); + }); + + it('returns the default none connector when it cannot find the reference', async () => { + const { name, type, fields } = createESJiraConnector(); + const returnValue: SavedObjectsUpdateResponse = { + type: CASE_SAVED_OBJECT, + id: '1', + attributes: { + connector: { + name, + type, + fields, + }, + }, + version: '1', + references: undefined, + }; + + unsecuredSavedObjectsClient.update.mockReturnValue(Promise.resolve(returnValue)); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + + it('returns a null external service connector when it cannot find the reference', async () => { + const { connector_id: id, ...restExternalConnector } = createExternalService()!; + const returnValue: SavedObjectsUpdateResponse = { + type: CASE_SAVED_OBJECT, + id: '1', + attributes: { + external_service: restExternalConnector, + }, + version: '1', + references: undefined, + }; + + unsecuredSavedObjectsClient.update.mockReturnValue(Promise.resolve(returnValue)); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes.external_service?.connector_id).toBeNull(); + }); + + it('returns the saved object fields when it cannot find the reference for connector_id', async () => { + const { connector_id: id, ...restExternalConnector } = createExternalService()!; + const returnValue: SavedObjectsUpdateResponse = { + type: CASE_SAVED_OBJECT, + id: '1', + attributes: { + external_service: restExternalConnector, + }, + version: '1', + references: undefined, + }; + + unsecuredSavedObjectsClient.update.mockReturnValue(Promise.resolve(returnValue)); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res).toMatchInlineSnapshot(` + Object { + "attributes": Object { + "external_service": Object { + "connector_id": null, + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + }, + }, + "id": "1", + "references": undefined, + "type": "cases", + "version": "1", + } + `); + }); + + it('returns the connector.id after finding the reference', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateSOResponse({ connector: createESJiraConnector() })) + ); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "id": "1", + "name": ".jira", + "type": ".jira", + } + `); + expect(res.attributes.connector?.id).toMatchInlineSnapshot(`"1"`); + }); + + it('returns the external_service connector_id after finding the reference', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateSOResponse({ externalService: createExternalService() })) + ); + + const res = await service.patchCase({ + caseId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createCaseUpdateParams(), + originalCase: {} as SavedObject, + }); + + expect(res.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_id": "100", + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + expect(res.attributes.external_service?.connector_id).toMatchInlineSnapshot(`"100"`); + }); + }); + + describe('post', () => { + it('includes the connector.id and connector_id fields in the response', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve( + createCaseSavedObjectResponse({ + connector: createESJiraConnector(), + externalService: createExternalService(), + }) + ) + ); + + const res = await service.postNewCase({ + unsecuredSavedObjectsClient, + attributes: createCasePostParams(getNoneCaseConnector()), + id: '1', + }); + + expect(res.attributes.connector.id).toMatchInlineSnapshot(`"1"`); + expect(res.attributes.external_service?.connector_id).toMatchInlineSnapshot(`"100"`); + }); + }); + + describe('find', () => { + it('includes the connector.id and connector_id field in the response', async () => { + const findMockReturn = createSOFindResponse([ + createFindSO({ + connector: createESJiraConnector(), + externalService: createExternalService(), + }), + createFindSO(), + ]); + unsecuredSavedObjectsClient.find.mockReturnValue(Promise.resolve(findMockReturn)); + + const res = await service.findCases({ unsecuredSavedObjectsClient }); + expect(res.saved_objects[0].attributes.connector.id).toMatchInlineSnapshot(`"1"`); + expect( + res.saved_objects[0].attributes.external_service?.connector_id + ).toMatchInlineSnapshot(`"100"`); + }); + + it('includes the saved object find response fields in the result', async () => { + const findMockReturn = createSOFindResponse([ + createFindSO({ + connector: createESJiraConnector(), + externalService: createExternalService(), + }), + createFindSO(), + ]); + unsecuredSavedObjectsClient.find.mockReturnValue(Promise.resolve(findMockReturn)); + + const res = await service.findCases({ unsecuredSavedObjectsClient }); + const { saved_objects: ignored, ...findResponseFields } = res; + expect(findResponseFields).toMatchInlineSnapshot(` + Object { + "page": 1, + "per_page": 2, + "total": 2, + } + `); + }); + }); + + describe('bulkGet', () => { + it('includes the connector.id and connector_id fields in the response', async () => { + unsecuredSavedObjectsClient.bulkGet.mockReturnValue( + Promise.resolve({ + saved_objects: [ + createCaseSavedObjectResponse({ + connector: createESJiraConnector(), + externalService: createExternalService(), + }), + createCaseSavedObjectResponse({ + connector: createESJiraConnector({ id: '2' }), + externalService: createExternalService({ connector_id: '200' }), + }), + ], + }) + ); + + const res = await service.getCases({ unsecuredSavedObjectsClient, caseIds: ['a'] }); + + expect(res.saved_objects[0].attributes.connector.id).toMatchInlineSnapshot(`"1"`); + expect( + res.saved_objects[1].attributes.external_service?.connector_id + ).toMatchInlineSnapshot(`"200"`); + + expect(res.saved_objects[1].attributes.connector.id).toMatchInlineSnapshot(`"2"`); + expect( + res.saved_objects[1].attributes.external_service?.connector_id + ).toMatchInlineSnapshot(`"200"`); + }); + }); + + describe('get', () => { + it('includes the connector.id and connector_id fields in the response', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve( + createCaseSavedObjectResponse({ + connector: createESJiraConnector(), + externalService: createExternalService(), + }) + ) + ); + + const res = await service.getCase({ unsecuredSavedObjectsClient, id: 'a' }); + + expect(res.attributes.connector.id).toMatchInlineSnapshot(`"1"`); + expect(res.attributes.external_service?.connector_id).toMatchInlineSnapshot(`"100"`); + }); + + it('defaults to the none connector when the connector reference cannot be found', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve( + createCaseSavedObjectResponse({ externalService: createExternalService() }) + ) + ); + const res = await service.getCase({ unsecuredSavedObjectsClient, id: 'a' }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + + it('sets external services connector_id to null when the connector id cannot be found in the references', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve(createCaseSavedObjectResponse()) + ); + const res = await service.getCase({ unsecuredSavedObjectsClient, id: 'a' }); + + expect(res.attributes.external_service?.connector_id).toMatchInlineSnapshot(`null`); + }); + + it('includes the external services fields when the connector id cannot be found in the references', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve(createCaseSavedObjectResponse()) + ); + const res = await service.getCase({ unsecuredSavedObjectsClient, id: 'a' }); + + expect(res.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_id": null, + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('defaults to the none connector and null external_services when attributes is undefined', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve(({ + references: [ + { + id: '1', + name: CONNECTOR_ID_REFERENCE_NAME, + type: ACTION_SAVED_OBJECT_TYPE, + }, + ], + } as unknown) as SavedObject) + ); + const res = await service.getCase({ unsecuredSavedObjectsClient, id: 'a' }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + + expect(res.attributes.external_service).toMatchInlineSnapshot(`null`); + }); + + it('returns a null external_services when it is already null', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve({ + attributes: { external_service: null }, + } as SavedObject) + ); + const res = await service.getCase({ unsecuredSavedObjectsClient, id: 'a' }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + + expect(res.attributes.external_service).toMatchInlineSnapshot(`null`); + }); + }); + }); +}); diff --git a/x-pack/plugins/cases/server/services/cases/index.ts b/x-pack/plugins/cases/server/services/cases/index.ts index a0e4380f95640..72c2033f83535 100644 --- a/x-pack/plugins/cases/server/services/cases/index.ts +++ b/x-pack/plugins/cases/server/services/cases/index.ts @@ -14,6 +14,8 @@ import { SavedObjectsFindResponse, SavedObjectsBulkResponse, SavedObjectsFindResult, + SavedObjectsBulkUpdateResponse, + SavedObjectsUpdateResponse, } from 'kibana/server'; import type { estypes } from '@elastic/elasticsearch'; @@ -32,7 +34,6 @@ import { CommentAttributes, CommentType, ENABLE_CASE_CONNECTOR, - ESCaseAttributes, GetCaseIdsByAlertIdAggs, MAX_CONCURRENT_SEARCHES, MAX_DOCS_PER_PAGE, @@ -41,6 +42,7 @@ import { SubCaseAttributes, SubCaseResponse, User, + CaseAttributes, } from '../../../common'; import { defaultSortField, @@ -54,6 +56,15 @@ import { ClientArgs } from '..'; import { combineFilters } from '../../client/utils'; import { includeFieldsRequiredForAuthentication } from '../../authorization/utils'; import { EnsureSOAuthCallback } from '../../authorization'; +import { + transformSavedObjectToExternalModel, + transformAttributesToESModel, + transformUpdateResponseToExternalModel, + transformUpdateResponsesToExternalModels, + transformBulkResponseToExternalModel, + transformFindResponseToExternalModel, +} from './transform'; +import { ESCaseAttributes } from './types'; interface GetCaseIdsByAlertIdArgs extends ClientArgs { alertId: string; @@ -111,7 +122,7 @@ interface FindSubCasesStatusStats { } interface PostCaseArgs extends ClientArgs { - attributes: ESCaseAttributes; + attributes: CaseAttributes; id: string; } @@ -123,7 +134,8 @@ interface CreateSubCaseArgs extends ClientArgs { interface PatchCase { caseId: string; - updatedAttributes: Partial; + updatedAttributes: Partial; + originalCase: SavedObject; version?: string; } type PatchCaseArgs = PatchCase & ClientArgs; @@ -168,7 +180,7 @@ interface FindCommentsByAssociationArgs { } interface Collection { - case: SavedObjectsFindResult; + case: SavedObjectsFindResult; subCases?: SubCaseResponse[]; } @@ -713,10 +725,14 @@ export class CasesService { public async getCase({ unsecuredSavedObjectsClient, id: caseId, - }: GetCaseArgs): Promise> { + }: GetCaseArgs): Promise> { try { this.log.debug(`Attempting to GET case ${caseId}`); - return await unsecuredSavedObjectsClient.get(CASE_SAVED_OBJECT, caseId); + const caseSavedObject = await unsecuredSavedObjectsClient.get( + CASE_SAVED_OBJECT, + caseId + ); + return transformSavedObjectToExternalModel(caseSavedObject); } catch (error) { this.log.error(`Error on GET case ${caseId}: ${error}`); throw error; @@ -753,12 +769,13 @@ export class CasesService { public async getCases({ unsecuredSavedObjectsClient, caseIds, - }: GetCasesArgs): Promise> { + }: GetCasesArgs): Promise> { try { this.log.debug(`Attempting to GET cases ${caseIds.join(', ')}`); - return await unsecuredSavedObjectsClient.bulkGet( + const cases = await unsecuredSavedObjectsClient.bulkGet( caseIds.map((caseId) => ({ type: CASE_SAVED_OBJECT, id: caseId })) ); + return transformBulkResponseToExternalModel(cases); } catch (error) { this.log.error(`Error on GET cases ${caseIds.join(', ')}: ${error}`); throw error; @@ -768,14 +785,15 @@ export class CasesService { public async findCases({ unsecuredSavedObjectsClient, options, - }: FindCasesArgs): Promise> { + }: FindCasesArgs): Promise> { try { this.log.debug(`Attempting to find cases`); - return await unsecuredSavedObjectsClient.find({ + const cases = await unsecuredSavedObjectsClient.find({ sortField: defaultSortField, ...options, type: CASE_SAVED_OBJECT, }); + return transformFindResponseToExternalModel(cases); } catch (error) { this.log.error(`Error on find cases: ${error}`); throw error; @@ -1041,14 +1059,20 @@ export class CasesService { } } - public async postNewCase({ unsecuredSavedObjectsClient, attributes, id }: PostCaseArgs) { + public async postNewCase({ + unsecuredSavedObjectsClient, + attributes, + id, + }: PostCaseArgs): Promise> { try { this.log.debug(`Attempting to POST a new case`); - return await unsecuredSavedObjectsClient.create( + const transformedAttributes = transformAttributesToESModel(attributes); + const createdCase = await unsecuredSavedObjectsClient.create( CASE_SAVED_OBJECT, - attributes, - { id } + transformedAttributes.attributes, + { id, references: transformedAttributes.referenceHandler.build() } ); + return transformSavedObjectToExternalModel(createdCase); } catch (error) { this.log.error(`Error on POST a new case: ${error}`); throw error; @@ -1059,33 +1083,52 @@ export class CasesService { unsecuredSavedObjectsClient, caseId, updatedAttributes, + originalCase, version, - }: PatchCaseArgs) { + }: PatchCaseArgs): Promise> { try { this.log.debug(`Attempting to UPDATE case ${caseId}`); - return await unsecuredSavedObjectsClient.update( + const transformedAttributes = transformAttributesToESModel(updatedAttributes); + + const updatedCase = await unsecuredSavedObjectsClient.update( CASE_SAVED_OBJECT, caseId, - { ...updatedAttributes }, - { version } + transformedAttributes.attributes, + { + version, + references: transformedAttributes.referenceHandler.build(originalCase.references), + } ); + + return transformUpdateResponseToExternalModel(updatedCase); } catch (error) { this.log.error(`Error on UPDATE case ${caseId}: ${error}`); throw error; } } - public async patchCases({ unsecuredSavedObjectsClient, cases }: PatchCasesArgs) { + public async patchCases({ + unsecuredSavedObjectsClient, + cases, + }: PatchCasesArgs): Promise> { try { this.log.debug(`Attempting to UPDATE case ${cases.map((c) => c.caseId).join(', ')}`); - return await unsecuredSavedObjectsClient.bulkUpdate( - cases.map((c) => ({ + + const bulkUpdate = cases.map(({ caseId, updatedAttributes, version, originalCase }) => { + const { attributes, referenceHandler } = transformAttributesToESModel(updatedAttributes); + return { type: CASE_SAVED_OBJECT, - id: c.caseId, - attributes: c.updatedAttributes, - version: c.version, - })) + id: caseId, + attributes, + references: referenceHandler.build(originalCase.references), + version, + }; + }); + + const updatedCases = await unsecuredSavedObjectsClient.bulkUpdate( + bulkUpdate ); + return transformUpdateResponsesToExternalModels(updatedCases); } catch (error) { this.log.error(`Error on UPDATE case ${cases.map((c) => c.caseId).join(', ')}: ${error}`); throw error; diff --git a/x-pack/plugins/cases/server/services/cases/transform.test.ts b/x-pack/plugins/cases/server/services/cases/transform.test.ts new file mode 100644 index 0000000000000..96312d00b37dd --- /dev/null +++ b/x-pack/plugins/cases/server/services/cases/transform.test.ts @@ -0,0 +1,414 @@ +/* + * 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 { + createCaseSavedObjectResponse, + createESJiraConnector, + createExternalService, + createJiraConnector, +} from '../test_utils'; +import { + transformAttributesToESModel, + transformSavedObjectToExternalModel, + transformUpdateResponseToExternalModel, +} from './transform'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { ConnectorTypes } from '../../../common'; +import { + getNoneCaseConnector, + CONNECTOR_ID_REFERENCE_NAME, + PUSH_CONNECTOR_ID_REFERENCE_NAME, +} from '../../common'; + +describe('case transforms', () => { + describe('transformUpdateResponseToExternalModel', () => { + it('does not return the connector field if it is undefined', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: {}, + references: undefined, + }).attributes + ).not.toHaveProperty('connector'); + }); + + it('does not return the external_service field if it is undefined', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: {}, + references: undefined, + }).attributes + ).not.toHaveProperty('external_service'); + }); + + it('return a null external_service field if it is null', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + external_service: null, + }, + references: undefined, + }).attributes.external_service + ).toBeNull(); + }); + + it('return a null external_service.connector_id field if it is none', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + external_service: createExternalService({ connector_id: 'none' }), + }, + references: undefined, + }).attributes.external_service?.connector_id + ).toBeNull(); + }); + + it('return the external_service fields if it is populated', () => { + const { connector_id: ignore, ...restExternalService } = createExternalService()!; + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + external_service: restExternalService, + }, + references: undefined, + }).attributes.external_service + ).toMatchInlineSnapshot(` + Object { + "connector_id": null, + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('populates the connector_id field when it finds a reference', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + external_service: createExternalService(), + }, + references: [ + { id: '1', name: PUSH_CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ], + }).attributes.external_service?.connector_id + ).toMatchInlineSnapshot(`"1"`); + }); + + it('populates the external_service fields when it finds a reference', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + external_service: createExternalService(), + }, + references: [ + { id: '1', name: PUSH_CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ], + }).attributes.external_service + ).toMatchInlineSnapshot(` + Object { + "connector_id": "1", + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('populates the connector fields when it finds a reference', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + connector: { + name: ConnectorTypes.jira, + type: ConnectorTypes.jira, + fields: [{ key: 'issueType', value: 'bug' }], + }, + }, + references: [ + { id: '1', name: CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ], + }).attributes.connector + ).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + }, + "id": "1", + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('returns the none connector when it cannot find the reference', () => { + expect( + transformUpdateResponseToExternalModel({ + type: 'a', + id: '1', + attributes: { + connector: { + name: ConnectorTypes.jira, + type: ConnectorTypes.jira, + fields: [{ key: 'issueType', value: 'bug' }], + }, + }, + references: undefined, + }).attributes.connector + ).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + }); + + describe('transformAttributesToESModel', () => { + it('does not return the external_service field when it is undefined', () => { + expect( + transformAttributesToESModel({ + external_service: undefined, + }).attributes + ).not.toHaveProperty('external_service'); + }); + + it('creates an undefined reference when external_service is undefined and the original reference is undefined', () => { + expect( + transformAttributesToESModel({ + external_service: undefined, + }).referenceHandler.build() + ).toBeUndefined(); + }); + + it('returns a null external_service when it is null', () => { + expect( + transformAttributesToESModel({ + external_service: null, + }).attributes.external_service + ).toBeNull(); + }); + + it('creates an undefined reference when external_service is null and the original reference is undefined', () => { + expect( + transformAttributesToESModel({ + external_service: null, + }).referenceHandler.build() + ).toBeUndefined(); + }); + + it('returns the external_service fields except for the connector_id', () => { + const transformedAttributes = transformAttributesToESModel({ + external_service: createExternalService(), + }); + + expect(transformedAttributes.attributes).toMatchInlineSnapshot(` + Object { + "external_service": Object { + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + }, + } + `); + expect(transformedAttributes.attributes.external_service).not.toHaveProperty('connector_id'); + expect(transformedAttributes.referenceHandler.build()).toMatchInlineSnapshot(` + Array [ + Object { + "id": "100", + "name": "pushConnectorId", + "type": "action", + }, + ] + `); + }); + + it('creates an empty references array to delete the connector_id when connector_id is null and the original references is undefined', () => { + const transformedAttributes = transformAttributesToESModel({ + external_service: createExternalService({ connector_id: null }), + }); + + expect(transformedAttributes.referenceHandler.build()).toEqual([]); + }); + + it('does not return the connector when it is undefined', () => { + expect(transformAttributesToESModel({ connector: undefined }).attributes).not.toHaveProperty( + 'connector' + ); + }); + + it('constructs an undefined reference when the connector is undefined and the original reference is undefined', () => { + expect( + transformAttributesToESModel({ connector: undefined }).referenceHandler.build() + ).toBeUndefined(); + }); + + it('returns a jira connector', () => { + const transformedAttributes = transformAttributesToESModel({ + connector: createJiraConnector(), + }); + + expect(transformedAttributes.attributes).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ], + "name": ".jira", + "type": ".jira", + }, + } + `); + expect(transformedAttributes.attributes.connector).not.toHaveProperty('id'); + expect(transformedAttributes.referenceHandler.build()).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + + it('returns a none connector without a reference', () => { + const transformedAttributes = transformAttributesToESModel({ + connector: getNoneCaseConnector(), + }); + + expect(transformedAttributes.attributes).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": Array [], + "name": "none", + "type": ".none", + }, + } + `); + expect(transformedAttributes.attributes.connector).not.toHaveProperty('id'); + expect(transformedAttributes.referenceHandler.build()).toEqual([]); + }); + }); + + describe('transformSavedObjectToExternalModel', () => { + it('returns the default none connector when it cannot find the reference', () => { + expect( + transformSavedObjectToExternalModel( + createCaseSavedObjectResponse({ connector: getNoneCaseConnector() }) + ).attributes.connector + ).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + + it('returns a jira connector', () => { + expect( + transformSavedObjectToExternalModel( + createCaseSavedObjectResponse({ connector: createESJiraConnector() }) + ).attributes.connector + ).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "id": "1", + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('sets external_service to null when it is null', () => { + expect( + transformSavedObjectToExternalModel( + createCaseSavedObjectResponse({ externalService: null }) + ).attributes.external_service + ).toBeNull(); + }); + + it('sets external_service.connector_id to null when a reference cannot be found', () => { + const transformedSO = transformSavedObjectToExternalModel( + createCaseSavedObjectResponse({ + externalService: createExternalService({ connector_id: null }), + }) + ); + + expect(transformedSO.attributes.external_service?.connector_id).toBeNull(); + expect(transformedSO.attributes.external_service).toMatchInlineSnapshot(` + Object { + "connector_id": null, + "connector_name": ".jira", + "external_id": "100", + "external_title": "awesome", + "external_url": "http://www.google.com", + "pushed_at": "2019-11-25T21:54:48.952Z", + "pushed_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + }); +}); diff --git a/x-pack/plugins/cases/server/services/cases/transform.ts b/x-pack/plugins/cases/server/services/cases/transform.ts new file mode 100644 index 0000000000000..00b20a6290860 --- /dev/null +++ b/x-pack/plugins/cases/server/services/cases/transform.ts @@ -0,0 +1,208 @@ +/* + * 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. + */ + +/* eslint-disable @typescript-eslint/naming-convention */ + +import { + SavedObject, + SavedObjectReference, + SavedObjectsBulkResponse, + SavedObjectsBulkUpdateResponse, + SavedObjectsFindResponse, + SavedObjectsUpdateResponse, +} from 'kibana/server'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { ESCaseAttributes, ExternalServicesWithoutConnectorId } from './types'; +import { CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { CaseAttributes, CaseFullExternalService } from '../../../common'; +import { + findConnectorIdReference, + transformFieldsToESModel, + transformESConnectorOrUseDefault, + transformESConnectorToExternalModel, +} from '../transform'; +import { ConnectorReferenceHandler } from '../connector_reference_handler'; + +export function transformUpdateResponsesToExternalModels( + response: SavedObjectsBulkUpdateResponse +): SavedObjectsBulkUpdateResponse { + return { + ...response, + saved_objects: response.saved_objects.map((so) => ({ + ...so, + ...transformUpdateResponseToExternalModel(so), + })), + }; +} + +export function transformUpdateResponseToExternalModel( + updatedCase: SavedObjectsUpdateResponse +): SavedObjectsUpdateResponse { + const { connector, external_service, ...restUpdateAttributes } = updatedCase.attributes ?? {}; + + const transformedConnector = transformESConnectorToExternalModel({ + // if the saved object had an error the attributes field will not exist + connector, + references: updatedCase.references, + referenceName: CONNECTOR_ID_REFERENCE_NAME, + }); + + let externalService: CaseFullExternalService | null | undefined; + + // if external_service is not defined then we don't want to include it in the response since it wasn't passed it as an + // attribute to update + if (external_service !== undefined) { + externalService = transformESExternalService(external_service, updatedCase.references); + } + + return { + ...updatedCase, + attributes: { + ...restUpdateAttributes, + ...(transformedConnector && { connector: transformedConnector }), + // if externalService is null that means we intentionally updated it to null within ES so return that as a valid value + ...(externalService !== undefined && { external_service: externalService }), + }, + }; +} + +export function transformAttributesToESModel( + caseAttributes: CaseAttributes +): { + attributes: ESCaseAttributes; + referenceHandler: ConnectorReferenceHandler; +}; +export function transformAttributesToESModel( + caseAttributes: Partial +): { + attributes: Partial; + referenceHandler: ConnectorReferenceHandler; +}; +export function transformAttributesToESModel( + caseAttributes: Partial +): { + attributes: Partial; + referenceHandler: ConnectorReferenceHandler; +} { + const { connector, external_service, ...restAttributes } = caseAttributes; + const { connector_id: pushConnectorId, ...restExternalService } = external_service ?? {}; + + const transformedConnector = { + ...(connector && { + connector: { + name: connector.name, + type: connector.type, + fields: transformFieldsToESModel(connector), + }, + }), + }; + + const transformedExternalService = { + ...(external_service + ? { external_service: restExternalService } + : external_service === null + ? { external_service: null } + : {}), + }; + + return { + attributes: { + ...restAttributes, + ...transformedConnector, + ...transformedExternalService, + }, + referenceHandler: buildReferenceHandler(connector?.id, pushConnectorId), + }; +} + +function buildReferenceHandler( + connectorId?: string, + pushConnectorId?: string | null +): ConnectorReferenceHandler { + return new ConnectorReferenceHandler([ + { id: connectorId, name: CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + { id: pushConnectorId, name: PUSH_CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ]); +} + +/** + * Until Kibana uses typescript 4.3 or higher we'll have to keep these functions separate instead of using an overload + * definition like this: + * + * export function transformArrayResponseToExternalModel( + * response: SavedObjectsBulkResponse | SavedObjectsFindResponse + * ): SavedObjectsBulkResponse | SavedObjectsFindResponse { + * + * See this issue for more details: https://stackoverflow.com/questions/49510832/typescript-how-to-map-over-union-array-type + */ + +export function transformBulkResponseToExternalModel( + response: SavedObjectsBulkResponse +): SavedObjectsBulkResponse { + return { + ...response, + saved_objects: response.saved_objects.map((so) => ({ + ...so, + ...transformSavedObjectToExternalModel(so), + })), + }; +} + +export function transformFindResponseToExternalModel( + response: SavedObjectsFindResponse +): SavedObjectsFindResponse { + return { + ...response, + saved_objects: response.saved_objects.map((so) => ({ + ...so, + ...transformSavedObjectToExternalModel(so), + })), + }; +} + +export function transformSavedObjectToExternalModel( + caseSavedObject: SavedObject +): SavedObject { + const connector = transformESConnectorOrUseDefault({ + // if the saved object had an error the attributes field will not exist + connector: caseSavedObject.attributes?.connector, + references: caseSavedObject.references, + referenceName: CONNECTOR_ID_REFERENCE_NAME, + }); + + const externalService = transformESExternalService( + caseSavedObject.attributes?.external_service, + caseSavedObject.references + ); + + return { + ...caseSavedObject, + attributes: { + ...caseSavedObject.attributes, + connector, + external_service: externalService, + }, + }; +} + +function transformESExternalService( + // this type needs to match that of CaseFullExternalService except that it does not include the connector_id, see: x-pack/plugins/cases/common/api/cases/case.ts + // that's why it can be null here + externalService: ExternalServicesWithoutConnectorId | null | undefined, + references: SavedObjectReference[] | undefined +): CaseFullExternalService | null { + const connectorIdRef = findConnectorIdReference(PUSH_CONNECTOR_ID_REFERENCE_NAME, references); + + if (!externalService) { + return null; + } + + return { + ...externalService, + connector_id: connectorIdRef?.id ?? null, + }; +} diff --git a/x-pack/plugins/cases/server/services/cases/types.ts b/x-pack/plugins/cases/server/services/cases/types.ts new file mode 100644 index 0000000000000..55c736b032590 --- /dev/null +++ b/x-pack/plugins/cases/server/services/cases/types.ts @@ -0,0 +1,32 @@ +/* + * 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 * as rt from 'io-ts'; +import { CaseAttributes, CaseExternalServiceBasicRt } from '../../../common'; +import { ESCaseConnector } from '..'; + +/** + * This type should only be used within the cases service and its helper functions (e.g. the transforms). + * + * The type represents how the external services portion of the object will be layed out when stored in ES. The external_service will have its + * connector_id field removed and placed within the references field. + */ +export type ExternalServicesWithoutConnectorId = Omit< + rt.TypeOf, + 'connector_id' +>; + +/** + * This type should only be used within the cases service and its helper functions (e.g. the transforms). + * + * The type represents how the Cases object will be layed out in ES. It will not have connector.id or external_service.connector_id. + * Instead those fields will be transformed into the references field. + */ +export type ESCaseAttributes = Omit & { + connector: ESCaseConnector; + external_service: ExternalServicesWithoutConnectorId | null; +}; diff --git a/x-pack/plugins/cases/server/services/configure/index.test.ts b/x-pack/plugins/cases/server/services/configure/index.test.ts new file mode 100644 index 0000000000000..199b541d49f98 --- /dev/null +++ b/x-pack/plugins/cases/server/services/configure/index.test.ts @@ -0,0 +1,722 @@ +/* + * 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 { + CaseConnector, + CasesConfigureAttributes, + CasesConfigurePatch, + CASE_CONFIGURE_SAVED_OBJECT, + ConnectorTypes, + SECURITY_SOLUTION_OWNER, +} from '../../../common'; +import { savedObjectsClientMock } from '../../../../../../src/core/server/mocks'; +import { + SavedObject, + SavedObjectReference, + SavedObjectsCreateOptions, + SavedObjectsFindResult, + SavedObjectsUpdateOptions, + SavedObjectsUpdateResponse, +} from 'kibana/server'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { loggerMock } from '@kbn/logging/target/mocks'; +import { CaseConfigureService } from '.'; +import { ESCasesConfigureAttributes } from './types'; +import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { createESJiraConnector, createJiraConnector, ESCaseConnectorWithId } from '../test_utils'; + +const basicConfigFields = { + closure_type: 'close-by-pushing' as const, + owner: SECURITY_SOLUTION_OWNER, + created_at: '2020-04-09T09:43:51.778Z', + created_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + updated_at: '2020-04-09T09:43:51.778Z', + updated_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, +}; + +const createConfigUpdateParams = ( + connector?: CaseConnector +): Partial => ({ + connector, +}); + +const createConfigPostParams = (connector: CaseConnector): CasesConfigureAttributes => ({ + ...basicConfigFields, + connector, +}); + +const createUpdateConfigSO = ( + connector?: ESCaseConnectorWithId +): SavedObjectsUpdateResponse => { + const references: SavedObjectReference[] = + connector && connector.id !== 'none' + ? [ + { + id: connector.id, + name: CONNECTOR_ID_REFERENCE_NAME, + type: ACTION_SAVED_OBJECT_TYPE, + }, + ] + : []; + + return { + type: CASE_CONFIGURE_SAVED_OBJECT, + id: '1', + attributes: { + connector: connector + ? { name: connector.name, type: connector.type, fields: connector.fields } + : undefined, + }, + version: '1', + references, + }; +}; + +const createConfigSO = ( + connector?: ESCaseConnectorWithId +): SavedObject => { + const references: SavedObjectReference[] = connector + ? [ + { + id: connector.id, + name: CONNECTOR_ID_REFERENCE_NAME, + type: ACTION_SAVED_OBJECT_TYPE, + }, + ] + : []; + + const formattedConnector = { + type: connector?.type ?? ConnectorTypes.jira, + name: connector?.name ?? ConnectorTypes.jira, + fields: connector?.fields ?? null, + }; + + return { + type: CASE_CONFIGURE_SAVED_OBJECT, + id: '1', + attributes: { + ...basicConfigFields, + // if connector is null we'll default this to an incomplete jira value because the service + // should switch it to a none connector when the id can't be found in the references array + connector: formattedConnector, + }, + references, + }; +}; + +const createConfigSOPromise = ( + connector?: ESCaseConnectorWithId +): Promise> => Promise.resolve(createConfigSO(connector)); + +const createConfigFindSO = ( + connector?: ESCaseConnectorWithId +): SavedObjectsFindResult => ({ + ...createConfigSO(connector), + score: 0, +}); + +const createSOFindResponse = ( + savedObjects: Array> +) => ({ + saved_objects: savedObjects, + total: savedObjects.length, + per_page: savedObjects.length, + page: 1, +}); + +describe('CaseConfigureService', () => { + const unsecuredSavedObjectsClient = savedObjectsClientMock.create(); + const mockLogger = loggerMock.create(); + + let service: CaseConfigureService; + + beforeEach(() => { + jest.resetAllMocks(); + service = new CaseConfigureService(mockLogger); + }); + + describe('transforms the external model to the Elasticsearch model', () => { + describe('patch', () => { + it('creates the update attributes with the fields that were passed in', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigPostParams(createJiraConnector()), + originalConfiguration: {} as SavedObject, + }); + + const { connector: ignoreConnector, ...restUpdateAttributes } = unsecuredSavedObjectsClient + .update.mock.calls[0][2] as Partial; + + expect(restUpdateAttributes).toMatchInlineSnapshot(` + Object { + "closure_type": "close-by-pushing", + "created_at": "2020-04-09T09:43:51.778Z", + "created_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + "owner": "securitySolution", + "updated_at": "2020-04-09T09:43:51.778Z", + "updated_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('transforms the connector.fields to an array of key/value pairs', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigPostParams(createJiraConnector()), + originalConfiguration: {} as SavedObject, + }); + + const { connector } = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + + expect(connector?.fields).toMatchInlineSnapshot(` + Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ] + `); + }); + + it('preserves the connector fields but does not include the id', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigPostParams(createJiraConnector()), + originalConfiguration: {} as SavedObject, + }); + + const { connector } = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + + expect(connector).toMatchInlineSnapshot(` + Object { + "fields": Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ], + "name": ".jira", + "type": ".jira", + } + `); + expect(connector).not.toHaveProperty('id'); + }); + + it('moves the connector.id to the references', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigPostParams(createJiraConnector()), + originalConfiguration: {} as SavedObject, + }); + + const updateAttributes = unsecuredSavedObjectsClient.update.mock + .calls[0][2] as Partial; + + expect(updateAttributes.connector).not.toHaveProperty('id'); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + + it('moves the connector.id to the references and includes the existing references', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigPostParams(createJiraConnector()), + originalConfiguration: { + references: [{ id: '123', name: 'awesome', type: 'hello' }], + } as SavedObject, + }); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "123", + "name": "awesome", + "type": "hello", + }, + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + + it('does not remove the connector.id reference when the update attributes do not include it', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(), + originalConfiguration: { + references: [ + { id: '123', name: CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ], + } as SavedObject, + }); + + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toMatchInlineSnapshot(` + Array [ + Object { + "id": "123", + "name": "connectorId", + "type": "action", + }, + ] + `); + }); + + it('creates an empty update object and null reference when there is no connector', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(), + originalConfiguration: {} as SavedObject, + }); + + expect(unsecuredSavedObjectsClient.update.mock.calls[0][2]).toMatchInlineSnapshot( + `Object {}` + ); + expect(unsecuredSavedObjectsClient.update.mock.calls[0][3]).toMatchInlineSnapshot(` + Object { + "references": undefined, + } + `); + }); + + it('creates an update object with the none connector', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(getNoneCaseConnector()), + originalConfiguration: {} as SavedObject, + }); + + expect(unsecuredSavedObjectsClient.update.mock.calls[0][2]).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": Array [], + "name": "none", + "type": ".none", + }, + } + `); + const updateOptions = unsecuredSavedObjectsClient.update.mock + .calls[0][3] as SavedObjectsUpdateOptions; + expect(updateOptions.references).toEqual([]); + }); + }); + + describe('post', () => { + it('includes the creation attributes excluding the connector.id field', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.post({ + unsecuredSavedObjectsClient, + attributes: createConfigPostParams(createJiraConnector()), + id: '1', + }); + + const creationAttributes = unsecuredSavedObjectsClient.create.mock + .calls[0][1] as ESCasesConfigureAttributes; + expect(creationAttributes.connector).not.toHaveProperty('id'); + expect(creationAttributes).toMatchInlineSnapshot(` + Object { + "closure_type": "close-by-pushing", + "connector": Object { + "fields": Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ], + "name": ".jira", + "type": ".jira", + }, + "created_at": "2020-04-09T09:43:51.778Z", + "created_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + "owner": "securitySolution", + "updated_at": "2020-04-09T09:43:51.778Z", + "updated_by": Object { + "email": "testemail@elastic.co", + "full_name": "elastic", + "username": "elastic", + }, + } + `); + }); + + it('moves the connector.id to the references', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.post({ + unsecuredSavedObjectsClient, + attributes: createConfigPostParams(createJiraConnector()), + id: '1', + }); + + expect(unsecuredSavedObjectsClient.create.mock.calls[0][2]).toMatchInlineSnapshot(` + Object { + "id": "1", + "references": Array [ + Object { + "id": "1", + "name": "connectorId", + "type": "action", + }, + ], + } + `); + }); + + it('sets connector.fields to an empty array when it is not included', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.post({ + unsecuredSavedObjectsClient, + attributes: createConfigPostParams(createJiraConnector({ setFieldsToNull: true })), + id: '1', + }); + + const postAttributes = unsecuredSavedObjectsClient.create.mock + .calls[0][1] as CasesConfigureAttributes; + expect(postAttributes.connector).toMatchInlineSnapshot(` + Object { + "fields": Array [], + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('does not create a reference for a none connector', async () => { + unsecuredSavedObjectsClient.create.mockReturnValue( + Promise.resolve({} as SavedObject) + ); + + await service.post({ + unsecuredSavedObjectsClient, + attributes: createConfigPostParams(getNoneCaseConnector()), + id: '1', + }); + + const creationOptions = unsecuredSavedObjectsClient.create.mock + .calls[0][2] as SavedObjectsCreateOptions; + expect(creationOptions.references).toEqual([]); + }); + }); + }); + + describe('transform the Elasticsearch model to the external model', () => { + describe('patch', () => { + it('returns an object with a none connector and without a reference', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateConfigSO(getNoneCaseConnector())) + ); + + const res = await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(), + originalConfiguration: {} as SavedObject, + }); + + expect(res.attributes).toMatchInlineSnapshot(` + Object { + "connector": Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + }, + } + `); + expect(res.references).toMatchInlineSnapshot(`Array []`); + }); + + it('returns an undefined connector if it is not returned by the update', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve({} as SavedObjectsUpdateResponse) + ); + + const res = await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(), + originalConfiguration: {} as SavedObject, + }); + + expect(res).toMatchInlineSnapshot(` + Object { + "attributes": Object {}, + } + `); + }); + + it('returns the default none connector when it cannot find the reference', async () => { + const { name, type, fields } = createESJiraConnector(); + const returnValue: SavedObjectsUpdateResponse = { + type: CASE_CONFIGURE_SAVED_OBJECT, + id: '1', + attributes: { + connector: { + name, + type, + fields, + }, + }, + version: '1', + references: undefined, + }; + + unsecuredSavedObjectsClient.update.mockReturnValue(Promise.resolve(returnValue)); + + const res = await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(), + originalConfiguration: {} as SavedObject, + }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + + it('returns a jira connector', async () => { + unsecuredSavedObjectsClient.update.mockReturnValue( + Promise.resolve(createUpdateConfigSO(createESJiraConnector())) + ); + + const res = await service.patch({ + configurationId: '1', + unsecuredSavedObjectsClient, + updatedAttributes: createConfigUpdateParams(), + originalConfiguration: {} as SavedObject, + }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "id": "1", + "name": ".jira", + "type": ".jira", + } + `); + }); + }); + + describe('find', () => { + it('includes the id field in the response', async () => { + const findMockReturn = createSOFindResponse([ + createConfigFindSO(createESJiraConnector()), + createConfigFindSO(), + ]); + unsecuredSavedObjectsClient.find.mockReturnValue(Promise.resolve(findMockReturn)); + + const res = await service.find({ unsecuredSavedObjectsClient }); + expect(res.saved_objects[0].attributes.connector.id).toMatchInlineSnapshot(`"1"`); + }); + + it('includes the saved object find response fields in the result', async () => { + const findMockReturn = createSOFindResponse([ + createConfigFindSO(createESJiraConnector()), + createConfigFindSO(), + ]); + unsecuredSavedObjectsClient.find.mockReturnValue(Promise.resolve(findMockReturn)); + + const res = await service.find({ unsecuredSavedObjectsClient }); + const { saved_objects: ignored, ...findResponseFields } = res; + expect(findResponseFields).toMatchInlineSnapshot(` + Object { + "page": 1, + "per_page": 2, + "total": 2, + } + `); + }); + + it('defaults to the none connector when the id cannot be found in the references', async () => { + const findMockReturn = createSOFindResponse([ + createConfigFindSO(createESJiraConnector()), + createConfigFindSO(), + ]); + unsecuredSavedObjectsClient.find.mockReturnValue(Promise.resolve(findMockReturn)); + + const res = await service.find({ unsecuredSavedObjectsClient }); + expect(res.saved_objects[1].attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + }); + + describe('get', () => { + it('includes the id field in the response', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + createConfigSOPromise(createESJiraConnector()) + ); + const res = await service.get({ unsecuredSavedObjectsClient, configurationId: '1' }); + + expect(res.attributes.connector.id).toMatchInlineSnapshot(`"1"`); + }); + + it('defaults to the none connector when the connector reference cannot be found', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue(createConfigSOPromise()); + const res = await service.get({ unsecuredSavedObjectsClient, configurationId: '1' }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + + it('defaults to the none connector when attributes is undefined', async () => { + unsecuredSavedObjectsClient.get.mockReturnValue( + Promise.resolve(({ + references: [ + { + id: '1', + name: CONNECTOR_ID_REFERENCE_NAME, + type: ACTION_SAVED_OBJECT_TYPE, + }, + ], + } as unknown) as SavedObject) + ); + const res = await service.get({ unsecuredSavedObjectsClient, configurationId: '1' }); + + expect(res.attributes.connector).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + }); + }); +}); diff --git a/x-pack/plugins/cases/server/services/configure/index.ts b/x-pack/plugins/cases/server/services/configure/index.ts index 348bff954b73e..a25818f4ff593 100644 --- a/x-pack/plugins/cases/server/services/configure/index.ts +++ b/x-pack/plugins/cases/server/services/configure/index.ts @@ -5,10 +5,28 @@ * 2.0. */ -import { Logger, SavedObjectsClientContract } from 'kibana/server'; +import { + Logger, + SavedObject, + SavedObjectsClientContract, + SavedObjectsFindResponse, + SavedObjectsUpdateResponse, +} from 'kibana/server'; -import { SavedObjectFindOptionsKueryNode } from '../../common'; -import { ESCasesConfigureAttributes, CASE_CONFIGURE_SAVED_OBJECT } from '../../../common'; +import { SavedObjectFindOptionsKueryNode, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; +import { + CASE_CONFIGURE_SAVED_OBJECT, + CasesConfigureAttributes, + CasesConfigurePatch, +} from '../../../common'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; +import { + transformFieldsToESModel, + transformESConnectorToExternalModel, + transformESConnectorOrUseDefault, +} from '../transform'; +import { ConnectorReferenceHandler } from '../connector_reference_handler'; +import { ESCasesConfigureAttributes } from './types'; interface ClientArgs { unsecuredSavedObjectsClient: SavedObjectsClientContract; @@ -22,13 +40,14 @@ interface FindCaseConfigureArgs extends ClientArgs { } interface PostCaseConfigureArgs extends ClientArgs { - attributes: ESCasesConfigureAttributes; + attributes: CasesConfigureAttributes; id: string; } interface PatchCaseConfigureArgs extends ClientArgs { configurationId: string; - updatedAttributes: Partial; + updatedAttributes: Partial; + originalConfiguration: SavedObject; } export class CaseConfigureService { @@ -44,45 +63,61 @@ export class CaseConfigureService { } } - public async get({ unsecuredSavedObjectsClient, configurationId }: GetCaseConfigureArgs) { + public async get({ + unsecuredSavedObjectsClient, + configurationId, + }: GetCaseConfigureArgs): Promise> { try { this.log.debug(`Attempting to GET case configuration ${configurationId}`); - return await unsecuredSavedObjectsClient.get( + const configuration = await unsecuredSavedObjectsClient.get( CASE_CONFIGURE_SAVED_OBJECT, configurationId ); + + return transformToExternalModel(configuration); } catch (error) { this.log.debug(`Error on GET case configuration ${configurationId}: ${error}`); throw error; } } - public async find({ unsecuredSavedObjectsClient, options }: FindCaseConfigureArgs) { + public async find({ + unsecuredSavedObjectsClient, + options, + }: FindCaseConfigureArgs): Promise> { try { this.log.debug(`Attempting to find all case configuration`); - return await unsecuredSavedObjectsClient.find({ + + const findResp = await unsecuredSavedObjectsClient.find({ ...options, // Get the latest configuration sortField: 'created_at', sortOrder: 'desc', type: CASE_CONFIGURE_SAVED_OBJECT, }); + + return transformFindResponseToExternalModel(findResp); } catch (error) { this.log.debug(`Attempting to find all case configuration`); throw error; } } - public async post({ unsecuredSavedObjectsClient, attributes, id }: PostCaseConfigureArgs) { + public async post({ + unsecuredSavedObjectsClient, + attributes, + id, + }: PostCaseConfigureArgs): Promise> { try { this.log.debug(`Attempting to POST a new case configuration`); - return await unsecuredSavedObjectsClient.create( + const esConfigInfo = transformAttributesToESModel(attributes); + const createdConfig = await unsecuredSavedObjectsClient.create( CASE_CONFIGURE_SAVED_OBJECT, - { - ...attributes, - }, - { id } + esConfigInfo.attributes, + { id, references: esConfigInfo.referenceHandler.build() } ); + + return transformToExternalModel(createdConfig); } catch (error) { this.log.debug(`Error on POST a new case configuration: ${error}`); throw error; @@ -93,19 +128,124 @@ export class CaseConfigureService { unsecuredSavedObjectsClient, configurationId, updatedAttributes, - }: PatchCaseConfigureArgs) { + originalConfiguration, + }: PatchCaseConfigureArgs): Promise> { try { this.log.debug(`Attempting to UPDATE case configuration ${configurationId}`); - return await unsecuredSavedObjectsClient.update( + const esUpdateInfo = transformAttributesToESModel(updatedAttributes); + + const updatedConfiguration = await unsecuredSavedObjectsClient.update( CASE_CONFIGURE_SAVED_OBJECT, configurationId, { - ...updatedAttributes, + ...esUpdateInfo.attributes, + }, + { + references: esUpdateInfo.referenceHandler.build(originalConfiguration.references), } ); + + return transformUpdateResponseToExternalModel(updatedConfiguration); } catch (error) { this.log.debug(`Error on UPDATE case configuration ${configurationId}: ${error}`); throw error; } } } + +function transformUpdateResponseToExternalModel( + updatedConfiguration: SavedObjectsUpdateResponse +): SavedObjectsUpdateResponse { + const { connector, ...restUpdatedAttributes } = updatedConfiguration.attributes ?? {}; + + const transformedConnector = transformESConnectorToExternalModel({ + connector, + references: updatedConfiguration.references, + referenceName: CONNECTOR_ID_REFERENCE_NAME, + }); + + return { + ...updatedConfiguration, + attributes: { + ...restUpdatedAttributes, + // this will avoid setting connector to undefined, it won't include to field at all + ...(transformedConnector && { connector: transformedConnector }), + }, + }; +} + +function transformToExternalModel( + configuration: SavedObject +): SavedObject { + const connector = transformESConnectorOrUseDefault({ + // if the saved object had an error the attributes field will not exist + connector: configuration.attributes?.connector, + references: configuration.references, + referenceName: CONNECTOR_ID_REFERENCE_NAME, + }); + + return { + ...configuration, + attributes: { + ...configuration.attributes, + connector, + }, + }; +} + +function transformFindResponseToExternalModel( + configurations: SavedObjectsFindResponse +): SavedObjectsFindResponse { + return { + ...configurations, + saved_objects: configurations.saved_objects.map((so) => ({ + ...so, + ...transformToExternalModel(so), + })), + }; +} + +function transformAttributesToESModel( + configuration: CasesConfigureAttributes +): { + attributes: ESCasesConfigureAttributes; + referenceHandler: ConnectorReferenceHandler; +}; +function transformAttributesToESModel( + configuration: Partial +): { + attributes: Partial; + referenceHandler: ConnectorReferenceHandler; +}; +function transformAttributesToESModel( + configuration: Partial +): { + attributes: Partial; + referenceHandler: ConnectorReferenceHandler; +} { + const { connector, ...restWithoutConnector } = configuration; + + const transformedConnector = { + ...(connector && { + connector: { + name: connector.name, + type: connector.type, + fields: transformFieldsToESModel(connector), + }, + }), + }; + + return { + attributes: { + ...restWithoutConnector, + ...transformedConnector, + }, + referenceHandler: buildReferenceHandler(connector?.id), + }; +} + +function buildReferenceHandler(id?: string): ConnectorReferenceHandler { + return new ConnectorReferenceHandler([ + { id, name: CONNECTOR_ID_REFERENCE_NAME, type: ACTION_SAVED_OBJECT_TYPE }, + ]); +} diff --git a/x-pack/plugins/cases/server/services/configure/types.ts b/x-pack/plugins/cases/server/services/configure/types.ts new file mode 100644 index 0000000000000..f52e05a2ff9b5 --- /dev/null +++ b/x-pack/plugins/cases/server/services/configure/types.ts @@ -0,0 +1,17 @@ +/* + * 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 { CasesConfigureAttributes } from '../../../common'; +import { ESCaseConnector } from '..'; + +/** + * This type should only be used within the configure service. It represents how the configure saved object will be layed + * out in ES. + */ +export type ESCasesConfigureAttributes = Omit & { + connector: ESCaseConnector; +}; diff --git a/x-pack/plugins/cases/server/services/connector_reference_handler.test.ts b/x-pack/plugins/cases/server/services/connector_reference_handler.test.ts new file mode 100644 index 0000000000000..4c42332d10627 --- /dev/null +++ b/x-pack/plugins/cases/server/services/connector_reference_handler.test.ts @@ -0,0 +1,148 @@ +/* + * 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 { noneConnectorId } from '../../common'; +import { ConnectorReferenceHandler } from './connector_reference_handler'; + +describe('ConnectorReferenceHandler', () => { + describe('merge', () => { + it('overwrites the original reference with the new one', () => { + const handler = new ConnectorReferenceHandler([{ id: 'hello2', type: '1', name: 'a' }]); + + expect(handler.build([{ id: 'hello', type: '1', name: 'a' }])).toMatchInlineSnapshot(` + Array [ + Object { + "id": "hello2", + "name": "a", + "type": "1", + }, + ] + `); + }); + + it('returns the original references if the new references is an empty array', () => { + const handler = new ConnectorReferenceHandler([]); + + expect(handler.build([{ id: 'hello', type: '1', name: 'a' }])).toMatchInlineSnapshot(` + Array [ + Object { + "id": "hello", + "name": "a", + "type": "1", + }, + ] + `); + }); + + it('returns undefined when there are no original references and no new ones', () => { + const handler = new ConnectorReferenceHandler([]); + + expect(handler.build()).toBeUndefined(); + }); + + it('returns an empty array when there is an empty array of original references and no new ones', () => { + const handler = new ConnectorReferenceHandler([]); + + expect(handler.build([])).toMatchInlineSnapshot(`Array []`); + }); + + it('removes a reference when the id field is null', () => { + const handler = new ConnectorReferenceHandler([{ id: null, name: 'a', type: '1' }]); + + expect(handler.build([{ id: 'hello', type: '1', name: 'a' }])).toMatchInlineSnapshot( + `Array []` + ); + }); + + it('removes a reference when the id field is the none connector', () => { + const handler = new ConnectorReferenceHandler([ + { id: noneConnectorId, name: 'a', type: '1' }, + ]); + + expect(handler.build([{ id: 'hello', type: '1', name: 'a' }])).toMatchInlineSnapshot( + `Array []` + ); + }); + + it('does not remove a reference when the id field is undefined', () => { + const handler = new ConnectorReferenceHandler([{ id: undefined, name: 'a', type: '1' }]); + + expect(handler.build([{ id: 'hello', type: '1', name: 'a' }])).toMatchInlineSnapshot(` + Array [ + Object { + "id": "hello", + "name": "a", + "type": "1", + }, + ] + `); + }); + + it('adds a new reference to existing ones', () => { + const handler = new ConnectorReferenceHandler([{ id: 'awesome', type: '2', name: 'b' }]); + + expect(handler.build([{ id: 'hello', type: '1', name: 'a' }])).toMatchInlineSnapshot(` + Array [ + Object { + "id": "hello", + "name": "a", + "type": "1", + }, + Object { + "id": "awesome", + "name": "b", + "type": "2", + }, + ] + `); + }); + + it('adds new references to an undefined original reference array', () => { + const handler = new ConnectorReferenceHandler([ + { id: 'awesome', type: '2', name: 'a' }, + { id: 'awesome', type: '2', name: 'b' }, + ]); + + expect(handler.build()).toMatchInlineSnapshot(` + Array [ + Object { + "id": "awesome", + "name": "a", + "type": "2", + }, + Object { + "id": "awesome", + "name": "b", + "type": "2", + }, + ] + `); + }); + + it('adds new references to an empty original reference array', () => { + const handler = new ConnectorReferenceHandler([ + { id: 'awesome', type: '2', name: 'a' }, + { id: 'awesome', type: '2', name: 'b' }, + ]); + + expect(handler.build()).toMatchInlineSnapshot(` + Array [ + Object { + "id": "awesome", + "name": "a", + "type": "2", + }, + Object { + "id": "awesome", + "name": "b", + "type": "2", + }, + ] + `); + }); + }); +}); diff --git a/x-pack/plugins/cases/server/services/connector_reference_handler.ts b/x-pack/plugins/cases/server/services/connector_reference_handler.ts new file mode 100644 index 0000000000000..81e1541366ab5 --- /dev/null +++ b/x-pack/plugins/cases/server/services/connector_reference_handler.ts @@ -0,0 +1,57 @@ +/* + * 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 { SavedObjectReference } from 'kibana/server'; +import { noneConnectorId } from '../../common'; + +interface Reference { + soReference?: SavedObjectReference; + name: string; +} + +export class ConnectorReferenceHandler { + private newReferences: Reference[] = []; + + constructor(references: Array<{ id?: string | null; name: string; type: string }>) { + for (const { id, name, type } of references) { + // When id is null, or the none connector we'll try to remove the reference if it exists + // When id is undefined it means that we're doing a patch request and this particular field shouldn't be updated + // so we'll ignore it. If it was already in the reference array then it'll stay there when we merge them together below + if (id === null || id === noneConnectorId) { + this.newReferences.push({ name }); + } else if (id) { + this.newReferences.push({ soReference: { id, name, type }, name }); + } + } + } + + /** + * Merges the references passed to the constructor into the original references passed into this function + * + * @param originalReferences existing saved object references + * @returns a merged reference list or undefined when there are no new or existing references + */ + public build(originalReferences?: SavedObjectReference[]): SavedObjectReference[] | undefined { + if (this.newReferences.length <= 0) { + return originalReferences; + } + + const refMap = new Map( + originalReferences?.map((ref) => [ref.name, ref]) + ); + + for (const newRef of this.newReferences) { + if (newRef.soReference) { + refMap.set(newRef.name, newRef.soReference); + } else { + refMap.delete(newRef.name); + } + } + + return Array.from(refMap.values()); + } +} diff --git a/x-pack/plugins/cases/server/services/index.ts b/x-pack/plugins/cases/server/services/index.ts index 09895d9392441..f910099c0cc20 100644 --- a/x-pack/plugins/cases/server/services/index.ts +++ b/x-pack/plugins/cases/server/services/index.ts @@ -6,6 +6,7 @@ */ import { SavedObjectsClientContract } from 'kibana/server'; +import { ConnectorTypes } from '../../common'; export { CasesService } from './cases'; export { CaseConfigureService } from './configure'; @@ -17,3 +18,14 @@ export { AttachmentService } from './attachments'; export interface ClientArgs { unsecuredSavedObjectsClient: SavedObjectsClientContract; } + +export type ESConnectorFields = Array<{ + key: string; + value: unknown; +}>; + +export interface ESCaseConnector { + name: string; + type: ConnectorTypes; + fields: ESConnectorFields | null; +} diff --git a/x-pack/plugins/cases/server/services/test_utils.ts b/x-pack/plugins/cases/server/services/test_utils.ts new file mode 100644 index 0000000000000..b712ea07f9c71 --- /dev/null +++ b/x-pack/plugins/cases/server/services/test_utils.ts @@ -0,0 +1,200 @@ +/* + * 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 { SavedObject, SavedObjectReference } from 'kibana/server'; +import { ESConnectorFields } from '.'; +import { CONNECTOR_ID_REFERENCE_NAME, PUSH_CONNECTOR_ID_REFERENCE_NAME } from '../common'; +import { + CaseConnector, + CaseFullExternalService, + CaseStatuses, + CaseType, + CASE_SAVED_OBJECT, + ConnectorTypes, + noneConnectorId, + SECURITY_SOLUTION_OWNER, +} from '../../common'; +import { ESCaseAttributes, ExternalServicesWithoutConnectorId } from './cases/types'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../actions/server'; + +/** + * This is only a utility interface to help with constructing test cases. After the migration, the ES format will no longer + * have the id field. Instead it will be moved to the references array. + */ +export interface ESCaseConnectorWithId { + id: string; + name: string; + type: ConnectorTypes; + fields: ESConnectorFields | null; +} + +/** + * This file contains utility functions to aid unit test development + */ + +/** + * Create an Elasticsearch jira connector. + * + * @param overrides fields used to override the default jira connector + * @returns a jira Elasticsearch connector (it has key value pairs for the fields) by default + */ +export const createESJiraConnector = ( + overrides?: Partial +): ESCaseConnectorWithId => { + return { + id: '1', + name: ConnectorTypes.jira, + fields: [ + { key: 'issueType', value: 'bug' }, + { key: 'priority', value: 'high' }, + { key: 'parent', value: '2' }, + ], + type: ConnectorTypes.jira, + ...(overrides && { ...overrides }), + }; +}; + +/** + * Creates a jira CaseConnector (has the actual fields defined in the object instead of key value paris) + * @param setFieldsToNull a flag that controls setting the fields property to null + * @returns a jira connector + */ +export const createJiraConnector = ({ + setFieldsToNull, +}: { setFieldsToNull?: boolean } = {}): CaseConnector => { + return { + id: '1', + name: ConnectorTypes.jira, + type: ConnectorTypes.jira, + fields: setFieldsToNull + ? null + : { + issueType: 'bug', + priority: 'high', + parent: '2', + }, + }; +}; + +export const createExternalService = ( + overrides?: Partial +): CaseFullExternalService => ({ + connector_id: '100', + connector_name: '.jira', + external_id: '100', + external_title: 'awesome', + external_url: 'http://www.google.com', + pushed_at: '2019-11-25T21:54:48.952Z', + pushed_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + ...(overrides && { ...overrides }), +}); + +export const basicCaseFields = { + closed_at: null, + closed_by: null, + created_at: '2019-11-25T21:54:48.952Z', + created_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + description: 'This is a brand new case of a bad meanie defacing data', + title: 'Super Bad Security Issue', + status: CaseStatuses.open, + tags: ['defacement'], + type: CaseType.individual, + updated_at: '2019-11-25T21:54:48.952Z', + updated_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + settings: { + syncAlerts: true, + }, + owner: SECURITY_SOLUTION_OWNER, +}; + +export const createCaseSavedObjectResponse = ({ + connector, + externalService, +}: { + connector?: ESCaseConnectorWithId; + externalService?: CaseFullExternalService; +} = {}): SavedObject => { + const references: SavedObjectReference[] = createSavedObjectReferences({ + connector, + externalService, + }); + + const formattedConnector = { + type: connector?.type ?? ConnectorTypes.jira, + name: connector?.name ?? ConnectorTypes.jira, + fields: connector?.fields ?? null, + }; + + let restExternalService: ExternalServicesWithoutConnectorId | null = null; + if (externalService !== null) { + const { connector_id: ignored, ...rest } = externalService ?? { + connector_name: '.jira', + external_id: '100', + external_title: 'awesome', + external_url: 'http://www.google.com', + pushed_at: '2019-11-25T21:54:48.952Z', + pushed_by: { + full_name: 'elastic', + email: 'testemail@elastic.co', + username: 'elastic', + }, + }; + restExternalService = rest; + } + + return { + type: CASE_SAVED_OBJECT, + id: '1', + attributes: { + ...basicCaseFields, + // if connector is null we'll default this to an incomplete jira value because the service + // should switch it to a none connector when the id can't be found in the references array + connector: formattedConnector, + external_service: restExternalService, + }, + references, + }; +}; + +export const createSavedObjectReferences = ({ + connector, + externalService, +}: { + connector?: ESCaseConnectorWithId; + externalService?: CaseFullExternalService; +} = {}): SavedObjectReference[] => [ + ...(connector && connector.id !== noneConnectorId + ? [ + { + id: connector.id, + name: CONNECTOR_ID_REFERENCE_NAME, + type: ACTION_SAVED_OBJECT_TYPE, + }, + ] + : []), + ...(externalService && externalService.connector_id + ? [ + { + id: externalService.connector_id, + name: PUSH_CONNECTOR_ID_REFERENCE_NAME, + type: ACTION_SAVED_OBJECT_TYPE, + }, + ] + : []), +]; diff --git a/x-pack/plugins/cases/server/services/transform.test.ts b/x-pack/plugins/cases/server/services/transform.test.ts new file mode 100644 index 0000000000000..b4346595e4998 --- /dev/null +++ b/x-pack/plugins/cases/server/services/transform.test.ts @@ -0,0 +1,211 @@ +/* + * 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 { ACTION_SAVED_OBJECT_TYPE } from '../../../actions/server'; +import { ConnectorTypes } from '../../common'; +import { createESJiraConnector, createJiraConnector } from './test_utils'; +import { + findConnectorIdReference, + transformESConnectorOrUseDefault, + transformESConnectorToExternalModel, + transformFieldsToESModel, +} from './transform'; + +describe('service transform helpers', () => { + describe('findConnectorIdReference', () => { + it('finds the reference when it exists', () => { + expect( + findConnectorIdReference('a', [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'a' }]) + ).toBeDefined(); + }); + + it('does not find the reference when the name is different', () => { + expect( + findConnectorIdReference('a', [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'b' }]) + ).toBeUndefined(); + }); + + it('does not find the reference when references is empty', () => { + expect(findConnectorIdReference('a', [])).toBeUndefined(); + }); + + it('does not find the reference when references is undefined', () => { + expect(findConnectorIdReference('a', undefined)).toBeUndefined(); + }); + + it('does not find the reference when the type is different', () => { + expect( + findConnectorIdReference('a', [{ id: 'hello', type: 'yo', name: 'a' }]) + ).toBeUndefined(); + }); + }); + + describe('transformESConnectorToExternalModel', () => { + it('returns undefined when the connector is undefined', () => { + expect(transformESConnectorToExternalModel({ referenceName: 'a' })).toBeUndefined(); + }); + + it('returns the default connector when it cannot find the reference', () => { + expect( + transformESConnectorToExternalModel({ + connector: createESJiraConnector(), + referenceName: 'a', + }) + ).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + + it('converts the connector.fields to an object', () => { + expect( + transformESConnectorToExternalModel({ + connector: createESJiraConnector(), + references: [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'a' }], + referenceName: 'a', + })?.fields + ).toMatchInlineSnapshot(` + Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + } + `); + }); + + it('returns the full jira connector', () => { + expect( + transformESConnectorToExternalModel({ + connector: createESJiraConnector(), + references: [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'a' }], + referenceName: 'a', + }) + ).toMatchInlineSnapshot(` + Object { + "fields": Object { + "issueType": "bug", + "parent": "2", + "priority": "high", + }, + "id": "hello", + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('sets fields to null if it is an empty array', () => { + expect( + transformESConnectorToExternalModel({ + connector: createESJiraConnector({ fields: [] }), + references: [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'a' }], + referenceName: 'a', + }) + ).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "hello", + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('sets fields to null if it is null', () => { + expect( + transformESConnectorToExternalModel({ + connector: createESJiraConnector({ fields: null }), + references: [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'a' }], + referenceName: 'a', + }) + ).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "hello", + "name": ".jira", + "type": ".jira", + } + `); + }); + + it('sets fields to null if it is undefined', () => { + expect( + transformESConnectorToExternalModel({ + connector: createESJiraConnector({ fields: undefined }), + references: [{ id: 'hello', type: ACTION_SAVED_OBJECT_TYPE, name: 'a' }], + referenceName: 'a', + }) + ).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "hello", + "name": ".jira", + "type": ".jira", + } + `); + }); + }); + + describe('transformESConnectorOrUseDefault', () => { + it('returns the default connector when the connector is undefined', () => { + expect(transformESConnectorOrUseDefault({ referenceName: 'a' })).toMatchInlineSnapshot(` + Object { + "fields": null, + "id": "none", + "name": "none", + "type": ".none", + } + `); + }); + }); + + describe('transformFieldsToESModel', () => { + it('returns an empty array when fields is null', () => { + expect(transformFieldsToESModel(createJiraConnector({ setFieldsToNull: true })).length).toBe( + 0 + ); + }); + + it('returns an empty array when fields is an empty object', () => { + expect( + transformFieldsToESModel({ + id: '1', + name: ConnectorTypes.jira, + type: ConnectorTypes.jira, + fields: {} as { + issueType: string; + priority: string; + parent: string; + }, + }).length + ).toBe(0); + }); + + it('returns an array with the key/value pairs', () => { + expect(transformFieldsToESModel(createJiraConnector())).toMatchInlineSnapshot(` + Array [ + Object { + "key": "issueType", + "value": "bug", + }, + Object { + "key": "priority", + "value": "high", + }, + Object { + "key": "parent", + "value": "2", + }, + ] + `); + }); + }); +}); diff --git a/x-pack/plugins/cases/server/services/transform.ts b/x-pack/plugins/cases/server/services/transform.ts new file mode 100644 index 0000000000000..39351d3a4b50a --- /dev/null +++ b/x-pack/plugins/cases/server/services/transform.ts @@ -0,0 +1,100 @@ +/* + * 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 { SavedObjectReference } from 'kibana/server'; +import { CaseConnector, ConnectorTypeFields } from '../../common'; +import { ACTION_SAVED_OBJECT_TYPE } from '../../../actions/server'; +import { getNoneCaseConnector } from '../common'; +import { ESCaseConnector, ESConnectorFields } from '.'; + +export function findConnectorIdReference( + name: string, + references?: SavedObjectReference[] +): SavedObjectReference | undefined { + return references?.find((ref) => ref.type === ACTION_SAVED_OBJECT_TYPE && ref.name === name); +} + +export function transformESConnectorToExternalModel({ + connector, + references, + referenceName, +}: { + connector?: ESCaseConnector; + references?: SavedObjectReference[]; + referenceName: string; +}): CaseConnector | undefined { + const connectorIdRef = findConnectorIdReference(referenceName, references); + return transformConnectorFieldsToExternalModel(connector, connectorIdRef?.id); +} + +function transformConnectorFieldsToExternalModel( + connector?: ESCaseConnector, + connectorId?: string +): CaseConnector | undefined { + if (!connector) { + return; + } + + // if the connector is valid, but we can't find it's ID in the reference, then it must be malformed + // or it was a none connector which doesn't have a reference (a none connector doesn't point to any actual connector + // saved object) + if (!connectorId) { + return getNoneCaseConnector(); + } + + const connectorTypeField = { + type: connector.type, + fields: + connector.fields != null && connector.fields.length > 0 + ? connector.fields.reduce( + (fields, { key, value }) => ({ + ...fields, + [key]: value, + }), + {} + ) + : null, + } as ConnectorTypeFields; + + return { + id: connectorId, + name: connector.name, + ...connectorTypeField, + }; +} + +export function transformESConnectorOrUseDefault({ + connector, + references, + referenceName, +}: { + connector?: ESCaseConnector; + references?: SavedObjectReference[]; + referenceName: string; +}): CaseConnector { + return ( + transformESConnectorToExternalModel({ connector, references, referenceName }) ?? + getNoneCaseConnector() + ); +} + +export function transformFieldsToESModel(connector: CaseConnector): ESConnectorFields { + if (!connector.fields) { + return []; + } + + return Object.entries(connector.fields).reduce( + (acc, [key, value]) => [ + ...acc, + { + key, + value, + }, + ], + [] + ); +} diff --git a/x-pack/plugins/cases/server/services/user_actions/helpers.ts b/x-pack/plugins/cases/server/services/user_actions/helpers.ts index 4d0f899d40785..223e731aa8d9b 100644 --- a/x-pack/plugins/cases/server/services/user_actions/helpers.ts +++ b/x-pack/plugins/cases/server/services/user_actions/helpers.ts @@ -13,18 +13,16 @@ import { CASE_COMMENT_SAVED_OBJECT, CASE_SAVED_OBJECT, CaseUserActionAttributes, - ESCaseAttributes, OWNER_FIELD, SUB_CASE_SAVED_OBJECT, SubCaseAttributes, User, UserAction, UserActionField, - UserActionFieldType, + CaseAttributes, } from '../../../common'; import { isTwoArraysDifference } from '../../client/utils'; import { UserActionItem } from '.'; -import { transformESConnectorToCaseConnector } from '../../common'; export const transformNewUserAction = ({ actionField, @@ -173,17 +171,12 @@ interface CaseSubIDs { } type GetCaseAndSubID = (so: SavedObjectsUpdateResponse) => CaseSubIDs; -type GetField = ( - attributes: Pick, 'attributes'>, - field: UserActionFieldType -) => unknown; /** * Abstraction functions to retrieve a given field and the caseId and subCaseId depending on * whether we're interacting with a case or a sub case. */ interface Getters { - getField: GetField; getCaseAndSubID: GetCaseAndSubID; } @@ -209,7 +202,7 @@ const buildGenericCaseUserActions = ({ allowedFields: UserActionField; getters: Getters; }): UserActionItem[] => { - const { getCaseAndSubID, getField } = getters; + const { getCaseAndSubID } = getters; return updatedCases.reduce((acc, updatedItem) => { const { caseId, subCaseId } = getCaseAndSubID(updatedItem); // regardless of whether we're looking at a sub case or case, the id field will always be used to match between @@ -220,8 +213,8 @@ const buildGenericCaseUserActions = ({ const updatedFields = Object.keys(updatedItem.attributes) as UserActionField; updatedFields.forEach((field) => { if (allowedFields.includes(field)) { - const origValue = getField(originalItem, field); - const updatedValue = getField(updatedItem, field); + const origValue = get(originalItem, ['attributes', field]); + const updatedValue = get(updatedItem, ['attributes', field]); if (isString(origValue) && isString(updatedValue) && origValue !== updatedValue) { userActions = [ @@ -308,18 +301,12 @@ export const buildSubCaseUserActions = (args: { originalSubCases: Array>; updatedSubCases: Array>; }): UserActionItem[] => { - const getField = ( - so: Pick, 'attributes'>, - field: UserActionFieldType - ) => get(so, ['attributes', field]); - const getCaseAndSubID = (so: SavedObjectsUpdateResponse): CaseSubIDs => { const caseId = so.references?.find((ref) => ref.type === CASE_SAVED_OBJECT)?.id ?? ''; return { caseId, subCaseId: so.id }; }; const getters: Getters = { - getField, getCaseAndSubID, }; @@ -339,24 +326,14 @@ export const buildSubCaseUserActions = (args: { export const buildCaseUserActions = (args: { actionDate: string; actionBy: User; - originalCases: Array>; - updatedCases: Array>; + originalCases: Array>; + updatedCases: Array>; }): UserActionItem[] => { - const getField = ( - so: Pick, 'attributes'>, - field: UserActionFieldType - ) => { - return field === 'connector' && so.attributes.connector - ? transformESConnectorToCaseConnector(so.attributes.connector) - : get(so, ['attributes', field]); - }; - const caseGetIds: GetCaseAndSubID = (so: SavedObjectsUpdateResponse): CaseSubIDs => { return { caseId: so.id }; }; const getters: Getters = { - getField, getCaseAndSubID: caseGetIds, }; diff --git a/x-pack/plugins/cases/server/services/user_actions/index.ts b/x-pack/plugins/cases/server/services/user_actions/index.ts index 5fdf4680f5ca8..b702448165554 100644 --- a/x-pack/plugins/cases/server/services/user_actions/index.ts +++ b/x-pack/plugins/cases/server/services/user_actions/index.ts @@ -55,6 +55,7 @@ export class CaseUserActionService { public async bulkCreate({ unsecuredSavedObjectsClient, actions }: PostCaseUserActionArgs) { try { this.log.debug(`Attempting to POST a new case user action`); + return await unsecuredSavedObjectsClient.bulkCreate( actions.map((action) => ({ type: CASE_USER_ACTION_SAVED_OBJECT, ...action })) ); diff --git a/x-pack/plugins/data_visualizer/kibana.json b/x-pack/plugins/data_visualizer/kibana.json index 01aca7c2bbaee..e7f2d71313abf 100644 --- a/x-pack/plugins/data_visualizer/kibana.json +++ b/x-pack/plugins/data_visualizer/kibana.json @@ -23,7 +23,8 @@ "home", "kibanaReact", "maps", - "esUiShared" + "esUiShared", + "fieldFormats" ], "extraPublicDirs": [ "common" diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/services/time_buckets.js b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/services/time_buckets.js index 6a68ebeef7c30..5d54b6c936fb2 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/services/time_buckets.js +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/services/time_buckets.js @@ -5,7 +5,8 @@ * 2.0. */ -import { FIELD_FORMAT_IDS, UI_SETTINGS } from '../../../../../../../src/plugins/data/common'; +import { FIELD_FORMAT_IDS } from '../../../../../../../src/plugins/field_formats/common'; +import { UI_SETTINGS } from '../../../../../../../src/plugins/data/common'; import { ary, assign, isPlainObject, isString, sortBy } from 'lodash'; import moment from 'moment'; import dateMath from '@elastic/datemath'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx new file mode 100644 index 0000000000000..80c72235f7a4a --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.test.tsx @@ -0,0 +1,103 @@ +/* + * 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 { setMockValues } from '../../../../__mocks__/kea_logic'; +import '../../../__mocks__/engine_logic.mock'; + +import React from 'react'; + +import { shallow, ShallowWrapper } from 'enzyme'; + +import { EuiBasicTable, EuiEmptyPrompt } from '@elastic/eui'; + +import { mountWithIntl } from '../../../../test_helpers'; + +import { + CrawlerDomain, + CrawlerPolicies, + CrawlerRules, + CrawlerStatus, + CrawlRequest, +} from '../types'; + +import { CrawlRequestsTable } from './crawl_requests_table'; + +const values: { domains: CrawlerDomain[]; crawlRequests: CrawlRequest[] } = { + // CrawlerOverviewLogic + domains: [ + { + id: '507f1f77bcf86cd799439011', + createdOn: 'Mon, 31 Aug 2020 17:00:00 +0000', + url: 'elastic.co', + documentCount: 13, + sitemaps: [], + entryPoints: [], + crawlRules: [], + defaultCrawlRule: { + id: '-', + policy: CrawlerPolicies.allow, + rule: CrawlerRules.regex, + pattern: '.*', + }, + }, + ], + crawlRequests: [ + { + id: '618d0e66abe97bc688328900', + status: CrawlerStatus.Pending, + createdAt: 'Mon, 31 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + ], +}; + +describe('CrawlRequestsTable', () => { + let wrapper: ShallowWrapper; + let tableContent: string; + + beforeEach(() => { + jest.clearAllMocks(); + }); + + describe('columns', () => { + beforeAll(() => { + setMockValues(values); + wrapper = shallow(); + tableContent = mountWithIntl() + .find(EuiBasicTable) + .text(); + }); + + it('renders an id column', () => { + expect(tableContent).toContain('618d0e66abe97bc688328900'); + }); + + it('renders a created at column', () => { + expect(tableContent).toContain('Created'); + expect(tableContent).toContain('Aug 31, 2020'); + }); + + it('renders a status column', () => { + expect(tableContent).toContain('Status'); + expect(tableContent).toContain('Pending'); + }); + }); + + describe('no items message', () => { + it('displays an empty prompt when there are no crawl requests', () => { + setMockValues({ + ...values, + crawlRequests: [], + }); + + wrapper = shallow(); + + expect(wrapper.find(EuiBasicTable).dive().find(EuiEmptyPrompt)).toHaveLength(1); + }); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx new file mode 100644 index 0000000000000..19b1a543ad207 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawl_requests_table.tsx @@ -0,0 +1,89 @@ +/* + * 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 { useValues } from 'kea'; + +import { EuiBasicTable, EuiEmptyPrompt, EuiTableFieldDataColumnType } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { CrawlerOverviewLogic } from '../crawler_overview_logic'; +import { CrawlRequest, readableCrawlerStatuses } from '../types'; + +import { CustomFormattedTimestamp } from './custom_formatted_timestamp'; + +const columns: Array> = [ + { + field: 'id', + name: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlRequestsTable.column.domainURL', + { + defaultMessage: 'Request ID', + } + ), + }, + { + field: 'createdAt', + name: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlRequestsTable.column.created', + { + defaultMessage: 'Created', + } + ), + render: (createdAt: CrawlRequest['createdAt']) => ( + + ), + }, + { + field: 'status', + name: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlRequestsTable.column.status', + { + defaultMessage: 'Status', + } + ), + render: (status: CrawlRequest['status']) => readableCrawlerStatuses[status], + }, +]; + +export const CrawlRequestsTable: React.FC = () => { + const { crawlRequests } = useValues(CrawlerOverviewLogic); + + return ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlRequestsTable.emptyPrompt.title', + { + defaultMessage: 'No recent crawl requests', + } + )} + + } + body={ +

    + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlRequestsTable.emptyPrompt.body', + { + defaultMessage: "You haven't started any crawls yet.", + } + )} +

    + } + /> + } + /> + ); +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_banner.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_banner.test.tsx new file mode 100644 index 0000000000000..1be4c27037d1f --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_banner.test.tsx @@ -0,0 +1,59 @@ +/* + * 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 { setMockValues } from '../../../../__mocks__/kea_logic'; + +import React from 'react'; + +import { shallow } from 'enzyme'; + +import { EuiCallOut } from '@elastic/eui'; + +import { CrawlerStatus } from '../types'; + +import { CrawlerStatusBanner } from './crawler_status_banner'; + +describe('CrawlerStatusBanner', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + [(CrawlerStatus.Starting, CrawlerStatus.Running, CrawlerStatus.Canceling)].forEach((status) => { + describe(`when the status is ${status}`, () => { + it('renders a callout', () => { + setMockValues({ + mostRecentCrawlRequestStatus: status, + }); + + const wrapper = shallow(); + + expect(wrapper.find(EuiCallOut)).toHaveLength(1); + }); + }); + }); + + [ + CrawlerStatus.Success, + CrawlerStatus.Failed, + CrawlerStatus.Canceled, + CrawlerStatus.Pending, + CrawlerStatus.Suspended, + CrawlerStatus.Suspending, + ].forEach((status) => { + describe(`when the status is ${status}`, () => { + it('does not render a banner/callout', () => { + setMockValues({ + mostRecentCrawlRequestStatus: status, + }); + + const wrapper = shallow(); + + expect(wrapper.isEmptyRender()).toBe(true); + }); + }); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_banner.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_banner.tsx new file mode 100644 index 0000000000000..833db286fc2e5 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_banner.tsx @@ -0,0 +1,40 @@ +/* + * 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 { useValues } from 'kea'; + +import { EuiCallOut } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { CrawlerOverviewLogic } from '../crawler_overview_logic'; +import { CrawlerStatus } from '../types'; + +export const CrawlerStatusBanner: React.FC = () => { + const { mostRecentCrawlRequestStatus } = useValues(CrawlerOverviewLogic); + if ( + mostRecentCrawlRequestStatus === CrawlerStatus.Running || + mostRecentCrawlRequestStatus === CrawlerStatus.Starting || + mostRecentCrawlRequestStatus === CrawlerStatus.Canceling + ) { + return ( + + ); + } + return null; +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/crawler_status_indicator.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/crawler_status_indicator.test.tsx new file mode 100644 index 0000000000000..9d585789d8e50 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/crawler_status_indicator.test.tsx @@ -0,0 +1,156 @@ +/* + * 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 { setMockActions, setMockValues } from '../../../../../__mocks__/kea_logic'; + +import React from 'react'; + +import { shallow } from 'enzyme'; + +import { EuiButton } from '@elastic/eui'; + +import { CrawlerDomain, CrawlerStatus } from '../../types'; + +import { CrawlerStatusIndicator } from './crawler_status_indicator'; +import { StopCrawlPopoverContextMenu } from './stop_crawl_popover_context_menu'; + +const MOCK_VALUES = { + domains: [{}, {}] as CrawlerDomain[], + mostRecentCrawlRequestStatus: CrawlerStatus.Success, +}; + +const MOCK_ACTIONS = { + startCrawl: jest.fn(), + stopCrawl: jest.fn(), +}; + +describe('CrawlerStatusIndicator', () => { + beforeEach(() => { + jest.clearAllMocks(); + setMockActions(MOCK_ACTIONS); + }); + + describe('when status is not a valid status', () => { + it('is disabled', () => { + // this tests a codepath that should be impossible to reach, status should always be a CrawlerStatus + // but we use a switch statement and need to test the default case for this to recieve 100% coverage + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: null, + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Start a crawl'); + expect(wrapper.prop('disabled')).toEqual(true); + }); + }); + + describe('when there are no domains', () => { + it('is disabled', () => { + setMockValues({ + ...MOCK_VALUES, + domains: [], + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Start a crawl'); + expect(wrapper.prop('disabled')).toEqual(true); + }); + }); + + describe('when the status is success', () => { + it('renders an CrawlerStatusIndicator with a start crawl button', () => { + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: CrawlerStatus.Success, + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Start a crawl'); + expect(wrapper.prop('onClick')).toEqual(MOCK_ACTIONS.startCrawl); + }); + }); + + [CrawlerStatus.Failed, CrawlerStatus.Canceled].forEach((status) => { + describe(`when the status is ready for retry: ${status}`, () => { + it('renders an CrawlerStatusIndicator with a retry crawl button', () => { + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: status, + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Retry crawl'); + expect(wrapper.prop('onClick')).toEqual(MOCK_ACTIONS.startCrawl); + }); + }); + }); + + [CrawlerStatus.Pending, CrawlerStatus.Suspended].forEach((status) => { + describe(`when the status is ${status}`, () => { + it('renders an CrawlerStatusIndicator with a pending indicator', () => { + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: status, + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Pending...'); + expect(wrapper.prop('disabled')).toEqual(true); + expect(wrapper.prop('isLoading')).toEqual(true); + }); + }); + }); + + describe('when the status is Starting', () => { + it('renders an appropriate CrawlerStatusIndicator', () => { + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: CrawlerStatus.Starting, + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Starting...'); + expect(wrapper.prop('isLoading')).toEqual(true); + }); + }); + + describe('when the status is Running', () => { + it('renders a stop crawl popover menu', () => { + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: CrawlerStatus.Running, + }); + + const wrapper = shallow(); + expect(wrapper.is(StopCrawlPopoverContextMenu)).toEqual(true); + expect(wrapper.prop('stopCrawl')).toEqual(MOCK_ACTIONS.stopCrawl); + }); + }); + + [CrawlerStatus.Canceling, CrawlerStatus.Suspending].forEach((status) => { + describe(`when the status is ${status}`, () => { + it('renders an CrawlerStatusIndicator with a stopping indicator', () => { + setMockValues({ + ...MOCK_VALUES, + mostRecentCrawlRequestStatus: status, + }); + + const wrapper = shallow(); + expect(wrapper.is(EuiButton)).toEqual(true); + expect(wrapper.render().text()).toContain('Stopping...'); + expect(wrapper.prop('isLoading')).toEqual(true); + }); + }); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/crawler_status_indicator.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/crawler_status_indicator.tsx new file mode 100644 index 0000000000000..c1b8ad2073444 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/crawler_status_indicator.tsx @@ -0,0 +1,106 @@ +/* + * 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 { useActions, useValues } from 'kea'; + +import { EuiButton } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { CrawlerOverviewLogic } from '../../crawler_overview_logic'; +import { CrawlerStatus } from '../../types'; + +import { StopCrawlPopoverContextMenu } from './stop_crawl_popover_context_menu'; + +export const CrawlerStatusIndicator: React.FC = () => { + const { domains, mostRecentCrawlRequestStatus } = useValues(CrawlerOverviewLogic); + const { startCrawl, stopCrawl } = useActions(CrawlerOverviewLogic); + + const disabledButton = ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.startACrawlButtonLabel', + { + defaultMessage: 'Start a crawl', + } + )} + + ); + + if (domains.length === 0) { + return disabledButton; + } + + switch (mostRecentCrawlRequestStatus) { + case CrawlerStatus.Success: + return ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.startACrawlButtonLabel', + { + defaultMessage: 'Start a crawl', + } + )} + + ); + case CrawlerStatus.Failed: + case CrawlerStatus.Canceled: + return ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.retryCrawlButtonLabel', + { + defaultMessage: 'Retry crawl', + } + )} + + ); + case CrawlerStatus.Pending: + case CrawlerStatus.Suspended: + return ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.pendingButtonLabel', + { + defaultMessage: 'Pending...', + } + )} + + ); + case CrawlerStatus.Starting: + return ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.startingButtonLabel', + { + defaultMessage: 'Starting...', + } + )} + + ); + case CrawlerStatus.Running: + return ; + case CrawlerStatus.Canceling: + case CrawlerStatus.Suspending: + return ( + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.stoppingButtonLabel', + { + defaultMessage: 'Stopping...', + } + )} + + ); + default: + // We should never get here, you would have to pass a CrawlerStatus option not covered + // in the switch cases above + return disabledButton; + } +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/stop_crawl_popover_context_menu.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/stop_crawl_popover_context_menu.test.tsx new file mode 100644 index 0000000000000..096238faff9a0 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/stop_crawl_popover_context_menu.test.tsx @@ -0,0 +1,51 @@ +/* + * 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 { shallow } from 'enzyme'; + +import { + EuiButton, + EuiContextMenuItem, + EuiContextMenuPanel, + EuiPopover, + EuiResizeObserver, +} from '@elastic/eui'; + +import { mountWithIntl } from '../../../../../test_helpers'; + +import { StopCrawlPopoverContextMenu } from './stop_crawl_popover_context_menu'; + +const stopCrawl = jest.fn(); + +describe('StopCrawlsPopoverContextMenu', () => { + it('is initially closed', () => { + const wrapper = shallow(); + + expect(wrapper.is(EuiPopover)).toBe(true); + expect(wrapper.prop('isOpen')).toEqual(false); + }); + + it('can be opened to stop crawls', () => { + const wrapper = mountWithIntl(); + + wrapper.find(EuiButton).simulate('click'); + + expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true); + + const menuItem = wrapper + .find(EuiContextMenuPanel) + .find(EuiResizeObserver) + .find(EuiContextMenuItem); + + expect(menuItem).toHaveLength(1); + + menuItem.simulate('click'); + + expect(stopCrawl).toHaveBeenCalled(); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/stop_crawl_popover_context_menu.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/stop_crawl_popover_context_menu.tsx new file mode 100644 index 0000000000000..6c0e91995e281 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/components/crawler_status_indicator/stop_crawl_popover_context_menu.tsx @@ -0,0 +1,86 @@ +/* + * 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, { useState } from 'react'; + +import { + EuiButton, + EuiContextMenuItem, + EuiContextMenuPanel, + EuiFlexGroup, + EuiFlexItem, + EuiLoadingSpinner, + EuiPopover, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +interface StopCrawlPopoverContextMenuProps { + stopCrawl(): void; +} + +export const StopCrawlPopoverContextMenu: React.FC = ({ + stopCrawl, + ...rest +}) => { + const [isPopoverOpen, setPopover] = useState(false); + + const togglePopover = () => setPopover(!isPopoverOpen); + + const closePopover = () => setPopover(false); + + return ( + + + + + + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.crawlingButtonLabel', + { + defaultMessage: 'Crawling...', + } + )} + + + + } + isOpen={isPopoverOpen} + closePopover={closePopover} + panelPaddingSize="none" + anchorPosition="downLeft" + > + { + closePopover(); + stopCrawl(); + }} + > + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusIndicator.cancelCrawlMenuItemLabel', + { + defaultMessage: 'Cancel Crawl', + } + )} + , + ]} + /> + + ); +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx index 610ad1f571699..ae4fc6b04b002 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx @@ -11,42 +11,155 @@ import '../../__mocks__/engine_logic.mock'; import React from 'react'; -import { shallow, ShallowWrapper } from 'enzyme'; +import { shallow } from 'enzyme'; + +import { getPageHeaderActions } from '../../../test_helpers'; import { AddDomainFlyout } from './components/add_domain/add_domain_flyout'; +import { AddDomainForm } from './components/add_domain/add_domain_form'; +import { AddDomainFormSubmitButton } from './components/add_domain/add_domain_form_submit_button'; +import { CrawlRequestsTable } from './components/crawl_requests_table'; +import { CrawlerStatusBanner } from './components/crawler_status_banner'; +import { CrawlerStatusIndicator } from './components/crawler_status_indicator/crawler_status_indicator'; import { DomainsTable } from './components/domains_table'; import { CrawlerOverview } from './crawler_overview'; +import { + CrawlerDomainFromServer, + CrawlerPolicies, + CrawlerRules, + CrawlerStatus, + CrawlRequestFromServer, +} from './types'; + +const domains: CrawlerDomainFromServer[] = [ + { + id: 'x', + name: 'moviedatabase.com', + document_count: 13, + created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + sitemaps: [], + entry_points: [], + crawl_rules: [], + default_crawl_rule: { + id: '-', + policy: CrawlerPolicies.allow, + rule: CrawlerRules.regex, + pattern: '.*', + }, + }, + { + id: 'y', + name: 'swiftype.com', + last_visited_at: 'Mon, 31 Aug 2020 17:00:00 +0000', + document_count: 40, + created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + sitemaps: [], + entry_points: [], + crawl_rules: [], + }, +]; + +const crawlRequests: CrawlRequestFromServer[] = [ + { + id: 'a', + status: CrawlerStatus.Canceled, + created_at: 'Mon, 31 Aug 2020 11:00:00 +0000', + began_at: 'Mon, 31 Aug 2020 12:00:00 +0000', + completed_at: 'Mon, 31 Aug 2020 13:00:00 +0000', + }, + { + id: 'b', + status: CrawlerStatus.Success, + created_at: 'Mon, 31 Aug 2020 14:00:00 +0000', + began_at: 'Mon, 31 Aug 2020 15:00:00 +0000', + completed_at: 'Mon, 31 Aug 2020 16:00:00 +0000', + }, +]; describe('CrawlerOverview', () => { const mockActions = { fetchCrawlerData: jest.fn(), + getLatestCrawlRequests: jest.fn(), }; const mockValues = { dataLoading: false, - domains: [], + domains, + crawlRequests, }; - let wrapper: ShallowWrapper; - beforeEach(() => { jest.clearAllMocks(); - setMockValues(mockValues); setMockActions(mockActions); - wrapper = shallow(); }); - it('calls fetchCrawlerData on page load', () => { + it('calls fetchCrawlerData and starts polling on page load', () => { + setMockValues(mockValues); + + shallow(); + expect(mockActions.fetchCrawlerData).toHaveBeenCalledTimes(1); + expect(mockActions.getLatestCrawlRequests).toHaveBeenCalledWith(false); }); - it('renders', () => { - expect(wrapper.find(DomainsTable)).toHaveLength(1); + it('contains a crawler status banner', () => { + setMockValues(mockValues); + const wrapper = shallow(); + + expect(wrapper.find(CrawlerStatusBanner)).toHaveLength(1); + }); + + it('contains a crawler status indicator', () => { + const wrapper = shallow(); + + expect(getPageHeaderActions(wrapper).find(CrawlerStatusIndicator)).toHaveLength(1); + }); + + it('hides the domain and crawl request tables when there are no domains, and no crawl requests', () => { + setMockValues({ ...mockValues, domains: [], crawlRequests: [] }); - // TODO test for CrawlRequestsTable after it is built in a future PR + const wrapper = shallow(); + expect(wrapper.find(AddDomainForm)).toHaveLength(1); + expect(wrapper.find(AddDomainFormSubmitButton)).toHaveLength(1); + expect(wrapper.find(AddDomainFlyout)).toHaveLength(0); + expect(wrapper.find(DomainsTable)).toHaveLength(0); + expect(wrapper.find(CrawlRequestsTable)).toHaveLength(0); + }); + + it('shows the domain and the crawl request tables when there are domains, but no crawl requests', () => { + setMockValues({ ...mockValues, crawlRequests: [] }); + + const wrapper = shallow(); + + expect(wrapper.find(AddDomainForm)).toHaveLength(0); + expect(wrapper.find(AddDomainFormSubmitButton)).toHaveLength(0); expect(wrapper.find(AddDomainFlyout)).toHaveLength(1); + expect(wrapper.find(DomainsTable)).toHaveLength(1); + expect(wrapper.find(CrawlRequestsTable)).toHaveLength(1); + }); + + it('hides the domain table and shows the crawl request tables when there are crawl requests but no domains', () => { + setMockValues({ ...mockValues, domains: [] }); + + const wrapper = shallow(); - // TODO test for empty state after it is built in a future PR + expect(wrapper.find(AddDomainForm)).toHaveLength(1); + expect(wrapper.find(AddDomainFormSubmitButton)).toHaveLength(1); + expect(wrapper.find(AddDomainFlyout)).toHaveLength(0); + expect(wrapper.find(DomainsTable)).toHaveLength(0); + expect(wrapper.find(CrawlRequestsTable)).toHaveLength(1); + }); + + it('shows the domain and the crawl request tables when there are crawl requests and domains', () => { + setMockValues(mockValues); + + const wrapper = shallow(); + + expect(wrapper.find(AddDomainForm)).toHaveLength(0); + expect(wrapper.find(AddDomainFormSubmitButton)).toHaveLength(0); + expect(wrapper.find(AddDomainFlyout)).toHaveLength(1); + expect(wrapper.find(DomainsTable)).toHaveLength(1); + expect(wrapper.find(CrawlRequestsTable)).toHaveLength(1); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx index 0daac399b7b09..c18c1a753d247 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.tsx @@ -9,49 +9,133 @@ import React, { useEffect } from 'react'; import { useActions, useValues } from 'kea'; -import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { DOCS_PREFIX } from '../../routes'; import { getEngineBreadcrumbs } from '../engine'; import { AppSearchPageTemplate } from '../layout'; import { AddDomainFlyout } from './components/add_domain/add_domain_flyout'; +import { AddDomainForm } from './components/add_domain/add_domain_form'; +import { AddDomainFormSubmitButton } from './components/add_domain/add_domain_form_submit_button'; +import { CrawlRequestsTable } from './components/crawl_requests_table'; +import { CrawlerStatusBanner } from './components/crawler_status_banner'; +import { CrawlerStatusIndicator } from './components/crawler_status_indicator/crawler_status_indicator'; import { DomainsTable } from './components/domains_table'; import { CRAWLER_TITLE } from './constants'; import { CrawlerOverviewLogic } from './crawler_overview_logic'; export const CrawlerOverview: React.FC = () => { - const { dataLoading } = useValues(CrawlerOverviewLogic); + const { crawlRequests, dataLoading, domains } = useValues(CrawlerOverviewLogic); - const { fetchCrawlerData } = useActions(CrawlerOverviewLogic); + const { fetchCrawlerData, getLatestCrawlRequests } = useActions(CrawlerOverviewLogic); useEffect(() => { fetchCrawlerData(); + getLatestCrawlRequests(false); }, []); return ( ], + }} isLoading={dataLoading} > - - + + + {domains.length > 0 ? ( + <> + + + +

    + {i18n.translate('xpack.enterpriseSearch.appSearch.crawler.domainsTitle', { + defaultMessage: 'Domains', + })} +

    +
    +
    + + + +
    + + + + ) : ( + <> -

    - {i18n.translate('xpack.enterpriseSearch.appSearch.crawler.domainsTitle', { - defaultMessage: 'Domains', +

    + {i18n.translate('xpack.enterpriseSearch.appSearch.crawler.empty.title', { + defaultMessage: 'Add a domain to get started', })} -

    +
    -
    - - - -
    - - + +

    + {i18n.translate('xpack.enterpriseSearch.appSearch.crawler.empty.description', { + defaultMessage: + "Easily index your website's content. To get started, enter your domain name, provide optional entry points and crawl rules, and we will handle the rest.", + })}{' '} + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.empty.crawlerDocumentationLinkDescription', + { + defaultMessage: 'Learn more about the web crawler', + } + )} + +

    +
    + + + + + + + + + )} + {(crawlRequests.length > 0 || domains.length > 0) && ( + <> + + +

    + {i18n.translate('xpack.enterpriseSearch.appSearch.crawler.crawlRequestsTitle', { + defaultMessage: 'Recent crawl requests', + })} +

    +
    + + +

    + {i18n.translate('xpack.enterpriseSearch.appSearch.crawler.crawlRequestsDescription', { + defaultMessage: + "Recent crawl requests are logged here. Using the request ID of each crawl, you can track progress and examine crawl events in Kibana's Discover or Logs user interfaces.", + })}{' '} + + {i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.configurationDocumentationLinkDescription', + { + defaultMessage: 'Learn more about configuring crawler logs in Kibana', + } + )} + +

    +
    + + + + )}
    ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts index 146f31eab8a97..86f6e14631329 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts @@ -14,19 +14,25 @@ import '../../__mocks__/engine_logic.mock'; import { nextTick } from '@kbn/test/jest'; -import { CrawlerOverviewLogic } from './crawler_overview_logic'; +import { CrawlerOverviewLogic, CrawlerOverviewValues } from './crawler_overview_logic'; import { + CrawlerData, CrawlerDataFromServer, CrawlerDomain, CrawlerPolicies, CrawlerRules, + CrawlerStatus, + CrawlRequest, CrawlRule, } from './types'; import { crawlerDataServerToClient } from './utils'; -const DEFAULT_VALUES = { +const DEFAULT_VALUES: CrawlerOverviewValues = { + crawlRequests: [], dataLoading: true, domains: [], + mostRecentCrawlRequestStatus: CrawlerStatus.Success, + timeoutId: null, }; const DEFAULT_CRAWL_RULE: CrawlRule = { @@ -36,7 +42,7 @@ const DEFAULT_CRAWL_RULE: CrawlRule = { pattern: '.*', }; -const MOCK_SERVER_DATA: CrawlerDataFromServer = { +const MOCK_SERVER_CRAWLER_DATA: CrawlerDataFromServer = { domains: [ { id: '507f1f77bcf86cd799439011', @@ -50,25 +56,52 @@ const MOCK_SERVER_DATA: CrawlerDataFromServer = { ], }; -const MOCK_CLIENT_DATA = crawlerDataServerToClient(MOCK_SERVER_DATA); +const MOCK_CLIENT_CRAWLER_DATA = crawlerDataServerToClient(MOCK_SERVER_CRAWLER_DATA); describe('CrawlerOverviewLogic', () => { - const { mount } = new LogicMounter(CrawlerOverviewLogic); + const { mount, unmount } = new LogicMounter(CrawlerOverviewLogic); const { http } = mockHttpValues; const { flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers; beforeEach(() => { jest.clearAllMocks(); + jest.useFakeTimers(); // this should be run before every test to reset these mocks mount(); }); + afterAll(() => { + jest.useRealTimers(); + }); + it('has expected default values', () => { expect(CrawlerOverviewLogic.values).toEqual(DEFAULT_VALUES); }); describe('actions', () => { + describe('clearTimeoutId', () => { + it('clears the timeout in the logic', () => { + mount({ + timeoutId: setTimeout(() => {}, 1), + }); + + CrawlerOverviewLogic.actions.clearTimeoutId(); + + expect(CrawlerOverviewLogic.values.timeoutId).toEqual(null); + }); + }); + + describe('onCreateNewTimeout', () => { + it('sets the timeout in the logic', () => { + const timeout = setTimeout(() => {}, 1); + + CrawlerOverviewLogic.actions.onCreateNewTimeout(timeout); + + expect(CrawlerOverviewLogic.values.timeoutId).toEqual(timeout); + }); + }); + describe('onReceiveCrawlerData', () => { - const crawlerData = { + const crawlerData: CrawlerData = { domains: [ { id: '507f1f77bcf86cd799439011', @@ -95,25 +128,46 @@ describe('CrawlerOverviewLogic', () => { expect(CrawlerOverviewLogic.values.dataLoading).toEqual(false); }); }); + + describe('onReceiveCrawlRequests', () => { + const crawlRequests: CrawlRequest[] = [ + { + id: '618d0e66abe97bc688328900', + status: CrawlerStatus.Pending, + createdAt: 'Mon, 31 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + ]; + + beforeEach(() => { + CrawlerOverviewLogic.actions.onReceiveCrawlRequests(crawlRequests); + }); + + it('should set the crawl requests', () => { + expect(CrawlerOverviewLogic.values.crawlRequests).toEqual(crawlRequests); + }); + }); }); describe('listeners', () => { describe('fetchCrawlerData', () => { - it('calls onReceiveCrawlerData with retrieved data that has been converted from server to client', async () => { + it('updates logic with data that has been converted from server to client', async () => { jest.spyOn(CrawlerOverviewLogic.actions, 'onReceiveCrawlerData'); + http.get.mockReturnValueOnce(Promise.resolve(MOCK_SERVER_CRAWLER_DATA)); - http.get.mockReturnValue(Promise.resolve(MOCK_SERVER_DATA)); CrawlerOverviewLogic.actions.fetchCrawlerData(); await nextTick(); expect(http.get).toHaveBeenCalledWith('/api/app_search/engines/some-engine/crawler'); expect(CrawlerOverviewLogic.actions.onReceiveCrawlerData).toHaveBeenCalledWith( - MOCK_CLIENT_DATA + MOCK_CLIENT_CRAWLER_DATA ); }); - it('calls flashApiErrors when there is an error', async () => { - http.get.mockReturnValue(Promise.reject('error')); + it('calls flashApiErrors when there is an error on the request for crawler data', async () => { + http.get.mockReturnValueOnce(Promise.reject('error')); + CrawlerOverviewLogic.actions.fetchCrawlerData(); await nextTick(); @@ -124,8 +178,8 @@ describe('CrawlerOverviewLogic', () => { describe('deleteDomain', () => { it('calls onReceiveCrawlerData with retrieved data that has been converted from server to client', async () => { jest.spyOn(CrawlerOverviewLogic.actions, 'onReceiveCrawlerData'); + http.delete.mockReturnValue(Promise.resolve(MOCK_SERVER_CRAWLER_DATA)); - http.delete.mockReturnValue(Promise.resolve(MOCK_SERVER_DATA)); CrawlerOverviewLogic.actions.deleteDomain({ id: '1234' } as CrawlerDomain); await nextTick(); @@ -136,18 +190,255 @@ describe('CrawlerOverviewLogic', () => { } ); expect(CrawlerOverviewLogic.actions.onReceiveCrawlerData).toHaveBeenCalledWith( - MOCK_CLIENT_DATA + MOCK_CLIENT_CRAWLER_DATA ); expect(flashSuccessToast).toHaveBeenCalled(); }); it('calls flashApiErrors when there is an error', async () => { http.delete.mockReturnValue(Promise.reject('error')); + CrawlerOverviewLogic.actions.deleteDomain({ id: '1234' } as CrawlerDomain); await nextTick(); expect(flashAPIErrors).toHaveBeenCalledWith('error'); }); }); + + describe('startCrawl', () => { + describe('success path', () => { + it('creates a new crawl request and then fetches the latest crawl requests', async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'getLatestCrawlRequests'); + http.post.mockReturnValueOnce(Promise.resolve()); + + CrawlerOverviewLogic.actions.startCrawl(); + await nextTick(); + + expect(http.post).toHaveBeenCalledWith( + '/api/app_search/engines/some-engine/crawler/crawl_requests' + ); + expect(CrawlerOverviewLogic.actions.getLatestCrawlRequests).toHaveBeenCalled(); + }); + }); + + describe('on failure', () => { + it('flashes an error message', async () => { + http.post.mockReturnValueOnce(Promise.reject('error')); + + CrawlerOverviewLogic.actions.startCrawl(); + await nextTick(); + + expect(flashAPIErrors).toHaveBeenCalledWith('error'); + }); + }); + }); + + describe('stopCrawl', () => { + describe('success path', () => { + it('stops the crawl starts and then fetches the latest crawl requests', async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'getLatestCrawlRequests'); + http.post.mockReturnValueOnce(Promise.resolve()); + + CrawlerOverviewLogic.actions.stopCrawl(); + await nextTick(); + + expect(http.post).toHaveBeenCalledWith( + '/api/app_search/engines/some-engine/crawler/crawl_requests/cancel' + ); + expect(CrawlerOverviewLogic.actions.getLatestCrawlRequests).toHaveBeenCalled(); + }); + }); + + describe('on failure', () => { + it('flashes an error message', async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'getLatestCrawlRequests'); + http.post.mockReturnValueOnce(Promise.reject('error')); + + CrawlerOverviewLogic.actions.stopCrawl(); + await nextTick(); + + expect(flashAPIErrors).toHaveBeenCalledWith('error'); + }); + }); + }); + + describe('createNewTimeoutForCrawlRequests', () => { + it('saves the timeout ID in the logic', () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'onCreateNewTimeout'); + jest.spyOn(CrawlerOverviewLogic.actions, 'getLatestCrawlRequests'); + + CrawlerOverviewLogic.actions.createNewTimeoutForCrawlRequests(2000); + + expect(setTimeout).toHaveBeenCalledWith(expect.any(Function), 2000); + expect(CrawlerOverviewLogic.actions.onCreateNewTimeout).toHaveBeenCalled(); + + jest.runAllTimers(); + + expect(CrawlerOverviewLogic.actions.getLatestCrawlRequests).toHaveBeenCalled(); + }); + + it('clears a timeout if one already exists', () => { + const timeoutId = setTimeout(() => {}, 1); + mount({ + timeoutId, + }); + + CrawlerOverviewLogic.actions.createNewTimeoutForCrawlRequests(2000); + + expect(clearTimeout).toHaveBeenCalledWith(timeoutId); + }); + }); + + describe('getLatestCrawlRequests', () => { + describe('on success', () => { + [ + CrawlerStatus.Pending, + CrawlerStatus.Starting, + CrawlerStatus.Running, + CrawlerStatus.Canceling, + ].forEach((status) => { + it(`creates a new timeout for status ${status}`, async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'createNewTimeoutForCrawlRequests'); + http.get.mockReturnValueOnce(Promise.resolve([{ status }])); + + CrawlerOverviewLogic.actions.getLatestCrawlRequests(); + await nextTick(); + + expect( + CrawlerOverviewLogic.actions.createNewTimeoutForCrawlRequests + ).toHaveBeenCalled(); + }); + }); + + [CrawlerStatus.Success, CrawlerStatus.Failed, CrawlerStatus.Canceled].forEach((status) => { + it(`clears the timeout and fetches data for status ${status}`, async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'clearTimeoutId'); + jest.spyOn(CrawlerOverviewLogic.actions, 'fetchCrawlerData'); + http.get.mockReturnValueOnce(Promise.resolve([{ status }])); + + CrawlerOverviewLogic.actions.getLatestCrawlRequests(); + await nextTick(); + + expect(CrawlerOverviewLogic.actions.clearTimeoutId).toHaveBeenCalled(); + expect(CrawlerOverviewLogic.actions.fetchCrawlerData).toHaveBeenCalled(); + }); + + it(`optionally supresses fetching data for status ${status}`, async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'clearTimeoutId'); + jest.spyOn(CrawlerOverviewLogic.actions, 'fetchCrawlerData'); + http.get.mockReturnValueOnce(Promise.resolve([{ status }])); + + CrawlerOverviewLogic.actions.getLatestCrawlRequests(false); + await nextTick(); + + expect(CrawlerOverviewLogic.actions.clearTimeoutId).toHaveBeenCalled(); + expect(CrawlerOverviewLogic.actions.fetchCrawlerData).toHaveBeenCalledTimes(0); + }); + }); + }); + + describe('on failure', () => { + it('creates a new timeout', async () => { + jest.spyOn(CrawlerOverviewLogic.actions, 'createNewTimeoutForCrawlRequests'); + http.get.mockReturnValueOnce(Promise.reject()); + + CrawlerOverviewLogic.actions.getLatestCrawlRequests(); + await nextTick(); + + expect(CrawlerOverviewLogic.actions.createNewTimeoutForCrawlRequests).toHaveBeenCalled(); + }); + }); + }); + }); + + describe('selectors', () => { + describe('mostRecentCrawlRequestStatus', () => { + it('is Success when there are no crawl requests', () => { + mount({ + crawlRequests: [], + }); + + expect(CrawlerOverviewLogic.values.mostRecentCrawlRequestStatus).toEqual( + CrawlerStatus.Success + ); + }); + + it('is Success when there are only crawl requests', () => { + mount({ + crawlRequests: [ + { + id: '2', + status: CrawlerStatus.Skipped, + createdAt: 'Mon, 31 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + { + id: '1', + status: CrawlerStatus.Skipped, + createdAt: 'Mon, 30 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + ], + }); + + expect(CrawlerOverviewLogic.values.mostRecentCrawlRequestStatus).toEqual( + CrawlerStatus.Success + ); + }); + + it('is the first non-skipped crawl request status', () => { + mount({ + crawlRequests: [ + { + id: '3', + status: CrawlerStatus.Skipped, + createdAt: 'Mon, 31 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + { + id: '2', + status: CrawlerStatus.Failed, + createdAt: 'Mon, 30 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + { + id: '1', + status: CrawlerStatus.Success, + createdAt: 'Mon, 29 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }, + ], + }); + + expect(CrawlerOverviewLogic.values.mostRecentCrawlRequestStatus).toEqual( + CrawlerStatus.Failed + ); + }); + }); + }); + + describe('events', () => { + describe('beforeUnmount', () => { + it('clears the timeout if there is one', () => { + jest.spyOn(global, 'setTimeout'); + + mount({ + timeoutId: setTimeout(() => {}, 1), + }); + unmount(); + + expect(setTimeout).toHaveBeenCalled(); + }); + + it('does not crash if no timeout exists', () => { + mount({ timeoutId: null }); + unmount(); + }); + }); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts index 3f64cbbd9a866..35dd866c0453e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.ts @@ -14,8 +14,14 @@ import { flashAPIErrors, flashSuccessToast } from '../../../shared/flash_message import { HttpLogic } from '../../../shared/http'; import { EngineLogic } from '../engine'; -import { CrawlerData, CrawlerDomain } from './types'; -import { crawlerDataServerToClient } from './utils'; +import { + CrawlerData, + CrawlerDomain, + CrawlRequest, + CrawlRequestFromServer, + CrawlerStatus, +} from './types'; +import { crawlerDataServerToClient, crawlRequestServerToClient } from './utils'; export const DELETE_DOMAIN_MESSAGE = (domainUrl: string) => i18n.translate( @@ -28,15 +34,28 @@ export const DELETE_DOMAIN_MESSAGE = (domainUrl: string) => } ); -interface CrawlerOverviewValues { +const POLLING_DURATION = 1000; +const POLLING_DURATION_ON_FAILURE = 5000; + +export interface CrawlerOverviewValues { + crawlRequests: CrawlRequest[]; dataLoading: boolean; domains: CrawlerDomain[]; + mostRecentCrawlRequestStatus: CrawlerStatus; + timeoutId: NodeJS.Timeout | null; } interface CrawlerOverviewActions { + clearTimeoutId(): void; + createNewTimeoutForCrawlRequests(duration: number): { duration: number }; deleteDomain(domain: CrawlerDomain): { domain: CrawlerDomain }; fetchCrawlerData(): void; + getLatestCrawlRequests(refreshData?: boolean): { refreshData?: boolean }; + onCreateNewTimeout(timeoutId: NodeJS.Timeout): { timeoutId: NodeJS.Timeout }; onReceiveCrawlerData(data: CrawlerData): { data: CrawlerData }; + onReceiveCrawlRequests(crawlRequests: CrawlRequest[]): { crawlRequests: CrawlRequest[] }; + startCrawl(): void; + stopCrawl(): void; } export const CrawlerOverviewLogic = kea< @@ -44,9 +63,16 @@ export const CrawlerOverviewLogic = kea< >({ path: ['enterprise_search', 'app_search', 'crawler', 'crawler_overview'], actions: { + clearTimeoutId: true, + createNewTimeoutForCrawlRequests: (duration) => ({ duration }), deleteDomain: (domain) => ({ domain }), fetchCrawlerData: true, + getLatestCrawlRequests: (refreshData) => ({ refreshData }), + onCreateNewTimeout: (timeoutId) => ({ timeoutId }), onReceiveCrawlerData: (data) => ({ data }), + onReceiveCrawlRequests: (crawlRequests) => ({ crawlRequests }), + startCrawl: () => null, + stopCrawl: () => null, }, reducers: { dataLoading: [ @@ -61,15 +87,44 @@ export const CrawlerOverviewLogic = kea< onReceiveCrawlerData: (_, { data: { domains } }) => domains, }, ], + crawlRequests: [ + [], + { + onReceiveCrawlRequests: (_, { crawlRequests }) => crawlRequests, + }, + ], + timeoutId: [ + null, + { + clearTimeoutId: () => null, + onCreateNewTimeout: (_, { timeoutId }) => timeoutId, + }, + ], }, - listeners: ({ actions }) => ({ + selectors: ({ selectors }) => ({ + mostRecentCrawlRequestStatus: [ + () => [selectors.crawlRequests], + (crawlRequests: CrawlerOverviewValues['crawlRequests']) => { + const eligibleCrawlRequests = crawlRequests.filter( + (req) => req.status !== CrawlerStatus.Skipped + ); + if (eligibleCrawlRequests.length === 0) { + return CrawlerStatus.Success; + } + return eligibleCrawlRequests[0].status; + }, + ], + }), + listeners: ({ actions, values }) => ({ fetchCrawlerData: async () => { const { http } = HttpLogic.values; const { engineName } = EngineLogic.values; try { const response = await http.get(`/api/app_search/engines/${engineName}/crawler`); + const crawlerData = crawlerDataServerToClient(response); + actions.onReceiveCrawlerData(crawlerData); } catch (e) { flashAPIErrors(e); @@ -95,5 +150,78 @@ export const CrawlerOverviewLogic = kea< flashAPIErrors(e); } }, + startCrawl: async () => { + const { http } = HttpLogic.values; + const { engineName } = EngineLogic.values; + + try { + await http.post(`/api/app_search/engines/${engineName}/crawler/crawl_requests`); + actions.getLatestCrawlRequests(); + } catch (e) { + flashAPIErrors(e); + } + }, + stopCrawl: async () => { + const { http } = HttpLogic.values; + const { engineName } = EngineLogic.values; + + try { + await http.post(`/api/app_search/engines/${engineName}/crawler/crawl_requests/cancel`); + actions.getLatestCrawlRequests(); + } catch (e) { + flashAPIErrors(e); + } + }, + createNewTimeoutForCrawlRequests: ({ duration }) => { + if (values.timeoutId) { + clearTimeout(values.timeoutId); + } + + const timeoutIdId = setTimeout(() => { + actions.getLatestCrawlRequests(); + }, duration); + + actions.onCreateNewTimeout(timeoutIdId); + }, + getLatestCrawlRequests: async ({ refreshData = true }) => { + const { http } = HttpLogic.values; + const { engineName } = EngineLogic.values; + + try { + const crawlRequestsFromServer: CrawlRequestFromServer[] = await http.get( + `/api/app_search/engines/${engineName}/crawler/crawl_requests` + ); + const crawlRequests = crawlRequestsFromServer.map(crawlRequestServerToClient); + actions.onReceiveCrawlRequests(crawlRequests); + if ( + [ + CrawlerStatus.Pending, + CrawlerStatus.Starting, + CrawlerStatus.Running, + CrawlerStatus.Canceling, + ].includes(crawlRequests[0]?.status) + ) { + actions.createNewTimeoutForCrawlRequests(POLLING_DURATION); + } else if ( + [CrawlerStatus.Success, CrawlerStatus.Failed, CrawlerStatus.Canceled].includes( + crawlRequests[0]?.status + ) + ) { + actions.clearTimeoutId(); + if (refreshData) { + actions.fetchCrawlerData(); + } + } + } catch (e) { + actions.createNewTimeoutForCrawlRequests(POLLING_DURATION_ON_FAILURE); + } + }, + }), + events: ({ values }) => ({ + beforeUnmount: () => { + if (values.timeoutId) { + clearTimeout(values.timeoutId); + } + }, }), }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx index 587ba61ce27e9..3fa0153861319 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.test.tsx @@ -8,17 +8,22 @@ import React from 'react'; import { Switch } from 'react-router-dom'; -import { shallow } from 'enzyme'; +import { shallow, ShallowWrapper } from 'enzyme'; + +import { rerender } from '../../../test_helpers'; import { CrawlerLanding } from './crawler_landing'; import { CrawlerOverview } from './crawler_overview'; import { CrawlerRouter } from './crawler_router'; +import { CrawlerSingleDomain } from './crawler_single_domain'; describe('CrawlerRouter', () => { + let wrapper: ShallowWrapper; const OLD_ENV = process.env; beforeEach(() => { jest.clearAllMocks(); + wrapper = shallow(); }); afterEach(() => { @@ -26,16 +31,18 @@ describe('CrawlerRouter', () => { }); it('renders a landing page by default', () => { - const wrapper = shallow(); - expect(wrapper.find(Switch)).toHaveLength(1); expect(wrapper.find(CrawlerLanding)).toHaveLength(1); }); it('renders a crawler overview in dev', () => { process.env.NODE_ENV = 'development'; - const wrapper = shallow(); + rerender(wrapper); expect(wrapper.find(CrawlerOverview)).toHaveLength(1); }); + + it('renders a crawler single domain view', () => { + expect(wrapper.find(CrawlerSingleDomain)).toHaveLength(1); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.tsx index c5dd3907c9019..3919740b0c6cb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_router.tsx @@ -8,10 +8,11 @@ import React from 'react'; import { Route, Switch } from 'react-router-dom'; -import { ENGINE_CRAWLER_PATH } from '../../routes'; +import { ENGINE_CRAWLER_DOMAIN_PATH, ENGINE_CRAWLER_PATH } from '../../routes'; import { CrawlerLanding } from './crawler_landing'; import { CrawlerOverview } from './crawler_overview'; +import { CrawlerSingleDomain } from './crawler_single_domain'; export const CrawlerRouter: React.FC = () => { return ( @@ -19,6 +20,9 @@ export const CrawlerRouter: React.FC = () => { {process.env.NODE_ENV === 'development' ? : } + + + ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain.test.tsx new file mode 100644 index 0000000000000..e2b230041c810 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain.test.tsx @@ -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 { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; +import '../../../__mocks__/shallow_useeffect.mock'; +import '../../__mocks__/engine_logic.mock'; +import { mockUseParams } from '../../../__mocks__/react_router'; + +import React from 'react'; + +import { shallow } from 'enzyme'; + +import { EuiCode } from '@elastic/eui'; + +import { getPageHeaderActions } from '../../../test_helpers'; + +import { CrawlerStatusBanner } from './components/crawler_status_banner'; +import { CrawlerStatusIndicator } from './components/crawler_status_indicator/crawler_status_indicator'; +import { CrawlerOverview } from './crawler_overview'; +import { CrawlerSingleDomain } from './crawler_single_domain'; + +const MOCK_VALUES = { + // CrawlerSingleDomainLogic + dataLoading: false, + domain: { + url: 'https://elastic.co', + }, + // CrawlerOverviewLogic + domains: [], + crawlRequests: [], +}; + +const MOCK_ACTIONS = { + fetchCrawlerData: jest.fn(), + fetchDomainData: jest.fn(), + getLatestCrawlRequests: jest.fn(), +}; + +describe('CrawlerSingleDomain', () => { + beforeEach(() => { + jest.clearAllMocks(); + mockUseParams.mockReturnValue({ domainId: '507f1f77bcf86cd799439011' }); + setMockActions(MOCK_ACTIONS); + setMockValues(MOCK_VALUES); + }); + + it('renders', () => { + const wrapper = shallow(); + + expect(wrapper.find(EuiCode).render().text()).toContain('https://elastic.co'); + expect(wrapper.prop('pageHeader').pageTitle).toEqual('https://elastic.co'); + }); + + it('uses a placeholder for the page title and page chrome if a domain has not been set', () => { + setMockValues({ + ...MOCK_VALUES, + domain: null, + }); + + const wrapper = shallow(); + + expect(wrapper.prop('pageHeader').pageTitle).toEqual('Loading...'); + }); + + it('contains a crawler status banner', () => { + const wrapper = shallow(); + + expect(wrapper.find(CrawlerStatusBanner)).toHaveLength(1); + }); + + it('contains a crawler status indicator', () => { + const wrapper = shallow(); + + expect(getPageHeaderActions(wrapper).find(CrawlerStatusIndicator)).toHaveLength(1); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain.tsx new file mode 100644 index 0000000000000..9f9ec288a690c --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain.tsx @@ -0,0 +1,54 @@ +/* + * 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, { useEffect } from 'react'; + +import { useParams } from 'react-router-dom'; + +import { useActions, useValues } from 'kea'; + +import { EuiCode, EuiSpacer } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { getEngineBreadcrumbs } from '../engine'; +import { AppSearchPageTemplate } from '../layout'; + +import { CrawlerStatusBanner } from './components/crawler_status_banner'; +import { CrawlerStatusIndicator } from './components/crawler_status_indicator/crawler_status_indicator'; +import { CRAWLER_TITLE } from './constants'; +import { CrawlerSingleDomainLogic } from './crawler_single_domain_logic'; + +export const CrawlerSingleDomain: React.FC = () => { + const { domainId } = useParams() as { domainId: string }; + + const { dataLoading, domain } = useValues(CrawlerSingleDomainLogic); + + const { fetchDomainData } = useActions(CrawlerSingleDomainLogic); + + const displayDomainUrl = domain + ? domain.url + : i18n.translate('xpack.enterpriseSearch.appSearch.crawler.singleDomain.loadingTitle', { + defaultMessage: 'Loading...', + }); + + useEffect(() => { + fetchDomainData(domainId); + }, []); + + return ( + ] }} + isLoading={dataLoading} + > + + + {JSON.stringify(domain, null, 2)} + + ); +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts new file mode 100644 index 0000000000000..bb478a30ee5ef --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.test.ts @@ -0,0 +1,98 @@ +/* + * 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 { + LogicMounter, + mockHttpValues, + mockFlashMessageHelpers, +} from '../../../__mocks__/kea_logic'; +import '../../__mocks__/engine_logic.mock'; + +import { nextTick } from '@kbn/test/jest'; + +import { CrawlerSingleDomainLogic, CrawlerSingleDomainValues } from './crawler_single_domain_logic'; +import { CrawlerDomain } from './types'; + +const DEFAULT_VALUES: CrawlerSingleDomainValues = { + dataLoading: true, + domain: null, +}; + +describe('CrawlerSingleDomainLogic', () => { + const { mount } = new LogicMounter(CrawlerSingleDomainLogic); + const { http } = mockHttpValues; + const { flashAPIErrors } = mockFlashMessageHelpers; + + beforeEach(() => { + jest.clearAllMocks(); + mount(); + }); + + it('has expected default values', () => { + expect(CrawlerSingleDomainLogic.values).toEqual(DEFAULT_VALUES); + }); + + describe('actions', () => { + describe('onReceiveDomainData', () => { + const domain = { + id: '507f1f77bcf86cd799439011', + }; + + beforeEach(() => { + CrawlerSingleDomainLogic.actions.onReceiveDomainData(domain as CrawlerDomain); + }); + + it('should set the domain', () => { + expect(CrawlerSingleDomainLogic.values.domain).toEqual(domain); + }); + }); + }); + + describe('listeners', () => { + describe('fetchDomainData', () => { + it('updates logic with data that has been converted from server to client', async () => { + jest.spyOn(CrawlerSingleDomainLogic.actions, 'onReceiveDomainData'); + http.get.mockReturnValueOnce( + Promise.resolve({ + id: '507f1f77bcf86cd799439011', + name: 'https://elastic.co', + created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + document_count: 13, + sitemaps: [], + entry_points: [], + crawl_rules: [], + }) + ); + + CrawlerSingleDomainLogic.actions.fetchDomainData('507f1f77bcf86cd799439011'); + await nextTick(); + + expect(http.get).toHaveBeenCalledWith( + '/api/app_search/engines/some-engine/crawler/domains/507f1f77bcf86cd799439011' + ); + expect(CrawlerSingleDomainLogic.actions.onReceiveDomainData).toHaveBeenCalledWith({ + id: '507f1f77bcf86cd799439011', + createdOn: 'Mon, 31 Aug 2020 17:00:00 +0000', + url: 'https://elastic.co', + documentCount: 13, + sitemaps: [], + entryPoints: [], + crawlRules: [], + }); + }); + + it('displays any errors to the user', async () => { + http.get.mockReturnValueOnce(Promise.reject('error')); + + CrawlerSingleDomainLogic.actions.fetchDomainData('507f1f77bcf86cd799439011'); + await nextTick(); + + expect(flashAPIErrors).toHaveBeenCalledWith('error'); + }); + }); + }); +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts new file mode 100644 index 0000000000000..bccd67a4921d1 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_single_domain_logic.ts @@ -0,0 +1,68 @@ +/* + * 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 { kea, MakeLogicType } from 'kea'; + +import { flashAPIErrors } from '../../../shared/flash_messages'; + +import { HttpLogic } from '../../../shared/http'; +import { EngineLogic } from '../engine'; + +import { CrawlerDomain } from './types'; +import { crawlerDomainServerToClient } from './utils'; + +export interface CrawlerSingleDomainValues { + dataLoading: boolean; + domain: CrawlerDomain | null; +} + +interface CrawlerSingleDomainActions { + fetchDomainData(domainId: string): { domainId: string }; + onReceiveDomainData(domain: CrawlerDomain): { domain: CrawlerDomain }; +} + +export const CrawlerSingleDomainLogic = kea< + MakeLogicType +>({ + path: ['enterprise_search', 'app_search', 'crawler', 'crawler_single_domain'], + actions: { + fetchDomainData: (domainId) => ({ domainId }), + onReceiveDomainData: (domain) => ({ domain }), + }, + reducers: { + dataLoading: [ + true, + { + onReceiveDomainData: () => false, + }, + ], + domain: [ + null, + { + onReceiveDomainData: (_, { domain }) => domain, + }, + ], + }, + listeners: ({ actions }) => ({ + fetchDomainData: async ({ domainId }) => { + const { http } = HttpLogic.values; + const { engineName } = EngineLogic.values; + + try { + const response = await http.get( + `/api/app_search/engines/${engineName}/crawler/domains/${domainId}` + ); + + const domainData = crawlerDomainServerToClient(response); + + actions.onReceiveDomainData(domainData); + } catch (e) { + flashAPIErrors(e); + } + }, + }), +}); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/types.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/types.ts index 38f06c7fab927..8f1abd6cb055b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/types.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { i18n } from '@kbn/i18n'; + export enum CrawlerPolicies { allow = 'allow', deny = 'deny', @@ -101,3 +103,75 @@ export type CrawlerDomainValidationStepName = | 'networkConnectivity' | 'indexingRestrictions' | 'contentVerification'; +// See SharedTogo::Crawler::Status for details on how these are generated +export enum CrawlerStatus { + Pending = 'pending', + Suspended = 'suspended', + Starting = 'starting', + Running = 'running', + Suspending = 'suspending', + Canceling = 'canceling', + Success = 'success', + Failed = 'failed', + Canceled = 'canceled', + Skipped = 'skipped', +} + +export interface CrawlRequestFromServer { + id: string; + status: CrawlerStatus; + created_at: string; + began_at: string | null; + completed_at: string | null; +} + +export interface CrawlRequest { + id: string; + status: CrawlerStatus; + createdAt: string; + beganAt: string | null; + completedAt: string | null; +} + +export const readableCrawlerStatuses: { [key in CrawlerStatus]: string } = { + [CrawlerStatus.Pending]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.pending', + { defaultMessage: 'Pending' } + ), + [CrawlerStatus.Suspended]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.suspended', + { defaultMessage: 'Suspended' } + ), + [CrawlerStatus.Starting]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.starting', + { defaultMessage: 'Starting' } + ), + [CrawlerStatus.Running]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.running', + { defaultMessage: 'Running' } + ), + [CrawlerStatus.Suspending]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.suspending', + { defaultMessage: 'Suspending' } + ), + [CrawlerStatus.Canceling]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.canceling', + { defaultMessage: 'Canceling' } + ), + [CrawlerStatus.Success]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.success', + { defaultMessage: 'Success' } + ), + [CrawlerStatus.Failed]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.failed', + { defaultMessage: 'Failed' } + ), + [CrawlerStatus.Canceled]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.canceled', + { defaultMessage: 'Canceled' } + ), + [CrawlerStatus.Skipped]: i18n.translate( + 'xpack.enterpriseSearch.appSearch.crawler.crawlerStatusOptions.skipped', + { defaultMessage: 'Skipped' } + ), +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.test.ts index c1b715f5d823a..95a7c714eba6a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.test.ts @@ -12,12 +12,17 @@ import { CrawlerDomainFromServer, CrawlerDomainValidationStep, CrawlerDomainValidationResultFromServer, + CrawlRequestFromServer, + CrawlerStatus, + CrawlerData, + CrawlRequest, } from './types'; import { crawlerDomainServerToClient, crawlerDataServerToClient, crawlDomainValidationToResult, + crawlRequestServerToClient, } from './utils'; const DEFAULT_CRAWL_RULE: CrawlRule = { @@ -68,38 +73,97 @@ describe('crawlerDomainServerToClient', () => { }); }); +describe('crawlRequestServerToClient', () => { + it('converts the API payload into properties matching our code style', () => { + const id = '507f1f77bcf86cd799439011'; + + const defaultServerPayload: CrawlRequestFromServer = { + id, + status: CrawlerStatus.Pending, + created_at: 'Mon, 31 Aug 2020 17:00:00 +0000', + began_at: null, + completed_at: null, + }; + + const defaultClientPayload: CrawlRequest = { + id, + status: CrawlerStatus.Pending, + createdAt: 'Mon, 31 Aug 2020 17:00:00 +0000', + beganAt: null, + completedAt: null, + }; + + expect(crawlRequestServerToClient(defaultServerPayload)).toStrictEqual(defaultClientPayload); + expect( + crawlRequestServerToClient({ + ...defaultServerPayload, + began_at: 'Mon, 31 Aug 2020 17:00:00 +0000', + }) + ).toStrictEqual({ ...defaultClientPayload, beganAt: 'Mon, 31 Aug 2020 17:00:00 +0000' }); + expect( + crawlRequestServerToClient({ + ...defaultServerPayload, + completed_at: 'Mon, 31 Aug 2020 17:00:00 +0000', + }) + ).toStrictEqual({ ...defaultClientPayload, completedAt: 'Mon, 31 Aug 2020 17:00:00 +0000' }); + }); +}); + describe('crawlerDataServerToClient', () => { + let output: CrawlerData; + + const domains: CrawlerDomainFromServer[] = [ + { + id: 'x', + name: 'moviedatabase.com', + document_count: 13, + created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + sitemaps: [], + entry_points: [], + crawl_rules: [], + default_crawl_rule: DEFAULT_CRAWL_RULE, + }, + { + id: 'y', + name: 'swiftype.com', + last_visited_at: 'Mon, 31 Aug 2020 17:00:00 +0000', + document_count: 40, + created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + sitemaps: [], + entry_points: [], + crawl_rules: [], + }, + ]; + + beforeAll(() => { + output = crawlerDataServerToClient({ + domains, + }); + }); + it('converts all domains from the server form to their client form', () => { - const domains: CrawlerDomainFromServer[] = [ + expect(output.domains).toEqual([ { id: 'x', - name: 'moviedatabase.com', - document_count: 13, - created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + url: 'moviedatabase.com', + documentCount: 13, + createdOn: 'Mon, 31 Aug 2020 17:00:00 +0000', sitemaps: [], - entry_points: [], - crawl_rules: [], - default_crawl_rule: DEFAULT_CRAWL_RULE, + entryPoints: [], + crawlRules: [], + defaultCrawlRule: DEFAULT_CRAWL_RULE, }, { id: 'y', - name: 'swiftype.com', - last_visited_at: 'Mon, 31 Aug 2020 17:00:00 +0000', - document_count: 40, - created_on: 'Mon, 31 Aug 2020 17:00:00 +0000', + url: 'swiftype.com', + lastCrawl: 'Mon, 31 Aug 2020 17:00:00 +0000', + documentCount: 40, + createdOn: 'Mon, 31 Aug 2020 17:00:00 +0000', sitemaps: [], - entry_points: [], - crawl_rules: [], + entryPoints: [], + crawlRules: [], }, - ]; - - const output = crawlerDataServerToClient({ - domains, - }); - - expect(output.domains).toHaveLength(2); - expect(output.domains[0]).toEqual(crawlerDomainServerToClient(domains[0])); - expect(output.domains[1]).toEqual(crawlerDomainServerToClient(domains[1])); + ]); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.ts index f466c3d2faca0..fe759044b3e1b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/utils.ts @@ -12,6 +12,8 @@ import { CrawlerDataFromServer, CrawlerDomainValidationResultFromServer, CrawlerDomainValidationStep, + CrawlRequestFromServer, + CrawlRequest, } from './types'; export function crawlerDomainServerToClient(payload: CrawlerDomainFromServer): CrawlerDomain { @@ -48,6 +50,24 @@ export function crawlerDomainServerToClient(payload: CrawlerDomainFromServer): C return clientPayload; } +export function crawlRequestServerToClient(crawlRequest: CrawlRequestFromServer): CrawlRequest { + const { + id, + status, + created_at: createdAt, + began_at: beganAt, + completed_at: completedAt, + } = crawlRequest; + + return { + id, + status, + createdAt, + beganAt, + completedAt, + }; +} + export function crawlerDataServerToClient(payload: CrawlerDataFromServer): CrawlerData { const { domains } = payload; diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts index 499b8da25774e..3b790bf2696cb 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.test.ts @@ -43,6 +43,105 @@ describe('crawler routes', () => { }); }); + describe('GET /api/app_search/engines/{name}/crawler/crawl_requests', () => { + let mockRouter: MockRouter; + + beforeEach(() => { + jest.clearAllMocks(); + mockRouter = new MockRouter({ + method: 'get', + path: '/api/app_search/engines/{name}/crawler/crawl_requests', + }); + + registerCrawlerRoutes({ + ...mockDependencies, + router: mockRouter.router, + }); + }); + + it('creates a request to enterprise search', () => { + expect(mockRequestHandler.createRequest).toHaveBeenCalledWith({ + path: '/api/as/v0/engines/:name/crawler/crawl_requests', + }); + }); + + it('validates correctly with name', () => { + const request = { params: { name: 'some-engine' } }; + mockRouter.shouldValidate(request); + }); + + it('fails validation without name', () => { + const request = { params: {} }; + mockRouter.shouldThrow(request); + }); + }); + + describe('POST /api/app_search/engines/{name}/crawler/crawl_requests', () => { + let mockRouter: MockRouter; + + beforeEach(() => { + jest.clearAllMocks(); + mockRouter = new MockRouter({ + method: 'post', + path: '/api/app_search/engines/{name}/crawler/crawl_requests', + }); + + registerCrawlerRoutes({ + ...mockDependencies, + router: mockRouter.router, + }); + }); + + it('creates a request to enterprise search', () => { + expect(mockRequestHandler.createRequest).toHaveBeenCalledWith({ + path: '/api/as/v0/engines/:name/crawler/crawl_requests', + }); + }); + + it('validates correctly with name', () => { + const request = { params: { name: 'some-engine' } }; + mockRouter.shouldValidate(request); + }); + + it('fails validation without name', () => { + const request = { params: {} }; + mockRouter.shouldThrow(request); + }); + }); + + describe('POST /api/app_search/engines/{name}/crawler/crawl_requests/cancel', () => { + let mockRouter: MockRouter; + + beforeEach(() => { + jest.clearAllMocks(); + mockRouter = new MockRouter({ + method: 'post', + path: '/api/app_search/engines/{name}/crawler/crawl_requests/cancel', + }); + + registerCrawlerRoutes({ + ...mockDependencies, + router: mockRouter.router, + }); + }); + + it('creates a request to enterprise search', () => { + expect(mockRequestHandler.createRequest).toHaveBeenCalledWith({ + path: '/api/as/v0/engines/:name/crawler/crawl_requests/active/cancel', + }); + }); + + it('validates correctly with name', () => { + const request = { params: { name: 'some-engine' } }; + mockRouter.shouldValidate(request); + }); + + it('fails validation without name', () => { + const request = { params: {} }; + mockRouter.shouldThrow(request); + }); + }); + describe('POST /api/app_search/engines/{name}/crawler/domains', () => { let mockRouter: MockRouter; @@ -145,6 +244,44 @@ describe('crawler routes', () => { }); }); + describe('GET /api/app_search/engines/{name}/crawler/domains/{id}', () => { + let mockRouter: MockRouter; + + beforeEach(() => { + jest.clearAllMocks(); + mockRouter = new MockRouter({ + method: 'get', + path: '/api/app_search/engines/{name}/crawler/domains/{id}', + }); + + registerCrawlerRoutes({ + ...mockDependencies, + router: mockRouter.router, + }); + }); + + it('creates a request to enterprise search', () => { + expect(mockRequestHandler.createRequest).toHaveBeenCalledWith({ + path: '/api/as/v0/engines/:name/crawler/domains/:id', + }); + }); + + it('validates correctly with name and id', () => { + const request = { params: { name: 'some-engine', id: '1234' } }; + mockRouter.shouldValidate(request); + }); + + it('fails validation without name', () => { + const request = { params: { id: '1234' } }; + mockRouter.shouldThrow(request); + }); + + it('fails validation without id', () => { + const request = { params: { name: 'test-engine' } }; + mockRouter.shouldThrow(request); + }); + }); + describe('POST /api/app_search/crawler/validate_url', () => { let mockRouter: MockRouter; diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts index 4404551738101..26a755a6d2b6c 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/crawler.ts @@ -27,6 +27,48 @@ export function registerCrawlerRoutes({ }) ); + router.get( + { + path: '/api/app_search/engines/{name}/crawler/crawl_requests', + validate: { + params: schema.object({ + name: schema.string(), + }), + }, + }, + enterpriseSearchRequestHandler.createRequest({ + path: '/api/as/v0/engines/:name/crawler/crawl_requests', + }) + ); + + router.post( + { + path: '/api/app_search/engines/{name}/crawler/crawl_requests', + validate: { + params: schema.object({ + name: schema.string(), + }), + }, + }, + enterpriseSearchRequestHandler.createRequest({ + path: '/api/as/v0/engines/:name/crawler/crawl_requests', + }) + ); + + router.post( + { + path: '/api/app_search/engines/{name}/crawler/crawl_requests/cancel', + validate: { + params: schema.object({ + name: schema.string(), + }), + }, + }, + enterpriseSearchRequestHandler.createRequest({ + path: '/api/as/v0/engines/:name/crawler/crawl_requests/active/cancel', + }) + ); + router.post( { path: '/api/app_search/engines/{name}/crawler/domains', @@ -52,6 +94,21 @@ export function registerCrawlerRoutes({ }) ); + router.get( + { + path: '/api/app_search/engines/{name}/crawler/domains/{id}', + validate: { + params: schema.object({ + name: schema.string(), + id: schema.string(), + }), + }, + }, + enterpriseSearchRequestHandler.createRequest({ + path: '/api/as/v0/engines/:name/crawler/domains/:id', + }) + ); + router.delete( { path: '/api/app_search/engines/{name}/crawler/domains/{id}', diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx index eed94de97113d..398421278b723 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx @@ -7,21 +7,20 @@ import React, { useState, memo, useMemo } from 'react'; import ReactMarkdown from 'react-markdown'; +import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFormRow, EuiSwitch, EuiFieldText, EuiText, - EuiCodeEditor, - EuiTextArea, EuiFieldPassword, + EuiCodeBlock, } from '@elastic/eui'; import type { RegistryVarsEntry } from '../../../../types'; +import { CodeEditor } from '../../../../../../../../../../src/plugins/kibana_react/public'; -import 'brace/mode/yaml'; -import 'brace/theme/textmate'; import { MultiTextInput } from './multi_text_input'; export const PackagePolicyInputVarField: React.FunctionComponent<{ @@ -52,26 +51,34 @@ export const PackagePolicyInputVarField: React.FunctionComponent<{ switch (type) { case 'yaml': return frozen ? ( - + +
    {value}
    +
    ) : ( - onChange(newVal)} - onBlur={() => setIsDirty(true)} /> ); case 'bool': diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx index fbd6e07e07bbd..74572e74dd508 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx @@ -141,7 +141,6 @@ const AvailablePackages: React.FC = memo(() => { const queryParams = new URLSearchParams(useLocation().search); const initialCategory = queryParams.get('category') || ''; const [selectedCategory, setSelectedCategory] = useState(initialCategory); - const { data: allPackagesRes, isLoading: isLoadingAllPackages } = useGetPackages(); const { data: categoryPackagesRes, isLoading: isLoadingCategoryPackages } = useGetPackages({ category: selectedCategory, }); @@ -168,16 +167,16 @@ const AvailablePackages: React.FC = memo(() => { title: i18n.translate('xpack.fleet.epmList.allPackagesFilterLinkText', { defaultMessage: 'All', }), - count: allPackagesRes?.response?.length || 0, + count: packages?.length || 0, }, ...(categoriesRes ? categoriesRes.response : []), ], - [allPackagesRes?.response?.length, categoriesRes] + [packages?.length, categoriesRes] ); const controls = categories ? ( { diff --git a/x-pack/plugins/fleet/public/components/settings_flyout/index.tsx b/x-pack/plugins/fleet/public/components/settings_flyout/index.tsx index 9bc1bc977b786..3d3a4dda60632 100644 --- a/x-pack/plugins/fleet/public/components/settings_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/components/settings_flyout/index.tsx @@ -6,6 +6,7 @@ */ import React, { useEffect, useCallback } from 'react'; +import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; import { EuiFlyout, @@ -21,9 +22,9 @@ import { EuiForm, EuiFormRow, EuiCode, - EuiCodeEditor, EuiLink, EuiPanel, + EuiTextColor, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiText } from '@elastic/eui'; @@ -39,13 +40,29 @@ import { sendPutOutput, } from '../../hooks'; import { isDiffPathProtocol, normalizeHostsForAgents } from '../../../common'; +import { CodeEditor } from '../../../../../../src/plugins/kibana_react/public'; import { SettingsConfirmModal } from './confirm_modal'; import type { SettingsConfirmModalProps } from './confirm_modal'; import { HostsInput } from './hosts_input'; -import 'brace/mode/yaml'; -import 'brace/theme/textmate'; +const CodeEditorContainer = styled.div` + min-height: 0; + position: relative; + height: 250px; +`; + +const CodeEditorPlaceholder = styled(EuiTextColor).attrs((props) => ({ + color: 'subdued', + size: 'xs', +}))` + position: absolute; + top: 0; + right: 0; + // Matches monaco editor + font-family: Menlo, Monaco, 'Courier New', monospace; + pointer-events: none; +`; const URL_REGEX = /^(https?):\/\/[^\s$.?#].[^\s]*$/gm; @@ -361,21 +378,40 @@ export const SettingFlyout: React.FunctionComponent = ({ onClose }) => { })} fullWidth > - + + + {(!inputs.additionalYamlConfig.value || inputs.additionalYamlConfig.value === '') && ( + + {`# YAML settings here will be added to the Elasticsearch output section of each policy`} + + )} + diff --git a/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts b/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts index 365c2d1d8a902..eb70aff3238a0 100644 --- a/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts +++ b/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts @@ -23,6 +23,7 @@ export const FLEET_GLOBAL_COMPONENT_TEMPLATE_CONTENT = { properties: { ingested: { type: 'date', + format: 'strict_date_time_no_millis||strict_date_optional_time||epoch_millis', }, agent_id_status: { ignore_above: 1024, @@ -42,7 +43,12 @@ processors: - set: description: Add time when event was ingested. field: event.ingested - value: '{{{_ingest.timestamp}}}' + copy_from: _ingest.timestamp + - script: + description: Remove sub-seconds from event.ingested to improve storage efficiency. + tag: truncate-subseconds-event-ingested + source: ctx.event.ingested = ctx.event.ingested.withNano(0).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + ignore_failure: true - remove: description: Remove any pre-existing untrusted values. field: diff --git a/x-pack/plugins/fleet/server/errors/handlers.test.ts b/x-pack/plugins/fleet/server/errors/handlers.test.ts index dc6f90d64180d..2d3fddeb951f4 100644 --- a/x-pack/plugins/fleet/server/errors/handlers.test.ts +++ b/x-pack/plugins/fleet/server/errors/handlers.test.ts @@ -6,7 +6,6 @@ */ import Boom from '@hapi/boom'; -import { errors } from 'elasticsearch'; import { httpServerMock } from 'src/core/server/mocks'; import { createAppContextStartContractMock } from '../mocks'; @@ -20,9 +19,6 @@ import { defaultIngestErrorHandler, } from './index'; -const LegacyESErrors = errors as Record; -type ITestEsErrorsFnParams = [errorCode: string, error: any, expectedMessage: string]; - describe('defaultIngestErrorHandler', () => { let mockContract: ReturnType; beforeEach(async () => { @@ -36,55 +32,6 @@ describe('defaultIngestErrorHandler', () => { appContextService.stop(); }); - async function testEsErrorsFn(...args: ITestEsErrorsFnParams) { - const [, error, expectedMessage] = args; - jest.clearAllMocks(); - const response = httpServerMock.createResponseFactory(); - await defaultIngestErrorHandler({ error, response }); - - // response - expect(response.ok).toHaveBeenCalledTimes(0); - expect(response.customError).toHaveBeenCalledTimes(1); - expect(response.customError).toHaveBeenCalledWith({ - statusCode: error.status, - body: { message: expectedMessage }, - }); - - // logging - expect(mockContract.logger?.error).toHaveBeenCalledTimes(1); - expect(mockContract.logger?.error).toHaveBeenCalledWith(expectedMessage); - } - - describe('use the HTTP error status code provided by LegacyESErrors', () => { - const statusCodes = Object.keys(LegacyESErrors).filter((key) => /^\d+$/.test(key)); - const errorCodes = statusCodes.filter((key) => parseInt(key, 10) >= 400); - const casesWithPathResponse: ITestEsErrorsFnParams[] = errorCodes.map((errorCode) => [ - errorCode, - new LegacyESErrors[errorCode]('the root message', { - path: '/path/to/call', - response: 'response is here', - }), - 'the root message response from /path/to/call: response is here', - ]); - const casesWithOtherMeta: ITestEsErrorsFnParams[] = errorCodes.map((errorCode) => [ - errorCode, - new LegacyESErrors[errorCode]('the root message', { - other: '/path/to/call', - props: 'response is here', - }), - 'the root message', - ]); - const casesWithoutMeta: ITestEsErrorsFnParams[] = errorCodes.map((errorCode) => [ - errorCode, - new LegacyESErrors[errorCode]('some message'), - 'some message', - ]); - - test.each(casesWithPathResponse)('%d - with path & response', testEsErrorsFn); - test.each(casesWithOtherMeta)('%d - with other metadata', testEsErrorsFn); - test.each(casesWithoutMeta)('%d - without metadata', testEsErrorsFn); - }); - describe('IngestManagerError', () => { it('502: RegistryError', async () => { const error = new RegistryError('xyz'); diff --git a/x-pack/plugins/fleet/server/errors/handlers.ts b/x-pack/plugins/fleet/server/errors/handlers.ts index 073727729ad84..c47b1a07780ec 100644 --- a/x-pack/plugins/fleet/server/errors/handlers.ts +++ b/x-pack/plugins/fleet/server/errors/handlers.ts @@ -7,7 +7,6 @@ import type Boom from '@hapi/boom'; import { isBoom } from '@hapi/boom'; -import { errors as LegacyESErrors } from 'elasticsearch'; import type { IKibanaResponse, @@ -40,26 +39,6 @@ interface IngestErrorHandlerParams { // unsure if this is correct. would prefer to use something "official" // this type is based on BadRequest values observed while debugging https://github.com/elastic/kibana/issues/75862 -interface LegacyESClientError { - message: string; - stack: string; - status: number; - displayName: string; - path?: string; - query?: string | undefined; - body?: { - error: { - type: string; - }; - status: number; - }; - statusCode?: number; - response?: string; -} -export const isLegacyESClientError = (error: any): error is LegacyESClientError => { - return error instanceof LegacyESErrors._Abstract; -}; - const getHTTPResponseCode = (error: IngestManagerError): number => { if (error instanceof RegistryError) { return 502; // Bad Gateway @@ -84,23 +63,6 @@ const getHTTPResponseCode = (error: IngestManagerError): number => { export function ingestErrorToResponseOptions(error: IngestErrorHandlerParams['error']) { const logger = appContextService.getLogger(); - if (isLegacyESClientError(error)) { - // there was a problem communicating with ES (e.g. via `callCluster`) - // only log the message - const message = - error?.path && error?.response - ? // if possible, return the failing endpoint and its response - `${error.message} response from ${error.path}: ${error.response}` - : error.message; - - logger.error(message); - - return { - statusCode: error?.statusCode || error.status, - body: { message }, - }; - } - // our "expected" errors if (error instanceof IngestManagerError) { // only log the message diff --git a/x-pack/plugins/fleet/server/errors/index.ts b/x-pack/plugins/fleet/server/errors/index.ts index 335bd147ab585..f31719d6c4364 100644 --- a/x-pack/plugins/fleet/server/errors/index.ts +++ b/x-pack/plugins/fleet/server/errors/index.ts @@ -8,11 +8,7 @@ /* eslint-disable max-classes-per-file */ import { isESClientError } from './utils'; -export { - defaultIngestErrorHandler, - ingestErrorToResponseOptions, - isLegacyESClientError, -} from './handlers'; +export { defaultIngestErrorHandler, ingestErrorToResponseOptions } from './handlers'; export { isESClientError } from './utils'; diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index 6881e0872606d..e3ecdcda20d2a 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -333,14 +333,30 @@ class AgentPolicyService { withPackagePolicies = false, } = options; - const agentPoliciesSO = await soClient.find({ + const baseFindParams = { type: SAVED_OBJECT_TYPE, sortField, sortOrder, page, perPage, - filter: kuery ? normalizeKuery(SAVED_OBJECT_TYPE, kuery) : undefined, - }); + }; + const filter = kuery ? normalizeKuery(SAVED_OBJECT_TYPE, kuery) : undefined; + let agentPoliciesSO; + try { + agentPoliciesSO = await soClient.find({ ...baseFindParams, filter }); + } catch (e) { + const isBadRequest = e.output?.statusCode === 400; + const isKQLSyntaxError = e.message?.startsWith('KQLSyntaxError'); + if (isBadRequest && !isKQLSyntaxError) { + // fall back to simple search if the kuery is just a search term i.e not KQL + agentPoliciesSO = await soClient.find({ + ...baseFindParams, + search: kuery, + }); + } else { + throw e; + } + } const agentPolicies = await Promise.all( agentPoliciesSO.saved_objects.map(async (agentPolicySO) => { diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts index 5ea4b896e7fa1..d374553e1db83 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts @@ -14,6 +14,8 @@ import type { AgentPolicy, NewPackagePolicy, Output } from '../types'; import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '../constants'; +import * as agentPolicy from './agent_policy'; + import { ensurePreconfiguredPackagesAndPolicies, comparePreconfiguredPolicyToCurrent, @@ -128,6 +130,7 @@ jest.mock('./epm/packages/get', () => ({ jest.mock('./package_policy', () => ({ ...jest.requireActual('./package_policy'), packagePolicyService: { + getByIDs: jest.fn().mockReturnValue([]), create(soClient: any, esClient: any, newPackagePolicy: NewPackagePolicy) { return { id: 'mocked', @@ -152,10 +155,13 @@ jest.mock('./app_context', () => ({ }, })); +const spyAgentPolicyServiceUpdate = jest.spyOn(agentPolicy.agentPolicyService, 'update'); + describe('policy preconfiguration', () => { beforeEach(() => { mockInstalledPackages.clear(); mockConfiguredPolicies.clear(); + spyAgentPolicyServiceUpdate.mockClear(); }); it('should perform a no-op when passed no policies or packages', async () => { @@ -331,6 +337,84 @@ describe('policy preconfiguration', () => { expect(policiesB[0].updated_at).toEqual(policiesA[0].updated_at); expect(nonFatalErrorsB.length).toBe(0); }); + + it('should update a managed policy if top level fields are changed', async () => { + const soClient = getPutPreconfiguredPackagesMock(); + const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; + + mockConfiguredPolicies.set('test-id', { + name: 'Test policy', + description: 'Test policy description', + unenroll_timeout: 120, + namespace: 'default', + id: 'test-id', + package_policies: [], + is_managed: true, + } as PreconfiguredAgentPolicy); + + const { + policies, + nonFatalErrors: nonFatalErrorsB, + } = await ensurePreconfiguredPackagesAndPolicies( + soClient, + esClient, + [ + { + name: 'Renamed Test policy', + description: 'Renamed Test policy description', + unenroll_timeout: 999, + namespace: 'default', + id: 'test-id', + is_managed: true, + package_policies: [], + }, + ] as PreconfiguredAgentPolicy[], + [], + mockDefaultOutput + ); + expect(spyAgentPolicyServiceUpdate).toBeCalled(); + expect(spyAgentPolicyServiceUpdate).toBeCalledWith( + expect.anything(), // soClient + expect.anything(), // esClient + 'test-id', + expect.objectContaining({ + name: 'Renamed Test policy', + description: 'Renamed Test policy description', + unenroll_timeout: 999, + }) + ); + expect(policies.length).toEqual(1); + expect(policies[0].id).toBe('test-id'); + expect(nonFatalErrorsB.length).toBe(0); + }); + + it('should not update a managed policy if a top level field has not changed', async () => { + const soClient = getPutPreconfiguredPackagesMock(); + const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; + const policy: PreconfiguredAgentPolicy = { + name: 'Test policy', + namespace: 'default', + id: 'test-id', + package_policies: [], + is_managed: true, + }; + mockConfiguredPolicies.set('test-id', policy); + + const { + policies, + nonFatalErrors: nonFatalErrorsB, + } = await ensurePreconfiguredPackagesAndPolicies( + soClient, + esClient, + [policy], + [], + mockDefaultOutput + ); + expect(spyAgentPolicyServiceUpdate).not.toBeCalled(); + expect(policies.length).toEqual(1); + expect(policies[0].id).toBe('test-id'); + expect(nonFatalErrorsB.length).toBe(0); + }); }); describe('comparePreconfiguredPolicyToCurrent', () => { diff --git a/x-pack/plugins/fleet/server/services/saved_object.ts b/x-pack/plugins/fleet/server/services/saved_object.ts index bdecffb843e8e..244de5f88ba1b 100644 --- a/x-pack/plugins/fleet/server/services/saved_object.ts +++ b/x-pack/plugins/fleet/server/services/saved_object.ts @@ -19,9 +19,9 @@ export function escapeSearchQueryPhrase(val: string): string { return `"${val.replace(/["]/g, '"')}"`; } -// Adds `.attribute` to any kuery strings that are missing it, this comes from -// internal SO structure. Kuery strings that come from UI will typicall have -// `.attribute` hidden to simplify UX, so this normalizes any kuery string for +// Adds `.attributes` to any kuery strings that are missing it, this comes from +// internal SO structure. Kuery strings that come from UI will typically have +// `.attributes` hidden to simplify UX, so this normalizes any kuery string for // filtering SOs export const normalizeKuery = (savedObjectType: string, kuery: string): string => { return kuery.replace( diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap b/x-pack/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap index 9595009347259..aa978d27f9e23 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap +++ b/x-pack/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.tsx.snap @@ -326,6 +326,7 @@ exports[`extend index management ilm summary extension should return extension w >
    illegal_argument_exception : diff --git a/x-pack/plugins/index_lifecycle_management/server/plugin.ts b/x-pack/plugins/index_lifecycle_management/server/plugin.ts index 533d8736931a4..f511f837b8074 100644 --- a/x-pack/plugins/index_lifecycle_management/server/plugin.ts +++ b/x-pack/plugins/index_lifecycle_management/server/plugin.ts @@ -35,7 +35,7 @@ const indexLifecycleDataEnricher = async ( return indicesList.map((index: IndexWithoutIlm) => { return { ...index, - // @ts-expect-error @elastic/elasticsearch Element implicitly has an 'any' type + // @ts-expect-error @elastic/elasticsearch https://github.com/elastic/elasticsearch-specification/issues/531 ilm: { ...(ilmIndicesData[index.name] || {}) }, }; }); diff --git a/x-pack/plugins/index_management/README.md b/x-pack/plugins/index_management/README.md index 39f4821403a8d..fba162259ce91 100644 --- a/x-pack/plugins/index_management/README.md +++ b/x-pack/plugins/index_management/README.md @@ -82,4 +82,21 @@ PUT _template/.cloud-example } ``` -The UI will now prevent you from editing or deleting this template. \ No newline at end of file +The UI will now prevent you from editing or deleting this template. + +In 7.x, the UI supports types defined as part of the mappings for legacy index templates. To test this out, use the "Load JSON" feature and verify the custom type is preserved: + +``` +{ + "my_custom_type": { + "_source": { + "enabled": false + }, + "properties": { + "name1": { + "type": "keyword" + } + } + } +} +``` \ No newline at end of file diff --git a/x-pack/plugins/index_management/server/lib/fetch_indices.ts b/x-pack/plugins/index_management/server/lib/fetch_indices.ts index 48f633a8dc102..f78e666ddfc5f 100644 --- a/x-pack/plugins/index_management/server/lib/fetch_indices.ts +++ b/x-pack/plugins/index_management/server/lib/fetch_indices.ts @@ -52,9 +52,9 @@ async function fetchIndicesCall( size: hit['store.size'], isFrozen: hit.sth === 'true', // sth value coming back as a string from ES aliases: aliases.length ? aliases : 'none', - // @ts-expect-error @elastic/elasticsearch Property 'index' does not exist on type 'IndicesIndexSettings | IndicesIndexStatePrefixedSettings'. + // @ts-expect-error @elastic/elasticsearch https://github.com/elastic/elasticsearch-specification/issues/532 hidden: index.settings.index.hidden === 'true', - // @ts-expect-error @elastic/elasticsearch Property 'data_stream' does not exist on type 'IndicesIndexState'. + // @ts-expect-error @elastic/elasticsearch https://github.com/elastic/elasticsearch-specification/issues/532 data_stream: index.data_stream!, }); } diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/index.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/index.ts index abc306c38d09a..fdc72893c7b7f 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/index.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/index.ts @@ -7,11 +7,11 @@ import { RouteDependencies } from '../../../types'; -import { registerGetAllRoute } from './get'; -import { registerCreateRoute } from './create'; -import { registerUpdateRoute } from './update'; -import { registerDeleteRoute } from './delete'; -import { registerPrivilegesRoute } from './privileges'; +import { registerGetAllRoute } from './register_get_route'; +import { registerCreateRoute } from './register_create_route'; +import { registerUpdateRoute } from './register_update_route'; +import { registerDeleteRoute } from './register_delete_route'; +import { registerPrivilegesRoute } from './register_privileges_route'; export function registerComponentTemplateRoutes(dependencies: RouteDependencies) { registerGetAllRoute(dependencies); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/create.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/register_create_route.ts similarity index 94% rename from x-pack/plugins/index_management/server/routes/api/component_templates/create.ts rename to x-pack/plugins/index_management/server/routes/api/component_templates/register_create_route.ts index 5fe607368b58a..b4683f1b8cb14 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/create.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/register_create_route.ts @@ -57,7 +57,7 @@ export const registerCreateRoute = ({ try { const { body: responseBody } = await client.asCurrentUser.cluster.putComponentTemplate({ name, - // @ts-expect-error @elastic/elasticsearch Type 'ComponentTemplateSerialized' is not assignable + // @ts-expect-error ComponentTemplateSerialized conflicts with @elastic/elasticsearch ClusterPutComponentTemplateRequest body: serializedComponentTemplate, }); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/register_delete_route.ts similarity index 100% rename from x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts rename to x-pack/plugins/index_management/server/routes/api/component_templates/register_delete_route.ts diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/get.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/register_get_route.ts similarity index 100% rename from x-pack/plugins/index_management/server/routes/api/component_templates/get.ts rename to x-pack/plugins/index_management/server/routes/api/component_templates/register_get_route.ts diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/register_privileges_route.test.ts similarity index 98% rename from x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts rename to x-pack/plugins/index_management/server/routes/api/component_templates/register_privileges_route.test.ts index 992c2f9ed29dd..fdbf0db89e689 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/register_privileges_route.test.ts @@ -10,7 +10,7 @@ import { kibanaResponseFactory, RequestHandlerContext, RequestHandler } from 'sr import { IndexDataEnricher } from '../../../services/index_data_enricher'; -import { registerPrivilegesRoute } from './privileges'; +import { registerPrivilegesRoute } from './register_privileges_route'; jest.mock('../../../services/index_data_enricher'); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/register_privileges_route.ts similarity index 100% rename from x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts rename to x-pack/plugins/index_management/server/routes/api/component_templates/register_privileges_route.ts diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/update.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/register_update_route.ts similarity index 92% rename from x-pack/plugins/index_management/server/routes/api/component_templates/update.ts rename to x-pack/plugins/index_management/server/routes/api/component_templates/register_update_route.ts index 17e14f1a39c42..464d73790af2a 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/update.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/register_update_route.ts @@ -6,6 +6,7 @@ */ import { schema } from '@kbn/config-schema'; +import { estypes } from '@elastic/elasticsearch'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '../index'; @@ -39,8 +40,7 @@ export const registerUpdateRoute = ({ const { body: responseBody } = await client.asCurrentUser.cluster.putComponentTemplate({ name, body: { - // @ts-expect-error @elastic/elasticsearch Not assignable to type 'IndicesIndexState' - template, + template: template as estypes.IndicesIndexState, version, _meta, }, diff --git a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts index c7b28b46e8f00..87eecfbfbbbad 100644 --- a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts @@ -129,11 +129,11 @@ export function registerGetAllRoute({ router, lib: { handleEsError }, config }: } const enhancedDataStreams = enhanceDataStreams({ - // @ts-expect-error @elastic/elasticsearch DataStreamFromEs incompatible with IndicesGetDataStreamIndicesGetDataStreamItem + // @ts-expect-error DataStreamFromEs conflicts with @elastic/elasticsearch IndicesGetDataStreamIndicesGetDataStreamItem dataStreams, - // @ts-expect-error @elastic/elasticsearch StatsFromEs incompatible with IndicesDataStreamsStatsDataStreamsStatsItem + // @ts-expect-error StatsFromEs conflicts with @elastic/elasticsearch IndicesDataStreamsStatsDataStreamsStatsItem dataStreamsStats, - // @ts-expect-error @elastic/elasticsearch PrivilegesFromEs incompatible with ApplicationsPrivileges + // @ts-expect-error PrivilegesFromEs conflicts with @elastic/elasticsearch ApplicationsPrivileges dataStreamsPrivileges, }); @@ -176,11 +176,11 @@ export function registerGetOneRoute({ router, lib: { handleEsError }, config }: } const enhancedDataStreams = enhanceDataStreams({ - // @ts-expect-error @elastic/elasticsearch DataStreamFromEs incompatible with IndicesGetDataStreamIndicesGetDataStreamItem + // @ts-expect-error DataStreamFromEs conflicts with @elastic/elasticsearch IndicesGetDataStreamIndicesGetDataStreamItem dataStreams, - // @ts-expect-error @elastic/elasticsearch StatsFromEs incompatible with IndicesDataStreamsStatsDataStreamsStatsItem + // @ts-expect-error StatsFromEs conflicts with @elastic/elasticsearch IndicesDataStreamsStatsDataStreamsStatsItem dataStreamsStats, - // @ts-expect-error @elastic/elasticsearch PrivilegesFromEs incompatible with ApplicationsPrivileges + // @ts-expect-error PrivilegesFromEs conflicts with @elastic/elasticsearch ApplicationsPrivileges dataStreamsPrivileges, }); const body = deserializeDataStream(enhancedDataStreams[0]); diff --git a/x-pack/plugins/index_management/server/routes/api/templates/lib.ts b/x-pack/plugins/index_management/server/routes/api/templates/lib.ts index ef2642399d76d..ec8916b0b8d07 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/lib.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/lib.ts @@ -51,7 +51,7 @@ export const saveTemplate = async ({ return await client.asCurrentUser.indices.putTemplate({ name: template.name, - // @ts-expect-error @elastic/elasticsearch not assignable to parameter of type 'IndicesPutTemplateRequest' + // @ts-expect-error @elastic/elasticsearch https://github.com/elastic/elasticsearch-specification/issues/533 order, body: { index_patterns, @@ -65,7 +65,7 @@ export const saveTemplate = async ({ return await client.asCurrentUser.indices.putIndexTemplate({ name: template.name, - // @ts-expect-error @elastic/elasticsearch Type 'LegacyTemplateSerialized | TemplateSerialized' is not assignable + // @ts-expect-error LegacyTemplateSerialized | TemplateSerialized conflicts with @elastic/elasticsearch IndicesPutIndexTemplateRequest body: serializedTemplate, }); }; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx index 8835a7cd55ce8..be0ecbb1dab65 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx @@ -17,6 +17,8 @@ import { EuiToolTip, EuiIcon, EuiFieldSearch, + EuiAccordion, + EuiPanel, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; @@ -259,6 +261,11 @@ export const Expressions: React.FC = (props) => { return alertParams.groupBy; }, [alertParams.groupBy]); + const areAllAggsRate = useMemo( + () => alertParams.criteria?.every((c) => c.aggType === Aggregators.RATE), + [alertParams.criteria] + ); + return ( <> @@ -323,27 +330,60 @@ export const Expressions: React.FC = (props) => {
    - - {i18n.translate('xpack.infra.metrics.alertFlyout.alertOnNoData', { - defaultMessage: "Alert me if there's no data", - })}{' '} - - - - - } - checked={alertParams.alertOnNoData} - onChange={(e) => setAlertParams('alertOnNoData', e.target.checked)} - /> - + + + + {i18n.translate('xpack.infra.metrics.alertFlyout.alertOnNoData', { + defaultMessage: "Alert me if there's no data", + })}{' '} + + + + + } + checked={alertParams.alertOnNoData} + onChange={(e) => setAlertParams('alertOnNoData', e.target.checked)} + /> + + {i18n.translate('xpack.infra.metrics.alertFlyout.shouldDropPartialBuckets', { + defaultMessage: 'Drop partial buckets when evaluating data', + })}{' '} + + + + + } + checked={areAllAggsRate || alertParams.shouldDropPartialBuckets} + disabled={areAllAggsRate} + onChange={(e) => setAlertParams('shouldDropPartialBuckets', e.target.checked)} + /> + + = (props) => { alertThrottle={alertThrottle} alertNotifyWhen={alertNotifyWhen} alertType={METRIC_THRESHOLD_ALERT_TYPE_ID} - alertParams={pick(alertParams, 'criteria', 'groupBy', 'filterQuery', 'sourceId')} + alertParams={pick( + alertParams, + 'criteria', + 'groupBy', + 'filterQuery', + 'sourceId', + 'shouldDropPartialBuckets' + )} showNoDataResults={alertParams.alertOnNoData} validate={validateMetricThreshold} groupByDisplayName={groupByPreviewDisplayName} diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/types.ts b/x-pack/plugins/infra/public/alerting/metric_threshold/types.ts index fca4160199030..a679579e57235 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/types.ts +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/types.ts @@ -61,4 +61,5 @@ export interface AlertParams { sourceId: string; filterQueryText?: string; alertOnNoData?: boolean; + shouldDropPartialBuckets?: boolean; } diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts index d3fa983ff9e84..6d99b6e2f5fe3 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/evaluate_alert.ts @@ -45,6 +45,7 @@ export interface EvaluatedAlertParams { criteria: MetricExpressionParams[]; groupBy: string | undefined | string[]; filterQuery: string | undefined; + shouldDropPartialBuckets?: boolean; } export const evaluateAlert = ( @@ -53,7 +54,7 @@ export const evaluateAlert = { - const { criteria, groupBy, filterQuery } = params; + const { criteria, groupBy, filterQuery, shouldDropPartialBuckets } = params; return Promise.all( criteria.map(async (criterion) => { const currentValues = await getMetric( @@ -63,7 +64,8 @@ export const evaluateAlert = Promise> = async function ( esClient, params, @@ -113,7 +114,8 @@ const getMetric: ( timefield, groupBy, filterQuery, - timeframe + timeframe, + shouldDropPartialBuckets ) { const { aggType, timeSize, timeUnit } = params; const hasGroupBy = groupBy && groupBy.length; @@ -127,10 +129,10 @@ const getMetric: ( .startOf(timeUnit) .valueOf(); - // We need enough data for 5 buckets worth of data. We also need - // to convert the intervalAsSeconds to milliseconds. - // TODO: We only need to get 5 buckets for the rate query, so this logic should move there. - const minimumFrom = to - intervalAsMS * MINIMUM_BUCKETS; + // Rate aggregations need 5 buckets worth of data + const minimumBuckets = aggType === Aggregators.RATE ? 5 : 1; + + const minimumFrom = to - intervalAsMS * minimumBuckets; const from = roundTimestamp( timeframe && timeframe.start <= minimumFrom ? timeframe.start : minimumFrom, @@ -145,6 +147,16 @@ const getMetric: ( filterQuery ); + const dropPartialBucketsOptions = + // Rate aggs always drop partial buckets; guard against this boolean being passed as false + shouldDropPartialBuckets || aggType === Aggregators.RATE + ? { + from, + to, + bucketSizeInMillis: intervalAsMS, + } + : null; + try { if (hasGroupBy) { const bucketSelector = ( @@ -166,11 +178,7 @@ const getMetric: ( ...result, [Object.values(bucket.key) .map((value) => value) - .join(', ')]: getValuesFromAggregations(bucket, aggType, { - from, - to, - bucketSizeInMillis: intervalAsMS, - }), + .join(', ')]: getValuesFromAggregations(bucket, aggType, dropPartialBucketsOptions), }), {} ); @@ -184,7 +192,7 @@ const getMetric: ( [UNGROUPED_FACTORY_KEY]: getValuesFromAggregations( (result.aggregations! as unknown) as Aggregation, aggType, - { from, to, bucketSizeInMillis: intervalAsMS } + dropPartialBucketsOptions ), }; } catch (e) { @@ -224,47 +232,46 @@ const dropPartialBuckets = ({ from, to, bucketSizeInMillis }: DropPartialBucketO const getValuesFromAggregations = ( aggregations: Aggregation, aggType: MetricExpressionParams['aggType'], - dropPartialBucketsOptions: DropPartialBucketOptions + dropPartialBucketsOptions: DropPartialBucketOptions | null ) => { try { const { buckets } = aggregations.aggregatedIntervals; if (!buckets.length) return null; // No Data state + let mappedBuckets; + if (aggType === Aggregators.COUNT) { - return buckets.map((bucket) => ({ + mappedBuckets = buckets.map((bucket) => ({ key: bucket.from_as_string, value: bucket.doc_count, })); - } - if (aggType === Aggregators.P95 || aggType === Aggregators.P99) { - return buckets.map((bucket) => { + } else if (aggType === Aggregators.P95 || aggType === Aggregators.P99) { + mappedBuckets = buckets.map((bucket) => { const values = bucket.aggregatedValue?.values || []; const firstValue = first(values); if (!firstValue) return null; return { key: bucket.from_as_string, value: firstValue.value }; }); - } - - if (aggType === Aggregators.AVERAGE) { - return buckets.map((bucket) => ({ + } else if (aggType === Aggregators.AVERAGE) { + mappedBuckets = buckets.map((bucket) => ({ + key: bucket.key_as_string ?? bucket.from_as_string, + value: bucket.aggregatedValue?.value ?? null, + })); + } else if (aggType === Aggregators.RATE) { + mappedBuckets = buckets.map((bucket) => ({ + key: bucket.key_as_string ?? bucket.from_as_string, + value: bucket.aggregatedValue?.value ?? null, + })); + } else { + mappedBuckets = buckets.map((bucket) => ({ key: bucket.key_as_string ?? bucket.from_as_string, value: bucket.aggregatedValue?.value ?? null, })); } - - if (aggType === Aggregators.RATE) { - return buckets - .map((bucket) => ({ - key: bucket.key_as_string ?? bucket.from_as_string, - value: bucket.aggregatedValue?.value ?? null, - })) - .filter(dropPartialBuckets(dropPartialBucketsOptions)); + if (dropPartialBucketsOptions) { + return mappedBuckets.filter(dropPartialBuckets(dropPartialBucketsOptions)); } - - return buckets.map((bucket) => ({ - key: bucket.key_as_string ?? bucket.from_as_string, - value: bucket.aggregatedValue?.value ?? null, - })); + return mappedBuckets; } catch (e) { return NaN; // Error state } diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.test.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.test.ts index 2ba8365d6b4a9..dd29437275243 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.test.ts @@ -64,4 +64,30 @@ describe("The Metric Threshold Alert's getElasticsearchMetricQuery", () => { ); }); }); + + describe('when passed a timeframe of 1 hour', () => { + const testTimeframe = { + start: moment().subtract(1, 'hour').valueOf(), + end: moment().valueOf(), + }; + const searchBodyWithoutGroupBy = getElasticsearchMetricQuery( + expressionParams, + timefield, + testTimeframe + ); + const searchBodyWithGroupBy = getElasticsearchMetricQuery( + expressionParams, + timefield, + testTimeframe, + groupBy + ); + test("generates 1 hour's worth of buckets", () => { + // @ts-ignore + expect(searchBodyWithoutGroupBy.aggs.aggregatedIntervals.date_range.ranges.length).toBe(60); + expect( + // @ts-ignore + searchBodyWithGroupBy.aggs.groupings.aggs.aggregatedIntervals.date_range.ranges.length + ).toBe(60); + }); + }); }); diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.ts index cde84b217be95..66e112640c357 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/lib/metric_query.ts @@ -76,12 +76,13 @@ export const getElasticsearchMetricQuery = ( aggregatedIntervals: { date_range: { field: timefield, - ranges: [ - { - from: to - intervalAsMS - deliveryDelay, - to: to - deliveryDelay, - }, - ], + // Generate an array of buckets, starting at `from` and ending at `to` + // This is usually only necessary for alert previews or rate aggs. Most alert evaluations + // will generate only one bucket from this logic. + ranges: Array.from(Array(Math.floor((to - from) / intervalAsMS)), (_, i) => ({ + from: from + intervalAsMS * i - deliveryDelay, + to: from + intervalAsMS * (i + 1) - deliveryDelay, + })), }, aggregations, }, diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/preview_metric_threshold_alert.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/preview_metric_threshold_alert.ts index a4c207f4006d5..931b830875cdf 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/preview_metric_threshold_alert.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/preview_metric_threshold_alert.ts @@ -26,6 +26,7 @@ interface PreviewMetricThresholdAlertParams { criteria: MetricExpressionParams[]; groupBy: string | undefined | string[]; filterQuery: string | undefined; + shouldDropPartialBuckets?: boolean; }; config: InfraSource['configuration']; lookback: Unit; diff --git a/x-pack/plugins/lens/common/expressions/datatable/sorting.test.tsx b/x-pack/plugins/lens/common/expressions/datatable/sorting.test.tsx index f5d457db65234..b5ff0a7e6915b 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/sorting.test.tsx +++ b/x-pack/plugins/lens/common/expressions/datatable/sorting.test.tsx @@ -6,7 +6,7 @@ */ import { getSortingCriteria } from './sorting'; -import { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { DatatableColumnType } from 'src/plugins/expressions'; function getMockFormatter() { diff --git a/x-pack/plugins/lens/common/expressions/datatable/sorting.tsx b/x-pack/plugins/lens/common/expressions/datatable/sorting.tsx index 13ca811b0b082..30060c10ea37e 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/sorting.tsx +++ b/x-pack/plugins/lens/common/expressions/datatable/sorting.tsx @@ -7,7 +7,7 @@ import ipaddr from 'ipaddr.js'; import type { IPv4, IPv6 } from 'ipaddr.js'; -import type { FieldFormat } from '../../../../../../src/plugins/data/common'; +import type { FieldFormat } from '../../../../../../src/plugins/field_formats/common'; function isIPv6Address(ip: IPv4 | IPv6): ip is IPv6 { return ip.kind() === 'ipv6'; diff --git a/x-pack/plugins/lens/common/expressions/datatable/summary.test.ts b/x-pack/plugins/lens/common/expressions/datatable/summary.test.ts index 9f8f56cc92768..61e74e0ef3bc7 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/summary.test.ts +++ b/x-pack/plugins/lens/common/expressions/datatable/summary.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IFieldFormat } from 'src/plugins/data/common'; +import type { IFieldFormat } from 'src/plugins/field_formats/common'; import { Datatable } from 'src/plugins/expressions'; import { computeSummaryRowForColumn, getFinalSummaryConfiguration } from './summary'; diff --git a/x-pack/plugins/lens/common/expressions/datatable/summary.ts b/x-pack/plugins/lens/common/expressions/datatable/summary.ts index aceade2a3a513..76c607ca4c4ee 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/summary.ts +++ b/x-pack/plugins/lens/common/expressions/datatable/summary.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { FieldFormat } from '../../../../../../src/plugins/data/common'; +import type { FieldFormat } from '../../../../../../src/plugins/field_formats/common'; import type { Datatable } from '../../../../../../src/plugins/expressions/common'; import { ColumnConfigArg } from './datatable_column'; import { getOriginalId } from './transpose_helpers'; diff --git a/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.test.ts b/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.test.ts index 7ac6b3d987c84..6adb8b59474db 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.test.ts +++ b/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import type { Datatable } from 'src/plugins/expressions'; import { DatatableArgs } from './datatable'; diff --git a/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.ts b/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.ts index 06798413c8f40..e2d928fda24ed 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.ts +++ b/x-pack/plugins/lens/common/expressions/datatable/transpose_helpers.ts @@ -10,7 +10,7 @@ import type { DatatableColumn, DatatableRow, } from '../../../../../../src/plugins/expressions'; -import type { FieldFormat } from '../../../../../../src/plugins/data/common'; +import type { FieldFormat } from '../../../../../../src/plugins/field_formats/common'; import type { DatatableArgs } from './datatable'; import type { ColumnConfig, ColumnConfigArg } from './datatable_column'; diff --git a/x-pack/plugins/lens/common/suffix_formatter/index.ts b/x-pack/plugins/lens/common/suffix_formatter/index.ts index 97fa8c067331e..00ae005c38b14 100644 --- a/x-pack/plugins/lens/common/suffix_formatter/index.ts +++ b/x-pack/plugins/lens/common/suffix_formatter/index.ts @@ -6,11 +6,11 @@ */ import { i18n } from '@kbn/i18n'; +import { KBN_FIELD_TYPES } from '@kbn/field-types'; import { FieldFormat, FieldFormatInstanceType, - KBN_FIELD_TYPES, -} from '../../../../../src/plugins/data/common'; +} from '../../../../../src/plugins/field_formats/common'; import type { FormatFactory } from '../types'; import type { TimeScaleUnit } from '../expressions/time_scale'; diff --git a/x-pack/plugins/lens/common/types.ts b/x-pack/plugins/lens/common/types.ts index a60061a3aa054..06fa31b87ce64 100644 --- a/x-pack/plugins/lens/common/types.ts +++ b/x-pack/plugins/lens/common/types.ts @@ -5,7 +5,8 @@ * 2.0. */ -import type { FilterMeta, Filter, IFieldFormat } from '../../../../src/plugins/data/common'; +import type { FilterMeta, Filter } from '../../../../src/plugins/data/common'; +import type { IFieldFormat } from '../../../../src/plugins/field_formats/common'; import type { Datatable, SerializedFieldFormat } from '../../../../src/plugins/expressions/common'; export type FormatFactory = (mapping?: SerializedFieldFormat) => IFieldFormat; diff --git a/x-pack/plugins/lens/kibana.json b/x-pack/plugins/lens/kibana.json index fd394aea90d66..6a3e0f40c48f4 100644 --- a/x-pack/plugins/lens/kibana.json +++ b/x-pack/plugins/lens/kibana.json @@ -36,7 +36,8 @@ "savedObjects", "kibanaUtils", "kibanaReact", - "embeddable" + "embeddable", + "fieldFormats" ], "owner": { "name": "Kibana App", diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index 6bd75c585f954..c1984991b04d8 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -70,6 +70,7 @@ const sessionIdSubject = new Subject(); describe('Lens App', () => { let defaultDoc: Document; let defaultSavedObjectId: string; + const mockDatasource: DatasourceMock = createMockDatasource('testDatasource'); const mockDatasource2: DatasourceMock = createMockDatasource('testDatasource2'); const datasourceMap = { diff --git a/x-pack/plugins/lens/public/app_plugin/mounter.tsx b/x-pack/plugins/lens/public/app_plugin/mounter.tsx index 12522402116c9..55f3e7463754e 100644 --- a/x-pack/plugins/lens/public/app_plugin/mounter.tsx +++ b/x-pack/plugins/lens/public/app_plugin/mounter.tsx @@ -6,24 +6,20 @@ */ import React, { FC, useCallback } from 'react'; - +import { DeepPartial } from '@reduxjs/toolkit'; import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { History } from 'history'; import { render, unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; - -import { DashboardFeatureFlagConfig } from 'src/plugins/dashboard/public'; import { Provider } from 'react-redux'; -import { isEqual } from 'lodash'; -import { EmbeddableEditorState } from 'src/plugins/embeddable/public'; import { Storage } from '../../../../../src/plugins/kibana_utils/public'; import { LensReportManager, setReportManager, trackUiEvent } from '../lens_ui_telemetry'; import { App } from './app'; -import { Datasource, EditorFrameStart, Visualization } from '../types'; +import { EditorFrameStart } from '../types'; import { addHelpMenuToAppChrome } from '../help_menu_util'; import { LensPluginStartDependencies } from '../plugin'; import { LENS_EMBEDDABLE_TYPE, LENS_EDIT_BY_VALUE, APP_ID } from '../../common'; @@ -32,32 +28,18 @@ import { LensByReferenceInput, LensByValueInput, } from '../embeddable/embeddable'; -import { - ACTION_VISUALIZE_LENS_FIELD, - VisualizeFieldContext, -} from '../../../../../src/plugins/ui_actions/public'; +import { ACTION_VISUALIZE_LENS_FIELD } from '../../../../../src/plugins/ui_actions/public'; import { LensAttributeService } from '../lens_attribute_service'; import { LensAppServices, RedirectToOriginProps, HistoryLocationState } from './types'; import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; - import { makeConfigureStore, navigateAway, - getPreloadedState, LensRootStore, - setState, - LensAppState, - updateLayer, - updateVisualizationState, + loadInitial, + LensState, } from '../state_management'; -import { getPersistedDoc } from './save_modal_container'; -import { getResolvedDateRange, getInitialDatasourceId } from '../utils'; -import { initializeDatasources } from '../editor_frame_service/editor_frame'; -import { generateId } from '../id_generator'; -import { - getVisualizeFieldSuggestions, - switchToSuggestion, -} from '../editor_frame_service/editor_frame/suggestion_helpers'; +import { getPreloadedState } from '../state_management/lens_slice'; export async function getLensServices( coreStart: CoreStart, @@ -114,7 +96,7 @@ export async function mountApp( const lensServices = await getLensServices(coreStart, startDependencies, attributeService); - const { stateTransfer, data, storage, dashboardFeatureFlag } = lensServices; + const { stateTransfer, data, storage } = lensServices; const embeddableEditorIncomingState = stateTransfer?.getIncomingEditorState(APP_ID); @@ -183,37 +165,19 @@ export async function mountApp( if (embeddableEditorIncomingState?.searchSessionId) { data.search.session.continue(embeddableEditorIncomingState.searchSessionId); } - const { datasourceMap, visualizationMap } = instance; - const initialDatasourceId = getInitialDatasourceId(datasourceMap); - const datasourceStates: LensAppState['datasourceStates'] = {}; - if (initialDatasourceId) { - datasourceStates[initialDatasourceId] = { - state: null, - isLoading: true, - }; - } - - const preloadedState = getPreloadedState({ - isLoading: true, - query: data.query.queryString.getQuery(), - // Do not use app-specific filters from previous app, - // only if Lens was opened with the intention to visualize a field (e.g. coming from Discover) - filters: !initialContext - ? data.query.filterManager.getGlobalFilters() - : data.query.filterManager.getFilters(), - searchSessionId: data.search.session.getSessionId(), - resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter), - isLinkedToOriginatingApp: Boolean(embeddableEditorIncomingState?.originatingApp), - activeDatasourceId: initialDatasourceId, - datasourceStates, - visualization: { - state: null, - activeId: Object.keys(visualizationMap)[0] || null, - }, - }); + const { datasourceMap, visualizationMap } = instance; + const storeDeps = { + lensServices, + datasourceMap, + visualizationMap, + embeddableEditorIncomingState, + initialContext, + }; + const lensStore: LensRootStore = makeConfigureStore(storeDeps, { + lens: getPreloadedState(storeDeps), + } as DeepPartial); - const lensStore: LensRootStore = makeConfigureStore(preloadedState, { data }); const EditorRenderer = React.memo( (props: { id?: string; history: History; editByValue?: boolean }) => { const redirectCallback = useCallback( @@ -224,17 +188,7 @@ export async function mountApp( ); trackUiEvent('loaded'); const initialInput = getInitialInput(props.id, props.editByValue); - loadInitialStore( - redirectCallback, - initialInput, - lensServices, - lensStore, - embeddableEditorIncomingState, - dashboardFeatureFlag, - datasourceMap, - visualizationMap, - initialContext - ); + lensStore.dispatch(loadInitial({ redirectCallback, initialInput })); return ( @@ -309,181 +263,3 @@ export async function mountApp( lensStore.dispatch(navigateAway()); }; } - -export function loadInitialStore( - redirectCallback: (savedObjectId?: string) => void, - initialInput: LensEmbeddableInput | undefined, - lensServices: LensAppServices, - lensStore: LensRootStore, - embeddableEditorIncomingState: EmbeddableEditorState | undefined, - dashboardFeatureFlag: DashboardFeatureFlagConfig, - datasourceMap: Record, - visualizationMap: Record, - initialContext?: VisualizeFieldContext -) { - const { attributeService, chrome, notifications, data } = lensServices; - const { persistedDoc } = lensStore.getState().lens; - if ( - !initialInput || - (attributeService.inputIsRefType(initialInput) && - initialInput.savedObjectId === persistedDoc?.savedObjectId) - ) { - return initializeDatasources( - datasourceMap, - lensStore.getState().lens.datasourceStates, - undefined, - initialContext, - { - isFullEditor: true, - } - ) - .then((result) => { - const datasourceStates = Object.entries(result).reduce( - (state, [datasourceId, datasourceState]) => ({ - ...state, - [datasourceId]: { - ...datasourceState, - isLoading: false, - }, - }), - {} - ); - lensStore.dispatch( - setState({ - datasourceStates, - isLoading: false, - }) - ); - if (initialContext) { - const selectedSuggestion = getVisualizeFieldSuggestions({ - datasourceMap, - datasourceStates, - visualizationMap, - activeVisualizationId: Object.keys(visualizationMap)[0] || null, - visualizationState: null, - visualizeTriggerFieldContext: initialContext, - }); - if (selectedSuggestion) { - switchToSuggestion(lensStore.dispatch, selectedSuggestion, 'SWITCH_VISUALIZATION'); - } - } - const activeDatasourceId = getInitialDatasourceId(datasourceMap); - const visualization = lensStore.getState().lens.visualization; - const activeVisualization = - visualization.activeId && visualizationMap[visualization.activeId]; - - if (visualization.state === null && activeVisualization) { - const newLayerId = generateId(); - - const initialVisualizationState = activeVisualization.initialize(() => newLayerId); - lensStore.dispatch( - updateLayer({ - datasourceId: activeDatasourceId!, - layerId: newLayerId, - updater: datasourceMap[activeDatasourceId!].insertLayer, - }) - ); - lensStore.dispatch( - updateVisualizationState({ - visualizationId: activeVisualization.id, - updater: initialVisualizationState, - }) - ); - } - }) - .catch((e: { message: string }) => { - notifications.toasts.addDanger({ - title: e.message, - }); - redirectCallback(); - }); - } - - getPersistedDoc({ - initialInput, - attributeService, - data, - chrome, - notifications, - }) - .then( - (doc) => { - if (doc) { - const currentSessionId = data.search.session.getSessionId(); - const docDatasourceStates = Object.entries(doc.state.datasourceStates).reduce( - (stateMap, [datasourceId, datasourceState]) => ({ - ...stateMap, - [datasourceId]: { - isLoading: true, - state: datasourceState, - }, - }), - {} - ); - - initializeDatasources( - datasourceMap, - docDatasourceStates, - doc.references, - initialContext, - { - isFullEditor: true, - } - ) - .then((result) => { - const activeDatasourceId = getInitialDatasourceId(datasourceMap, doc); - - lensStore.dispatch( - setState({ - query: doc.state.query, - searchSessionId: - dashboardFeatureFlag.allowByValueEmbeddables && - Boolean(embeddableEditorIncomingState?.originatingApp) && - !(initialInput as LensByReferenceInput)?.savedObjectId && - currentSessionId - ? currentSessionId - : data.search.session.start(), - ...(!isEqual(persistedDoc, doc) ? { persistedDoc: doc } : null), - activeDatasourceId, - visualization: { - activeId: doc.visualizationType, - state: doc.state.visualization, - }, - datasourceStates: Object.entries(result).reduce( - (state, [datasourceId, datasourceState]) => ({ - ...state, - [datasourceId]: { - ...datasourceState, - isLoading: false, - }, - }), - {} - ), - isLoading: false, - }) - ); - }) - .catch((e: { message: string }) => - notifications.toasts.addDanger({ - title: e.message, - }) - ); - } else { - redirectCallback(); - } - }, - () => { - lensStore.dispatch( - setState({ - isLoading: false, - }) - ); - redirectCallback(); - } - ) - .catch((e: { message: string }) => - notifications.toasts.addDanger({ - title: e.message, - }) - ); -} diff --git a/x-pack/plugins/lens/public/app_plugin/types.ts b/x-pack/plugins/lens/public/app_plugin/types.ts index 499ba3c86bca5..c482b56b70301 100644 --- a/x-pack/plugins/lens/public/app_plugin/types.ts +++ b/x-pack/plugins/lens/public/app_plugin/types.ts @@ -34,7 +34,7 @@ import { EmbeddableEditorState, EmbeddableStateTransfer, } from '../../../../../src/plugins/embeddable/public'; -import { Datasource, EditorFrameInstance, Visualization } from '../types'; +import { DatasourceMap, EditorFrameInstance, VisualizationMap } from '../types'; import { PresentationUtilPluginStart } from '../../../../../src/plugins/presentation_util/public'; export interface RedirectToOriginProps { input?: LensEmbeddableInput; @@ -54,8 +54,8 @@ export interface LensAppProps { // State passed in by the container which is used to determine the id of the Originating App. incomingState?: EmbeddableEditorState; - datasourceMap: Record; - visualizationMap: Record; + datasourceMap: DatasourceMap; + visualizationMap: VisualizationMap; } export type RunSave = ( @@ -82,7 +82,7 @@ export interface LensTopNavMenuProps { indicateNoData: boolean; setIsSaveModalVisible: React.Dispatch>; runSave: RunSave; - datasourceMap: Record; + datasourceMap: DatasourceMap; title?: string; } diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx index fb9cb992fcf47..96413444d60c4 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx @@ -9,7 +9,7 @@ import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DataContext } from './table_basic'; import { createGridCell } from './cell_value'; -import { FieldFormat } from 'src/plugins/data/public'; +import type { FieldFormat } from 'src/plugins/field_formats/common'; import { Datatable } from 'src/plugins/expressions/public'; import { IUiSettingsClient } from 'kibana/public'; import { act } from 'react-dom/test-utils'; 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 bb678a361e174..a0d137b90e84c 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 @@ -10,7 +10,8 @@ import { ReactWrapper, shallow } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { mountWithIntl } from '@kbn/test/jest'; import { EuiDataGrid } from '@elastic/eui'; -import { IAggType, IFieldFormat } from 'src/plugins/data/public'; +import { IAggType } from 'src/plugins/data/public'; +import { IFieldFormat } from 'src/plugins/field_formats/common'; import { VisualizationContainer } from '../../visualization_container'; import { EmptyPlaceholder } from '../../shared_components'; import { LensIconChartDatatable } from '../../assets/chart_datatable'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx index 4b4d2275d0dec..163971c4ba9fb 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx @@ -8,7 +8,7 @@ import { DatatableProps } from '../../common/expressions'; import type { LensMultiTable } from '../../common'; import { createMockExecutionContext } from '../../../../../src/plugins/expressions/common/mocks'; -import { IFieldFormat } from '../../../../../src/plugins/data/public'; +import type { IFieldFormat } from '../../../../../src/plugins/field_formats/common'; import { getDatatable } from './expression'; function sampleArgs() { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx index d4a9870056b34..8a5d385b5be0f 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx @@ -27,11 +27,8 @@ import { } from '../../../state_management'; export const ConfigPanelWrapper = memo(function ConfigPanelWrapper(props: ConfigPanelWrapperProps) { - const activeVisualization = props.visualizationMap[props.activeVisualizationId || '']; - const { visualizationState } = props; - - return activeVisualization && visualizationState ? ( - + return props.activeVisualization && props.visualizationState ? ( + ) : null; }); diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/types.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/types.ts index 683b96c6b8773..d9bf678d1916a 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/types.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/types.ts @@ -8,17 +8,16 @@ import { Visualization, FramePublicAPI, - Datasource, DatasourceDimensionEditorProps, VisualizationDimensionGroupConfig, + DatasourceMap, } from '../../../types'; export interface ConfigPanelWrapperProps { activeDatasourceId: string; visualizationState: unknown; - visualizationMap: Record; - activeVisualizationId: string | null; + activeVisualization: Visualization | null; framePublicAPI: FramePublicAPI; - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { @@ -33,7 +32,7 @@ export interface ConfigPanelWrapperProps { export interface LayerPanelProps { activeDatasourceId: string; visualizationState: unknown; - datasourceMap: Record; + datasourceMap: DatasourceMap; activeVisualization: Visualization; framePublicAPI: FramePublicAPI; datasourceStates: Record< diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/data_panel_wrapper.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/data_panel_wrapper.tsx index c50d3f41479f1..abfeb647186a7 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/data_panel_wrapper.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/data_panel_wrapper.tsx @@ -13,7 +13,7 @@ import { EuiPopover, EuiButtonIcon, EuiContextMenuPanel, EuiContextMenuItem } fr import { createSelector } from '@reduxjs/toolkit'; import { NativeRenderer } from '../../native_renderer'; import { DragContext, DragDropIdentifier } from '../../drag_drop'; -import { StateSetter, DatasourceDataPanelProps, Datasource } from '../../types'; +import { StateSetter, DatasourceDataPanelProps, DatasourceMap } from '../../types'; import { UiActionsStart } from '../../../../../../src/plugins/ui_actions/public'; import { switchDatasource, @@ -27,7 +27,7 @@ import { initializeDatasources } from './state_helpers'; interface DataPanelWrapperProps { datasourceState: unknown; - datasourceMap: Record; + datasourceMap: DatasourceMap; activeDatasource: string | null; datasourceIsLoading: boolean; showNoDataPopover: () => void; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.tsx index 4b725c4cd1850..653ad2d27fe06 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useRef, useMemo } from 'react'; import { CoreStart } from 'kibana/public'; import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public'; -import { Datasource, FramePublicAPI, Visualization } from '../../types'; +import { DatasourceMap, FramePublicAPI, VisualizationMap } from '../../types'; import { DataPanelWrapper } from './data_panel_wrapper'; import { ConfigPanelWrapper } from './config_panel'; import { FrameLayout } from './frame_layout'; @@ -22,8 +22,8 @@ import { trackUiEvent } from '../../lens_ui_telemetry'; import { useLensSelector, useLensDispatch } from '../../state_management'; export interface EditorFrameProps { - datasourceMap: Record; - visualizationMap: Record; + datasourceMap: DatasourceMap; + visualizationMap: VisualizationMap; ExpressionRenderer: ReactExpressionRendererType; core: CoreStart; plugins: EditorFrameStartPlugins; @@ -125,11 +125,12 @@ export function EditorFrame(props: EditorFrameProps) { configPanel={ allLoaded && ( , + datasourceMap: DatasourceMap, datasourceStates: Record< string, { @@ -80,7 +80,7 @@ export function buildExpression({ description?: string; visualization: Visualization | null; visualizationState: unknown; - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts index e861112f3f7b4..2b0090554b7da 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts @@ -10,11 +10,13 @@ import { Ast } from '@kbn/interpreter/common'; import memoizeOne from 'memoize-one'; import { Datasource, + DatasourceMap, DatasourcePublicAPI, FramePublicAPI, InitializationOptions, Visualization, VisualizationDimensionGroupConfig, + VisualizationMap, } from '../../types'; import { buildExpression } from './expression_helpers'; import { Document } from '../../persistence/saved_object_store'; @@ -28,7 +30,7 @@ import { } from '../error_helper'; export async function initializeDatasources( - datasourceMap: Record, + datasourceMap: DatasourceMap, datasourceStates: Record, references?: SavedObjectReference[], initialContext?: VisualizeFieldContext, @@ -55,7 +57,7 @@ export async function initializeDatasources( } export const createDatasourceLayers = memoizeOne(function createDatasourceLayers( - datasourceMap: Record, + datasourceMap: DatasourceMap, datasourceStates: Record ) { const datasourceLayers: Record = {}; @@ -78,7 +80,7 @@ export const createDatasourceLayers = memoizeOne(function createDatasourceLayers export async function persistedStateToExpression( datasources: Record, - visualizations: Record, + visualizations: VisualizationMap, doc: Document ): Promise<{ ast: Ast | null; errors: ErrorMessage[] | undefined }> { const { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts index 9fdc283c3cc29..31d54d26c304b 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts @@ -18,6 +18,8 @@ import { TableSuggestion, DatasourceSuggestion, DatasourcePublicAPI, + DatasourceMap, + VisualizationMap, } from '../../types'; import { DragDropIdentifier } from '../../drag_drop'; import { LensDispatch, selectSuggestion, switchVisualization } from '../../state_management'; @@ -57,7 +59,7 @@ export function getSuggestions({ activeData, mainPalette, }: { - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { @@ -65,7 +67,7 @@ export function getSuggestions({ state: unknown; } >; - visualizationMap: Record; + visualizationMap: VisualizationMap; activeVisualizationId: string | null; subVisualizationId?: string; visualizationState: unknown; @@ -140,7 +142,7 @@ export function getVisualizeFieldSuggestions({ visualizationState, visualizeTriggerFieldContext, }: { - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { @@ -148,7 +150,7 @@ export function getVisualizeFieldSuggestions({ state: unknown; } >; - visualizationMap: Record; + visualizationMap: VisualizationMap; activeVisualizationId: string | null; subVisualizationId?: string; visualizationState: unknown; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx index 6d360a09a5b49..c6dae5b23b9d4 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx @@ -25,7 +25,14 @@ import { Ast, toExpression } from '@kbn/interpreter/common'; import { i18n } from '@kbn/i18n'; import classNames from 'classnames'; import { ExecutionContextSearch } from 'src/plugins/data/public'; -import { Datasource, Visualization, FramePublicAPI, DatasourcePublicAPI } from '../../types'; +import { + Datasource, + Visualization, + FramePublicAPI, + DatasourcePublicAPI, + DatasourceMap, + VisualizationMap, +} from '../../types'; import { getSuggestions, switchToSuggestion } from './suggestion_helpers'; import { ReactExpressionRendererProps, @@ -45,7 +52,7 @@ const MAX_SUGGESTIONS_DISPLAYED = 5; export interface SuggestionPanelProps { activeDatasourceId: string | null; - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { @@ -54,7 +61,7 @@ export interface SuggestionPanelProps { } >; activeVisualizationId: string | null; - visualizationMap: Record; + visualizationMap: VisualizationMap; visualizationState: unknown; ExpressionRenderer: ReactExpressionRendererType; frame: FramePublicAPI; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx index 314989ecc9758..7db639536b8ac 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx @@ -20,7 +20,13 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Visualization, FramePublicAPI, Datasource, VisualizationType } from '../../../types'; +import { + Visualization, + FramePublicAPI, + VisualizationType, + VisualizationMap, + DatasourceMap, +} from '../../../types'; import { getSuggestions, switchToSuggestion, Suggestion } from '../suggestion_helpers'; import { trackUiEvent } from '../../../lens_ui_telemetry'; import { ToolbarButton } from '../../../../../../../src/plugins/kibana_react/public'; @@ -44,9 +50,9 @@ interface VisualizationSelection { } interface Props { - visualizationMap: Record; framePublicAPI: FramePublicAPI; - datasourceMap: Record; + visualizationMap: VisualizationMap; + datasourceMap: DatasourceMap; } type SelectableEntry = EuiSelectableOption<{ value: string }>; @@ -55,7 +61,7 @@ function VisualizationSummary({ visualizationMap, visualization, }: { - visualizationMap: Record; + visualizationMap: VisualizationMap; visualization: { activeId: string | null; state: unknown; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx index a52d83ed81fe8..68243efc28d07 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx @@ -34,12 +34,12 @@ import { ReactExpressionRendererType, } from '../../../../../../../src/plugins/expressions/public'; import { - Datasource, - Visualization, FramePublicAPI, isLensBrushEvent, isLensFilterEvent, isLensEditEvent, + VisualizationMap, + DatasourceMap, } from '../../../types'; import { DragDrop, DragContext, DragDropIdentifier } from '../../../drag_drop'; import { Suggestion, switchToSuggestion } from '../suggestion_helpers'; @@ -62,10 +62,10 @@ import { export interface WorkspacePanelProps { activeVisualizationId: string | null; - visualizationMap: Record; + visualizationMap: VisualizationMap; visualizationState: unknown; activeDatasourceId: string | null; - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx index d0e8e0d5a1bab..057d8c8baebfa 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx @@ -10,7 +10,7 @@ import './workspace_panel_wrapper.scss'; import React, { useCallback } from 'react'; import { EuiPageContent, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import classNames from 'classnames'; -import { Datasource, FramePublicAPI, Visualization } from '../../../types'; +import { DatasourceMap, FramePublicAPI, VisualizationMap } from '../../../types'; import { NativeRenderer } from '../../../native_renderer'; import { ChartSwitch } from './chart_switch'; import { WarningsPopover } from './warnings_popover'; @@ -21,9 +21,9 @@ export interface WorkspacePanelWrapperProps { children: React.ReactNode | React.ReactNode[]; framePublicAPI: FramePublicAPI; visualizationState: unknown; - visualizationMap: Record; + visualizationMap: VisualizationMap; visualizationId: string | null; - datasourceMap: Record; + datasourceMap: DatasourceMap; datasourceStates: Record< string, { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx index 43f5527e42d4b..84bcb48f95234 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx @@ -23,7 +23,7 @@ import { keys, } from '@elastic/eui'; import { useDebounceWithOptions } from '../../../../shared_components'; -import { IFieldFormat } from '../../../../../../../../src/plugins/data/common'; +import { IFieldFormat } from '../../../../../../../../src/plugins/field_formats/common'; import { RangeTypeLens, isValidRange } from './ranges'; import { FROM_PLACEHOLDER, TO_PLACEHOLDER, TYPING_DEBOUNCE_TIME } from './constants'; import { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/range_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/range_editor.tsx index 3389c723b4daf..69460c649c3e1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/range_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/range_editor.tsx @@ -18,7 +18,7 @@ import { EuiRange, EuiToolTip, } from '@elastic/eui'; -import type { IFieldFormat } from 'src/plugins/data/public'; +import type { IFieldFormat } from 'src/plugins/field_formats/common'; import { UI_SETTINGS } from '../../../../../../../../src/plugins/data/public'; import { RangeColumnParams, UpdateParamsFnType, MODES_TYPES } from './ranges'; import { AdvancedRangeEditor } from './advanced_editor'; @@ -59,7 +59,7 @@ const GranularityHelpPopover = () => {

    {UI_SETTINGS.HISTOGRAM_MAX_BARS}, diff --git a/x-pack/plugins/lens/public/metric_visualization/expression.test.tsx b/x-pack/plugins/lens/public/metric_visualization/expression.test.tsx index 21c68a9fe1d82..10575f37dba6e 100644 --- a/x-pack/plugins/lens/public/metric_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/metric_visualization/expression.test.tsx @@ -10,7 +10,7 @@ import { MetricConfig } from '../../common/expressions'; import React from 'react'; import { shallow } from 'enzyme'; import { createMockExecutionContext } from '../../../../../src/plugins/expressions/common/mocks'; -import { IFieldFormat } from '../../../../../src/plugins/data/public'; +import type { IFieldFormat } from '../../../../../src/plugins/field_formats/common'; import type { LensMultiTable } from '../../common'; function sampleArgs() { diff --git a/x-pack/plugins/lens/public/mocks.tsx b/x-pack/plugins/lens/public/mocks.tsx index fc1b3019df386..3c598540cbb93 100644 --- a/x-pack/plugins/lens/public/mocks.tsx +++ b/x-pack/plugins/lens/public/mocks.tsx @@ -16,6 +16,7 @@ import moment from 'moment'; import { Provider } from 'react-redux'; import { act } from 'react-dom/test-utils'; import { ReactExpressionRendererProps } from 'src/plugins/expressions/public'; +import { DeepPartial } from '@reduxjs/toolkit'; import { LensPublicStart } from '.'; import { visualizationTypes } from './xy_visualization/types'; import { navigationPluginMock } from '../../../../src/plugins/navigation/public/mocks'; @@ -35,7 +36,7 @@ import { import { LensAttributeService } from './lens_attribute_service'; import { EmbeddableStateTransfer } from '../../../../src/plugins/embeddable/public'; -import { makeConfigureStore, getPreloadedState, LensAppState } from './state_management/index'; +import { makeConfigureStore, LensAppState, LensState } from './state_management/index'; import { getResolvedDateRange } from './utils'; import { presentationUtilPluginMock } from '../../../../src/plugins/presentation_util/public/mocks'; import { DatasourcePublicAPI, Datasource, Visualization, FramePublicAPI } from './types'; @@ -82,6 +83,11 @@ export function createMockVisualization(): jest.Mocked { }; } +const visualizationMap = { + vis: createMockVisualization(), + vis2: createMockVisualization(), +}; + export type DatasourceMock = jest.Mocked & { publicAPIMock: jest.Mocked; }; @@ -126,6 +132,13 @@ export function createMockDatasource(id: string): DatasourceMock { }; } +const mockDatasource: DatasourceMock = createMockDatasource('testDatasource'); +const mockDatasource2: DatasourceMock = createMockDatasource('testDatasource2'); +const datasourceMap = { + testDatasource2: mockDatasource2, + testDatasource: mockDatasource, +}; + export function createExpressionRendererMock(): jest.Mock< React.ReactElement, [ReactExpressionRendererProps] @@ -401,17 +414,21 @@ export function makeLensStore({ data = mockDataPlugin(); } const lensStore = makeConfigureStore( - getPreloadedState({ - ...defaultState, - searchSessionId: data.search.session.start(), - query: data.query.queryString.getQuery(), - filters: data.query.filterManager.getGlobalFilters(), - resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter), - ...preloadedState, - }), { - data, - } + lensServices: { ...makeDefaultServices(), data }, + datasourceMap, + visualizationMap, + }, + { + lens: { + ...defaultState, + searchSessionId: data.search.session.start(), + query: data.query.queryString.getQuery(), + filters: data.query.filterManager.getGlobalFilters(), + resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter), + ...preloadedState, + }, + } as DeepPartial ); const origDispatch = lensStore.dispatch; diff --git a/x-pack/plugins/lens/public/state_management/index.ts b/x-pack/plugins/lens/public/state_management/index.ts index b72c383130208..b06dc73857cff 100644 --- a/x-pack/plugins/lens/public/state_management/index.ts +++ b/x-pack/plugins/lens/public/state_management/index.ts @@ -5,16 +5,14 @@ * 2.0. */ -import { configureStore, DeepPartial, getDefaultMiddleware } from '@reduxjs/toolkit'; +import { configureStore, getDefaultMiddleware, DeepPartial } from '@reduxjs/toolkit'; import logger from 'redux-logger'; import { useDispatch, useSelector, TypedUseSelectorHook } from 'react-redux'; -import { lensSlice, initialState } from './lens_slice'; +import { lensSlice } from './lens_slice'; import { timeRangeMiddleware } from './time_range_middleware'; import { optimizingMiddleware } from './optimizing_middleware'; -import { externalContextMiddleware } from './external_context_middleware'; - -import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; -import { LensAppState, LensState } from './types'; +import { LensState, LensStoreDeps } from './types'; +import { initMiddleware } from './init_middleware'; export * from './types'; export const reducer = { @@ -22,8 +20,9 @@ export const reducer = { }; export const { - setState, + loadInitial, navigateAway, + setState, setSaveable, onActiveDataChange, updateState, @@ -38,29 +37,17 @@ export const { setToggleFullscreen, } = lensSlice.actions; -export const getPreloadedState = (initializedState: Partial) => { - const state = { - lens: { - ...initialState, - ...initializedState, - }, - } as DeepPartial; - return state; -}; - -type PreloadedState = ReturnType; - export const makeConfigureStore = ( - preloadedState: PreloadedState, - { data }: { data: DataPublicPluginStart } + storeDeps: LensStoreDeps, + preloadedState: DeepPartial ) => { const middleware = [ ...getDefaultMiddleware({ serializableCheck: false, }), + initMiddleware(storeDeps), optimizingMiddleware(), - timeRangeMiddleware(data), - externalContextMiddleware(data), + timeRangeMiddleware(storeDeps.lensServices.data), ]; if (process.env.NODE_ENV === 'development') middleware.push(logger); diff --git a/x-pack/plugins/lens/public/state_management/init_middleware/index.ts b/x-pack/plugins/lens/public/state_management/init_middleware/index.ts new file mode 100644 index 0000000000000..854e08dfe83e4 --- /dev/null +++ b/x-pack/plugins/lens/public/state_management/init_middleware/index.ts @@ -0,0 +1,33 @@ +/* + * 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 { Dispatch, MiddlewareAPI, PayloadAction } from '@reduxjs/toolkit'; +import { LensStoreDeps } from '..'; +import { lensSlice } from '../lens_slice'; +import { loadInitial } from './load_initial'; +import { subscribeToExternalContext } from './subscribe_to_external_context'; + +export const initMiddleware = (storeDeps: LensStoreDeps) => (store: MiddlewareAPI) => { + const unsubscribeFromExternalContext = subscribeToExternalContext( + storeDeps.lensServices.data, + store.getState, + store.dispatch + ); + return (next: Dispatch) => (action: PayloadAction) => { + if (lensSlice.actions.loadInitial.match(action)) { + return loadInitial( + store, + storeDeps, + action.payload.redirectCallback, + action.payload.initialInput + ); + } else if (lensSlice.actions.navigateAway.match(action)) { + return unsubscribeFromExternalContext(); + } + next(action); + }; +}; diff --git a/x-pack/plugins/lens/public/app_plugin/mounter.test.tsx b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.test.tsx similarity index 76% rename from x-pack/plugins/lens/public/app_plugin/mounter.test.tsx rename to x-pack/plugins/lens/public/state_management/init_middleware/load_initial.test.tsx index 03eec4f617cfc..9f653c2ff9f86 100644 --- a/x-pack/plugins/lens/public/app_plugin/mounter.test.tsx +++ b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.test.tsx @@ -4,11 +4,17 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { makeDefaultServices, makeLensStore, defaultDoc, createMockVisualization } from '../mocks'; -import { createMockDatasource, DatasourceMock } from '../mocks'; +import { + makeDefaultServices, + makeLensStore, + defaultDoc, + createMockVisualization, + createMockDatasource, + DatasourceMock, +} from '../../mocks'; import { act } from 'react-dom/test-utils'; -import { loadInitialStore } from './mounter'; -import { LensEmbeddableInput } from '../embeddable/embeddable'; +import { loadInitial } from './load_initial'; +import { LensEmbeddableInput } from '../../embeddable'; const defaultSavedObjectId = '1234'; const preloadedState = { @@ -20,7 +26,6 @@ const preloadedState = { }; describe('Mounter', () => { - const byValueFlag = { allowByValueEmbeddables: true }; const mockDatasource: DatasourceMock = createMockDatasource('testDatasource'); const mockDatasource2: DatasourceMock = createMockDatasource('testDatasource2'); const datasourceMap = { @@ -66,15 +71,15 @@ describe('Mounter', () => { preloadedState, }); await act(async () => { - await loadInitialStore( - redirectCallback, - undefined, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput ); }); expect(mockDatasource.initialize).toHaveBeenCalled(); @@ -87,15 +92,14 @@ describe('Mounter', () => { const lensStore = await makeLensStore({ data: services.data, preloadedState }); await act(async () => { - await loadInitialStore( - redirectCallback, - undefined, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback ); }); expect(mockDatasource.initialize).toHaveBeenCalled(); @@ -114,20 +118,19 @@ describe('Mounter', () => { // it.skip('should pass the datasource api for each layer to the visualization', async () => {}) // it('displays errors from the frame in a toast', async () => { - describe('loadInitialStore', () => { + describe('loadInitial', () => { it('does not load a document if there is no initial input', async () => { const services = makeDefaultServices(); const redirectCallback = jest.fn(); const lensStore = makeLensStore({ data: services.data, preloadedState }); - await loadInitialStore( - redirectCallback, - undefined, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback ); expect(services.attributeService.unwrapAttributes).not.toHaveBeenCalled(); }); @@ -139,15 +142,15 @@ describe('Mounter', () => { const lensStore = await makeLensStore({ data: services.data, preloadedState }); await act(async () => { - await loadInitialStore( - redirectCallback, - { savedObjectId: defaultSavedObjectId } as LensEmbeddableInput, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput ); }); @@ -175,43 +178,43 @@ describe('Mounter', () => { const lensStore = makeLensStore({ data: services.data, preloadedState }); await act(async () => { - await loadInitialStore( - redirectCallback, - { savedObjectId: defaultSavedObjectId } as LensEmbeddableInput, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput ); }); await act(async () => { - await loadInitialStore( - redirectCallback, - { savedObjectId: defaultSavedObjectId } as LensEmbeddableInput, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput ); }); expect(services.attributeService.unwrapAttributes).toHaveBeenCalledTimes(1); await act(async () => { - await loadInitialStore( - redirectCallback, - { savedObjectId: '5678' } as LensEmbeddableInput, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: '5678' } as unknown) as LensEmbeddableInput ); }); @@ -227,15 +230,15 @@ describe('Mounter', () => { services.attributeService.unwrapAttributes = jest.fn().mockRejectedValue('failed to load'); await act(async () => { - await loadInitialStore( - redirectCallback, - { savedObjectId: defaultSavedObjectId } as LensEmbeddableInput, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput ); }); expect(services.attributeService.unwrapAttributes).toHaveBeenCalledWith({ @@ -251,15 +254,15 @@ describe('Mounter', () => { const services = makeDefaultServices(); const lensStore = makeLensStore({ data: services.data, preloadedState }); await act(async () => { - await loadInitialStore( - redirectCallback, - ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput, - services, + await loadInitial( lensStore, - undefined, - byValueFlag, - datasourceMap, - visualizationMap + { + lensServices: services, + datasourceMap, + visualizationMap, + }, + redirectCallback, + ({ savedObjectId: defaultSavedObjectId } as unknown) as LensEmbeddableInput ); }); diff --git a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts new file mode 100644 index 0000000000000..5aeeec81e29b0 --- /dev/null +++ b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts @@ -0,0 +1,199 @@ +/* + * 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 { MiddlewareAPI } from '@reduxjs/toolkit'; +import { isEqual } from 'lodash'; +import { setState } from '..'; +import { updateLayer, updateVisualizationState, LensStoreDeps } from '..'; +import { LensEmbeddableInput, LensByReferenceInput } from '../../embeddable/embeddable'; +import { getInitialDatasourceId } from '../../utils'; +import { initializeDatasources } from '../../editor_frame_service/editor_frame'; +import { generateId } from '../../id_generator'; +import { + getVisualizeFieldSuggestions, + switchToSuggestion, +} from '../../editor_frame_service/editor_frame/suggestion_helpers'; +import { getPersistedDoc } from '../../app_plugin/save_modal_container'; + +export function loadInitial( + store: MiddlewareAPI, + { + lensServices, + datasourceMap, + visualizationMap, + embeddableEditorIncomingState, + initialContext, + }: LensStoreDeps, + redirectCallback: (savedObjectId?: string) => void, + initialInput?: LensEmbeddableInput +) { + const { getState, dispatch } = store; + const { attributeService, chrome, notifications, data, dashboardFeatureFlag } = lensServices; + const { persistedDoc } = getState().lens; + if ( + !initialInput || + (attributeService.inputIsRefType(initialInput) && + initialInput.savedObjectId === persistedDoc?.savedObjectId) + ) { + return initializeDatasources( + datasourceMap, + getState().lens.datasourceStates, + undefined, + initialContext, + { + isFullEditor: true, + } + ) + .then((result) => { + const datasourceStates = Object.entries(result).reduce( + (state, [datasourceId, datasourceState]) => ({ + ...state, + [datasourceId]: { + ...datasourceState, + isLoading: false, + }, + }), + {} + ); + dispatch( + setState({ + datasourceStates, + isLoading: false, + }) + ); + if (initialContext) { + const selectedSuggestion = getVisualizeFieldSuggestions({ + datasourceMap, + datasourceStates, + visualizationMap, + activeVisualizationId: Object.keys(visualizationMap)[0] || null, + visualizationState: null, + visualizeTriggerFieldContext: initialContext, + }); + if (selectedSuggestion) { + switchToSuggestion(dispatch, selectedSuggestion, 'SWITCH_VISUALIZATION'); + } + } + const activeDatasourceId = getInitialDatasourceId(datasourceMap); + const visualization = getState().lens.visualization; + const activeVisualization = + visualization.activeId && visualizationMap[visualization.activeId]; + + if (visualization.state === null && activeVisualization) { + const newLayerId = generateId(); + + const initialVisualizationState = activeVisualization.initialize(() => newLayerId); + dispatch( + updateLayer({ + datasourceId: activeDatasourceId!, + layerId: newLayerId, + updater: datasourceMap[activeDatasourceId!].insertLayer, + }) + ); + dispatch( + updateVisualizationState({ + visualizationId: activeVisualization.id, + updater: initialVisualizationState, + }) + ); + } + }) + .catch((e: { message: string }) => { + notifications.toasts.addDanger({ + title: e.message, + }); + redirectCallback(); + }); + } + getPersistedDoc({ + initialInput, + attributeService, + data, + chrome, + notifications, + }) + .then( + (doc) => { + if (doc) { + const currentSessionId = data.search.session.getSessionId(); + const docDatasourceStates = Object.entries(doc.state.datasourceStates).reduce( + (stateMap, [datasourceId, datasourceState]) => ({ + ...stateMap, + [datasourceId]: { + isLoading: true, + state: datasourceState, + }, + }), + {} + ); + + initializeDatasources( + datasourceMap, + docDatasourceStates, + doc.references, + initialContext, + { + isFullEditor: true, + } + ) + .then((result) => { + const activeDatasourceId = getInitialDatasourceId(datasourceMap, doc); + + dispatch( + setState({ + query: doc.state.query, + searchSessionId: + dashboardFeatureFlag.allowByValueEmbeddables && + Boolean(embeddableEditorIncomingState?.originatingApp) && + !(initialInput as LensByReferenceInput)?.savedObjectId && + currentSessionId + ? currentSessionId + : data.search.session.start(), + ...(!isEqual(persistedDoc, doc) ? { persistedDoc: doc } : null), + activeDatasourceId, + visualization: { + activeId: doc.visualizationType, + state: doc.state.visualization, + }, + datasourceStates: Object.entries(result).reduce( + (state, [datasourceId, datasourceState]) => ({ + ...state, + [datasourceId]: { + ...datasourceState, + isLoading: false, + }, + }), + {} + ), + isLoading: false, + }) + ); + }) + .catch((e: { message: string }) => + notifications.toasts.addDanger({ + title: e.message, + }) + ); + } else { + redirectCallback(); + } + }, + () => { + dispatch( + setState({ + isLoading: false, + }) + ); + redirectCallback(); + } + ) + .catch((e: { message: string }) => + notifications.toasts.addDanger({ + title: e.message, + }) + ); +} diff --git a/x-pack/plugins/lens/public/state_management/external_context_middleware.ts b/x-pack/plugins/lens/public/state_management/init_middleware/subscribe_to_external_context.ts similarity index 75% rename from x-pack/plugins/lens/public/state_management/external_context_middleware.ts rename to x-pack/plugins/lens/public/state_management/init_middleware/subscribe_to_external_context.ts index 07233b87dd19b..325e246246fcd 100644 --- a/x-pack/plugins/lens/public/state_management/external_context_middleware.ts +++ b/x-pack/plugins/lens/public/state_management/init_middleware/subscribe_to_external_context.ts @@ -7,34 +7,15 @@ import { delay, finalize, switchMap, tap } from 'rxjs/operators'; import { debounce, isEqual } from 'lodash'; -import { Dispatch, MiddlewareAPI, PayloadAction } from '@reduxjs/toolkit'; -import { trackUiEvent } from '../lens_ui_telemetry'; - +import { trackUiEvent } from '../../lens_ui_telemetry'; import { waitUntilNextSessionCompletes$, DataPublicPluginStart, -} from '../../../../../src/plugins/data/public'; -import { setState, LensGetState, LensDispatch } from '.'; -import { LensAppState } from './types'; -import { getResolvedDateRange } from '../utils'; - -export const externalContextMiddleware = (data: DataPublicPluginStart) => ( - store: MiddlewareAPI -) => { - const unsubscribeFromExternalContext = subscribeToExternalContext( - data, - store.getState, - store.dispatch - ); - return (next: Dispatch) => (action: PayloadAction>) => { - if (action.type === 'lens/navigateAway') { - unsubscribeFromExternalContext(); - } - next(action); - }; -}; +} from '../../../../../../src/plugins/data/public'; +import { setState, LensGetState, LensDispatch } from '..'; +import { getResolvedDateRange } from '../../utils'; -function subscribeToExternalContext( +export function subscribeToExternalContext( data: DataPublicPluginStart, getState: LensGetState, dispatch: LensDispatch diff --git a/x-pack/plugins/lens/public/state_management/lens_slice.ts b/x-pack/plugins/lens/public/state_management/lens_slice.ts index cb181881a6552..21624ae99cefc 100644 --- a/x-pack/plugins/lens/public/state_management/lens_slice.ts +++ b/x-pack/plugins/lens/public/state_management/lens_slice.ts @@ -6,8 +6,10 @@ */ import { createSlice, current, PayloadAction } from '@reduxjs/toolkit'; +import { LensEmbeddableInput } from '..'; import { TableInspectorAdapter } from '../editor_frame_service/types'; -import { LensAppState } from './types'; +import { getInitialDatasourceId, getResolvedDateRange } from '../utils'; +import { LensAppState, LensStoreDeps } from './types'; export const initialState: LensAppState = { searchSessionId: '', @@ -26,6 +28,44 @@ export const initialState: LensAppState = { }, }; +export const getPreloadedState = ({ + lensServices: { data }, + initialContext, + embeddableEditorIncomingState, + datasourceMap, + visualizationMap, +}: LensStoreDeps) => { + const initialDatasourceId = getInitialDatasourceId(datasourceMap); + const datasourceStates: LensAppState['datasourceStates'] = {}; + if (initialDatasourceId) { + datasourceStates[initialDatasourceId] = { + state: null, + isLoading: true, + }; + } + + const state = { + ...initialState, + isLoading: true, + query: data.query.queryString.getQuery(), + // Do not use app-specific filters from previous app, + // only if Lens was opened with the intention to visualize a field (e.g. coming from Discover) + filters: !initialContext + ? data.query.filterManager.getGlobalFilters() + : data.query.filterManager.getFilters(), + searchSessionId: data.search.session.getSessionId(), + resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter), + isLinkedToOriginatingApp: Boolean(embeddableEditorIncomingState?.originatingApp), + activeDatasourceId: initialDatasourceId, + datasourceStates, + visualization: { + state: null as unknown, + activeId: Object.keys(visualizationMap)[0] || null, + }, + }; + return state; +}; + export const lensSlice = createSlice({ name: 'lens', initialState, @@ -254,6 +294,13 @@ export const lensSlice = createSlice({ }; }, navigateAway: (state) => state, + loadInitial: ( + state, + payload: PayloadAction<{ + initialInput?: LensEmbeddableInput; + redirectCallback: (savedObjectId?: string) => void; + }> + ) => state, }, }); diff --git a/x-pack/plugins/lens/public/state_management/optimizing_middleware.ts b/x-pack/plugins/lens/public/state_management/optimizing_middleware.ts index 63e59221a683a..f1293a84255b9 100644 --- a/x-pack/plugins/lens/public/state_management/optimizing_middleware.ts +++ b/x-pack/plugins/lens/public/state_management/optimizing_middleware.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { Dispatch, MiddlewareAPI, PayloadAction } from '@reduxjs/toolkit'; +import { Dispatch, MiddlewareAPI, Action } from '@reduxjs/toolkit'; import { isEqual } from 'lodash'; -import { LensAppState } from './types'; +import { lensSlice } from './lens_slice'; /** cancels updates to the store that don't change the state */ export const optimizingMiddleware = () => (store: MiddlewareAPI) => { - return (next: Dispatch) => (action: PayloadAction>) => { - if (action.type === 'lens/onActiveDataChange') { + return (next: Dispatch) => (action: Action) => { + if (lensSlice.actions.onActiveDataChange.match(action)) { if (isEqual(store.getState().lens.activeData, action.payload)) { return; } diff --git a/x-pack/plugins/lens/public/state_management/types.ts b/x-pack/plugins/lens/public/state_management/types.ts index 1c696a3d79f9d..8816ef27238c2 100644 --- a/x-pack/plugins/lens/public/state_management/types.ts +++ b/x-pack/plugins/lens/public/state_management/types.ts @@ -5,11 +5,15 @@ * 2.0. */ +import { VisualizeFieldContext } from 'src/plugins/ui_actions/public'; +import { EmbeddableEditorState } from 'src/plugins/embeddable/public'; import { Filter, Query, SavedQuery } from '../../../../../src/plugins/data/public'; import { Document } from '../persistence'; import { TableInspectorAdapter } from '../editor_frame_service/types'; import { DateRange } from '../../common'; +import { LensAppServices } from '../app_plugin/types'; +import { DatasourceMap, VisualizationMap } from '../types'; export interface PreviewState { visualization: { @@ -49,3 +53,11 @@ export type DispatchSetState = ( export interface LensState { lens: LensAppState; } + +export interface LensStoreDeps { + lensServices: LensAppServices; + datasourceMap: DatasourceMap; + visualizationMap: VisualizationMap; + initialContext?: VisualizeFieldContext; + embeddableEditorIncomingState?: EmbeddableEditorState; +} diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 0e142c865aa81..91b16d2bcbc16 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -45,10 +45,13 @@ export interface EditorFrameProps { showNoDataPopover: () => void; } +export type VisualizationMap = Record; +export type DatasourceMap = Record; + export interface EditorFrameInstance { EditorFrameContainer: (props: EditorFrameProps) => React.ReactElement; - datasourceMap: Record; - visualizationMap: Record; + datasourceMap: DatasourceMap; + visualizationMap: VisualizationMap; } export interface EditorFrameSetup { diff --git a/x-pack/plugins/lens/public/utils.ts b/x-pack/plugins/lens/public/utils.ts index a79480d7d9953..b8ee5e4a0c26b 100644 --- a/x-pack/plugins/lens/public/utils.ts +++ b/x-pack/plugins/lens/public/utils.ts @@ -13,7 +13,7 @@ import { SavedObjectReference } from 'kibana/public'; import { Filter, Query } from 'src/plugins/data/public'; import { uniq } from 'lodash'; import { Document } from './persistence/saved_object_store'; -import { Datasource } from './types'; +import { Datasource, DatasourceMap } from './types'; import { extractFilterReferences } from './persistence'; export function getVisualizeGeoFieldMessage(fieldType: string) { @@ -55,10 +55,7 @@ export function getActiveDatasourceIdFromDoc(doc?: Document) { return firstDatasourceFromDoc || null; } -export const getInitialDatasourceId = ( - datasourceMap: Record, - doc?: Document -) => { +export const getInitialDatasourceId = (datasourceMap: DatasourceMap, doc?: Document) => { return (doc && getActiveDatasourceIdFromDoc(doc)) || Object.keys(datasourceMap)[0] || null; }; diff --git a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap index c17eeec91dc2b..cf5ca5c9c0c00 100644 --- a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap +++ b/x-pack/plugins/lens/public/xy_visualization/__snapshots__/expression.test.tsx.snap @@ -17,6 +17,7 @@ exports[`xy_expression XYChart component it renders area 1`] = ` legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={0} showLegend={false} showLegendExtra={false} @@ -234,6 +235,7 @@ exports[`xy_expression XYChart component it renders bar 1`] = ` legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={0} showLegend={false} showLegendExtra={false} @@ -465,6 +467,7 @@ exports[`xy_expression XYChart component it renders horizontal bar 1`] = ` legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={90} showLegend={false} showLegendExtra={false} @@ -696,6 +699,7 @@ exports[`xy_expression XYChart component it renders line 1`] = ` legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={0} showLegend={false} showLegendExtra={false} @@ -913,6 +917,7 @@ exports[`xy_expression XYChart component it renders stacked area 1`] = ` legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={0} showLegend={false} showLegendExtra={false} @@ -1138,6 +1143,7 @@ exports[`xy_expression XYChart component it renders stacked bar 1`] = ` legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={0} showLegend={false} showLegendExtra={false} @@ -1377,6 +1383,7 @@ exports[`xy_expression XYChart component it renders stacked horizontal bar 1`] = legendPosition="top" onBrushEnd={[Function]} onElementClick={[Function]} + onPointerUpdate={[Function]} rotation={90} showLegend={false} showLegendExtra={false} diff --git a/x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts b/x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts index 83d86eb410b19..95c9140624e63 100644 --- a/x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts +++ b/x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts @@ -8,7 +8,7 @@ import { FormatFactory } from '../../common'; import { AxisExtentConfig, XYLayerConfig } from '../../common/expressions'; import { Datatable, SerializedFieldFormat } from '../../../../../src/plugins/expressions/public'; -import { IFieldFormat } from '../../../../../src/plugins/data/public'; +import type { IFieldFormat } from '../../../../../src/plugins/field_formats/common'; interface FormattedMetric { layer: string; diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx index 56a59bd7713b2..94ed503700042 100644 --- a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx @@ -49,7 +49,12 @@ import { XyEndzones } from './x_domain'; const onClickValue = jest.fn(); const onSelectRange = jest.fn(); -const chartsThemeService = chartPluginMock.createSetupContract().theme; +const chartSetupContract = chartPluginMock.createSetupContract(); +const chartStartContract = chartPluginMock.createStartContract(); + +const chartsThemeService = chartSetupContract.theme; +const chartsActiveCursorService = chartStartContract.activeCursor; + const paletteService = chartPluginMock.createPaletteRegistry(); const mockPaletteOutput: PaletteOutput = { @@ -473,6 +478,7 @@ describe('xy_expression', () => { timeZone: 'UTC', renderMode: 'display', chartsThemeService, + chartsActiveCursorService, paletteService, minInterval: 50, onClickValue, diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.tsx index b7f22ebf8968d..23b251b76e950 100644 --- a/x-pack/plugins/lens/public/xy_visualization/expression.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/expression.tsx @@ -7,7 +7,7 @@ import './expression.scss'; -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import ReactDOM from 'react-dom'; import { Chart, @@ -47,8 +47,10 @@ import { isHorizontalChart, getSeriesColor } from './state_helpers'; import { search } from '../../../../../src/plugins/data/public'; import { ChartsPluginSetup, + ChartsPluginStart, PaletteRegistry, SeriesLayer, + useActiveCursor, } from '../../../../../src/plugins/charts/public'; import { EmptyPlaceholder } from '../shared_components'; import { getFitOptions } from './fitting_functions'; @@ -85,6 +87,7 @@ export { export type XYChartRenderProps = XYChartProps & { chartsThemeService: ChartsPluginSetup['theme']; + chartsActiveCursorService: ChartsPluginStart['activeCursor']; paletteService: PaletteRegistry; formatFactory: FormatFactory; timeZone: string; @@ -121,7 +124,8 @@ export function calculateMinInterval({ args: { layers }, data }: XYChartProps) { export const getXyChartRenderer = (dependencies: { formatFactory: Promise; - chartsThemeService: ChartsPluginSetup['theme']; + chartsThemeService: ChartsPluginStart['theme']; + chartsActiveCursorService: ChartsPluginStart['activeCursor']; paletteService: PaletteRegistry; timeZone: string; }): ExpressionRenderDefinition => ({ @@ -150,6 +154,7 @@ export const getXyChartRenderer = (dependencies: { (null); const chartTheme = chartsThemeService.useChartsTheme(); const chartBaseTheme = chartsThemeService.useChartsBaseTheme(); const darkMode = chartsThemeService.useDarkMode(); const filteredLayers = getFilteredLayers(layers, data); + const handleCursorUpdate = useActiveCursor(chartsActiveCursorService, chartRef, { + datatables: Object.values(data.tables), + }); + if (filteredLayers.length === 0) { const icon: IconType = layers.length > 0 ? getIconForSeriesType(layers[0].seriesType) : 'bar'; return ; @@ -486,8 +497,9 @@ export function XYChart({ } as LegendPositionConfig; return ( - + , - { expressions, formatFactory, editorFrame, charts }: XyVisualizationPluginSetupPlugins + { expressions, formatFactory, editorFrame }: XyVisualizationPluginSetupPlugins ) { editorFrame.registerVisualization(async () => { const { @@ -41,7 +41,7 @@ export class XyVisualization { getXyChartRenderer, getXyVisualization, } = await import('../async_services'); - const [, { data }] = await core.getStartServices(); + const [, { data, charts }] = await core.getStartServices(); const palettes = await charts.palettes.getPalettes(); expressions.registerFunction(() => legendConfig); expressions.registerFunction(() => yAxisConfig); @@ -57,6 +57,7 @@ export class XyVisualization { getXyChartRenderer({ formatFactory, chartsThemeService: charts.theme, + chartsActiveCursorService: charts.activeCursor, paletteService: palettes, timeZone: getTimeZone(core.uiSettings), }) diff --git a/x-pack/plugins/lens/tsconfig.json b/x-pack/plugins/lens/tsconfig.json index 134f0b4185b84..6c4d3631a12f3 100644 --- a/x-pack/plugins/lens/tsconfig.json +++ b/x-pack/plugins/lens/tsconfig.json @@ -37,5 +37,6 @@ { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, { "path": "../../../src/plugins/embeddable/tsconfig.json"}, { "path": "../../../src/plugins/presentation_util/tsconfig.json"}, + { "path": "../../../src/plugins/field_formats/tsconfig.json"} ] - } \ No newline at end of file + } diff --git a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap index ea973df9aad76..f81ec6a73d140 100644 --- a/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap +++ b/x-pack/plugins/license_management/__jest__/__snapshots__/upload_license.test.tsx.snap @@ -1408,6 +1408,7 @@ exports[`UploadLicense should display an error when ES says license is expired 1 >