diff --git a/.buildkite/pipelines/es_snapshots/verify.yml b/.buildkite/pipelines/es_snapshots/verify.yml index 70b540f12686e..23ec38085c3d9 100755 --- a/.buildkite/pipelines/es_snapshots/verify.yml +++ b/.buildkite/pipelines/es_snapshots/verify.yml @@ -79,7 +79,6 @@ steps: queue: kibana-default depends_on: - default-cigroup - - default-cigroup-docker - oss-cigroup - jest-integration - api-integration diff --git a/.buildkite/scripts/steps/artifacts/publish.sh b/.buildkite/scripts/steps/artifacts/publish.sh index c16d7a02d6cd9..ed4cb5ca1d4b9 100644 --- a/.buildkite/scripts/steps/artifacts/publish.sh +++ b/.buildkite/scripts/steps/artifacts/publish.sh @@ -26,6 +26,7 @@ download "kibana-$FULL_VERSION-x86_64.rpm" download "kibana-$FULL_VERSION-aarch64.rpm" download "kibana-$FULL_VERSION-docker-build-context.tar.gz" +download "kibana-cloud-$FULL_VERSION-docker-build-context.tar.gz" download "kibana-ironbank-$FULL_VERSION-docker-build-context.tar.gz" download "kibana-ubi8-$FULL_VERSION-docker-build-context.tar.gz" diff --git a/.buildkite/scripts/steps/functional/uptime.sh b/.buildkite/scripts/steps/functional/uptime.sh index a1c8c2bf6c85b..ce49acadf4deb 100755 --- a/.buildkite/scripts/steps/functional/uptime.sh +++ b/.buildkite/scripts/steps/functional/uptime.sh @@ -13,5 +13,5 @@ echo "--- Uptime @elastic/synthetics Tests" cd "$XPACK_DIR" -checks-reporter-with-killswitch "Uptime @elastic/synthetics Tests" \ - node plugins/uptime/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" ${GREP:+--grep \"${GREP}\"} +checks-reporter-with-killswitch "uptime plugin @elastic/synthetics Tests" \ + node plugins/synthetics/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" ${GREP:+--grep \"${GREP}\"} diff --git a/docs/concepts/data-views.asciidoc b/docs/concepts/data-views.asciidoc index 807b829c7481a..f8040d1885907 100644 --- a/docs/concepts/data-views.asciidoc +++ b/docs/concepts/data-views.asciidoc @@ -1,11 +1,11 @@ [[data-views]] -=== Create a data view +=== Create a {data-source} -{kib} requires a data view to access the {es} data that you want to explore. -A data view selects the data to use and allows you to define properties of the fields. +{kib} requires a {data-source} to access the {es} data that you want to explore. +A {data-source} selects the data to use and allows you to define properties of the fields. -A data view can point to one or more indices, {ref}/data-streams.html[data stream], or {ref}/alias.html[index aliases]. -For example, a data view can point to your log data from yesterday, +A {data-source} can point to one or more indices, {ref}/data-streams.html[data streams], or {ref}/alias.html[index aliases]. +For example, a {data-source} can point to your log data from yesterday, or all indices that contain your data. [float] @@ -15,12 +15,12 @@ or all indices that contain your data. * Access to *Data Views* requires the <> `Data View Management`. -* To create a data view, you must have the <> +* To create a {data-source}, you must have the <> `view_index_metadata`. * If a read-only indicator appears in {kib}, you have insufficient privileges -to create or save data views. The buttons to create new data views or -save existing data views are not visible. For more information, +to create or save {data-sources}. The buttons to create {data-sources} or +save existing {data-sources} are not visible. For more information, refer to <>. [float] @@ -29,12 +29,12 @@ refer to <>. If you collected data using one of the {kib} <>, uploaded a file, or added sample data, -you get a data view for free, and can start exploring your data. -If you loaded your own data, follow these steps to create a data view. +you get a {data-source} for free, and can start exploring your data. +If you loaded your own data, follow these steps to create a {data-source}. . Open the main menu, then click *Stack Management > Data Views*. -. Click *Create data view*. +. Click *Create {data-source}*. . Start typing in the *name* field, and {kib} looks for the names of indices, data streams, and aliases that match your input. @@ -61,21 +61,25 @@ global time filters on your dashboards. This is useful if you have multiple time fields and want to create dashboards that combine visualizations based on different timestamps. -. Click *Create data view*. +. To display all indices, click *Show advanced settings*, then select *Allow hidden and system indices*. + +. To specify your own {data-source} name, click *Show advanced settings*, then enter the name in the *Custom {data-source} ID* field. For example, enter your {es} index alias name. + +. Click *Create {data-source}*. + [[reload-fields]] {kib} is now configured to use your {es} data. When a new field is added to an index, -the data view field list is updated -the next time the data view is loaded, for example, when you load the page or +the {data-source} field list is updated +the next time the {data-source} is loaded, for example, when you load the page or move between {kib} apps. -. Select this data view when you search and visualize your data. +. Select this {data-source} when you search and visualize your data. [float] [[rollup-data-view]] ==== Create a data view for rolled up data -A data view can match one rollup index. For a combination rollup -data view with both raw and rolled up data, use the standard notation: +A {data-source} can match one rollup index. For a combination rollup +{data-source} with both raw and rolled up data, use the standard notation: ```ts rollup_logstash,kibana_sample_data_logs @@ -130,20 +134,20 @@ To exclude a cluster having a name starting with `cluster_`: `cluster_*:logstash-*,cluster_one:-*` ``` -Once you configure a data view to use the {ccs} syntax, all searches and -aggregations using that data view in {kib} take advantage of {ccs}. +Once you configure a {data-source} to use the {ccs} syntax, all searches and +aggregations using that {data-source} in {kib} take advantage of {ccs}. [float] [[delete-data-view]] -=== Delete data views +=== Delete {data-sources} -When you delete a data view, you cannot recover the associated field formatters, runtime fields, source filters, -and field popularity data. Deleting a data view does not remove any indices or data documents from {es}. +When you delete a {data-source}, you cannot recover the associated field formatters, runtime fields, source filters, +and field popularity data. Deleting a {data-source} does not remove any indices or data documents from {es}. -WARNING: Deleting a data view breaks all visualizations, saved searches, and other saved objects that reference the data view. +WARNING: Deleting a {data-source} breaks all visualizations, saved searches, and other saved objects that reference the data view. . Open the main menu, then click *Stack Management > Data Views*. -. Click the data view to delete. +. Click the {data-source} to delete. -. Delete (image:management/index-patterns/images/delete.png[Delete icon]) the data view. +. Delete (image:management/index-patterns/images/delete.png[Delete icon]) the {data-source}. diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index e96f1cd819186..90bf3d3c29b41 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -613,6 +613,11 @@ the alertTypes by the Stack in the alerting plugin, register associated HTTP routes, etc. +|{kib-repo}blob/{branch}/x-pack/plugins/synthetics/README.md[synthetics] +|The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening +in their infrastructure. + + |{kib-repo}blob/{branch}/x-pack/plugins/task_manager/README.md[taskManager] |The task manager is a generic system for running background tasks. Documentation: https://www.elastic.co/guide/en/kibana/master/task-manager-production-considerations.html @@ -648,11 +653,6 @@ As a developer you can reuse and extend built-in alerts and actions UI functiona |Upgrade Assistant helps users prepare their Stack for being upgraded to the next major. It will only be enabled on the last minor before the next major release. This is controlled via the config: xpack.upgrade_assistant.readonly (#101296). -|{kib-repo}blob/{branch}/x-pack/plugins/uptime/README.md[uptime] -|The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening -in their infrastructure. - - |{kib-repo}blob/{branch}/x-pack/plugins/drilldowns/url_drilldown/README.md[urlDrilldown] |NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin. diff --git a/docs/user/alerting/create-and-manage-rules.asciidoc b/docs/user/alerting/create-and-manage-rules.asciidoc index 23e79911fd5ee..ba1629abd9c86 100644 --- a/docs/user/alerting/create-and-manage-rules.asciidoc +++ b/docs/user/alerting/create-and-manage-rules.asciidoc @@ -140,17 +140,21 @@ Actions are not required on rules. You can run a rule without actions to underst [float] [[controlling-rules]] -=== Mute and disable rules +=== Snooze and disable rules -The rule listing allows you to quickly mute/unmute, disable/enable, and delete individual rules by clicking menu button to open the actions menu. Muting means that the rule checks continue to run on a schedule, but that alert will not trigger any action. +The rule listing enables you to quickly snooze, disable or enable, and delete individual rules using the colored dropdown. [role="screenshot"] -image:images/individual-mute-disable.png[The actions button allows an individual rule to be muted, disabled, or deleted] +image:images/individual-snooze-disable.png[The rule status dropdown enables you to snooze or disable an individual rule] -You can perform these operations in bulk by multi-selecting rules, and then clicking the *Manage rules* button: +When you snooze a rule, the rule checks continue to run on a schedule but the alert will not trigger any actions. You can snooze for a specified period of time or indefinitely. [role="screenshot"] -image:images/bulk-mute-disable.png[The Manage rules button lets you mute/unmute, enable/disable, and delete in bulk,width=75%] +image:images/snooze-panel.png[The snooze panel allows you to set the length of a rule's snooze period] + +When a rule is in a `snoozed` state, you can cancel or change the duration of this state. You can perform these operations in bulk by multi-selecting rules, and then clicking the *Manage rules* button. + +TIP: In this context, "Mute" refers to an indefinite snooze. preview:[] [float] === Rule status diff --git a/docs/user/alerting/images/bulk-mute-disable.png b/docs/user/alerting/images/bulk-mute-disable.png deleted file mode 100644 index b2f9c230ffeb2..0000000000000 Binary files a/docs/user/alerting/images/bulk-mute-disable.png and /dev/null differ diff --git a/docs/user/alerting/images/individual-snooze-disable.png b/docs/user/alerting/images/individual-snooze-disable.png new file mode 100644 index 0000000000000..354d996ee74a1 Binary files /dev/null and b/docs/user/alerting/images/individual-snooze-disable.png differ diff --git a/docs/user/alerting/images/snooze-panel.png b/docs/user/alerting/images/snooze-panel.png new file mode 100644 index 0000000000000..b09a509c57ca9 Binary files /dev/null and b/docs/user/alerting/images/snooze-panel.png differ diff --git a/package.json b/package.json index fc3433f84802a..43d47614b7fd2 100644 --- a/package.json +++ b/package.json @@ -151,6 +151,7 @@ "@kbn/i18n-react": "link:bazel-bin/packages/kbn-i18n-react", "@kbn/interpreter": "link:bazel-bin/packages/kbn-interpreter", "@kbn/io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils", + "@kbn/kibana-json-schema": "link:bazel-bin/packages/kbn-kibana-json-schema", "@kbn/logging": "link:bazel-bin/packages/kbn-logging", "@kbn/logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks", "@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl", @@ -635,6 +636,7 @@ "@types/kbn__interpreter": "link:bazel-bin/packages/kbn-interpreter/npm_module_types", "@types/kbn__io-ts-utils": "link:bazel-bin/packages/kbn-io-ts-utils/npm_module_types", "@types/kbn__jest-serializers": "link:bazel-bin/packages/kbn-jest-serializers/npm_module_types", + "@types/kbn__kibana-json-schema": "link:bazel-bin/packages/kbn-kibana-json-schema/npm_module_types", "@types/kbn__logging": "link:bazel-bin/packages/kbn-logging/npm_module_types", "@types/kbn__logging-mocks": "link:bazel-bin/packages/kbn-logging-mocks/npm_module_types", "@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types", @@ -877,6 +879,7 @@ "jest-styled-components": "^7.0.3", "jimp": "^0.14.0", "jsdom": "13.1.0", + "json-schema-typed": "^7.0.3", "json5": "^1.0.1", "jsondiffpatch": "0.4.1", "license-checker": "^16.0.0", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 3fe72a6c642d6..567e5dd65d664 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -54,6 +54,7 @@ filegroup( "//packages/kbn-interpreter:build", "//packages/kbn-io-ts-utils:build", "//packages/kbn-jest-serializers:build", + "//packages/kbn-kibana-json-schema:build", "//packages/kbn-logging-mocks:build", "//packages/kbn-logging:build", "//packages/kbn-mapbox-gl:build", @@ -149,6 +150,7 @@ filegroup( "//packages/kbn-interpreter:build_types", "//packages/kbn-io-ts-utils:build_types", "//packages/kbn-jest-serializers:build_types", + "//packages/kbn-kibana-json-schema:build_types", "//packages/kbn-logging-mocks:build_types", "//packages/kbn-logging:build_types", "//packages/kbn-mapbox-gl:build_types", diff --git a/packages/analytics/client/src/events/types.ts b/packages/analytics/client/src/events/types.ts index 5f1f587d3b284..bc193a2788db1 100644 --- a/packages/analytics/client/src/events/types.ts +++ b/packages/analytics/client/src/events/types.ts @@ -17,9 +17,9 @@ export interface EventContext { */ userId?: string; /** - * The user's organization ID. + * The Cloud ID. */ - esOrgId?: string; + cloudId?: string; /** * The product's version. */ diff --git a/packages/analytics/shippers/fullstory/src/fullstory_shipper.test.ts b/packages/analytics/shippers/fullstory/src/fullstory_shipper.test.ts index 67797a629c828..4b60ba661fe14 100644 --- a/packages/analytics/shippers/fullstory/src/fullstory_shipper.test.ts +++ b/packages/analytics/shippers/fullstory/src/fullstory_shipper.test.ts @@ -62,13 +62,13 @@ describe('FullStoryShipper', () => { }); }); - test('calls `setUserVars` when esOrgId is provided', () => { - fullstoryShipper.extendContext({ esOrgId: 'test-es-org-id' }); + test('calls `setUserVars` when cloudId is provided', () => { + fullstoryShipper.extendContext({ cloudId: 'test-es-org-id' }); expect(fullStoryApiMock.setUserVars).toHaveBeenCalledWith({ org_id_str: 'test-es-org-id' }); }); - test('merges both: version and esOrgId if both are provided', () => { - fullstoryShipper.extendContext({ version: '1.2.3', esOrgId: 'test-es-org-id' }); + test('merges both: version and cloudId if both are provided', () => { + fullstoryShipper.extendContext({ version: '1.2.3', cloudId: 'test-es-org-id' }); expect(fullStoryApiMock.setUserVars).toHaveBeenCalledWith({ org_id_str: 'test-es-org-id', version_str: '1.2.3', @@ -84,7 +84,7 @@ describe('FullStoryShipper', () => { const context = { userId: 'test-user-id', version: '1.2.3', - esOrgId: 'test-es-org-id', + cloudId: 'test-es-org-id', foo: 'bar', }; fullstoryShipper.extendContext(context); diff --git a/packages/analytics/shippers/fullstory/src/fullstory_shipper.ts b/packages/analytics/shippers/fullstory/src/fullstory_shipper.ts index 6f74a3085ab62..ef9d5d662813d 100644 --- a/packages/analytics/shippers/fullstory/src/fullstory_shipper.ts +++ b/packages/analytics/shippers/fullstory/src/fullstory_shipper.ts @@ -36,7 +36,7 @@ export class FullStoryShipper implements IShipper { this.initContext.logger.debug(`Received context ${JSON.stringify(newContext)}`); // FullStory requires different APIs for different type of contexts. - const { userId, version, esOrgId, ...nonUserContext } = newContext; + const { userId, version, cloudId, ...nonUserContext } = newContext; // Call it only when the userId changes if (userId && userId !== this.lastUserId) { @@ -47,13 +47,13 @@ export class FullStoryShipper implements IShipper { } // User-level context - if (version || esOrgId) { + if (version || cloudId) { this.initContext.logger.debug( - `Calling FS.setUserVars with version ${version} and esOrgId ${esOrgId}` + `Calling FS.setUserVars with version ${version} and cloudId ${cloudId}` ); this.fullStoryApi.setUserVars({ ...(version ? getParsedVersion(version) : {}), - ...(esOrgId ? { org_id_str: esOrgId } : {}), + ...(cloudId ? { org_id_str: cloudId } : {}), }); } diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index a1d94136ebfb1..a8b1234a406fd 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -14,7 +14,7 @@ module.exports = { USES_STYLED_COMPONENTS: [ /packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/, /src[\/\\]plugins[\/\\](unified_search|kibana_react)[\/\\]/, - /x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime|ux)[\/\\]/, + /x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|synthetics|ux)[\/\\]/, /x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/, ], }; diff --git a/packages/kbn-dev-utils/BUILD.bazel b/packages/kbn-dev-utils/BUILD.bazel index 5513aff23f15a..cf12092007987 100644 --- a/packages/kbn-dev-utils/BUILD.bazel +++ b/packages/kbn-dev-utils/BUILD.bazel @@ -47,6 +47,7 @@ RUNTIME_DEPS = [ "//packages/kbn-stdio-dev-helpers", "//packages/kbn-ci-stats-reporter", "//packages/kbn-jest-serializers", + "//packages/kbn-kibana-json-schema", "@npm//@babel/core", "@npm//axios", "@npm//chalk", @@ -77,6 +78,7 @@ TYPES_DEPS = [ "//packages/kbn-stdio-dev-helpers:npm_module_types", "//packages/kbn-ci-stats-reporter:npm_module_types", "//packages/kbn-jest-serializers:npm_module_types", + "//packages/kbn-kibana-json-schema:npm_module_types", "@npm//@babel/parser", "@npm//@babel/types", "@npm//@types/babel__core", diff --git a/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts b/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts index 4fccc9937b1f6..55a44564d29ea 100644 --- a/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts +++ b/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts @@ -6,6 +6,8 @@ * Side Public License, v 1. */ +import { KibanaJsonSchema } from '@kbn/kibana-json-schema'; + export interface ManagedConfigKey { key: string; value: string | Record | boolean | number; @@ -58,4 +60,17 @@ export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [ key: 'typescript.tsserver.maxTsServerMemory', value: 4096, }, + { + key: 'json.schemas', + value: [ + { + fileMatch: ['kibana.json'], + url: './.vscode/kibana-json-schema.json', + }, + ], + }, +]; + +export const MANAGED_CONFIG_FILES = [ + { name: 'kibana-json-schema.json', content: JSON.stringify(KibanaJsonSchema, null, 2) }, ]; diff --git a/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.test.ts b/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.test.ts index 3573acd59559f..f9e3aecb89b93 100644 --- a/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.test.ts +++ b/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.test.ts @@ -26,6 +26,10 @@ const TEST_KEYS: ManagedConfigKey[] = [ key: 'stringKey', value: 'foo', }, + { + key: 'arrayKey', + value: ['foo', 'bar'], + }, ]; const run = (json?: string) => updateVscodeConfig(TEST_KEYS, '', json); @@ -41,7 +45,9 @@ it('updates the passed JSON with the managed settings', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -58,7 +64,9 @@ it('initialized empty or undefined json values', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -73,7 +81,9 @@ it('initialized empty or undefined json values', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -90,7 +100,9 @@ it('replaces conflicting managed keys which do not have matching value types', ( "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -136,7 +148,9 @@ it('persists comments in the original file', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -164,7 +178,9 @@ it('overrides old values for managed keys', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -206,7 +222,9 @@ it('does not modify properties with leading `// self managed` comment', () => { "world": [5] }, // self managed - "stringKey": "--" + "stringKey": "--", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -232,7 +250,9 @@ it('does not modify child properties with leading `// self managed` comment', () "hello": true }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -260,7 +280,9 @@ it('does not modify unknown child properties', () => { "hello": true }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -288,7 +310,9 @@ it('removes managed properties which are no longer managed', () => { "hello": true }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -314,7 +338,9 @@ it('wipes out child keys which conflict with newly managed child keys', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -338,7 +364,9 @@ it('correctly formats info text when specified', () => { "world": [1, 2, 3] }, // @managed - "stringKey": "foo" + "stringKey": "foo", + // @managed + "arrayKey": ["foo", "bar"] } `); @@ -368,7 +396,9 @@ it('allows "// self managed" comments conflicting with "// @managed" comments to "world": [1, 2, 3] }, // self managed - "stringKey": 12345 + "stringKey": 12345, + // @managed + "arrayKey": ["foo", "bar"] } `); diff --git a/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.ts b/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.ts index 5c33b00262cc6..d327ab98ae82c 100644 --- a/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.ts +++ b/packages/kbn-dev-utils/src/vscode_config/update_vscode_config.ts @@ -69,9 +69,9 @@ const createObjectPropOfManagedValues = (key: string, value: Record const addManagedProp = ( ast: t.ObjectExpression, key: string, - value: string | Record | boolean | number + value: string | Record | boolean | number | any[] ) => { - if (['number', 'string', 'boolean'].includes(typeof value)) { + if (['number', 'string', 'boolean'].includes(typeof value) || Array.isArray(value)) { ast.properties.push(createManagedProp(key, value)); } else { ast.properties.push(createObjectPropOfManagedValues(key, value as Record)); @@ -183,6 +183,20 @@ export function updateVscodeConfig(keys: ManagedConfigKey[], infoText: string, j continue; } + if (Array.isArray(value)) { + if (!existingProp) { + addManagedProp(ast, key, value); + continue; + } + + if (!isSelfManaged(existingProp)) { + replaceManagedProp(ast, existingProp, value); + continue; + } + + continue; + } + if (typeof value === 'object') { if (existingProp && existingProp.value.type === 'ObjectExpression') { // setting exists and is an object so merge properties of `value` with it diff --git a/packages/kbn-dev-utils/src/vscode_config/update_vscode_config_cli.ts b/packages/kbn-dev-utils/src/vscode_config/update_vscode_config_cli.ts index 273aed9585572..70ae7c35765f5 100644 --- a/packages/kbn-dev-utils/src/vscode_config/update_vscode_config_cli.ts +++ b/packages/kbn-dev-utils/src/vscode_config/update_vscode_config_cli.ts @@ -7,23 +7,25 @@ */ import Path from 'path'; -import Fs from 'fs/promises'; +import Fsp from 'fs/promises'; import { REPO_ROOT } from '@kbn/utils'; import dedent from 'dedent'; import { run } from '../run'; -import { MANAGED_CONFIG_KEYS } from './managed_config_keys'; +import { MANAGED_CONFIG_KEYS, MANAGED_CONFIG_FILES } from './managed_config_keys'; import { updateVscodeConfig } from './update_vscode_config'; +const CONFIG_DIR = Path.resolve(REPO_ROOT, '.vscode'); + export function runUpdateVscodeConfigCli() { run(async ({ log }) => { - const path = Path.resolve(REPO_ROOT, '.vscode/settings.json'); + const path = Path.resolve(CONFIG_DIR, 'settings.json'); let json; try { - json = await Fs.readFile(path, 'utf-8'); + json = await Fsp.readFile(path, 'utf-8'); } catch (error) { if (error.code !== 'ENOENT') { throw error; @@ -40,8 +42,14 @@ export function runUpdateVscodeConfigCli() { `, json ); - await Fs.mkdir(Path.dirname(path), { recursive: true }); - await Fs.writeFile(path, updatedJson); + await Fsp.mkdir(Path.dirname(path), { recursive: true }); + + // write managed config files + for (const { name, content } of MANAGED_CONFIG_FILES) { + await Fsp.writeFile(Path.resolve(CONFIG_DIR, name), content); + } + + await Fsp.writeFile(path, updatedJson); log.success('updated', path); }); diff --git a/packages/kbn-generate/src/commands/package_command.ts b/packages/kbn-generate/src/commands/package_command.ts index 9b369c3201939..92362e7feb35f 100644 --- a/packages/kbn-generate/src/commands/package_command.ts +++ b/packages/kbn-generate/src/commands/package_command.ts @@ -11,6 +11,7 @@ import Path from 'path'; import normalizePath from 'normalize-path'; import globby from 'globby'; +import { ESLint } from 'eslint'; import micromatch from 'micromatch'; import { REPO_ROOT } from '@kbn/utils'; @@ -129,6 +130,15 @@ ${BAZEL_PACKAGE_DIRS.map((dir) => ` ./${dir}/*\n`).join log.info('Wrote plugin files to', packageDir); + log.info('Linting files'); + const eslint = new ESLint({ + cache: false, + cwd: REPO_ROOT, + fix: true, + extensions: ['.js', '.mjs', '.ts', '.tsx'], + }); + await ESLint.outputFixes(await eslint.lintFiles([packageDir])); + const packageJsonPath = Path.resolve(REPO_ROOT, 'package.json'); const packageJson = JSON.parse(await Fsp.readFile(packageJsonPath, 'utf8')); diff --git a/packages/kbn-kibana-json-schema/BUILD.bazel b/packages/kbn-kibana-json-schema/BUILD.bazel new file mode 100644 index 0000000000000..ff863dd7d6d0a --- /dev/null +++ b/packages/kbn-kibana-json-schema/BUILD.bazel @@ -0,0 +1,117 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "kbn-kibana-json-schema" +PKG_REQUIRE_NAME = "@kbn/kibana-json-schema" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + ], + exclude = [ + "**/*.test.*", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +# In this array place runtime dependencies, including other packages and NPM packages +# which must be available for this code to run. +# +# To reference other packages use: +# "//repo/relative/path/to/package" +# eg. "//packages/kbn-utils" +# +# To reference a NPM package use: +# "@npm//name-of-package" +# eg. "@npm//lodash" +RUNTIME_DEPS = [ + "@npm//dedent", +] + +# In this array place dependencies necessary to build the types, which will include the +# :npm_module_types target of other packages and packages from NPM, including @types/* +# packages. +# +# To reference the types for another package use: +# "//repo/relative/path/to/package:npm_module_types" +# eg. "//packages/kbn-utils:npm_module_types" +# +# References to NPM packages work the same as RUNTIME_DEPS +TYPES_DEPS = [ + "@npm//@types/dedent", + "@npm//@types/node", + "@npm//@types/jest", + "@npm//json-schema-typed" +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-kibana-json-schema/README.md b/packages/kbn-kibana-json-schema/README.md new file mode 100644 index 0000000000000..f1edda001081b --- /dev/null +++ b/packages/kbn-kibana-json-schema/README.md @@ -0,0 +1,3 @@ +# @kbn/kibana-json-schema + +The JSON Schema used for kibana.json files \ No newline at end of file diff --git a/packages/kbn-kibana-json-schema/jest.config.js b/packages/kbn-kibana-json-schema/jest.config.js new file mode 100644 index 0000000000000..00bc8f55adc57 --- /dev/null +++ b/packages/kbn-kibana-json-schema/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/jest_node', + rootDir: '../..', + roots: ['/packages/kbn-kibana-json-schema'], +}; diff --git a/packages/kbn-kibana-json-schema/package.json b/packages/kbn-kibana-json-schema/package.json new file mode 100644 index 0000000000000..12df4c2d199a2 --- /dev/null +++ b/packages/kbn-kibana-json-schema/package.json @@ -0,0 +1,7 @@ +{ + "name": "@kbn/kibana-json-schema", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/kbn-kibana-json-schema/src/index.ts b/packages/kbn-kibana-json-schema/src/index.ts new file mode 100644 index 0000000000000..57d8be3e215e6 --- /dev/null +++ b/packages/kbn-kibana-json-schema/src/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 { KibanaJsonSchema } from './kibana_json_schema'; diff --git a/packages/kbn-kibana-json-schema/src/kibana_json_schema.ts b/packages/kbn-kibana-json-schema/src/kibana_json_schema.ts new file mode 100644 index 0000000000000..40686a9230cc6 --- /dev/null +++ b/packages/kbn-kibana-json-schema/src/kibana_json_schema.ts @@ -0,0 +1,145 @@ +/* + * Copyright 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 { JSONSchema } from 'json-schema-typed'; +import dedent from 'dedent'; + +export const KibanaJsonSchema: JSONSchema = { + type: 'object', + required: ['id', 'version', 'owner'], + properties: { + id: { + description: dedent` + Identifier of the plugin. Must be a string in camelCase. Part of a plugin + public contract. Other plugins leverage it to access plugin API, navigate + to the plugin, etc. + `, + type: 'string', + pattern: '^[a-z]{1}([a-zA-Z0-9]{1,})$', + }, + version: { + description: 'Version of the plugin.', + type: 'string', + pattern: '^(kibana|v?\\d+(\\.\\d+){0,2})$', + }, + kibanaVersion: { + description: dedent` + The version of Kibana the plugin is compatible with, defaults to the value of the version field. + `, + type: 'string', + pattern: '^(kibana|)$', + }, + type: { + description: 'Type of the plugin, defaults to `standard`.', + enum: ['standard', 'preboot'], + }, + configPath: { + description: + 'Root configuration path used by the plugin, defaults to "id" in snake_case format.', + oneOf: [ + { type: 'string' }, + { + type: 'array', + items: { type: 'string' }, + }, + ], + }, + requiredPlugins: { + description: dedent` + An optional list of the other plugins that MUST BE installed and enabled for this + plugin to function properly. + `, + type: 'array', + items: { type: 'string' }, + }, + optionalPlugins: { + description: dedent` + An optional list of the other plugins that if installed and enabled **may be** + leveraged by this plugin for some additional functionality but otherwise are + not required for this plugin to work properly. + `, + type: 'array', + items: { type: 'string' }, + }, + requiredBundles: { + description: dedent` + An optional list of the other plugins that if installed and enabled MAY BE leveraged + by this plugin for some additional functionality but otherwise are not required for + this plugin to work properly. + + The plugins listed here will be loaded in the browser, even if the plugin is + disabled. Required by \`@kbn/optimizer\` to support cross-plugin imports. + "core" and plugins already listed in \`requiredPlugins\` do not need to be + duplicated here. + `, + type: 'array', + items: { type: 'string' }, + }, + ui: { + description: dedent` + Specifies whether plugin includes some client/browser specific functionality + that should be included into client bundle via \`public/ui_plugin.js\` file. + `, + type: 'boolean', + }, + server: { + description: dedent` + Specifies whether plugin includes some server-side specific functionality. + `, + type: 'boolean', + }, + extraPublicDirs: { + description: dedent` + Specifies directory names that can be imported by other ui-plugins built + using the same instance of the @kbn/optimizer. A temporary measure we plan + to replace with better mechanisms for sharing static code between plugins + @deprecated To be deleted when https://github.com/elastic/kibana/issues/101948 is done. + `, + type: 'array', + items: { type: 'string' }, + }, + serviceFolders: { + description: dedent` + Only used for the automatically generated API documentation. Specifying service + folders will cause your plugin API reference to be broken up into sub sections. + `, + type: 'array', + items: { type: 'string' }, + }, + owner: { + type: 'object', + required: ['name'], + properties: { + name: { + description: 'The name of the team that currently owns this plugin.', + type: 'string', + }, + githubTeam: { + description: dedent` + All internal plugins should have a github team specified. GitHub teams can be + viewed here: https://github.com/orgs/elastic/teams + `, + type: 'string', + }, + }, + }, + description: { + description: dedent` + A brief description of what this plugin does and any capabilities it provides. + `, + type: 'string', + }, + enabledOnAnonymousPages: { + description: dedent` + Specifies whether this plugin - and its required dependencies - will be enabled for anonymous pages (login page, status page when + configured, etc.) Default is false. + `, + type: 'boolean', + }, + }, +}; diff --git a/packages/kbn-kibana-json-schema/tsconfig.json b/packages/kbn-kibana-json-schema/tsconfig.json new file mode 100644 index 0000000000000..a8cfc2cceb08b --- /dev/null +++ b/packages/kbn-kibana-json-schema/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": "src", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 8b2fa23eb8a75..98089f1f1c5fb 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -58,7 +58,6 @@ pageLoadAssetSize: transform: 41007 triggersActionsUi: 103400 upgradeAssistant: 81241 - uptime: 40825 urlForwarding: 32579 usageCollection: 39762 visDefaultEditor: 50178 @@ -116,7 +115,7 @@ pageLoadAssetSize: reporting: 57003 visTypeHeatmap: 25340 expressionGauge: 25000 - controls: 34788 + controls: 40000 expressionPartitionVis: 26338 sharedUX: 16225 ux: 20784 @@ -128,3 +127,4 @@ pageLoadAssetSize: expressionXY: 26500 eventAnnotation: 19334 screenshotting: 22870 + synthetics: 40958 diff --git a/src/dev/typescript/projects.ts b/src/dev/typescript/projects.ts index a2e3d578205e4..6d9b372069b22 100644 --- a/src/dev/typescript/projects.ts +++ b/src/dev/typescript/projects.ts @@ -68,7 +68,7 @@ export const PROJECTS = [ name: 'fleet/cypress', }), - createProject('x-pack/plugins/uptime/e2e/tsconfig.json', { + createProject('x-pack/plugins/synthetics/e2e/tsconfig.json', { name: 'uptime/synthetics-e2e-tests', disableTypeCheck: true, }), diff --git a/src/plugins/controls/common/control_group/control_group_constants.ts b/src/plugins/controls/common/control_group/control_group_constants.ts index 467394614e12c..604e411279bad 100644 --- a/src/plugins/controls/common/control_group/control_group_constants.ts +++ b/src/plugins/controls/common/control_group/control_group_constants.ts @@ -6,21 +6,7 @@ * Side Public License, v 1. */ -import { ControlGroupInput } from '..'; import { ControlStyle, ControlWidth } from '../types'; export const DEFAULT_CONTROL_WIDTH: ControlWidth = 'auto'; export const DEFAULT_CONTROL_STYLE: ControlStyle = 'oneLine'; - -export const getDefaultControlGroupInput = (): Omit => ({ - panels: {}, - defaultControlWidth: DEFAULT_CONTROL_WIDTH, - controlStyle: DEFAULT_CONTROL_STYLE, - chainingSystem: 'HIERARCHICAL', - ignoreParentSettings: { - ignoreFilters: false, - ignoreQuery: false, - ignoreTimerange: false, - ignoreValidations: false, - }, -}); diff --git a/src/plugins/dashboard/common/embeddable/dashboard_control_group.ts b/src/plugins/controls/common/control_group/control_group_persistence.ts similarity index 65% rename from src/plugins/dashboard/common/embeddable/dashboard_control_group.ts rename to src/plugins/controls/common/control_group/control_group_persistence.ts index 908f50bbadd72..55a7ad4b5a854 100644 --- a/src/plugins/dashboard/common/embeddable/dashboard_control_group.ts +++ b/src/plugins/controls/common/control_group/control_group_persistence.ts @@ -7,12 +7,53 @@ */ import { SerializableRecord } from '@kbn/utility-types'; -import { ControlGroupInput, getDefaultControlGroupInput } from '@kbn/controls-plugin/common'; -import { RawControlGroupAttributes } from '../types'; +import deepEqual from 'fast-deep-equal'; -export const getDefaultDashboardControlGroupInput = getDefaultControlGroupInput; +import { pick } from 'lodash'; +import { ControlGroupInput } from '..'; +import { DEFAULT_CONTROL_STYLE, DEFAULT_CONTROL_WIDTH } from './control_group_constants'; +import { PersistableControlGroupInput, RawControlGroupAttributes } from './types'; -export const controlGroupInputToRawAttributes = ( +const safeJSONParse = (jsonString?: string): OutType | undefined => { + if (!jsonString && typeof jsonString !== 'string') return; + try { + return JSON.parse(jsonString) as OutType; + } catch { + return; + } +}; + +export const getDefaultControlGroupInput = (): Omit => ({ + panels: {}, + defaultControlWidth: DEFAULT_CONTROL_WIDTH, + controlStyle: DEFAULT_CONTROL_STYLE, + chainingSystem: 'HIERARCHICAL', + ignoreParentSettings: { + ignoreFilters: false, + ignoreQuery: false, + ignoreTimerange: false, + ignoreValidations: false, + }, +}); + +export const persistableControlGroupInputIsEqual = ( + a: PersistableControlGroupInput | undefined, + b: PersistableControlGroupInput | undefined +) => { + const defaultInput = getDefaultControlGroupInput(); + const inputA = { + ...defaultInput, + ...pick(a, ['panels', 'chainingSystem', 'controlStyle', 'ignoreParentSettings']), + }; + const inputB = { + ...defaultInput, + ...pick(b, ['panels', 'chainingSystem', 'controlStyle', 'ignoreParentSettings']), + }; + if (deepEqual(inputA, inputB)) return true; + return false; +}; + +export const controlGroupInputToRawControlGroupAttributes = ( controlGroupInput: Omit ): RawControlGroupAttributes => { return { @@ -23,16 +64,7 @@ export const controlGroupInputToRawAttributes = ( }; }; -const safeJSONParse = (jsonString?: string): OutType | undefined => { - if (!jsonString && typeof jsonString !== 'string') return; - try { - return JSON.parse(jsonString) as OutType; - } catch { - return; - } -}; - -export const rawAttributesToControlGroupInput = ( +export const rawControlGroupAttributesToControlGroupInput = ( rawControlGroupAttributes: RawControlGroupAttributes ): Omit | undefined => { const defaultControlGroupInput = getDefaultControlGroupInput(); @@ -50,7 +82,7 @@ export const rawAttributesToControlGroupInput = ( }; }; -export const rawAttributesToSerializable = ( +export const rawControlGroupAttributesToSerializable = ( rawControlGroupAttributes: Omit ): SerializableRecord => { const defaultControlGroupInput = getDefaultControlGroupInput(); @@ -62,7 +94,7 @@ export const rawAttributesToSerializable = ( }; }; -export const serializableToRawAttributes = ( +export const serializableToRawControlGroupAttributes = ( serializable: SerializableRecord ): Omit => { return { diff --git a/src/plugins/controls/common/control_group/types.ts b/src/plugins/controls/common/control_group/types.ts index 4bc5831649d08..9fbfc54b09a17 100644 --- a/src/plugins/controls/common/control_group/types.ts +++ b/src/plugins/controls/common/control_group/types.ts @@ -29,3 +29,36 @@ export interface ControlGroupInput extends EmbeddableInput, ControlInput { controlStyle: ControlStyle; panels: ControlsPanels; } + +// only parts of the Control Group Input should be persisted +export type PersistableControlGroupInput = Pick< + ControlGroupInput, + 'panels' | 'chainingSystem' | 'controlStyle' | 'ignoreParentSettings' +>; + +// panels are json stringified for storage in a saved object. +export type RawControlGroupAttributes = Omit< + PersistableControlGroupInput, + 'panels' | 'ignoreParentSettings' +> & { + ignoreParentSettingsJSON: string; + panelsJSON: string; +}; +export interface ControlGroupTelemetry { + total: number; + chaining_system: { + [key: string]: number; + }; + label_position: { + [key: string]: number; + }; + ignore_settings: { + [key: string]: number; + }; + by_type: { + [key: string]: { + total: number; + details: { [key: string]: number }; + }; + }; +} diff --git a/src/plugins/controls/common/index.ts b/src/plugins/controls/common/index.ts index ff2c39346f075..2956570f79189 100644 --- a/src/plugins/controls/common/index.ts +++ b/src/plugins/controls/common/index.ts @@ -7,14 +7,37 @@ */ export type { ControlWidth } from './types'; -export type { ControlPanelState, ControlsPanels, ControlGroupInput } from './control_group/types'; -export type { OptionsListEmbeddableInput } from './control_types/options_list/types'; -export type { RangeSliderEmbeddableInput } from './control_types/range_slider/types'; -export { CONTROL_GROUP_TYPE } from './control_group/types'; -export { OPTIONS_LIST_CONTROL } from './control_types/options_list/types'; -export { RANGE_SLIDER_CONTROL } from './control_types/range_slider/types'; - -export { getDefaultControlGroupInput } from './control_group/control_group_constants'; +// Control Group exports +export { + CONTROL_GROUP_TYPE, + type ControlPanelState, + type ControlsPanels, + type ControlGroupInput, + type ControlGroupTelemetry, + type RawControlGroupAttributes, + type PersistableControlGroupInput, +} from './control_group/types'; +export { + controlGroupInputToRawControlGroupAttributes, + rawControlGroupAttributesToControlGroupInput, + rawControlGroupAttributesToSerializable, + serializableToRawControlGroupAttributes, + persistableControlGroupInputIsEqual, + getDefaultControlGroupInput, +} from './control_group/control_group_persistence'; +export { + DEFAULT_CONTROL_WIDTH, + DEFAULT_CONTROL_STYLE, +} from './control_group/control_group_constants'; +// Control Type exports +export { + OPTIONS_LIST_CONTROL, + type OptionsListEmbeddableInput, +} from './control_types/options_list/types'; +export { + type RangeSliderEmbeddableInput, + RANGE_SLIDER_CONTROL, +} from './control_types/range_slider/types'; export { TIME_SLIDER_CONTROL } from './control_types/time_slider/types'; diff --git a/src/plugins/controls/public/control_group/editor/control_group_editor.tsx b/src/plugins/controls/public/control_group/editor/control_group_editor.tsx index 95e2066541b5f..8917769f6b151 100644 --- a/src/plugins/controls/public/control_group/editor/control_group_editor.tsx +++ b/src/plugins/controls/public/control_group/editor/control_group_editor.tsx @@ -44,10 +44,7 @@ import { ControlStyle, ControlWidth } from '../../types'; import { ParentIgnoreSettings } from '../..'; import { ControlsPanels } from '../types'; import { ControlGroupInput } from '..'; -import { - DEFAULT_CONTROL_WIDTH, - getDefaultControlGroupInput, -} from '../../../common/control_group/control_group_constants'; +import { DEFAULT_CONTROL_WIDTH, getDefaultControlGroupInput } from '../../../common'; interface EditControlGroupProps { initialInput: ControlGroupInput; diff --git a/src/plugins/controls/public/control_group/embeddable/control_group_container_factory.ts b/src/plugins/controls/public/control_group/embeddable/control_group_container_factory.ts index a8e31e6e2dbec..f55c49101dc40 100644 --- a/src/plugins/controls/public/control_group/embeddable/control_group_container_factory.ts +++ b/src/plugins/controls/public/control_group/embeddable/control_group_container_factory.ts @@ -23,7 +23,7 @@ import { createControlGroupExtract, createControlGroupInject, } from '../../../common/control_group/control_group_persistable_state'; -import { getDefaultControlGroupInput } from '../../../common/control_group/control_group_constants'; +import { getDefaultControlGroupInput } from '../../../common'; export class ControlGroupContainerFactory implements EmbeddableFactoryDefinition { public readonly isContainerType = true; diff --git a/src/plugins/controls/server/control_group/control_group_container_factory.ts b/src/plugins/controls/server/control_group/control_group_container_factory.ts index 806efd652db57..ba50652d3507a 100644 --- a/src/plugins/controls/server/control_group/control_group_container_factory.ts +++ b/src/plugins/controls/server/control_group/control_group_container_factory.ts @@ -14,6 +14,7 @@ import { createControlGroupInject, migrations, } from '../../common/control_group/control_group_persistable_state'; +import { controlGroupTelemetry } from './control_group_telemetry'; export const controlGroupContainerPersistableStateServiceFactory = ( persistableStateService: EmbeddablePersistableStateService @@ -22,6 +23,7 @@ export const controlGroupContainerPersistableStateServiceFactory = ( id: CONTROL_GROUP_TYPE, extract: createControlGroupExtract(persistableStateService), inject: createControlGroupInject(persistableStateService), + telemetry: controlGroupTelemetry, migrations, }; }; diff --git a/src/plugins/controls/server/control_group/control_group_telemetry.test.ts b/src/plugins/controls/server/control_group/control_group_telemetry.test.ts new file mode 100644 index 0000000000000..140b58fd790fc --- /dev/null +++ b/src/plugins/controls/server/control_group/control_group_telemetry.test.ts @@ -0,0 +1,142 @@ +/* + * Copyright 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 { ControlGroupTelemetry, RawControlGroupAttributes } from '../../common'; +import { controlGroupTelemetry, initializeControlGroupTelemetry } from './control_group_telemetry'; + +// controls attributes with all settings ignored + 3 options lists + hierarchical chaining + label above +const rawControlAttributes1: RawControlGroupAttributes = { + controlStyle: 'twoLine', + chainingSystem: 'NONE', + panelsJSON: + '{"6fc71ac6-62f9-4ff4-bf5a-d1e066065376":{"order":0,"width":"auto","type":"optionsListControl","explicitInput":{"title":"Carrier","fieldName":"Carrier","id":"6fc71ac6-62f9-4ff4-bf5a-d1e066065376","enhancements":{}}},"1ca90451-908b-4eae-ac4d-535f2e30c4ad":{"order":2,"width":"auto","type":"optionsListControl","explicitInput":{"title":"DestAirportID","fieldName":"DestAirportID","id":"1ca90451-908b-4eae-ac4d-535f2e30c4ad","enhancements":{}}},"71086bac-316d-415f-8aa8-b9a921bc7f58":{"order":1,"width":"auto","type":"optionsListControl","explicitInput":{"title":"DestRegion","fieldName":"DestRegion","id":"71086bac-316d-415f-8aa8-b9a921bc7f58","enhancements":{}}}}', + ignoreParentSettingsJSON: + '{"ignoreFilters":true,"ignoreQuery":true,"ignoreTimerange":true,"ignoreValidations":true}', +}; + +// controls attributes with some settings ignored + 2 range sliders, 1 time slider + No chaining + label inline +const rawControlAttributes2: RawControlGroupAttributes = { + controlStyle: 'oneLine', + chainingSystem: 'NONE', + panelsJSON: + '{"9cf90205-e94d-43c9-a3aa-45f359a7522f":{"order":0,"width":"auto","type":"rangeSliderControl","explicitInput":{"title":"DistanceKilometers","fieldName":"DistanceKilometers","id":"9cf90205-e94d-43c9-a3aa-45f359a7522f","enhancements":{}}},"b47916fd-fc03-4dcd-bef1-5c3b7a315723":{"order":1,"width":"auto","type":"timeSlider","explicitInput":{"title":"timestamp","fieldName":"timestamp","id":"b47916fd-fc03-4dcd-bef1-5c3b7a315723","enhancements":{}}},"f6b076c6-9ef5-483e-b08d-d313d60d4b8c":{"order":2,"width":"auto","type":"rangeSliderControl","explicitInput":{"title":"DistanceMiles","fieldName":"DistanceMiles","id":"f6b076c6-9ef5-483e-b08d-d313d60d4b8c","enhancements":{}}}}', + ignoreParentSettingsJSON: + '{"ignoreFilters":true,"ignoreQuery":false,"ignoreTimerange":false,"ignoreValidations":false}', +}; + +// controls attributes with no settings ignored + 2 options lists, 1 range slider, 1 time slider + hierarchical chaining + label inline +const rawControlAttributes3: RawControlGroupAttributes = { + controlStyle: 'oneLine', + chainingSystem: 'HIERARCHICAL', + panelsJSON: + '{"9cf90205-e94d-43c9-a3aa-45f359a7522f":{"order":0,"width":"auto","type":"rangeSliderControl","explicitInput":{"title":"DistanceKilometers","fieldName":"DistanceKilometers","id":"9cf90205-e94d-43c9-a3aa-45f359a7522f","enhancements":{}}},"b47916fd-fc03-4dcd-bef1-5c3b7a315723":{"order":1,"width":"auto","type":"timeSlider","explicitInput":{"title":"timestamp","fieldName":"timestamp","id":"b47916fd-fc03-4dcd-bef1-5c3b7a315723","enhancements":{}}},"ee325e9e-6ec1-41f9-953f-423d59850d44":{"order":2,"width":"auto","type":"optionsListControl","explicitInput":{"title":"Carrier","fieldName":"Carrier","id":"ee325e9e-6ec1-41f9-953f-423d59850d44","enhancements":{}}},"cb0f5fcd-9ad9-4d4a-b489-b75bd060399b":{"order":3,"width":"auto","type":"optionsListControl","explicitInput":{"title":"DestCityName","fieldName":"DestCityName","id":"cb0f5fcd-9ad9-4d4a-b489-b75bd060399b","enhancements":{}}}}', + ignoreParentSettingsJSON: + '{"ignoreFilters":false,"ignoreQuery":false,"ignoreTimerange":false,"ignoreValidations":false}', +}; + +describe('Initialize telemetry', () => { + test('initializes telemetry when given blank object', () => { + const initializedTelemetry = initializeControlGroupTelemetry({}); + expect(initializedTelemetry.total).toBe(0); + expect(initializedTelemetry.chaining_system).toEqual({}); + expect(initializedTelemetry.ignore_settings).toEqual({}); + expect(initializedTelemetry.by_type).toEqual({}); + }); + + test('initializes telemetry without overwriting any keys when given a partial telemetry object', () => { + const partialTelemetry: Partial = { + total: 77, + chaining_system: { TESTCHAIN: 10, OTHERCHAIN: 1 }, + by_type: { test1: { total: 10, details: {} } }, + }; + const initializedTelemetry = initializeControlGroupTelemetry(partialTelemetry); + expect(initializedTelemetry.total).toBe(77); + expect(initializedTelemetry.chaining_system).toEqual({ TESTCHAIN: 10, OTHERCHAIN: 1 }); + expect(initializedTelemetry.ignore_settings).toEqual({}); + expect(initializedTelemetry.by_type).toEqual({ test1: { total: 10, details: {} } }); + expect(initializedTelemetry.label_position).toEqual({}); + }); + + test('initiailizes telemetry without overwriting any keys when given a completed telemetry object', () => { + const partialTelemetry: Partial = { + total: 5, + chaining_system: { TESTCHAIN: 10, OTHERCHAIN: 1 }, + by_type: { test1: { total: 10, details: {} } }, + ignore_settings: { ignoreValidations: 12 }, + label_position: { inline: 10, above: 12 }, + }; + const initializedTelemetry = initializeControlGroupTelemetry(partialTelemetry); + expect(initializedTelemetry.total).toBe(5); + expect(initializedTelemetry.chaining_system).toEqual({ TESTCHAIN: 10, OTHERCHAIN: 1 }); + expect(initializedTelemetry.ignore_settings).toEqual({ ignoreValidations: 12 }); + expect(initializedTelemetry.by_type).toEqual({ test1: { total: 10, details: {} } }); + expect(initializedTelemetry.label_position).toEqual({ inline: 10, above: 12 }); + }); +}); + +describe('Control group telemetry function', () => { + let finalTelemetry: ControlGroupTelemetry; + + beforeAll(() => { + const allControlGroups = [rawControlAttributes1, rawControlAttributes2, rawControlAttributes3]; + + finalTelemetry = allControlGroups.reduce( + (telemetrySoFar, rawControlGroupAttributes) => { + return controlGroupTelemetry( + rawControlGroupAttributes, + telemetrySoFar + ) as ControlGroupTelemetry; + }, + {} as ControlGroupTelemetry + ); + }); + + test('counts all telemetry over multiple runs', () => { + expect(finalTelemetry.total).toBe(10); + }); + + test('counts control types over multiple runs.', () => { + expect(finalTelemetry.by_type).toEqual({ + optionsListControl: { + details: {}, + total: 5, + }, + rangeSliderControl: { + details: {}, + total: 3, + }, + timeSlider: { + details: {}, + total: 2, + }, + }); + }); + + test('collects ignore settings over multiple runs.', () => { + expect(finalTelemetry.ignore_settings).toEqual({ + ignoreFilters: 2, + ignoreQuery: 1, + ignoreTimerange: 1, + ignoreValidations: 1, + }); + }); + + test('counts various chaining systems over multiple runs.', () => { + expect(finalTelemetry.chaining_system).toEqual({ + HIERARCHICAL: 1, + NONE: 2, + }); + }); + + test('counts label positions over multiple runs.', () => { + expect(finalTelemetry.label_position).toEqual({ + oneLine: 2, + twoLine: 1, + }); + }); +}); diff --git a/src/plugins/controls/server/control_group/control_group_telemetry.ts b/src/plugins/controls/server/control_group/control_group_telemetry.ts new file mode 100644 index 0000000000000..83e363e081241 --- /dev/null +++ b/src/plugins/controls/server/control_group/control_group_telemetry.ts @@ -0,0 +1,122 @@ +/* + * Copyright 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 { set } from 'lodash'; +import { PersistableStateService } from '@kbn/kibana-utils-plugin/common'; +import { + ControlGroupTelemetry, + RawControlGroupAttributes, + rawControlGroupAttributesToControlGroupInput, +} from '../../common'; +import { ControlGroupInput } from '../../common/control_group/types'; + +export const initializeControlGroupTelemetry = ( + statsSoFar: Record +): ControlGroupTelemetry => { + return { + total: (statsSoFar?.total as number) ?? 0, + chaining_system: + (statsSoFar?.chaining_system as ControlGroupTelemetry['chaining_system']) ?? {}, + ignore_settings: + (statsSoFar?.ignore_settings as ControlGroupTelemetry['ignore_settings']) ?? {}, + label_position: (statsSoFar?.label_position as ControlGroupTelemetry['label_position']) ?? {}, + by_type: (statsSoFar?.by_type as ControlGroupTelemetry['by_type']) ?? {}, + }; +}; + +const reportChainingSystemInUse = ( + chainingSystemsStats: ControlGroupTelemetry['chaining_system'], + chainingSystem: ControlGroupInput['chainingSystem'] +): ControlGroupTelemetry['chaining_system'] => { + if (!chainingSystem) return chainingSystemsStats; + if (Boolean(chainingSystemsStats[chainingSystem])) { + chainingSystemsStats[chainingSystem]++; + } else { + chainingSystemsStats[chainingSystem] = 1; + } + return chainingSystemsStats; +}; + +const reportLabelPositionsInUse = ( + labelPositionStats: ControlGroupTelemetry['label_position'], + labelPosition: ControlGroupInput['controlStyle'] // controlStyle was renamed labelPosition +): ControlGroupTelemetry['label_position'] => { + if (!labelPosition) return labelPositionStats; + if (Boolean(labelPositionStats[labelPosition])) { + labelPositionStats[labelPosition]++; + } else { + labelPositionStats[labelPosition] = 1; + } + return labelPositionStats; +}; + +const reportIgnoreSettingsInUse = ( + settingsStats: ControlGroupTelemetry['ignore_settings'], + settings: ControlGroupInput['ignoreParentSettings'] +): ControlGroupTelemetry['ignore_settings'] => { + if (!settings) return settingsStats; + for (const [settingKey, settingValue] of Object.entries(settings)) { + if (settingValue) { + // only report ignore settings which are turned ON + const currentValueForSetting = settingsStats[settingKey] ?? 0; + set(settingsStats, settingKey, currentValueForSetting + 1); + } + } + return settingsStats; +}; + +const reportControlTypes = ( + controlTypeStats: ControlGroupTelemetry['by_type'], + panels: ControlGroupInput['panels'] +): ControlGroupTelemetry['by_type'] => { + for (const { type } of Object.values(panels)) { + const currentTypeCount = controlTypeStats[type]?.total ?? 0; + const currentTypeDetails = controlTypeStats[type]?.details ?? {}; + + // here if we need to start tracking details on specific control types, we can call embeddableService.telemetry + + set(controlTypeStats, `${type}.total`, currentTypeCount + 1); + set(controlTypeStats, `${type}.details`, currentTypeDetails); + } + return controlTypeStats; +}; + +export const controlGroupTelemetry: PersistableStateService['telemetry'] = ( + state, + stats +): ControlGroupTelemetry => { + const controlGroupStats = initializeControlGroupTelemetry(stats); + const controlGroupInput = rawControlGroupAttributesToControlGroupInput( + state as unknown as RawControlGroupAttributes + ); + if (!controlGroupInput) return controlGroupStats; + + controlGroupStats.total += Object.keys(controlGroupInput?.panels ?? {}).length; + + controlGroupStats.chaining_system = reportChainingSystemInUse( + controlGroupStats.chaining_system, + controlGroupInput.chainingSystem + ); + + controlGroupStats.label_position = reportLabelPositionsInUse( + controlGroupStats.label_position, + controlGroupInput.controlStyle + ); + + controlGroupStats.ignore_settings = reportIgnoreSettingsInUse( + controlGroupStats.ignore_settings, + controlGroupInput.ignoreParentSettings + ); + + controlGroupStats.by_type = reportControlTypes( + controlGroupStats.by_type, + controlGroupInput.panels + ); + + return controlGroupStats; +}; diff --git a/src/plugins/controls/server/index.ts b/src/plugins/controls/server/index.ts index 5928186715210..cec761ae80e20 100644 --- a/src/plugins/controls/server/index.ts +++ b/src/plugins/controls/server/index.ts @@ -9,3 +9,5 @@ import { ControlsPlugin } from './plugin'; export const plugin = () => new ControlsPlugin(); + +export { initializeControlGroupTelemetry } from './control_group/control_group_telemetry'; diff --git a/src/plugins/dashboard/common/embeddable/dashboard_container_persistable_state.ts b/src/plugins/dashboard/common/embeddable/dashboard_container_persistable_state.ts index cffe5c9b47042..5346932f7034c 100644 --- a/src/plugins/dashboard/common/embeddable/dashboard_container_persistable_state.ts +++ b/src/plugins/dashboard/common/embeddable/dashboard_container_persistable_state.ts @@ -12,12 +12,8 @@ import { EmbeddableStateWithType, } from '@kbn/embeddable-plugin/common'; import { SavedObjectReference } from '@kbn/core/types'; -import { CONTROL_GROUP_TYPE } from '@kbn/controls-plugin/common'; -import { - DashboardContainerControlGroupInput, - DashboardContainerStateWithType, - DashboardPanelState, -} from '../types'; +import { CONTROL_GROUP_TYPE, PersistableControlGroupInput } from '@kbn/controls-plugin/common'; +import { DashboardContainerStateWithType, DashboardPanelState } from '../types'; const getPanelStatePrefix = (state: DashboardPanelState) => `${state.explicitInput.id}:`; @@ -95,7 +91,7 @@ export const createInject = ( controlGroupReferences ); workingState.controlGroupInput = - injectedControlGroupState as unknown as DashboardContainerControlGroupInput; + injectedControlGroupState as unknown as PersistableControlGroupInput; } return workingState as EmbeddableStateWithType; @@ -160,7 +156,7 @@ export const createExtract = ( id: controlGroupId, }); workingState.controlGroupInput = - extractedControlGroupState as unknown as DashboardContainerControlGroupInput; + extractedControlGroupState as unknown as PersistableControlGroupInput; const prefixedControlGroupReferences = controlGroupReferences.map((reference) => ({ ...reference, name: `${controlGroupReferencePrefix}${reference.name}`, diff --git a/src/plugins/dashboard/common/index.ts b/src/plugins/dashboard/common/index.ts index e99fe82ffabda..73e01693977d9 100644 --- a/src/plugins/dashboard/common/index.ts +++ b/src/plugins/dashboard/common/index.ts @@ -28,11 +28,3 @@ export { migratePanelsTo730 } from './migrate_to_730_panels'; export const UI_SETTINGS = { ENABLE_LABS_UI: 'labs:dashboard:enable_ui', }; - -export { - controlGroupInputToRawAttributes, - getDefaultDashboardControlGroupInput, - rawAttributesToControlGroupInput, - rawAttributesToSerializable, - serializableToRawAttributes, -} from './embeddable/dashboard_control_group'; diff --git a/src/plugins/dashboard/common/saved_dashboard_references.ts b/src/plugins/dashboard/common/saved_dashboard_references.ts index 79339257d7c01..e3a3193dd85a1 100644 --- a/src/plugins/dashboard/common/saved_dashboard_references.ts +++ b/src/plugins/dashboard/common/saved_dashboard_references.ts @@ -9,11 +9,10 @@ import semverGt from 'semver/functions/gt'; import { SavedObjectAttributes, SavedObjectReference } from '@kbn/core/types'; import { EmbeddablePersistableStateService } from '@kbn/embeddable-plugin/common/types'; import { - DashboardContainerControlGroupInput, - DashboardContainerStateWithType, - DashboardPanelState, + PersistableControlGroupInput, RawControlGroupAttributes, -} from './types'; +} from '@kbn/controls-plugin/common'; +import { DashboardContainerStateWithType, DashboardPanelState } from './types'; import { convertPanelStateToSavedDashboardPanel, convertSavedDashboardPanelToPanelState, @@ -41,7 +40,7 @@ function dashboardAttributesToState(attributes: SavedObjectAttributes): { inputPanels = JSON.parse(attributes.panelsJSON) as SavedDashboardPanel[]; } - let controlGroupInput: DashboardContainerControlGroupInput | undefined; + let controlGroupInput: PersistableControlGroupInput | undefined; if (attributes.controlGroupInput) { const rawControlGroupInput = attributes.controlGroupInput as unknown as RawControlGroupAttributes; diff --git a/src/plugins/dashboard/common/types.ts b/src/plugins/dashboard/common/types.ts index 719df2fbe0be0..941f9437e54e6 100644 --- a/src/plugins/dashboard/common/types.ts +++ b/src/plugins/dashboard/common/types.ts @@ -12,7 +12,7 @@ import { PanelState, } from '@kbn/embeddable-plugin/common/types'; import { SavedObjectEmbeddableInput } from '@kbn/embeddable-plugin/common/lib/saved_object_embeddable'; -import { ControlGroupInput } from '@kbn/controls-plugin/common'; +import { PersistableControlGroupInput } from '@kbn/controls-plugin/common'; import { RawSavedDashboardPanelTo60, RawSavedDashboardPanel610, @@ -23,6 +23,7 @@ import { } from './bwc/types'; import { GridData } from './embeddable/types'; + export type PanelId = string; export type SavedObjectId = string; @@ -98,23 +99,9 @@ export type SavedDashboardPanel730ToLatest = Pick< // Making this interface because so much of the Container type from embeddable is tied up in public // Once that is all available from common, we should be able to move the dashboard_container type to our common as well -// dashboard only persists part of the Control Group Input -export type DashboardContainerControlGroupInput = Pick< - ControlGroupInput, - 'panels' | 'chainingSystem' | 'controlStyle' | 'ignoreParentSettings' ->; - -export type RawControlGroupAttributes = Omit< - DashboardContainerControlGroupInput, - 'panels' | 'ignoreParentSettings' -> & { - ignoreParentSettingsJSON: string; - panelsJSON: string; -}; - export interface DashboardContainerStateWithType extends EmbeddableStateWithType { panels: { [panelId: string]: DashboardPanelState; }; - controlGroupInput?: DashboardContainerControlGroupInput; + controlGroupInput?: PersistableControlGroupInput; } diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx index 7009ea72f06a4..1077cf71454f9 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx @@ -16,6 +16,7 @@ import { ControlGroupOutput, CONTROL_GROUP_TYPE, } from '@kbn/controls-plugin/public'; +import { getDefaultControlGroupInput } from '@kbn/controls-plugin/common'; import { DashboardContainerInput } from '../..'; import { DASHBOARD_CONTAINER_TYPE } from './dashboard_constants'; import type { DashboardContainer, DashboardContainerServices } from './dashboard_container'; @@ -31,8 +32,6 @@ import { createInject, } from '../../../common/embeddable/dashboard_container_persistable_state'; -import { getDefaultDashboardControlGroupInput } from '../../../common/embeddable/dashboard_control_group'; - export type DashboardContainerFactory = EmbeddableFactory< DashboardContainerInput, ContainerOutput, @@ -90,7 +89,7 @@ export class DashboardContainerFactoryDefinition const { filters, query, timeRange, viewMode, controlGroupInput, id } = initialInput; const controlGroup = await controlsGroupFactory?.create({ id: `control_group_${id ?? 'new_dashboard'}`, - ...getDefaultDashboardControlGroupInput(), + ...getDefaultControlGroupInput(), ...pickBy(controlGroupInput, identity), // undefined keys in initialInput should not overwrite defaults timeRange, viewMode, diff --git a/src/plugins/dashboard/public/application/lib/dashboard_control_group.ts b/src/plugins/dashboard/public/application/lib/dashboard_control_group.ts index 38b1b8eeb9fa1..83497babc2654 100644 --- a/src/plugins/dashboard/public/application/lib/dashboard_control_group.ts +++ b/src/plugins/dashboard/public/application/lib/dashboard_control_group.ts @@ -11,16 +11,19 @@ import deepEqual from 'fast-deep-equal'; import { compareFilters, COMPARE_ALL_OPTIONS, type Filter } from '@kbn/es-query'; import { debounceTime, distinctUntilChanged, distinctUntilKeyChanged } from 'rxjs/operators'; -import { pick } from 'lodash'; -import { ControlGroupContainer, ControlGroupInput } from '@kbn/controls-plugin/public'; -import { DashboardContainer, DashboardContainerControlGroupInput } from '..'; +import { + ControlGroupInput, + controlGroupInputToRawControlGroupAttributes, + getDefaultControlGroupInput, + persistableControlGroupInputIsEqual, + rawControlGroupAttributesToControlGroupInput, +} from '@kbn/controls-plugin/common'; +import { ControlGroupContainer } from '@kbn/controls-plugin/public'; + +import { DashboardContainer } from '..'; import { DashboardState } from '../../types'; import { DashboardContainerInput, DashboardSavedObject } from '../..'; -import { - controlGroupInputToRawAttributes, - getDefaultDashboardControlGroupInput, - rawAttributesToControlGroupInput, -} from '../../../common'; + interface DiffChecks { [key: string]: (a?: unknown, b?: unknown) => boolean; } @@ -45,7 +48,7 @@ export const syncDashboardControlGroup = async ({ const subscriptions = new Subscription(); const isControlGroupInputEqual = () => - controlGroupInputIsEqual( + persistableControlGroupInputIsEqual( controlGroup.getInput(), dashboardContainer.getInput().controlGroupInput ); @@ -122,7 +125,7 @@ export const syncDashboardControlGroup = async ({ .subscribe(() => { if (!isControlGroupInputEqual()) { if (!dashboardContainer.getInput().controlGroupInput) { - controlGroup.updateInput(getDefaultDashboardControlGroupInput()); + controlGroup.updateInput(getDefaultControlGroupInput()); return; } controlGroup.updateInput({ ...dashboardContainer.getInput().controlGroupInput }); @@ -152,39 +155,22 @@ export const syncDashboardControlGroup = async ({ }; }; -export const controlGroupInputIsEqual = ( - a: DashboardContainerControlGroupInput | undefined, - b: DashboardContainerControlGroupInput | undefined -) => { - const defaultInput = getDefaultDashboardControlGroupInput(); - const inputA = { - ...defaultInput, - ...pick(a, ['panels', 'chainingSystem', 'controlStyle', 'ignoreParentSettings']), - }; - const inputB = { - ...defaultInput, - ...pick(b, ['panels', 'chainingSystem', 'controlStyle', 'ignoreParentSettings']), - }; - if (deepEqual(inputA, inputB)) return true; - return false; -}; - export const serializeControlGroupToDashboardSavedObject = ( dashboardSavedObject: DashboardSavedObject, dashboardState: DashboardState ) => { // only save to saved object if control group is not default if ( - controlGroupInputIsEqual( + persistableControlGroupInputIsEqual( dashboardState.controlGroupInput, - getDefaultDashboardControlGroupInput() + getDefaultControlGroupInput() ) ) { dashboardSavedObject.controlGroupInput = undefined; return; } if (dashboardState.controlGroupInput) { - dashboardSavedObject.controlGroupInput = controlGroupInputToRawAttributes( + dashboardSavedObject.controlGroupInput = controlGroupInputToRawControlGroupAttributes( dashboardState.controlGroupInput ); } @@ -194,7 +180,7 @@ export const deserializeControlGroupFromDashboardSavedObject = ( dashboardSavedObject: DashboardSavedObject ): Omit | undefined => { if (!dashboardSavedObject.controlGroupInput) return; - return rawAttributesToControlGroupInput(dashboardSavedObject.controlGroupInput); + return rawControlGroupAttributesToControlGroupInput(dashboardSavedObject.controlGroupInput); }; export const combineDashboardFiltersWithControlGroupFilters = ( diff --git a/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts b/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts index 85a8bf54c9266..ec42e18bad858 100644 --- a/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts +++ b/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts @@ -10,8 +10,8 @@ import { xor, omit, isEmpty } from 'lodash'; import fastIsEqual from 'fast-deep-equal'; import { compareFilters, COMPARE_ALL_OPTIONS, type Filter, isFilterPinned } from '@kbn/es-query'; +import { persistableControlGroupInputIsEqual } from '@kbn/controls-plugin/common'; import { DashboardContainerInput } from '../..'; -import { controlGroupInputIsEqual } from './dashboard_control_group'; import { DashboardOptions, DashboardPanelMap, DashboardState } from '../../types'; import { IEmbeddable } from '../../services/embeddable'; @@ -84,7 +84,7 @@ export const diffDashboardState = async ({ ); const optionsAreEqual = getOptionsAreEqual(originalState.options, newState.options); const filtersAreEqual = getFiltersAreEqual(originalState.filters, newState.filters, true); - const controlGroupIsEqual = controlGroupInputIsEqual( + const controlGroupIsEqual = persistableControlGroupInputIsEqual( originalState.controlGroupInput, newState.controlGroupInput ); diff --git a/src/plugins/dashboard/public/application/state/dashboard_state_slice.ts b/src/plugins/dashboard/public/application/state/dashboard_state_slice.ts index ee403939a9e8c..35f9789023ec5 100644 --- a/src/plugins/dashboard/public/application/state/dashboard_state_slice.ts +++ b/src/plugins/dashboard/public/application/state/dashboard_state_slice.ts @@ -7,11 +7,11 @@ */ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { PersistableControlGroupInput } from '@kbn/controls-plugin/common'; import { Filter, Query, TimeRange } from '../../services/data'; import { ViewMode } from '../../services/embeddable'; import { DashboardOptions, DashboardPanelMap, DashboardState } from '../../types'; -import { DashboardContainerControlGroupInput } from '../embeddable'; export const dashboardStateSlice = createSlice({ name: 'dashboardState', @@ -44,7 +44,7 @@ export const dashboardStateSlice = createSlice({ }, setControlGroupState: ( state, - action: PayloadAction + action: PayloadAction ) => { state.controlGroupInput = action.payload; }, diff --git a/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts b/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts index 23aa9c493e5f4..cf79354719dbc 100644 --- a/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts +++ b/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts @@ -10,6 +10,7 @@ import { assign, cloneDeep } from 'lodash'; import { SavedObjectsClientContract } from '@kbn/core/public'; import type { ResolvedSimpleSavedObject } from '@kbn/core/public'; import { SavedObjectAttributes, SavedObjectReference } from '@kbn/core/types'; +import { RawControlGroupAttributes } from '@kbn/controls-plugin/common'; import { EmbeddableStart } from '../services/embeddable'; import { SavedObject, SavedObjectsStart } from '../services/saved_objects'; import { Filter, ISearchSource, Query, RefreshInterval } from '../services/data'; @@ -18,7 +19,6 @@ import { createDashboardEditUrl } from '../dashboard_constants'; import { extractReferences, injectReferences } from '../../common/saved_dashboard_references'; import { DashboardOptions } from '../types'; -import { RawControlGroupAttributes } from '../application'; export interface DashboardSavedObject extends SavedObject { id?: string; diff --git a/src/plugins/dashboard/public/types.ts b/src/plugins/dashboard/public/types.ts index 249f134239663..e250e44d5abce 100644 --- a/src/plugins/dashboard/public/types.ts +++ b/src/plugins/dashboard/public/types.ts @@ -23,6 +23,7 @@ import { BehaviorSubject, Subject } from 'rxjs'; import { UrlForwardingStart } from '@kbn/url-forwarding-plugin/public'; import { VisualizationsStart } from '@kbn/visualizations-plugin/public'; +import { PersistableControlGroupInput } from '@kbn/controls-plugin/common'; import { DataView } from './services/data_views'; import { SharePluginStart } from './services/share'; import { EmbeddableStart } from './services/embeddable'; @@ -30,11 +31,7 @@ import { DashboardSessionStorage } from './application/lib'; import { UsageCollectionSetup } from './services/usage_collection'; import { NavigationPublicPluginStart } from './services/navigation'; import { Query, RefreshInterval, TimeRange } from './services/data'; -import { - DashboardContainerControlGroupInput, - DashboardPanelState, - SavedDashboardPanel, -} from '../common/types'; +import { DashboardPanelState, SavedDashboardPanel } from '../common/types'; import { SavedObjectsTaggingApi } from './services/saved_objects_tagging_oss'; import { DataPublicPluginStart, DataViewsContract } from './services/data'; import { ContainerInput, EmbeddableInput, ViewMode } from './services/embeddable'; @@ -74,7 +71,7 @@ export interface DashboardState { panels: DashboardPanelMap; timeRange?: TimeRange; - controlGroupInput?: DashboardContainerControlGroupInput; + controlGroupInput?: PersistableControlGroupInput; } /** @@ -84,7 +81,7 @@ export type RawDashboardState = Omit & { panels: Saved export interface DashboardContainerInput extends ContainerInput { dashboardCapabilities?: DashboardAppCapabilities; - controlGroupInput?: DashboardContainerControlGroupInput; + controlGroupInput?: PersistableControlGroupInput; refreshConfig?: RefreshInterval; isEmbeddedExternally?: boolean; isFullScreenMode: boolean; diff --git a/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts b/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts index 603fa4af71db4..b3625bec3e8a9 100644 --- a/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts +++ b/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts @@ -22,16 +22,15 @@ import { MigrateFunction, MigrateFunctionsObject, } from '@kbn/kibana-utils-plugin/common'; -import { CONTROL_GROUP_TYPE } from '@kbn/controls-plugin/common'; +import { + CONTROL_GROUP_TYPE, + rawControlGroupAttributesToSerializable, + serializableToRawControlGroupAttributes, +} from '@kbn/controls-plugin/common'; import { migrations730 } from './migrations_730'; import { SavedDashboardPanel } from '../../common/types'; import { migrateMatchAllQuery } from './migrate_match_all_query'; -import { - serializableToRawAttributes, - DashboardDoc700To720, - DashboardDoc730ToLatest, - rawAttributesToSerializable, -} from '../../common'; +import { DashboardDoc700To720, DashboardDoc730ToLatest } from '../../common'; import { injectReferences, extractReferences } from '../../common/saved_dashboard_references'; import { convertPanelStateToSavedDashboardPanel, @@ -221,12 +220,15 @@ const migrateByValuePanels = const { attributes } = doc; if (attributes?.controlGroupInput) { - const controlGroupInput = rawAttributesToSerializable(attributes.controlGroupInput); + const controlGroupInput = rawControlGroupAttributesToSerializable( + attributes.controlGroupInput + ); const migratedControlGroupInput = migrate({ ...controlGroupInput, type: CONTROL_GROUP_TYPE, }); - attributes.controlGroupInput = serializableToRawAttributes(migratedControlGroupInput); + attributes.controlGroupInput = + serializableToRawControlGroupAttributes(migratedControlGroupInput); } // Skip if panelsJSON is missing otherwise this will cause saved object import to fail when diff --git a/src/plugins/dashboard/server/usage/dashboard_telemetry.ts b/src/plugins/dashboard/server/usage/dashboard_telemetry.ts index 9f0c5e19fcd0e..dcb2ad9ba37eb 100644 --- a/src/plugins/dashboard/server/usage/dashboard_telemetry.ts +++ b/src/plugins/dashboard/server/usage/dashboard_telemetry.ts @@ -6,8 +6,16 @@ * Side Public License, v 1. */ +import { isEmpty } from 'lodash'; import { ISavedObjectsRepository, SavedObjectAttributes } from '@kbn/core/server'; import { EmbeddablePersistableStateService } from '@kbn/embeddable-plugin/common'; +import { + type ControlGroupTelemetry, + CONTROL_GROUP_TYPE, + RawControlGroupAttributes, +} from '@kbn/controls-plugin/common'; +import { initializeControlGroupTelemetry } from '@kbn/controls-plugin/server'; + import { SavedDashboardPanel730ToLatest } from '../../common'; import { injectReferences } from '../../common/saved_dashboard_references'; export interface DashboardCollectorData { @@ -26,6 +34,7 @@ export interface DashboardCollectorData { }; }; }; + controls: ControlGroupTelemetry; } export const getEmptyDashboardData = (): DashboardCollectorData => ({ @@ -35,6 +44,7 @@ export const getEmptyDashboardData = (): DashboardCollectorData => ({ by_value: 0, by_type: {}, }, + controls: initializeControlGroupTelemetry({}), }); export const getEmptyPanelTypeData = () => ({ @@ -92,6 +102,19 @@ export async function collectDashboardTelemetry( embeddablePersistableStateService: embeddableService, }); + const controlGroupAttributes: RawControlGroupAttributes | undefined = + attributes.controlGroupInput as unknown as RawControlGroupAttributes; + if (!isEmpty(controlGroupAttributes)) { + collectorData.controls = embeddableService.telemetry( + { + ...controlGroupAttributes, + type: CONTROL_GROUP_TYPE, + id: `DASHBOARD_${CONTROL_GROUP_TYPE}`, + }, + collectorData.controls + ) as ControlGroupTelemetry; + } + const panels = JSON.parse( attributes.panelsJSON as string ) as unknown as SavedDashboardPanel730ToLatest[]; diff --git a/src/plugins/dashboard/server/usage/register_collector.ts b/src/plugins/dashboard/server/usage/register_collector.ts index 7c77dd1473d85..9a7bcd31f8a84 100644 --- a/src/plugins/dashboard/server/usage/register_collector.ts +++ b/src/plugins/dashboard/server/usage/register_collector.ts @@ -60,6 +60,55 @@ export function registerDashboardUsageCollector( }, }, }, + controls: { + total: { type: 'long' }, + by_type: { + DYNAMIC_KEY: { + total: { + type: 'long', + _meta: { + description: 'The number of this type of control in all Control Groups', + }, + }, + details: { + DYNAMIC_KEY: { + type: 'long', + _meta: { + description: + 'Collection of telemetry metrics that embeddable service reports. Will be used for details which are specific to the current control type', + }, + }, + }, + }, + }, + ignore_settings: { + DYNAMIC_KEY: { + type: 'long', + _meta: { + description: + 'Collection of telemetry metrics that count the number of control groups which have this ignore setting turned on', + }, + }, + }, + chaining_system: { + DYNAMIC_KEY: { + type: 'long', + _meta: { + description: + 'Collection of telemetry metrics that count the number of control groups which are using this chaining system', + }, + }, + }, + label_position: { + DYNAMIC_KEY: { + type: 'long', + _meta: { + description: + 'Collection of telemetry metrics that count the number of control groups which have their labels in this position', + }, + }, + }, + }, }, }); diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 7e8e570993102..ca9a57bb4462a 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -50,6 +50,67 @@ } } } + }, + "controls": { + "properties": { + "total": { + "type": "long" + }, + "by_type": { + "properties": { + "DYNAMIC_KEY": { + "properties": { + "total": { + "type": "long", + "_meta": { + "description": "The number of this type of control in all Control Groups" + } + }, + "details": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "Collection of telemetry metrics that embeddable service reports. Will be used for details which are specific to the current control type" + } + } + } + } + } + } + } + }, + "ignore_settings": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "Collection of telemetry metrics that count the number of control groups which have this ignore setting turned on" + } + } + } + }, + "chaining_system": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "Collection of telemetry metrics that count the number of control groups which are using this chaining system" + } + } + } + }, + "label_position": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "Collection of telemetry metrics that count the number of control groups which have their labels in this position" + } + } + } + } + } } } }, diff --git a/test/examples/bfetch_explorer/index.ts b/test/examples/bfetch_explorer/index.ts index e5b4789bf9178..247cef07a487e 100644 --- a/test/examples/bfetch_explorer/index.ts +++ b/test/examples/bfetch_explorer/index.ts @@ -14,7 +14,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid const PageObjects = getPageObjects(['common', 'header']); describe('bfetch explorer', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('bfetch-explorer', { insertTimestamp: false }); diff --git a/test/examples/data_view_field_editor_example/index.ts b/test/examples/data_view_field_editor_example/index.ts index f24eb0feddbc8..0f8517cb3ed29 100644 --- a/test/examples/data_view_field_editor_example/index.ts +++ b/test/examples/data_view_field_editor_example/index.ts @@ -20,7 +20,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header', 'settings']); describe('data view field editor example', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); before(async () => { await esArchiver.emptyKibanaIndex(); await browser.setWindowSize(1300, 900); diff --git a/test/examples/embeddables/index.ts b/test/examples/embeddables/index.ts index 9a3b07aab51dc..364c4001383a7 100644 --- a/test/examples/embeddables/index.ts +++ b/test/examples/embeddables/index.ts @@ -18,7 +18,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header']); describe('embeddable explorer', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('embeddableExplorer'); diff --git a/test/examples/expressions_explorer/index.ts b/test/examples/expressions_explorer/index.ts index ec826f66d8e27..34f3c77cb0d3e 100644 --- a/test/examples/expressions_explorer/index.ts +++ b/test/examples/expressions_explorer/index.ts @@ -18,7 +18,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header']); describe('expressions explorer', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('expressionsExplorer'); diff --git a/test/examples/field_formats/index.ts b/test/examples/field_formats/index.ts index cafa84f862eaa..f9692c910fda0 100644 --- a/test/examples/field_formats/index.ts +++ b/test/examples/field_formats/index.ts @@ -16,7 +16,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Field formats example', function () { before(async () => { - this.tags('ciGroup2'); + this.tags('ciGroup11'); await PageObjects.common.navigateToApp('fieldFormatsExample'); }); diff --git a/test/examples/hello_world/index.ts b/test/examples/hello_world/index.ts index 3215c92666b27..1ffb7ff6d69af 100644 --- a/test/examples/hello_world/index.ts +++ b/test/examples/hello_world/index.ts @@ -17,7 +17,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid describe('Hello world', function () { before(async () => { - this.tags('ciGroup2'); + this.tags('ciGroup11'); await PageObjects.common.navigateToApp('helloWorld'); }); diff --git a/test/examples/partial_results/index.ts b/test/examples/partial_results/index.ts index 62d40652b4db5..84ccff4cd35b7 100644 --- a/test/examples/partial_results/index.ts +++ b/test/examples/partial_results/index.ts @@ -16,7 +16,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Partial Results Example', function () { before(async () => { - this.tags('ciGroup2'); + this.tags('ciGroup11'); await PageObjects.common.navigateToApp('partialResultsExample'); const element = await testSubjects.find('example-help'); diff --git a/test/examples/routing/index.ts b/test/examples/routing/index.ts index 4c42931e267f1..949d8cfc7547a 100644 --- a/test/examples/routing/index.ts +++ b/test/examples/routing/index.ts @@ -17,7 +17,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid describe('routing examples', function () { before(async () => { - this.tags('ciGroup2'); + this.tags('ciGroup11'); await PageObjects.common.navigateToApp('routingExample'); }); diff --git a/test/examples/state_sync/index.ts b/test/examples/state_sync/index.ts index d48f4d4d8ae64..a33c014f4dd9d 100644 --- a/test/examples/state_sync/index.ts +++ b/test/examples/state_sync/index.ts @@ -17,7 +17,7 @@ export default function ({ const browser = getService('browser'); describe('state sync examples', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); before(async () => { await browser.setWindowSize(1300, 900); }); diff --git a/test/examples/ui_actions/index.ts b/test/examples/ui_actions/index.ts index 9c4dbaee9b860..b04d361cc86ec 100644 --- a/test/examples/ui_actions/index.ts +++ b/test/examples/ui_actions/index.ts @@ -18,7 +18,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header']); describe('ui actions explorer', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('uiActionsExplorer'); diff --git a/test/functional/apps/dashboard/index.ts b/test/functional/apps/dashboard/index.ts index c9a62447f223a..4f69504ef7d5c 100644 --- a/test/functional/apps/dashboard/index.ts +++ b/test/functional/apps/dashboard/index.ts @@ -115,7 +115,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { // TODO: Remove when vislib is removed // https://github.com/elastic/kibana/issues/56143 describe('new charts library', function () { - this.tags('ciGroup6'); + this.tags('ciGroup5'); before(async () => { await loadLogstash(); diff --git a/test/functional/apps/discover/_discover.ts b/test/functional/apps/discover/_discover.ts index 03a8dbcffa2d9..88df8f7798ba8 100644 --- a/test/functional/apps/discover/_discover.ts +++ b/test/functional/apps/discover/_discover.ts @@ -25,7 +25,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { defaultIndex: 'logstash-*', }; - describe('discover test', function describeIndexTests() { + // FLAKY: https://github.com/elastic/kibana/issues/130694 + describe.skip('discover test', function describeIndexTests() { before(async function () { log.debug('load kibana index with default index pattern'); await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); diff --git a/test/functional/apps/getting_started/index.ts b/test/functional/apps/getting_started/index.ts index ae7fdc3c1d4fa..c88999e23be3d 100644 --- a/test/functional/apps/getting_started/index.ts +++ b/test/functional/apps/getting_started/index.ts @@ -13,7 +13,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); describe('Getting Started ', function () { - this.tags(['ciGroup6']); + this.tags(['ciGroup5']); before(async function () { await browser.setWindowSize(1200, 800); diff --git a/test/functional/apps/home/index.js b/test/functional/apps/home/index.js index 257ee724f6c8b..992c5b1f2f474 100644 --- a/test/functional/apps/home/index.js +++ b/test/functional/apps/home/index.js @@ -10,7 +10,7 @@ export default function ({ getService, loadTestFile }) { const browser = getService('browser'); describe('homepage app', function () { - this.tags('ciGroup6'); + this.tags('ciGroup5'); before(function () { return browser.setWindowSize(1200, 800); diff --git a/test/interactive_setup_api_integration/tests/enrollment_flow.ts b/test/interactive_setup_api_integration/tests/enrollment_flow.ts index 53454207b73ed..f35509f49480a 100644 --- a/test/interactive_setup_api_integration/tests/enrollment_flow.ts +++ b/test/interactive_setup_api_integration/tests/enrollment_flow.ts @@ -20,7 +20,7 @@ export default function (context: FtrProviderContext) { const config = context.getService('config'); describe('Interactive setup APIs - Enrollment flow', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); let kibanaVerificationCode: string; let elasticsearchCaFingerprint: string; diff --git a/test/interactive_setup_api_integration/tests/manual_configuration_flow.ts b/test/interactive_setup_api_integration/tests/manual_configuration_flow.ts index 2db59dd446fc4..94a06363367ad 100644 --- a/test/interactive_setup_api_integration/tests/manual_configuration_flow.ts +++ b/test/interactive_setup_api_integration/tests/manual_configuration_flow.ts @@ -19,7 +19,7 @@ export default function (context: FtrProviderContext) { const config = context.getService('config'); describe('Interactive setup APIs - Manual configuration flow', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); let kibanaVerificationCode: string; let elasticsearchCaCertificate: string; diff --git a/test/interactive_setup_api_integration/tests/manual_configuration_flow_without_tls.ts b/test/interactive_setup_api_integration/tests/manual_configuration_flow_without_tls.ts index 97a3e490e9650..a3964c5fd5aa6 100644 --- a/test/interactive_setup_api_integration/tests/manual_configuration_flow_without_tls.ts +++ b/test/interactive_setup_api_integration/tests/manual_configuration_flow_without_tls.ts @@ -18,7 +18,7 @@ export default function (context: FtrProviderContext) { const config = context.getService('config'); describe('Interactive setup APIs - Manual configuration flow without TLS', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); let kibanaVerificationCode: string; before(async () => { diff --git a/test/interactive_setup_functional/tests/enrollment_token.ts b/test/interactive_setup_functional/tests/enrollment_token.ts index 56311c9458cef..20d9da6539692 100644 --- a/test/interactive_setup_functional/tests/enrollment_token.ts +++ b/test/interactive_setup_functional/tests/enrollment_token.ts @@ -22,7 +22,7 @@ export default function ({ getService }: FtrProviderContext) { const log = getService('log'); describe('Interactive Setup Functional Tests (Enrollment token)', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); const elasticsearchConfig = config.get('servers.elasticsearch'); let verificationCode: string; diff --git a/test/interactive_setup_functional/tests/manual_configuration.ts b/test/interactive_setup_functional/tests/manual_configuration.ts index 3c7c5d9c08d76..68c5068acd267 100644 --- a/test/interactive_setup_functional/tests/manual_configuration.ts +++ b/test/interactive_setup_functional/tests/manual_configuration.ts @@ -19,7 +19,7 @@ export default function ({ getService }: FtrProviderContext) { const log = getService('log'); describe('Interactive Setup Functional Tests (Manual configuration)', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); let verificationCode: string; before(async function () { diff --git a/test/interactive_setup_functional/tests/manual_configuration_without_security.ts b/test/interactive_setup_functional/tests/manual_configuration_without_security.ts index 2111dc3cce7e7..20f7bac890da4 100644 --- a/test/interactive_setup_functional/tests/manual_configuration_without_security.ts +++ b/test/interactive_setup_functional/tests/manual_configuration_without_security.ts @@ -19,7 +19,7 @@ export default function ({ getService, getPageObject }: FtrProviderContext) { const log = getService('log'); describe('Interactive Setup Functional Tests (Manual configuration without Security)', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); let verificationCode: string; before(async function () { diff --git a/test/interactive_setup_functional/tests/manual_configuration_without_tls.ts b/test/interactive_setup_functional/tests/manual_configuration_without_tls.ts index b8e391dc6f93f..04e31b4ae8454 100644 --- a/test/interactive_setup_functional/tests/manual_configuration_without_tls.ts +++ b/test/interactive_setup_functional/tests/manual_configuration_without_tls.ts @@ -19,7 +19,7 @@ export default function ({ getService }: FtrProviderContext) { const log = getService('log'); describe('Interactive Setup Functional Tests (Manual configuration without TLS)', function () { - this.tags(['skipCloud', 'ciGroup2']); + this.tags(['skipCloud', 'ciGroup11']); let verificationCode: string; before(async function () { diff --git a/test/new_visualize_flow/index.ts b/test/new_visualize_flow/index.ts index 02245002e8336..7cb55069d7d9b 100644 --- a/test/new_visualize_flow/index.ts +++ b/test/new_visualize_flow/index.ts @@ -11,7 +11,7 @@ import { FtrProviderContext } from '../functional/ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default function ({ loadTestFile, getService }: FtrProviderContext) { describe('New Visualize Flow', function () { - this.tags('ciGroup2'); + this.tags('ciGroup11'); const esArchiver = getService('esArchiver'); before(async () => { await esArchiver.loadIfNeeded( diff --git a/test/package/Vagrantfile b/test/package/Vagrantfile index 6a094e013c341..2a7e465531333 100644 --- a/test/package/Vagrantfile +++ b/test/package/Vagrantfile @@ -1,6 +1,6 @@ Vagrant.configure("2") do |config| config.vm.synced_folder '../../target/', '/packages' - + config.vm.boot_timeout = 600 config.vm.define "deb" do |deb| deb.vm.provider :virtualbox do |vb| vb.memory = 2048 diff --git a/test/ui_capabilities/newsfeed_err/test.ts b/test/ui_capabilities/newsfeed_err/test.ts index 2c0c9e60c6995..52c1c0644299a 100644 --- a/test/ui_capabilities/newsfeed_err/test.ts +++ b/test/ui_capabilities/newsfeed_err/test.ts @@ -15,7 +15,7 @@ export default function uiCapabilitiesTests({ getService, getPageObjects }: FtrP const PageObjects = getPageObjects(['common', 'newsfeed']); describe('Newsfeed icon button handle errors', function () { - this.tags('ciGroup6'); + this.tags('ciGroup5'); before(async () => { await PageObjects.newsfeed.resetPage(); diff --git a/test/visual_regression/tests/discover/index.ts b/test/visual_regression/tests/discover/index.ts index 3f82f5405972e..fe634c02400a4 100644 --- a/test/visual_regression/tests/discover/index.ts +++ b/test/visual_regression/tests/discover/index.ts @@ -16,7 +16,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const browser = getService('browser'); describe('discover app', function () { - this.tags('ciGroup6'); + this.tags('ciGroup5'); before(function () { return browser.setWindowSize(SCREEN_WIDTH, 1000); diff --git a/test/visual_regression/tests/vega/index.ts b/test/visual_regression/tests/vega/index.ts index c6b4cbd2d01b5..71f22a3058d91 100644 --- a/test/visual_regression/tests/vega/index.ts +++ b/test/visual_regression/tests/vega/index.ts @@ -16,7 +16,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const browser = getService('browser'); describe('vega app', function () { - this.tags('ciGroup6'); + this.tags('ciGroup5'); before(function () { return browser.setWindowSize(SCREEN_WIDTH, 1000); diff --git a/tsconfig.base.json b/tsconfig.base.json index b8dfc58796297..ac35847201b7f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -389,6 +389,8 @@ "@kbn/spaces-plugin/*": ["x-pack/plugins/spaces/*"], "@kbn/stack-alerts-plugin": ["x-pack/plugins/stack_alerts"], "@kbn/stack-alerts-plugin/*": ["x-pack/plugins/stack_alerts/*"], + "@kbn/synthetics-plugin": ["x-pack/plugins/synthetics"], + "@kbn/synthetics-plugin/*": ["x-pack/plugins/synthetics/*"], "@kbn/task-manager-plugin": ["x-pack/plugins/task_manager"], "@kbn/task-manager-plugin/*": ["x-pack/plugins/task_manager/*"], "@kbn/telemetry-collection-xpack-plugin": ["x-pack/plugins/telemetry_collection_xpack"], @@ -405,8 +407,6 @@ "@kbn/ui-actions-enhanced-plugin/*": ["x-pack/plugins/ui_actions_enhanced/*"], "@kbn/upgrade-assistant-plugin": ["x-pack/plugins/upgrade_assistant"], "@kbn/upgrade-assistant-plugin/*": ["x-pack/plugins/upgrade_assistant/*"], - "@kbn/uptime-plugin": ["x-pack/plugins/uptime"], - "@kbn/uptime-plugin/*": ["x-pack/plugins/uptime/*"], "@kbn/ux-plugin": ["x-pack/plugins/ux"], "@kbn/ux-plugin/*": ["x-pack/plugins/ux/*"], "@kbn/watcher-plugin": ["x-pack/plugins/watcher"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 3960cdd76a761..f72f8d135ff3d 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -60,7 +60,7 @@ "xpack.transform": "plugins/transform", "xpack.triggersActionsUI": "plugins/triggers_actions_ui", "xpack.upgradeAssistant": "plugins/upgrade_assistant", - "xpack.uptime": ["plugins/uptime"], + "xpack.uptime": ["plugins/synthetics"], "xpack.ux": ["plugins/ux"], "xpack.urlDrilldown": "plugins/drilldowns/url_drilldown", "xpack.watcher": "plugins/watcher", diff --git a/x-pack/plugins/cloud/public/plugin.tsx b/x-pack/plugins/cloud/public/plugin.tsx index 2aaf9549e9a22..bffc1d9496422 100644 --- a/x-pack/plugins/cloud/public/plugin.tsx +++ b/x-pack/plugins/cloud/public/plugin.tsx @@ -93,7 +93,7 @@ interface SetupFullStoryDeps { interface SetupTelemetryContextDeps extends CloudSetupDependencies { analytics: AnalyticsServiceSetup; executionContextPromise: Promise; - esOrgId?: string; + cloudId?: string; } interface SetupChatDeps extends Pick { @@ -120,7 +120,7 @@ export class CloudPlugin implements Plugin { analytics: core.analytics, security, executionContextPromise, - esOrgId: this.config.id, + cloudId: this.config.id, }).catch((e) => { // eslint-disable-next-line no-console console.debug(`Error setting up TelemetryContext: ${e.toString()}`); @@ -278,7 +278,7 @@ export class CloudPlugin implements Plugin { analytics, security, executionContextPromise, - esOrgId, + cloudId, }: SetupTelemetryContextDeps) { // Some context providers can be moved to other places for better domain isolation. // Let's use https://github.com/elastic/kibana/issues/125690 for that purpose. @@ -290,11 +290,11 @@ export class CloudPlugin implements Plugin { analytics.registerContextProvider({ name: 'cloud_org_id', - context$: of({ esOrgId }), + context$: of({ cloudId }), schema: { - esOrgId: { + cloudId: { type: 'keyword', - _meta: { description: 'The Cloud Organization ID', optional: true }, + _meta: { description: 'The Cloud ID', optional: true }, }, }, }); @@ -310,7 +310,7 @@ export class CloudPlugin implements Plugin { const { sha256 } = await import('js-sha256'); // Join the cloud org id and the user to create a truly unique user id. // The hashing here is to keep it at clear as possible in our source code that we do not send literal user IDs - return { userId: sha256(esOrgId ? `${esOrgId}:${userId}` : `${userId}`) }; + return { userId: sha256(cloudId ? `${cloudId}:${userId}` : `${userId}`) }; }) ), schema: { diff --git a/x-pack/plugins/cloud_security_posture/public/common/hooks/use_navigate_findings.ts b/x-pack/plugins/cloud_security_posture/public/common/hooks/use_navigate_findings.ts index 6cc1582d7ff7b..b5ce12095f99a 100644 --- a/x-pack/plugins/cloud_security_posture/public/common/hooks/use_navigate_findings.ts +++ b/x-pack/plugins/cloud_security_posture/public/common/hooks/use_navigate_findings.ts @@ -9,9 +9,9 @@ import { useHistory } from 'react-router-dom'; import { Query } from '@kbn/es-query'; import { allNavigationItems } from '../navigation/constants'; import { encodeQuery } from '../navigation/query_utils'; -import { CspFindingsRequest } from '../../pages/findings/use_findings'; +import { FindingsBaseURLQuery } from '../../pages/findings/types'; -const getFindingsQuery = (queryValue: Query['query']): Pick => { +const getFindingsQuery = (queryValue: Query['query']): Pick => { const query = typeof queryValue === 'string' ? queryValue diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_by_resource_table.test.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_by_resource_table.test.tsx new file mode 100644 index 0000000000000..3018de31aeb58 --- /dev/null +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_by_resource_table.test.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 { render, screen, within } from '@testing-library/react'; +import * as TEST_SUBJECTS from './test_subjects'; +import { FindingsByResourceTable, formatNumber, getResourceId } from './findings_by_resource_table'; +import * as TEXT from './translations'; +import type { PropsOf } from '@elastic/eui'; +import Chance from 'chance'; +import numeral from '@elastic/numeral'; + +const chance = new Chance(); + +const getFakeFindingsByResource = () => ({ + resource_id: chance.guid(), + cluster_id: chance.guid(), + cis_section: chance.word(), + failed_findings: { + total: chance.integer(), + normalized: chance.integer({ min: 0, max: 1 }), + }, +}); + +type TableProps = PropsOf; + +describe('', () => { + it('renders the zero state when status success and data has a length of zero ', async () => { + const props: TableProps = { + loading: false, + data: { page: [] }, + error: null, + }; + + render(); + + expect(screen.getByText(TEXT.NO_FINDINGS)).toBeInTheDocument(); + }); + + it('renders the table with provided items', () => { + const data = Array.from({ length: 10 }, getFakeFindingsByResource); + + const props: TableProps = { + loading: false, + data: { page: data }, + error: null, + }; + + render(); + + data.forEach((item, i) => { + const row = screen.getByTestId( + TEST_SUBJECTS.getFindingsByResourceTableRowTestId(getResourceId(item)) + ); + expect(row).toBeInTheDocument(); + expect(within(row).getByText(item.resource_id)).toBeInTheDocument(); + expect(within(row).getByText(item.cluster_id)).toBeInTheDocument(); + expect(within(row).getByText(item.cis_section)).toBeInTheDocument(); + expect(within(row).getByText(formatNumber(item.failed_findings.total))).toBeInTheDocument(); + expect( + within(row).getByText(new RegExp(numeral(item.failed_findings.normalized).format('0%'))) + ).toBeInTheDocument(); + }); + }); +}); diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_by_resource_table.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_by_resource_table.tsx new file mode 100644 index 0000000000000..d2acee177686a --- /dev/null +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_by_resource_table.tsx @@ -0,0 +1,109 @@ +/* + * Copyright 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 { + EuiTableFieldDataColumnType, + EuiEmptyPrompt, + EuiBasicTable, + EuiTextColor, + EuiFlexGroup, + EuiFlexItem, + EuiLink, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; +import numeral from '@elastic/numeral'; +import { extractErrorMessage } from '../../../common/utils/helpers'; +import * as TEST_SUBJECTS from './test_subjects'; +import * as TEXT from './translations'; +import type { CspFindingsByResourceResult } from './use_findings_by_resource'; + +export const formatNumber = (value: number) => + value < 1000 ? value : numeral(value).format('0.0a'); + +type FindingsGroupByResourceProps = CspFindingsByResourceResult; +type CspFindingsByResource = NonNullable['page'][number]; + +export const getResourceId = (resource: CspFindingsByResource) => + [resource.resource_id, resource.cluster_id, resource.cis_section].join('/'); + +const FindingsByResourceTableComponent = ({ + error, + data, + loading, +}: FindingsGroupByResourceProps) => { + const getRowProps = (row: CspFindingsByResource) => ({ + 'data-test-subj': TEST_SUBJECTS.getFindingsByResourceTableRowTestId(getResourceId(row)), + }); + + if (!loading && !data?.page.length) + return {TEXT.NO_FINDINGS}} />; + + return ( + + ); +}; + +const columns: Array> = [ + { + field: 'resource_id', + name: ( + + ), + render: (resourceId: CspFindingsByResource['resource_id']) => {resourceId}, + }, + { + field: 'cis_section', + truncateText: true, + name: ( + + ), + }, + { + field: 'cluster_id', + truncateText: true, + name: ( + + ), + }, + { + field: 'failed_findings', + truncateText: true, + name: ( + + ), + render: (failedFindings: CspFindingsByResource['failed_findings']) => ( + + + {formatNumber(failedFindings.total)} + + + ({numeral(failedFindings.normalized).format('0%')}) + + + ), + }, +]; + +export const FindingsByResourceTable = React.memo(FindingsByResourceTableComponent); diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_container.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_container.tsx index e41a4be639d20..213592d50e069 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_container.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_container.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import React, { useEffect, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { EuiComboBoxOptionOption, EuiSpacer, EuiTitle, useEuiTheme } from '@elastic/eui'; import { css } from '@emotion/react'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -16,20 +16,18 @@ import { FindingsTable } from './findings_table'; import { FindingsSearchBar } from './findings_search_bar'; import * as TEST_SUBJECTS from './test_subjects'; import { useUrlQuery } from '../../common/hooks/use_url_query'; -import { useFindings, type CspFindingsRequest } from './use_findings'; +import { useFindings } from './use_findings'; +import type { FindingsGroupByNoneQuery } from './use_findings'; +import type { FindingsBaseURLQuery } from './types'; +import { useFindingsByResource } from './use_findings_by_resource'; import { FindingsGroupBySelector } from './findings_group_by_selector'; import { INTERNAL_FEATURE_FLAGS } from '../../../common/constants'; import { useFindingsCounter } from './use_findings_count'; import { FindingsDistributionBar } from './findings_distribution_bar'; -import type { CspClientPluginStartDeps } from '../../types'; -import { useKibana } from '../../common/hooks/use_kibana'; -import * as TEXT from './translations'; - -export type GroupBy = 'none' | 'resourceType'; -export type FindingsBaseQuery = ReturnType; +import { FindingsByResourceTable } from './findings_by_resource_table'; // TODO: define this as a schema with default values -export const getDefaultQuery = (): CspFindingsRequest & { groupBy: GroupBy } => ({ +export const getDefaultQuery = (): FindingsBaseURLQuery & FindingsGroupByNoneQuery => ({ query: { language: 'kuery', query: '' }, filters: [], sort: [{ ['@timestamp']: SortDirection.desc }], @@ -38,7 +36,7 @@ export const getDefaultQuery = (): CspFindingsRequest & { groupBy: GroupBy } => groupBy: 'none', }); -const getGroupByOptions = (): Array> => [ +const getGroupByOptions = (): Array> => [ { value: 'none', label: i18n.translate('xpack.csp.findings.groupBySelector.groupByNoneLabel', { @@ -46,88 +44,55 @@ const getGroupByOptions = (): Array> => [ }), }, { - value: 'resourceType', - label: i18n.translate('xpack.csp.findings.groupBySelector.groupByResourceTypeLabel', { - defaultMessage: 'Resource Type', + value: 'resource', + label: i18n.translate('xpack.csp.findings.groupBySelector.groupByResourceIdLabel', { + defaultMessage: 'Resource', }), }, ]; -const getFindingsBaseEsQuery = ({ - query, - dataView, - filters, - queryService, -}: Pick & { - dataView: DataView; - queryService: CspClientPluginStartDeps['data']['query']; -}) => { - if (query) queryService.queryString.setQuery(query); - queryService.filterManager.setFilters(filters); - - try { - return { - index: dataView.title, - query: buildEsQuery( - dataView, - queryService.queryString.getQuery(), - queryService.filterManager.getFilters() - ), - }; - } catch (error) { - return { - error: - error instanceof Error - ? error - : new Error( - i18n.translate('xpack.csp.findings.unknownError', { - defaultMessage: 'Unknown Error', - }) - ), - }; - } -}; - export const FindingsContainer = ({ dataView }: { dataView: DataView }) => { const { euiTheme } = useEuiTheme(); const groupByOptions = useMemo(getGroupByOptions, []); - const { - data, - notifications: { toasts }, - } = useKibana().services; - - const { - urlQuery: { groupBy, ...findingsQuery }, - setUrlQuery, - } = useUrlQuery(getDefaultQuery); + const { urlQuery, setUrlQuery } = useUrlQuery(getDefaultQuery); - const baseQuery = useMemo( - () => getFindingsBaseEsQuery({ ...findingsQuery, dataView, queryService: data.query }), - [data.query, dataView, findingsQuery] + const baseEsQuery = useMemo( + () => ({ + index: dataView.title, + // TODO: this will throw for malformed query + // page will display an error boundary with the JS error + // will be accounted for before releasing the feature + query: buildEsQuery(dataView, urlQuery.query, urlQuery.filters), + }), + [dataView, urlQuery] ); - const countResult = useFindingsCounter(baseQuery); - const findingsResult = useFindings({ - ...baseQuery, - size: findingsQuery.size, - from: findingsQuery.from, - sort: findingsQuery.sort, + const findingsGroupByResource = useFindingsByResource({ + ...baseEsQuery, + enabled: urlQuery.groupBy === 'resource', }); - useEffect(() => { - if (baseQuery.error) { - toasts.addError(baseQuery.error, { title: TEXT.SEARCH_FAILED }); - } - }, [baseQuery.error, toasts]); + const findingsCount = useFindingsCounter({ + ...baseEsQuery, + enabled: urlQuery.groupBy === 'none', + }); + + const findingsGroupByNone = useFindings({ + ...baseEsQuery, + enabled: urlQuery.groupBy === 'none', + size: urlQuery.size, + from: urlQuery.from, + sort: urlQuery.sort, + }); return (
{ {INTERNAL_FEATURE_FLAGS.showFindingsGroupBy && ( setUrlQuery({ groupBy: type[0]?.value })} options={groupByOptions} /> )} - {groupBy === 'none' && ( + {urlQuery.groupBy === 'none' && ( <> + + )} + {urlQuery.groupBy === 'resource' && ( + <> + )} - {groupBy === 'resourceType' &&
}
); diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_group_by_selector.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_group_by_selector.tsx index c6e61c16299a3..84adf919a5fe1 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_group_by_selector.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_group_by_selector.tsx @@ -7,12 +7,12 @@ import React from 'react'; import { EuiComboBox, EuiFormLabel, type EuiComboBoxOptionOption } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import type { GroupBy } from './findings_container'; +import type { FindingsGroupByKind } from './types'; interface Props { - type: GroupBy; - options: Array>; - onChange(selectedOptions: Array>): void; + type: FindingsGroupByKind; + options: Array>; + onChange(selectedOptions: Array>): void; } export const FindingsGroupBySelector = ({ type, options, onChange }: Props) => ( diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_search_bar.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_search_bar.tsx index a3c1a0bfccb9a..89673dabbf91f 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_search_bar.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_search_bar.tsx @@ -10,12 +10,13 @@ import { EuiThemeComputed, useEuiTheme } from '@elastic/eui'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import type { DataView } from '@kbn/data-plugin/common'; import * as TEST_SUBJECTS from './test_subjects'; -import type { CspFindingsRequest, CspFindingsResult } from './use_findings'; +import type { CspFindingsResult } from './use_findings'; +import type { FindingsBaseURLQuery } from './types'; import type { CspClientPluginStartDeps } from '../../types'; import { PLUGIN_NAME } from '../../../common'; import { FINDINGS_SEARCH_PLACEHOLDER } from './translations'; -type SearchBarQueryProps = Pick; +type SearchBarQueryProps = Pick; interface FindingsSearchBarProps extends SearchBarQueryProps { setQuery(v: Partial): void; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.tsx index b1e404767d03e..189cf42994382 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.tsx @@ -22,13 +22,11 @@ import * as TEST_SUBJECTS from './test_subjects'; import * as TEXT from './translations'; import type { CspFinding } from './types'; import { CspEvaluationBadge } from '../../components/csp_evaluation_badge'; -import type { CspFindingsRequest, CspFindingsResult } from './use_findings'; +import type { FindingsGroupByNoneQuery, CspFindingsResult } from './use_findings'; import { FindingsRuleFlyout } from './findings_flyout'; -type TableQueryProps = Pick; - -interface BaseFindingsTableProps extends TableQueryProps { - setQuery(query: Partial): void; +interface BaseFindingsTableProps extends FindingsGroupByNoneQuery { + setQuery(query: Partial): void; } type FindingsTableProps = CspFindingsResult & BaseFindingsTableProps; @@ -119,7 +117,7 @@ const getEuiPaginationFromEsSearchSource = ({ }); const getEuiSortFromEsSearchSource = ( - sort: TableQueryProps['sort'] + sort: FindingsGroupByNoneQuery['sort'] ): EuiBasicTableProps['sorting'] => { if (!sort.length) return; @@ -133,7 +131,7 @@ const getEuiSortFromEsSearchSource = ( const getEsSearchQueryFromEuiTableParams = ({ page, sort, -}: Criteria): Partial => ({ +}: Criteria): Partial => ({ ...(!!page && { from: page.index * page.size, size: page.size }), sort: sort ? [{ [sort.field]: SortDirection[sort.direction] }] : undefined, }); diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/test_subjects.ts b/x-pack/plugins/cloud_security_posture/public/pages/findings/test_subjects.ts index 51bcafd46060d..778e54de82db6 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/test_subjects.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/test_subjects.ts @@ -9,3 +9,5 @@ export const FINDINGS_SEARCH_BAR = 'findings_search_bar'; export const FINDINGS_TABLE = 'findings_table'; export const FINDINGS_CONTAINER = 'findings_container'; export const FINDINGS_TABLE_ZERO_STATE = 'findings_table_zero_state'; +export const getFindingsByResourceTableRowTestId = (id: string) => + `findings_resource_table_row_${id}`; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/types.ts b/x-pack/plugins/cloud_security_posture/public/pages/findings/types.ts index efa2a04e06bc1..79d8f3507c896 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/types.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/types.ts @@ -4,6 +4,33 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import type { BoolQuery, Filter, Query } from '@kbn/es-query'; +import { UseQueryResult } from 'react-query'; + +export type FindingsGroupByKind = 'none' | 'resource'; + +export interface FindingsBaseURLQuery { + groupBy: FindingsGroupByKind; + query: Query; + filters: Filter[]; +} + +export interface FindingsBaseEsQuery { + index: string; + query?: { + bool: BoolQuery; + }; +} + +export interface FindingsQueryStatus { + enabled: boolean; +} + +export interface FindingsQueryResult { + loading: UseQueryResult['isLoading']; + error: TError; + data: TData; +} // TODO: this needs to be defined in a versioned schema export interface CspFinding { diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings.ts b/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings.ts index 8754bdf390ef7..1f7e8dae483bf 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings.ts @@ -4,41 +4,35 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { type UseQueryResult, useQuery } from 'react-query'; +import { useQuery } from 'react-query'; import { number } from 'io-ts'; -import type { Filter } from '@kbn/es-query'; import { lastValueFrom } from 'rxjs'; -import type { - EsQuerySortValue, - IEsSearchResponse, - SerializedSearchSourceFields, -} from '@kbn/data-plugin/common'; +import type { EsQuerySortValue, IEsSearchResponse } from '@kbn/data-plugin/common'; import type { CoreStart } from '@kbn/core/public'; +import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { extractErrorMessage } from '../../../common/utils/helpers'; import * as TEXT from './translations'; -import type { CspFinding } from './types'; +import type { CspFinding, FindingsQueryResult } from './types'; import { useKibana } from '../../common/hooks/use_kibana'; -import type { FindingsBaseQuery } from './findings_container'; +import type { FindingsBaseEsQuery, FindingsQueryStatus } from './types'; -export interface CspFindingsRequest - extends Required> { - filters: Filter[]; -} +interface UseFindingsOptions + extends FindingsBaseEsQuery, + FindingsGroupByNoneQuery, + FindingsQueryStatus {} -type UseFindingsOptions = FindingsBaseQuery & Omit; +export interface FindingsGroupByNoneQuery { + from: NonNullable; + size: NonNullable; + sort: EsQuerySortValue[]; +} interface CspFindingsData { page: CspFinding[]; total: number; } -type Result = UseQueryResult; - -export interface CspFindingsResult { - loading: Result['isLoading']; - error: Result['error']; - data: CspFindingsData | undefined; -} +export type CspFindingsResult = FindingsQueryResult; const FIELDS_WITHOUT_KEYWORD_MAPPING = new Set(['@timestamp']); @@ -77,7 +71,7 @@ export const getFindingsQuery = ({ size, from, sort, -}: Omit) => ({ +}: Omit) => ({ index, query, size, @@ -85,14 +79,14 @@ export const getFindingsQuery = ({ sort: mapEsQuerySortKey(sort), }); -export const useFindings = ({ error, index, query, sort, from, size }: UseFindingsOptions) => { +export const useFindings = ({ enabled, index, query, sort, from, size }: UseFindingsOptions) => { const { data, notifications: { toasts }, } = useKibana().services; return useQuery( - ['csp_findings', { from, size, query, sort }], + ['csp_findings', { index, query, sort, from, size }], () => lastValueFrom>( data.search.search({ @@ -100,9 +94,8 @@ export const useFindings = ({ error, index, query, sort, from, size }: UseFindin }) ), { - enabled: !error, + enabled, select: ({ rawResponse: { hits } }) => ({ - // TODO: use 'fields' instead of '_source' ? page: hits.hits.map((hit) => hit._source!), total: number.is(hits.total) ? hits.total : 0, }), diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_by_resource.ts b/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_by_resource.ts new file mode 100644 index 0000000000000..b5596d55a6664 --- /dev/null +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_by_resource.ts @@ -0,0 +1,101 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { useQuery } from 'react-query'; +import { lastValueFrom } from 'rxjs'; +import { IKibanaSearchRequest, IKibanaSearchResponse } from '@kbn/data-plugin/common'; +import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { useKibana } from '../../common/hooks/use_kibana'; +import { showErrorToast } from './use_findings'; +import type { FindingsBaseEsQuery, FindingsQueryResult, FindingsQueryStatus } from './types'; + +interface UseFindingsByResourceOptions extends FindingsBaseEsQuery, FindingsQueryStatus {} + +type FindingsAggRequest = IKibanaSearchRequest; +type FindingsAggResponse = IKibanaSearchResponse< + estypes.SearchResponse<{}, FindingsByResourceAggs> +>; + +export type CspFindingsByResourceResult = FindingsQueryResult< + ReturnType['data'] | undefined, + unknown +>; + +interface FindingsByResourceAggs extends estypes.AggregationsCompositeAggregate { + groupBy: { + buckets: FindingsAggBucket[]; + }; +} + +interface FindingsAggBucket { + doc_count: number; + failed_findings: { doc_count: number }; + key: { + resource_id: string; + cluster_id: string; + cis_section: string; + }; +} + +export const getFindingsByResourceAggQuery = ({ + index, + query, +}: Omit): estypes.SearchRequest => ({ + index, + size: 0, + body: { + query, + aggs: { + groupBy: { + composite: { + size: 10 * 1000, + sources: [ + { resource_id: { terms: { field: 'resource_id.keyword' } } }, + { cluster_id: { terms: { field: 'cluster_id.keyword' } } }, + { cis_section: { terms: { field: 'rule.section' } } }, + ], + }, + aggs: { + failed_findings: { + filter: { term: { 'result.evaluation.keyword': 'failed' } }, + }, + }, + }, + }, + }, +}); + +export const useFindingsByResource = ({ enabled, index, query }: UseFindingsByResourceOptions) => { + const { + data, + notifications: { toasts }, + } = useKibana().services; + + return useQuery( + ['csp_findings_resource', { index, query }], + () => + lastValueFrom( + data.search.search({ + params: getFindingsByResourceAggQuery({ index, query }), + }) + ), + { + enabled, + select: ({ rawResponse }) => ({ + page: rawResponse.aggregations?.groupBy.buckets.map(createFindingsByResource) || [], + }), + onError: (err) => showErrorToast(toasts, err), + } + ); +}; + +const createFindingsByResource = (bucket: FindingsAggBucket) => ({ + ...bucket.key, + failed_findings: { + total: bucket.failed_findings.doc_count, + normalized: bucket.doc_count > 0 ? bucket.failed_findings.doc_count / bucket.doc_count : 0, + }, +}); diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_count.ts b/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_count.ts index 5a9e0411910e6..6ed56ea1d4397 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_count.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/use_findings_count.ts @@ -10,7 +10,9 @@ import { lastValueFrom } from 'rxjs'; import type { IKibanaSearchRequest, IKibanaSearchResponse } from '@kbn/data-plugin/public'; import { useKibana } from '../../common/hooks/use_kibana'; import { showErrorToast } from './use_findings'; -import type { FindingsBaseQuery } from './findings_container'; +import type { FindingsBaseEsQuery, FindingsQueryStatus } from './types'; + +interface UseFindingsCountOptions extends FindingsBaseEsQuery, FindingsQueryStatus {} type FindingsAggRequest = IKibanaSearchRequest; type FindingsAggResponse = IKibanaSearchResponse>; @@ -23,7 +25,7 @@ interface FindingsAggs extends estypes.AggregationsMultiBucketAggregateBase { }; } -export const getFindingsCountAggQuery = ({ index, query }: Omit) => ({ +export const getFindingsCountAggQuery = ({ index, query }: FindingsBaseEsQuery) => ({ index, size: 0, track_total_hits: true, @@ -33,7 +35,7 @@ export const getFindingsCountAggQuery = ({ index, query }: Omit { +export const useFindingsCounter = ({ enabled, index, query }: UseFindingsCountOptions) => { const { data, notifications: { toasts }, @@ -48,7 +50,7 @@ export const useFindingsCounter = ({ index, query, error }: FindingsBaseQuery) = }) ), { - enabled: !error, + enabled, onError: (err) => showErrorToast(toasts, err), select: (response) => Object.fromEntries( diff --git a/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts b/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts index ad802e3fab9fa..f3132d145c7a2 100644 --- a/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts +++ b/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.ts @@ -28,6 +28,7 @@ export type DataFilters = { timeslice?: Timeslice; zoom: number; isReadOnly: boolean; + joinKeyFilter?: Filter; }; export type VectorSourceRequestMeta = DataFilters & { @@ -77,7 +78,10 @@ export type VectorTileLayerMeta = { }; // Partial because objects are justified downstream in constructors -export type DataRequestMeta = Partial< +export type DataRequestMeta = { + // request stop time in milliseconds since epoch + requestStopTime?: number; +} & Partial< VectorSourceRequestMeta & VectorJoinSourceRequestMeta & VectorStyleRequestMeta & diff --git a/x-pack/plugins/maps/public/actions/layer_actions.ts b/x-pack/plugins/maps/public/actions/layer_actions.ts index b184cab70d1a7..25ba0ac862db8 100644 --- a/x-pack/plugins/maps/public/actions/layer_actions.ts +++ b/x-pack/plugins/maps/public/actions/layer_actions.ts @@ -13,6 +13,7 @@ import { createLayerInstance, getEditState, getLayerById, + getLayerDescriptor, getLayerList, getLayerListRaw, getMapColors, @@ -55,11 +56,12 @@ import { LayerDescriptor, StyleDescriptor, TileMetaFeature, + VectorLayerDescriptor, } from '../../common/descriptor_types'; import { ILayer } from '../classes/layers/layer'; import { IVectorLayer } from '../classes/layers/vector_layer'; import { OnSourceChangeArgs } from '../classes/sources/source'; -import { DRAW_MODE, LAYER_STYLE_TYPE, LAYER_TYPE } from '../../common/constants'; +import { DRAW_MODE, LAYER_STYLE_TYPE, LAYER_TYPE, SCALING_TYPES } from '../../common/constants'; import { IVectorStyle } from '../classes/styles/vector/vector_style'; import { notifyLicensedFeatureUsage } from '../licensed_features'; import { IESAggField } from '../classes/fields/agg'; @@ -362,13 +364,17 @@ function updateSourcePropWithoutSync( value: unknown, newLayerType?: LAYER_TYPE ) { - return async (dispatch: ThunkDispatch) => { + return async ( + dispatch: ThunkDispatch, + getState: () => MapStoreState + ) => { if (propName === 'metrics') { if (newLayerType) { throw new Error('May not change layer-type when modifying metrics source-property'); } return await dispatch(updateMetricsProp(layerId, value)); } + dispatch({ type: UPDATE_SOURCE_PROP, layerId, @@ -378,6 +384,37 @@ function updateSourcePropWithoutSync( if (newLayerType) { dispatch(updateLayerType(layerId, newLayerType)); } + + if (propName === 'scalingType') { + // get joins from layer descriptor instead of layer.getJoins() + // 1) IVectorLayer implementations may return empty array when descriptor has joins + // 2) getJoins returns instances and descriptors are needed. + const layerDescriptor = getLayerDescriptor(getState(), layerId) as VectorLayerDescriptor; + const joins = layerDescriptor.joins ? layerDescriptor.joins : []; + if (value === SCALING_TYPES.CLUSTERS && joins.length) { + // Blended scaling type does not support joins + // It is not possible to display join metrics when showing clusters + dispatch({ + type: SET_JOINS, + layerId, + joins: [], + }); + await dispatch(updateStyleProperties(layerId)); + } else if (value === SCALING_TYPES.MVT) { + if (joins.length > 1) { + // Maplibre feature-state join uses promoteId and there is a limit to one promoteId + // Therefore, Vector tile scaling supports only one join + dispatch({ + type: SET_JOINS, + layerId, + joins: [joins[0]], + }); + } + // update style props regardless of updating joins + // Allow style to clean-up data driven style properties with join fields that do not support feature-state. + await dispatch(updateStyleProperties(layerId)); + } + } }; } @@ -562,7 +599,7 @@ function removeLayerFromLayerList(layerId: string) { }; } -function updateStyleProperties(layerId: string, previousFields: IField[]) { +function updateStyleProperties(layerId: string, previousFields?: IField[]) { return async ( dispatch: ThunkDispatch, getState: () => MapStoreState @@ -584,7 +621,7 @@ function updateStyleProperties(layerId: string, previousFields: IField[]) { const nextFields = await (targetLayer as IVectorLayer).getFields(); // take into account all fields, since labels can be driven by any field (source or join) const { hasChanges, nextStyleDescriptor } = await ( style as IVectorStyle - ).getDescriptorWithUpdatedStyleProps(nextFields, previousFields, getMapColors(getState())); + ).getDescriptorWithUpdatedStyleProps(nextFields, getMapColors(getState()), previousFields); if (hasChanges && nextStyleDescriptor) { dispatch(updateLayerStyle(layerId, nextStyleDescriptor)); } @@ -626,9 +663,9 @@ export function updateLayerStyleForSelectedLayer(styleDescriptor: StyleDescripto export function setJoinsForLayer(layer: ILayer, joins: JoinDescriptor[]) { return async (dispatch: ThunkDispatch) => { const previousFields = await (layer as IVectorLayer).getFields(); - await dispatch({ + dispatch({ type: SET_JOINS, - layer, + layerId: layer.getId(), joins, }); await dispatch(updateStyleProperties(layer.getId(), previousFields)); diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/bounds_data.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/bounds_data.ts index 863f4b7f1cb68..29ecf1635d626 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/bounds_data.ts +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/bounds_data.ts @@ -34,6 +34,7 @@ export async function syncBoundsData({ timeFilters: dataFilters.timeFilters, timeslice: dataFilters.timeslice, filters: dataFilters.filters, + joinKeyFilter: dataFilters.joinKeyFilter, applyGlobalQuery: source.getApplyGlobalQuery(), applyGlobalTime: source.getApplyGlobalTime(), }; diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx index 42303bc0b4c31..18972e89607e4 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/geojson_vector_layer.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import _ from 'lodash'; import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiIcon } from '@elastic/eui'; @@ -13,35 +14,30 @@ import type { Map as MbMap, GeoJSONSource as MbGeoJSONSource } from '@kbn/mapbox import { EMPTY_FEATURE_COLLECTION, FEATURE_VISIBLE_PROPERTY_NAME, - FIELD_ORIGIN, LAYER_TYPE, } from '../../../../../common/constants'; import { StyleMetaDescriptor, Timeslice, - VectorJoinSourceRequestMeta, VectorLayerDescriptor, } from '../../../../../common/descriptor_types'; -import { PropertiesMap } from '../../../../../common/elasticsearch_util'; import { TimesliceMaskConfig } from '../../../util/mb_filter_expressions'; import { DataRequestContext } from '../../../../actions'; import { IVectorStyle, VectorStyle } from '../../../styles/vector/vector_style'; import { ISource } from '../../../sources/source'; import { IVectorSource } from '../../../sources/vector_source'; import { AbstractLayer, LayerIcon } from '../../layer'; -import { InnerJoin } from '../../../joins/inner_join'; import { AbstractVectorLayer, noResultsIcon, NO_RESULTS_ICON_AND_TOOLTIPCONTENT, } from '../vector_layer'; import { DataRequestAbortError } from '../../../util/data_request'; -import { canSkipSourceUpdate } from '../../../util/can_skip_fetch'; import { getFeatureCollectionBounds } from '../../../util/get_feature_collection_bounds'; import { GEOJSON_FEATURE_ID_PROPERTY_NAME } from './assign_feature_ids'; import { syncGeojsonSourceData } from './geojson_source_data'; -import { JoinState, performInnerJoins } from './perform_inner_joins'; -import { buildVectorRequestMeta } from '../../build_vector_request_meta'; +import { performInnerJoins } from './perform_inner_joins'; +import { pluckStyleMetaFromFeatures } from './pluck_style_meta_from_features'; export class GeoJsonVectorLayer extends AbstractVectorLayer { static createDescriptor( @@ -127,7 +123,12 @@ export class GeoJsonVectorLayer extends AbstractVectorLayer { if (!style || !sourceDataRequest) { return null; } - return await style.pluckStyleMetaFromSourceDataRequest(sourceDataRequest); + + return await pluckStyleMetaFromFeatures( + _.get(sourceDataRequest.getData(), 'features', []), + await this.getSource().getSupportedShapeTypes(), + this.getCurrentStyle().getDynamicPropertiesArray() + ); } _requiresPrevSourceCleanup(mbMap: MbMap) { @@ -159,6 +160,13 @@ export class GeoJsonVectorLayer extends AbstractVectorLayer { this._setMbLinePolygonProperties(mbMap, undefined, timesliceMaskConfig); } + _getJoinFilterExpression(): unknown | undefined { + return this.hasJoins() + ? // Remove unjoined source features by filtering out features without GeoJSON feature.property[FEATURE_VISIBLE_PROPERTY_NAME] is true + ['==', ['get', FEATURE_VISIBLE_PROPERTY_NAME], true] + : undefined; + } + _syncFeatureCollectionWithMb(mbMap: MbMap) { const mbGeoJSONSource = mbMap.getSource(this.getId()) as MbGeoJSONSource; const featureCollection = this._getSourceFeatureCollection(); @@ -260,118 +268,6 @@ export class GeoJsonVectorLayer extends AbstractVectorLayer { } } - async _syncJoin({ - join, - startLoading, - stopLoading, - onLoadError, - registerCancelCallback, - dataFilters, - isForceRefresh, - }: { join: InnerJoin } & DataRequestContext): Promise { - const joinSource = join.getRightJoinSource(); - const sourceDataId = join.getSourceDataRequestId(); - const requestToken = Symbol(`layer-join-refresh:${this.getId()} - ${sourceDataId}`); - - const joinRequestMeta: VectorJoinSourceRequestMeta = buildVectorRequestMeta( - joinSource, - joinSource.getFieldNames(), - dataFilters, - joinSource.getWhereQuery(), - isForceRefresh - ) as VectorJoinSourceRequestMeta; - - const prevDataRequest = this.getDataRequest(sourceDataId); - const canSkipFetch = await canSkipSourceUpdate({ - source: joinSource, - prevDataRequest, - nextRequestMeta: joinRequestMeta, - extentAware: false, // join-sources are term-aggs that are spatially unaware (e.g. ESTermSource/TableSource). - getUpdateDueToTimeslice: () => { - return true; - }, - }); - - if (canSkipFetch) { - return { - dataHasChanged: false, - join, - propertiesMap: prevDataRequest?.getData() as PropertiesMap, - }; - } - - try { - startLoading(sourceDataId, requestToken, joinRequestMeta); - const leftSourceName = await this._source.getDisplayName(); - const propertiesMap = await joinSource.getPropertiesMap( - joinRequestMeta, - leftSourceName, - join.getLeftField().getName(), - registerCancelCallback.bind(null, requestToken) - ); - stopLoading(sourceDataId, requestToken, propertiesMap); - return { - dataHasChanged: true, - join, - propertiesMap, - }; - } catch (error) { - if (!(error instanceof DataRequestAbortError)) { - onLoadError(sourceDataId, requestToken, `Join error: ${error.message}`); - } - throw error; - } - } - - async _syncJoins(syncContext: DataRequestContext, style: IVectorStyle) { - const joinSyncs = this.getValidJoins().map(async (join) => { - await this._syncJoinStyleMeta(syncContext, join, style); - await this._syncJoinFormatters(syncContext, join, style); - return this._syncJoin({ join, ...syncContext }); - }); - - return await Promise.all(joinSyncs); - } - - async _syncJoinStyleMeta(syncContext: DataRequestContext, join: InnerJoin, style: IVectorStyle) { - const joinSource = join.getRightJoinSource(); - return this._syncStyleMeta({ - source: joinSource, - style, - sourceQuery: joinSource.getWhereQuery(), - dataRequestId: join.getSourceMetaDataRequestId(), - dynamicStyleProps: this.getCurrentStyle() - .getDynamicPropertiesArray() - .filter((dynamicStyleProp) => { - const matchingField = joinSource.getFieldByName(dynamicStyleProp.getFieldName()); - return ( - dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.JOIN && - !!matchingField && - dynamicStyleProp.isFieldMetaEnabled() - ); - }), - ...syncContext, - }); - } - - async _syncJoinFormatters(syncContext: DataRequestContext, join: InnerJoin, style: IVectorStyle) { - const joinSource = join.getRightJoinSource(); - return this._syncFormatters({ - source: joinSource, - dataRequestId: join.getSourceFormattersDataRequestId(), - fields: style - .getDynamicPropertiesArray() - .filter((dynamicStyleProp) => { - const matchingField = joinSource.getFieldByName(dynamicStyleProp.getFieldName()); - return dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.JOIN && !!matchingField; - }) - .map((dynamicStyleProp) => { - return dynamicStyleProp.getField()!; - }), - ...syncContext, - }); - } - _getSourceFeatureCollection() { const sourceDataRequest = this.getSourceDataRequest(); return sourceDataRequest ? (sourceDataRequest.getData() as FeatureCollection) : null; diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/perform_inner_joins.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/perform_inner_joins.ts index d02f1c1a99bb7..5fd7dc4b94397 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/perform_inner_joins.ts +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/perform_inner_joins.ts @@ -9,20 +9,13 @@ import { FeatureCollection } from 'geojson'; import { i18n } from '@kbn/i18n'; import { FEATURE_VISIBLE_PROPERTY_NAME } from '../../../../../common/constants'; import { DataRequestContext } from '../../../../actions'; -import { InnerJoin } from '../../../joins/inner_join'; -import { PropertiesMap } from '../../../../../common/elasticsearch_util'; +import { JoinState } from '../types'; interface SourceResult { refreshed: boolean; featureCollection: FeatureCollection; } -export interface JoinState { - dataHasChanged: boolean; - join: InnerJoin; - propertiesMap?: PropertiesMap; -} - export async function performInnerJoins( sourceResult: SourceResult, joinStates: JoinState[], diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/pluck_style_meta_from_features.test.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/pluck_style_meta_from_features.test.ts new file mode 100644 index 0000000000000..5c609f66e3f53 --- /dev/null +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/pluck_style_meta_from_features.test.ts @@ -0,0 +1,417 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { Feature } from 'geojson'; +import { + COLOR_MAP_TYPE, + FIELD_ORIGIN, + VECTOR_SHAPE_TYPE, + VECTOR_STYLES, +} from '../../../../../common/constants'; +import { ColorDynamicOptions } from '../../../../../common/descriptor_types'; +import { IVectorLayer } from '../vector_layer'; +import { IVectorSource } from '../../../sources/vector_source'; +import { DynamicColorProperty } from '../../../styles/vector/properties/dynamic_color_property'; +import { InlineField } from '../../../fields/inline_field'; +import { + isOnlySingleFeatureType, + pluckCategoricalStyleMetaFromFeatures, + pluckStyleMetaFromFeatures, +} from './pluck_style_meta_from_features'; + +describe('pluckStyleMetaFromFeatures', () => { + test('Should identify when feature collection only contains points', async () => { + const features = [ + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [0, 0], + }, + properties: {}, + }, + { + type: 'Feature', + geometry: { + type: 'MultiPoint', + coordinates: [ + [10.0, 40.0], + [40.0, 30.0], + [20.0, 20.0], + [30.0, 10.0], + ], + }, + properties: {}, + }, + ] as Feature[]; + + const styleMeta = await pluckStyleMetaFromFeatures( + features, + Object.values(VECTOR_SHAPE_TYPE), + [] + ); + expect(styleMeta).toEqual({ + fieldMeta: {}, + geometryTypes: { + isLinesOnly: false, + isPointsOnly: true, + isPolygonsOnly: false, + }, + }); + }); + + test('Should identify when feature collection only contains lines', async () => { + const features = [ + { + type: 'Feature', + geometry: { + type: 'LineString', + coordinates: [ + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + ], + }, + properties: {}, + }, + { + type: 'Feature', + geometry: { + type: 'MultiLineString', + coordinates: [ + [ + [10.0, 10.0], + [20.0, 20.0], + [10.0, 40.0], + ], + [ + [40.0, 40.0], + [30.0, 30.0], + [40.0, 20.0], + [30.0, 10.0], + ], + ], + }, + properties: {}, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [0, 0], + }, + properties: { + __kbn_is_centroid_feature__: true, + }, + }, + ] as Feature[]; + + const styleMeta = await pluckStyleMetaFromFeatures( + features, + Object.values(VECTOR_SHAPE_TYPE), + [] + ); + expect(styleMeta).toEqual({ + fieldMeta: {}, + geometryTypes: { + isLinesOnly: true, + isPointsOnly: false, + isPolygonsOnly: false, + }, + }); + }); + + test('Should not extract scaled field range when scaled field has no values', async () => { + const features = [ + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [0, 0], + }, + properties: { + myDynamicField: 1, + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [0, 0], + }, + properties: { + myDynamicField: 10, + }, + }, + ] as Feature[]; + const dynamicColorOptions = { + type: COLOR_MAP_TYPE.ORDINAL, + field: { + origin: FIELD_ORIGIN.SOURCE, + name: 'myDynamicFieldWithNoValues', + }, + } as ColorDynamicOptions; + const field = new InlineField({ + fieldName: dynamicColorOptions.field!.name, + source: {} as unknown as IVectorSource, + origin: dynamicColorOptions.field!.origin, + dataType: 'number', + }); + const dynamicColorProperty = new DynamicColorProperty( + dynamicColorOptions, + VECTOR_STYLES.FILL_COLOR, + field, + {} as unknown as IVectorLayer, + () => { + return null; + } // getFieldFormatter + ); + + const styleMeta = await pluckStyleMetaFromFeatures(features, Object.values(VECTOR_SHAPE_TYPE), [ + dynamicColorProperty, + ]); + expect(styleMeta).toEqual({ + fieldMeta: { + myDynamicFieldWithNoValues: { + categories: [], + }, + }, + geometryTypes: { + isLinesOnly: false, + isPointsOnly: true, + isPolygonsOnly: false, + }, + }); + }); + + test('Should extract scaled field range', async () => { + const features = [ + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [0, 0], + }, + properties: { + myDynamicField: 1, + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [0, 0], + }, + properties: { + myDynamicField: 10, + }, + }, + ] as Feature[]; + const dynamicColorOptions = { + type: COLOR_MAP_TYPE.ORDINAL, + field: { + origin: FIELD_ORIGIN.SOURCE, + name: 'myDynamicField', + }, + } as ColorDynamicOptions; + const field = new InlineField({ + fieldName: dynamicColorOptions.field!.name, + source: {} as unknown as IVectorSource, + origin: dynamicColorOptions.field!.origin, + dataType: 'number', + }); + const dynamicColorProperty = new DynamicColorProperty( + dynamicColorOptions, + VECTOR_STYLES.FILL_COLOR, + field, + {} as unknown as IVectorLayer, + () => { + return null; + } // getFieldFormatter + ); + + const styleMeta = await pluckStyleMetaFromFeatures(features, Object.values(VECTOR_SHAPE_TYPE), [ + dynamicColorProperty, + ]); + expect(styleMeta).toEqual({ + fieldMeta: { + myDynamicField: { + categories: [], + range: { + delta: 9, + max: 10, + min: 1, + }, + }, + }, + geometryTypes: { + isLinesOnly: false, + isPointsOnly: true, + isPolygonsOnly: false, + }, + }); + }); +}); + +describe('pluckCategoricalStyleMetaFromFeatures', () => { + test('Should pluck the categorical style-meta', async () => { + const field = new InlineField({ + fieldName: 'foobar', + source: {} as unknown as IVectorSource, + origin: FIELD_ORIGIN.SOURCE, + dataType: 'number', + }); + const dynamicColorProperty = new DynamicColorProperty( + { + type: COLOR_MAP_TYPE.CATEGORICAL, + colorCategory: 'palette_0', + fieldMetaOptions: { isEnabled: true }, + }, + VECTOR_STYLES.LINE_COLOR, + field, + {} as unknown as IVectorLayer, + () => { + return null; + } // getFieldFormatter + ); + + const features = [ + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-10, 0], + }, + properties: { + foobar: 'CN', + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-10, 0], + }, + properties: { + foobar: 'CN', + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-10, 0], + }, + properties: { + foobar: 'US', + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-10, 0], + }, + properties: { + foobar: 'CN', + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-10, 0], + }, + properties: { + foobar: 'US', + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-10, 0], + }, + properties: { + foobar: 'IN', + }, + }, + ] as Feature[]; + + const categories = pluckCategoricalStyleMetaFromFeatures(dynamicColorProperty, features); + + expect(categories).toEqual([ + { key: 'CN', count: 3 }, + { key: 'US', count: 2 }, + { key: 'IN', count: 1 }, + ]); + }); +}); + +describe('isOnlySingleFeatureType', () => { + describe('source supports single feature type', () => { + const supportedFeatures = [VECTOR_SHAPE_TYPE.POINT]; + const hasFeatureType = { + [VECTOR_SHAPE_TYPE.POINT]: false, + [VECTOR_SHAPE_TYPE.LINE]: false, + [VECTOR_SHAPE_TYPE.POLYGON]: false, + }; + + test('Is only single feature type when only supported feature type is target feature type', () => { + expect( + isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.POINT, supportedFeatures, hasFeatureType) + ).toBe(true); + }); + + test('Is not single feature type when only supported feature type is not target feature type', () => { + expect( + isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.LINE, supportedFeatures, hasFeatureType) + ).toBe(false); + }); + }); + + describe('source supports multiple feature types', () => { + const supportedFeatures = [ + VECTOR_SHAPE_TYPE.POINT, + VECTOR_SHAPE_TYPE.LINE, + VECTOR_SHAPE_TYPE.POLYGON, + ]; + + test('Is only single feature type when data only has target feature type', () => { + const hasFeatureType = { + [VECTOR_SHAPE_TYPE.POINT]: true, + [VECTOR_SHAPE_TYPE.LINE]: false, + [VECTOR_SHAPE_TYPE.POLYGON]: false, + }; + expect( + isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.POINT, supportedFeatures, hasFeatureType) + ).toBe(true); + }); + + test('Is not single feature type when data has multiple feature types', () => { + const hasFeatureType = { + [VECTOR_SHAPE_TYPE.POINT]: true, + [VECTOR_SHAPE_TYPE.LINE]: true, + [VECTOR_SHAPE_TYPE.POLYGON]: true, + }; + expect( + isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.LINE, supportedFeatures, hasFeatureType) + ).toBe(false); + }); + + test('Is not single feature type when data does not have target feature types', () => { + const hasFeatureType = { + [VECTOR_SHAPE_TYPE.POINT]: false, + [VECTOR_SHAPE_TYPE.LINE]: true, + [VECTOR_SHAPE_TYPE.POLYGON]: false, + }; + expect( + isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.POINT, supportedFeatures, hasFeatureType) + ).toBe(false); + }); + }); +}); diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/pluck_style_meta_from_features.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/pluck_style_meta_from_features.ts new file mode 100644 index 0000000000000..2ea0fef1bf648 --- /dev/null +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/geojson_vector_layer/pluck_style_meta_from_features.ts @@ -0,0 +1,190 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { Feature } from 'geojson'; +import { + GEO_JSON_TYPE, + KBN_IS_CENTROID_FEATURE, + VECTOR_SHAPE_TYPE, +} from '../../../../../common/constants'; +import { + Category, + DynamicStylePropertyOptions, + RangeFieldMeta, + StyleMetaDescriptor, +} from '../../../../../common/descriptor_types'; +import { IDynamicStyleProperty } from '../../../styles/vector/properties/dynamic_style_property'; + +const POINTS = [GEO_JSON_TYPE.POINT, GEO_JSON_TYPE.MULTI_POINT]; +const LINES = [GEO_JSON_TYPE.LINE_STRING, GEO_JSON_TYPE.MULTI_LINE_STRING]; +const POLYGONS = [GEO_JSON_TYPE.POLYGON, GEO_JSON_TYPE.MULTI_POLYGON]; + +export async function pluckStyleMetaFromFeatures( + features: Feature[], + supportedShapeTypes: VECTOR_SHAPE_TYPE[], + dynamicProperties: Array> +): Promise { + const hasFeatureType = { + [VECTOR_SHAPE_TYPE.POINT]: false, + [VECTOR_SHAPE_TYPE.LINE]: false, + [VECTOR_SHAPE_TYPE.POLYGON]: false, + }; + if (supportedShapeTypes.length > 1) { + for (let i = 0; i < features.length; i++) { + const feature = features[i]; + + // ignore centroid features as they are added for styling and not part of the real data set + if (feature.properties?.[KBN_IS_CENTROID_FEATURE]) { + continue; + } + + if ( + !hasFeatureType[VECTOR_SHAPE_TYPE.POINT] && + POINTS.includes(feature.geometry.type as GEO_JSON_TYPE) + ) { + hasFeatureType[VECTOR_SHAPE_TYPE.POINT] = true; + } + if ( + !hasFeatureType[VECTOR_SHAPE_TYPE.LINE] && + LINES.includes(feature.geometry.type as GEO_JSON_TYPE) + ) { + hasFeatureType[VECTOR_SHAPE_TYPE.LINE] = true; + } + if ( + !hasFeatureType[VECTOR_SHAPE_TYPE.POLYGON] && + POLYGONS.includes(feature.geometry.type as GEO_JSON_TYPE) + ) { + hasFeatureType[VECTOR_SHAPE_TYPE.POLYGON] = true; + } + } + } + + const styleMeta = { + geometryTypes: { + isPointsOnly: isOnlySingleFeatureType( + VECTOR_SHAPE_TYPE.POINT, + supportedShapeTypes, + hasFeatureType + ), + isLinesOnly: isOnlySingleFeatureType( + VECTOR_SHAPE_TYPE.LINE, + supportedShapeTypes, + hasFeatureType + ), + isPolygonsOnly: isOnlySingleFeatureType( + VECTOR_SHAPE_TYPE.POLYGON, + supportedShapeTypes, + hasFeatureType + ), + }, + fieldMeta: {}, + } as StyleMetaDescriptor; + + if (dynamicProperties.length === 0 || features.length === 0) { + // no additional meta data to pull from source data request. + return styleMeta; + } + + dynamicProperties.forEach( + (dynamicProperty: IDynamicStyleProperty) => { + const name = dynamicProperty.getFieldName(); + if (!styleMeta.fieldMeta[name]) { + styleMeta.fieldMeta[name] = { categories: [] }; + } + const categories = pluckCategoricalStyleMetaFromFeatures(dynamicProperty, features); + if (categories.length) { + styleMeta.fieldMeta[name].categories = categories; + } + const ordinalStyleMeta = pluckOrdinalStyleMetaFromFeatures(dynamicProperty, features); + if (ordinalStyleMeta) { + styleMeta.fieldMeta[name].range = ordinalStyleMeta; + } + } + ); + + return styleMeta; +} + +function pluckOrdinalStyleMetaFromFeatures( + property: IDynamicStyleProperty, + features: Feature[] +): RangeFieldMeta | null { + if (!property.isOrdinal()) { + return null; + } + + const name = property.getFieldName(); + let min = Infinity; + let max = -Infinity; + for (let i = 0; i < features.length; i++) { + const feature = features[i]; + const newValue = feature.properties ? parseFloat(feature.properties[name]) : NaN; + if (!isNaN(newValue)) { + min = Math.min(min, newValue); + max = Math.max(max, newValue); + } + } + + return min === Infinity || max === -Infinity + ? null + : { + min, + max, + delta: max - min, + }; +} + +export function pluckCategoricalStyleMetaFromFeatures( + property: IDynamicStyleProperty, + features: Feature[] +): Category[] { + const size = property.getNumberOfCategories(); + if (!property.isCategorical() || size <= 0) { + return []; + } + + const counts = new Map(); + for (let i = 0; i < features.length; i++) { + const feature = features[i]; + const term = feature.properties ? feature.properties[property.getFieldName()] : undefined; + // properties object may be sparse, so need to check if the field is effectively present + if (typeof term !== undefined) { + if (counts.has(term)) { + counts.set(term, counts.get(term) + 1); + } else { + counts.set(term, 1); + } + } + } + + const ordered: Category[] = []; + for (const [key, value] of counts) { + ordered.push({ key, count: value }); + } + + ordered.sort((a, b) => { + return b.count - a.count; + }); + return ordered.slice(0, size); +} + +export function isOnlySingleFeatureType( + featureType: VECTOR_SHAPE_TYPE, + supportedShapeTypes: VECTOR_SHAPE_TYPE[], + hasFeatureType: { [key in keyof typeof VECTOR_SHAPE_TYPE]: boolean } +): boolean { + if (supportedShapeTypes.length === 1) { + return supportedShapeTypes[0] === featureType; + } + + const featureTypes = Object.keys(hasFeatureType); + // @ts-expect-error + return featureTypes.reduce((accumulator: boolean, featureTypeKey: VECTOR_SHAPE_TYPE) => { + const hasFeature = hasFeatureType[featureTypeKey]; + return featureTypeKey === featureType ? accumulator && hasFeature : accumulator && !hasFeature; + }, true); +} diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx index 325e302c0941a..4d15cddcf44db 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.tsx @@ -5,7 +5,9 @@ * 2.0. */ +import _ from 'lodash'; import type { + FeatureIdentifier, Map as MbMap, AnyLayer as MbLayer, GeoJSONSource as MbGeoJSONSource, @@ -13,7 +15,9 @@ import type { } from '@kbn/mapbox-gl'; import { Feature } from 'geojson'; import { i18n } from '@kbn/i18n'; +import { buildPhrasesFilter } from '@kbn/es-query'; import { VectorStyle } from '../../../styles/vector/vector_style'; +import { getField } from '../../../../../common/elasticsearch_util'; import { LAYER_TYPE, SOURCE_TYPES } from '../../../../../common/constants'; import { NO_RESULTS_ICON_AND_TOOLTIPCONTENT, @@ -23,13 +27,18 @@ import { import { IMvtVectorSource } from '../../../sources/vector_source'; import { DataRequestContext } from '../../../../actions'; import { + DataRequestMeta, StyleMetaDescriptor, TileMetaFeature, VectorLayerDescriptor, } from '../../../../../common/descriptor_types'; import { ESSearchSource } from '../../../sources/es_search_source'; +import { IESSource } from '../../../sources/es_source'; +import { InnerJoin } from '../../../joins/inner_join'; import { LayerIcon } from '../../layer'; import { MvtSourceData, syncMvtSourceData } from './mvt_source_data'; +import { PropertiesMap } from '../../../../../common/elasticsearch_util'; +import { pluckStyleMeta } from './pluck_style_meta'; export const ES_MVT_META_LAYER_NAME = 'meta'; const ES_MVT_HITS_TOTAL_RELATION = 'hits.total.relation'; @@ -54,9 +63,34 @@ export class MvtVectorLayer extends AbstractVectorLayer { readonly _source: IMvtVectorSource; - constructor({ layerDescriptor, source, customIcons }: VectorLayerArguments) { - super({ layerDescriptor, source, customIcons }); - this._source = source as IMvtVectorSource; + constructor(args: VectorLayerArguments) { + super(args); + this._source = args.source as IMvtVectorSource; + } + + async getBounds(syncContext: DataRequestContext) { + // Add filter to narrow bounds to features with matching join keys + let joinKeyFilter; + if (this.getSource().isESSource()) { + const { join, joinPropertiesMap } = this._getJoinResults(); + if (join && joinPropertiesMap) { + const indexPattern = await (this.getSource() as IESSource).getIndexPattern(); + const joinField = getField(indexPattern, join.getLeftField().getName()); + joinKeyFilter = buildPhrasesFilter( + joinField, + Array.from(joinPropertiesMap.keys()), + indexPattern + ); + } + } + + return super.getBounds({ + ...syncContext, + dataFilters: { + ...syncContext.dataFilters, + joinKeyFilter, + }, + }); } getFeatureId(feature: Feature): string | number | undefined { @@ -203,6 +237,10 @@ export class MvtVectorLayer extends AbstractVectorLayer { source: this.getSource() as IMvtVectorSource, syncContext, }); + + if (this.hasJoins()) { + await this._syncJoins(syncContext, this.getCurrentStyle()); + } } _syncSourceBindingWithMb(mbMap: MbMap) { @@ -229,6 +267,7 @@ export class MvtVectorLayer extends AbstractVectorLayer { tiles: [sourceData.tileUrl], minzoom: sourceData.tileMinZoom, maxzoom: sourceData.tileMaxZoom, + promoteId: this._getSourcePromoteId(), }); } @@ -240,10 +279,99 @@ export class MvtVectorLayer extends AbstractVectorLayer { return this.getMbSourceId() === mbSourceId; } + _getJoinResults(): { + join?: InnerJoin; + joinPropertiesMap?: PropertiesMap; + joinRequestMeta?: DataRequestMeta; + } { + const joins = this.getValidJoins(); + if (!joins || !joins.length) { + return {}; + } + + const join = joins[0]; + const joinDataRequest = this.getDataRequest(join.getSourceDataRequestId()); + return { + join, + joinPropertiesMap: joinDataRequest?.getData() as PropertiesMap | undefined, + joinRequestMeta: joinDataRequest?.getMeta(), + }; + } + _getMbTooManyFeaturesLayerId() { return this.makeMbLayerId('toomanyfeatures'); } + _getJoinFilterExpression(): unknown | undefined { + const { join, joinPropertiesMap } = this._getJoinResults(); + if (!join) { + return undefined; + } + + // When there are no join results, return a filter that hides all features + // work around for 'match' with empty array not filtering out features + // This filter always returns false because features will never have `__kbn_never_prop__` property + const hideAllFilter = ['has', '__kbn_never_prop__']; + + if (!joinPropertiesMap) { + return hideAllFilter; + } + + const joinKeys = Array.from(joinPropertiesMap.keys()); + return joinKeys.length + ? // Unable to check FEATURE_VISIBLE_PROPERTY_NAME flag since filter expressions do not support feature-state + // Instead, remove unjoined source features by filtering out features without matching join keys + [ + 'match', + ['get', join.getLeftField().getName()], + joinKeys, + true, // match value + false, // fallback - value with no match + ] + : hideAllFilter; + } + + _syncFeatureState(mbMap: MbMap) { + const { joinPropertiesMap, joinRequestMeta } = this._getJoinResults(); + if (!joinPropertiesMap) { + return; + } + + const [firstKey] = joinPropertiesMap.keys(); + const firstKeyFeatureState = mbMap.getFeatureState({ + source: this.getMbSourceId(), + sourceLayer: this._source.getTileSourceLayer(), + id: firstKey, + }); + const joinRequestStopTime = joinRequestMeta?.requestStopTime; + if (firstKeyFeatureState?.requestStopTime === joinRequestStopTime) { + // Do not update feature state when it already contains current join results + return; + } + + // Clear existing feature state + mbMap.removeFeatureState({ + source: this.getMbSourceId(), + sourceLayer: this._source.getTileSourceLayer(), + // by omitting 'id' argument, all feature state is cleared for source + }); + + // Set feature state for join results + // reusing featureIdentifier to avoid creating new object in tight loops + const featureIdentifier: FeatureIdentifier = { + source: this.getMbSourceId(), + sourceLayer: this._source.getTileSourceLayer(), + id: undefined, + }; + joinPropertiesMap.forEach((value: object, key: string) => { + featureIdentifier.id = key; + mbMap.setFeatureState(featureIdentifier, { + ...value, + requestStopTime: joinRequestStopTime, + }); + }); + } + _syncStylePropertiesWithMb(mbMap: MbMap) { // @ts-ignore const mbSource = mbMap.getSource(this.getMbSourceId()); @@ -307,6 +435,18 @@ export class MvtVectorLayer extends AbstractVectorLayer { mbMap.setLayerZoomRange(tooManyFeaturesLayerId, this.getMinZoom(), this.getMaxZoom()); } + _getSourcePromoteId() { + const { join } = this._getJoinResults(); + return join + ? { + [this._source.getTileSourceLayer()]: join.getLeftField().getName(), + } + : undefined; + } + + // Maplibre does not expose API for updating source attributes. + // Must remove/add vector source to update source attributes. + // _requiresPrevSourceCleanup returns true when vector source needs to be removed so it can be re-added with updated attributes _requiresPrevSourceCleanup(mbMap: MbMap): boolean { const mbSource = mbMap.getSource(this.getMbSourceId()) as MbVectorSource | MbGeoJSONSource; if (!mbSource) { @@ -330,7 +470,8 @@ export class MvtVectorLayer extends AbstractVectorLayer { const isSourceDifferent = mbTileSource.tiles?.[0] !== sourceData.tileUrl || mbTileSource.minzoom !== sourceData.tileMinZoom || - mbTileSource.maxzoom !== sourceData.tileMaxZoom; + mbTileSource.maxzoom !== sourceData.tileMaxZoom || + !_.isEqual(mbTileSource.promoteId, this._getSourcePromoteId()); if (isSourceDifferent) { return true; @@ -360,13 +501,10 @@ export class MvtVectorLayer extends AbstractVectorLayer { syncLayerWithMB(mbMap: MbMap) { this._removeStaleMbSourcesAndLayers(mbMap); this._syncSourceBindingWithMb(mbMap); + this._syncFeatureState(mbMap); this._syncStylePropertiesWithMb(mbMap); } - getJoins() { - return []; - } - getMinZoom() { // higher resolution vector tiles cannot be displayed at lower-res return Math.max(this._source.getMinZoom(), super.getMinZoom()); @@ -377,6 +515,12 @@ export class MvtVectorLayer extends AbstractVectorLayer { } async getStyleMetaDescriptorFromLocalFeatures(): Promise { - return await this.getCurrentStyle().pluckStyleMetaFromTileMeta(this._getMetaFromTiles()); + const { joinPropertiesMap } = this._getJoinResults(); + return await pluckStyleMeta( + this._getMetaFromTiles(), + joinPropertiesMap, + await this.getSource().getSupportedShapeTypes(), + this.getCurrentStyle().getDynamicPropertiesArray() + ); } } diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/pluck_style_meta.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/pluck_style_meta.tsx new file mode 100644 index 0000000000000..1f9784fb65dc0 --- /dev/null +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/pluck_style_meta.tsx @@ -0,0 +1,110 @@ +/* + * Copyright 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 { FIELD_ORIGIN, VECTOR_SHAPE_TYPE } from '../../../../../common/constants'; +import { + Category, + DynamicStylePropertyOptions, + RangeFieldMeta, + StyleMetaDescriptor, + TileMetaFeature, +} from '../../../../../common/descriptor_types'; +import { PropertiesMap } from '../../../../../common/elasticsearch_util'; +import { IDynamicStyleProperty } from '../../../styles/vector/properties/dynamic_style_property'; + +export async function pluckStyleMeta( + metaFeatures: TileMetaFeature[], + joinPropertiesMap: PropertiesMap | undefined, + supportedShapeTypes: VECTOR_SHAPE_TYPE[], + dynamicProperties: Array> +): Promise { + const styleMeta: StyleMetaDescriptor = { + geometryTypes: { + isPointsOnly: + supportedShapeTypes.length === 1 && supportedShapeTypes.includes(VECTOR_SHAPE_TYPE.POINT), + isLinesOnly: + supportedShapeTypes.length === 1 && supportedShapeTypes.includes(VECTOR_SHAPE_TYPE.LINE), + isPolygonsOnly: + supportedShapeTypes.length === 1 && supportedShapeTypes.includes(VECTOR_SHAPE_TYPE.POLYGON), + }, + fieldMeta: {}, + }; + + if (dynamicProperties.length === 0 || !metaFeatures) { + // no additional meta data to pull from source data request. + return styleMeta; + } + + dynamicProperties.forEach((dynamicProperty) => { + const name = dynamicProperty.getFieldName(); + if (!styleMeta.fieldMeta[name]) { + styleMeta.fieldMeta[name] = { categories: [] }; + } + + const categories = pluckCategoricalStyleMeta(dynamicProperty, metaFeatures, joinPropertiesMap); + if (categories.length) { + styleMeta.fieldMeta[name].categories = categories; + } + const ordinalStyleMeta = pluckOrdinalStyleMeta( + dynamicProperty, + metaFeatures, + joinPropertiesMap + ); + if (ordinalStyleMeta) { + styleMeta.fieldMeta[name].range = ordinalStyleMeta; + } + }); + + return styleMeta; +} + +function pluckCategoricalStyleMeta( + property: IDynamicStyleProperty, + metaFeatures: TileMetaFeature[], + joinPropertiesMap: PropertiesMap | undefined +): Category[] { + return []; +} + +function pluckOrdinalStyleMeta( + property: IDynamicStyleProperty, + metaFeatures: TileMetaFeature[], + joinPropertiesMap: PropertiesMap | undefined +): RangeFieldMeta | null { + const field = property.getField(); + if (!field || !property.isOrdinal()) { + return null; + } + + let min = Infinity; + let max = -Infinity; + if (property.getFieldOrigin() === FIELD_ORIGIN.SOURCE) { + for (let i = 0; i < metaFeatures.length; i++) { + const range = field.pluckRangeFromTileMetaFeature(metaFeatures[i]); + if (range) { + min = Math.min(range.min, min); + max = Math.max(range.max, max); + } + } + } else if (property.getFieldOrigin() === FIELD_ORIGIN.JOIN && joinPropertiesMap) { + joinPropertiesMap.forEach((value: { [key: string]: unknown }) => { + const propertyValue = value[field.getName()]; + if (typeof propertyValue === 'number') { + min = Math.min(propertyValue as number, min); + max = Math.max(propertyValue as number, max); + } + }); + } + + return min === Infinity || max === -Infinity + ? null + : { + min, + max, + delta: max - min, + }; +} diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/types.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/types.ts new file mode 100644 index 0000000000000..0c368de63fe16 --- /dev/null +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/types.ts @@ -0,0 +1,15 @@ +/* + * Copyright 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 { InnerJoin } from '../../joins/inner_join'; +import { PropertiesMap } from '../../../../common/elasticsearch_util'; + +export interface JoinState { + dataHasChanged: boolean; + join: InnerJoin; + propertiesMap?: PropertiesMap; +} diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx index a66135748c521..23c76924e911e 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx @@ -44,6 +44,7 @@ import { ESTermSourceDescriptor, JoinDescriptor, StyleMetaDescriptor, + VectorJoinSourceRequestMeta, VectorLayerDescriptor, VectorSourceRequestMeta, VectorStyleRequestMeta, @@ -60,6 +61,9 @@ import { ITermJoinSource } from '../../sources/term_join_source'; import { buildVectorRequestMeta } from '../build_vector_request_meta'; import { getJoinAggKey } from '../../../../common/get_agg_key'; import { syncBoundsData } from './bounds_data'; +import { JoinState } from './types'; +import { canSkipSourceUpdate } from '../../util/can_skip_fetch'; +import { PropertiesMap } from '../../../../common/elasticsearch_util'; const SUPPORTS_FEATURE_EDITING_REQUEST_ID = 'SUPPORTS_FEATURE_EDITING_REQUEST_ID'; @@ -530,6 +534,118 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { } } + async _syncJoin({ + join, + startLoading, + stopLoading, + onLoadError, + registerCancelCallback, + dataFilters, + isForceRefresh, + }: { join: InnerJoin } & DataRequestContext): Promise { + const joinSource = join.getRightJoinSource(); + const sourceDataId = join.getSourceDataRequestId(); + const requestToken = Symbol(`layer-join-refresh:${this.getId()} - ${sourceDataId}`); + + const joinRequestMeta: VectorJoinSourceRequestMeta = buildVectorRequestMeta( + joinSource, + joinSource.getFieldNames(), + dataFilters, + joinSource.getWhereQuery(), + isForceRefresh + ) as VectorJoinSourceRequestMeta; + + const prevDataRequest = this.getDataRequest(sourceDataId); + const canSkipFetch = await canSkipSourceUpdate({ + source: joinSource, + prevDataRequest, + nextRequestMeta: joinRequestMeta, + extentAware: false, // join-sources are term-aggs that are spatially unaware (e.g. ESTermSource/TableSource). + getUpdateDueToTimeslice: () => { + return true; + }, + }); + + if (canSkipFetch) { + return { + dataHasChanged: false, + join, + propertiesMap: prevDataRequest?.getData() as PropertiesMap, + }; + } + + try { + startLoading(sourceDataId, requestToken, joinRequestMeta); + const leftSourceName = await this._source.getDisplayName(); + const propertiesMap = await joinSource.getPropertiesMap( + joinRequestMeta, + leftSourceName, + join.getLeftField().getName(), + registerCancelCallback.bind(null, requestToken) + ); + stopLoading(sourceDataId, requestToken, propertiesMap); + return { + dataHasChanged: true, + join, + propertiesMap, + }; + } catch (error) { + if (!(error instanceof DataRequestAbortError)) { + onLoadError(sourceDataId, requestToken, `Join error: ${error.message}`); + } + throw error; + } + } + + async _syncJoins(syncContext: DataRequestContext, style: IVectorStyle) { + const joinSyncs = this.getValidJoins().map(async (join) => { + await this._syncJoinStyleMeta(syncContext, join, style); + await this._syncJoinFormatters(syncContext, join, style); + return this._syncJoin({ join, ...syncContext }); + }); + + return await Promise.all(joinSyncs); + } + + async _syncJoinStyleMeta(syncContext: DataRequestContext, join: InnerJoin, style: IVectorStyle) { + const joinSource = join.getRightJoinSource(); + return this._syncStyleMeta({ + source: joinSource, + style, + sourceQuery: joinSource.getWhereQuery(), + dataRequestId: join.getSourceMetaDataRequestId(), + dynamicStyleProps: this.getCurrentStyle() + .getDynamicPropertiesArray() + .filter((dynamicStyleProp) => { + const matchingField = joinSource.getFieldByName(dynamicStyleProp.getFieldName()); + return ( + dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.JOIN && + !!matchingField && + dynamicStyleProp.isFieldMetaEnabled() + ); + }), + ...syncContext, + }); + } + + async _syncJoinFormatters(syncContext: DataRequestContext, join: InnerJoin, style: IVectorStyle) { + const joinSource = join.getRightJoinSource(); + return this._syncFormatters({ + source: joinSource, + dataRequestId: join.getSourceFormattersDataRequestId(), + fields: style + .getDynamicPropertiesArray() + .filter((dynamicStyleProp) => { + const matchingField = joinSource.getFieldByName(dynamicStyleProp.getFieldName()); + return dynamicStyleProp.getFieldOrigin() === FIELD_ORIGIN.JOIN && !!matchingField; + }) + .map((dynamicStyleProp) => { + return dynamicStyleProp.getField()!; + }), + ...syncContext, + }); + } + async _syncSupportsFeatureEditing({ syncContext, source, @@ -557,6 +673,10 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { } } + _getJoinFilterExpression(): unknown | undefined { + return undefined; + } + _setMbPointsProperties( mbMap: MbMap, mvtSourceLayer?: string, @@ -611,7 +731,10 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { } } - const filterExpr = getPointFilterExpression(this.hasJoins(), timesliceMaskConfig); + const filterExpr = getPointFilterExpression( + this._getJoinFilterExpression(), + timesliceMaskConfig + ); if (!_.isEqual(filterExpr, mbMap.getFilter(markerLayerId))) { mbMap.setFilter(markerLayerId, filterExpr); } @@ -644,7 +767,6 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { const fillLayerId = this._getMbPolygonLayerId(); const lineLayerId = this._getMbLineLayerId(); - const hasJoins = this.hasJoins(); if (!mbMap.getLayer(fillLayerId)) { const mbLayer: MbLayer = { id: fillLayerId, @@ -677,16 +799,18 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { lineLayerId, }); + const joinFilter = this._getJoinFilterExpression(); + this.syncVisibilityWithMb(mbMap, fillLayerId); mbMap.setLayerZoomRange(fillLayerId, this.getMinZoom(), this.getMaxZoom()); - const fillFilterExpr = getFillFilterExpression(hasJoins, timesliceMaskConfig); + const fillFilterExpr = getFillFilterExpression(joinFilter, timesliceMaskConfig); if (!_.isEqual(fillFilterExpr, mbMap.getFilter(fillLayerId))) { mbMap.setFilter(fillLayerId, fillFilterExpr); } this.syncVisibilityWithMb(mbMap, lineLayerId); mbMap.setLayerZoomRange(lineLayerId, this.getMinZoom(), this.getMaxZoom()); - const lineFilterExpr = getLineFilterExpression(hasJoins, timesliceMaskConfig); + const lineFilterExpr = getLineFilterExpression(joinFilter, timesliceMaskConfig); if (!_.isEqual(lineFilterExpr, mbMap.getFilter(lineLayerId))) { mbMap.setFilter(lineLayerId, lineFilterExpr); } @@ -713,8 +837,8 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { const isSourceGeoJson = !this.getSource().isMvt(); const filterExpr = getLabelFilterExpression( - this.hasJoins(), isSourceGeoJson, + this._getJoinFilterExpression(), timesliceMaskConfig ); if (!_.isEqual(filterExpr, mbMap.getFilter(labelLayerId))) { diff --git a/x-pack/plugins/maps/public/classes/layers/wizards/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts b/x-pack/plugins/maps/public/classes/layers/wizards/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts index dc647089b3516..92045f5911176 100644 --- a/x-pack/plugins/maps/public/classes/layers/wizards/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts +++ b/x-pack/plugins/maps/public/classes/layers/wizards/choropleth_layer_wizard/create_choropleth_layer_descriptor.ts @@ -21,6 +21,7 @@ import { CountAggDescriptor, EMSFileSourceDescriptor, ESSearchSourceDescriptor, + VectorStylePropertiesDescriptor, } from '../../../../../common/descriptor_types'; import { VectorStyle } from '../../../styles/vector/vector_style'; import { GeoJsonVectorLayer } from '../../vector_layer'; @@ -37,12 +38,14 @@ function createChoroplethLayerDescriptor({ rightIndexPatternId, rightIndexPatternTitle, rightTermField, + setLabelStyle, }: { sourceDescriptor: EMSFileSourceDescriptor | ESSearchSourceDescriptor; leftField: string; rightIndexPatternId: string; rightIndexPatternTitle: string; rightTermField: string; + setLabelStyle: boolean; }) { const metricsDescriptor: CountAggDescriptor = { type: AGG_TYPE.COUNT }; const joinId = uuid(); @@ -51,6 +54,40 @@ function createChoroplethLayerDescriptor({ aggFieldName: '', rightSourceId: joinId, }); + + const styleProperties: Partial = { + [VECTOR_STYLES.FILL_COLOR]: { + type: STYLE_TYPE.DYNAMIC, + options: { + ...(defaultDynamicProperties[VECTOR_STYLES.FILL_COLOR].options as ColorDynamicOptions), + field: { + name: joinKey, + origin: FIELD_ORIGIN.JOIN, + }, + color: 'Yellow to Red', + type: COLOR_MAP_TYPE.ORDINAL, + }, + }, + [VECTOR_STYLES.LINE_COLOR]: { + type: STYLE_TYPE.STATIC, + options: { + color: '#3d3d3d', + }, + }, + }; + if (setLabelStyle) { + styleProperties[VECTOR_STYLES.LABEL_TEXT] = { + type: STYLE_TYPE.DYNAMIC, + options: { + ...defaultDynamicProperties[VECTOR_STYLES.LABEL_TEXT].options, + field: { + name: joinKey, + origin: FIELD_ORIGIN.JOIN, + }, + }, + }; + } + return GeoJsonVectorLayer.createDescriptor({ joins: [ { @@ -69,36 +106,7 @@ function createChoroplethLayerDescriptor({ }, ], sourceDescriptor, - style: VectorStyle.createDescriptor({ - [VECTOR_STYLES.FILL_COLOR]: { - type: STYLE_TYPE.DYNAMIC, - options: { - ...(defaultDynamicProperties[VECTOR_STYLES.FILL_COLOR].options as ColorDynamicOptions), - field: { - name: joinKey, - origin: FIELD_ORIGIN.JOIN, - }, - color: 'Yellow to Red', - type: COLOR_MAP_TYPE.ORDINAL, - }, - }, - [VECTOR_STYLES.LINE_COLOR]: { - type: STYLE_TYPE.STATIC, - options: { - color: '#3d3d3d', - }, - }, - [VECTOR_STYLES.LABEL_TEXT]: { - type: STYLE_TYPE.DYNAMIC, - options: { - ...defaultDynamicProperties[VECTOR_STYLES.LABEL_TEXT].options, - field: { - name: joinKey, - origin: FIELD_ORIGIN.JOIN, - }, - }, - }, - }), + style: VectorStyle.createDescriptor(styleProperties), }); } @@ -124,6 +132,7 @@ export function createEmsChoroplethLayerDescriptor({ rightIndexPatternId, rightIndexPatternTitle, rightTermField, + setLabelStyle: true, }); } @@ -146,7 +155,7 @@ export function createEsChoroplethLayerDescriptor({ sourceDescriptor: ESSearchSource.createDescriptor({ indexPatternId: leftIndexPatternId, geoField: leftGeoField, - scalingType: SCALING_TYPES.LIMIT, + scalingType: SCALING_TYPES.MVT, tooltipProperties: [leftJoinField], applyGlobalQuery: false, applyGlobalTime: false, @@ -156,5 +165,6 @@ export function createEsChoroplethLayerDescriptor({ rightIndexPatternId, rightIndexPatternTitle, rightTermField, + setLabelStyle: false, // Styling label by join metric with MVT is not supported }); } diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap b/x-pack/plugins/maps/public/classes/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap index 0ff94163f9230..60d7be79d35e3 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/__snapshots__/update_source_editor.test.js.snap @@ -95,6 +95,7 @@ exports[`should enable sort order select when sort field provided 1`] = ` clusteringDisabledReason={null} filterByMapBounds={true} indexPatternId="indexPattern1" + numberOfJoins={0} onChange={[Function]} scalingType="LIMIT" supportsClustering={false} @@ -200,6 +201,7 @@ exports[`should render update source editor 1`] = ` clusteringDisabledReason={null} filterByMapBounds={true} indexPatternId="indexPattern1" + numberOfJoins={0} onChange={[Function]} scalingType="LIMIT" supportsClustering={false} diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts index 6983c1d43faa2..54071848f9a40 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.test.ts @@ -146,14 +146,21 @@ describe('ESSearchSource', () => { }); expect(esSearchSource.getJoinsDisabledReason()).toBe(null); }); - it('mvt', () => { + it('blended layer', () => { const esSearchSource = new ESSearchSource({ ...mockDescriptor, - scalingType: SCALING_TYPES.MVT, + scalingType: SCALING_TYPES.CLUSTERS, }); expect(esSearchSource.getJoinsDisabledReason()).toBe( - 'Joins are not supported when scaling by vector tiles' + 'Joins are not supported when scaling by clusters' ); }); + it('mvt', () => { + const esSearchSource = new ESSearchSource({ + ...mockDescriptor, + scalingType: SCALING_TYPES.MVT, + }); + expect(esSearchSource.getJoinsDisabledReason()).toBe(null); + }); }); }); diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx index 34bd92a428a58..f021772e59756 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/es_search_source.tsx @@ -181,8 +181,7 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource sortOrder={this._descriptor.sortOrder} scalingType={this._descriptor.scalingType} filterByMapBounds={this.isFilterByMapBounds()} - hasJoins={sourceEditorArgs.hasJoins} - clearJoins={sourceEditorArgs.clearJoins} + numberOfJoins={sourceEditorArgs.numberOfJoins} /> ); } @@ -759,10 +758,6 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource reason = i18n.translate('xpack.maps.source.esSearch.joinsDisabledReason', { defaultMessage: 'Joins are not supported when scaling by clusters', }); - } else if (this._descriptor.scalingType === SCALING_TYPES.MVT) { - reason = i18n.translate('xpack.maps.source.esSearch.joinsDisabledReasonMvt', { - defaultMessage: 'Joins are not supported when scaling by vector tiles', - }); } else { reason = null; } diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.js b/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.js index aa31e9ef85947..7addffc286bd0 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.js +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.js @@ -35,8 +35,7 @@ export class UpdateSourceEditor extends Component { sortOrder: PropTypes.string.isRequired, scalingType: PropTypes.string.isRequired, source: PropTypes.object, - hasJoins: PropTypes.bool.isRequired, - clearJoins: PropTypes.func.isRequired, + numberOfJoins: PropTypes.number.isRequired, }; state = { @@ -207,8 +206,7 @@ export class UpdateSourceEditor extends Component { scalingType={this.props.scalingType} supportsClustering={this.state.supportsClustering} clusteringDisabledReason={this.state.clusteringDisabledReason} - hasJoins={this.props.hasJoins} - clearJoins={this.props.clearJoins} + numberOfJoins={this.props.numberOfJoins} /> ); diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.test.js b/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.test.js index cfc2090f537f2..264bb0d95c2a9 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.test.js +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/update_source_editor.test.js @@ -26,6 +26,7 @@ const defaultProps = { tooltipFields: [], sortOrder: 'DESC', scalingType: SCALING_TYPES.LIMIT, + numberOfJoins: 0, }; test('should render update source editor', async () => { diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_documenation_popover.tsx b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_documenation_popover.tsx index 1733856a4734d..3da6099f71bf7 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_documenation_popover.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_documenation_popover.tsx @@ -43,19 +43,19 @@ export class ScalingDocumenationPopover extends Component {
-
{this.props.mvtOptionLabel}
+
{this.props.mvtOptionLabel} (Default)

@@ -88,9 +88,35 @@ export class ScalingDocumenationPopover extends Component {

+

    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +

diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.test.tsx b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.test.tsx index aa3c7b51df5bb..38137ffcd72df 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.test.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.test.tsx @@ -26,8 +26,7 @@ const defaultProps = { scalingType: SCALING_TYPES.LIMIT, supportsClustering: true, termFields: [], - hasJoins: false, - clearJoins: () => {}, + numberOfJoins: 0, }; describe('scaling form', () => { diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx index fcf915618a0b7..a76c1e8c7b609 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/scaling_form.tsx @@ -35,19 +35,20 @@ interface Props { scalingType: SCALING_TYPES; supportsClustering: boolean; clusteringDisabledReason?: string | null; - hasJoins: boolean; - clearJoins: () => void; + numberOfJoins: number; } interface State { nextScalingType?: SCALING_TYPES; maxResultWindow: string; showModal: boolean; + modalMsg: string | null; } export class ScalingForm extends Component { state: State = { maxResultWindow: DEFAULT_MAX_RESULT_WINDOW.toLocaleString(), + modalMsg: null, showModal: false, }; _isMounted = false; @@ -74,8 +75,23 @@ export class ScalingForm extends Component { } _onScalingTypeSelect = (optionId: SCALING_TYPES): void => { - if (this.props.hasJoins && optionId !== SCALING_TYPES.LIMIT) { - this._openModal(optionId); + if (this.props.numberOfJoins > 0 && optionId === SCALING_TYPES.CLUSTERS) { + this._openModal( + optionId, + i18n.translate('xpack.maps.source.esSearch.clusterScalingJoinMsg', { + defaultMessage: `Scaling with clusters does not support term joins. Switching to clusters will remove all term joins from your layer configuration.`, + }) + ); + } else if (this.props.numberOfJoins > 1 && optionId === SCALING_TYPES.MVT) { + this._openModal( + optionId, + i18n.translate('xpack.maps.source.esSearch.mvtScalingJoinMsg', { + defaultMessage: `Vector tiles support one term join. Your layer has {numberOfJoins} term joins. Switching to vector tiles will keep the first term join and remove all other term joins from your layer configuration.`, + values: { + numberOfJoins: this.props.numberOfJoins, + }, + }) + ); } else { this._onScalingTypeChange(optionId); } @@ -98,8 +114,9 @@ export class ScalingForm extends Component { this.props.onChange({ propName: 'filterByMapBounds', value: event.target.checked }); }; - _openModal = (optionId: SCALING_TYPES) => { + _openModal = (optionId: SCALING_TYPES, modalMsg: string) => { this.setState({ + modalMsg, nextScalingType: optionId, showModal: true, }); @@ -107,14 +124,16 @@ export class ScalingForm extends Component { _closeModal = () => { this.setState({ + modalMsg: null, nextScalingType: undefined, showModal: false, }); }; _acceptModal = () => { - this.props.clearJoins(); - this._onScalingTypeChange(this.state.nextScalingType!); + if (this.state.nextScalingType) { + this._onScalingTypeChange(this.state.nextScalingType); + } this._closeModal(); }; @@ -139,22 +158,14 @@ export class ScalingForm extends Component { } _renderModal() { - if (!this.state.showModal || this.state.nextScalingType === undefined) { + if (!this.state.showModal || !this.state.modalMsg || this.state.nextScalingType === undefined) { return null; } - const scalingOptionLabel = - this.state.nextScalingType === SCALING_TYPES.CLUSTERS - ? i18n.translate('xpack.maps.source.esSearch.scalingModal.clusters', { - defaultMessage: `clusters`, - }) - : i18n.translate('xpack.maps.source.esSearch.scalingModal.vectorTiles', { - defaultMessage: `vector tiles`, - }); return ( { buttonColor="danger" defaultFocusedButton="cancel" > -

- -

+

{this.state.modalMsg}

); } diff --git a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts index 512f7c6bc1501..c0eef8ba1ca22 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts @@ -214,6 +214,9 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource const indexPattern = await this.getIndexPattern(); const globalFilters: Filter[] = searchFilters.applyGlobalQuery ? searchFilters.filters : []; const allFilters: Filter[] = [...globalFilters]; + if (searchFilters.joinKeyFilter) { + allFilters.push(searchFilters.joinKeyFilter); + } if (this.isFilterByMapBounds() && 'buffer' in searchFilters && searchFilters.buffer) { // buffer can be empty const geoField = await this._getGeoField(); diff --git a/x-pack/plugins/maps/public/classes/sources/source.ts b/x-pack/plugins/maps/public/classes/sources/source.ts index 56a49dd3d5fa6..0e5e7174707d1 100644 --- a/x-pack/plugins/maps/public/classes/sources/source.ts +++ b/x-pack/plugins/maps/public/classes/sources/source.ts @@ -29,9 +29,8 @@ export type OnSourceChangeArgs = { }; export type SourceEditorArgs = { - clearJoins: () => void; currentLayerType: string; - hasJoins: boolean; + numberOfJoins: number; onChange: (...args: OnSourceChangeArgs[]) => Promise; }; diff --git a/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx b/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx index 321e10f19885f..79830068628e5 100644 --- a/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx +++ b/x-pack/plugins/maps/public/classes/sources/vector_source/vector_source.tsx @@ -42,6 +42,7 @@ export interface BoundsRequestMeta { sourceQuery?: Query; timeFilters: TimeRange; timeslice?: Timeslice; + joinKeyFilter?: Filter; } export interface IVectorSource extends ISource { diff --git a/x-pack/plugins/maps/public/classes/styles/vector/components/__snapshots__/vector_style_editor.test.tsx.snap b/x-pack/plugins/maps/public/classes/styles/vector/components/__snapshots__/vector_style_editor.test.tsx.snap index be8c9b0750b94..a95c8194ffdb3 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/components/__snapshots__/vector_style_editor.test.tsx.snap +++ b/x-pack/plugins/maps/public/classes/styles/vector/components/__snapshots__/vector_style_editor.test.tsx.snap @@ -24,6 +24,7 @@ exports[`should render 1`] = ` fields={ Array [ Object { + "isUnsupported": false, "label": "field0", "name": "field0", "origin": "source", @@ -82,6 +83,7 @@ exports[`should render 1`] = ` fields={ Array [ Object { + "isUnsupported": false, "label": "field0", "name": "field0", "origin": "source", @@ -168,6 +170,7 @@ exports[`should render 1`] = ` fields={ Array [ Object { + "isUnsupported": false, "label": "field0", "name": "field0", "origin": "source", @@ -212,6 +215,7 @@ exports[`should render 1`] = ` fields={ Array [ Object { + "isUnsupported": false, "label": "field0", "name": "field0", "origin": "source", @@ -306,6 +310,7 @@ exports[`should render 1`] = ` fields={ Array [ Object { + "isUnsupported": false, "label": "field0", "name": "field0", "origin": "source", diff --git a/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx b/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx index 8f61bfd35be85..3de0292292b41 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx @@ -51,7 +51,12 @@ function groupFieldsByOrigin(fields: StyleField[]) { function fieldsListToOptions(fieldsList: StyleField[]) { return fieldsList .map((field) => { - return { value: field, label: field.label }; + return { + value: field, + label: field.label, + disabled: field.isUnsupported, + title: field.unsupportedMsg, + }; }) .sort((a, b) => { return a.label.toLowerCase().localeCompare(b.label.toLowerCase()); diff --git a/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.test.tsx b/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.test.tsx index 8edb67703a4d1..8d5df5fbad54d 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.test.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.test.tsx @@ -49,6 +49,9 @@ function createLayerMock(numFields: number, supportedShapeTypes: VECTOR_SHAPE_TY getSupportedShapeTypes: async () => { return supportedShapeTypes; }, + isMvt: () => { + return false; + }, } as unknown as IVectorSource; }, } as unknown as IVectorLayer; diff --git a/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.tsx b/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.tsx index 4431cead9b0d1..daf307e85ffc1 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/components/vector_style_editor.tsx @@ -179,7 +179,14 @@ export class VectorStyleEditor extends Component { return labelBorderSize.getOptions().size !== LABEL_BORDER_SIZES.NONE; } + _isLayerSourceMvt() { + return this.props.layer.getSource().isMvt(); + } + _renderFillColor(isPointFillColor = false) { + const styleProperty = this.props.styleProperties[VECTOR_STYLES.FILL_COLOR] as IStyleProperty< + ColorDynamicOptions | ColorStaticOptions + >; return ( { swatches={DEFAULT_FILL_COLORS} onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} - styleProperty={ - this.props.styleProperties[VECTOR_STYLES.FILL_COLOR] as IStyleProperty< - ColorDynamicOptions | ColorStaticOptions - > - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.FILL_COLOR)} + styleProperty={styleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + styleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.FILL_COLOR].options as ColorStaticOptions } @@ -206,6 +212,9 @@ export class VectorStyleEditor extends Component { _renderLineColor(isPointBorderColor = false) { const disabledByIconSize = isPointBorderColor && !this._hasMarkerOrIcon(); + const styleProperty = this.props.styleProperties[VECTOR_STYLES.LINE_COLOR] as IStyleProperty< + ColorDynamicOptions | ColorStaticOptions + >; return ( { swatches={DEFAULT_LINE_COLORS} onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} - styleProperty={ - this.props.styleProperties[VECTOR_STYLES.LINE_COLOR] as IStyleProperty< - ColorDynamicOptions | ColorStaticOptions - > - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.LINE_COLOR)} + styleProperty={styleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + styleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.LINE_COLOR].options as ColorStaticOptions } @@ -231,18 +239,20 @@ export class VectorStyleEditor extends Component { } _renderLineWidth(isPointBorderWidth = false) { + const styleProperty = this.props.styleProperties[VECTOR_STYLES.LINE_WIDTH] as IStyleProperty< + SizeDynamicOptions | SizeStaticOptions + >; return ( - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.LINE_WIDTH)} + styleProperty={styleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + styleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.LINE_WIDTH].options as SizeStaticOptions } @@ -261,17 +271,28 @@ export class VectorStyleEditor extends Component { | DynamicTextProperty ); const hasLabelBorder = this._hasLabelBorder(); + const labelStyleProperty = this.props.styleProperties[ + VECTOR_STYLES.LABEL_TEXT + ] as IStyleProperty; + const labelColorStyleProperty = this.props.styleProperties[ + VECTOR_STYLES.LABEL_COLOR + ] as IStyleProperty; + const labelSizeStyleProperty = this.props.styleProperties[ + VECTOR_STYLES.LABEL_SIZE + ] as IStyleProperty; + const labelBorderColorProperty = this.props.styleProperties[ + VECTOR_STYLES.LABEL_BORDER_COLOR + ] as IStyleProperty; return ( - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.LABEL_TEXT)} + styleProperty={labelStyleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + labelStyleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.LABEL_TEXT] .options as LabelStaticOptions @@ -289,12 +310,11 @@ export class VectorStyleEditor extends Component { swatches={DEFAULT_LINE_COLORS} onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} - styleProperty={ - this.props.styleProperties[VECTOR_STYLES.LABEL_COLOR] as IStyleProperty< - ColorDynamicOptions | ColorStaticOptions - > - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.LABEL_COLOR)} + styleProperty={labelColorStyleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + labelColorStyleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.LABEL_COLOR] .options as ColorStaticOptions @@ -311,12 +331,11 @@ export class VectorStyleEditor extends Component { disabledBy={VECTOR_STYLES.LABEL_TEXT} onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} - styleProperty={ - this.props.styleProperties[VECTOR_STYLES.LABEL_SIZE] as IStyleProperty< - SizeDynamicOptions | SizeStaticOptions - > - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.LABEL_SIZE)} + styleProperty={labelSizeStyleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + labelSizeStyleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.LABEL_SIZE] .options as SizeStaticOptions @@ -334,12 +353,11 @@ export class VectorStyleEditor extends Component { swatches={DEFAULT_LINE_COLORS} onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} - styleProperty={ - this.props.styleProperties[VECTOR_STYLES.LABEL_BORDER_COLOR] as IStyleProperty< - ColorDynamicOptions | ColorStaticOptions - > - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.LABEL_BORDER_COLOR)} + styleProperty={labelBorderColorProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + labelBorderColorProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.LABEL_BORDER_COLOR] .options as ColorStaticOptions @@ -371,6 +389,10 @@ export class VectorStyleEditor extends Component { this.props.styleProperties[VECTOR_STYLES.SYMBOLIZE_AS] as SymbolizeAsProperty ).isSymbolizedAsIcon() ) { + const orientationStyleProperty = this.props.styleProperties[VECTOR_STYLES.ICON_ORIENTATION]; + const iconStyleProperty = this.props.styleProperties[VECTOR_STYLES.ICON] as IStyleProperty< + IconDynamicOptions | IconStaticOptions + >; iconOrientationEditor = ( { disabledBy={VECTOR_STYLES.ICON_SIZE} onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} - styleProperty={this.props.styleProperties[VECTOR_STYLES.ICON_ORIENTATION]} - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.ICON_ORIENTATION)} + styleProperty={orientationStyleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + orientationStyleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.ICON_ORIENTATION].options } @@ -399,12 +424,11 @@ export class VectorStyleEditor extends Component { onStaticStyleChange={this._onStaticStyleChange} onDynamicStyleChange={this._onDynamicStyleChange} onCustomIconsChange={this.props.onCustomIconsChange} - styleProperty={ - this.props.styleProperties[VECTOR_STYLES.ICON] as IStyleProperty< - IconDynamicOptions | IconStaticOptions - > - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.ICON)} + styleProperty={iconStyleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + iconStyleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.ICON].options as IconStaticOptions } @@ -417,6 +441,9 @@ export class VectorStyleEditor extends Component { ); } + const iconSizeStyleProperty = this.props.styleProperties[ + VECTOR_STYLES.ICON_SIZE + ] as IStyleProperty; return ( { - } - fields={this.state.styleFieldsHelper!.getFieldsForStyle(VECTOR_STYLES.ICON_SIZE)} + styleProperty={iconSizeStyleProperty} + fields={this.state.styleFieldsHelper!.getFieldsForStyle( + iconSizeStyleProperty, + this._isLayerSourceMvt() + )} defaultStaticStyleOptions={ this.state.defaultStaticProperties[VECTOR_STYLES.ICON_SIZE].options as SizeStaticOptions } diff --git a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_color_property.test.tsx b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_color_property.test.tsx index 710824d0e1414..3dd8628339803 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_color_property.test.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_color_property.test.tsx @@ -13,7 +13,6 @@ jest.mock('../components/vector_style_editor', () => ({ import React from 'react'; import { shallow } from 'enzyme'; -import { Feature, Point } from 'geojson'; import { DynamicColorProperty } from './dynamic_color_property'; import { @@ -208,38 +207,6 @@ describe('renderLegendDetailRow', () => { }); }); -function makeFeatures(foobarPropValues: string[]) { - return foobarPropValues.map((value: string) => { - return { - type: 'Feature', - geometry: { - type: 'Point', - coordinates: [-10, 0], - } as Point, - properties: { - foobar: value, - }, - } as Feature; - }); -} - -test('Should pluck the categorical style-meta', async () => { - const colorStyle = makeProperty({ - type: COLOR_MAP_TYPE.CATEGORICAL, - colorCategory: 'palette_0', - fieldMetaOptions, - }); - - const features = makeFeatures(['CN', 'CN', 'US', 'CN', 'US', 'IN']); - const meta = colorStyle.pluckCategoricalStyleMetaFromFeatures(features); - - expect(meta).toEqual([ - { key: 'CN', count: 3 }, - { key: 'US', count: 2 }, - { key: 'IN', count: 1 }, - ]); -}); - test('Should pluck the categorical style-meta from fieldmeta', async () => { const colorStyle = makeProperty({ type: COLOR_MAP_TYPE.CATEGORICAL, diff --git a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_orientation_property.ts b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_orientation_property.ts index afa034b4d395c..1759af0c0f0e9 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_orientation_property.ts +++ b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_orientation_property.ts @@ -6,9 +6,8 @@ */ import type { Map as MbMap } from '@kbn/mapbox-gl'; -import { DynamicStyleProperty, getNumericalMbFeatureStateValue } from './dynamic_style_property'; +import { DynamicStyleProperty } from './dynamic_style_property'; import { OrientationDynamicOptions } from '../../../../../common/descriptor_types'; -import { RawValue } from '../../../../../common/constants'; export class DynamicOrientationProperty extends DynamicStyleProperty { syncIconRotationWithMb(symbolLayerId: string, mbMap: MbMap) { @@ -28,11 +27,7 @@ export class DynamicOrientationProperty extends DynamicStyleProperty extends IStyleProperty { getFieldOrigin(): FIELD_ORIGIN | null; getRangeFieldMeta(): RangeFieldMeta | null; getCategoryFieldMeta(): Category[]; + /* * Returns hash that signals style meta needs to be re-fetched when value changes */ getStyleMetaHash(): string; isFieldMetaEnabled(): boolean; + isCategorical(): boolean; isOrdinal(): boolean; + getNumberOfCategories(): number; supportsFieldMeta(): boolean; + + /* + * Maplibre layers have two sub-properties that determine how data is rendered: layout and paint. + * + * Layout properties are applied early in the rendering process and define how data for that layer is passed to the GPU. + * Changes to a layout property require an asynchronous "layout" step. + * + * Paint properties are applied later in the rendering process. Changes to a paint property are cheap and happen synchronously. + * + * Paint properties support feature-state. Layout properties do not support feature-state + * + * Returns true when the style only sets paints properties. Returns false when the style sets any layout properties. + */ + supportsFeatureState(): boolean; + + /* + * Maplibre stores vector properties in 2 locations: feature.properties and feature-state + * + * Feature-state is a set of runtime defined attributes that can be dynamically assigned to a feature and used to style features. + * Feature-state is paired to a feature by feature id or feature.properties[promoteId] (when 'source.promoteId' is set). + * + * Feature-state provides a significant boost in performance allowing for the update of individual styles + * without the map rendering engine having to re-parse the underlying geometry and feature properties. + * + * 'paint' properties may retrieve style data from feature-state or feature.properties. + * 'layout' properties may only retrieve style from feature.properties. + * + * Returns true when style data is stored in feature-state. Returns false when style data is stored in feature.properties. + */ + usesFeatureState(): boolean; + getFieldMetaRequest(): Promise; - pluckOrdinalStyleMetaFromFeatures(features: Feature[]): RangeFieldMeta | null; - pluckCategoricalStyleMetaFromFeatures(features: Feature[]): Category[]; - pluckOrdinalStyleMetaFromTileMetaFeatures(metaFeatures: TileMetaFeature[]): RangeFieldMeta | null; - pluckCategoricalStyleMetaFromTileMetaFeatures(features: TileMetaFeature[]): Category[]; getValueSuggestions(query: string): Promise; enrichGeoJsonAndMbFeatureState( featureCollection: FeatureCollection, @@ -284,14 +313,20 @@ export class DynamicStyleProperty return null; } - supportsMbFeatureState() { - return !!this._field && !this._field.getSource().isMvt(); + supportsFeatureState() { + return true; + } + + usesFeatureState() { + if (!this._field) { + return false; + } + + return this._field.getSource().isMvt() ? false : this.supportsFeatureState(); } getMbLookupFunction(): MB_LOOKUP_FUNCTION { - return this.supportsMbFeatureState() - ? MB_LOOKUP_FUNCTION.FEATURE_STATE - : MB_LOOKUP_FUNCTION.GET; + return this.usesFeatureState() ? MB_LOOKUP_FUNCTION.FEATURE_STATE : MB_LOOKUP_FUNCTION.GET; } getFieldMetaOptions() { @@ -317,93 +352,6 @@ export class DynamicStyleProperty : DATA_MAPPING_FUNCTION.INTERPOLATE; } - pluckOrdinalStyleMetaFromTileMetaFeatures( - metaFeatures: TileMetaFeature[] - ): RangeFieldMeta | null { - if (!this._field || !this.isOrdinal()) { - return null; - } - - let min = Infinity; - let max = -Infinity; - for (let i = 0; i < metaFeatures.length; i++) { - const range = this._field.pluckRangeFromTileMetaFeature(metaFeatures[i]); - if (range) { - min = Math.min(range.min, min); - max = Math.max(range.max, max); - } - } - - return min === Infinity || max === -Infinity - ? null - : { - min, - max, - delta: max - min, - }; - } - - pluckCategoricalStyleMetaFromTileMetaFeatures(metaFeatures: TileMetaFeature[]): Category[] { - return []; - } - - pluckOrdinalStyleMetaFromFeatures(features: Feature[]): RangeFieldMeta | null { - if (!this.isOrdinal()) { - return null; - } - - const name = this.getFieldName(); - let min = Infinity; - let max = -Infinity; - for (let i = 0; i < features.length; i++) { - const feature = features[i]; - const newValue = feature.properties ? parseFloat(feature.properties[name]) : NaN; - if (!isNaN(newValue)) { - min = Math.min(min, newValue); - max = Math.max(max, newValue); - } - } - - return min === Infinity || max === -Infinity - ? null - : { - min, - max, - delta: max - min, - }; - } - - pluckCategoricalStyleMetaFromFeatures(features: Feature[]): Category[] { - const size = this.getNumberOfCategories(); - if (!this.isCategorical() || size <= 0) { - return []; - } - - const counts = new Map(); - for (let i = 0; i < features.length; i++) { - const feature = features[i]; - const term = feature.properties ? feature.properties[this.getFieldName()] : undefined; - // properties object may be sparse, so need to check if the field is effectively present - if (typeof term !== undefined) { - if (counts.has(term)) { - counts.set(term, counts.get(term) + 1); - } else { - counts.set(term, 1); - } - } - } - - const ordered: Category[] = []; - for (const [key, value] of counts) { - ordered.push({ key, count: value }); - } - - ordered.sort((a, b) => { - return b.count - a.count; - }); - return ordered.slice(0, size); - } - _pluckOrdinalStyleMetaFromFieldMetaData(styleMetaData: StyleMetaData): RangeFieldMeta | null { if (!this.isOrdinal() || !this._field) { return null; @@ -494,7 +442,7 @@ export class DynamicStyleProperty } let targetName; - if (this.supportsMbFeatureState()) { + if (this.usesFeatureState()) { // Base case for any properties that can support feature-state (e.g. color, size, ...) // They just re-use the original property-name targetName = this._field.getName(); @@ -512,10 +460,7 @@ export class DynamicStyleProperty } getMbPropertyValue(rawValue: RawValue): RawValue { - // Maps only uses feature-state for numerical values. - // `supportsMbFeatureState` will only return true when the mb-style rule does a feature-state lookup on a numerical value - // Calling `isOrdinal` would be equivalent. - return this.supportsMbFeatureState() ? getNumericalMbFeatureStateValue(rawValue) : rawValue; + return this.isOrdinal() ? getNumericalMbFeatureStateValue(rawValue) : rawValue; } enrichGeoJsonAndMbFeatureState( @@ -523,7 +468,7 @@ export class DynamicStyleProperty mbMap: MbMap, mbSourceId: string ): boolean { - const supportsFeatureState = this.supportsMbFeatureState(); + const usesFeatureState = this.usesFeatureState(); const featureIdentifier: FeatureIdentifier = { source: mbSourceId, id: undefined, @@ -534,7 +479,7 @@ export class DynamicStyleProperty const feature = featureCollection.features[i]; const rawValue = feature.properties ? feature.properties[this.getFieldName()] : undefined; const targetMbValue = this.getMbPropertyValue(rawValue); - if (supportsFeatureState) { + if (usesFeatureState) { featureState[targetMbName] = targetMbValue; // the same value will be potentially overridden multiple times, if the name remains identical featureIdentifier.id = feature.id; mbMap.setFeatureState(featureIdentifier, featureState); @@ -544,7 +489,7 @@ export class DynamicStyleProperty } } } - return supportsFeatureState; + return usesFeatureState; } } diff --git a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_text_property.ts b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_text_property.ts index daf9fa67d9ee7..55957c6e9721a 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_text_property.ts +++ b/x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_text_property.ts @@ -44,7 +44,7 @@ export class DynamicTextProperty extends DynamicStyleProperty { @@ -29,6 +35,7 @@ export async function createStyleFieldsHelper(fields: IField[]): Promise field.getName() === styleField.name); } - getFieldsForStyle(styleName: VECTOR_STYLES): StyleField[] { + _getFieldsForStyle(styleName: VECTOR_STYLES): StyleField[] { switch (styleName) { case VECTOR_STYLES.ICON_ORIENTATION: return this._numberFields; @@ -96,6 +103,37 @@ export class StyleFieldsHelper { } } + getFieldsForStyle( + styleProperty: IStyleProperty, + isLayerSourceMvt: boolean + ): StyleField[] { + const styleFields = this._getFieldsForStyle(styleProperty.getStyleName()); + return styleProperty.isDynamic() && + !(styleProperty as IDynamicStyleProperty).supportsFeatureState() + ? styleFields.map((styleField) => { + // It is not possible to fallback to feature.properties for maplibre 'vector' source + // Join fields that do not support feature-state can not be supported. + if (isLayerSourceMvt && styleField.origin === FIELD_ORIGIN.JOIN) { + return { + ...styleField, + isUnsupported: true, + unsupportedMsg: i18n.translate( + 'xpack.maps.style.field.unsupportedWithVectorTileMsg', + { + defaultMessage: `'{styleLabel}' does not support this field with vector tiles. To style '{styleLabel}' with this field, select 'Limit results' in 'Scaling'.`, + values: { + styleLabel: getVectorStyleLabel(styleProperty.getStyleName()), + }, + } + ), + }; + } + + return styleField; + }) + : styleFields; + } + getStyleFields(): StyleField[] { return this._styleFields; } diff --git a/x-pack/plugins/maps/public/classes/styles/vector/style_util.test.ts b/x-pack/plugins/maps/public/classes/styles/vector/style_util.test.ts index fc57f1b92f5af..a0de940b3dfd9 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/style_util.test.ts +++ b/x-pack/plugins/maps/public/classes/styles/vector/style_util.test.ts @@ -5,72 +5,7 @@ * 2.0. */ -import { isOnlySingleFeatureType, assignCategoriesToPalette, dynamicRound } from './style_util'; -import { VECTOR_SHAPE_TYPE } from '../../../../common/constants'; - -describe('isOnlySingleFeatureType', () => { - describe('source supports single feature type', () => { - const supportedFeatures = [VECTOR_SHAPE_TYPE.POINT]; - const hasFeatureType = { - [VECTOR_SHAPE_TYPE.POINT]: false, - [VECTOR_SHAPE_TYPE.LINE]: false, - [VECTOR_SHAPE_TYPE.POLYGON]: false, - }; - - test('Is only single feature type when only supported feature type is target feature type', () => { - expect( - isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.POINT, supportedFeatures, hasFeatureType) - ).toBe(true); - }); - - test('Is not single feature type when only supported feature type is not target feature type', () => { - expect( - isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.LINE, supportedFeatures, hasFeatureType) - ).toBe(false); - }); - }); - - describe('source supports multiple feature types', () => { - const supportedFeatures = [ - VECTOR_SHAPE_TYPE.POINT, - VECTOR_SHAPE_TYPE.LINE, - VECTOR_SHAPE_TYPE.POLYGON, - ]; - - test('Is only single feature type when data only has target feature type', () => { - const hasFeatureType = { - [VECTOR_SHAPE_TYPE.POINT]: true, - [VECTOR_SHAPE_TYPE.LINE]: false, - [VECTOR_SHAPE_TYPE.POLYGON]: false, - }; - expect( - isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.POINT, supportedFeatures, hasFeatureType) - ).toBe(true); - }); - - test('Is not single feature type when data has multiple feature types', () => { - const hasFeatureType = { - [VECTOR_SHAPE_TYPE.POINT]: true, - [VECTOR_SHAPE_TYPE.LINE]: true, - [VECTOR_SHAPE_TYPE.POLYGON]: true, - }; - expect( - isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.LINE, supportedFeatures, hasFeatureType) - ).toBe(false); - }); - - test('Is not single feature type when data does not have target feature types', () => { - const hasFeatureType = { - [VECTOR_SHAPE_TYPE.POINT]: false, - [VECTOR_SHAPE_TYPE.LINE]: true, - [VECTOR_SHAPE_TYPE.POLYGON]: false, - }; - expect( - isOnlySingleFeatureType(VECTOR_SHAPE_TYPE.POINT, supportedFeatures, hasFeatureType) - ).toBe(false); - }); - }); -}); +import { assignCategoriesToPalette, dynamicRound } from './style_util'; describe('assignCategoriesToPalette', () => { test('Categories and icons have same length', () => { diff --git a/x-pack/plugins/maps/public/classes/styles/vector/style_util.ts b/x-pack/plugins/maps/public/classes/styles/vector/style_util.ts index 11f564f436dd5..ec2ecadf70fe3 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/style_util.ts +++ b/x-pack/plugins/maps/public/classes/styles/vector/style_util.ts @@ -6,12 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { - ICON_SOURCE, - MB_LOOKUP_FUNCTION, - VECTOR_SHAPE_TYPE, - VECTOR_STYLES, -} from '../../../../common/constants'; +import { ICON_SOURCE, MB_LOOKUP_FUNCTION, VECTOR_STYLES } from '../../../../common/constants'; import { Category } from '../../../../common/descriptor_types'; import { StaticTextProperty } from './properties/static_text_property'; import { DynamicTextProperty } from './properties/dynamic_text_property'; @@ -30,23 +25,6 @@ export function getComputedFieldNamePrefix(fieldName: string) { return `__kbn__dynamic__${fieldName}`; } -export function isOnlySingleFeatureType( - featureType: VECTOR_SHAPE_TYPE, - supportedFeatures: VECTOR_SHAPE_TYPE[], - hasFeatureType: { [key in keyof typeof VECTOR_SHAPE_TYPE]: boolean } -): boolean { - if (supportedFeatures.length === 1) { - return supportedFeatures[0] === featureType; - } - - const featureTypes = Object.keys(hasFeatureType); - // @ts-expect-error - return featureTypes.reduce((accumulator: boolean, featureTypeKey: VECTOR_SHAPE_TYPE) => { - const hasFeature = hasFeatureType[featureTypeKey]; - return featureTypeKey === featureType ? accumulator && hasFeature : accumulator && !hasFeature; - }, true); -} - export function dynamicRound(value: number | string) { if (typeof value !== 'number') { return value; diff --git a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.test.js b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.test.js index c1aa8e395d8c0..caf0e13ce5a2f 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.test.js +++ b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.test.js @@ -6,7 +6,6 @@ */ import { VectorStyle } from './vector_style'; -import { DataRequest } from '../../util/data_request'; import { FIELD_ORIGIN, STYLE_TYPE, @@ -35,7 +34,15 @@ class MockSource { describe('getDescriptorWithUpdatedStyleProps', () => { const previousFieldName = 'doIStillExist'; const mapColors = []; - const layer = {}; + const layer = { + getSource: () => { + return { + isMvt: () => { + return false; + }, + }; + }, + }; const customIcons = []; const properties = { fillColor: { @@ -76,8 +83,8 @@ describe('getDescriptorWithUpdatedStyleProps', () => { const nextFields = [new MockField({ fieldName: previousFieldName, dataType: 'number' })]; const { hasChanges } = await vectorStyle.getDescriptorWithUpdatedStyleProps( nextFields, - previousFields, - mapColors + mapColors, + previousFields ); expect(hasChanges).toBe(false); }); @@ -89,7 +96,7 @@ describe('getDescriptorWithUpdatedStyleProps', () => { const nextFields = []; const { hasChanges, nextStyleDescriptor } = - await vectorStyle.getDescriptorWithUpdatedStyleProps(nextFields, previousFields, mapColors); + await vectorStyle.getDescriptorWithUpdatedStyleProps(nextFields, mapColors, previousFields); expect(hasChanges).toBe(true); expect(nextStyleDescriptor.properties[VECTOR_STYLES.LINE_COLOR]).toEqual({ options: { @@ -132,7 +139,7 @@ describe('getDescriptorWithUpdatedStyleProps', () => { }, ]; const { hasChanges, nextStyleDescriptor } = - await vectorStyle.getDescriptorWithUpdatedStyleProps(nextFields, previousFields, mapColors); + await vectorStyle.getDescriptorWithUpdatedStyleProps(nextFields, mapColors, previousFields); expect(hasChanges).toBe(true); expect(nextStyleDescriptor.properties[VECTOR_STYLES.ICON_SIZE]).toEqual({ options: { @@ -149,7 +156,7 @@ describe('getDescriptorWithUpdatedStyleProps', () => { const nextFields = [new MockField({ fieldName: 'someOtherField', dataType: 'number' })]; const { hasChanges, nextStyleDescriptor } = - await vectorStyle.getDescriptorWithUpdatedStyleProps(nextFields, previousFields, mapColors); + await vectorStyle.getDescriptorWithUpdatedStyleProps(nextFields, mapColors, previousFields); expect(hasChanges).toBe(true); expect(nextStyleDescriptor.properties[VECTOR_STYLES.LINE_COLOR]).toEqual({ options: { @@ -174,153 +181,3 @@ describe('getDescriptorWithUpdatedStyleProps', () => { }); }); }); - -describe('pluckStyleMetaFromSourceDataRequest', () => { - const layer = {}; - const customIcons = []; - describe('has features', () => { - it('Should identify when feature collection only contains points', async () => { - const sourceDataRequest = new DataRequest({ - data: { - type: 'FeatureCollection', - features: [ - { - geometry: { - type: 'Point', - }, - properties: {}, - }, - { - geometry: { - type: 'MultiPoint', - }, - properties: {}, - }, - ], - }, - }); - const vectorStyle = new VectorStyle({}, new MockSource(), layer, customIcons); - - const featuresMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest); - expect(featuresMeta.geometryTypes.isPointsOnly).toBe(true); - expect(featuresMeta.geometryTypes.isLinesOnly).toBe(false); - expect(featuresMeta.geometryTypes.isPolygonsOnly).toBe(false); - }); - - it('Should identify when feature collection only contains lines', async () => { - const sourceDataRequest = new DataRequest({ - data: { - type: 'FeatureCollection', - features: [ - { - geometry: { - type: 'LineString', - }, - properties: {}, - }, - { - geometry: { - type: 'MultiLineString', - }, - properties: {}, - }, - { - geometry: { - type: 'Point', - }, - properties: { - __kbn_is_centroid_feature__: true, - }, - }, - ], - }, - }); - const vectorStyle = new VectorStyle({}, new MockSource(), layer, customIcons); - - const featuresMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest); - expect(featuresMeta.geometryTypes.isPointsOnly).toBe(false); - expect(featuresMeta.geometryTypes.isLinesOnly).toBe(true); - expect(featuresMeta.geometryTypes.isPolygonsOnly).toBe(false); - }); - }); - - describe('scaled field range', () => { - const sourceDataRequest = new DataRequest({ - data: { - type: 'FeatureCollection', - features: [ - { - geometry: { - type: 'Point', - }, - properties: { - myDynamicField: 1, - }, - }, - { - geometry: { - type: 'Point', - }, - properties: { - myDynamicField: 10, - }, - }, - ], - }, - }); - - it('Should not extract scaled field range when scaled field has no values', async () => { - const vectorStyle = new VectorStyle( - { - properties: { - fillColor: { - type: STYLE_TYPE.DYNAMIC, - options: { - field: { - origin: FIELD_ORIGIN.SOURCE, - name: 'myDynamicFieldWithNoValues', - }, - }, - }, - }, - }, - new MockSource(), - layer, - customIcons - ); - - const featuresMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest); - expect(featuresMeta.geometryTypes.isPointsOnly).toBe(true); - expect(featuresMeta.geometryTypes.isLinesOnly).toBe(false); - expect(featuresMeta.geometryTypes.isPolygonsOnly).toBe(false); - }); - - it('Should extract scaled field range', async () => { - const vectorStyle = new VectorStyle( - { - properties: { - fillColor: { - type: STYLE_TYPE.DYNAMIC, - options: { - field: { - origin: FIELD_ORIGIN.SOURCE, - name: 'myDynamicField', - }, - }, - }, - }, - }, - new MockSource(), - layer, - customIcons - ); - - const styleMeta = await vectorStyle.pluckStyleMetaFromSourceDataRequest(sourceDataRequest); - expect(styleMeta.fieldMeta.myDynamicField.range).toEqual({ - delta: 9, - max: 10, - min: 1, - }); - }); - }); -}); diff --git a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx index 52209563e9807..395f8b6391cad 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/vector_style.tsx @@ -19,13 +19,10 @@ import { import { DEFAULT_ICON, FIELD_ORIGIN, - GEO_JSON_TYPE, ICON_SOURCE, - KBN_IS_CENTROID_FEATURE, LAYER_STYLE_TYPE, SOURCE_FORMATTERS_DATA_REQUEST_ID, STYLE_TYPE, - VECTOR_SHAPE_TYPE, VECTOR_STYLES, } from '../../../../common/constants'; import { StyleMeta } from './style_meta'; @@ -33,7 +30,7 @@ import { StyleMeta } from './style_meta'; import { getMakiSymbol, PREFERRED_ICONS } from './symbol_utils'; import { VectorIcon } from './components/legend/vector_icon'; import { VectorStyleLegend } from './components/legend/vector_style_legend'; -import { isOnlySingleFeatureType, getHasLabel } from './style_util'; +import { getHasLabel } from './style_util'; import { StaticStyleProperty } from './properties/static_style_property'; import { DynamicStyleProperty, IDynamicStyleProperty } from './properties/dynamic_style_property'; import { DynamicSizeProperty } from './properties/dynamic_size_property'; @@ -69,14 +66,11 @@ import { SizeStaticOptions, SizeStylePropertyDescriptor, StyleDescriptor, - StyleMetaDescriptor, StylePropertyField, StylePropertyOptions, - TileMetaFeature, VectorStyleDescriptor, VectorStylePropertiesDescriptor, } from '../../../../common/descriptor_types'; -import { DataRequest } from '../../util/data_request'; import { IStyle } from '../style'; import { IStyleProperty } from './properties/style_property'; import { IField } from '../../fields/field'; @@ -85,20 +79,29 @@ import { IVectorSource } from '../../sources/vector_source'; import { createStyleFieldsHelper, StyleFieldsHelper } from './style_fields_helper'; import { IESAggField } from '../../fields/agg'; -const POINTS = [GEO_JSON_TYPE.POINT, GEO_JSON_TYPE.MULTI_POINT]; -const LINES = [GEO_JSON_TYPE.LINE_STRING, GEO_JSON_TYPE.MULTI_LINE_STRING]; -const POLYGONS = [GEO_JSON_TYPE.POLYGON, GEO_JSON_TYPE.MULTI_POLYGON]; - export interface IVectorStyle extends IStyle { getAllStyleProperties(): Array>; getDynamicPropertiesArray(): Array>; getSourceFieldNames(): string[]; getStyleMeta(): StyleMeta; + + /* + * Changes to source descriptor and join descriptor will impact style properties. + * For instance, a style property may be dynamically tied to the value of an ordinal field defined + * by a join or a metric aggregation. The metric aggregation or join may be edited or removed. + * When this happens, the style will be linked to a no-longer-existing field. + * This method provides a way for a style to clean itself and return a descriptor that unsets any dynamic + * properties that are tied to missing fields + * + * This method does not update its descriptor. It just returns a new descriptor that the caller + * can then use to update store state via dispatch. + */ getDescriptorWithUpdatedStyleProps( nextFields: IField[], - previousFields: IField[], - mapColors: string[] + mapColors: string[], + previousFields?: IField[] ): Promise<{ hasChanges: boolean; nextStyleDescriptor?: VectorStyleDescriptor }>; + getIsPointsOnly(): boolean; isTimeAware(): boolean; getPrimaryColor(): string; @@ -319,7 +322,6 @@ export class VectorStyle implements IVectorStyle { }); return this._deleteFieldsFromDescriptorAndUpdateStyling( - nextFields, updatedProperties, hasChanges, styleFieldsHelper, @@ -328,13 +330,11 @@ export class VectorStyle implements IVectorStyle { } async _deleteFieldsFromDescriptorAndUpdateStyling( - nextFields: IField[], originalProperties: VectorStylePropertiesDescriptor, hasChanges: boolean, styleFieldsHelper: StyleFieldsHelper, mapColors: string[] ) { - // const originalProperties = this.getRawProperties(); const updatedProperties = {} as VectorStylePropertiesDescriptor; const dynamicProperties = (Object.keys(originalProperties) as VECTOR_STYLES[]).filter((key) => { @@ -343,9 +343,21 @@ export class VectorStyle implements IVectorStyle { }); dynamicProperties.forEach((key: VECTOR_STYLES) => { + // TODO instead of looking up instance by key, update argument originalProperties to be instances instead of descriptors + const styleProperty = this.getAllStyleProperties().find((property) => { + return property.getStyleName() === key; + }); + if (!styleProperty) { + return; + } + const nextStyleFields = styleFieldsHelper + .getFieldsForStyle(styleProperty, this._layer.getSource().isMvt()) + .filter((styleField) => { + return !styleField.isUnsupported; + }); + // Convert dynamic styling to static stying when there are no style fields - const styleFields = styleFieldsHelper.getFieldsForStyle(key); - if (styleFields.length === 0) { + if (nextStyleFields.length === 0) { const staticProperties = getDefaultStaticProperties(mapColors); updatedProperties[key] = staticProperties[key] as any; return; @@ -355,16 +367,16 @@ export class VectorStyle implements IVectorStyle { if (!dynamicProperty || !dynamicProperty.options) { return; } - const fieldName = (dynamicProperty.options as DynamicStylePropertyOptions).field!.name; + const fieldName = (dynamicProperty.options as DynamicStylePropertyOptions).field?.name; if (!fieldName) { return; } - const matchingOrdinalField = nextFields.find((ordinalField) => { - return fieldName === ordinalField.getName(); + const fieldStillExists = nextStyleFields.some((nextStyleField) => { + return fieldName === nextStyleField.name; }); - if (matchingOrdinalField) { + if (fieldStillExists) { return; } @@ -404,25 +416,14 @@ export class VectorStyle implements IVectorStyle { } } - /* - * Changes to source descriptor and join descriptor will impact style properties. - * For instance, a style property may be dynamically tied to the value of an ordinal field defined - * by a join or a metric aggregation. The metric aggregation or join may be edited or removed. - * When this happens, the style will be linked to a no-longer-existing ordinal field. - * This method provides a way for a style to clean itself and return a descriptor that unsets any dynamic - * properties that are tied to missing oridinal fields - * - * This method does not update its descriptor. It just returns a new descriptor that the caller - * can then use to update store state via dispatch. - */ async getDescriptorWithUpdatedStyleProps( nextFields: IField[], - previousFields: IField[], - mapColors: string[] + mapColors: string[], + previousFields?: IField[] ) { const styleFieldsHelper = await createStyleFieldsHelper(nextFields); - return previousFields.length === nextFields.length + return previousFields && previousFields.length === nextFields.length ? // Field-config changed await this._updateFieldsInDescriptor( nextFields, @@ -432,7 +433,6 @@ export class VectorStyle implements IVectorStyle { ) : // Deletions or additions await this._deleteFieldsFromDescriptorAndUpdateStyling( - nextFields, this.getRawProperties(), false, styleFieldsHelper, @@ -509,128 +509,6 @@ export class VectorStyle implements IVectorStyle { ); } - async pluckStyleMetaFromTileMeta(metaFeatures: TileMetaFeature[]): Promise { - const supportedShapeTypes = await this._source.getSupportedShapeTypes(); - const styleMeta: StyleMetaDescriptor = { - geometryTypes: { - isPointsOnly: - supportedShapeTypes.length === 1 && supportedShapeTypes.includes(VECTOR_SHAPE_TYPE.POINT), - isLinesOnly: - supportedShapeTypes.length === 1 && supportedShapeTypes.includes(VECTOR_SHAPE_TYPE.LINE), - isPolygonsOnly: - supportedShapeTypes.length === 1 && - supportedShapeTypes.includes(VECTOR_SHAPE_TYPE.POLYGON), - }, - fieldMeta: {}, - }; - - const dynamicProperties = this.getDynamicPropertiesArray(); - if (dynamicProperties.length === 0 || !metaFeatures) { - // no additional meta data to pull from source data request. - return styleMeta; - } - - dynamicProperties.forEach((dynamicProperty) => { - const name = dynamicProperty.getFieldName(); - if (!styleMeta.fieldMeta[name]) { - styleMeta.fieldMeta[name] = { categories: [] }; - } - const categories = - dynamicProperty.pluckCategoricalStyleMetaFromTileMetaFeatures(metaFeatures); - if (categories.length) { - styleMeta.fieldMeta[name].categories = categories; - } - const ordinalStyleMeta = - dynamicProperty.pluckOrdinalStyleMetaFromTileMetaFeatures(metaFeatures); - if (ordinalStyleMeta) { - styleMeta.fieldMeta[name].range = ordinalStyleMeta; - } - }); - - return styleMeta; - } - - async pluckStyleMetaFromSourceDataRequest( - sourceDataRequest: DataRequest - ): Promise { - const features = _.get(sourceDataRequest.getData(), 'features', []); - const supportedFeatures = await this._source.getSupportedShapeTypes(); - const hasFeatureType = { - [VECTOR_SHAPE_TYPE.POINT]: false, - [VECTOR_SHAPE_TYPE.LINE]: false, - [VECTOR_SHAPE_TYPE.POLYGON]: false, - }; - if (supportedFeatures.length > 1) { - for (let i = 0; i < features.length; i++) { - const feature = features[i]; - - // ignore centroid features as they are added for styling and not part of the real data set - if (feature.properties[KBN_IS_CENTROID_FEATURE]) { - continue; - } - - if (!hasFeatureType[VECTOR_SHAPE_TYPE.POINT] && POINTS.includes(feature.geometry.type)) { - hasFeatureType[VECTOR_SHAPE_TYPE.POINT] = true; - } - if (!hasFeatureType[VECTOR_SHAPE_TYPE.LINE] && LINES.includes(feature.geometry.type)) { - hasFeatureType[VECTOR_SHAPE_TYPE.LINE] = true; - } - if ( - !hasFeatureType[VECTOR_SHAPE_TYPE.POLYGON] && - POLYGONS.includes(feature.geometry.type) - ) { - hasFeatureType[VECTOR_SHAPE_TYPE.POLYGON] = true; - } - } - } - - const styleMeta = { - geometryTypes: { - isPointsOnly: isOnlySingleFeatureType( - VECTOR_SHAPE_TYPE.POINT, - supportedFeatures, - hasFeatureType - ), - isLinesOnly: isOnlySingleFeatureType( - VECTOR_SHAPE_TYPE.LINE, - supportedFeatures, - hasFeatureType - ), - isPolygonsOnly: isOnlySingleFeatureType( - VECTOR_SHAPE_TYPE.POLYGON, - supportedFeatures, - hasFeatureType - ), - }, - fieldMeta: {}, - } as StyleMetaDescriptor; - - const dynamicProperties = this.getDynamicPropertiesArray(); - if (dynamicProperties.length === 0 || features.length === 0) { - // no additional meta data to pull from source data request. - return styleMeta; - } - - dynamicProperties.forEach( - (dynamicProperty: IDynamicStyleProperty) => { - const name = dynamicProperty.getFieldName(); - if (!styleMeta.fieldMeta[name]) { - styleMeta.fieldMeta[name] = { categories: [] }; - } - const categories = dynamicProperty.pluckCategoricalStyleMetaFromFeatures(features); - if (categories.length) { - styleMeta.fieldMeta[name].categories = categories; - } - const ordinalStyleMeta = dynamicProperty.pluckOrdinalStyleMetaFromFeatures(features); - if (ordinalStyleMeta) { - styleMeta.fieldMeta[name].range = ordinalStyleMeta; - } - } - ); - - return styleMeta; - } - getSourceFieldNames() { const fieldNames: string[] = []; this.getDynamicPropertiesArray().forEach((styleProperty) => { diff --git a/x-pack/plugins/maps/public/classes/util/mb_filter_expressions.ts b/x-pack/plugins/maps/public/classes/util/mb_filter_expressions.ts index ed6c01ac32dfa..025d1d830c87d 100644 --- a/x-pack/plugins/maps/public/classes/util/mb_filter_expressions.ts +++ b/x-pack/plugins/maps/public/classes/util/mb_filter_expressions.ts @@ -5,11 +5,7 @@ * 2.0. */ -import { - GEO_JSON_TYPE, - FEATURE_VISIBLE_PROPERTY_NAME, - KBN_IS_CENTROID_FEATURE, -} from '../../../common/constants'; +import { GEO_JSON_TYPE, KBN_IS_CENTROID_FEATURE } from '../../../common/constants'; import { Timeslice } from '../../../common/descriptor_types'; @@ -22,13 +18,13 @@ export const EXCLUDE_CENTROID_FEATURES = ['!=', ['get', KBN_IS_CENTROID_FEATURE] function getFilterExpression( filters: unknown[], - hasJoins: boolean, + joinFilter?: unknown, timesliceMaskConfig?: TimesliceMaskConfig ) { const allFilters: unknown[] = [...filters]; - if (hasJoins) { - allFilters.push(['==', ['get', FEATURE_VISIBLE_PROPERTY_NAME], true]); + if (joinFilter) { + allFilters.push(joinFilter); } if (timesliceMaskConfig) { @@ -49,7 +45,7 @@ function getFilterExpression( } export function getFillFilterExpression( - hasJoins: boolean, + joinFilter?: unknown, timesliceMaskConfig?: TimesliceMaskConfig ): unknown[] { return getFilterExpression( @@ -61,13 +57,13 @@ export function getFillFilterExpression( ['==', ['geometry-type'], GEO_JSON_TYPE.MULTI_POLYGON], ], ], - hasJoins, + joinFilter, timesliceMaskConfig ); } export function getLineFilterExpression( - hasJoins: boolean, + joinFilter?: unknown, timesliceMaskConfig?: TimesliceMaskConfig ): unknown[] { return getFilterExpression( @@ -81,7 +77,7 @@ export function getLineFilterExpression( ['==', ['geometry-type'], GEO_JSON_TYPE.MULTI_LINE_STRING], ], ], - hasJoins, + joinFilter, timesliceMaskConfig ); } @@ -93,19 +89,19 @@ const IS_POINT_FEATURE = [ ]; export function getPointFilterExpression( - hasJoins: boolean, + joinFilter?: unknown, timesliceMaskConfig?: TimesliceMaskConfig ): unknown[] { return getFilterExpression( [EXCLUDE_CENTROID_FEATURES, IS_POINT_FEATURE], - hasJoins, + joinFilter, timesliceMaskConfig ); } export function getLabelFilterExpression( - hasJoins: boolean, isSourceGeoJson: boolean, + joinFilter?: unknown, timesliceMaskConfig?: TimesliceMaskConfig ): unknown[] { const filters: unknown[] = []; @@ -117,5 +113,5 @@ export function getLabelFilterExpression( filters.push(IS_POINT_FEATURE); } - return getFilterExpression(filters, hasJoins, timesliceMaskConfig); + return getFilterExpression(filters, joinFilter, timesliceMaskConfig); } diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/__snapshots__/edit_layer_panel.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/__snapshots__/edit_layer_panel.test.tsx.snap index 03e8b4a90c0ca..224bc52f7ffaa 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/__snapshots__/edit_layer_panel.test.tsx.snap +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/__snapshots__/edit_layer_panel.test.tsx.snap @@ -96,6 +96,7 @@ exports[`EditLayerPanel is rendered 1`] = ` layer={ Object { "canShowTooltip": [Function], + "getDescriptor": [Function], "getDisplayName": [Function], "getId": [Function], "getImmutableSourceProperties": [Function], @@ -119,6 +120,7 @@ exports[`EditLayerPanel is rendered 1`] = ` layer={ Object { "canShowTooltip": [Function], + "getDescriptor": [Function], "getDisplayName": [Function], "getId": [Function], "getImmutableSourceProperties": [Function], diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx index ebe0cc6a4178d..c073eb8ec4675 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.test.tsx @@ -89,13 +89,15 @@ const mockLayer = { supportsFitToBounds: () => { return true; }, + getDescriptor: () => { + return {}; + }, } as unknown as ILayer; const defaultProps = { selectedLayer: mockLayer, fitToBounds: () => {}, updateSourceProps: async () => {}, - clearJoins: () => {}, }; describe('EditLayerPanel', () => { diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.tsx index bc0071c9dc62c..a0f8539190a1a 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.tsx +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/edit_layer_panel.tsx @@ -29,7 +29,7 @@ import { JoinEditor, JoinField } from './join_editor'; import { FlyoutFooter } from './flyout_footer'; import { LayerSettings } from './layer_settings'; import { StyleSettings } from './style_settings'; - +import { VectorLayerDescriptor } from '../../../common/descriptor_types'; import { getData, getCore } from '../../kibana_services'; import { ILayer } from '../../classes/layers/layer'; import { isVectorLayer, IVectorLayer } from '../../classes/layers/vector_layer'; @@ -39,7 +39,6 @@ import { IField } from '../../classes/fields/field'; const localStorage = new Storage(window.localStorage); export interface Props { - clearJoins: (layer: ILayer) => void; selectedLayer?: ILayer; updateSourceProps: (layerId: string, sourcePropChanges: OnSourceChangeArgs[]) => Promise; } @@ -139,12 +138,6 @@ export class EditLayerPanel extends Component { return this.props.updateSourceProps(this.props.selectedLayer!.getId(), args); }; - _clearJoins = () => { - if (this.props.selectedLayer) { - this.props.clearJoins(this.props.selectedLayer); - } - }; - _renderLayerErrors() { if (!this.props.selectedLayer || !this.props.selectedLayer.hasErrors()) { return null; @@ -230,6 +223,9 @@ export class EditLayerPanel extends Component { return null; } + const descriptor = this.props.selectedLayer.getDescriptor() as VectorLayerDescriptor; + const numberOfJoins = descriptor.joins ? descriptor.joins.length : 0; + return ( { /> {this.props.selectedLayer.renderSourceSettingsEditor({ - clearJoins: this._clearJoins, currentLayerType: this.props.selectedLayer.getType(), - hasJoins: isVectorLayer(this.props.selectedLayer) - ? (this.props.selectedLayer as IVectorLayer).hasJoins() - : false, + numberOfJoins, onChange: this._onSourceChange, })} diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/index.ts b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/index.ts index 5f9a920d38494..5773d93221508 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/index.ts +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/index.ts @@ -10,9 +10,8 @@ import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; import { EditLayerPanel } from './edit_layer_panel'; import { getSelectedLayer } from '../../selectors/map_selectors'; -import { setJoinsForLayer, updateSourceProps } from '../../actions'; +import { updateSourceProps } from '../../actions'; import { MapStoreState } from '../../reducers/store'; -import { ILayer } from '../../classes/layers/layer'; import { isVectorLayer, IVectorLayer } from '../../classes/layers/vector_layer'; import { OnSourceChangeArgs } from '../../classes/sources/source'; @@ -32,9 +31,6 @@ function mapStateToProps(state: MapStoreState) { function mapDispatchToProps(dispatch: ThunkDispatch) { return { - clearJoins: (layer: ILayer) => { - dispatch(setJoinsForLayer(layer, [])); - }, updateSourceProps: async (id: string, sourcePropChanges: OnSourceChangeArgs[]) => await dispatch(updateSourceProps(id, sourcePropChanges)), }; diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/add_join_button.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/add_join_button.test.tsx.snap new file mode 100644 index 0000000000000..6da0a04523c16 --- /dev/null +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/add_join_button.test.tsx.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Should disable add button when layer source is MVT and there is one join 1`] = ` + + + Add join + + +`; + +exports[`Should enable add button when layer source is MVT and there is no join 1`] = ` + + Add join + +`; + +exports[`Should render add join button 1`] = ` + + Add join + +`; diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/join_editor.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/join_editor.test.tsx.snap index 0a79b21175d1e..7daacae707ecb 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/join_editor.test.tsx.snap +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/__snapshots__/join_editor.test.tsx.snap @@ -85,18 +85,11 @@ exports[`Should render join editor 1`] = ` - - - +
`; diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/add_join_button.test.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/add_join_button.test.tsx new file mode 100644 index 0000000000000..2a017b8dd183f --- /dev/null +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/add_join_button.test.tsx @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { shallow } from 'enzyme'; +import { AddJoinButton } from './add_join_button'; + +test('Should render add join button', () => { + const component = shallow( + {}} isLayerSourceMvt={false} numJoins={0} /> + ); + expect(component).toMatchSnapshot(); +}); + +test('Should enable add button when layer source is MVT and there is no join', () => { + const component = shallow( + {}} isLayerSourceMvt={true} numJoins={0} /> + ); + expect(component).toMatchSnapshot(); +}); + +test('Should disable add button when layer source is MVT and there is one join', () => { + const component = shallow( + {}} isLayerSourceMvt={true} numJoins={1} /> + ); + expect(component).toMatchSnapshot(); +}); diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/add_join_button.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/add_join_button.tsx new file mode 100644 index 0000000000000..2aee26fbbaeac --- /dev/null +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/add_join_button.tsx @@ -0,0 +1,47 @@ +/* + * Copyright 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 React from 'react'; +import { EuiButtonEmpty, EuiToolTip } from '@elastic/eui'; + +const BUTTON_LABEL = i18n.translate('xpack.maps.layerPanel.joinEditor.addJoinButton.label', { + defaultMessage: 'Add join', +}); + +export interface Props { + addJoin: () => void; + isLayerSourceMvt: boolean; + numJoins: number; +} + +export function AddJoinButton({ addJoin, isLayerSourceMvt, numJoins }: Props) { + const isDisabled = isLayerSourceMvt && numJoins >= 1; + const button = ( + + {BUTTON_LABEL} + + ); + + return isDisabled ? ( + + {button} + + ) : ( + button + ); +} diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.test.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.test.tsx index 6da05ef0b4092..cb007110f7d35 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.test.tsx +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.test.tsx @@ -21,6 +21,14 @@ class MockLayer { getJoinsDisabledReason() { return this._disableReason; } + + getSource() { + return { + isMvt: () => { + return false; + }, + }; + } } const defaultProps = { diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.tsx index 3483b0011b127..cfa46ecf32b32 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.tsx +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/join_editor/join_editor.tsx @@ -8,14 +8,7 @@ import React, { Fragment } from 'react'; import uuid from 'uuid/v4'; -import { - EuiButtonEmpty, - EuiTitle, - EuiSpacer, - EuiToolTip, - EuiTextAlign, - EuiCallOut, -} from '@elastic/eui'; +import { EuiTitle, EuiSpacer, EuiToolTip, EuiTextAlign, EuiCallOut } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; @@ -23,6 +16,7 @@ import { Join } from './resources/join'; import { IVectorLayer } from '../../../classes/layers/vector_layer'; import { JoinDescriptor } from '../../../../common/descriptor_types'; import { SOURCE_TYPES } from '../../../../common/constants'; +import { AddJoinButton } from './add_join_button'; export interface JoinField { label: string; @@ -83,7 +77,7 @@ export function JoinEditor({ joins, layer, onChange, leftJoinFields, layerDispla ]); }; - const renderContent = () => { + function renderContent() { const disabledReason = layer.getJoinsDisabledReason(); return disabledReason ? ( {disabledReason} @@ -92,23 +86,15 @@ export function JoinEditor({ joins, layer, onChange, leftJoinFields, layerDispla {renderJoins()} - - - + ); - }; + } return (
diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/tooltip_control.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/tooltip_control.tsx index 05c1c8dc8bdfa..bb4d68f59d4f9 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/tooltip_control.tsx +++ b/x-pack/plugins/maps/public/connected_components/mb_map/tooltip_control/tooltip_control.tsx @@ -223,13 +223,10 @@ export class TooltipControl extends Component { } } if (!match) { - // "tags" (aka properties) are optional in .mvt tiles. - // It's not entirely clear how mapbox-gl handles those. - // - As null value (as defined in https://tools.ietf.org/html/rfc7946#section-3.2) - // - As undefined value - // - As empty object literal - // To avoid ambiguity, normalize properties to empty object literal. - const mbProperties = mbFeature.properties ? mbFeature.properties : {}; + const mbProperties = { + ...(mbFeature.properties ? mbFeature.properties : {}), + ...(mbFeature.state ? mbFeature.state : {}), + }; const actions: TooltipFeatureAction[] = isLocked ? this._getFeatureActions({ layerId, featureId, tooltipId }) : []; diff --git a/x-pack/plugins/maps/public/reducers/map/data_request_utils.test.ts b/x-pack/plugins/maps/public/reducers/map/data_request_utils.test.ts index f878b8be0d84b..745a02ed72259 100644 --- a/x-pack/plugins/maps/public/reducers/map/data_request_utils.test.ts +++ b/x-pack/plugins/maps/public/reducers/map/data_request_utils.test.ts @@ -280,7 +280,10 @@ describe('stopDataRequest', () => { const stateClone = _.cloneDeep(state); const reponseMeta = { responseProp1: 'response' } as DataRequestMeta; const data = { prop1: 'new data' }; - expect(stopDataRequest(state, 'layer1', 'source', REQUEST_TOKEN, reponseMeta, data)).toEqual({ + const newState = stopDataRequest(state, 'layer1', 'source', REQUEST_TOKEN, reponseMeta, data); + // remove timestamp since it changes every run + delete newState.layerList[0].__dataRequests![0].dataRequestMeta!.requestStopTime; + expect(newState).toEqual({ layerList: [ { id: 'layer1', diff --git a/x-pack/plugins/maps/public/reducers/map/data_request_utils.ts b/x-pack/plugins/maps/public/reducers/map/data_request_utils.ts index ec97203deb520..9e32cd469ecc4 100644 --- a/x-pack/plugins/maps/public/reducers/map/data_request_utils.ts +++ b/x-pack/plugins/maps/public/reducers/map/data_request_utils.ts @@ -60,9 +60,10 @@ export function stopDataRequest( dataRequestMeta: { ...(dataRequest.dataRequestMetaAtStart ? dataRequest.dataRequestMetaAtStart : {}), ...(responseMeta ? responseMeta : {}), + requestStopTime: Date.now(), }, dataRequestMetaAtStart: undefined, - dataRequestToken: undefined, + dataRequestToken: undefined, // active data request }) : state; } diff --git a/x-pack/plugins/maps/public/reducers/map/map.ts b/x-pack/plugins/maps/public/reducers/map/map.ts index c747f45f5f17a..6bd57fda01803 100644 --- a/x-pack/plugins/maps/public/reducers/map/map.ts +++ b/x-pack/plugins/maps/public/reducers/map/map.ts @@ -251,13 +251,11 @@ export function map(state: MapState = DEFAULT_MAP_STATE, action: Record descriptor.id === action.layer.getId() + (descriptor) => descriptor.id === action.layerId ); if (layerDescriptor) { const newLayerDescriptor = { ...layerDescriptor, joins: action.joins.slice() }; - const index = state.layerList.findIndex( - (descriptor) => descriptor.id === action.layer.getId() - ); + const index = state.layerList.findIndex((descriptor) => descriptor.id === action.layerId); const newLayerList = state.layerList.slice(); newLayerList[index] = newLayerDescriptor; return { ...state, layerList: newLayerList }; diff --git a/x-pack/plugins/maps/public/selectors/map_selectors.ts b/x-pack/plugins/maps/public/selectors/map_selectors.ts index 7a3b1972671f6..2c964f6ef0843 100644 --- a/x-pack/plugins/maps/public/selectors/map_selectors.ts +++ b/x-pack/plugins/maps/public/selectors/map_selectors.ts @@ -64,6 +64,14 @@ import { EMSTMSSource } from '../classes/sources/ems_tms_source'; import { ILayer } from '../classes/layers/layer'; import { getIsReadOnly } from './ui_selectors'; +function createJoinInstances(vectorLayerDescriptor: VectorLayerDescriptor, source: IVectorSource) { + return vectorLayerDescriptor.joins + ? vectorLayerDescriptor.joins.map((joinDescriptor) => { + return new InnerJoin(joinDescriptor, source); + }) + : []; +} + export function createLayerInstance( layerDescriptor: LayerDescriptor, customIcons: CustomIcon[], @@ -75,22 +83,6 @@ export function createLayerInstance( switch (layerDescriptor.type) { case LAYER_TYPE.RASTER_TILE: return new RasterTileLayer({ layerDescriptor, source: source as ITMSSource }); - case LAYER_TYPE.GEOJSON_VECTOR: - const joins: InnerJoin[] = []; - const vectorLayerDescriptor = layerDescriptor as VectorLayerDescriptor; - if (vectorLayerDescriptor.joins) { - vectorLayerDescriptor.joins.forEach((joinDescriptor) => { - const join = new InnerJoin(joinDescriptor, source as IVectorSource); - joins.push(join); - }); - } - return new GeoJsonVectorLayer({ - layerDescriptor: vectorLayerDescriptor, - source: source as IVectorSource, - joins, - customIcons, - chartsPaletteServiceGetColor, - }); case LAYER_TYPE.EMS_VECTOR_TILE: return new EmsVectorTileLayer({ layerDescriptor, source: source as EMSTMSSource }); case LAYER_TYPE.HEATMAP: @@ -98,6 +90,17 @@ export function createLayerInstance( layerDescriptor: layerDescriptor as HeatmapLayerDescriptor, source: source as ESGeoGridSource, }); + case LAYER_TYPE.GEOJSON_VECTOR: + return new GeoJsonVectorLayer({ + layerDescriptor: layerDescriptor as VectorLayerDescriptor, + source: source as IVectorSource, + joins: createJoinInstances( + layerDescriptor as VectorLayerDescriptor, + source as IVectorSource + ), + customIcons, + chartsPaletteServiceGetColor, + }); case LAYER_TYPE.BLENDED_VECTOR: return new BlendedVectorLayer({ layerDescriptor: layerDescriptor as VectorLayerDescriptor, @@ -109,6 +112,10 @@ export function createLayerInstance( return new MvtVectorLayer({ layerDescriptor: layerDescriptor as VectorLayerDescriptor, source: source as IVectorSource, + joins: createJoinInstances( + layerDescriptor as VectorLayerDescriptor, + source as IVectorSource + ), customIcons, }); default: @@ -215,7 +222,7 @@ export const getDrawState = ({ map }: MapStoreState): DrawState | undefined => export const getEditState = ({ map }: MapStoreState): EditState | undefined => map.mapState.editState; -function getLayerDescriptor(state: MapStoreState, layerId: string) { +export function getLayerDescriptor(state: MapStoreState, layerId: string) { const layerListRaw = getLayerListRaw(state); return layerListRaw.find((layer) => layer.id === layerId); } diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx index 38cc37aec646c..c35ad5bacf371 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx @@ -18,7 +18,11 @@ import { DataFrameAnalysisConfigType } from '../../../../../common/types/data_fr import { HelpMenu } from '../../../components/help_menu'; import { useMlKibana, useMlApiContext } from '../../../contexts/kibana'; import { MlPageHeader } from '../../../components/page_header'; -import { AnalyticsIdSelector, AnalyticsSelectorIds } from '../components/analytics_selector'; +import { + AnalyticsIdSelector, + AnalyticsSelectorIds, + AnalyticsIdSelectorControls, +} from '../components/analytics_selector'; import { AnalyticsEmptyPrompt } from '../analytics_management/components/empty_prompt'; import { useUrlState } from '../../../util/url_state'; @@ -27,6 +31,7 @@ export const Page: FC<{ analysisType: DataFrameAnalysisConfigType; }> = ({ jobId, analysisType }) => { const [analyticsId, setAnalyticsId] = useState(); + const [isIdSelectorFlyoutVisible, setIsIdSelectorFlyoutVisible] = useState(!jobId); const [jobsExist, setJobsExist] = useState(true); const { services: { docLinks }, @@ -74,7 +79,6 @@ export const Page: FC<{ } return ( <> - + + {isIdSelectorFlyoutVisible ? ( + + ) : null} {jobIdToUse !== undefined && ( >; jobsOnly?: boolean; + setIsIdSelectorFlyoutVisible: React.Dispatch>; } -export function AnalyticsIdSelector({ setAnalyticsId, jobsOnly = false }: Props) { +export function AnalyticsIdSelector({ + setAnalyticsId, + jobsOnly = false, + setIsIdSelectorFlyoutVisible, +}: Props) { const [selected, setSelected] = useState< { model_id?: string; job_id?: string; analysis_type?: string } | undefined >(); const [analyticsJobs, setAnalyticsJobs] = useState([]); const [trainedModels, setTrainedModels] = useState([]); - const [isFlyoutVisible, setIsFlyoutVisible] = useState(true); const [isLoading, setIsLoading] = useState(false); const { displayErrorToast } = useToastNotificationService(); const trainedModelsApiService = useTrainedModelsApiService(); @@ -165,7 +169,7 @@ export function AnalyticsIdSelector({ setAnalyticsId, jobsOnly = false }: Props) } function closeFlyout() { - setIsFlyoutVisible(false); + setIsIdSelectorFlyoutVisible(false); } // Fetch analytics jobs and models on flyout open @@ -258,7 +262,7 @@ export function AnalyticsIdSelector({ setAnalyticsId, jobsOnly = false }: Props) }); } - return isFlyoutVisible ? ( + return ( - ) : null; + ); } diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector_controls.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector_controls.tsx new file mode 100644 index 0000000000000..1df676da58aec --- /dev/null +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/analytics_id_selector_controls.tsx @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { + EuiBadge, + EuiButtonEmpty, + EuiFlexGroup, + EuiFlexItem, + EuiHorizontalRule, + EuiText, +} from '@elastic/eui'; + +interface Props { + setIsIdSelectorFlyoutVisible: React.Dispatch>; + selectedId?: string; +} + +export const AnalyticsIdSelectorControls: FC = ({ + setIsIdSelectorFlyoutVisible, + selectedId, +}) => ( + <> + + + {selectedId ? ( + + {selectedId} + + ) : null} + {!selectedId ? ( + + + + ) : null} + + + + + + + + + +); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/index.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/index.ts index dcd547d84b8f0..8daca8b921480 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/index.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/components/analytics_selector/index.ts @@ -7,3 +7,4 @@ export { AnalyticsIdSelector } from './analytics_id_selector'; export type { AnalyticsSelectorIds } from './analytics_id_selector'; +export { AnalyticsIdSelectorControls } from './analytics_id_selector_controls'; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx index 3420f839d592b..47d10b6c08d6e 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/job_map/page.tsx @@ -18,16 +18,24 @@ import { HelpMenu } from '../../../components/help_menu'; import { useMlKibana, useMlApiContext } from '../../../contexts/kibana'; import { useRefreshAnalyticsList } from '../../common'; import { MlPageHeader } from '../../../components/page_header'; -import { AnalyticsIdSelector, AnalyticsSelectorIds } from '../components/analytics_selector'; +import { + AnalyticsIdSelector, + AnalyticsSelectorIds, + AnalyticsIdSelectorControls, +} from '../components/analytics_selector'; import { AnalyticsEmptyPrompt } from '../analytics_management/components/empty_prompt'; export const Page: FC = () => { const [globalState, setGlobalState] = useUrlState('_g'); + const mapJobId = globalState?.ml?.jobId; + const mapModelId = globalState?.ml?.modelId; + const [isLoading, setIsLoading] = useState(false); + const [isIdSelectorFlyoutVisible, setIsIdSelectorFlyoutVisible] = useState( + !mapJobId && !mapModelId + ); const [jobsExist, setJobsExist] = useState(true); const { refresh } = useRefreshAnalyticsList({ isLoading: setIsLoading }); - const mapJobId = globalState?.ml?.jobId; - const mapModelId = globalState?.ml?.modelId; const [analyticsId, setAnalyticsId] = useState(); const { services: { docLinks }, @@ -71,7 +79,6 @@ export const Page: FC = () => { } return ( <> - { return ( <> + + {isIdSelectorFlyoutVisible ? ( + + ) : null} {jobId === undefined && modelId === undefined ? ( ; + +export const postApmInstanceResponsePayloadRT = rt.type({ + data: rt.string, +}); diff --git a/x-pack/plugins/monitoring/common/http_api/apm/post_apm_instances.ts b/x-pack/plugins/monitoring/common/http_api/apm/post_apm_instances.ts new file mode 100644 index 0000000000000..9e5510ed7a8f9 --- /dev/null +++ b/x-pack/plugins/monitoring/common/http_api/apm/post_apm_instances.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as rt from 'io-ts'; + +export const postApmInstancesRequestParamsRT = rt.type({ + clusterUuid: rt.string, +}); + +export const postApmInstancesRequestPayloadRT = rt.intersection([ + rt.partial({ + ccs: rt.string, + }), + rt.type({ + timeRange: rt.type({ + min: rt.string, + max: rt.string, + }), + }), +]); + +export type PostApmInstancesRequestPayload = rt.TypeOf; + +export const postApmInstancesResponsePayloadRT = rt.type({ + data: rt.string, +}); diff --git a/x-pack/plugins/monitoring/common/http_api/apm/post_apm_overview.ts b/x-pack/plugins/monitoring/common/http_api/apm/post_apm_overview.ts new file mode 100644 index 0000000000000..e7da157984b1d --- /dev/null +++ b/x-pack/plugins/monitoring/common/http_api/apm/post_apm_overview.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as rt from 'io-ts'; + +export const postApmOverviewRequestParamsRT = rt.type({ + clusterUuid: rt.string, +}); + +export const postApmOverviewRequestPayloadRT = rt.intersection([ + rt.partial({ + ccs: rt.string, + }), + rt.type({ + timeRange: rt.type({ + min: rt.string, + max: rt.string, + }), + }), +]); + +export type PostApmOverviewRequestPayload = rt.TypeOf; + +export const postApmOverviewResponsePayloadRT = rt.type({ + data: rt.string, +}); diff --git a/x-pack/plugins/monitoring/common/runtime_types.ts b/x-pack/plugins/monitoring/common/runtime_types.ts new file mode 100644 index 0000000000000..3b49cc628be84 --- /dev/null +++ b/x-pack/plugins/monitoring/common/runtime_types.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Context, IntersectionType, UnionType, ValidationError } from 'io-ts'; + +const getErrorPath = ([first, ...rest]: Context): string[] => { + if (typeof first === 'undefined') { + return []; + } else if (first.type instanceof IntersectionType) { + const [, ...next] = rest; + return getErrorPath(next); + } else if (first.type instanceof UnionType) { + const [, ...next] = rest; + return [first.key, ...getErrorPath(next)]; + } + + return [first.key, ...getErrorPath(rest)]; +}; + +const getErrorType = ({ context }: ValidationError) => + context[context.length - 1]?.type?.name ?? 'unknown'; + +const formatError = (error: ValidationError) => + error.message ?? + `in ${getErrorPath(error.context).join('/')}: ${JSON.stringify( + error.value + )} does not match expected type ${getErrorType(error)}`; + +export const formatErrors = (errors: ValidationError[]) => + `Failed to validate: \n${errors.map((error) => ` ${formatError(error)}`).join('\n')}`; diff --git a/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts b/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts index 0ad1ff7370a9a..d4580ab1e0a90 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts @@ -21,8 +21,8 @@ export async function getTimeOfLastEvent({ req: LegacyRequest; callWithRequest: (_req: any, endpoint: string, params: any) => Promise; apmIndexPattern: string; - start: number; - end: number; + start?: number; + end?: number; clusterUuid: string; }) { const params = { diff --git a/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts b/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts index d12d69f9a18da..92f5b19165916 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts @@ -85,8 +85,8 @@ export async function getApmInfo( }: { clusterUuid: string; apmUuid: string; - start: number; - end: number; + start?: number; + end?: number; } ) { checkParam(apmIndexPattern, 'apmIndexPattern in beats/getBeatSummary'); diff --git a/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts b/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts index 4c23ff858f471..189f94976a035 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/flag_supported_clusters.ts @@ -8,14 +8,14 @@ // @ts-ignore import { checkParam } from '../error_missing_required'; import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants'; -import { ElasticsearchResponse, ElasticsearchModifiedSource } from '../../../common/types/es'; -import { LegacyRequest } from '../../types'; +import { ElasticsearchResponse } from '../../../common/types/es'; +import { LegacyRequest, Cluster } from '../../types'; import { getNewIndexPatterns } from './get_index_patterns'; import { Globals } from '../../static_globals'; async function findSupportedBasicLicenseCluster( req: LegacyRequest, - clusters: ElasticsearchModifiedSource[], + clusters: Cluster[], ccs: string, kibanaUuid: string, serverLog: (message: string) => void @@ -90,7 +90,7 @@ async function findSupportedBasicLicenseCluster( */ export function flagSupportedClusters(req: LegacyRequest, ccs: string) { const serverLog = (message: string) => req.getLogger('supported-clusters').debug(message); - const flagAllSupported = (clusters: ElasticsearchModifiedSource[]) => { + const flagAllSupported = (clusters: Cluster[]) => { clusters.forEach((cluster) => { if (cluster.license || cluster.elasticsearch?.cluster?.stats?.license) { cluster.isSupported = true; @@ -99,7 +99,7 @@ export function flagSupportedClusters(req: LegacyRequest, ccs: string) { return clusters; }; - return async function (clusters: ElasticsearchModifiedSource[]) { + return async function (clusters: Cluster[]) { // Standalone clusters are automatically supported in the UI so ignore those for // our calculations here let linkedClusterCount = 0; diff --git a/x-pack/plugins/monitoring/server/lib/create_route_validation_function.ts b/x-pack/plugins/monitoring/server/lib/create_route_validation_function.ts new file mode 100644 index 0000000000000..4ed1276d039b1 --- /dev/null +++ b/x-pack/plugins/monitoring/server/lib/create_route_validation_function.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { RouteValidationFunction } from '@kbn/core/server'; +import { fold } from 'fp-ts/lib/Either'; +import { pipe } from 'fp-ts/lib/pipeable'; +import { Errors, Type } from 'io-ts'; +import { formatErrors } from '../../common/runtime_types'; + +type ValdidationResult = ReturnType>; + +export const createValidationFunction = + ( + runtimeType: Type + ): RouteValidationFunction => + (inputValue, { badRequest, ok }) => + pipe( + runtimeType.decode(inputValue), + fold>( + (errors: Errors) => badRequest(formatErrors(errors)), + (result: DecodedValue) => ok(result) + ) + ); diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts index 881643c8b33df..0a2143a185c16 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_ml_jobs.ts @@ -13,8 +13,8 @@ import { createQuery } from '../create_query'; // @ts-ignore import { ElasticsearchMetric } from '../metrics'; import { ML_SUPPORTED_LICENSES } from '../../../common/constants'; -import { ElasticsearchResponse, ElasticsearchSource } from '../../../common/types/es'; -import { LegacyRequest } from '../../types'; +import { ElasticsearchResponse } from '../../../common/types/es'; +import { LegacyRequest, Cluster } from '../../types'; import { getNewIndexPatterns } from '../cluster/get_index_patterns'; import { Globals } from '../../static_globals'; @@ -100,7 +100,7 @@ export function getMlJobs(req: LegacyRequest) { * cardinality isn't guaranteed to be accurate is the issue * but it will be as long as the precision threshold is >= the actual value */ -export function getMlJobsForCluster(req: LegacyRequest, cluster: ElasticsearchSource, ccs: string) { +export function getMlJobsForCluster(req: LegacyRequest, cluster: Cluster, ccs: string) { const license = cluster.license ?? cluster.elasticsearch?.cluster?.stats?.license ?? {}; if (license.status === 'active' && includes(ML_SUPPORTED_LICENSES, license.type)) { diff --git a/x-pack/plugins/monitoring/server/plugin.ts b/x-pack/plugins/monitoring/server/plugin.ts index 44117a747cbc3..ef2cc93bff652 100644 --- a/x-pack/plugins/monitoring/server/plugin.ts +++ b/x-pack/plugins/monitoring/server/plugin.ts @@ -22,6 +22,7 @@ import { } from '@kbn/core/server'; import { get } from 'lodash'; import { DEFAULT_APP_CATEGORIES } from '@kbn/core/server'; +import { RouteMethod } from '@kbn/core/server'; import { KIBANA_MONITORING_LOGGING_TAG, KIBANA_STATS_TYPE_MONITORING, @@ -50,6 +51,7 @@ import { PluginsSetup, PluginsStart, RequestHandlerContextMonitoringPlugin, + MonitoringRouteConfig, } from './types'; // This is used to test the version of kibana @@ -314,7 +316,9 @@ export class MonitoringPlugin return { config, log: this.log, - route: (options: any) => { + route: ( + options: MonitoringRouteConfig + ) => { const method = options.method; const handler = async ( context: RequestHandlerContextMonitoringPlugin, @@ -389,18 +393,23 @@ export class MonitoringPlugin } }; - const validate: any = get(options, 'config.validate', false); - if (validate && validate.payload) { - validate.body = validate.payload; - } + const validate: MonitoringRouteConfig['validate'] = + // NOTE / TODO: "config.validate" is a legacy convention and should be converted over during the TS conversion work + get(options, 'validate', false) || get(options, 'config.validate', false); + options.validate = validate; - if (method === 'POST') { - router.post(options, handler); - } else if (method === 'GET') { - router.get(options, handler); - } else if (method === 'PUT') { - router.put(options, handler); + const routeConfig = { + path: options.path, + validate: options.validate, + }; + + if (method.toLowerCase() === 'post') { + router.post(routeConfig, handler); + } else if (method.toLowerCase() === 'get') { + router.get(routeConfig, handler); + } else if (method.toLowerCase() === 'put') { + router.put(routeConfig, handler); } else { throw new Error('Unsupported API method: ' + method); } diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/_get_apm_cluster_status.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/_get_apm_cluster_status.ts similarity index 75% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/_get_apm_cluster_status.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/_get_apm_cluster_status.ts index bd0198ffcc3b2..50ae3b574deb9 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/_get_apm_cluster_status.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/_get_apm_cluster_status.ts @@ -6,8 +6,16 @@ */ import { getApmsForClusters } from '../../../../lib/apm/get_apms_for_clusters'; +import { LegacyRequest } from '../../../../types'; -export const getApmClusterStatus = (req, { clusterUuid }) => { +export const getApmClusterStatus = ( + req: LegacyRequest, + { + clusterUuid, + }: { + clusterUuid: string; + } +) => { const clusters = [{ cluster_uuid: clusterUuid }]; return getApmsForClusters(req, clusters).then((apms) => { const [{ stats, config }] = apms; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/index.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/index.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/index.ts diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts similarity index 72% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts index 61530a52ddd19..69b226ef3eaed 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instance.ts @@ -5,32 +5,26 @@ * 2.0. */ -import { schema } from '@kbn/config-schema'; import { prefixIndexPatternWithCcs } from '../../../../../common/ccs_utils'; +import { INDEX_PATTERN_BEATS } from '../../../../../common/constants'; +import { + postApmInstanceRequestParamsRT, + postApmInstanceRequestPayloadRT, +} from '../../../../../common/http_api/apm'; +import { getApmInfo } from '../../../../lib/apm'; +import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; -import { metricSet } from './metric_set_instance'; import { handleError } from '../../../../lib/errors'; -import { getApmInfo } from '../../../../lib/apm'; -import { INDEX_PATTERN_BEATS } from '../../../../../common/constants'; +import { MonitoringCore } from '../../../../types'; +import { metricSet } from './metric_set_instance'; -export function apmInstanceRoute(server) { +export function apmInstanceRoute(server: MonitoringCore) { server.route({ - method: 'POST', + method: 'post', path: '/api/monitoring/v1/clusters/{clusterUuid}/apm/{apmUuid}', - config: { - validate: { - params: schema.object({ - clusterUuid: schema.string(), - apmUuid: schema.string(), - }), - payload: schema.object({ - ccs: schema.maybe(schema.string()), - timeRange: schema.object({ - min: schema.string(), - max: schema.string(), - }), - }), - }, + validate: { + params: createValidationFunction(postApmInstanceRequestParamsRT), + body: createValidationFunction(postApmInstanceRequestPayloadRT), }, async handler(req) { const apmUuid = req.params.apmUuid; @@ -42,7 +36,9 @@ export function apmInstanceRoute(server) { const showCgroupMetrics = config.ui.container.apm.enabled; if (showCgroupMetrics) { const metricCpu = metricSet.find((m) => m.name === 'apm_cpu'); - metricCpu.keys = ['apm_cgroup_cpu']; + if (metricCpu) { + metricCpu.keys = ['apm_cgroup_cpu']; + } } try { diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts similarity index 67% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts index c1ba44bff590a..960a8dc3627b0 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/instances.ts @@ -5,29 +5,24 @@ * 2.0. */ -import { schema } from '@kbn/config-schema'; import { prefixIndexPatternWithCcs } from '../../../../../common/ccs_utils'; -import { getStats, getApms } from '../../../../lib/apm'; -import { handleError } from '../../../../lib/errors'; import { INDEX_PATTERN_BEATS } from '../../../../../common/constants'; +import { + postApmInstancesRequestParamsRT, + postApmInstancesRequestPayloadRT, +} from '../../../../../common/http_api/apm'; +import { getApms, getStats } from '../../../../lib/apm'; +import { createValidationFunction } from '../../../../lib/create_route_validation_function'; +import { handleError } from '../../../../lib/errors'; +import { MonitoringCore } from '../../../../types'; -export function apmInstancesRoute(server) { +export function apmInstancesRoute(server: MonitoringCore) { server.route({ - method: 'POST', + method: 'post', path: '/api/monitoring/v1/clusters/{clusterUuid}/apm/instances', - config: { - validate: { - params: schema.object({ - clusterUuid: schema.string(), - }), - payload: schema.object({ - ccs: schema.maybe(schema.string()), - timeRange: schema.object({ - min: schema.string(), - max: schema.string(), - }), - }), - }, + validate: { + params: createValidationFunction(postApmInstancesRequestParamsRT), + body: createValidationFunction(postApmInstancesRequestPayloadRT), }, async handler(req) { const config = server.config; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.ts similarity index 100% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.ts diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.ts similarity index 100% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.ts diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/overview.ts similarity index 66% rename from x-pack/plugins/monitoring/server/routes/api/v1/apm/overview.js rename to x-pack/plugins/monitoring/server/routes/api/v1/apm/overview.ts index 1e5e125d7e6c9..532b5fa4dc4c8 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/overview.ts @@ -5,29 +5,24 @@ * 2.0. */ -import { schema } from '@kbn/config-schema'; +import { + postApmOverviewRequestParamsRT, + postApmOverviewRequestPayloadRT, +} from '../../../../../common/http_api/apm'; +import { createValidationFunction } from '../../../../lib/create_route_validation_function'; import { getMetrics } from '../../../../lib/details/get_metrics'; -import { metricSet } from './metric_set_overview'; import { handleError } from '../../../../lib/errors'; +import { MonitoringCore } from '../../../../types'; +import { metricSet } from './metric_set_overview'; import { getApmClusterStatus } from './_get_apm_cluster_status'; -export function apmOverviewRoute(server) { +export function apmOverviewRoute(server: MonitoringCore) { server.route({ - method: 'POST', + method: 'post', path: '/api/monitoring/v1/clusters/{clusterUuid}/apm', - config: { - validate: { - params: schema.object({ - clusterUuid: schema.string(), - }), - payload: schema.object({ - ccs: schema.maybe(schema.string()), - timeRange: schema.object({ - min: schema.string(), - max: schema.string(), - }), - }), - }, + validate: { + params: createValidationFunction(postApmOverviewRequestParamsRT), + body: createValidationFunction(postApmOverviewRequestPayloadRT), }, async handler(req) { const config = server.config; @@ -36,7 +31,9 @@ export function apmOverviewRoute(server) { const showCgroupMetrics = config.ui.container.apm.enabled; if (showCgroupMetrics) { const metricCpu = metricSet.find((m) => m.name === 'apm_cpu'); - metricCpu.keys = ['apm_cgroup_cpu']; + if (metricCpu) { + metricCpu.keys = ['apm_cgroup_cpu']; + } } try { diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.js b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.js index 96851b4e7f3d8..8c28dd420675a 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beat_detail.js @@ -23,7 +23,7 @@ export function beatsDetailRoute(server) { clusterUuid: schema.string(), beatUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.js b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.js index 0a44b657afa78..83403eaa355bd 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/beats/beats.js @@ -20,7 +20,7 @@ export function beatsListingRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.js index 49da476e166e7..9cd9bcd9787e2 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/beats/overview.js @@ -22,7 +22,7 @@ export function beatsOverviewRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts index ecfb62c7d2c4b..30749f2e95c9f 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts @@ -24,7 +24,7 @@ export function clusterRoute(server: LegacyServer) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts index 2e7ebe753e8a1..3dd4feb3db805 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr.ts @@ -204,7 +204,7 @@ export function ccrRoute(server: { route: (p: any) => void; config: MonitoringCo params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts index 91d616d776f26..44a1eb1807595 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ccr_shard.ts @@ -89,7 +89,7 @@ export function ccrShardRoute(server: { route: (p: any) => void; config: () => { index: schema.string(), shardId: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.js index 2d405f8d2a517..b4f317c9a435d 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/index_detail.js @@ -29,7 +29,7 @@ export function esIndexRoute(server) { clusterUuid: schema.string(), id: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/indices.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/indices.js index ea490a1547116..de41137791108 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/indices.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/indices.js @@ -24,7 +24,7 @@ export function esIndicesRoute(server) { query: schema.object({ show_system_indices: schema.boolean(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ml_jobs.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ml_jobs.js index d27ec8ce3cc83..f2f0698bae18c 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ml_jobs.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/ml_jobs.js @@ -21,7 +21,7 @@ export function mlJobRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js index cb7fc1a455c61..1504bb076101e 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/node_detail.js @@ -29,7 +29,7 @@ export function esNodeRoute(server) { clusterUuid: schema.string(), nodeUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), showSystemIndices: schema.boolean({ defaultValue: false }), // show/hide system indices in shard allocation table timeRange: schema.object({ diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/nodes.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/nodes.js index d6cff7ecd9ae9..fa0329f957f54 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/nodes.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/nodes.js @@ -24,7 +24,7 @@ export function esNodesRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.js index 57b3d2d267831..35066bb33784d 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch/overview.js @@ -26,7 +26,7 @@ export function esOverviewRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js index 97ab818a82992..e3e269d8b3148 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/enterprise_search/overview.js @@ -20,7 +20,7 @@ export function entSearchOverviewRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instance.ts b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instance.ts index dfbd8e82bb29b..b899697cbc7b3 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instance.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instance.ts @@ -31,7 +31,7 @@ export function kibanaInstanceRoute(server: LegacyServer) { clusterUuid: schema.string(), kibanaUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instances.js b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instances.js index f1e872d6436f2..a406d2a2896e6 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instances.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/instances.js @@ -22,7 +22,7 @@ export function kibanaInstancesRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.js index 8f77dea99868a..ff34c2735bd57 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/kibana/overview.js @@ -23,7 +23,7 @@ export function kibanaOverviewRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.js index be7ce5ad0d3c2..cf1551d260e17 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/node.js @@ -36,7 +36,7 @@ export function logstashNodeRoute(server) { clusterUuid: schema.string(), logstashUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/nodes.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/nodes.js index dd27dcec80605..c483a4ac905dd 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/nodes.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/nodes.js @@ -32,7 +32,7 @@ export function logstashNodesRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.js index 81d64e8fcdc2b..797365da6e308 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/overview.js @@ -33,7 +33,7 @@ export function logstashOverviewRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipeline.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipeline.js index a9c3906dad675..128df1b147cc6 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipeline.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipeline.js @@ -38,7 +38,7 @@ export function logstashPipelineRoute(server) { pipelineId: schema.string(), pipelineHash: schema.maybe(schema.string()), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), detailVertexId: schema.maybe(schema.string()), }), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js index bd9de876f8903..ebe3f1a308ff3 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipeline_ids.js @@ -21,7 +21,7 @@ export function logstashClusterPipelineIdsRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipelines.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipelines.js index ace5661b9bf98..38ba810ca5a23 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipelines.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/cluster_pipelines.js @@ -22,7 +22,7 @@ export function logstashClusterPipelinesRoute(server) { params: schema.object({ clusterUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/node_pipelines.js b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/node_pipelines.js index c232da925e74c..d47f1e6e88ec8 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/node_pipelines.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/logstash/pipelines/node_pipelines.js @@ -23,7 +23,7 @@ export function logstashNodePipelinesRoute(server) { clusterUuid: schema.string(), logstashUuid: schema.string(), }), - payload: schema.object({ + body: schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ min: schema.string(), diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/setup/cluster_setup_status.js b/x-pack/plugins/monitoring/server/routes/api/v1/setup/cluster_setup_status.js index 7608d3527f235..bc8b722d22214 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/setup/cluster_setup_status.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/setup/cluster_setup_status.js @@ -35,7 +35,7 @@ export function clusterSetupStatusRoute(server) { // in our testing environment. skipLiveData: schema.boolean({ defaultValue: false }), }), - payload: schema.nullable( + body: schema.nullable( schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.object({ diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/setup/node_setup_status.js b/x-pack/plugins/monitoring/server/routes/api/v1/setup/node_setup_status.js index 42e77eb2b8b11..1f93e92843ea8 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/setup/node_setup_status.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/setup/node_setup_status.js @@ -35,7 +35,7 @@ export function nodeSetupStatusRoute(server) { // in our testing environment. skipLiveData: schema.boolean({ defaultValue: false }), }), - payload: schema.nullable( + body: schema.nullable( schema.object({ ccs: schema.maybe(schema.string()), timeRange: schema.maybe( diff --git a/x-pack/plugins/monitoring/server/types.ts b/x-pack/plugins/monitoring/server/types.ts index 37881544f8c1b..ee7deb63ec848 100644 --- a/x-pack/plugins/monitoring/server/types.ts +++ b/x-pack/plugins/monitoring/server/types.ts @@ -34,6 +34,7 @@ import { LicensingPluginStart } from '@kbn/licensing-plugin/server'; import { PluginSetupContract as FeaturesPluginSetupContract } from '@kbn/features-plugin/server'; import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; import { CloudSetup } from '@kbn/cloud-plugin/server'; +import { RouteConfig, RouteMethod } from '@kbn/core/server'; import { ElasticsearchModifiedSource } from '../common/types/es'; import { RulesByType } from '../common/types/alerts'; import { configSchema, MonitoringConfig } from './config'; @@ -79,10 +80,18 @@ export interface RouteDependencies { logger: Logger; } +export type MonitoringRouteConfig = { + method: RouteMethod; +} & RouteConfig & { + handler: (request: LegacyRequest) => any; + }; + export interface MonitoringCore { config: MonitoringConfig; log: Logger; - route: (options: any) => void; + route: ( + options: MonitoringRouteConfig + ) => void; } export interface LegacyShimDependencies { @@ -144,7 +153,8 @@ export interface LegacyServer { }; } -export type Cluster = ElasticsearchModifiedSource & { +export type Cluster = Omit & { + timestamp?: string; ml?: { jobs: any }; logs?: any; alerts?: AlertsOnCluster; diff --git a/x-pack/plugins/session_view/public/components/process_tree_alert/__snapshots__/index.test.tsx.snap b/x-pack/plugins/session_view/public/components/process_tree_alert/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000000..e9f66ea10d66e --- /dev/null +++ b/x-pack/plugins/session_view/public/components/process_tree_alert/__snapshots__/index.test.tsx.snap @@ -0,0 +1,152 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ProcessTreeAlerts component When ProcessTreeAlert is mounted should render alert row correctly 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+ + +
+ cmd test alert +
+ + + + open + + + +
+
+ , + "container":
+
+ + +
+ cmd test alert +
+ + + + open + + + +
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; diff --git a/x-pack/plugins/session_view/public/components/process_tree_alert/index.test.tsx b/x-pack/plugins/session_view/public/components/process_tree_alert/index.test.tsx index d0c4ca5256809..7ed1783e2da3f 100644 --- a/x-pack/plugins/session_view/public/components/process_tree_alert/index.test.tsx +++ b/x-pack/plugins/session_view/public/components/process_tree_alert/index.test.tsx @@ -40,6 +40,7 @@ describe('ProcessTreeAlerts component', () => { expect(renderResult.queryByTestId(TEST_ID)).toBeTruthy(); expect(renderResult.queryByText(ALERT_RULE_NAME!)).toBeTruthy(); expect(renderResult.queryByText(ALERT_STATUS!)).toBeTruthy(); + expect(renderResult).toMatchSnapshot(); }); it('should execute onClick callback', async () => { diff --git a/x-pack/plugins/session_view/public/components/process_tree_alert/index.tsx b/x-pack/plugins/session_view/public/components/process_tree_alert/index.tsx index bf4b6f63bbe95..95618123d709f 100644 --- a/x-pack/plugins/session_view/public/components/process_tree_alert/index.tsx +++ b/x-pack/plugins/session_view/public/components/process_tree_alert/index.tsx @@ -73,7 +73,7 @@ export const ProcessTreeAlert = ({ data-test-subj={`sessionView:sessionViewAlertDetailExpand-${uuid}`} onClick={handleExpandClick} /> - + {dataOrDash(name)} diff --git a/x-pack/plugins/uptime/.buildkite/pipelines/flaky.js b/x-pack/plugins/synthetics/.buildkite/pipelines/flaky.js similarity index 100% rename from x-pack/plugins/uptime/.buildkite/pipelines/flaky.js rename to x-pack/plugins/synthetics/.buildkite/pipelines/flaky.js diff --git a/x-pack/plugins/uptime/.buildkite/pipelines/flaky.sh b/x-pack/plugins/synthetics/.buildkite/pipelines/flaky.sh similarity index 100% rename from x-pack/plugins/uptime/.buildkite/pipelines/flaky.sh rename to x-pack/plugins/synthetics/.buildkite/pipelines/flaky.sh diff --git a/x-pack/plugins/uptime/README.md b/x-pack/plugins/synthetics/README.md similarity index 100% rename from x-pack/plugins/uptime/README.md rename to x-pack/plugins/synthetics/README.md diff --git a/x-pack/plugins/uptime/common/config.ts b/x-pack/plugins/synthetics/common/config.ts similarity index 100% rename from x-pack/plugins/uptime/common/config.ts rename to x-pack/plugins/synthetics/common/config.ts diff --git a/x-pack/plugins/uptime/common/constants/alerts.ts b/x-pack/plugins/synthetics/common/constants/alerts.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/alerts.ts rename to x-pack/plugins/synthetics/common/constants/alerts.ts diff --git a/x-pack/plugins/uptime/common/constants/capabilities.ts b/x-pack/plugins/synthetics/common/constants/capabilities.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/capabilities.ts rename to x-pack/plugins/synthetics/common/constants/capabilities.ts diff --git a/x-pack/plugins/uptime/common/constants/chart_format_limits.ts b/x-pack/plugins/synthetics/common/constants/chart_format_limits.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/chart_format_limits.ts rename to x-pack/plugins/synthetics/common/constants/chart_format_limits.ts diff --git a/x-pack/plugins/uptime/common/constants/client_defaults.ts b/x-pack/plugins/synthetics/common/constants/client_defaults.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/client_defaults.ts rename to x-pack/plugins/synthetics/common/constants/client_defaults.ts diff --git a/x-pack/plugins/uptime/common/constants/context_defaults.ts b/x-pack/plugins/synthetics/common/constants/context_defaults.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/context_defaults.ts rename to x-pack/plugins/synthetics/common/constants/context_defaults.ts diff --git a/x-pack/plugins/uptime/common/constants/index.ts b/x-pack/plugins/synthetics/common/constants/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/index.ts rename to x-pack/plugins/synthetics/common/constants/index.ts diff --git a/x-pack/plugins/uptime/common/constants/monitor_management.ts b/x-pack/plugins/synthetics/common/constants/monitor_management.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/monitor_management.ts rename to x-pack/plugins/synthetics/common/constants/monitor_management.ts diff --git a/x-pack/plugins/uptime/common/constants/plugin.ts b/x-pack/plugins/synthetics/common/constants/plugin.ts similarity index 79% rename from x-pack/plugins/uptime/common/constants/plugin.ts rename to x-pack/plugins/synthetics/common/constants/plugin.ts index 6785bbc106aa2..8c1506621ba8c 100644 --- a/x-pack/plugins/uptime/common/constants/plugin.ts +++ b/x-pack/plugins/synthetics/common/constants/plugin.ts @@ -10,13 +10,13 @@ import { i18n } from '@kbn/i18n'; export const PLUGIN = { APP_ROOT_ID: 'react-uptime-root', DESCRIPTION: i18n.translate('xpack.uptime.pluginDescription', { - defaultMessage: 'Uptime monitoring', + defaultMessage: 'Synthetics monitoring', description: 'The description text that will appear in the feature catalogue.', }), ID: 'uptime', LOCAL_STORAGE_KEY: 'xpack.uptime', - NAME: i18n.translate('xpack.uptime.featureRegistry.uptimeFeatureName', { - defaultMessage: 'Uptime', + NAME: i18n.translate('xpack.uptime.featureRegistry.syntheticsFeatureName', { + defaultMessage: 'Synthetics and Uptime', }), TITLE: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', { defaultMessage: 'Uptime', diff --git a/x-pack/plugins/uptime/common/constants/query.ts b/x-pack/plugins/synthetics/common/constants/query.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/query.ts rename to x-pack/plugins/synthetics/common/constants/query.ts diff --git a/x-pack/plugins/uptime/common/constants/rest_api.ts b/x-pack/plugins/synthetics/common/constants/rest_api.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/rest_api.ts rename to x-pack/plugins/synthetics/common/constants/rest_api.ts diff --git a/x-pack/plugins/uptime/common/constants/settings_defaults.ts b/x-pack/plugins/synthetics/common/constants/settings_defaults.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/settings_defaults.ts rename to x-pack/plugins/synthetics/common/constants/settings_defaults.ts diff --git a/x-pack/plugins/uptime/common/constants/ui.ts b/x-pack/plugins/synthetics/common/constants/ui.ts similarity index 100% rename from x-pack/plugins/uptime/common/constants/ui.ts rename to x-pack/plugins/synthetics/common/constants/ui.ts diff --git a/x-pack/plugins/uptime/common/lib/__snapshots__/assert_close_to.test.ts.snap b/x-pack/plugins/synthetics/common/lib/__snapshots__/assert_close_to.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/common/lib/__snapshots__/assert_close_to.test.ts.snap rename to x-pack/plugins/synthetics/common/lib/__snapshots__/assert_close_to.test.ts.snap diff --git a/x-pack/plugins/uptime/common/lib/__snapshots__/stringify_kueries.test.ts.snap b/x-pack/plugins/synthetics/common/lib/__snapshots__/stringify_kueries.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/common/lib/__snapshots__/stringify_kueries.test.ts.snap rename to x-pack/plugins/synthetics/common/lib/__snapshots__/stringify_kueries.test.ts.snap diff --git a/x-pack/plugins/uptime/common/lib/assert_close_to.test.ts b/x-pack/plugins/synthetics/common/lib/assert_close_to.test.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/assert_close_to.test.ts rename to x-pack/plugins/synthetics/common/lib/assert_close_to.test.ts diff --git a/x-pack/plugins/uptime/common/lib/assert_close_to.ts b/x-pack/plugins/synthetics/common/lib/assert_close_to.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/assert_close_to.ts rename to x-pack/plugins/synthetics/common/lib/assert_close_to.ts diff --git a/x-pack/plugins/uptime/common/lib/combine_filters_and_user_search.test.ts b/x-pack/plugins/synthetics/common/lib/combine_filters_and_user_search.test.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/combine_filters_and_user_search.test.ts rename to x-pack/plugins/synthetics/common/lib/combine_filters_and_user_search.test.ts diff --git a/x-pack/plugins/uptime/common/lib/combine_filters_and_user_search.ts b/x-pack/plugins/synthetics/common/lib/combine_filters_and_user_search.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/combine_filters_and_user_search.ts rename to x-pack/plugins/synthetics/common/lib/combine_filters_and_user_search.ts diff --git a/x-pack/plugins/uptime/common/lib/get_histogram_interval.test.ts b/x-pack/plugins/synthetics/common/lib/get_histogram_interval.test.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/get_histogram_interval.test.ts rename to x-pack/plugins/synthetics/common/lib/get_histogram_interval.test.ts diff --git a/x-pack/plugins/uptime/common/lib/get_histogram_interval.ts b/x-pack/plugins/synthetics/common/lib/get_histogram_interval.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/get_histogram_interval.ts rename to x-pack/plugins/synthetics/common/lib/get_histogram_interval.ts diff --git a/x-pack/plugins/uptime/common/lib/index.ts b/x-pack/plugins/synthetics/common/lib/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/index.ts rename to x-pack/plugins/synthetics/common/lib/index.ts diff --git a/x-pack/plugins/uptime/common/lib/ml.test.ts b/x-pack/plugins/synthetics/common/lib/ml.test.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/ml.test.ts rename to x-pack/plugins/synthetics/common/lib/ml.test.ts diff --git a/x-pack/plugins/uptime/common/lib/ml.ts b/x-pack/plugins/synthetics/common/lib/ml.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/ml.ts rename to x-pack/plugins/synthetics/common/lib/ml.ts diff --git a/x-pack/plugins/synthetics/common/lib/schedule_to_time.test.ts b/x-pack/plugins/synthetics/common/lib/schedule_to_time.test.ts new file mode 100644 index 0000000000000..391963a960be4 --- /dev/null +++ b/x-pack/plugins/synthetics/common/lib/schedule_to_time.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ScheduleUnit, SyntheticsMonitorSchedule } from '../runtime_types'; +import { scheduleToMilli } from './schedule_to_time'; + +describe('schedule_to_time', () => { + describe('scheduleToMilli', () => { + it('converts seconds schedule to millis', () => { + const schedule: SyntheticsMonitorSchedule = { unit: ScheduleUnit.SECONDS, number: '10' }; + expect(scheduleToMilli(schedule)).toEqual(10 * 1000); + }); + + it('converts minutes schedule to millis', () => { + const schedule: SyntheticsMonitorSchedule = { unit: ScheduleUnit.MINUTES, number: '6' }; + expect(scheduleToMilli(schedule)).toEqual(6 * 60 * 1000); + }); + }); +}); diff --git a/x-pack/plugins/synthetics/common/lib/schedule_to_time.ts b/x-pack/plugins/synthetics/common/lib/schedule_to_time.ts new file mode 100644 index 0000000000000..d944c35b2ec78 --- /dev/null +++ b/x-pack/plugins/synthetics/common/lib/schedule_to_time.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ScheduleUnit, SyntheticsMonitorSchedule } from '../runtime_types'; + +export function scheduleToMilli(schedule: SyntheticsMonitorSchedule): number { + const timeValue = parseInt(schedule.number, 10); + return timeValue * getMilliFactorForScheduleUnit(schedule.unit); +} + +function getMilliFactorForScheduleUnit(scheduleUnit: ScheduleUnit): number { + switch (scheduleUnit) { + case ScheduleUnit.SECONDS: + return 1000; + case ScheduleUnit.MINUTES: + return 60 * 1000; + default: + throw new Error(`Unit ${scheduleUnit} is not supported`); + } +} diff --git a/x-pack/plugins/uptime/common/lib/stringify_kueries.test.ts b/x-pack/plugins/synthetics/common/lib/stringify_kueries.test.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/stringify_kueries.test.ts rename to x-pack/plugins/synthetics/common/lib/stringify_kueries.test.ts diff --git a/x-pack/plugins/uptime/common/lib/stringify_kueries.ts b/x-pack/plugins/synthetics/common/lib/stringify_kueries.ts similarity index 100% rename from x-pack/plugins/uptime/common/lib/stringify_kueries.ts rename to x-pack/plugins/synthetics/common/lib/stringify_kueries.ts diff --git a/x-pack/plugins/uptime/common/requests/get_certs_request_body.ts b/x-pack/plugins/synthetics/common/requests/get_certs_request_body.ts similarity index 100% rename from x-pack/plugins/uptime/common/requests/get_certs_request_body.ts rename to x-pack/plugins/synthetics/common/requests/get_certs_request_body.ts diff --git a/x-pack/plugins/uptime/common/rules/uptime_rule_field_map.ts b/x-pack/plugins/synthetics/common/rules/uptime_rule_field_map.ts similarity index 100% rename from x-pack/plugins/uptime/common/rules/uptime_rule_field_map.ts rename to x-pack/plugins/synthetics/common/rules/uptime_rule_field_map.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/alerts/common.ts b/x-pack/plugins/synthetics/common/runtime_types/alerts/common.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/alerts/common.ts rename to x-pack/plugins/synthetics/common/runtime_types/alerts/common.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/alerts/index.ts b/x-pack/plugins/synthetics/common/runtime_types/alerts/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/alerts/index.ts rename to x-pack/plugins/synthetics/common/runtime_types/alerts/index.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/alerts/status_check.ts b/x-pack/plugins/synthetics/common/runtime_types/alerts/status_check.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/alerts/status_check.ts rename to x-pack/plugins/synthetics/common/runtime_types/alerts/status_check.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/certs.ts b/x-pack/plugins/synthetics/common/runtime_types/certs.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/certs.ts rename to x-pack/plugins/synthetics/common/runtime_types/certs.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/common.ts b/x-pack/plugins/synthetics/common/runtime_types/common.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/common.ts rename to x-pack/plugins/synthetics/common/runtime_types/common.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/dynamic_settings.ts b/x-pack/plugins/synthetics/common/runtime_types/dynamic_settings.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/dynamic_settings.ts rename to x-pack/plugins/synthetics/common/runtime_types/dynamic_settings.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/index.ts b/x-pack/plugins/synthetics/common/runtime_types/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/index.ts rename to x-pack/plugins/synthetics/common/runtime_types/index.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor/index.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor/index.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor/index.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor/locations.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor/locations.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor/locations.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor/locations.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor/state.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor/state.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor/state.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/config_key.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/config_key.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/config_key.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/config_key.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/index.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/index.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/index.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/locations.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/locations.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/locations.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/locations.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_configs.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_configs.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_configs.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_configs.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_meta_data.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_meta_data.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_meta_data.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_meta_data.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_types.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts similarity index 98% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_types.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts index fa2f04b641f51..c093705e858d8 100644 --- a/x-pack/plugins/uptime/common/runtime_types/monitor_management/monitor_types.ts +++ b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts @@ -19,11 +19,13 @@ import { } from './monitor_configs'; import { MetadataCodec } from './monitor_meta_data'; -const Schedule = t.interface({ +const ScheduleCodec = t.interface({ number: t.string, unit: ScheduleUnitCodec, }); +export type SyntheticsMonitorSchedule = t.TypeOf; + // TLSFields export const TLSFieldsCodec = t.partial({ [ConfigKey.TLS_CERTIFICATE_AUTHORITIES]: t.string, @@ -65,7 +67,7 @@ export const CommonFieldsCodec = t.intersection([ [ConfigKey.NAMESPACE]: t.string, [ConfigKey.MONITOR_TYPE]: DataStreamCodec, [ConfigKey.ENABLED]: t.boolean, - [ConfigKey.SCHEDULE]: Schedule, + [ConfigKey.SCHEDULE]: ScheduleCodec, [ConfigKey.APM_SERVICE_NAME]: t.string, [ConfigKey.TAGS]: t.array(t.string), [ConfigKey.LOCATIONS]: MonitorServiceLocationsCodec, diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor_management/state.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/state.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/monitor_management/state.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/state.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/network_events.ts b/x-pack/plugins/synthetics/common/runtime_types/network_events.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/network_events.ts rename to x-pack/plugins/synthetics/common/runtime_types/network_events.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/histogram.ts b/x-pack/plugins/synthetics/common/runtime_types/ping/histogram.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/ping/histogram.ts rename to x-pack/plugins/synthetics/common/runtime_types/ping/histogram.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/index.ts b/x-pack/plugins/synthetics/common/runtime_types/ping/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/ping/index.ts rename to x-pack/plugins/synthetics/common/runtime_types/ping/index.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/ping.ts b/x-pack/plugins/synthetics/common/runtime_types/ping/ping.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/ping/ping.ts rename to x-pack/plugins/synthetics/common/runtime_types/ping/ping.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/synthetics.test.ts b/x-pack/plugins/synthetics/common/runtime_types/ping/synthetics.test.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/ping/synthetics.test.ts rename to x-pack/plugins/synthetics/common/runtime_types/ping/synthetics.test.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/ping/synthetics.ts b/x-pack/plugins/synthetics/common/runtime_types/ping/synthetics.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/ping/synthetics.ts rename to x-pack/plugins/synthetics/common/runtime_types/ping/synthetics.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/snapshot/index.ts b/x-pack/plugins/synthetics/common/runtime_types/snapshot/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/snapshot/index.ts rename to x-pack/plugins/synthetics/common/runtime_types/snapshot/index.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/snapshot/snapshot_count.ts b/x-pack/plugins/synthetics/common/runtime_types/snapshot/snapshot_count.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/snapshot/snapshot_count.ts rename to x-pack/plugins/synthetics/common/runtime_types/snapshot/snapshot_count.ts diff --git a/x-pack/plugins/uptime/common/runtime_types/synthetics_service_api_key.ts b/x-pack/plugins/synthetics/common/runtime_types/synthetics_service_api_key.ts similarity index 100% rename from x-pack/plugins/uptime/common/runtime_types/synthetics_service_api_key.ts rename to x-pack/plugins/synthetics/common/runtime_types/synthetics_service_api_key.ts diff --git a/x-pack/plugins/uptime/common/translations.ts b/x-pack/plugins/synthetics/common/translations.ts similarity index 100% rename from x-pack/plugins/uptime/common/translations.ts rename to x-pack/plugins/synthetics/common/translations.ts diff --git a/x-pack/plugins/uptime/common/types/index.ts b/x-pack/plugins/synthetics/common/types/index.ts similarity index 100% rename from x-pack/plugins/uptime/common/types/index.ts rename to x-pack/plugins/synthetics/common/types/index.ts diff --git a/x-pack/plugins/uptime/common/types/monitor_duration.ts b/x-pack/plugins/synthetics/common/types/monitor_duration.ts similarity index 100% rename from x-pack/plugins/uptime/common/types/monitor_duration.ts rename to x-pack/plugins/synthetics/common/types/monitor_duration.ts diff --git a/x-pack/plugins/uptime/common/types/monitor_validation.ts b/x-pack/plugins/synthetics/common/types/monitor_validation.ts similarity index 100% rename from x-pack/plugins/uptime/common/types/monitor_validation.ts rename to x-pack/plugins/synthetics/common/types/monitor_validation.ts diff --git a/x-pack/plugins/uptime/common/types/saved_objects.ts b/x-pack/plugins/synthetics/common/types/saved_objects.ts similarity index 100% rename from x-pack/plugins/uptime/common/types/saved_objects.ts rename to x-pack/plugins/synthetics/common/types/saved_objects.ts diff --git a/x-pack/plugins/uptime/common/types/synthetics_monitor.ts b/x-pack/plugins/synthetics/common/types/synthetics_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/common/types/synthetics_monitor.ts rename to x-pack/plugins/synthetics/common/types/synthetics_monitor.ts diff --git a/x-pack/plugins/uptime/common/utils/as_mutable_array.ts b/x-pack/plugins/synthetics/common/utils/as_mutable_array.ts similarity index 100% rename from x-pack/plugins/uptime/common/utils/as_mutable_array.ts rename to x-pack/plugins/synthetics/common/utils/as_mutable_array.ts diff --git a/x-pack/plugins/uptime/common/utils/es_search.ts b/x-pack/plugins/synthetics/common/utils/es_search.ts similarity index 100% rename from x-pack/plugins/uptime/common/utils/es_search.ts rename to x-pack/plugins/synthetics/common/utils/es_search.ts diff --git a/x-pack/plugins/uptime/common/utils/get_monitor_url.ts b/x-pack/plugins/synthetics/common/utils/get_monitor_url.ts similarity index 100% rename from x-pack/plugins/uptime/common/utils/get_monitor_url.ts rename to x-pack/plugins/synthetics/common/utils/get_monitor_url.ts diff --git a/x-pack/plugins/uptime/common/utils/t_enum.ts b/x-pack/plugins/synthetics/common/utils/t_enum.ts similarity index 100% rename from x-pack/plugins/uptime/common/utils/t_enum.ts rename to x-pack/plugins/synthetics/common/utils/t_enum.ts diff --git a/x-pack/plugins/uptime/e2e/config.ts b/x-pack/plugins/synthetics/e2e/config.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/config.ts rename to x-pack/plugins/synthetics/e2e/config.ts diff --git a/x-pack/plugins/uptime/e2e/fixtures/es_archiver/browser/data.json.gz b/x-pack/plugins/synthetics/e2e/fixtures/es_archiver/browser/data.json.gz similarity index 100% rename from x-pack/plugins/uptime/e2e/fixtures/es_archiver/browser/data.json.gz rename to x-pack/plugins/synthetics/e2e/fixtures/es_archiver/browser/data.json.gz diff --git a/x-pack/plugins/uptime/e2e/fixtures/es_archiver/browser/mappings.json b/x-pack/plugins/synthetics/e2e/fixtures/es_archiver/browser/mappings.json similarity index 100% rename from x-pack/plugins/uptime/e2e/fixtures/es_archiver/browser/mappings.json rename to x-pack/plugins/synthetics/e2e/fixtures/es_archiver/browser/mappings.json diff --git a/x-pack/plugins/uptime/e2e/fixtures/es_archiver/full_heartbeat/data.json.gz b/x-pack/plugins/synthetics/e2e/fixtures/es_archiver/full_heartbeat/data.json.gz similarity index 100% rename from x-pack/plugins/uptime/e2e/fixtures/es_archiver/full_heartbeat/data.json.gz rename to x-pack/plugins/synthetics/e2e/fixtures/es_archiver/full_heartbeat/data.json.gz diff --git a/x-pack/plugins/uptime/e2e/fixtures/es_archiver/full_heartbeat/mappings.json b/x-pack/plugins/synthetics/e2e/fixtures/es_archiver/full_heartbeat/mappings.json similarity index 100% rename from x-pack/plugins/uptime/e2e/fixtures/es_archiver/full_heartbeat/mappings.json rename to x-pack/plugins/synthetics/e2e/fixtures/es_archiver/full_heartbeat/mappings.json diff --git a/x-pack/plugins/uptime/e2e/helpers/make_checks.ts b/x-pack/plugins/synthetics/e2e/helpers/make_checks.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/helpers/make_checks.ts rename to x-pack/plugins/synthetics/e2e/helpers/make_checks.ts diff --git a/x-pack/plugins/uptime/e2e/helpers/make_ping.ts b/x-pack/plugins/synthetics/e2e/helpers/make_ping.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/helpers/make_ping.ts rename to x-pack/plugins/synthetics/e2e/helpers/make_ping.ts diff --git a/x-pack/plugins/uptime/e2e/helpers/make_tls.ts b/x-pack/plugins/synthetics/e2e/helpers/make_tls.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/helpers/make_tls.ts rename to x-pack/plugins/synthetics/e2e/helpers/make_tls.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/alerts/default_email_settings.ts b/x-pack/plugins/synthetics/e2e/journeys/alerts/default_email_settings.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/alerts/default_email_settings.ts rename to x-pack/plugins/synthetics/e2e/journeys/alerts/default_email_settings.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/alerts/index.ts b/x-pack/plugins/synthetics/e2e/journeys/alerts/index.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/alerts/index.ts rename to x-pack/plugins/synthetics/e2e/journeys/alerts/index.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/alerts/status_alert_flyouts_in_alerting_app.ts b/x-pack/plugins/synthetics/e2e/journeys/alerts/status_alert_flyouts_in_alerting_app.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/alerts/status_alert_flyouts_in_alerting_app.ts rename to x-pack/plugins/synthetics/e2e/journeys/alerts/status_alert_flyouts_in_alerting_app.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/alerts/tls_alert_flyouts_in_alerting_app.ts b/x-pack/plugins/synthetics/e2e/journeys/alerts/tls_alert_flyouts_in_alerting_app.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/alerts/tls_alert_flyouts_in_alerting_app.ts rename to x-pack/plugins/synthetics/e2e/journeys/alerts/tls_alert_flyouts_in_alerting_app.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/data_view_permissions.ts b/x-pack/plugins/synthetics/e2e/journeys/data_view_permissions.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/data_view_permissions.ts rename to x-pack/plugins/synthetics/e2e/journeys/data_view_permissions.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/index.ts b/x-pack/plugins/synthetics/e2e/journeys/index.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/index.ts rename to x-pack/plugins/synthetics/e2e/journeys/index.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/locations/index.ts b/x-pack/plugins/synthetics/e2e/journeys/locations/index.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/locations/index.ts rename to x-pack/plugins/synthetics/e2e/journeys/locations/index.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/locations/locations.ts b/x-pack/plugins/synthetics/e2e/journeys/locations/locations.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/locations/locations.ts rename to x-pack/plugins/synthetics/e2e/journeys/locations/locations.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_details.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_details.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_details/index.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_details/index.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_details/index.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_details/index.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_details/monitor_alerts.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_details/monitor_alerts.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_details/monitor_alerts.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_details/monitor_alerts.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_details/monitor_details.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_details/monitor_details.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_details/monitor_details.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_details/monitor_details.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_details/ping_redirects.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_details/ping_redirects.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_details/ping_redirects.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_details/ping_redirects.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_management.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_management.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_management.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_management.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_management_enablement.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_management_enablement.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_management_enablement.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_management_enablement.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_name.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/monitor_name.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/monitor_name.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/monitor_name.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/read_only_user/index.ts b/x-pack/plugins/synthetics/e2e/journeys/read_only_user/index.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/read_only_user/index.ts rename to x-pack/plugins/synthetics/e2e/journeys/read_only_user/index.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/read_only_user/monitor_management.ts b/x-pack/plugins/synthetics/e2e/journeys/read_only_user/monitor_management.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/read_only_user/monitor_management.ts rename to x-pack/plugins/synthetics/e2e/journeys/read_only_user/monitor_management.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/step_duration.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/step_duration.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/step_duration.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/step_duration.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/uptime.journey.ts b/x-pack/plugins/synthetics/e2e/journeys/uptime.journey.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/uptime.journey.ts rename to x-pack/plugins/synthetics/e2e/journeys/uptime.journey.ts diff --git a/x-pack/plugins/uptime/e2e/journeys/utils.ts b/x-pack/plugins/synthetics/e2e/journeys/utils.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/journeys/utils.ts rename to x-pack/plugins/synthetics/e2e/journeys/utils.ts diff --git a/x-pack/plugins/uptime/e2e/page_objects/login.tsx b/x-pack/plugins/synthetics/e2e/page_objects/login.tsx similarity index 100% rename from x-pack/plugins/uptime/e2e/page_objects/login.tsx rename to x-pack/plugins/synthetics/e2e/page_objects/login.tsx diff --git a/x-pack/plugins/uptime/e2e/page_objects/monitor_details.tsx b/x-pack/plugins/synthetics/e2e/page_objects/monitor_details.tsx similarity index 100% rename from x-pack/plugins/uptime/e2e/page_objects/monitor_details.tsx rename to x-pack/plugins/synthetics/e2e/page_objects/monitor_details.tsx diff --git a/x-pack/plugins/uptime/e2e/page_objects/monitor_management.tsx b/x-pack/plugins/synthetics/e2e/page_objects/monitor_management.tsx similarity index 100% rename from x-pack/plugins/uptime/e2e/page_objects/monitor_management.tsx rename to x-pack/plugins/synthetics/e2e/page_objects/monitor_management.tsx diff --git a/x-pack/plugins/uptime/e2e/page_objects/settings.tsx b/x-pack/plugins/synthetics/e2e/page_objects/settings.tsx similarity index 100% rename from x-pack/plugins/uptime/e2e/page_objects/settings.tsx rename to x-pack/plugins/synthetics/e2e/page_objects/settings.tsx diff --git a/x-pack/plugins/uptime/e2e/page_objects/utils.tsx b/x-pack/plugins/synthetics/e2e/page_objects/utils.tsx similarity index 100% rename from x-pack/plugins/uptime/e2e/page_objects/utils.tsx rename to x-pack/plugins/synthetics/e2e/page_objects/utils.tsx diff --git a/x-pack/plugins/uptime/e2e/playwright_run.ts b/x-pack/plugins/synthetics/e2e/playwright_run.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/playwright_run.ts rename to x-pack/plugins/synthetics/e2e/playwright_run.ts diff --git a/x-pack/plugins/uptime/e2e/playwright_start.ts b/x-pack/plugins/synthetics/e2e/playwright_start.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/playwright_start.ts rename to x-pack/plugins/synthetics/e2e/playwright_start.ts diff --git a/x-pack/plugins/uptime/e2e/tasks/es_archiver.ts b/x-pack/plugins/synthetics/e2e/tasks/es_archiver.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/tasks/es_archiver.ts rename to x-pack/plugins/synthetics/e2e/tasks/es_archiver.ts diff --git a/x-pack/plugins/uptime/e2e/tasks/import_monitors.ts b/x-pack/plugins/synthetics/e2e/tasks/import_monitors.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/tasks/import_monitors.ts rename to x-pack/plugins/synthetics/e2e/tasks/import_monitors.ts diff --git a/x-pack/plugins/uptime/e2e/tasks/read_kibana_config.ts b/x-pack/plugins/synthetics/e2e/tasks/read_kibana_config.ts similarity index 100% rename from x-pack/plugins/uptime/e2e/tasks/read_kibana_config.ts rename to x-pack/plugins/synthetics/e2e/tasks/read_kibana_config.ts diff --git a/x-pack/plugins/uptime/e2e/tasks/uptime_monitor.ndjson b/x-pack/plugins/synthetics/e2e/tasks/uptime_monitor.ndjson similarity index 100% rename from x-pack/plugins/uptime/e2e/tasks/uptime_monitor.ndjson rename to x-pack/plugins/synthetics/e2e/tasks/uptime_monitor.ndjson diff --git a/x-pack/plugins/uptime/e2e/tsconfig.json b/x-pack/plugins/synthetics/e2e/tsconfig.json similarity index 100% rename from x-pack/plugins/uptime/e2e/tsconfig.json rename to x-pack/plugins/synthetics/e2e/tsconfig.json diff --git a/x-pack/plugins/uptime/jest.config.js b/x-pack/plugins/synthetics/jest.config.js similarity index 70% rename from x-pack/plugins/uptime/jest.config.js rename to x-pack/plugins/synthetics/jest.config.js index baafb5ce133e6..de4161347ae40 100644 --- a/x-pack/plugins/uptime/jest.config.js +++ b/x-pack/plugins/synthetics/jest.config.js @@ -8,8 +8,8 @@ module.exports = { preset: '@kbn/test', rootDir: '../../..', - roots: ['/x-pack/plugins/uptime'], - coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/uptime', + roots: ['/x-pack/plugins/synthetics'], + coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/synthetics', coverageReporters: ['text', 'html'], - collectCoverageFrom: ['/x-pack/plugins/uptime/{common,public,server}/**/*.{ts,tsx}'], + collectCoverageFrom: ['/x-pack/plugins/synthetics/{common,public,server}/**/*.{ts,tsx}'], }; diff --git a/x-pack/plugins/uptime/kibana.json b/x-pack/plugins/synthetics/kibana.json similarity index 97% rename from x-pack/plugins/uptime/kibana.json rename to x-pack/plugins/synthetics/kibana.json index 715a497ef79aa..d65a89a16161f 100644 --- a/x-pack/plugins/uptime/kibana.json +++ b/x-pack/plugins/synthetics/kibana.json @@ -1,6 +1,6 @@ { "configPath": ["xpack", "uptime"], - "id": "uptime", + "id": "synthetics", "kibanaVersion": "kibana", "optionalPlugins": ["cloud", "data", "fleet", "home", "ml", "telemetry"], "requiredPlugins": [ diff --git a/x-pack/plugins/uptime/public/apps/__snapshots__/uptime_page_template.test.tsx.snap b/x-pack/plugins/synthetics/public/apps/__snapshots__/uptime_page_template.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/apps/__snapshots__/uptime_page_template.test.tsx.snap rename to x-pack/plugins/synthetics/public/apps/__snapshots__/uptime_page_template.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/apps/locators/overview.test.ts b/x-pack/plugins/synthetics/public/apps/locators/overview.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/apps/locators/overview.test.ts rename to x-pack/plugins/synthetics/public/apps/locators/overview.test.ts diff --git a/x-pack/plugins/uptime/public/apps/locators/overview.ts b/x-pack/plugins/synthetics/public/apps/locators/overview.ts similarity index 100% rename from x-pack/plugins/uptime/public/apps/locators/overview.ts rename to x-pack/plugins/synthetics/public/apps/locators/overview.ts diff --git a/x-pack/plugins/uptime/public/apps/plugin.ts b/x-pack/plugins/synthetics/public/apps/plugin.ts similarity index 100% rename from x-pack/plugins/uptime/public/apps/plugin.ts rename to x-pack/plugins/synthetics/public/apps/plugin.ts diff --git a/x-pack/plugins/uptime/public/apps/render_app.tsx b/x-pack/plugins/synthetics/public/apps/render_app.tsx similarity index 100% rename from x-pack/plugins/uptime/public/apps/render_app.tsx rename to x-pack/plugins/synthetics/public/apps/render_app.tsx diff --git a/x-pack/plugins/uptime/public/apps/uptime_app.tsx b/x-pack/plugins/synthetics/public/apps/uptime_app.tsx similarity index 97% rename from x-pack/plugins/uptime/public/apps/uptime_app.tsx rename to x-pack/plugins/synthetics/public/apps/uptime_app.tsx index 91d6ccbfd5267..b106123de1b29 100644 --- a/x-pack/plugins/uptime/public/apps/uptime_app.tsx +++ b/x-pack/plugins/synthetics/public/apps/uptime_app.tsx @@ -17,7 +17,6 @@ import { RedirectAppLinks, } from '@kbn/kibana-react-plugin/public'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; import { InspectorContextProvider } from '@kbn/observability-plugin/public'; import { ClientPluginsSetup, ClientPluginsStart } from './plugin'; import { UMUpdateBadge } from '../lib/lib'; @@ -30,8 +29,8 @@ import { import { CommonlyUsedRange } from '../components/common/uptime_date_picker'; import { setBasePath } from '../state/actions'; import { PageRouter } from '../routes'; -import { UptimeAlertsFlyoutWrapper } from '../components/overview/alerts'; -import { store } from '../state'; +import { UptimeAlertsFlyoutWrapper } from '../components/overview'; +import { store, storage } from '../state'; import { kibanaService } from '../state/kibana_service'; import { ActionMenu } from '../components/common/header/action_menu'; import { UptimeIndexPatternContextProvider } from '../contexts/uptime_index_pattern_context'; @@ -102,8 +101,6 @@ const Application = (props: UptimeAppProps) => { store.dispatch(setBasePath(basePath)); - const storage = new Storage(window.localStorage); - return ( diff --git a/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts b/x-pack/plugins/synthetics/public/apps/uptime_overview_fetcher.ts similarity index 100% rename from x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts rename to x-pack/plugins/synthetics/public/apps/uptime_overview_fetcher.ts diff --git a/x-pack/plugins/uptime/public/apps/uptime_page_template.test.tsx b/x-pack/plugins/synthetics/public/apps/uptime_page_template.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/apps/uptime_page_template.test.tsx rename to x-pack/plugins/synthetics/public/apps/uptime_page_template.test.tsx diff --git a/x-pack/plugins/uptime/public/apps/uptime_page_template.tsx b/x-pack/plugins/synthetics/public/apps/uptime_page_template.tsx similarity index 100% rename from x-pack/plugins/uptime/public/apps/uptime_page_template.tsx rename to x-pack/plugins/synthetics/public/apps/uptime_page_template.tsx diff --git a/x-pack/plugins/uptime/public/apps/use_no_data_config.ts b/x-pack/plugins/synthetics/public/apps/use_no_data_config.ts similarity index 100% rename from x-pack/plugins/uptime/public/apps/use_no_data_config.ts rename to x-pack/plugins/synthetics/public/apps/use_no_data_config.ts diff --git a/x-pack/plugins/uptime/public/badge.ts b/x-pack/plugins/synthetics/public/badge.ts similarity index 100% rename from x-pack/plugins/uptime/public/badge.ts rename to x-pack/plugins/synthetics/public/badge.ts diff --git a/x-pack/plugins/uptime/public/components/certificates/__snapshots__/cert_monitors.test.tsx.snap b/x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_monitors.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/__snapshots__/cert_monitors.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_monitors.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/certificates/__snapshots__/cert_search.test.tsx.snap b/x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_search.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/__snapshots__/cert_search.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_search.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/certificates/__snapshots__/cert_status.test.tsx.snap b/x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_status.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/__snapshots__/cert_status.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_status.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_monitors.test.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_monitors.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_monitors.test.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_monitors.test.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_monitors.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_monitors.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_monitors.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_monitors.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_refresh_btn.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_refresh_btn.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_refresh_btn.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_refresh_btn.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_search.test.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_search.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_search.test.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_search.test.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_search.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_search.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_search.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_search.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_status.test.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_status.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_status.test.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_status.test.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/cert_status.tsx b/x-pack/plugins/synthetics/public/components/certificates/cert_status.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/cert_status.tsx rename to x-pack/plugins/synthetics/public/components/certificates/cert_status.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/certificate_title.tsx b/x-pack/plugins/synthetics/public/components/certificates/certificate_title.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/certificate_title.tsx rename to x-pack/plugins/synthetics/public/components/certificates/certificate_title.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/certificates_list.test.tsx b/x-pack/plugins/synthetics/public/components/certificates/certificates_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/certificates_list.test.tsx rename to x-pack/plugins/synthetics/public/components/certificates/certificates_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/certificates_list.tsx b/x-pack/plugins/synthetics/public/components/certificates/certificates_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/certificates_list.tsx rename to x-pack/plugins/synthetics/public/components/certificates/certificates_list.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/fingerprint_col.test.tsx b/x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/fingerprint_col.test.tsx rename to x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.test.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/fingerprint_col.tsx b/x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/fingerprint_col.tsx rename to x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.tsx diff --git a/x-pack/plugins/uptime/public/components/certificates/index.ts b/x-pack/plugins/synthetics/public/components/certificates/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/index.ts rename to x-pack/plugins/synthetics/public/components/certificates/index.ts diff --git a/x-pack/plugins/uptime/public/components/certificates/translations.ts b/x-pack/plugins/synthetics/public/components/certificates/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/translations.ts rename to x-pack/plugins/synthetics/public/components/certificates/translations.ts diff --git a/x-pack/plugins/uptime/public/components/certificates/use_cert_search.ts b/x-pack/plugins/synthetics/public/components/certificates/use_cert_search.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/certificates/use_cert_search.ts rename to x-pack/plugins/synthetics/public/components/certificates/use_cert_search.ts diff --git a/x-pack/plugins/uptime/public/components/common/__snapshots__/location_link.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/__snapshots__/location_link.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/__snapshots__/location_link.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/__snapshots__/location_link.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/__snapshots__/monitor_page_link.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_page_link.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/__snapshots__/monitor_page_link.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_page_link.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/__snapshots__/monitor_tags.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_tags.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/__snapshots__/monitor_tags.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_tags.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/alerts/uptime_edit_alert_flyout.tsx b/x-pack/plugins/synthetics/public/components/common/alerts/uptime_edit_alert_flyout.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/alerts/uptime_edit_alert_flyout.tsx rename to x-pack/plugins/synthetics/public/components/common/alerts/uptime_edit_alert_flyout.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap b/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/common/charts/annotation_tooltip.tsx b/x-pack/plugins/synthetics/public/components/common/charts/annotation_tooltip.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/annotation_tooltip.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/annotation_tooltip.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.tsx b/x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/chart_empty_state.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/chart_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper/chart_wrapper.tsx b/x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/chart_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/chart_wrapper/chart_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/chart_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/chart_wrapper/index.ts b/x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/chart_wrapper/index.ts rename to x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/index.ts diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/donut_chart.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/donut_chart.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/donut_chart.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart.tsx b/x-pack/plugins/synthetics/public/components/common/charts/donut_chart.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/donut_chart.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/donut_chart.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.tsx b/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.tsx b/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/donut_chart_legend_row.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/duration_chart.tsx b/x-pack/plugins/synthetics/public/components/common/charts/duration_chart.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/duration_chart.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/duration_chart.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/duration_charts.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/duration_charts.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/duration_charts.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/duration_charts.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/duration_line_bar_list.tsx b/x-pack/plugins/synthetics/public/components/common/charts/duration_line_bar_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/duration_line_bar_list.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/duration_line_bar_list.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/duration_line_series_list.tsx b/x-pack/plugins/synthetics/public/components/common/charts/duration_line_series_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/duration_line_series_list.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/duration_line_series_list.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/get_tick_format.test.ts b/x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/get_tick_format.test.ts rename to x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.test.ts diff --git a/x-pack/plugins/uptime/public/components/common/charts/get_tick_format.ts b/x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/get_tick_format.ts rename to x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.ts diff --git a/x-pack/plugins/uptime/public/components/common/charts/index.ts b/x-pack/plugins/synthetics/public/components/common/charts/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/index.ts rename to x-pack/plugins/synthetics/public/components/common/charts/index.ts diff --git a/x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.tsx b/x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/monitor_bar_series.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.test.tsx b/x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/ping_histogram.test.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx b/x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx rename to x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.tsx diff --git a/x-pack/plugins/uptime/public/components/common/charts/utils.test.ts b/x-pack/plugins/synthetics/public/components/common/charts/utils.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/utils.test.ts rename to x-pack/plugins/synthetics/public/components/common/charts/utils.test.ts diff --git a/x-pack/plugins/uptime/public/components/common/charts/utils.ts b/x-pack/plugins/synthetics/public/components/common/charts/utils.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/charts/utils.ts rename to x-pack/plugins/synthetics/public/components/common/charts/utils.ts diff --git a/x-pack/plugins/uptime/public/components/common/header/action_menu.tsx b/x-pack/plugins/synthetics/public/components/common/header/action_menu.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/action_menu.tsx rename to x-pack/plugins/synthetics/public/components/common/header/action_menu.tsx diff --git a/x-pack/plugins/uptime/public/components/common/header/action_menu_content.test.tsx b/x-pack/plugins/synthetics/public/components/common/header/action_menu_content.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/action_menu_content.test.tsx rename to x-pack/plugins/synthetics/public/components/common/header/action_menu_content.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/header/action_menu_content.tsx b/x-pack/plugins/synthetics/public/components/common/header/action_menu_content.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/action_menu_content.tsx rename to x-pack/plugins/synthetics/public/components/common/header/action_menu_content.tsx diff --git a/x-pack/plugins/uptime/public/components/common/header/inspector_header_link.tsx b/x-pack/plugins/synthetics/public/components/common/header/inspector_header_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/inspector_header_link.tsx rename to x-pack/plugins/synthetics/public/components/common/header/inspector_header_link.tsx diff --git a/x-pack/plugins/uptime/public/components/common/header/manage_monitors_btn.tsx b/x-pack/plugins/synthetics/public/components/common/header/manage_monitors_btn.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/manage_monitors_btn.tsx rename to x-pack/plugins/synthetics/public/components/common/header/manage_monitors_btn.tsx diff --git a/x-pack/plugins/uptime/public/components/common/header/page_tabs.test.tsx b/x-pack/plugins/synthetics/public/components/common/header/page_tabs.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/page_tabs.test.tsx rename to x-pack/plugins/synthetics/public/components/common/header/page_tabs.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/header/page_tabs.tsx b/x-pack/plugins/synthetics/public/components/common/header/page_tabs.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/header/page_tabs.tsx rename to x-pack/plugins/synthetics/public/components/common/header/page_tabs.tsx diff --git a/x-pack/plugins/uptime/public/components/common/higher_order/index.ts b/x-pack/plugins/synthetics/public/components/common/higher_order/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/higher_order/index.ts rename to x-pack/plugins/synthetics/public/components/common/higher_order/index.ts diff --git a/x-pack/plugins/uptime/public/components/common/higher_order/responsive_wrapper.test.tsx b/x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/higher_order/responsive_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/higher_order/responsive_wrapper.tsx b/x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/higher_order/responsive_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/common/location_link.test.tsx b/x-pack/plugins/synthetics/public/components/common/location_link.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/location_link.test.tsx rename to x-pack/plugins/synthetics/public/components/common/location_link.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/location_link.tsx b/x-pack/plugins/synthetics/public/components/common/location_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/location_link.tsx rename to x-pack/plugins/synthetics/public/components/common/location_link.tsx diff --git a/x-pack/plugins/uptime/public/components/common/monitor_page_link.test.tsx b/x-pack/plugins/synthetics/public/components/common/monitor_page_link.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/monitor_page_link.test.tsx rename to x-pack/plugins/synthetics/public/components/common/monitor_page_link.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/monitor_page_link.tsx b/x-pack/plugins/synthetics/public/components/common/monitor_page_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/monitor_page_link.tsx rename to x-pack/plugins/synthetics/public/components/common/monitor_page_link.tsx diff --git a/x-pack/plugins/uptime/public/components/common/monitor_tags.test.tsx b/x-pack/plugins/synthetics/public/components/common/monitor_tags.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/monitor_tags.test.tsx rename to x-pack/plugins/synthetics/public/components/common/monitor_tags.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/monitor_tags.tsx b/x-pack/plugins/synthetics/public/components/common/monitor_tags.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/monitor_tags.tsx rename to x-pack/plugins/synthetics/public/components/common/monitor_tags.tsx diff --git a/x-pack/plugins/uptime/public/components/common/react_router_helpers/index.ts b/x-pack/plugins/synthetics/public/components/common/react_router_helpers/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/react_router_helpers/index.ts rename to x-pack/plugins/synthetics/public/components/common/react_router_helpers/index.ts diff --git a/x-pack/plugins/uptime/public/components/common/react_router_helpers/link_events.test.ts b/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/react_router_helpers/link_events.test.ts rename to x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.test.ts diff --git a/x-pack/plugins/uptime/public/components/common/react_router_helpers/link_events.ts b/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/react_router_helpers/link_events.ts rename to x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.ts diff --git a/x-pack/plugins/uptime/public/components/common/react_router_helpers/link_for_eui.test.tsx b/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/react_router_helpers/link_for_eui.test.tsx rename to x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/react_router_helpers/link_for_eui.tsx b/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/react_router_helpers/link_for_eui.tsx rename to x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.tsx diff --git a/x-pack/plugins/uptime/public/components/common/step_detail_link.tsx b/x-pack/plugins/synthetics/public/components/common/step_detail_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/step_detail_link.tsx rename to x-pack/plugins/synthetics/public/components/common/step_detail_link.tsx diff --git a/x-pack/plugins/uptime/public/components/common/translations.ts b/x-pack/plugins/synthetics/public/components/common/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/common/translations.ts rename to x-pack/plugins/synthetics/public/components/common/translations.ts diff --git a/x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx b/x-pack/plugins/synthetics/public/components/common/uptime_date_picker.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/uptime_date_picker.test.tsx rename to x-pack/plugins/synthetics/public/components/common/uptime_date_picker.test.tsx diff --git a/x-pack/plugins/uptime/public/components/common/uptime_date_picker.tsx b/x-pack/plugins/synthetics/public/components/common/uptime_date_picker.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/common/uptime_date_picker.tsx rename to x-pack/plugins/synthetics/public/components/common/uptime_date_picker.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/advanced_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/browser/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/normalizers.test.ts b/x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/normalizers.test.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.test.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/script_recorder_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/script_recorder_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/script_recorder_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/script_recorder_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/simple_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/simple_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/simple_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/simple_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/source_field.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/source_field.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/source_field.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/source_field.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/throttling_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/throttling_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/throttling_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/throttling_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/uploader.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/uploader.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/uploader.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/uploader.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/zip_url_tls_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/zip_url_tls_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/browser/zip_url_tls_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/browser/zip_url_tls_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/code_editor.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/code_editor.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/code_editor.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/code_editor.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/combo_box.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/combo_box.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/combo_box.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/combo_box.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/combo_box.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/combo_box.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/combo_box.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/combo_box.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/common_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/common/common_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/common_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/common/common_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/default_values.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/default_values.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/default_values.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/common/default_values.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/described_form_group_with_wrap.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/common/described_form_group_with_wrap.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/described_form_group_with_wrap.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/common/described_form_group_with_wrap.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/enabled.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/common/enabled.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/enabled.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/common/enabled.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/formatters.test.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/formatters.test.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.test.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/normalizers.test.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/normalizers.test.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.test.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/simple_fields_wrapper.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/common/simple_fields_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/simple_fields_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/common/simple_fields_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/common/tls_options.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/common/tls_options.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/common/tls_options.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/common/tls_options.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/browser_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/browser_context.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/browser_context_advanced.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/browser_context_advanced.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/browser_provider.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_provider.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/browser_provider.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_provider.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/http_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/http_context.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/http_context_advanced.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/http_context_advanced.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/http_provider.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_provider.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/http_provider.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_provider.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/icmp_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/icmp_context.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/index.ts b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/index.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/policy_config_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/policy_config_context.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/synthetics_context_providers.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/synthetics_context_providers.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/synthetics_context_providers.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/synthetics_context_providers.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/tcp_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/tcp_context.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/tcp_context_advanced.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/tcp_context_advanced.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/tcp_provider.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_provider.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/tcp_provider.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_provider.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/tls_fields_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/contexts/tls_fields_context.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/custom_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/header_field.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/header_field.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/header_field.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/header_field.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/header_field.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/header_field.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/header_field.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/header_field.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/helpers/context_helpers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/helpers/context_helpers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/helpers/context_helpers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/helpers/context_helpers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/helpers/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/helpers/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/helpers/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/helpers/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/helpers/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/helpers/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/helpers/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/helpers/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/hooks/use_policy.ts b/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/hooks/use_policy.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/hooks/use_update_policy.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/hooks/use_update_policy.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/hooks/use_update_policy.ts b/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/hooks/use_update_policy.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/http/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http/advanced_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/http/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/http/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/http/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/http/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/http/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/http/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/http/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http/simple_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/http/simple_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/http/simple_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/http/simple_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/icmp/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/icmp/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/icmp/advanced_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/icmp/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/icmp/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/icmp/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/icmp/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/icmp/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/icmp/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/icmp/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/icmp/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/icmp/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/icmp/simple_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/icmp/simple_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/icmp/simple_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/icmp/simple_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/index.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/index.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/index.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/index.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/key_value_field.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/key_value_field.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/optional_label.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/optional_label.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/optional_label.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/optional_label.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/request_body_field.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/request_body_field.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/schedule_field.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/schedule_field.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_custom_assets_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_custom_assets_extension.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_custom_assets_extension.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_custom_assets_extension.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tcp/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp/advanced_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tcp/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/tcp/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tcp/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/tcp/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/tcp/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tcp/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/tcp/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp/simple_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/tcp/simple_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tcp/simple_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/tcp/simple_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls/default_values.ts b/x-pack/plugins/synthetics/public/components/fleet_package/tls/default_values.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tls/default_values.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/tls/default_values.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls/formatters.ts b/x-pack/plugins/synthetics/public/components/fleet_package/tls/formatters.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tls/formatters.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/tls/formatters.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/tls/normalizers.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tls/normalizers.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/tls/normalizers.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.test.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tls_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/types.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/types.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/types.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/types.tsx diff --git a/x-pack/plugins/uptime/public/components/fleet_package/validation.test.ts b/x-pack/plugins/synthetics/public/components/fleet_package/validation.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/validation.test.ts rename to x-pack/plugins/synthetics/public/components/fleet_package/validation.test.ts diff --git a/x-pack/plugins/uptime/public/components/fleet_package/validation.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/validation.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/fleet_package/validation.tsx rename to x-pack/plugins/synthetics/public/components/fleet_package/validation.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/__snapshots__/monitor_charts.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/__snapshots__/monitor_charts.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/__snapshots__/monitor_charts.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/__snapshots__/monitor_charts.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/index.ts b/x-pack/plugins/synthetics/public/components/monitor/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/confirm_alert_delete.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/confirm_alert_delete.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/confirm_alert_delete.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/confirm_alert_delete.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/confirm_delete.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/index.ts b/x-pack/plugins/synthetics/public/components/monitor/ml/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/ml/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/license_info.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/license_info.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/license_info.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/license_info.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/license_info.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/license_info.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/license_info.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/license_info.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/manage_ml_job.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/manage_ml_job.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/manage_ml_job.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/manage_ml_job.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout_container.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_flyout_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_integeration.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_integeration.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_integeration.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_integeration.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_integerations.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_integerations.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_integerations.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_integerations.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_job_link.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/ml_manage_job.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/ml_manage_job.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/ml_manage_job.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/ml_manage_job.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/translations.tsx b/x-pack/plugins/synthetics/public/components/monitor/ml/translations.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/translations.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ml/translations.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/use_anomaly_alert.ts b/x-pack/plugins/synthetics/public/components/monitor/ml/use_anomaly_alert.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ml/use_anomaly_alert.ts rename to x-pack/plugins/synthetics/public/components/monitor/ml/use_anomaly_alert.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_charts.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/monitor_charts.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_charts.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/monitor_charts.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_charts.tsx b/x-pack/plugins/synthetics/public/components/monitor/monitor_charts.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_charts.tsx rename to x-pack/plugins/synthetics/public/components/monitor/monitor_charts.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/index.ts b/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_duration/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/monitor_duration/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration.tsx b/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration.tsx rename to x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration_container.tsx b/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/monitor_title.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/monitor_title.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_title.tsx b/x-pack/plugins/synthetics/public/components/monitor/monitor_title.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/monitor_title.tsx rename to x-pack/plugins/synthetics/public/components/monitor/monitor_title.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_histogram/index.ts b/x-pack/plugins/synthetics/public/components/monitor/ping_histogram/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_histogram/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/ping_histogram/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_histogram/ping_histogram_container.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_histogram/ping_histogram_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_histogram/ping_histogram_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_histogram/ping_histogram_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/expand_row.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/expand_row.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/expand_row.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/expand_row.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/failed_step.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/failed_step.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/failed_step.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/failed_step.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_error.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_error.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_error.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_error.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_status.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_status.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_status.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_status.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/index.ts b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/response_code.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/response_code.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/columns/response_code.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/response_code.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/doc_link_body.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/doc_link_body.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/doc_link_body.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/doc_link_body.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/expanded_row.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/headers.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/headers.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/headers.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/headers.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/index.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/index.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/index.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/index.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/location_name.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/location_name.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/location_name.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/location_name.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_headers.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_headers.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/ping_headers.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_headers.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_header.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_header.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_header.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_header.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_table.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/ping_list_table.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_table.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/ping_redirects.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_redirects.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/ping_redirects.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_redirects.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/response_code.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/ping_list/response_code.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/response_code.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/response_code.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/translations.ts b/x-pack/plugins/synthetics/public/components/monitor/ping_list/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/translations.ts rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/translations.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/use_pings.ts b/x-pack/plugins/synthetics/public/components/monitor/ping_list/use_pings.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/ping_list/use_pings.ts rename to x-pack/plugins/synthetics/public/components/monitor/ping_list/use_pings.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/availability_reporting.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/availability_reporting.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/index.ts b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/tag_label.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/index.ts b/x-pack/plugins/synthetics/public/components/monitor/status_details/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/status_details/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/location_availability.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/location_availability.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/location_availability.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/location_availability.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/monitor_status.bar.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/monitor_status.bar.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/monitor_status.bar.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/monitor_status.bar.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/ssl_certificate.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/ssl_certificate.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/ssl_certificate.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/ssl_certificate.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/index.ts b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/index.ts rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/monitor_redirects.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/monitor_redirects.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/monitor_redirects.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/monitor_redirects.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/ssl_certificate.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/ssl_certificate.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/ssl_certificate.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/ssl_certificate.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_bar.test.ts b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_bar.test.ts rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.test.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_bar.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_bar.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_by_location.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_by_location.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/status_by_location.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_by_location.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/use_status_bar.ts b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/use_status_bar.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/use_status_bar.ts rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/use_status_bar.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_by_location.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_by_location.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_by_location.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_by_location.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_details.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_details.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_details.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_details.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_details_container.tsx b/x-pack/plugins/synthetics/public/components/monitor/status_details/status_details_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/status_details_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor/status_details/status_details_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/translations.ts b/x-pack/plugins/synthetics/public/components/monitor/status_details/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/status_details/translations.ts rename to x-pack/plugins/synthetics/public/components/monitor/status_details/translations.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/step_detail_container.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_detail_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/step_detail_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_detail_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/step_page_nav.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_nav.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/step_page_nav.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_nav.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/step_page_title.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_title.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/step_page_title.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_title.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/types.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/types.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/types.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/types.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/translations.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/translations.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/translations.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/README.md b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/README.md similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/README.md rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/README.md diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/constants.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/constants.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/constants.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/constants.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/legend.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/legend.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/legend.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/legend.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/network_requests_total.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/network_requests_total.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/sidebar.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/sidebar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/sidebar.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/sidebar.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/styles.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/styles.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/styles.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/styles.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/translations.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/translations.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/translations.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_flyout.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/use_flyout.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.ts diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/index.tsx b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/index.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/index.tsx rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/index.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/types.ts b/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/types.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/types.ts rename to x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/types.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar_errors.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_errors.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar_errors.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_errors.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar_portal.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_portal.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/action_bar/action_bar_portal.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_portal.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/add_monitor_btn.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/add_monitor_btn.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/add_monitor_btn.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/add_monitor_btn.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/content/index.ts b/x-pack/plugins/synthetics/public/components/monitor_management/content/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/content/index.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/content/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/edit_monitor_config.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/edit_monitor_config.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_enablement.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_enablement.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_enablement.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_enablement.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_format_monitor.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_format_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_format_monitor.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_format_monitor.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors_count.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_inline_errors_count.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_invalid_monitors.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_invalid_monitors.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_invalid_monitors.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_invalid_monitors.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_locations.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_locations.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_locations.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_locations.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_run_once_errors.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_run_once_errors.ts new file mode 100644 index 0000000000000..52218986744c0 --- /dev/null +++ b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_run_once_errors.ts @@ -0,0 +1,99 @@ +/* + * Copyright 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 { useEffect, useMemo, useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { Locations, ServiceLocationErrors } from '../../../../common/runtime_types'; + +export function useRunOnceErrors({ + testRunId, + serviceError, + errors, + locations, +}: { + testRunId: string; + serviceError: null | Error; + errors: ServiceLocationErrors; + locations: Locations; +}) { + const [locationErrors, setLocationErrors] = useState([]); + const [runOnceServiceError, setRunOnceServiceError] = useState(null); + + useEffect(() => { + setLocationErrors([]); + setRunOnceServiceError(null); + }, [testRunId]); + + useEffect(() => { + if (locationErrors.length || errors.length) { + setLocationErrors(errors); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [errors]); + + useEffect(() => { + if (runOnceServiceError?.message !== serviceError?.message) { + setRunOnceServiceError(serviceError); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [serviceError]); + + const locationsById: Record = useMemo( + () => (locations as Locations).reduce((acc, cur) => ({ ...acc, [cur.id]: cur }), {}), + [locations] + ); + + const expectPings = + locations.length - (locationErrors ?? []).filter(({ locationId }) => !!locationId).length; + + const hasBlockingError = + !!runOnceServiceError || + (locationErrors?.length && locationErrors?.length === locations.length); + + const errorMessages = useMemo(() => { + if (hasBlockingError) { + return [{ name: 'Error', message: PushErrorService, title: PushErrorLabel }]; + } else if (locationErrors?.length > 0) { + // If only some of the locations were unsuccessful + return locationErrors + .map(({ locationId }) => locationsById[locationId]) + .filter((location) => !!location) + .map((location) => ({ + name: 'Error', + message: getLocationTestErrorLabel(location.label), + title: RunErrorLabel, + })); + } + + return []; + }, [locationsById, locationErrors, hasBlockingError]); + + return { + expectPings, + hasBlockingError, + blockingErrorMessage: hasBlockingError ? PushErrorService : null, + errorMessages, + }; +} + +const PushErrorLabel = i18n.translate('xpack.uptime.testRun.pushErrorLabel', { + defaultMessage: 'Push error', +}); + +const RunErrorLabel = i18n.translate('xpack.uptime.testRun.runErrorLabel', { + defaultMessage: 'Error running test', +}); + +const getLocationTestErrorLabel = (locationName: string) => + i18n.translate('xpack.uptime.testRun.runErrorLocation', { + defaultMessage: 'Failed to run monitor on location {locationName}.', + values: { locationName }, + }); + +const PushErrorService = i18n.translate('xpack.uptime.testRun.pushError', { + defaultMessage: 'Failed to push the monitor to service.', +}); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/hooks/use_service_allowed.ts b/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_service_allowed.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/hooks/use_service_allowed.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_service_allowed.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/loader/loader.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/loader/loader.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/loader/loader.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/loader/loader.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/mocks/index.ts b/x-pack/plugins/synthetics/public/components/monitor_management/mocks/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/mocks/index.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/mocks/index.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/mocks/locations.ts b/x-pack/plugins/synthetics/public/components/monitor_management/mocks/locations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/mocks/locations.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/mocks/locations.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/locations.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/locations.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/locations.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/locations.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_config.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_config.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_config.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_config.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_fields.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_fields.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_fields.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_fields.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_name_location.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_name_location.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/monitor_name_location.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_name_location.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.ts b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/actions.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/actions.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/actions.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/actions.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/all_monitors.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/all_monitors.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/all_monitors.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/all_monitors.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/delete_monitor.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/delete_monitor.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/delete_monitor.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/delete_monitor.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/enablement_empty_state.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/enablement_empty_state.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/enablement_empty_state.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/enablement_empty_state.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/inline_error.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/inline_error.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/inline_error.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/inline_error.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/invalid_monitors.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/invalid_monitors.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/invalid_monitors.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/invalid_monitors.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_async_error.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_async_error.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_enabled.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_enabled.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list_container.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list_container.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list_container.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_locations.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_locations.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_locations.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_locations.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/stderr_logs_popover.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/stderr_logs_popover.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/stderr_logs_popover.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/stderr_logs_popover.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/tags.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/tags.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/monitor_list/tags.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/tags.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/show_sync_errors.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/show_sync_errors.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/show_sync_errors.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/show_sync_errors.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx similarity index 89% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx index edeb0c57eb31d..2a31d54097d5f 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx @@ -23,7 +23,14 @@ describe('BrowserTestRunResult', function () { }); it('should render properly', async function () { - render(); + render( + + ); expect(await screen.findByText('Test result')).toBeInTheDocument(); expect(await screen.findByText('0 steps completed')).toBeInTheDocument(); const dataApi = (kibanaService.core as any).data.search; @@ -55,18 +62,34 @@ describe('BrowserTestRunResult', function () { ); }); - it('should displays results', async function () { + it('should display results', async function () { jest.spyOn(runOnceHooks, 'useBrowserRunOnceMonitors').mockReturnValue({ data, - stepListData: { steps: [stepEndDoc._source] } as any, - loading: false, - stepsLoading: false, - journeyStarted: true, - summaryDoc: summaryDoc._source, - stepEnds: [stepEndDoc._source], + summariesLoading: false, + stepLoadingInProgress: false, + expectedSummariesLoaded: true, + lastUpdated: Date.now(), + checkGroupResults: [ + { + checkGroupId: 'c01406bf-7467-11ec-9858-aa31996e0afe', + stepsLoading: false, + journeyStarted: true, + summaryDoc: summaryDoc._source, + journeyDoc: summaryDoc._source, + steps: [stepEndDoc._source], + completedSteps: 1, + }, + ], }); - render(); + render( + + ); expect(await screen.findByText('Test result')).toBeInTheDocument(); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx new file mode 100644 index 0000000000000..e5ca115b09b97 --- /dev/null +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx @@ -0,0 +1,138 @@ +/* + * Copyright 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 { useEffect } from 'react'; +import * as React from 'react'; +import { EuiAccordion, EuiText, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import styled from 'styled-components'; +import { StepsList } from '../../../synthetics/check_steps/steps_list'; +import { CheckGroupResult, useBrowserRunOnceMonitors } from './use_browser_run_once_monitors'; +import { TestResultHeader } from '../test_result_header'; +import { StdErrorLogs } from '../../../synthetics/check_steps/stderr_logs'; + +interface Props { + monitorId: string; + isMonitorSaved: boolean; + expectPings: number; + onDone: () => void; +} +export const BrowserTestRunResult = ({ monitorId, isMonitorSaved, expectPings, onDone }: Props) => { + const { summariesLoading, expectedSummariesLoaded, stepLoadingInProgress, checkGroupResults } = + useBrowserRunOnceMonitors({ + configId: monitorId, + expectSummaryDocs: expectPings, + }); + + useEffect(() => { + if (expectedSummariesLoaded) { + onDone(); + } + }, [onDone, expectedSummariesLoaded]); + + return ( + <> + {checkGroupResults.map((checkGroupResult) => { + const { checkGroupId, journeyStarted, summaryDoc, stepsLoading, steps, completedSteps } = + checkGroupResult; + const isStepsLoading = !summariesLoading && journeyStarted && summaryDoc && stepsLoading; + const isStepsLoadingFailed = + summaryDoc && !summariesLoading && !stepLoadingInProgress && steps.length === 0; + + return ( + + {isStepsLoading && ( + + + {LOADING_STEPS} + + + + + + )} + {isStepsLoadingFailed && ( + {summaryDoc?.error?.message ?? FAILED_TO_RUN} + )} + + {isStepsLoadingFailed && + summaryDoc?.error?.message?.includes('journey did not finish executing') && ( + + )} + + {summaryDoc && completedSteps > 0 && ( + + )} + + ); + })} + + ); +}; + +const AccordionWrapper = styled(EuiAccordion)` + .euiAccordion__buttonContent { + width: 100%; + } +`; + +function getButtonContent({ + journeyDoc, + summaryDoc, + checkGroupId, + journeyStarted, + completedSteps, +}: CheckGroupResult) { + return ( +
+ + +

+ + {i18n.translate('xpack.uptime.monitorManagement.stepCompleted', { + defaultMessage: + '{stepCount, number} {stepCount, plural, one {step} other {steps}} completed', + values: { + stepCount: completedSteps ?? 0, + }, + })} + +

+
+
+ ); +} + +const FAILED_TO_RUN = i18n.translate('xpack.uptime.monitorManagement.failedRun', { + defaultMessage: 'Failed to run steps', +}); + +const LOADING_STEPS = i18n.translate('xpack.uptime.monitorManagement.loadingSteps', { + defaultMessage: 'Loading steps...', +}); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx similarity index 62% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx index 285a4a4140c27..332af4403e180 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx @@ -26,18 +26,34 @@ describe('useBrowserRunOnceMonitors', function () { }, }); - const { result } = renderHook(() => useBrowserRunOnceMonitors({ configId: 'test-id' }), { - wrapper: WrappedHelper, - }); + const { result } = renderHook( + () => + useBrowserRunOnceMonitors({ + configId: 'test-id', + testRunId: 'test-run-id', + expectSummaryDocs: 1, + }), + { + wrapper: WrappedHelper, + } + ); expect(result.current).toEqual({ data: undefined, - journeyStarted: false, - loading: true, - stepsLoading: true, - stepEnds: [], - stepListData: undefined, - summaryDoc: undefined, + expectedSummariesLoaded: false, + lastUpdated: expect.any(Number), + stepLoadingInProgress: true, + summariesLoading: true, + checkGroupResults: [ + { + checkGroupId: 'placeholder-check-group-0', + completedSteps: 0, + steps: [], + summaryDoc: undefined, + journeyStarted: false, + stepsLoading: true, + }, + ], }); }); }); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts new file mode 100644 index 0000000000000..68f96b5d7b487 --- /dev/null +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts @@ -0,0 +1,278 @@ +/* + * Copyright 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 { useEffect, useState, useRef } from 'react'; +import { createEsParams, useEsSearch, useFetcher } from '@kbn/observability-plugin/public'; +import { JourneyStep } from '../../../../../common/runtime_types'; +import { useTickTick } from '../use_tick_tick'; +import { fetchJourneySteps } from '../../../../state/api/journey'; +import { isStepEnd } from '../../../synthetics/check_steps/steps_list'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants'; + +export interface CheckGroupResult { + checkGroupId: string; + journeyStarted: boolean; + journeyDoc?: JourneyStep; + summaryDoc?: JourneyStep; + steps: JourneyStep[]; + stepsLoading: boolean; + completedSteps: number; +} + +export const useBrowserEsResults = ({ + configId, + testRunId, + lastRefresh, +}: { + configId: string; + testRunId?: string; + lastRefresh: number; +}) => { + return useEsSearch( + createEsParams({ + index: SYNTHETICS_INDEX_PATTERN, + body: { + sort: [ + { + '@timestamp': 'desc', + }, + ], + query: { + bool: { + filter: [ + { + term: { + config_id: configId, + }, + }, + { + terms: { + 'synthetics.type': ['heartbeat/summary', 'journey/start'], + }, + }, + ...(testRunId + ? [ + { + term: { + test_run_id: testRunId, + }, + }, + ] + : []), + ], + }, + }, + }, + size: 1000, + }), + [configId, lastRefresh], + { name: 'TestRunData' } + ); +}; + +export const useBrowserRunOnceMonitors = ({ + configId, + testRunId, + skipDetails = false, + refresh = true, + expectSummaryDocs, +}: { + configId: string; + testRunId?: string; + refresh?: boolean; + skipDetails?: boolean; + expectSummaryDocs: number; +}) => { + const { refreshTimer, lastRefresh } = useTickTick(3 * 1000, refresh); + + const [checkGroupResults, setCheckGroupResults] = useState(() => { + return new Array(expectSummaryDocs) + .fill({ + checkGroupId: '', + journeyStarted: false, + steps: [], + stepsLoading: false, + completedSteps: 0, + } as CheckGroupResult) + .map((emptyCheckGroup, index) => ({ + ...emptyCheckGroup, + checkGroupId: `placeholder-check-group-${index}`, + })); + }); + + const lastUpdated = useRef<{ checksum: string; time: number }>({ + checksum: '', + time: Date.now(), + }); + + const { data, loading: summariesLoading } = useBrowserEsResults({ + configId, + testRunId, + lastRefresh, + }); + + useEffect(() => { + const hits = data?.hits.hits; + + if (hits && hits.length > 0) { + const allDocs = (hits ?? []).map(({ _source }) => _source as JourneyStep); + const checkGroupsById = allDocs + .filter( + (doc) => + doc.synthetics?.type === 'journey/start' || doc.synthetics?.type === 'heartbeat/summary' + ) + .reduce( + (acc, cur) => ({ + ...acc, + [cur.monitor.check_group]: { + checkGroupId: cur.monitor.check_group, + journeyStarted: true, + journeyDoc: cur, + summaryDoc: null, + steps: [], + stepsLoading: false, + completedSteps: 0, + }, + }), + {} + ) as Record; + + allDocs.forEach((step) => { + if (step.synthetics?.type === 'heartbeat/summary') { + checkGroupsById[step.monitor.check_group].summaryDoc = step; + } + }); + + const checkGroups = Object.values(checkGroupsById); + const finishedCheckGroups = checkGroups.filter((group) => !!group.summaryDoc); + + if (finishedCheckGroups.length >= expectSummaryDocs) { + clearInterval(refreshTimer); + } + + replaceCheckGroupResults(checkGroups); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [expectSummaryDocs, data, refreshTimer]); + + // Loading steps for browser runs + const checkGroupIds = checkGroupResults.map(({ checkGroupId }) => checkGroupId); + const checkGroupCheckSum = checkGroupIds.reduce((acc, cur) => acc + cur, ''); + const { loading: stepLoadingInProgress } = useFetcher(() => { + if (checkGroupIds.length && !skipDetails) { + setCheckGroupResults((prevState) => { + return prevState.map((result) => ({ ...result, stepsLoading: true })); + }); + + return Promise.all( + checkGroupIds.map((id) => { + return fetchJourneySteps({ + checkGroup: id, + }) + .then((stepsData) => { + updateCheckGroupResult(stepsData.checkGroup, { + steps: stepsData.steps, + completedSteps: stepsData.steps.filter(isStepEnd).length, + }); + + return stepsData; + }) + .finally(() => { + updateCheckGroupResult(id, { + stepsLoading: false, + }); + }); + }) + ); + } + + return Promise.resolve(null); + }, [checkGroupCheckSum, setCheckGroupResults, lastRefresh]); + + // Whenever a new found document is fetched, update lastUpdated + useEffect(() => { + const currentChecksum = getCheckGroupChecksum(checkGroupResults); + if (checkGroupCheckSum !== lastUpdated.current.checksum) { + // Mutating lastUpdated + lastUpdated.current.checksum = currentChecksum; + lastUpdated.current.time = Date.now(); + } + }, [checkGroupResults, checkGroupCheckSum]); + + const updateCheckGroupResult = (id: string, result: Partial) => { + setCheckGroupResults((prevState) => { + return prevState.map((r) => { + if (id !== r.checkGroupId) { + return r; + } + + return mergeCheckGroups(r, result); + }) as CheckGroupResult[]; + }); + }; + + const replaceCheckGroupResults = (curCheckGroups: CheckGroupResult[]) => { + const emptyCheckGroups = checkGroupResults.filter((group) => + group.checkGroupId.startsWith('placeholder-check-group') + ); + + // Padding the collection with placeholders so that rows could be shown on UI with loading state + const paddedCheckGroups = + curCheckGroups.length < expectSummaryDocs + ? [ + ...curCheckGroups, + ...emptyCheckGroups.slice(-1 * (expectSummaryDocs - curCheckGroups.length)), + ] + : curCheckGroups; + + setCheckGroupResults((prevCheckGroups) => { + const newIds = paddedCheckGroups.map(({ checkGroupId }) => checkGroupId); + const newById: Record = paddedCheckGroups.reduce( + (acc, cur) => ({ ...acc, [cur.checkGroupId]: cur }), + {} + ); + const oldById: Record = prevCheckGroups.reduce( + (acc, cur) => ({ ...acc, [cur.checkGroupId]: cur }), + {} + ); + + return newIds.map((id) => mergeCheckGroups(oldById[id], newById[id])); + }); + }; + + return { + data, + summariesLoading, + stepLoadingInProgress, + expectedSummariesLoaded: + checkGroupResults.filter(({ summaryDoc }) => !!summaryDoc).length >= expectSummaryDocs, + checkGroupResults, + lastUpdated: lastUpdated.current.time, + }; +}; + +function mergeCheckGroups(prev: CheckGroupResult, curr: Partial) { + // Once completed steps has been determined and shown, don't lower the number on UI due to re-fetch + const completedSteps = curr.completedSteps + ? Math.max(prev?.completedSteps ?? 0, curr.completedSteps ?? 0) + : prev?.completedSteps ?? 0; + + return { + ...(prev ?? {}), + ...curr, + completedSteps, + }; +} + +function getCheckGroupChecksum(checkGroupResults: CheckGroupResult[]) { + return checkGroupResults.reduce((acc, cur) => { + return ( + acc + cur?.journeyDoc?._id ?? + '' + cur?.summaryDoc?._id ?? + '' + (cur?.steps ?? []).reduce((stepAcc, { _id }) => stepAcc + _id, '') + ); + }, ''); +} diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx similarity index 94% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx index da27837a34e8c..6ef4daf9fbdf3 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx @@ -23,7 +23,7 @@ describe('SimpleTestResults', function () { }); it('should render properly', async function () { - render(); + render(); expect(await screen.findByText('Test result')).toBeInTheDocument(); const dataApi = (kibanaService.core as any).data.search; @@ -51,15 +51,18 @@ describe('SimpleTestResults', function () { const doc = data.hits.hits[0]; jest.spyOn(runOnceHooks, 'useSimpleRunOnceMonitors').mockReturnValue({ data: data as any, - summaryDoc: { - ...(doc._source as unknown as Ping), - timestamp: (doc._source as unknown as Record)?.['@timestamp'], - docId: doc._id, - }, + summaryDocs: [ + { + ...(doc._source as unknown as Ping), + timestamp: (doc._source as unknown as Record)?.['@timestamp'], + docId: doc._id, + }, + ], loading: false, + lastUpdated: Date.now(), }); - render(); + render(); expect(await screen.findByText('Test result')).toBeInTheDocument(); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx new file mode 100644 index 0000000000000..b1ac899a8951e --- /dev/null +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx @@ -0,0 +1,53 @@ +/* + * Copyright 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, useState } from 'react'; +import { useSimpleRunOnceMonitors } from './use_simple_run_once_monitors'; +import { Ping } from '../../../../../common/runtime_types'; +import { PingListTable } from '../../../monitor/ping_list/ping_list_table'; +import { TestResultHeader } from '../test_result_header'; + +interface Props { + monitorId: string; + expectPings: number; + onDone: () => void; +} +export function SimpleTestResults({ monitorId, expectPings, onDone }: Props) { + const [summaryDocsCache, setSummaryDocsCache] = useState([]); + const { summaryDocs, loading } = useSimpleRunOnceMonitors({ + configId: monitorId, + expectSummaryDocs: expectPings, + }); + + useEffect(() => { + if (summaryDocs) { + setSummaryDocsCache((prevState: Ping[]) => { + const prevById: Record = prevState.reduce( + (acc, cur) => ({ ...acc, [cur.docId]: cur }), + {} + ); + return summaryDocs.map((updatedDoc) => ({ + ...updatedDoc, + ...(prevById[updatedDoc.docId] ?? {}), + })); + }); + + if (summaryDocs.length >= expectPings) { + onDone(); + } + } + }, [expectPings, summaryDocs, onDone]); + + return ( + <> + = expectPings)} + /> + {summaryDocs && } + + ); +} diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts similarity index 65% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts index 5d12662d1e113..3ca3691aef22c 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useMemo } from 'react'; +import { useMemo, useRef } from 'react'; import { createEsParams, useEsSearch } from '@kbn/observability-plugin/public'; import { Ping } from '../../../../../common/runtime_types'; import { useTickTick } from '../use_tick_tick'; @@ -13,9 +13,11 @@ import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants'; export const useSimpleRunOnceMonitors = ({ configId, + expectSummaryDocs, testRunId, }: { configId: string; + expectSummaryDocs: number; testRunId?: string; }) => { const { refreshTimer, lastRefresh } = useTickTick(2 * 1000, false); @@ -61,26 +63,46 @@ export const useSimpleRunOnceMonitors = ({ { name: 'TestRunData' } ); + const lastUpdated = useRef<{ checksum: string; time: number }>({ + checksum: '', + time: Date.now(), + }); + return useMemo(() => { - const doc = data?.hits.hits?.[0]; + const docs = data?.hits.hits ?? []; + + // Whenever a new found document is fetched, update lastUpdated + const docsChecksum = docs + .map(({ _id }: { _id: string }) => _id) + .reduce((acc, cur) => acc + cur, ''); + if (docsChecksum !== lastUpdated.current.checksum) { + // Mutating lastUpdated + lastUpdated.current.checksum = docsChecksum; + lastUpdated.current.time = Date.now(); + } + + if (docs.length > 0) { + if (docs.length >= expectSummaryDocs) { + clearInterval(refreshTimer); + } - if (doc) { - clearInterval(refreshTimer); return { data, loading, - summaryDoc: { + summaryDocs: docs.map((doc) => ({ ...(doc._source as Ping), timestamp: (doc._source as Record)?.['@timestamp'], docId: doc._id, - }, + })), + lastUpdated: lastUpdated.current.time, }; } return { data, loading, - summaryDoc: null, + summaryDocs: null, + lastUpdated: lastUpdated.current.time, }; - }, [data, loading, refreshTimer]); + }, [expectSummaryDocs, data, loading, refreshTimer]); }; diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx similarity index 53% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx index 4a3f155a18813..da06b41d16530 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx @@ -10,24 +10,42 @@ import { screen } from '@testing-library/react'; import { render } from '../../../lib/helper/rtl_helpers'; import { TestNowMode } from './test_now_mode'; import { kibanaService } from '../../../state/kibana_service'; -import { MonitorFields } from '../../../../common/runtime_types'; +import { Locations, MonitorFields } from '../../../../common/runtime_types'; +import * as runOnceErrorHooks from '../hooks/use_run_once_errors'; describe('TestNowMode', function () { + const locations: Locations = [ + { + id: 'test-location-id', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + }, + ]; + const testMonitor = { + id: 'test-monitor-id', + type: 'browser', + locations, + } as unknown as MonitorFields; + const testRun = { id: 'test-run-id', monitor: testMonitor }; const onDone = jest.fn(); + beforeEach(() => { + jest.spyOn(runOnceErrorHooks, 'useRunOnceErrors').mockReturnValue({ + expectPings: 1, + hasBlockingError: false, + blockingErrorMessage: '', + errorMessages: [], + }); + }); + afterEach(() => { jest.resetAllMocks(); }); it('should render properly', async function () { - render( - - ); - expect(await screen.findByText('Test result')).toBeInTheDocument(); + render(); expect(await screen.findByText('PENDING')).toBeInTheDocument(); expect(await screen.findByText('0 steps completed')).toBeInTheDocument(); @@ -36,7 +54,7 @@ describe('TestNowMode', function () { expect(kibanaService.core.http.post).toHaveBeenLastCalledWith( expect.stringContaining('/internal/uptime/service/monitors/run_once/'), - { body: '{"type":"browser"}', method: 'POST' } + { body: JSON.stringify(testMonitor), method: 'POST' } ); }); }); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_now_mode.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.tsx similarity index 65% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_now_mode.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.tsx index fc5ab8aef94e4..0cc5f0658ff44 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_now_mode.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.tsx @@ -16,8 +16,9 @@ import { EuiSpacer, } from '@elastic/eui'; import { useFetcher } from '@kbn/observability-plugin/public'; +import { useRunOnceErrors } from '../hooks/use_run_once_errors'; import { TestRunResult } from './test_run_results'; -import { MonitorFields } from '../../../../common/runtime_types'; +import { Locations, MonitorFields, ServiceLocationErrors } from '../../../../common/runtime_types'; import { runOnceMonitor } from '../../../state/api'; import { kibanaService } from '../../../state/kibana_service'; @@ -43,31 +44,37 @@ export function TestNowMode({ monitor: testRun.monitor, id: testRun.id, }) - .then(() => setServiceError(null)) + .then((d) => { + setServiceError(null); + return d; + }) .catch((error) => setServiceError(error)); } return new Promise((resolve) => resolve(null)); }, [testRun]); - useEffect(() => { - const errors = (data as { errors: Array<{ error: Error }> })?.errors; - - if (errors?.length > 0) { - errors.forEach(({ error }) => { - kibanaService.toasts.addError(error, { title: PushErrorLabel }); - }); - } - }, [data]); + const errors = (data as { errors?: ServiceLocationErrors })?.errors; - const errors = (data as { errors?: Array<{ error: Error }> })?.errors; + const { hasBlockingError, blockingErrorMessage, expectPings, errorMessages } = useRunOnceErrors({ + testRunId: testRun?.id ?? '', + serviceError, + errors: errors ?? [], + locations: (testRun?.monitor.locations ?? []) as Locations, + }); - const hasErrors = serviceError || (errors && errors?.length > 0); + useEffect(() => { + errorMessages.forEach( + ({ name, message, title }: { name: string; message: string; title: string }) => { + kibanaService.toasts.addError({ name, message }, { title }); + } + ); + }, [errorMessages]); useEffect(() => { - if (!isPushing && (!testRun || hasErrors)) { + if (!isPushing && (!testRun || hasBlockingError)) { onDone(); } - }, [testRun, hasErrors, isPushing, onDone]); + }, [testRun, hasBlockingError, isPushing, onDone]); if (!testRun) { return null; @@ -81,15 +88,19 @@ export function TestNowMode({ )} - {hasErrors && !isPushing && } + {(hasBlockingError && !isPushing && ( + + )) || + null} - {testRun && !hasErrors && !isPushing && ( + {testRun && !hasBlockingError && !isPushing && ( @@ -103,11 +114,3 @@ export function TestNowMode({ const PushingLabel = i18n.translate('xpack.uptime.testRun.pushing.description', { defaultMessage: 'Pushing the monitor to service...', }); - -const PushError = i18n.translate('xpack.uptime.testRun.pushError', { - defaultMessage: 'Failed to push the monitor to service.', -}); - -const PushErrorLabel = i18n.translate('xpack.uptime.testRun.pushErrorLabel', { - defaultMessage: 'Push error', -}); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.test.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.test.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.test.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.tsx similarity index 92% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.tsx index 38679ebff3b60..7c53e99a6e9af 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_result_header.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.tsx @@ -21,14 +21,20 @@ import { JourneyStep, Ping } from '../../../../common/runtime_types'; import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; interface Props { - doc?: JourneyStep; + checkGroupId?: string; summaryDocs?: Ping[] | JourneyStep[] | null; journeyStarted?: boolean; title?: string; isCompleted: boolean; } -export function TestResultHeader({ doc, title, summaryDocs, journeyStarted, isCompleted }: Props) { +export function TestResultHeader({ + checkGroupId, + title, + summaryDocs, + journeyStarted, + isCompleted, +}: Props) { const { basePath } = useUptimeSettingsContext(); let duration = 0; if (summaryDocs && summaryDocs.length > 0) { @@ -76,12 +82,9 @@ export function TestResultHeader({ doc, title, summaryDocs, journeyStarted, isCo )} - {doc && ( + {checkGroupId && ( - + {VIEW_DETAILS} diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_run_results.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_run_results.tsx similarity index 63% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_run_results.tsx rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_run_results.tsx index 27c9eb8426a31..b1a6d0aba8cfc 100644 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/test_run_results.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_run_results.tsx @@ -14,12 +14,24 @@ interface Props { monitorId: string; monitor: SyntheticsMonitor; isMonitorSaved: boolean; + expectPings: number; onDone: () => void; } -export const TestRunResult = ({ monitorId, monitor, isMonitorSaved, onDone }: Props) => { +export const TestRunResult = ({ + monitorId, + monitor, + isMonitorSaved, + expectPings, + onDone, +}: Props) => { return monitor.type === 'browser' ? ( - + ) : ( - + ); }; diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/use_tick_tick.ts b/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/use_tick_tick.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/use_tick_tick.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/use_tick_tick.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/validation.test.ts b/x-pack/plugins/synthetics/public/components/monitor_management/validation.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/validation.test.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/validation.test.ts diff --git a/x-pack/plugins/uptime/public/components/monitor_management/validation.ts b/x-pack/plugins/synthetics/public/components/monitor_management/validation.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/monitor_management/validation.ts rename to x-pack/plugins/synthetics/public/components/monitor_management/validation.ts diff --git a/x-pack/plugins/uptime/public/components/overview/__snapshots__/snapshot_heading.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/__snapshots__/snapshot_heading.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/__snapshots__/snapshot_heading.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/__snapshots__/snapshot_heading.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alert_expression_popover.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alert_expression_popover.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alert_expression_popover.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alert_expression_popover.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alert_field_number.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alert_query_bar/query_bar.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alert_query_bar/query_bar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alert_query_bar/query_bar.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alert_query_bar/query_bar.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alert_tls.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alert_tls.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alert_tls.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alert_tls.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_tls.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_tls.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/alert_tls.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_tls.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/index.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/index.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/use_snap_shot.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/use_snap_shot.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/alerts_containers/use_snap_shot.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/use_snap_shot.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/select_severity.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/select_severity.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/select_severity.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/select_severity.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/translations.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/anomaly_alert/translations.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/translations.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/index.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/index.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/availability_expression_select.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/availability_expression_select.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/availability_expression_select.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/availability_expression_select.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/down_number_select.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/index.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/index.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/status_expression_select.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/status_expression_select.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/status_expression_select.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/status_expression_select.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_expression_select.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/translations.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/translations.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/translations.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/settings_message_expression_popover.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/settings_message_expression_popover.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/settings_message_expression_popover.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/settings_message_expression_popover.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.test.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/toggle_alert_flyout_button.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/translations.ts b/x-pack/plugins/synthetics/public/components/overview/alerts/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/translations.ts rename to x-pack/plugins/synthetics/public/components/overview/alerts/translations.ts diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx b/x-pack/plugins/synthetics/public/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx rename to x-pack/plugins/synthetics/public/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_error.tsx b/x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_error.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_error.tsx rename to x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_error.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_loading.tsx b/x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_loading.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_loading.tsx rename to x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_loading.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/use_has_data.tsx b/x-pack/plugins/synthetics/public/components/overview/empty_state/use_has_data.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/empty_state/use_has_data.tsx rename to x-pack/plugins/synthetics/public/components/overview/empty_state/use_has_data.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_group.test.tsx b/x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/filter_group/filter_group.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_group.tsx b/x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/filter_group/filter_group.tsx rename to x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/selected_filters.tsx b/x-pack/plugins/synthetics/public/components/overview/filter_group/selected_filters.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/filter_group/selected_filters.tsx rename to x-pack/plugins/synthetics/public/components/overview/filter_group/selected_filters.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/translations.tsx b/x-pack/plugins/synthetics/public/components/overview/filter_group/translations.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/filter_group/translations.tsx rename to x-pack/plugins/synthetics/public/components/overview/filter_group/translations.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/index.ts b/x-pack/plugins/synthetics/public/components/overview/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/index.ts rename to x-pack/plugins/synthetics/public/components/overview/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/cert_status_column.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/cert_status_column.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/define_connectors.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/define_connectors.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/define_connectors.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/define_connectors.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/enable_alert.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_name_col.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_name_col.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.tsx similarity index 89% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.tsx index 8d8ed5dc684f4..92d7620b55938 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useCallback } from 'react'; +import React, { useCallback, useEffect } from 'react'; import moment, { Moment } from 'moment'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; @@ -20,6 +20,8 @@ import { } from '@elastic/eui'; import { useDispatch, useSelector } from 'react-redux'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; +import { kibanaService } from '../../../../state/kibana_service'; +import { useRunOnceErrors } from '../../../monitor_management/hooks/use_run_once_errors'; import { parseTimestamp } from '../parse_timestamp'; import { DataStream, Ping, PingError } from '../../../../../common/runtime_types'; import { @@ -189,6 +191,25 @@ export const MonitorListStatusColumn = ({ const testNowRun = useSelector(testNowRunSelector(configId)); + const { expectPings, errorMessages, hasBlockingError } = useRunOnceErrors({ + testRunId: testNowRun?.monitorId ?? '', + serviceError: (testNowRun?.fetchError as Error) ?? null, + locations: testNowRun?.locations ?? [], + errors: testNowRun?.errors ?? [], + }); + + useEffect(() => { + errorMessages.forEach( + ({ name, message, title }: { name: string; message: string; title: string }) => { + kibanaService.toasts.addError({ name, message }, { title }); + } + ); + + if (hasBlockingError) { + stopProgressTrack(); + } + }, [errorMessages, hasBlockingError, stopProgressTrack]); + return (
@@ -200,6 +221,8 @@ export const MonitorListStatusColumn = ({ testRunId={testNowRun?.testRunId} monitorType={monitorType as DataStream} duration={duration ?? 0} + schedule={testNowRun.schedule} + expectPings={expectPings} stopProgressTrack={stopProgressTrack} /> ) : ( diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx similarity index 50% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx index c0453573693c4..b92916bd7b72b 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx +++ b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx @@ -6,7 +6,9 @@ */ import { EuiBadge, EuiProgress } from '@elastic/eui'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; +import { scheduleToMilli } from '../../../../../../common/lib/schedule_to_time'; +import { SyntheticsMonitorSchedule } from '../../../../../../common/runtime_types'; import { useBrowserRunOnceMonitors } from '../../../../monitor_management/test_now_mode/browser/use_browser_run_once_monitors'; import { IN_PROGRESS_LABEL, @@ -17,52 +19,54 @@ export const BrowserMonitorProgress = ({ configId, testRunId, duration, + schedule, isUpdating, + expectPings, updateMonitorStatus, + stopProgressTrack, }: { configId: string; testRunId: string; duration: number; + schedule: SyntheticsMonitorSchedule; isUpdating: boolean; + expectPings: number; updateMonitorStatus: () => void; + stopProgressTrack: () => void; }) => { - const { journeyStarted, summaryDoc, data } = useBrowserRunOnceMonitors({ - configId, - testRunId, - refresh: false, - skipDetails: true, - }); + const { data, checkGroupResults, lastUpdated, expectedSummariesLoaded } = + useBrowserRunOnceMonitors({ + configId, + testRunId, + refresh: false, + skipDetails: true, + expectSummaryDocs: expectPings, + }); - const [startTime, setStartTime] = useState(Date.now()); + const journeyStarted = checkGroupResults.some((result) => result.journeyStarted); const [passedTime, setPassedTime] = useState(0); + const startTime = useRef(Date.now()); + useEffect(() => { - if (summaryDoc) { + if (expectedSummariesLoaded) { updateMonitorStatus(); } - }, [updateMonitorStatus, summaryDoc]); + }, [updateMonitorStatus, expectedSummariesLoaded]); useEffect(() => { - const interVal = setInterval(() => { - if (journeyStarted) { - setPassedTime((Date.now() - startTime) * 1000); - } - }, 500); - const startTimeValue = startTime; - return () => { - if ((Date.now() - startTimeValue) * 1000 > duration) { - clearInterval(interVal); - } - }; - }, [data, duration, journeyStarted, startTime]); + setPassedTime((Date.now() - startTime.current) * 1000); - useEffect(() => { - if (journeyStarted) { - setStartTime(Date.now()); + // Stop waiting for docs if time elapsed is more than monitor frequency + const timeSinceLastDoc = Date.now() - lastUpdated; + const usualDurationMilli = duration / 1000; + const maxTimeout = scheduleToMilli(schedule) - usualDurationMilli; + if (timeSinceLastDoc >= maxTimeout) { + stopProgressTrack(); } - }, [journeyStarted]); + }, [data, checkGroupResults, lastUpdated, duration, schedule, stopProgressTrack]); - if (isUpdating || passedTime > duration) { + if (journeyStarted && (isUpdating || passedTime > duration)) { return ( <> {IN_PROGRESS_LABEL} @@ -72,7 +76,7 @@ export const BrowserMonitorProgress = ({ } return ( - + <> {journeyStarted ? ( <> {IN_PROGRESS_LABEL} @@ -84,6 +88,6 @@ export const BrowserMonitorProgress = ({ )} - + ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx similarity index 81% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx index e4fc0cf90e87b..b03d278f09d45 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx +++ b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx @@ -9,7 +9,7 @@ import React, { useEffect } from 'react'; import { useSelector } from 'react-redux'; import { SimpleMonitorProgress } from './simple_monitor_progress'; import { BrowserMonitorProgress } from './browser_monitor_progress'; -import { DataStream } from '../../../../../../common/runtime_types'; +import { DataStream, SyntheticsMonitorSchedule } from '../../../../../../common/runtime_types'; import { useUpdatedMonitor } from './use_updated_monitor'; import { refreshedMonitorSelector } from '../../../../../state/reducers/monitor_list'; @@ -19,6 +19,8 @@ export const MonitorProgress = ({ testRunId, duration, monitorType, + schedule, + expectPings, stopProgressTrack, }: { monitorId: string; @@ -26,6 +28,8 @@ export const MonitorProgress = ({ testRunId: string; duration: number; monitorType: DataStream; + schedule: SyntheticsMonitorSchedule; + expectPings: number; stopProgressTrack: () => void; }) => { const { updateMonitorStatus, isUpdating } = useUpdatedMonitor({ @@ -46,16 +50,22 @@ export const MonitorProgress = ({ configId={configId} testRunId={testRunId} duration={duration} + schedule={schedule} + expectPings={expectPings} isUpdating={isUpdating} updateMonitorStatus={updateMonitorStatus} + stopProgressTrack={stopProgressTrack} /> ) : ( ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx similarity index 62% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx index d51ae3f4e9dff..f93bcadd58519 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx +++ b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx @@ -7,6 +7,8 @@ import { EuiBadge, EuiProgress } from '@elastic/eui'; import React, { useEffect, useRef, useState } from 'react'; +import { scheduleToMilli } from '../../../../../../common/lib/schedule_to_time'; +import { SyntheticsMonitorSchedule } from '../../../../../../common/runtime_types'; import { useSimpleRunOnceMonitors } from '../../../../monitor_management/test_now_mode/simple/use_simple_run_once_monitors'; import { IN_PROGRESS_LABEL } from '../../../../monitor_management/test_now_mode/test_result_header'; @@ -14,18 +16,25 @@ export const SimpleMonitorProgress = ({ monitorId, testRunId, duration, + schedule, + expectPings, isUpdating, updateMonitorStatus, + stopProgressTrack, }: { monitorId: string; testRunId: string; duration: number; + schedule: SyntheticsMonitorSchedule; + expectPings: number; isUpdating: boolean; updateMonitorStatus: () => void; + stopProgressTrack: () => void; }) => { - const { summaryDoc, data } = useSimpleRunOnceMonitors({ + const { summaryDocs, data, lastUpdated } = useSimpleRunOnceMonitors({ configId: monitorId, testRunId, + expectSummaryDocs: expectPings, }); const startTime = useRef(Date.now()); @@ -33,14 +42,22 @@ export const SimpleMonitorProgress = ({ const [passedTime, setPassedTime] = useState(Date.now()); useEffect(() => { - if (summaryDoc) { + if (summaryDocs?.length) { updateMonitorStatus(); } - }, [updateMonitorStatus, summaryDoc]); + }, [updateMonitorStatus, summaryDocs]); useEffect(() => { setPassedTime(Date.now() - startTime.current); - }, [data]); + + // Stop waiting for docs if time elapsed is more than monitor frequency + const timeSinceLastDoc = Date.now() - lastUpdated; + const usualDurationMilli = duration / 1000; + const maxTimeout = scheduleToMilli(schedule) - usualDurationMilli; + if (timeSinceLastDoc >= maxTimeout) { + stopProgressTrack(); + } + }, [data, lastUpdated, duration, schedule, stopProgressTrack]); const passedTimeMicro = passedTime * 1000; @@ -54,9 +71,9 @@ export const SimpleMonitorProgress = ({ } return ( - + <> {IN_PROGRESS_LABEL} - + ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/status_badge.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/status_badge.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/status_badge.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/status_badge.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/test_now_col.tsx similarity index 84% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/test_now_col.tsx index 3248f65963d77..b877da1824370 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/test_now_col.tsx +++ b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/test_now_col.tsx @@ -5,12 +5,12 @@ * 2.0. */ -import React from 'react'; +import { EuiButtonIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { EuiButtonIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; import { testNowMonitorAction } from '../../../../state/actions'; -import { testNowRunSelector } from '../../../../state/reducers/test_now_runs'; +import { testNowRunSelector, TestRunStats } from '../../../../state/reducers/test_now_runs'; export const TestNowColumn = ({ monitorId, @@ -35,7 +35,10 @@ export const TestNowColumn = ({ dispatch(testNowMonitorAction.get(configId)); }; - if (testNowRun && testNowRun.status === 'loading') { + const isTestNowLoading = testNowRun && testNowRun.status === TestRunStats.LOADING; + const isTestNowCompleted = !testNowRun || testNowRun.status === TestRunStats.COMPLETED; + + if (isTestNowLoading) { return ; } @@ -44,7 +47,7 @@ export const TestNowColumn = ({ testNowClick()} - isDisabled={Boolean(testNowRun)} + isDisabled={!isTestNowCompleted} aria-label={TEST_NOW_ARIA_LABEL} /> diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/translations.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/columns/translations.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/translations.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/filter_status_button.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/index.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/index.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_container.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/data.json b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/data.json similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/data.json rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/data.json diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/index.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/index.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_header.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_header.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_header.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_header.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_page_size_select.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/no_items_meesage.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_meesage.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/no_items_meesage.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_meesage.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/no_items_message.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_message.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/no_items_message.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_message.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/overview_page_link.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/overview_page_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/overview_page_link.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/overview_page_link.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/parse_timestamp.test.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/parse_timestamp.test.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.test.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/parse_timestamp.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/parse_timestamp.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.test.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/status_filter.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/translations.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/translations.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/translations.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/troubleshoot_popover.tsx b/x-pack/plugins/synthetics/public/components/overview/monitor_list/troubleshoot_popover.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/troubleshoot_popover.tsx rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/troubleshoot_popover.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/types.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/types.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/types.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/types.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/use_monitor_histogram.ts b/x-pack/plugins/synthetics/public/components/overview/monitor_list/use_monitor_histogram.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/use_monitor_histogram.ts rename to x-pack/plugins/synthetics/public/components/overview/monitor_list/use_monitor_histogram.ts diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/query_bar.tsx b/x-pack/plugins/synthetics/public/components/overview/query_bar/query_bar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/query_bar/query_bar.tsx rename to x-pack/plugins/synthetics/public/components/overview/query_bar/query_bar.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/translations.ts b/x-pack/plugins/synthetics/public/components/overview/query_bar/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/query_bar/translations.ts rename to x-pack/plugins/synthetics/public/components/overview/query_bar/translations.ts diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.test.tsx b/x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.ts b/x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.ts rename to x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.ts diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap b/x-pack/plugins/synthetics/public/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/index.ts b/x-pack/plugins/synthetics/public/components/overview/snapshot/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot/index.ts rename to x-pack/plugins/synthetics/public/components/overview/snapshot/index.ts diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.test.tsx b/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.tsx b/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot/snapshot.tsx rename to x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/snapshot_heading.tsx b/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot_heading.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot/snapshot_heading.tsx rename to x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot_heading.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot/use_snap_shot.ts b/x-pack/plugins/synthetics/public/components/overview/snapshot/use_snap_shot.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot/use_snap_shot.ts rename to x-pack/plugins/synthetics/public/components/overview/snapshot/use_snap_shot.ts diff --git a/x-pack/plugins/uptime/public/components/overview/snapshot_heading.test.tsx b/x-pack/plugins/synthetics/public/components/overview/snapshot_heading.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/snapshot_heading.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/snapshot_heading.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/status_panel.tsx b/x-pack/plugins/synthetics/public/components/overview/status_panel.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/status_panel.tsx rename to x-pack/plugins/synthetics/public/components/overview/status_panel.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/synthetics_callout.test.tsx b/x-pack/plugins/synthetics/public/components/overview/synthetics_callout.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/synthetics_callout.test.tsx rename to x-pack/plugins/synthetics/public/components/overview/synthetics_callout.test.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/synthetics_callout.tsx b/x-pack/plugins/synthetics/public/components/overview/synthetics_callout.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/overview/synthetics_callout.tsx rename to x-pack/plugins/synthetics/public/components/overview/synthetics_callout.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/__snapshots__/certificate_form.test.tsx.snap b/x-pack/plugins/synthetics/public/components/settings/__snapshots__/certificate_form.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/__snapshots__/certificate_form.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/settings/__snapshots__/certificate_form.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/settings/__snapshots__/indices_form.test.tsx.snap b/x-pack/plugins/synthetics/public/components/settings/__snapshots__/indices_form.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/__snapshots__/indices_form.test.tsx.snap rename to x-pack/plugins/synthetics/public/components/settings/__snapshots__/indices_form.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/settings/add_connector_flyout.tsx b/x-pack/plugins/synthetics/public/components/settings/add_connector_flyout.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/add_connector_flyout.tsx rename to x-pack/plugins/synthetics/public/components/settings/add_connector_flyout.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/alert_defaults_form.tsx b/x-pack/plugins/synthetics/public/components/settings/alert_defaults_form.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/alert_defaults_form.tsx rename to x-pack/plugins/synthetics/public/components/settings/alert_defaults_form.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/certificate_form.test.tsx b/x-pack/plugins/synthetics/public/components/settings/certificate_form.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/certificate_form.test.tsx rename to x-pack/plugins/synthetics/public/components/settings/certificate_form.test.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/certificate_form.tsx b/x-pack/plugins/synthetics/public/components/settings/certificate_form.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/certificate_form.tsx rename to x-pack/plugins/synthetics/public/components/settings/certificate_form.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/default_email.tsx b/x-pack/plugins/synthetics/public/components/settings/default_email.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/default_email.tsx rename to x-pack/plugins/synthetics/public/components/settings/default_email.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/indices_form.test.tsx b/x-pack/plugins/synthetics/public/components/settings/indices_form.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/indices_form.test.tsx rename to x-pack/plugins/synthetics/public/components/settings/indices_form.test.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/indices_form.tsx b/x-pack/plugins/synthetics/public/components/settings/indices_form.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/indices_form.tsx rename to x-pack/plugins/synthetics/public/components/settings/indices_form.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/settings_actions.tsx b/x-pack/plugins/synthetics/public/components/settings/settings_actions.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/settings_actions.tsx rename to x-pack/plugins/synthetics/public/components/settings/settings_actions.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/settings_bottom_bar.tsx b/x-pack/plugins/synthetics/public/components/settings/settings_bottom_bar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/settings_bottom_bar.tsx rename to x-pack/plugins/synthetics/public/components/settings/settings_bottom_bar.tsx diff --git a/x-pack/plugins/uptime/public/components/settings/translations.ts b/x-pack/plugins/synthetics/public/components/settings/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/translations.ts rename to x-pack/plugins/synthetics/public/components/settings/translations.ts diff --git a/x-pack/plugins/uptime/public/components/settings/types.ts b/x-pack/plugins/synthetics/public/components/settings/types.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/types.ts rename to x-pack/plugins/synthetics/public/components/settings/types.ts diff --git a/x-pack/plugins/uptime/public/components/settings/use_settings_errors.ts b/x-pack/plugins/synthetics/public/components/settings/use_settings_errors.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/settings/use_settings_errors.ts rename to x-pack/plugins/synthetics/public/components/settings/use_settings_errors.ts diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/stderr_logs.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/stderr_logs.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/stderr_logs.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/stderr_logs.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/step_duration.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_duration.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/step_duration.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_duration.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/step_field_trend.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/step_field_trend.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/step_field_trend.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/step_field_trend.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/step_image.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_image.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/step_image.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_image.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/steps_list.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/steps_list.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/steps_list.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/steps_list.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/use_check_steps.ts b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_check_steps.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/use_check_steps.ts rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_check_steps.ts diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/use_expanded_row.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/use_expanded_row.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/use_expanded_row.tsx b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/use_expanded_row.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/check_steps/use_std_error_logs.ts b/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_std_error_logs.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/check_steps/use_std_error_logs.ts rename to x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_std_error_logs.ts diff --git a/x-pack/plugins/uptime/public/components/synthetics/code_block_accordion.tsx b/x-pack/plugins/synthetics/public/components/synthetics/code_block_accordion.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/code_block_accordion.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/code_block_accordion.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/console_event.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/console_event.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/console_event.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/console_event.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/console_event.tsx b/x-pack/plugins/synthetics/public/components/synthetics/console_event.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/console_event.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/console_event.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/console_output_event_list.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/console_output_event_list.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/console_output_event_list.tsx b/x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/console_output_event_list.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/empty_journey.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/empty_journey.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/empty_journey.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/empty_journey.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/empty_journey.tsx b/x-pack/plugins/synthetics/public/components/synthetics/empty_journey.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/empty_journey.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/empty_journey.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/executed_step.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/executed_step.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/executed_step.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/executed_step.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/executed_step.tsx b/x-pack/plugins/synthetics/public/components/synthetics/executed_step.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/executed_step.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/executed_step.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/status_badge.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/status_badge.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/status_badge.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/status_badge.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/status_badge.tsx b/x-pack/plugins/synthetics/public/components/synthetics/status_badge.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/status_badge.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/status_badge.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/step_screenshot_display.test.tsx b/x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/step_screenshot_display.test.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.test.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/step_screenshot_display.tsx b/x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.tsx similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/step_screenshot_display.tsx rename to x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.tsx diff --git a/x-pack/plugins/uptime/public/components/synthetics/translations.ts b/x-pack/plugins/synthetics/public/components/synthetics/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/components/synthetics/translations.ts rename to x-pack/plugins/synthetics/public/components/synthetics/translations.ts diff --git a/x-pack/plugins/uptime/public/contexts/index.ts b/x-pack/plugins/synthetics/public/contexts/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/contexts/index.ts rename to x-pack/plugins/synthetics/public/contexts/index.ts diff --git a/x-pack/plugins/uptime/public/contexts/uptime_index_pattern_context.tsx b/x-pack/plugins/synthetics/public/contexts/uptime_index_pattern_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/contexts/uptime_index_pattern_context.tsx rename to x-pack/plugins/synthetics/public/contexts/uptime_index_pattern_context.tsx diff --git a/x-pack/plugins/uptime/public/contexts/uptime_refresh_context.tsx b/x-pack/plugins/synthetics/public/contexts/uptime_refresh_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/contexts/uptime_refresh_context.tsx rename to x-pack/plugins/synthetics/public/contexts/uptime_refresh_context.tsx diff --git a/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx b/x-pack/plugins/synthetics/public/contexts/uptime_settings_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx rename to x-pack/plugins/synthetics/public/contexts/uptime_settings_context.tsx diff --git a/x-pack/plugins/uptime/public/contexts/uptime_startup_plugins_context.tsx b/x-pack/plugins/synthetics/public/contexts/uptime_startup_plugins_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/contexts/uptime_startup_plugins_context.tsx rename to x-pack/plugins/synthetics/public/contexts/uptime_startup_plugins_context.tsx diff --git a/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx b/x-pack/plugins/synthetics/public/contexts/uptime_theme_context.tsx similarity index 100% rename from x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx rename to x-pack/plugins/synthetics/public/contexts/uptime_theme_context.tsx diff --git a/x-pack/plugins/uptime/public/hooks/__snapshots__/use_url_params.test.tsx.snap b/x-pack/plugins/synthetics/public/hooks/__snapshots__/use_url_params.test.tsx.snap similarity index 100% rename from x-pack/plugins/uptime/public/hooks/__snapshots__/use_url_params.test.tsx.snap rename to x-pack/plugins/synthetics/public/hooks/__snapshots__/use_url_params.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/hooks/index.ts b/x-pack/plugins/synthetics/public/hooks/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/index.ts rename to x-pack/plugins/synthetics/public/hooks/index.ts diff --git a/x-pack/plugins/uptime/public/hooks/update_kuery_string.ts b/x-pack/plugins/synthetics/public/hooks/update_kuery_string.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/update_kuery_string.ts rename to x-pack/plugins/synthetics/public/hooks/update_kuery_string.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.test.tsx b/x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_breadcrumbs.test.tsx rename to x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.test.tsx diff --git a/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.ts b/x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_breadcrumbs.ts rename to x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_breakpoints.test.ts b/x-pack/plugins/synthetics/public/hooks/use_breakpoints.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_breakpoints.test.ts rename to x-pack/plugins/synthetics/public/hooks/use_breakpoints.test.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_breakpoints.ts b/x-pack/plugins/synthetics/public/hooks/use_breakpoints.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_breakpoints.ts rename to x-pack/plugins/synthetics/public/hooks/use_breakpoints.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_cert_status.ts b/x-pack/plugins/synthetics/public/hooks/use_cert_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_cert_status.ts rename to x-pack/plugins/synthetics/public/hooks/use_cert_status.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_chart_theme.ts b/x-pack/plugins/synthetics/public/hooks/use_chart_theme.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_chart_theme.ts rename to x-pack/plugins/synthetics/public/hooks/use_chart_theme.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_composite_image.test.tsx b/x-pack/plugins/synthetics/public/hooks/use_composite_image.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_composite_image.test.tsx rename to x-pack/plugins/synthetics/public/hooks/use_composite_image.test.tsx diff --git a/x-pack/plugins/uptime/public/hooks/use_composite_image.ts b/x-pack/plugins/synthetics/public/hooks/use_composite_image.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_composite_image.ts rename to x-pack/plugins/synthetics/public/hooks/use_composite_image.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_filter_update.test.ts b/x-pack/plugins/synthetics/public/hooks/use_filter_update.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_filter_update.test.ts rename to x-pack/plugins/synthetics/public/hooks/use_filter_update.test.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_filter_update.ts b/x-pack/plugins/synthetics/public/hooks/use_filter_update.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_filter_update.ts rename to x-pack/plugins/synthetics/public/hooks/use_filter_update.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_init_app.ts b/x-pack/plugins/synthetics/public/hooks/use_init_app.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_init_app.ts rename to x-pack/plugins/synthetics/public/hooks/use_init_app.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_mapping_check.test.ts b/x-pack/plugins/synthetics/public/hooks/use_mapping_check.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_mapping_check.test.ts rename to x-pack/plugins/synthetics/public/hooks/use_mapping_check.test.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_mapping_check.ts b/x-pack/plugins/synthetics/public/hooks/use_mapping_check.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_mapping_check.ts rename to x-pack/plugins/synthetics/public/hooks/use_mapping_check.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_monitor.ts b/x-pack/plugins/synthetics/public/hooks/use_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_monitor.ts rename to x-pack/plugins/synthetics/public/hooks/use_monitor.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_overview_filter_check.test.tsx b/x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_overview_filter_check.test.tsx rename to x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.test.tsx diff --git a/x-pack/plugins/uptime/public/hooks/use_overview_filter_check.ts b/x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_overview_filter_check.ts rename to x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_search_text.ts b/x-pack/plugins/synthetics/public/hooks/use_search_text.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_search_text.ts rename to x-pack/plugins/synthetics/public/hooks/use_search_text.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_selected_filters.test.tsx b/x-pack/plugins/synthetics/public/hooks/use_selected_filters.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_selected_filters.test.tsx rename to x-pack/plugins/synthetics/public/hooks/use_selected_filters.test.tsx diff --git a/x-pack/plugins/uptime/public/hooks/use_selected_filters.ts b/x-pack/plugins/synthetics/public/hooks/use_selected_filters.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_selected_filters.ts rename to x-pack/plugins/synthetics/public/hooks/use_selected_filters.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_telemetry.ts b/x-pack/plugins/synthetics/public/hooks/use_telemetry.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_telemetry.ts rename to x-pack/plugins/synthetics/public/hooks/use_telemetry.ts diff --git a/x-pack/plugins/uptime/public/hooks/use_url_params.test.tsx b/x-pack/plugins/synthetics/public/hooks/use_url_params.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_url_params.test.tsx rename to x-pack/plugins/synthetics/public/hooks/use_url_params.test.tsx diff --git a/x-pack/plugins/uptime/public/hooks/use_url_params.ts b/x-pack/plugins/synthetics/public/hooks/use_url_params.ts similarity index 100% rename from x-pack/plugins/uptime/public/hooks/use_url_params.ts rename to x-pack/plugins/synthetics/public/hooks/use_url_params.ts diff --git a/x-pack/plugins/uptime/public/icons/heartbeat_white.svg b/x-pack/plugins/synthetics/public/icons/heartbeat_white.svg similarity index 100% rename from x-pack/plugins/uptime/public/icons/heartbeat_white.svg rename to x-pack/plugins/synthetics/public/icons/heartbeat_white.svg diff --git a/x-pack/plugins/uptime/public/index.ts b/x-pack/plugins/synthetics/public/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/index.ts rename to x-pack/plugins/synthetics/public/index.ts diff --git a/x-pack/plugins/uptime/public/lib/__mocks__/screenshot_ref.mock.ts b/x-pack/plugins/synthetics/public/lib/__mocks__/screenshot_ref.mock.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/__mocks__/screenshot_ref.mock.ts rename to x-pack/plugins/synthetics/public/lib/__mocks__/screenshot_ref.mock.ts diff --git a/x-pack/plugins/uptime/public/lib/__mocks__/uptime_plugin_start_mock.ts b/x-pack/plugins/synthetics/public/lib/__mocks__/uptime_plugin_start_mock.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/__mocks__/uptime_plugin_start_mock.ts rename to x-pack/plugins/synthetics/public/lib/__mocks__/uptime_plugin_start_mock.ts diff --git a/x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts b/x-pack/plugins/synthetics/public/lib/__mocks__/uptime_store.mock.ts similarity index 98% rename from x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts rename to x-pack/plugins/synthetics/public/lib/__mocks__/uptime_store.mock.ts index 0286e884a68d7..01a11fd809fe8 100644 --- a/x-pack/plugins/uptime/public/lib/__mocks__/uptime_store.mock.ts +++ b/x-pack/plugins/synthetics/public/lib/__mocks__/uptime_store.mock.ts @@ -126,7 +126,5 @@ export const mockState: AppState = { cacheSize: 0, hitCount: [], }, - testNowRuns: { - testNowRuns: [], - }, + testNowRuns: {}, }; diff --git a/x-pack/plugins/uptime/public/lib/__mocks__/use_composite_image.mock.ts b/x-pack/plugins/synthetics/public/lib/__mocks__/use_composite_image.mock.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/__mocks__/use_composite_image.mock.ts rename to x-pack/plugins/synthetics/public/lib/__mocks__/use_composite_image.mock.ts diff --git a/x-pack/plugins/uptime/public/lib/__mocks__/ut_router_history.mock.ts b/x-pack/plugins/synthetics/public/lib/__mocks__/ut_router_history.mock.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/__mocks__/ut_router_history.mock.ts rename to x-pack/plugins/synthetics/public/lib/__mocks__/ut_router_history.mock.ts diff --git a/x-pack/plugins/uptime/public/lib/adapters/framework/capabilities_adapter.ts b/x-pack/plugins/synthetics/public/lib/adapters/framework/capabilities_adapter.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/adapters/framework/capabilities_adapter.ts rename to x-pack/plugins/synthetics/public/lib/adapters/framework/capabilities_adapter.ts diff --git a/x-pack/plugins/uptime/public/lib/alert_types/alert_messages.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/alert_messages.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/alert_messages.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/alert_messages.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/common.ts b/x-pack/plugins/synthetics/public/lib/alert_types/common.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/common.ts rename to x-pack/plugins/synthetics/public/lib/alert_types/common.ts diff --git a/x-pack/plugins/uptime/public/lib/alert_types/duration_anomaly.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/duration_anomaly.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/duration_anomaly.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/duration_anomaly.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/index.ts b/x-pack/plugins/synthetics/public/lib/alert_types/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/index.ts rename to x-pack/plugins/synthetics/public/lib/alert_types/index.ts diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/monitor_status.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/monitor_status.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/tls_alert.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/tls_alert.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/tls_alert.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/tls_alert.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts b/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts rename to x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts diff --git a/x-pack/plugins/uptime/public/lib/alert_types/monitor_status.test.ts b/x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/monitor_status.test.ts rename to x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.test.ts diff --git a/x-pack/plugins/uptime/public/lib/alert_types/monitor_status.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/monitor_status.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/tls.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/tls.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/tls.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/tls.tsx diff --git a/x-pack/plugins/uptime/public/lib/alert_types/tls_legacy.tsx b/x-pack/plugins/synthetics/public/lib/alert_types/tls_legacy.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/alert_types/tls_legacy.tsx rename to x-pack/plugins/synthetics/public/lib/alert_types/tls_legacy.tsx diff --git a/x-pack/plugins/uptime/public/lib/formatting.ts b/x-pack/plugins/synthetics/public/lib/formatting.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/formatting.ts rename to x-pack/plugins/synthetics/public/lib/formatting.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/charts/get_chart_date_label.ts b/x-pack/plugins/synthetics/public/lib/helper/charts/get_chart_date_label.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/charts/get_chart_date_label.ts rename to x-pack/plugins/synthetics/public/lib/helper/charts/get_chart_date_label.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/charts/get_label_format.test.ts b/x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/charts/get_label_format.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/charts/get_label_format.ts b/x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/charts/get_label_format.ts rename to x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/charts/index.ts b/x-pack/plugins/synthetics/public/lib/helper/charts/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/charts/index.ts rename to x-pack/plugins/synthetics/public/lib/helper/charts/index.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/charts/is_within_current_date.test.ts b/x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/charts/is_within_current_date.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/charts/is_within_current_date.ts b/x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/charts/is_within_current_date.ts rename to x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/compose_screenshot_images.test.ts b/x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/compose_screenshot_images.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/compose_screenshot_images.ts b/x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/compose_screenshot_images.ts rename to x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/convert_measurements.test.ts b/x-pack/plugins/synthetics/public/lib/helper/convert_measurements.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/convert_measurements.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/convert_measurements.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/convert_measurements.ts b/x-pack/plugins/synthetics/public/lib/helper/convert_measurements.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/convert_measurements.ts rename to x-pack/plugins/synthetics/public/lib/helper/convert_measurements.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx b/x-pack/plugins/synthetics/public/lib/helper/enzyme_helpers.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/enzyme_helpers.tsx rename to x-pack/plugins/synthetics/public/lib/helper/enzyme_helpers.tsx diff --git a/x-pack/plugins/uptime/public/lib/helper/get_title.ts b/x-pack/plugins/synthetics/public/lib/helper/get_title.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/get_title.ts rename to x-pack/plugins/synthetics/public/lib/helper/get_title.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/helper_with_redux.tsx b/x-pack/plugins/synthetics/public/lib/helper/helper_with_redux.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/helper_with_redux.tsx rename to x-pack/plugins/synthetics/public/lib/helper/helper_with_redux.tsx diff --git a/x-pack/plugins/uptime/public/lib/helper/index.ts b/x-pack/plugins/synthetics/public/lib/helper/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/index.ts rename to x-pack/plugins/synthetics/public/lib/helper/index.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/add_base_path.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/add_base_path.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/add_base_path.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/add_base_path.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/build_href.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/build_href.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/build_href.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/build_href.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.test.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/get_apm_href.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.test.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.test.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/index.ts b/x-pack/plugins/synthetics/public/lib/helper/observability_integration/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/observability_integration/index.ts rename to x-pack/plugins/synthetics/public/lib/helper/observability_integration/index.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/parse_search.test.ts b/x-pack/plugins/synthetics/public/lib/helper/parse_search.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/parse_search.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/parse_search.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/parse_search.ts b/x-pack/plugins/synthetics/public/lib/helper/parse_search.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/parse_search.ts rename to x-pack/plugins/synthetics/public/lib/helper/parse_search.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/rtl_helpers.tsx b/x-pack/plugins/synthetics/public/lib/helper/rtl_helpers.tsx similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/rtl_helpers.tsx rename to x-pack/plugins/synthetics/public/lib/helper/rtl_helpers.tsx diff --git a/x-pack/plugins/uptime/public/lib/helper/series_has_down_values.test.ts b/x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/series_has_down_values.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/series_has_down_values.ts b/x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/series_has_down_values.ts rename to x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/spy_use_fetcher.ts b/x-pack/plugins/synthetics/public/lib/helper/spy_use_fetcher.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/spy_use_fetcher.ts rename to x-pack/plugins/synthetics/public/lib/helper/spy_use_fetcher.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/stringify_url_params.test.ts b/x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/stringify_url_params.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/stringify_url_params.ts b/x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/stringify_url_params.ts rename to x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/test_helpers.ts b/x-pack/plugins/synthetics/public/lib/helper/test_helpers.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/test_helpers.ts rename to x-pack/plugins/synthetics/public/lib/helper/test_helpers.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap b/x-pack/plugins/synthetics/public/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap rename to x-pack/plugins/synthetics/public/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/get_supported_url_params.test.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/get_supported_url_params.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/get_supported_url_params.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/get_supported_url_params.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/index.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/index.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/index.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/parse_absolute_date.test.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/parse_absolute_date.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/parse_absolute_date.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/parse_absolute_date.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/parse_is_paused.test.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/parse_is_paused.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/parse_is_paused.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/parse_is_paused.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/parse_url_int.test.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/parse_url_int.test.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.test.ts diff --git a/x-pack/plugins/uptime/public/lib/helper/url_params/parse_url_int.ts b/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/helper/url_params/parse_url_int.ts rename to x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.ts diff --git a/x-pack/plugins/uptime/public/lib/index.ts b/x-pack/plugins/synthetics/public/lib/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/index.ts rename to x-pack/plugins/synthetics/public/lib/index.ts diff --git a/x-pack/plugins/uptime/public/lib/lib.ts b/x-pack/plugins/synthetics/public/lib/lib.ts similarity index 100% rename from x-pack/plugins/uptime/public/lib/lib.ts rename to x-pack/plugins/synthetics/public/lib/lib.ts diff --git a/x-pack/plugins/uptime/public/pages/certificates.test.tsx b/x-pack/plugins/synthetics/public/pages/certificates.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/certificates.test.tsx rename to x-pack/plugins/synthetics/public/pages/certificates.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/certificates.tsx b/x-pack/plugins/synthetics/public/pages/certificates.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/certificates.tsx rename to x-pack/plugins/synthetics/public/pages/certificates.tsx diff --git a/x-pack/plugins/uptime/public/pages/index.ts b/x-pack/plugins/synthetics/public/pages/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/pages/index.ts rename to x-pack/plugins/synthetics/public/pages/index.ts diff --git a/x-pack/plugins/uptime/public/pages/mapping_error.tsx b/x-pack/plugins/synthetics/public/pages/mapping_error.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/mapping_error.tsx rename to x-pack/plugins/synthetics/public/pages/mapping_error.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor.test.tsx b/x-pack/plugins/synthetics/public/pages/monitor.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor.test.tsx rename to x-pack/plugins/synthetics/public/pages/monitor.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor.tsx b/x-pack/plugins/synthetics/public/pages/monitor.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor.tsx rename to x-pack/plugins/synthetics/public/pages/monitor.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/action_bar_portal_node.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/action_bar_portal_node.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/action_bar_portal_node.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/action_bar_portal_node.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/add_monitor.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/add_monitor.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/add_monitor.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/add_monitor.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/bottom_bar.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/bottom_bar.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/bottom_bar.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/bottom_bar.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/content.ts b/x-pack/plugins/synthetics/public/pages/monitor_management/content.ts similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/content.ts rename to x-pack/plugins/synthetics/public/pages/monitor_management/content.ts diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/edit_monitor.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/edit_monitor.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/edit_monitor.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/edit_monitor.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/monitor_management.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/monitor_management.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/monitor_management.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/monitor_management.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/service_allowed_wrapper.test.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/service_allowed_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/service_allowed_wrapper.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/service_allowed_wrapper.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.tsx diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx b/x-pack/plugins/synthetics/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx rename to x-pack/plugins/synthetics/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx diff --git a/x-pack/plugins/uptime/public/pages/not_found.test.tsx b/x-pack/plugins/synthetics/public/pages/not_found.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/not_found.test.tsx rename to x-pack/plugins/synthetics/public/pages/not_found.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/not_found.tsx b/x-pack/plugins/synthetics/public/pages/not_found.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/not_found.tsx rename to x-pack/plugins/synthetics/public/pages/not_found.tsx diff --git a/x-pack/plugins/uptime/public/pages/overview.test.tsx b/x-pack/plugins/synthetics/public/pages/overview.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/overview.test.tsx rename to x-pack/plugins/synthetics/public/pages/overview.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/overview.tsx b/x-pack/plugins/synthetics/public/pages/overview.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/overview.tsx rename to x-pack/plugins/synthetics/public/pages/overview.tsx diff --git a/x-pack/plugins/uptime/public/pages/settings.test.tsx b/x-pack/plugins/synthetics/public/pages/settings.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/settings.test.tsx rename to x-pack/plugins/synthetics/public/pages/settings.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/settings.tsx b/x-pack/plugins/synthetics/public/pages/settings.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/settings.tsx rename to x-pack/plugins/synthetics/public/pages/settings.tsx diff --git a/x-pack/plugins/uptime/public/pages/synthetics/checks_navigation.tsx b/x-pack/plugins/synthetics/public/pages/synthetics/checks_navigation.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/synthetics/checks_navigation.tsx rename to x-pack/plugins/synthetics/public/pages/synthetics/checks_navigation.tsx diff --git a/x-pack/plugins/uptime/public/pages/synthetics/step_detail_page.tsx b/x-pack/plugins/synthetics/public/pages/synthetics/step_detail_page.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/synthetics/step_detail_page.tsx rename to x-pack/plugins/synthetics/public/pages/synthetics/step_detail_page.tsx diff --git a/x-pack/plugins/uptime/public/pages/synthetics/synthetics_checks.test.tsx b/x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.test.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/synthetics/synthetics_checks.test.tsx rename to x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.test.tsx diff --git a/x-pack/plugins/uptime/public/pages/synthetics/synthetics_checks.tsx b/x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.tsx similarity index 100% rename from x-pack/plugins/uptime/public/pages/synthetics/synthetics_checks.tsx rename to x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.tsx diff --git a/x-pack/plugins/uptime/public/pages/translations.ts b/x-pack/plugins/synthetics/public/pages/translations.ts similarity index 100% rename from x-pack/plugins/uptime/public/pages/translations.ts rename to x-pack/plugins/synthetics/public/pages/translations.ts diff --git a/x-pack/plugins/uptime/public/routes.tsx b/x-pack/plugins/synthetics/public/routes.tsx similarity index 100% rename from x-pack/plugins/uptime/public/routes.tsx rename to x-pack/plugins/synthetics/public/routes.tsx diff --git a/x-pack/plugins/uptime/public/state/actions/alerts.ts b/x-pack/plugins/synthetics/public/state/actions/alerts.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/alerts.ts rename to x-pack/plugins/synthetics/public/state/actions/alerts.ts diff --git a/x-pack/plugins/uptime/public/state/actions/dynamic_settings.ts b/x-pack/plugins/synthetics/public/state/actions/dynamic_settings.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/state/actions/dynamic_settings.ts diff --git a/x-pack/plugins/uptime/public/state/actions/index.ts b/x-pack/plugins/synthetics/public/state/actions/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/index.ts rename to x-pack/plugins/synthetics/public/state/actions/index.ts diff --git a/x-pack/plugins/uptime/public/state/actions/index_status.ts b/x-pack/plugins/synthetics/public/state/actions/index_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/index_status.ts rename to x-pack/plugins/synthetics/public/state/actions/index_status.ts diff --git a/x-pack/plugins/uptime/public/state/actions/journey.ts b/x-pack/plugins/synthetics/public/state/actions/journey.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/journey.ts rename to x-pack/plugins/synthetics/public/state/actions/journey.ts diff --git a/x-pack/plugins/uptime/public/state/actions/ml_anomaly.ts b/x-pack/plugins/synthetics/public/state/actions/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/state/actions/ml_anomaly.ts diff --git a/x-pack/plugins/uptime/public/state/actions/monitor.ts b/x-pack/plugins/synthetics/public/state/actions/monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/monitor.ts rename to x-pack/plugins/synthetics/public/state/actions/monitor.ts diff --git a/x-pack/plugins/uptime/public/state/actions/monitor_duration.ts b/x-pack/plugins/synthetics/public/state/actions/monitor_duration.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/monitor_duration.ts rename to x-pack/plugins/synthetics/public/state/actions/monitor_duration.ts diff --git a/x-pack/plugins/uptime/public/state/actions/monitor_list.ts b/x-pack/plugins/synthetics/public/state/actions/monitor_list.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/monitor_list.ts rename to x-pack/plugins/synthetics/public/state/actions/monitor_list.ts diff --git a/x-pack/plugins/uptime/public/state/actions/monitor_management.ts b/x-pack/plugins/synthetics/public/state/actions/monitor_management.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/monitor_management.ts rename to x-pack/plugins/synthetics/public/state/actions/monitor_management.ts diff --git a/x-pack/plugins/uptime/public/state/actions/monitor_status.ts b/x-pack/plugins/synthetics/public/state/actions/monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/monitor_status.ts rename to x-pack/plugins/synthetics/public/state/actions/monitor_status.ts diff --git a/x-pack/plugins/uptime/public/state/actions/network_events.ts b/x-pack/plugins/synthetics/public/state/actions/network_events.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/network_events.ts rename to x-pack/plugins/synthetics/public/state/actions/network_events.ts diff --git a/x-pack/plugins/uptime/public/state/actions/ping.ts b/x-pack/plugins/synthetics/public/state/actions/ping.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/ping.ts rename to x-pack/plugins/synthetics/public/state/actions/ping.ts diff --git a/x-pack/plugins/uptime/public/state/actions/selected_filters.ts b/x-pack/plugins/synthetics/public/state/actions/selected_filters.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/selected_filters.ts rename to x-pack/plugins/synthetics/public/state/actions/selected_filters.ts diff --git a/x-pack/plugins/uptime/public/state/actions/snapshot.ts b/x-pack/plugins/synthetics/public/state/actions/snapshot.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/snapshot.ts rename to x-pack/plugins/synthetics/public/state/actions/snapshot.ts diff --git a/x-pack/plugins/uptime/public/state/actions/types.ts b/x-pack/plugins/synthetics/public/state/actions/types.ts similarity index 89% rename from x-pack/plugins/uptime/public/state/actions/types.ts rename to x-pack/plugins/synthetics/public/state/actions/types.ts index 953227adfae93..62f0051f411f7 100644 --- a/x-pack/plugins/uptime/public/state/actions/types.ts +++ b/x-pack/plugins/synthetics/public/state/actions/types.ts @@ -15,10 +15,9 @@ export interface AsyncAction { success: (payload: SuccessPayload) => Action; fail: (payload: IHttpFetchError) => Action; } -export interface AsyncAction1 { +export interface AsyncActionOptionalPayload + extends AsyncAction { get: (payload?: Payload) => Action; - success: (payload: SuccessPayload) => Action; - fail: (payload: IHttpFetchError) => Action; } export interface MonitorIdParam { diff --git a/x-pack/plugins/uptime/public/state/actions/ui.ts b/x-pack/plugins/synthetics/public/state/actions/ui.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/actions/ui.ts rename to x-pack/plugins/synthetics/public/state/actions/ui.ts diff --git a/x-pack/plugins/uptime/public/state/actions/utils.ts b/x-pack/plugins/synthetics/public/state/actions/utils.ts similarity index 85% rename from x-pack/plugins/uptime/public/state/actions/utils.ts rename to x-pack/plugins/synthetics/public/state/actions/utils.ts index 15b03d6b18680..6bac4be8b8173 100644 --- a/x-pack/plugins/uptime/public/state/actions/utils.ts +++ b/x-pack/plugins/synthetics/public/state/actions/utils.ts @@ -7,11 +7,11 @@ import { createAction } from 'redux-actions'; import { IHttpFetchError } from '@kbn/core/public'; -import { AsyncAction, AsyncAction1 } from './types'; +import { AsyncAction, AsyncActionOptionalPayload } from './types'; export function createAsyncAction( actionStr: string -): AsyncAction1; +): AsyncActionOptionalPayload; export function createAsyncAction( actionStr: string ): AsyncAction { diff --git a/x-pack/plugins/uptime/public/state/alerts/alerts.ts b/x-pack/plugins/synthetics/public/state/alerts/alerts.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/alerts/alerts.ts rename to x-pack/plugins/synthetics/public/state/alerts/alerts.ts diff --git a/x-pack/plugins/uptime/public/state/api/__snapshots__/snapshot.test.ts.snap b/x-pack/plugins/synthetics/public/state/api/__snapshots__/snapshot.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/public/state/api/__snapshots__/snapshot.test.ts.snap rename to x-pack/plugins/synthetics/public/state/api/__snapshots__/snapshot.test.ts.snap diff --git a/x-pack/plugins/uptime/public/state/api/alert_actions.test.ts b/x-pack/plugins/synthetics/public/state/api/alert_actions.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/alert_actions.test.ts rename to x-pack/plugins/synthetics/public/state/api/alert_actions.test.ts diff --git a/x-pack/plugins/uptime/public/state/api/alert_actions.ts b/x-pack/plugins/synthetics/public/state/api/alert_actions.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/alert_actions.ts rename to x-pack/plugins/synthetics/public/state/api/alert_actions.ts diff --git a/x-pack/plugins/uptime/public/state/api/alerts.ts b/x-pack/plugins/synthetics/public/state/api/alerts.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/alerts.ts rename to x-pack/plugins/synthetics/public/state/api/alerts.ts diff --git a/x-pack/plugins/uptime/public/state/api/dynamic_settings.ts b/x-pack/plugins/synthetics/public/state/api/dynamic_settings.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/state/api/dynamic_settings.ts diff --git a/x-pack/plugins/uptime/public/state/api/index.ts b/x-pack/plugins/synthetics/public/state/api/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/index.ts rename to x-pack/plugins/synthetics/public/state/api/index.ts diff --git a/x-pack/plugins/uptime/public/state/api/index_status.ts b/x-pack/plugins/synthetics/public/state/api/index_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/index_status.ts rename to x-pack/plugins/synthetics/public/state/api/index_status.ts diff --git a/x-pack/plugins/uptime/public/state/api/journey.ts b/x-pack/plugins/synthetics/public/state/api/journey.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/journey.ts rename to x-pack/plugins/synthetics/public/state/api/journey.ts diff --git a/x-pack/plugins/uptime/public/state/api/ml_anomaly.ts b/x-pack/plugins/synthetics/public/state/api/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/state/api/ml_anomaly.ts diff --git a/x-pack/plugins/uptime/public/state/api/monitor.ts b/x-pack/plugins/synthetics/public/state/api/monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/monitor.ts rename to x-pack/plugins/synthetics/public/state/api/monitor.ts diff --git a/x-pack/plugins/uptime/public/state/api/monitor_duration.ts b/x-pack/plugins/synthetics/public/state/api/monitor_duration.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/monitor_duration.ts rename to x-pack/plugins/synthetics/public/state/api/monitor_duration.ts diff --git a/x-pack/plugins/uptime/public/state/api/monitor_list.ts b/x-pack/plugins/synthetics/public/state/api/monitor_list.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/monitor_list.ts rename to x-pack/plugins/synthetics/public/state/api/monitor_list.ts diff --git a/x-pack/plugins/uptime/public/state/api/monitor_management.ts b/x-pack/plugins/synthetics/public/state/api/monitor_management.ts similarity index 92% rename from x-pack/plugins/uptime/public/state/api/monitor_management.ts rename to x-pack/plugins/synthetics/public/state/api/monitor_management.ts index 58cc0217c298c..a776d33b8147b 100644 --- a/x-pack/plugins/uptime/public/state/api/monitor_management.ts +++ b/x-pack/plugins/synthetics/public/state/api/monitor_management.ts @@ -18,6 +18,8 @@ import { ServiceLocationsApiResponseCodec, ServiceLocationErrors, ThrottlingOptions, + Locations, + SyntheticsMonitorSchedule, } from '../../../common/runtime_types'; import { DecryptedSyntheticsMonitorSavedObject, @@ -84,12 +86,16 @@ export const runOnceMonitor = async ({ }; export interface TestNowResponse { - errors?: Array<{ error: Error }>; + schedule: SyntheticsMonitorSchedule; + locations: Locations; + errors?: ServiceLocationErrors; testRunId: string; monitorId: string; } -export const testNowMonitor = async (configId: string): Promise => { +export const triggerTestNowMonitor = async ( + configId: string +): Promise => { return await apiService.get(API_URLS.TRIGGER_MONITOR + `/${configId}`); }; diff --git a/x-pack/plugins/uptime/public/state/api/monitor_status.ts b/x-pack/plugins/synthetics/public/state/api/monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/monitor_status.ts rename to x-pack/plugins/synthetics/public/state/api/monitor_status.ts diff --git a/x-pack/plugins/uptime/public/state/api/network_events.ts b/x-pack/plugins/synthetics/public/state/api/network_events.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/network_events.ts rename to x-pack/plugins/synthetics/public/state/api/network_events.ts diff --git a/x-pack/plugins/uptime/public/state/api/ping.ts b/x-pack/plugins/synthetics/public/state/api/ping.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/ping.ts rename to x-pack/plugins/synthetics/public/state/api/ping.ts diff --git a/x-pack/plugins/uptime/public/state/api/snapshot.test.ts b/x-pack/plugins/synthetics/public/state/api/snapshot.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/snapshot.test.ts rename to x-pack/plugins/synthetics/public/state/api/snapshot.test.ts diff --git a/x-pack/plugins/uptime/public/state/api/snapshot.ts b/x-pack/plugins/synthetics/public/state/api/snapshot.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/snapshot.ts rename to x-pack/plugins/synthetics/public/state/api/snapshot.ts diff --git a/x-pack/plugins/uptime/public/state/api/types.ts b/x-pack/plugins/synthetics/public/state/api/types.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/types.ts rename to x-pack/plugins/synthetics/public/state/api/types.ts diff --git a/x-pack/plugins/uptime/public/state/api/utils.ts b/x-pack/plugins/synthetics/public/state/api/utils.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/api/utils.ts rename to x-pack/plugins/synthetics/public/state/api/utils.ts diff --git a/x-pack/plugins/uptime/public/state/certificates/certificates.ts b/x-pack/plugins/synthetics/public/state/certificates/certificates.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/certificates/certificates.ts rename to x-pack/plugins/synthetics/public/state/certificates/certificates.ts diff --git a/x-pack/plugins/uptime/public/state/effects/alerts.ts b/x-pack/plugins/synthetics/public/state/effects/alerts.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/alerts.ts rename to x-pack/plugins/synthetics/public/state/effects/alerts.ts diff --git a/x-pack/plugins/uptime/public/state/effects/dynamic_settings.ts b/x-pack/plugins/synthetics/public/state/effects/dynamic_settings.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/state/effects/dynamic_settings.ts diff --git a/x-pack/plugins/uptime/public/state/effects/fetch_effect.test.ts b/x-pack/plugins/synthetics/public/state/effects/fetch_effect.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/fetch_effect.test.ts rename to x-pack/plugins/synthetics/public/state/effects/fetch_effect.test.ts diff --git a/x-pack/plugins/uptime/public/state/effects/fetch_effect.ts b/x-pack/plugins/synthetics/public/state/effects/fetch_effect.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/fetch_effect.ts rename to x-pack/plugins/synthetics/public/state/effects/fetch_effect.ts diff --git a/x-pack/plugins/uptime/public/state/effects/index.ts b/x-pack/plugins/synthetics/public/state/effects/index.ts similarity index 91% rename from x-pack/plugins/uptime/public/state/effects/index.ts rename to x-pack/plugins/synthetics/public/state/effects/index.ts index 5c61c2ff26d1f..82d9209e47995 100644 --- a/x-pack/plugins/uptime/public/state/effects/index.ts +++ b/x-pack/plugins/synthetics/public/state/effects/index.ts @@ -7,16 +7,13 @@ import { fork } from 'redux-saga/effects'; import { fetchMonitorDetailsEffect } from './monitor'; -import { - fetchMonitorListEffect, - fetchRunNowMonitorEffect, - fetchUpdatedMonitorEffect, -} from './monitor_list'; +import { fetchMonitorListEffect, fetchUpdatedMonitorEffect } from './monitor_list'; import { fetchMonitorManagementEffect, fetchSyntheticsServiceAllowedEffect, } from './monitor_management'; import { fetchMonitorStatusEffect } from './monitor_status'; +import { fetchTestNowMonitorEffect } from './test_now_runs'; import { fetchDynamicSettingsEffect, setDynamicSettingsEffect } from './dynamic_settings'; import { fetchPingsEffect, fetchPingHistogramEffect } from './ping'; import { fetchMonitorDurationEffect } from './monitor_duration'; @@ -37,6 +34,7 @@ export function* rootEffect() { yield fork(fetchUpdatedMonitorEffect); yield fork(fetchMonitorManagementEffect); yield fork(fetchMonitorStatusEffect); + yield fork(fetchTestNowMonitorEffect); yield fork(fetchDynamicSettingsEffect); yield fork(setDynamicSettingsEffect); yield fork(fetchPingsEffect); @@ -50,6 +48,5 @@ export function* rootEffect() { yield fork(fetchScreenshotBlocks); yield fork(generateBlockStatsOnPut); yield fork(pruneBlockCache); - yield fork(fetchRunNowMonitorEffect); yield fork(fetchSyntheticsServiceAllowedEffect); } diff --git a/x-pack/plugins/uptime/public/state/effects/index_status.ts b/x-pack/plugins/synthetics/public/state/effects/index_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/index_status.ts rename to x-pack/plugins/synthetics/public/state/effects/index_status.ts diff --git a/x-pack/plugins/uptime/public/state/effects/journey.test.ts b/x-pack/plugins/synthetics/public/state/effects/journey.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/journey.test.ts rename to x-pack/plugins/synthetics/public/state/effects/journey.test.ts diff --git a/x-pack/plugins/uptime/public/state/effects/journey.ts b/x-pack/plugins/synthetics/public/state/effects/journey.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/journey.ts rename to x-pack/plugins/synthetics/public/state/effects/journey.ts diff --git a/x-pack/plugins/uptime/public/state/effects/ml_anomaly.ts b/x-pack/plugins/synthetics/public/state/effects/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/state/effects/ml_anomaly.ts diff --git a/x-pack/plugins/uptime/public/state/effects/monitor.ts b/x-pack/plugins/synthetics/public/state/effects/monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/monitor.ts rename to x-pack/plugins/synthetics/public/state/effects/monitor.ts diff --git a/x-pack/plugins/uptime/public/state/effects/monitor_duration.ts b/x-pack/plugins/synthetics/public/state/effects/monitor_duration.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/monitor_duration.ts rename to x-pack/plugins/synthetics/public/state/effects/monitor_duration.ts diff --git a/x-pack/plugins/uptime/public/state/effects/monitor_list.ts b/x-pack/plugins/synthetics/public/state/effects/monitor_list.ts similarity index 70% rename from x-pack/plugins/uptime/public/state/effects/monitor_list.ts rename to x-pack/plugins/synthetics/public/state/effects/monitor_list.ts index 35322c3768190..3e4d0f67ffa18 100644 --- a/x-pack/plugins/uptime/public/state/effects/monitor_list.ts +++ b/x-pack/plugins/synthetics/public/state/effects/monitor_list.ts @@ -5,15 +5,14 @@ * 2.0. */ -import { takeEvery, takeLatest } from 'redux-saga/effects'; +import { takeLatest } from 'redux-saga/effects'; import { getMonitorList, getMonitorListSuccess, getMonitorListFailure, getUpdatedMonitor, - testNowMonitorAction, } from '../actions'; -import { fetchMonitorList, testNowMonitor } from '../api'; +import { fetchMonitorList } from '../api'; import { fetchEffectFactory } from './fetch_effect'; export function* fetchMonitorListEffect() { @@ -29,10 +28,3 @@ export function* fetchUpdatedMonitorEffect() { fetchEffectFactory(fetchMonitorList, getUpdatedMonitor.success, getUpdatedMonitor.fail) ); } - -export function* fetchRunNowMonitorEffect() { - yield takeEvery( - testNowMonitorAction.get, - fetchEffectFactory(testNowMonitor, testNowMonitorAction.success, testNowMonitorAction.fail) - ); -} diff --git a/x-pack/plugins/uptime/public/state/effects/monitor_management.ts b/x-pack/plugins/synthetics/public/state/effects/monitor_management.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/monitor_management.ts rename to x-pack/plugins/synthetics/public/state/effects/monitor_management.ts diff --git a/x-pack/plugins/uptime/public/state/effects/monitor_status.ts b/x-pack/plugins/synthetics/public/state/effects/monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/monitor_status.ts rename to x-pack/plugins/synthetics/public/state/effects/monitor_status.ts diff --git a/x-pack/plugins/uptime/public/state/effects/network_events.ts b/x-pack/plugins/synthetics/public/state/effects/network_events.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/network_events.ts rename to x-pack/plugins/synthetics/public/state/effects/network_events.ts diff --git a/x-pack/plugins/uptime/public/state/effects/ping.ts b/x-pack/plugins/synthetics/public/state/effects/ping.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/ping.ts rename to x-pack/plugins/synthetics/public/state/effects/ping.ts diff --git a/x-pack/plugins/uptime/public/state/effects/synthetic_journey_blocks.ts b/x-pack/plugins/synthetics/public/state/effects/synthetic_journey_blocks.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/effects/synthetic_journey_blocks.ts rename to x-pack/plugins/synthetics/public/state/effects/synthetic_journey_blocks.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/test_now_runs.ts b/x-pack/plugins/synthetics/public/state/effects/test_now_runs.ts new file mode 100644 index 0000000000000..9272886ec7376 --- /dev/null +++ b/x-pack/plugins/synthetics/public/state/effects/test_now_runs.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { IHttpFetchError } from '@kbn/core/public'; +import { takeEvery } from 'redux-saga/effects'; +import { testNowMonitorAction } from '../actions'; +import { TestNowResponse, triggerTestNowMonitor } from '../api'; +import { fetchEffectFactory } from './fetch_effect'; + +export function* fetchTestNowMonitorEffect() { + yield takeEvery( + testNowMonitorAction.get, + fetchEffectFactory(triggerTestNowMonitor, testNowMonitorSuccessAction, testNowMonitorFailAction) + ); +} + +function testNowMonitorSuccessAction(payload: TestNowResponse | undefined) { + return testNowMonitorAction.success(payload); +} + +function testNowMonitorFailAction(payload: IHttpFetchError) { + return testNowMonitorAction.fail(payload); +} diff --git a/x-pack/plugins/uptime/public/state/index.ts b/x-pack/plugins/synthetics/public/state/index.ts similarity index 86% rename from x-pack/plugins/uptime/public/state/index.ts rename to x-pack/plugins/synthetics/public/state/index.ts index 506051b95fd5a..9d4fa202b3d1a 100644 --- a/x-pack/plugins/uptime/public/state/index.ts +++ b/x-pack/plugins/synthetics/public/state/index.ts @@ -9,6 +9,7 @@ import { createStore, applyMiddleware } from 'redux'; import type { Store } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; import createSagaMiddleware from 'redux-saga'; +import { Storage } from '@kbn/kibana-utils-plugin/public'; import { rootEffect } from './effects'; import { rootReducer } from './reducers'; @@ -19,3 +20,5 @@ const sagaMW = createSagaMiddleware(); export const store: Store = createStore(rootReducer, composeWithDevTools(applyMiddleware(sagaMW))); sagaMW.run(rootEffect); + +export const storage = new Storage(window.localStorage); diff --git a/x-pack/plugins/uptime/public/state/kibana_service.ts b/x-pack/plugins/synthetics/public/state/kibana_service.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/kibana_service.ts rename to x-pack/plugins/synthetics/public/state/kibana_service.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/dynamic_settings.ts b/x-pack/plugins/synthetics/public/state/reducers/dynamic_settings.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/state/reducers/dynamic_settings.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/index.ts b/x-pack/plugins/synthetics/public/state/reducers/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/index.ts rename to x-pack/plugins/synthetics/public/state/reducers/index.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/index_status.ts b/x-pack/plugins/synthetics/public/state/reducers/index_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/index_status.ts rename to x-pack/plugins/synthetics/public/state/reducers/index_status.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/journey.ts b/x-pack/plugins/synthetics/public/state/reducers/journey.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/journey.ts rename to x-pack/plugins/synthetics/public/state/reducers/journey.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/ml_anomaly.ts b/x-pack/plugins/synthetics/public/state/reducers/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/state/reducers/ml_anomaly.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor.ts b/x-pack/plugins/synthetics/public/state/reducers/monitor.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/monitor.ts rename to x-pack/plugins/synthetics/public/state/reducers/monitor.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor_duration.ts b/x-pack/plugins/synthetics/public/state/reducers/monitor_duration.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/monitor_duration.ts rename to x-pack/plugins/synthetics/public/state/reducers/monitor_duration.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor_list.ts b/x-pack/plugins/synthetics/public/state/reducers/monitor_list.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/monitor_list.ts rename to x-pack/plugins/synthetics/public/state/reducers/monitor_list.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor_management.ts b/x-pack/plugins/synthetics/public/state/reducers/monitor_management.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/monitor_management.ts rename to x-pack/plugins/synthetics/public/state/reducers/monitor_management.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor_status.test.ts b/x-pack/plugins/synthetics/public/state/reducers/monitor_status.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/monitor_status.test.ts rename to x-pack/plugins/synthetics/public/state/reducers/monitor_status.test.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/monitor_status.ts b/x-pack/plugins/synthetics/public/state/reducers/monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/monitor_status.ts rename to x-pack/plugins/synthetics/public/state/reducers/monitor_status.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/network_events.ts b/x-pack/plugins/synthetics/public/state/reducers/network_events.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/network_events.ts rename to x-pack/plugins/synthetics/public/state/reducers/network_events.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/ping.ts b/x-pack/plugins/synthetics/public/state/reducers/ping.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/ping.ts rename to x-pack/plugins/synthetics/public/state/reducers/ping.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/ping_list.ts b/x-pack/plugins/synthetics/public/state/reducers/ping_list.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/ping_list.ts rename to x-pack/plugins/synthetics/public/state/reducers/ping_list.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/selected_filters.test.ts b/x-pack/plugins/synthetics/public/state/reducers/selected_filters.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/selected_filters.test.ts rename to x-pack/plugins/synthetics/public/state/reducers/selected_filters.test.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/selected_filters.ts b/x-pack/plugins/synthetics/public/state/reducers/selected_filters.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/selected_filters.ts rename to x-pack/plugins/synthetics/public/state/reducers/selected_filters.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/synthetics.test.ts b/x-pack/plugins/synthetics/public/state/reducers/synthetics.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/synthetics.test.ts rename to x-pack/plugins/synthetics/public/state/reducers/synthetics.test.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/synthetics.ts b/x-pack/plugins/synthetics/public/state/reducers/synthetics.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/synthetics.ts rename to x-pack/plugins/synthetics/public/state/reducers/synthetics.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/test_now_runs.ts b/x-pack/plugins/synthetics/public/state/reducers/test_now_runs.ts new file mode 100644 index 0000000000000..d081039e4d901 --- /dev/null +++ b/x-pack/plugins/synthetics/public/state/reducers/test_now_runs.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 { createReducer, PayloadAction } from '@reduxjs/toolkit'; +import { WritableDraft } from 'immer/dist/types/types-external'; +import { IHttpFetchError } from '@kbn/core/public'; +import { + Locations, + ScheduleUnit, + ServiceLocationErrors, + SyntheticsMonitorSchedule, +} from '../../../common/runtime_types'; +import { clearTestNowMonitorAction, testNowMonitorAction } from '../actions'; +import { TestNowResponse } from '../api'; +import { AppState } from '..'; + +export enum TestRunStats { + LOADING = 'loading', + IN_PROGRESS = 'in-progress', + COMPLETED = 'completed', +} + +interface TestNowRun { + monitorId: string; + testRunId?: string; + status: TestRunStats; + schedule: SyntheticsMonitorSchedule; + locations: Locations; + errors?: ServiceLocationErrors; + fetchError?: { name: string; message: string }; +} + +export interface TestNowRunsState { + [monitorId: string]: TestNowRun; +} + +export const initialState: TestNowRunsState = {}; + +export const testNowRunsReducer = createReducer(initialState, (builder) => { + builder + .addCase( + String(testNowMonitorAction.get), + (state: WritableDraft, action: PayloadAction) => ({ + ...state, + [action.payload]: { + monitorId: action.payload, + status: TestRunStats.LOADING, + schedule: { unit: ScheduleUnit.MINUTES, number: '3' }, + locations: [], + }, + }) + ) + .addCase( + String(testNowMonitorAction.success), + (state: WritableDraft, { payload }: PayloadAction) => ({ + ...state, + [payload.monitorId]: { + monitorId: payload.monitorId, + testRunId: payload.testRunId, + status: TestRunStats.IN_PROGRESS, + errors: payload.errors, + schedule: payload.schedule, + locations: payload.locations, + }, + }) + ) + .addCase( + String(testNowMonitorAction.fail), + (state: WritableDraft, action: PayloadAction) => { + const fetchError = action.payload as unknown as IHttpFetchError; + if (fetchError?.request.url) { + const { name, message } = fetchError; + + const [, errorMonitor] = + Object.entries(state).find( + ([key]) => fetchError.request.url.indexOf(key) > -1 ?? false + ) ?? []; + + if (errorMonitor) { + return { + ...state, + [errorMonitor.monitorId]: { + ...state[errorMonitor.monitorId], + status: TestRunStats.COMPLETED, + errors: undefined, + fetchError: { name, message }, + }, + }; + } + } + + if (action.payload.monitorId) { + return { + ...state, + [action.payload.monitorId]: { + ...state[action.payload.monitorId], + status: TestRunStats.COMPLETED, + errors: action.payload.errors, + fetchError: undefined, + }, + }; + } + + return state; + } + ) + .addCase( + String(clearTestNowMonitorAction), + (state: WritableDraft, action: PayloadAction) => { + const { [action.payload]: payloadTestRun, ...rest } = state; + + return rest; + } + ); +}); + +export const testNowRunsSelector = ({ testNowRuns }: AppState) => testNowRuns.testNowRuns; + +export const testNowRunSelector = + (monitorId?: string) => + ({ testNowRuns }: AppState) => + monitorId ? testNowRuns[monitorId] : undefined; diff --git a/x-pack/plugins/uptime/public/state/reducers/types.ts b/x-pack/plugins/synthetics/public/state/reducers/types.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/types.ts rename to x-pack/plugins/synthetics/public/state/reducers/types.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/ui.test.ts b/x-pack/plugins/synthetics/public/state/reducers/ui.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/ui.test.ts rename to x-pack/plugins/synthetics/public/state/reducers/ui.test.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/ui.ts b/x-pack/plugins/synthetics/public/state/reducers/ui.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/ui.ts rename to x-pack/plugins/synthetics/public/state/reducers/ui.ts diff --git a/x-pack/plugins/uptime/public/state/reducers/utils.ts b/x-pack/plugins/synthetics/public/state/reducers/utils.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/reducers/utils.ts rename to x-pack/plugins/synthetics/public/state/reducers/utils.ts diff --git a/x-pack/plugins/uptime/public/state/selectors/index.test.ts b/x-pack/plugins/synthetics/public/state/selectors/index.test.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/selectors/index.test.ts rename to x-pack/plugins/synthetics/public/state/selectors/index.test.ts diff --git a/x-pack/plugins/uptime/public/state/selectors/index.ts b/x-pack/plugins/synthetics/public/state/selectors/index.ts similarity index 100% rename from x-pack/plugins/uptime/public/state/selectors/index.ts rename to x-pack/plugins/synthetics/public/state/selectors/index.ts diff --git a/x-pack/plugins/uptime/scripts/e2e.js b/x-pack/plugins/synthetics/scripts/e2e.js similarity index 100% rename from x-pack/plugins/uptime/scripts/e2e.js rename to x-pack/plugins/synthetics/scripts/e2e.js diff --git a/x-pack/plugins/uptime/server/index.ts b/x-pack/plugins/synthetics/server/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/index.ts rename to x-pack/plugins/synthetics/server/index.ts diff --git a/x-pack/plugins/uptime/server/kibana.index.ts b/x-pack/plugins/synthetics/server/kibana.index.ts similarity index 100% rename from x-pack/plugins/uptime/server/kibana.index.ts rename to x-pack/plugins/synthetics/server/kibana.index.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/synthetics/server/lib/adapters/framework/adapter_types.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/framework/adapter_types.ts rename to x-pack/plugins/synthetics/server/lib/adapters/framework/adapter_types.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/framework/index.ts b/x-pack/plugins/synthetics/server/lib/adapters/framework/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/framework/index.ts rename to x-pack/plugins/synthetics/server/lib/adapters/framework/index.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/synthetics/server/lib/adapters/framework/kibana_framework_adapter.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/framework/kibana_framework_adapter.ts rename to x-pack/plugins/synthetics/server/lib/adapters/framework/kibana_framework_adapter.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/index.ts b/x-pack/plugins/synthetics/server/lib/adapters/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/index.ts rename to x-pack/plugins/synthetics/server/lib/adapters/index.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/__snapshots__/kibana_telemetry_adapter.test.ts.snap b/x-pack/plugins/synthetics/server/lib/adapters/telemetry/__snapshots__/kibana_telemetry_adapter.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/telemetry/__snapshots__/kibana_telemetry_adapter.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/adapters/telemetry/__snapshots__/kibana_telemetry_adapter.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/index.ts b/x-pack/plugins/synthetics/server/lib/adapters/telemetry/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/telemetry/index.ts rename to x-pack/plugins/synthetics/server/lib/adapters/telemetry/index.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.test.ts b/x-pack/plugins/synthetics/server/lib/adapters/telemetry/kibana_telemetry_adapter.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.test.ts rename to x-pack/plugins/synthetics/server/lib/adapters/telemetry/kibana_telemetry_adapter.test.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts b/x-pack/plugins/synthetics/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts rename to x-pack/plugins/synthetics/server/lib/adapters/telemetry/kibana_telemetry_adapter.ts diff --git a/x-pack/plugins/uptime/server/lib/adapters/telemetry/types.ts b/x-pack/plugins/synthetics/server/lib/adapters/telemetry/types.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/adapters/telemetry/types.ts rename to x-pack/plugins/synthetics/server/lib/adapters/telemetry/types.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/action_variables.ts b/x-pack/plugins/synthetics/server/lib/alerts/action_variables.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/action_variables.ts rename to x-pack/plugins/synthetics/server/lib/alerts/action_variables.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/common.test.ts b/x-pack/plugins/synthetics/server/lib/alerts/common.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/common.test.ts rename to x-pack/plugins/synthetics/server/lib/alerts/common.test.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/common.ts b/x-pack/plugins/synthetics/server/lib/alerts/common.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/common.ts rename to x-pack/plugins/synthetics/server/lib/alerts/common.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.test.ts b/x-pack/plugins/synthetics/server/lib/alerts/duration_anomaly.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.test.ts rename to x-pack/plugins/synthetics/server/lib/alerts/duration_anomaly.test.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts b/x-pack/plugins/synthetics/server/lib/alerts/duration_anomaly.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/duration_anomaly.ts rename to x-pack/plugins/synthetics/server/lib/alerts/duration_anomaly.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/index.ts b/x-pack/plugins/synthetics/server/lib/alerts/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/index.ts rename to x-pack/plugins/synthetics/server/lib/alerts/index.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/status_check.test.ts b/x-pack/plugins/synthetics/server/lib/alerts/status_check.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/status_check.test.ts rename to x-pack/plugins/synthetics/server/lib/alerts/status_check.test.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/status_check.ts b/x-pack/plugins/synthetics/server/lib/alerts/status_check.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/status_check.ts rename to x-pack/plugins/synthetics/server/lib/alerts/status_check.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/test_utils/index.ts b/x-pack/plugins/synthetics/server/lib/alerts/test_utils/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/test_utils/index.ts rename to x-pack/plugins/synthetics/server/lib/alerts/test_utils/index.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/tls.test.ts b/x-pack/plugins/synthetics/server/lib/alerts/tls.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/tls.test.ts rename to x-pack/plugins/synthetics/server/lib/alerts/tls.test.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/tls.ts b/x-pack/plugins/synthetics/server/lib/alerts/tls.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/tls.ts rename to x-pack/plugins/synthetics/server/lib/alerts/tls.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/tls_legacy.test.ts b/x-pack/plugins/synthetics/server/lib/alerts/tls_legacy.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/tls_legacy.test.ts rename to x-pack/plugins/synthetics/server/lib/alerts/tls_legacy.test.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/tls_legacy.ts b/x-pack/plugins/synthetics/server/lib/alerts/tls_legacy.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/tls_legacy.ts rename to x-pack/plugins/synthetics/server/lib/alerts/tls_legacy.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/translations.ts b/x-pack/plugins/synthetics/server/lib/alerts/translations.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/translations.ts rename to x-pack/plugins/synthetics/server/lib/alerts/translations.ts diff --git a/x-pack/plugins/uptime/server/lib/alerts/types.ts b/x-pack/plugins/synthetics/server/lib/alerts/types.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/alerts/types.ts rename to x-pack/plugins/synthetics/server/lib/alerts/types.ts diff --git a/x-pack/plugins/uptime/server/lib/compose/kibana.ts b/x-pack/plugins/synthetics/server/lib/compose/kibana.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/compose/kibana.ts rename to x-pack/plugins/synthetics/server/lib/compose/kibana.ts diff --git a/x-pack/plugins/uptime/server/lib/domains/__snapshots__/license.test.ts.snap b/x-pack/plugins/synthetics/server/lib/domains/__snapshots__/license.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/domains/__snapshots__/license.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/domains/__snapshots__/license.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/domains/index.ts b/x-pack/plugins/synthetics/server/lib/domains/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/domains/index.ts rename to x-pack/plugins/synthetics/server/lib/domains/index.ts diff --git a/x-pack/plugins/uptime/server/lib/domains/license.test.ts b/x-pack/plugins/synthetics/server/lib/domains/license.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/domains/license.test.ts rename to x-pack/plugins/synthetics/server/lib/domains/license.test.ts diff --git a/x-pack/plugins/uptime/server/lib/domains/license.ts b/x-pack/plugins/synthetics/server/lib/domains/license.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/domains/license.ts rename to x-pack/plugins/synthetics/server/lib/domains/license.ts diff --git a/x-pack/plugins/uptime/server/lib/helper/__snapshots__/get_filter_clause.test.ts.snap b/x-pack/plugins/synthetics/server/lib/helper/__snapshots__/get_filter_clause.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/__snapshots__/get_filter_clause.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/helper/__snapshots__/get_filter_clause.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/helper/get_filter_clause.test.ts b/x-pack/plugins/synthetics/server/lib/helper/get_filter_clause.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/get_filter_clause.test.ts rename to x-pack/plugins/synthetics/server/lib/helper/get_filter_clause.test.ts diff --git a/x-pack/plugins/uptime/server/lib/helper/get_filter_clause.ts b/x-pack/plugins/synthetics/server/lib/helper/get_filter_clause.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/get_filter_clause.ts rename to x-pack/plugins/synthetics/server/lib/helper/get_filter_clause.ts diff --git a/x-pack/plugins/uptime/server/lib/helper/index.ts b/x-pack/plugins/synthetics/server/lib/helper/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/index.ts rename to x-pack/plugins/synthetics/server/lib/helper/index.ts diff --git a/x-pack/plugins/uptime/server/lib/helper/make_date_rate_filter.ts b/x-pack/plugins/synthetics/server/lib/helper/make_date_rate_filter.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/make_date_rate_filter.ts rename to x-pack/plugins/synthetics/server/lib/helper/make_date_rate_filter.ts diff --git a/x-pack/plugins/uptime/server/lib/helper/object_to_array.ts b/x-pack/plugins/synthetics/server/lib/helper/object_to_array.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/object_to_array.ts rename to x-pack/plugins/synthetics/server/lib/helper/object_to_array.ts diff --git a/x-pack/plugins/uptime/server/lib/helper/parse_relative_date.test.ts b/x-pack/plugins/synthetics/server/lib/helper/parse_relative_date.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/helper/parse_relative_date.test.ts rename to x-pack/plugins/synthetics/server/lib/helper/parse_relative_date.test.ts diff --git a/x-pack/plugins/uptime/server/lib/lib.ts b/x-pack/plugins/synthetics/server/lib/lib.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/lib.ts rename to x-pack/plugins/synthetics/server/lib/lib.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/__fixtures__/monitor_charts_mock.json b/x-pack/plugins/synthetics/server/lib/requests/__fixtures__/monitor_charts_mock.json similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/__fixtures__/monitor_charts_mock.json rename to x-pack/plugins/synthetics/server/lib/requests/__fixtures__/monitor_charts_mock.json diff --git a/x-pack/plugins/uptime/server/lib/requests/__snapshots__/generate_filter_aggs.test.ts.snap b/x-pack/plugins/synthetics/server/lib/requests/__snapshots__/generate_filter_aggs.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/__snapshots__/generate_filter_aggs.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/requests/__snapshots__/generate_filter_aggs.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/requests/__snapshots__/get_monitor_charts.test.ts.snap b/x-pack/plugins/synthetics/server/lib/requests/__snapshots__/get_monitor_charts.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/__snapshots__/get_monitor_charts.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/requests/__snapshots__/get_monitor_charts.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/requests/__snapshots__/get_monitor_details.test.ts.snap b/x-pack/plugins/synthetics/server/lib/requests/__snapshots__/get_monitor_details.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/__snapshots__/get_monitor_details.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/requests/__snapshots__/get_monitor_details.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/requests/__snapshots__/get_ping_histogram.test.ts.snap b/x-pack/plugins/synthetics/server/lib/requests/__snapshots__/get_ping_histogram.test.ts.snap similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/__snapshots__/get_ping_histogram.test.ts.snap rename to x-pack/plugins/synthetics/server/lib/requests/__snapshots__/get_ping_histogram.test.ts.snap diff --git a/x-pack/plugins/uptime/server/lib/requests/generate_filter_aggs.test.ts b/x-pack/plugins/synthetics/server/lib/requests/generate_filter_aggs.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/generate_filter_aggs.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/generate_filter_aggs.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/generate_filter_aggs.ts b/x-pack/plugins/synthetics/server/lib/requests/generate_filter_aggs.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/generate_filter_aggs.ts rename to x-pack/plugins/synthetics/server/lib/requests/generate_filter_aggs.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_certs.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_certs.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_certs.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_certs.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_certs.ts b/x-pack/plugins/synthetics/server/lib/requests/get_certs.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_certs.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_certs.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_index_pattern.ts b/x-pack/plugins/synthetics/server/lib/requests/get_index_pattern.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_index_pattern.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_index_pattern.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_index_status.ts b/x-pack/plugins/synthetics/server/lib/requests/get_index_status.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_index_status.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_index_status.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_details.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_details.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_details.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_details.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_details.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_details.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_details.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_details.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_failed_steps.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_failed_steps.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_failed_steps.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_failed_steps.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_failed_steps.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_failed_steps.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_failed_steps.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_failed_steps.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot_blocks.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot_blocks.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot_blocks.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot_blocks.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot_blocks.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot_blocks.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_screenshot_blocks.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_screenshot_blocks.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_steps.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_steps.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_steps.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_steps.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_journey_steps.ts b/x-pack/plugins/synthetics/server/lib/requests/get_journey_steps.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_journey_steps.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_journey_steps.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_last_successful_check.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_last_successful_check.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_last_successful_check.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_last_successful_check.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_last_successful_check.ts b/x-pack/plugins/synthetics/server/lib/requests/get_last_successful_check.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_last_successful_check.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_last_successful_check.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_latest_monitor.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_latest_monitor.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts b/x-pack/plugins/synthetics/server/lib/requests/get_latest_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_latest_monitor.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_availability.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_availability.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_availability.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_availability.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_availability.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_availability.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_availability.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_availability.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_charts.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_charts.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_charts.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_charts.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_details.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_details.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_details.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_details.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_details.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_details.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_details.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_details.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_duration.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_duration.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_duration.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_duration.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_locations.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_locations.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_locations.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_locations.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_states.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_states.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_status.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_status.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_status.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_status.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_status.ts b/x-pack/plugins/synthetics/server/lib/requests/get_monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_monitor_status.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_monitor_status.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_network_events.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_network_events.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_network_events.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_network_events.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_network_events.ts b/x-pack/plugins/synthetics/server/lib/requests/get_network_events.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_network_events.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_network_events.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_ping_histogram.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_ping_histogram.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts b/x-pack/plugins/synthetics/server/lib/requests/get_ping_histogram.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_ping_histogram.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_ping_histogram.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_pings.test.ts b/x-pack/plugins/synthetics/server/lib/requests/get_pings.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_pings.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_pings.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_pings.ts b/x-pack/plugins/synthetics/server/lib/requests/get_pings.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_pings.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_pings.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/get_snapshot_counts.ts b/x-pack/plugins/synthetics/server/lib/requests/get_snapshot_counts.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/get_snapshot_counts.ts rename to x-pack/plugins/synthetics/server/lib/requests/get_snapshot_counts.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/helper.ts b/x-pack/plugins/synthetics/server/lib/requests/helper.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/helper.ts rename to x-pack/plugins/synthetics/server/lib/requests/helper.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/index.ts b/x-pack/plugins/synthetics/server/lib/requests/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/index.ts rename to x-pack/plugins/synthetics/server/lib/requests/index.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/fetch_chunk.ts b/x-pack/plugins/synthetics/server/lib/requests/search/fetch_chunk.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/fetch_chunk.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/fetch_chunk.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/find_potential_matches.ts b/x-pack/plugins/synthetics/server/lib/requests/search/find_potential_matches.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/find_potential_matches.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/find_potential_matches.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/index.ts b/x-pack/plugins/synthetics/server/lib/requests/search/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/index.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/index.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/monitor_summary_iterator.test.ts b/x-pack/plugins/synthetics/server/lib/requests/search/monitor_summary_iterator.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/monitor_summary_iterator.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/monitor_summary_iterator.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/monitor_summary_iterator.ts b/x-pack/plugins/synthetics/server/lib/requests/search/monitor_summary_iterator.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/monitor_summary_iterator.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/monitor_summary_iterator.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/query_context.test.ts b/x-pack/plugins/synthetics/server/lib/requests/search/query_context.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/query_context.test.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/query_context.test.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/query_context.ts b/x-pack/plugins/synthetics/server/lib/requests/search/query_context.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/query_context.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/query_context.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts b/x-pack/plugins/synthetics/server/lib/requests/search/refine_potential_matches.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/refine_potential_matches.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/test_helpers.ts b/x-pack/plugins/synthetics/server/lib/requests/search/test_helpers.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/test_helpers.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/test_helpers.ts diff --git a/x-pack/plugins/uptime/server/lib/requests/search/types.ts b/x-pack/plugins/synthetics/server/lib/requests/search/types.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/requests/search/types.ts rename to x-pack/plugins/synthetics/server/lib/requests/search/types.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/index.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/index.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/index.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/migrations.test.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/migrations.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/migrations.test.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/migrations.test.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/migrations.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/migrations.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/migrations.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/migrations.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/saved_objects.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/saved_objects.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/saved_objects.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/saved_objects.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/service_api_key.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/service_api_key.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/service_api_key.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/service_api_key.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/synthetics_monitor.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/synthetics_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/synthetics_monitor.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/synthetics_monitor.ts diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/uptime_settings.ts b/x-pack/plugins/synthetics/server/lib/saved_objects/uptime_settings.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/saved_objects/uptime_settings.ts rename to x-pack/plugins/synthetics/server/lib/saved_objects/uptime_settings.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/browser.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/browser.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/browser.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/browser.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/common.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/common.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/common.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/common.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/convert_to_data_stream.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/convert_to_data_stream.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/convert_to_data_stream.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/convert_to_data_stream.test.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/convert_to_data_stream.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/convert_to_data_stream.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/convert_to_data_stream.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/convert_to_data_stream.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/format_configs.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/format_configs.test.ts similarity index 99% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/format_configs.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/format_configs.test.ts index 815a02b9d4b3a..a54e777c13eee 100644 --- a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/format_configs.test.ts +++ b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/format_configs.test.ts @@ -53,7 +53,6 @@ describe('formatMonitorConfig', () => { expect(yamlConfig).toEqual({ 'check.request.method': 'GET', enabled: true, - locations: [], max_redirects: '0', name: 'Test', password: '3z9SBOQWW5F0UrdqLVFqlF6z', @@ -110,7 +109,6 @@ describe('formatMonitorConfig', () => { enabled: true, 'filter_journeys.tags': ['dev'], ignore_https_errors: false, - locations: [], name: 'Test', schedule: '@every 3m', screenshots: 'on', diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/format_configs.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/format_configs.ts similarity index 96% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/format_configs.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/format_configs.ts index 5c7f538f18ce1..f3b9787ce628d 100644 --- a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/format_configs.ts +++ b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/format_configs.ts @@ -15,6 +15,9 @@ const UI_KEYS_TO_SKIP = [ ConfigKey.DOWNLOAD_SPEED, ConfigKey.LATENCY, ConfigKey.IS_THROTTLING_ENABLED, + ConfigKey.LOCATIONS, + ConfigKey.REVISION, + 'secrets', ]; const uiToHeartbeatKeyMap = { diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/http.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/http.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/http.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/http.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/icmp.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/icmp.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/icmp.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/icmp.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/index.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/index.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/index.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/tcp.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/tcp.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/tcp.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/tcp.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/formatters/tls.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/tls.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/formatters/tls.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/tls.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/get_api_key.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/get_api_key.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/get_api_key.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/get_api_key.test.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/get_api_key.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/get_api_key.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/get_api_key.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/get_api_key.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/get_es_hosts.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/get_es_hosts.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/get_es_hosts.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/get_es_hosts.test.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/get_es_hosts.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/get_es_hosts.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/get_es_hosts.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/get_es_hosts.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/get_service_locations.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/get_service_locations.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/get_service_locations.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/get_service_locations.test.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/get_service_locations.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/get_service_locations.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/get_service_locations.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/get_service_locations.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/hydrate_saved_object.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/hydrate_saved_object.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/hydrate_saved_object.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/hydrate_saved_object.test.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/hydrate_saved_object.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/hydrate_saved_object.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/hydrate_saved_object.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/hydrate_saved_object.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/service_api_client.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/service_api_client.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/service_api_client.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.test.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/synthetics_service.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.test.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/synthetics_service.test.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/synthetics_service.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/synthetics_service.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/synthetics_service.ts diff --git a/x-pack/plugins/uptime/server/lib/synthetics_service/utils/secrets.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/utils/secrets.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/synthetics_service/utils/secrets.ts rename to x-pack/plugins/synthetics/server/lib/synthetics_service/utils/secrets.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/__mocks__/index.ts b/x-pack/plugins/synthetics/server/lib/telemetry/__mocks__/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/__mocks__/index.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/__mocks__/index.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/constants.ts b/x-pack/plugins/synthetics/server/lib/telemetry/constants.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/constants.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/constants.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/queue.test.ts b/x-pack/plugins/synthetics/server/lib/telemetry/queue.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/queue.test.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/queue.test.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/queue.ts b/x-pack/plugins/synthetics/server/lib/telemetry/queue.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/queue.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/queue.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/sender.test.ts b/x-pack/plugins/synthetics/server/lib/telemetry/sender.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/sender.test.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/sender.test.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/sender.ts b/x-pack/plugins/synthetics/server/lib/telemetry/sender.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/sender.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/sender.ts diff --git a/x-pack/plugins/uptime/server/lib/telemetry/types.ts b/x-pack/plugins/synthetics/server/lib/telemetry/types.ts similarity index 100% rename from x-pack/plugins/uptime/server/lib/telemetry/types.ts rename to x-pack/plugins/synthetics/server/lib/telemetry/types.ts diff --git a/x-pack/plugins/uptime/server/plugin.ts b/x-pack/plugins/synthetics/server/plugin.ts similarity index 100% rename from x-pack/plugins/uptime/server/plugin.ts rename to x-pack/plugins/synthetics/server/plugin.ts diff --git a/x-pack/plugins/uptime/server/rest_api/create_route_with_auth.ts b/x-pack/plugins/synthetics/server/rest_api/create_route_with_auth.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/create_route_with_auth.ts rename to x-pack/plugins/synthetics/server/rest_api/create_route_with_auth.ts diff --git a/x-pack/plugins/uptime/server/rest_api/dynamic_settings.test.ts b/x-pack/plugins/synthetics/server/rest_api/dynamic_settings.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/dynamic_settings.test.ts rename to x-pack/plugins/synthetics/server/rest_api/dynamic_settings.test.ts diff --git a/x-pack/plugins/uptime/server/rest_api/dynamic_settings.ts b/x-pack/plugins/synthetics/server/rest_api/dynamic_settings.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/dynamic_settings.ts rename to x-pack/plugins/synthetics/server/rest_api/dynamic_settings.ts diff --git a/x-pack/plugins/uptime/server/rest_api/index.ts b/x-pack/plugins/synthetics/server/rest_api/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/index.ts rename to x-pack/plugins/synthetics/server/rest_api/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/index_state/get_index_status.ts b/x-pack/plugins/synthetics/server/rest_api/index_state/get_index_status.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/index_state/get_index_status.ts rename to x-pack/plugins/synthetics/server/rest_api/index_state/get_index_status.ts diff --git a/x-pack/plugins/uptime/server/rest_api/index_state/index.ts b/x-pack/plugins/synthetics/server/rest_api/index_state/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/index_state/index.ts rename to x-pack/plugins/synthetics/server/rest_api/index_state/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/index.ts b/x-pack/plugins/synthetics/server/rest_api/monitors/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/monitors/index.ts rename to x-pack/plugins/synthetics/server/rest_api/monitors/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/monitor_list.ts b/x-pack/plugins/synthetics/server/rest_api/monitors/monitor_list.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/monitors/monitor_list.ts rename to x-pack/plugins/synthetics/server/rest_api/monitors/monitor_list.ts diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/monitor_locations.ts b/x-pack/plugins/synthetics/server/rest_api/monitors/monitor_locations.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/monitors/monitor_locations.ts rename to x-pack/plugins/synthetics/server/rest_api/monitors/monitor_locations.ts diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/monitor_status.ts b/x-pack/plugins/synthetics/server/rest_api/monitors/monitor_status.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/monitors/monitor_status.ts rename to x-pack/plugins/synthetics/server/rest_api/monitors/monitor_status.ts diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/monitors_details.ts b/x-pack/plugins/synthetics/server/rest_api/monitors/monitors_details.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/monitors/monitors_details.ts rename to x-pack/plugins/synthetics/server/rest_api/monitors/monitors_details.ts diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/monitors_durations.ts b/x-pack/plugins/synthetics/server/rest_api/monitors/monitors_durations.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/monitors/monitors_durations.ts rename to x-pack/plugins/synthetics/server/rest_api/monitors/monitors_durations.ts diff --git a/x-pack/plugins/uptime/server/rest_api/network_events/get_network_events.ts b/x-pack/plugins/synthetics/server/rest_api/network_events/get_network_events.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/network_events/get_network_events.ts rename to x-pack/plugins/synthetics/server/rest_api/network_events/get_network_events.ts diff --git a/x-pack/plugins/uptime/server/rest_api/network_events/index.ts b/x-pack/plugins/synthetics/server/rest_api/network_events/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/network_events/index.ts rename to x-pack/plugins/synthetics/server/rest_api/network_events/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/get_ping_histogram.ts b/x-pack/plugins/synthetics/server/rest_api/pings/get_ping_histogram.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/get_ping_histogram.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/get_ping_histogram.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/get_pings.ts b/x-pack/plugins/synthetics/server/rest_api/pings/get_pings.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/get_pings.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/get_pings.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/index.ts b/x-pack/plugins/synthetics/server/rest_api/pings/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/index.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.test.ts b/x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshot_blocks.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.test.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshot_blocks.test.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.ts b/x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshot_blocks.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshot_blocks.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.test.ts b/x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshots.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.test.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshots.test.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts b/x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshots.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/journey_screenshots.ts diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journeys.ts b/x-pack/plugins/synthetics/server/rest_api/pings/journeys.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/pings/journeys.ts rename to x-pack/plugins/synthetics/server/rest_api/pings/journeys.ts diff --git a/x-pack/plugins/uptime/server/rest_api/snapshot/get_snapshot_count.ts b/x-pack/plugins/synthetics/server/rest_api/snapshot/get_snapshot_count.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/snapshot/get_snapshot_count.ts rename to x-pack/plugins/synthetics/server/rest_api/snapshot/get_snapshot_count.ts diff --git a/x-pack/plugins/uptime/server/rest_api/snapshot/index.ts b/x-pack/plugins/synthetics/server/rest_api/snapshot/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/snapshot/index.ts rename to x-pack/plugins/synthetics/server/rest_api/snapshot/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics/last_successful_check.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics/last_successful_check.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics/last_successful_check.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics/last_successful_check.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/add_monitor.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/add_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/add_monitor.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/add_monitor.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/delete_monitor.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/delete_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/delete_monitor.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/delete_monitor.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/edit_monitor.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/edit_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/edit_monitor.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/edit_monitor.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/enablement.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/enablement.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/enablement.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/enablement.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/get_monitor.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/get_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/get_monitor.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/get_monitor.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/get_service_allowed.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/get_service_allowed.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/get_service_allowed.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/get_service_allowed.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/get_service_locations.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/get_service_locations.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/get_service_locations.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/get_service_locations.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/install_index_templates.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/install_index_templates.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/install_index_templates.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/install_index_templates.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.test.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/monitor_validation.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.test.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/monitor_validation.test.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/monitor_validation.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/monitor_validation.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/monitor_validation.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/run_once_monitor.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/run_once_monitor.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/run_once_monitor.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/run_once_monitor.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/service_errors.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/service_errors.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/service_errors.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/service_errors.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.test.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.test.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.test.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.test.ts diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.ts similarity index 96% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.ts index 295f6cfc2e6e9..526e40ef2f230 100644 --- a/x-pack/plugins/uptime/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.ts +++ b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/telemetry/monitor_upgrade_sender.ts @@ -7,6 +7,7 @@ import { sha256 } from 'js-sha256'; import type { Logger } from '@kbn/core/server'; import { SavedObjectsUpdateResponse, SavedObject } from '@kbn/core/server'; +import { scheduleToMilli } from '../../../../common/lib/schedule_to_time'; import { MonitorFields, EncryptedSyntheticsMonitor, @@ -68,7 +69,7 @@ export function formatTelemetryEvent({ ), // mark self-managed locations as other locationsCount: attributes[ConfigKey.LOCATIONS].length, monitorNameLength: attributes[ConfigKey.NAME].length, - monitorInterval: parseInt(attributes[ConfigKey.SCHEDULE].number, 10) * 60 * 1000, + monitorInterval: scheduleToMilli(attributes[ConfigKey.SCHEDULE]), stackVersion: kibanaVersion, scriptType: getScriptType(attributes as Partial), errors: diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/test_now_monitor.ts similarity index 80% rename from x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts rename to x-pack/plugins/synthetics/server/rest_api/synthetics_service/test_now_monitor.ts index 57a1385e0f1d4..fa06bda0cf66d 100644 --- a/x-pack/plugins/uptime/server/rest_api/synthetics_service/test_now_monitor.ts +++ b/x-pack/plugins/synthetics/server/rest_api/synthetics_service/test_now_monitor.ts @@ -6,7 +6,11 @@ */ import { schema } from '@kbn/config-schema'; import { v4 as uuidv4 } from 'uuid'; -import { SyntheticsMonitor, SyntheticsMonitorWithSecrets } from '../../../common/runtime_types'; +import { + ConfigKey, + SyntheticsMonitor, + SyntheticsMonitorWithSecrets, +} from '../../../common/runtime_types'; import { UMRestApiRouteFactory } from '../types'; import { API_URLS } from '../../../common/constants'; import { @@ -23,7 +27,7 @@ export const testNowMonitorRoute: UMRestApiRouteFactory = () => ({ monitorId: schema.string({ minLength: 1, maxLength: 1024 }), }), }, - handler: async ({ request, savedObjectsClient, response, server }): Promise => { + handler: async ({ request, savedObjectsClient, server }): Promise => { const { monitorId } = request.params; const monitor = await savedObjectsClient.get( syntheticsMonitorType, @@ -38,6 +42,8 @@ export const testNowMonitorRoute: UMRestApiRouteFactory = () => ({ monitorId ); + const { [ConfigKey.SCHEDULE]: schedule, [ConfigKey.LOCATIONS]: locations } = monitor.attributes; + const { syntheticsService } = server; const testRunId = uuidv4(); @@ -45,7 +51,6 @@ export const testNowMonitorRoute: UMRestApiRouteFactory = () => ({ const errors = await syntheticsService.triggerConfigs(request, [ { ...normalizeSecrets(monitorWithSecrets).attributes, - ...monitor.attributes, id: monitorId, fields_under_root: true, fields: { config_id: monitorId, test_run_id: testRunId }, @@ -53,9 +58,9 @@ export const testNowMonitorRoute: UMRestApiRouteFactory = () => ({ ]); if (errors && errors?.length > 0) { - return { errors, testRunId, monitorId }; + return { errors, testRunId, monitorId, schedule, locations }; } - return { testRunId, monitorId }; + return { testRunId, monitorId, schedule, locations }; }, }); diff --git a/x-pack/plugins/uptime/server/rest_api/telemetry/index.ts b/x-pack/plugins/synthetics/server/rest_api/telemetry/index.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/telemetry/index.ts rename to x-pack/plugins/synthetics/server/rest_api/telemetry/index.ts diff --git a/x-pack/plugins/uptime/server/rest_api/telemetry/log_page_view.ts b/x-pack/plugins/synthetics/server/rest_api/telemetry/log_page_view.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/telemetry/log_page_view.ts rename to x-pack/plugins/synthetics/server/rest_api/telemetry/log_page_view.ts diff --git a/x-pack/plugins/uptime/server/rest_api/types.ts b/x-pack/plugins/synthetics/server/rest_api/types.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/types.ts rename to x-pack/plugins/synthetics/server/rest_api/types.ts diff --git a/x-pack/plugins/uptime/server/rest_api/uptime_route_wrapper.ts b/x-pack/plugins/synthetics/server/rest_api/uptime_route_wrapper.ts similarity index 100% rename from x-pack/plugins/uptime/server/rest_api/uptime_route_wrapper.ts rename to x-pack/plugins/synthetics/server/rest_api/uptime_route_wrapper.ts diff --git a/x-pack/plugins/uptime/server/types.ts b/x-pack/plugins/synthetics/server/types.ts similarity index 100% rename from x-pack/plugins/uptime/server/types.ts rename to x-pack/plugins/synthetics/server/types.ts diff --git a/x-pack/plugins/uptime/server/uptime_server.ts b/x-pack/plugins/synthetics/server/uptime_server.ts similarity index 100% rename from x-pack/plugins/uptime/server/uptime_server.ts rename to x-pack/plugins/synthetics/server/uptime_server.ts diff --git a/x-pack/plugins/uptime/tsconfig.json b/x-pack/plugins/synthetics/tsconfig.json similarity index 100% rename from x-pack/plugins/uptime/tsconfig.json rename to x-pack/plugins/synthetics/tsconfig.json diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 21aa36c338c61..db23047f1e019 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -16810,8 +16810,6 @@ "xpack.maps.layerPanel.join.applyGlobalTimeCheckboxLabel": "Appliquer une heure globale à la liaison", "xpack.maps.layerPanel.join.deleteJoinAriaLabel": "Supprimer la liaison", "xpack.maps.layerPanel.join.deleteJoinTitle": "Supprimer la liaison", - "xpack.maps.layerPanel.joinEditor.addJoinAriaLabel": "Ajouter une liaison", - "xpack.maps.layerPanel.joinEditor.addJoinButtonLabel": "Ajouter une liaison", "xpack.maps.layerPanel.joinEditor.termJoinsTitle": "Liaisons de terme", "xpack.maps.layerPanel.joinEditor.termJoinTooltip": "Utilisez les liaisons de terme pour ajouter à ce calque les propriétés de style basées sur les données.", "xpack.maps.layerPanel.joinExpression.helpText": "Configurez la clé partagée.", @@ -16986,7 +16984,6 @@ "xpack.maps.scalingDocs.clustersDetails": "Affichez les clusters lorsque les résultats dépassent {maxResultWindow} documents. Affichez les documents lorsqu’il y a moins de {maxResultWindow} résultats.", "xpack.maps.scalingDocs.clustersUseCase": "Utilisez cette option pour afficher de grands ensembles de données. Ne prend pas en charge les liaisons de termes.", "xpack.maps.scalingDocs.limitDetails": "Affichez les fonctionnalités des {maxResultWindow} premiers documents.", - "xpack.maps.scalingDocs.limitUseCase": "Utilisez cette option pour créer des cartes chloroplèthes qui comparent les statistiques d’une limite à l’autre.", "xpack.maps.scalingDocs.maxResultWindow": "Contrainte {maxResultWindow} fournie par le paramètre d’index {link}.", "xpack.maps.scalingDocs.mvtDetails": "Partitionnez votre carte en tuiles, chacune affichant les fonctionnalités des {maxResultWindow} premiers documents. Les résultats dépassant {maxResultWindow} ne sont pas affichés en tuile. Une zone de délimitation indique la zone où les données sont incomplètes.", "xpack.maps.scalingDocs.mvtUseCase": "Utilisez cette option pour afficher de grands ensembles de données avec les temps de chargement les plus courts. Ne prend pas en charge les liaisons de termes, les étiquettes formatées et les styles fondés sur les données à partir de champs scriptés.", @@ -17094,15 +17091,11 @@ "xpack.maps.source.esSearch.indexOverOneLengthEditError": "Votre vue de données pointe vers plusieurs index. Un seul index est autorisé par vue de données.", "xpack.maps.source.esSearch.indexZeroLengthEditError": "Votre vue de données ne pointe vers aucun index.", "xpack.maps.source.esSearch.joinsDisabledReason": "Les liaisons ne sont pas prises en charge lors de la montée en charge par rapport aux clusters", - "xpack.maps.source.esSearch.joinsDisabledReasonMvt": "Les liaisons ne sont pas prises en charge lors de la montée en charge par rapport aux tuiles vectorielles.", "xpack.maps.source.esSearch.limitScalingLabel": "Limiter les résultats à {maxResultWindow}", "xpack.maps.source.esSearch.loadTooltipPropertiesErrorMsg": "Document introuvable, _id : {docId}", "xpack.maps.source.esSearch.scalingModal.cancelBtnLabel": "Annuler", - "xpack.maps.source.esSearch.scalingModal.clusters": "clusters", "xpack.maps.source.esSearch.scalingModal.confirmBtnLabel": "Accepter", - "xpack.maps.source.esSearch.scalingModal.message": "L’option de montée en charge {scalingOptionLabel} ne prend pas en charge les liaisons de termes. Le passage à l’option {scalingOptionLabel} entraînera la suppression de toutes les liaisons de termes de la configuration de calque.", "xpack.maps.source.esSearch.scalingModal.title": "Liaisons de termes non prises en charge", - "xpack.maps.source.esSearch.scalingModal.vectorTiles": "tuiles vectorielles", "xpack.maps.source.esSearch.selectLabel": "Sélectionner un champ géographique", "xpack.maps.source.esSearch.sortFieldLabel": "Champ", "xpack.maps.source.esSearch.sortFieldSelectPlaceholder": "Sélectionner le champ de tri", @@ -30132,7 +30125,6 @@ "xpack.uptime.emptyStateError.notFoundPage": "Page introuvable", "xpack.uptime.emptyStateError.title": "Erreur", "xpack.uptime.enableAlert.editAlert": "Modifier l'alerte", - "xpack.uptime.featureRegistry.uptimeFeatureName": "Uptime", "xpack.uptime.filterBar.ariaLabel": "Saisissez des critères de filtre pour la page d'aperçu", "xpack.uptime.filterBar.filterAllLabel": "Tous", "xpack.uptime.filterBar.options.location.name": "Emplacement", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 95a4be2f6fede..f171f90222089 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -16943,8 +16943,6 @@ "xpack.maps.layerPanel.join.applyGlobalTimeCheckboxLabel": "結合するグローバル時刻を適用", "xpack.maps.layerPanel.join.deleteJoinAriaLabel": "ジョブの削除", "xpack.maps.layerPanel.join.deleteJoinTitle": "ジョブの削除", - "xpack.maps.layerPanel.joinEditor.addJoinAriaLabel": "結合を追加", - "xpack.maps.layerPanel.joinEditor.addJoinButtonLabel": "結合を追加", "xpack.maps.layerPanel.joinEditor.termJoinsTitle": "用語結合", "xpack.maps.layerPanel.joinEditor.termJoinTooltip": "用語結合を使用すると、データに基づくスタイル設定のプロパティでこのレイヤーを強化します。", "xpack.maps.layerPanel.joinExpression.helpText": "共有キーを構成します。", @@ -17125,7 +17123,6 @@ "xpack.maps.scalingDocs.clustersDetails": "結果が{maxResultWindow}ドキュメントを超えたときにクラスターを表示します。結果が{maxResultWindow}未満のときにドキュメントを表示します。", "xpack.maps.scalingDocs.clustersUseCase": "このオプションを使用して、大きいデータセットを表示します。用語結合はサポートされていません。", "xpack.maps.scalingDocs.limitDetails": "最初の{maxResultWindow}ドキュメントから特徴量を表示します。", - "xpack.maps.scalingDocs.limitUseCase": "このオプションを使用すると、境界を越えて統計情報を比較する階級区分図を作成します。", "xpack.maps.scalingDocs.maxResultWindow": "{link}インデックス設定で提供された{maxResultWindow}制約。", "xpack.maps.scalingDocs.mvtDetails": "マップをタイルに区分します。各タイルには、最初の{maxResultWindow}ドキュメントの特徴量が表示されます。{maxResultWindow}を超える結果はタイルに表示されません。バウンディングボックスは、データが不完全である領域を示します。", "xpack.maps.scalingDocs.mvtUseCase": "このオプションを使用すると、最速読み込み時間で大きいデータセットを表示します。用語結合、書式設定されたラベル、スクリプトフィールドからのデータドリブンスタイルはサポートされません。", @@ -17233,15 +17230,11 @@ "xpack.maps.source.esSearch.indexOverOneLengthEditError": "データビューは複数のインデックスを参照しています。データビューごとに1つのインデックスのみが許可されています。", "xpack.maps.source.esSearch.indexZeroLengthEditError": "データビューはどのインデックスも参照していません。", "xpack.maps.source.esSearch.joinsDisabledReason": "クラスターでスケーリングするときに、結合はサポートされていません", - "xpack.maps.source.esSearch.joinsDisabledReasonMvt": "ベクトルタイルでスケーリングするときに、結合はサポートされていません", "xpack.maps.source.esSearch.limitScalingLabel": "結果を{maxResultWindow}に限定", "xpack.maps.source.esSearch.loadTooltipPropertiesErrorMsg": "ドキュメントが見つかりません。_id:{docId}", "xpack.maps.source.esSearch.scalingModal.cancelBtnLabel": "キャンセル", - "xpack.maps.source.esSearch.scalingModal.clusters": "クラスター", "xpack.maps.source.esSearch.scalingModal.confirmBtnLabel": "承諾", - "xpack.maps.source.esSearch.scalingModal.message": "スケーリングオプション{scalingOptionLabel}は用語結合をサポートしていません。{scalingOptionLabel}に切り替えると、すべての用語結合がレイヤー構成から削除されます。", "xpack.maps.source.esSearch.scalingModal.title": "用語結合はサポートされていません", - "xpack.maps.source.esSearch.scalingModal.vectorTiles": "ベクトルタイル", "xpack.maps.source.esSearch.selectLabel": "ジオフィールドを選択", "xpack.maps.source.esSearch.sortFieldLabel": "フィールド", "xpack.maps.source.esSearch.sortFieldSelectPlaceholder": "ソートフィールドを選択", @@ -30317,7 +30310,6 @@ "xpack.uptime.emptyStateError.notFoundPage": "ページが見つかりません", "xpack.uptime.emptyStateError.title": "エラー", "xpack.uptime.enableAlert.editAlert": "アラートを編集", - "xpack.uptime.featureRegistry.uptimeFeatureName": "アップタイム", "xpack.uptime.filterBar.ariaLabel": "概要ページのインプットフィルター基準", "xpack.uptime.filterBar.filterAllLabel": "すべて", "xpack.uptime.filterBar.options.location.name": "場所", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 2ea50fe043ac2..4d70fa18e8c84 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -16968,8 +16968,6 @@ "xpack.maps.layerPanel.join.applyGlobalTimeCheckboxLabel": "应用全局时间到联接", "xpack.maps.layerPanel.join.deleteJoinAriaLabel": "删除联接", "xpack.maps.layerPanel.join.deleteJoinTitle": "删除联接", - "xpack.maps.layerPanel.joinEditor.addJoinAriaLabel": "添加联接", - "xpack.maps.layerPanel.joinEditor.addJoinButtonLabel": "添加联接", "xpack.maps.layerPanel.joinEditor.termJoinsTitle": "词联接", "xpack.maps.layerPanel.joinEditor.termJoinTooltip": "使用词联接及属性增强此图层,以实现数据驱动的样式。", "xpack.maps.layerPanel.joinExpression.helpText": "配置共享密钥。", @@ -17150,7 +17148,6 @@ "xpack.maps.scalingDocs.clustersDetails": "结果超过 {maxResultWindow} 个文档时显示集群。结果数小于 {maxResultWindow} 时显示文档。", "xpack.maps.scalingDocs.clustersUseCase": "使用此选项可显示大型数据集。不支持词联接。", "xpack.maps.scalingDocs.limitDetails": "显示前 {maxResultWindow} 个文档中的特征。", - "xpack.maps.scalingDocs.limitUseCase": "使用此选项可创建跨边界比较统计信息的分级统计图。", "xpack.maps.scalingDocs.maxResultWindow": "{link} 索引设置提供的 {maxResultWindow} 限制。", "xpack.maps.scalingDocs.mvtDetails": "将地图分区为磁贴,每个磁贴显示前 {maxResultWindow} 个文档中的特征。超出 {maxResultWindow} 的结果不在磁贴中显示。边界框指示数据不完整的区域。", "xpack.maps.scalingDocs.mvtUseCase": "使用此选项可显示加载时间最快的大型数据集。不支持词联接、格式化标签和脚本字段的数据驱动样式。", @@ -17258,15 +17255,11 @@ "xpack.maps.source.esSearch.indexOverOneLengthEditError": "您的数据视图指向多个索引。每个数据视图只允许一个索引。", "xpack.maps.source.esSearch.indexZeroLengthEditError": "您的数据视图未指向任何索引。", "xpack.maps.source.esSearch.joinsDisabledReason": "按集群缩放时不支持联接", - "xpack.maps.source.esSearch.joinsDisabledReasonMvt": "按矢量磁贴缩放时不支持联接", "xpack.maps.source.esSearch.limitScalingLabel": "将结果数限制到 {maxResultWindow}", "xpack.maps.source.esSearch.loadTooltipPropertiesErrorMsg": "找不到文档,_id:{docId}", "xpack.maps.source.esSearch.scalingModal.cancelBtnLabel": "取消", - "xpack.maps.source.esSearch.scalingModal.clusters": "集群", "xpack.maps.source.esSearch.scalingModal.confirmBtnLabel": "接受", - "xpack.maps.source.esSearch.scalingModal.message": "缩放选项 {scalingOptionLabel} 不支持词联接。切换到 {scalingOptionLabel} 将从您的图层配置中移除所有词联接。", "xpack.maps.source.esSearch.scalingModal.title": "不支持词联接", - "xpack.maps.source.esSearch.scalingModal.vectorTiles": "矢量磁贴", "xpack.maps.source.esSearch.selectLabel": "选择地理字段", "xpack.maps.source.esSearch.sortFieldLabel": "字段", "xpack.maps.source.esSearch.sortFieldSelectPlaceholder": "选择排序字段", @@ -30353,7 +30346,6 @@ "xpack.uptime.emptyStateError.notFoundPage": "未找到页面", "xpack.uptime.emptyStateError.title": "错误", "xpack.uptime.enableAlert.editAlert": "编辑告警", - "xpack.uptime.featureRegistry.uptimeFeatureName": "运行时间", "xpack.uptime.filterBar.ariaLabel": "概览页面的输入筛选条件", "xpack.uptime.filterBar.filterAllLabel": "全部", "xpack.uptime.filterBar.options.location.name": "位置", diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx deleted file mode 100644 index af11553d185a5..0000000000000 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx +++ /dev/null @@ -1,122 +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 { useEffect } from 'react'; -import * as React from 'react'; -import { EuiAccordion, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner, EuiText } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import styled from 'styled-components'; -import { StepsList } from '../../../synthetics/check_steps/steps_list'; -import { JourneyStep } from '../../../../../common/runtime_types'; -import { useBrowserRunOnceMonitors } from './use_browser_run_once_monitors'; -import { TestResultHeader } from '../test_result_header'; -import { StdErrorLogs } from '../../../synthetics/check_steps/stderr_logs'; - -interface Props { - monitorId: string; - isMonitorSaved: boolean; - onDone: () => void; -} -export const BrowserTestRunResult = ({ monitorId, isMonitorSaved, onDone }: Props) => { - const { data, loading, stepsLoading, stepEnds, journeyStarted, summaryDoc, stepListData } = - useBrowserRunOnceMonitors({ - configId: monitorId, - }); - - useEffect(() => { - if (Boolean(summaryDoc)) { - onDone(); - } - }, [summaryDoc, onDone]); - - const hits = data?.hits.hits; - const doc = hits?.[0]?._source as JourneyStep; - - const buttonContent = ( -
- - -

- - {i18n.translate('xpack.uptime.monitorManagement.stepCompleted', { - defaultMessage: - '{stepCount, number} {stepCount, plural, one {step} other {steps}} completed', - values: { - stepCount: stepEnds.length, - }, - })} - -

-
-
- ); - - const isStepsLoading = - journeyStarted && stepEnds.length === 0 && (!summaryDoc || (summaryDoc && stepsLoading)); - const isStepsLoadingFailed = summaryDoc && stepEnds.length === 0 && !isStepsLoading; - - return ( - - {isStepsLoading && ( - - - {LOADING_STEPS} - - - - - - )} - {isStepsLoadingFailed && ( - {summaryDoc?.error?.message ?? FAILED_TO_RUN} - )} - - {isStepsLoadingFailed && - summaryDoc?.error?.message?.includes('journey did not finish executing') && ( - - )} - - {stepEnds.length > 0 && stepListData?.steps && ( - - )} - - ); -}; - -const AccordionWrapper = styled(EuiAccordion)` - .euiAccordion__buttonContent { - width: 100%; - } -`; - -const FAILED_TO_RUN = i18n.translate('xpack.uptime.monitorManagement.failedRun', { - defaultMessage: 'Failed to run steps', -}); - -const LOADING_STEPS = i18n.translate('xpack.uptime.monitorManagement.loadingSteps', { - defaultMessage: 'Loading steps...', -}); diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts deleted file mode 100644 index a54cead8378a1..0000000000000 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.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 { useEffect, useState } from 'react'; -import { createEsParams, useEsSearch, useFetcher } from '@kbn/observability-plugin/public'; -import { JourneyStep } from '../../../../../common/runtime_types'; -import { useTickTick } from '../use_tick_tick'; -import { fetchJourneySteps } from '../../../../state/api/journey'; -import { isStepEnd } from '../../../synthetics/check_steps/steps_list'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants'; - -export const useBrowserEsResults = ({ - configId, - testRunId, - lastRefresh, -}: { - configId: string; - testRunId?: string; - lastRefresh: number; -}) => { - return useEsSearch( - createEsParams({ - index: SYNTHETICS_INDEX_PATTERN, - body: { - sort: [ - { - '@timestamp': 'desc', - }, - ], - query: { - bool: { - filter: [ - { - term: { - config_id: configId, - }, - }, - { - terms: { - 'synthetics.type': ['heartbeat/summary', 'journey/start'], - }, - }, - ...(testRunId - ? [ - { - term: { - test_run_id: testRunId, - }, - }, - ] - : []), - ], - }, - }, - }, - size: 1000, - }), - [configId, lastRefresh], - { name: 'TestRunData' } - ); -}; - -export const useBrowserRunOnceMonitors = ({ - configId, - testRunId, - skipDetails = false, - refresh = true, -}: { - configId: string; - testRunId?: string; - refresh?: boolean; - skipDetails?: boolean; -}) => { - const { refreshTimer, lastRefresh } = useTickTick(3 * 1000, refresh); - - const [checkGroupId, setCheckGroupId] = useState(''); - const [stepEnds, setStepEnds] = useState([]); - const [summary, setSummary] = useState(); - - const { data, loading } = useBrowserEsResults({ configId, testRunId, lastRefresh }); - - const { data: stepListData, loading: stepsLoading } = useFetcher(() => { - if (checkGroupId && !skipDetails) { - return fetchJourneySteps({ - checkGroup: checkGroupId, - }); - } - return Promise.resolve(null); - }, [lastRefresh]); - - useEffect(() => { - const hits = data?.hits.hits; - - if (hits && hits.length > 0) { - hits?.forEach((hit) => { - const doc = hit._source as JourneyStep; - if (doc.synthetics?.type === 'journey/start') { - setCheckGroupId(doc.monitor.check_group); - } - if (doc.synthetics?.type === 'heartbeat/summary') { - setSummary(doc); - clearInterval(refreshTimer); - } - }); - } - }, [data, refreshTimer]); - - useEffect(() => { - if (stepListData?.steps && stepListData?.steps.length > 0) { - setStepEnds(stepListData.steps.filter(isStepEnd)); - } - }, [stepListData]); - - return { - data, - stepEnds, - loading, - stepsLoading, - stepListData, - summaryDoc: summary, - journeyStarted: Boolean(checkGroupId), - }; -}; diff --git a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx b/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx deleted file mode 100644 index 4fb27fb83d560..0000000000000 --- a/x-pack/plugins/uptime/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx +++ /dev/null @@ -1,34 +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, { useEffect, useState } from 'react'; -import { useSimpleRunOnceMonitors } from './use_simple_run_once_monitors'; -import { Ping } from '../../../../../common/runtime_types'; -import { PingListTable } from '../../../monitor/ping_list/ping_list_table'; -import { TestResultHeader } from '../test_result_header'; - -interface Props { - monitorId: string; - onDone: () => void; -} -export function SimpleTestResults({ monitorId, onDone }: Props) { - const [summaryDocs, setSummaryDocs] = useState([]); - const { summaryDoc, loading } = useSimpleRunOnceMonitors({ configId: monitorId }); - - useEffect(() => { - if (summaryDoc) { - setSummaryDocs((prevState) => [summaryDoc, ...prevState]); - onDone(); - } - }, [summaryDoc, onDone]); - - return ( - <> - - {summaryDoc && } - - ); -} diff --git a/x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts b/x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts deleted file mode 100644 index 83833e531bb9f..0000000000000 --- a/x-pack/plugins/uptime/public/state/reducers/test_now_runs.ts +++ /dev/null @@ -1,82 +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 { createReducer, PayloadAction } from '@reduxjs/toolkit'; -import { WritableDraft } from 'immer/dist/types/types-external'; -import { clearTestNowMonitorAction, testNowMonitorAction } from '../actions'; -import { TestNowResponse } from '../api'; -import { AppState } from '..'; - -export enum TestRunStats { - LOADING = 'loading', - IN_PROGRESS = 'in-progress', - COMPLETED = 'completed', -} - -interface TestNowRun { - monitorId: string; - testRunId?: string; - status: TestRunStats; -} - -export interface TestNowRunsState { - testNowRuns: TestNowRun[]; -} - -export const initialState: TestNowRunsState = { - testNowRuns: [], -}; - -export const testNowRunsReducer = createReducer(initialState, (builder) => { - builder - .addCase( - String(testNowMonitorAction.get), - (state: WritableDraft, action: PayloadAction) => ({ - ...state, - testNowRuns: [ - ...state.testNowRuns, - { monitorId: action.payload, status: TestRunStats.LOADING }, - ], - }) - ) - .addCase( - String(testNowMonitorAction.success), - (state: WritableDraft, { payload }: PayloadAction) => ({ - ...state, - testNowRuns: state.testNowRuns.map((tRun) => - tRun.monitorId === payload.monitorId - ? { - monitorId: payload.monitorId, - testRunId: payload.testRunId, - status: TestRunStats.IN_PROGRESS, - } - : tRun - ), - }) - ) - .addCase( - String(testNowMonitorAction.fail), - (state: WritableDraft, action: PayloadAction) => ({ - ...state, - testNowRuns: [...(state.testNowRuns ?? [])], - }) - ) - .addCase( - String(clearTestNowMonitorAction), - (state: WritableDraft, action: PayloadAction) => ({ - ...state, - testNowRuns: state.testNowRuns.filter((tRun) => tRun.monitorId !== action.payload), - }) - ); -}); - -export const testNowRunsSelector = ({ testNowRuns }: AppState) => testNowRuns.testNowRuns; - -export const testNowRunSelector = - (monitorId?: string) => - ({ testNowRuns }: AppState) => - testNowRuns.testNowRuns.find((tRun) => monitorId && monitorId === tRun.monitorId); diff --git a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts index 31ea0c35bba7f..34a7bbb1b2186 100644 --- a/x-pack/test/api_integration/apis/maps/maps_telemetry.ts +++ b/x-pack/test/api_integration/apis/maps/maps_telemetry.ts @@ -27,83 +27,81 @@ export default function ({ getService }: FtrProviderContext) { const mapUsage = apiResponse.stack_stats.kibana.plugins.maps; delete mapUsage.timeCaptured; - expect(mapUsage).eql({ - geoShapeAggLayersCount: 1, - indexPatternsWithGeoFieldCount: 6, - indexPatternsWithGeoPointFieldCount: 4, - indexPatternsWithGeoShapeFieldCount: 2, - mapsTotalCount: 25, - basemaps: {}, - joins: { term: { min: 1, max: 1, total: 3, avg: 0.12 } }, - layerTypes: { - es_docs: { min: 1, max: 2, total: 17, avg: 0.68 }, - es_agg_grids: { min: 1, max: 1, total: 6, avg: 0.24 }, - es_point_to_point: { min: 1, max: 1, total: 1, avg: 0.04 }, - es_top_hits: { min: 1, max: 1, total: 2, avg: 0.08 }, - es_agg_heatmap: { min: 1, max: 1, total: 1, avg: 0.04 }, - kbn_tms_raster: { min: 1, max: 1, total: 1, avg: 0.04 }, - ems_basemap: { min: 1, max: 1, total: 1, avg: 0.04 }, - ems_region: { min: 1, max: 1, total: 1, avg: 0.04 }, - }, - resolutions: { - coarse: { min: 1, max: 1, total: 4, avg: 0.16 }, - super_fine: { min: 1, max: 1, total: 3, avg: 0.12 }, + expect(mapUsage.geoShapeAggLayersCount).eql(1); + expect(mapUsage.indexPatternsWithGeoFieldCount).eql(6); + expect(mapUsage.indexPatternsWithGeoPointFieldCount).eql(4); + expect(mapUsage.indexPatternsWithGeoShapeFieldCount).eql(2); + expect(mapUsage.mapsTotalCount).eql(26); + expect(mapUsage.basemaps).eql({}); + expect(mapUsage.joins).eql({ term: { min: 1, max: 1, total: 3, avg: 0.11538461538461539 } }); + expect(mapUsage.layerTypes).eql({ + es_docs: { min: 1, max: 2, total: 18, avg: 0.6923076923076923 }, + es_agg_grids: { min: 1, max: 1, total: 6, avg: 0.23076923076923078 }, + es_point_to_point: { min: 1, max: 1, total: 1, avg: 0.038461538461538464 }, + es_top_hits: { min: 1, max: 1, total: 2, avg: 0.07692307692307693 }, + es_agg_heatmap: { min: 1, max: 1, total: 1, avg: 0.038461538461538464 }, + kbn_tms_raster: { min: 1, max: 1, total: 1, avg: 0.038461538461538464 }, + ems_basemap: { min: 1, max: 1, total: 1, avg: 0.038461538461538464 }, + ems_region: { min: 1, max: 1, total: 1, avg: 0.038461538461538464 }, + }); + expect(mapUsage.resolutions).eql({ + coarse: { min: 1, max: 1, total: 4, avg: 0.15384615384615385 }, + super_fine: { min: 1, max: 1, total: 3, avg: 0.11538461538461539 }, + }); + expect(mapUsage.scalingOptions).eql({ + limit: { min: 1, max: 2, total: 14, avg: 0.5384615384615384 }, + clusters: { min: 1, max: 1, total: 1, avg: 0.038461538461538464 }, + mvt: { min: 1, max: 1, total: 3, avg: 0.11538461538461539 }, + }); + expect(mapUsage.attributesPerMap).eql({ + dataSourcesCount: { + avg: 1.1538461538461537, + max: 5, + min: 1, }, - scalingOptions: { - limit: { min: 1, max: 2, total: 14, avg: 0.56 }, - clusters: { min: 1, max: 1, total: 1, avg: 0.04 }, - mvt: { min: 1, max: 1, total: 2, avg: 0.08 }, + emsVectorLayersCount: { + idThatDoesNotExitForEMSFileSource: { + avg: 0.038461538461538464, + max: 1, + min: 1, + }, }, - attributesPerMap: { - dataSourcesCount: { - avg: 1.16, - max: 5, + layerTypesCount: { + BLENDED_VECTOR: { + avg: 0.038461538461538464, + max: 1, min: 1, }, - emsVectorLayersCount: { - idThatDoesNotExitForEMSFileSource: { - avg: 0.04, - max: 1, - min: 1, - }, + EMS_VECTOR_TILE: { + avg: 0.038461538461538464, + max: 1, + min: 1, }, - layerTypesCount: { - BLENDED_VECTOR: { - avg: 0.04, - max: 1, - min: 1, - }, - EMS_VECTOR_TILE: { - avg: 0.04, - max: 1, - min: 1, - }, - GEOJSON_VECTOR: { - avg: 0.84, - max: 4, - min: 1, - }, - HEATMAP: { - avg: 0.04, - max: 1, - min: 1, - }, - MVT_VECTOR: { - avg: 0.2, - max: 1, - min: 1, - }, - RASTER_TILE: { - avg: 0.04, - max: 1, - min: 1, - }, + GEOJSON_VECTOR: { + avg: 0.8076923076923077, + max: 4, + min: 1, + }, + HEATMAP: { + avg: 0.038461538461538464, + max: 1, + min: 1, }, - layersCount: { - avg: 1.2, - max: 6, + MVT_VECTOR: { + avg: 0.23076923076923078, + max: 1, min: 1, }, + RASTER_TILE: { + avg: 0.038461538461538464, + max: 1, + min: 1, + }, + }, + layersCount: { + avg: 1.1923076923076923, + max: 6, + min: 1, }, }); }); diff --git a/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts b/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts index 50722c39476c6..543c20fd95e45 100644 --- a/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts +++ b/x-pack/test/api_integration/apis/security_solution/matrix_dns_histogram.ts @@ -20,7 +20,8 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const bsearch = getService('bsearch'); - describe('Matrix DNS Histogram', () => { + // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/130692 + describe.skip('Matrix DNS Histogram', () => { describe('Large data set', () => { before( async () => diff --git a/x-pack/test/api_integration/apis/uptime/feature_controls.ts b/x-pack/test/api_integration/apis/uptime/feature_controls.ts index c9c545cbad242..39d7406636353 100644 --- a/x-pack/test/api_integration/apis/uptime/feature_controls.ts +++ b/x-pack/test/api_integration/apis/uptime/feature_controls.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../ftr_provider_context'; import { PINGS_DATE_RANGE_END, PINGS_DATE_RANGE_START } from './constants'; diff --git a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts index a7547d61992f2..19b78854a8df3 100644 --- a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts +++ b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts @@ -7,7 +7,7 @@ import moment from 'moment'; import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { PINGS_DATE_RANGE_START, PINGS_DATE_RANGE_END } from './constants'; import { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts index 379b740c22427..14fce8f974e92 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts @@ -6,9 +6,9 @@ */ import { omit } from 'lodash'; import expect from '@kbn/expect'; -import { secretKeys } from '@kbn/uptime-plugin/common/constants/monitor_management'; -import { HTTPFields } from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { secretKeys } from '@kbn/synthetics-plugin/common/constants/monitor_management'; +import { HTTPFields } from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { getFixtureJson } from './helper/get_fixture_json'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/certs.ts b/x-pack/test/api_integration/apis/uptime/rest/certs.ts index 8e76567bb13fb..ac9cc0e2be15f 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/certs.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/certs.ts @@ -8,11 +8,11 @@ import expect from '@kbn/expect'; import moment from 'moment'; import { isRight } from 'fp-ts/lib/Either'; -import { CertType } from '@kbn/uptime-plugin/common/runtime_types'; +import { CertType } from '@kbn/synthetics-plugin/common/runtime_types'; import { processCertsResult, getCertsRequestBody, -} from '@kbn/uptime-plugin/common/requests/get_certs_request_body'; +} from '@kbn/synthetics-plugin/common/requests/get_certs_request_body'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus } from './helper/make_checks'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts index e82759d581191..faff22f750670 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { HTTPFields, MonitorFields } from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { HTTPFields, MonitorFields } from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { getFixtureJson } from './helper/get_fixture_json'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts b/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts index 19b50a0d1a260..ab5315b92300c 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts @@ -7,8 +7,8 @@ import expect from '@kbn/expect'; import { isRight } from 'fp-ts/lib/Either'; -import { DynamicSettingsType, DynamicSettings } from '@kbn/uptime-plugin/common/runtime_types'; -import { DYNAMIC_SETTINGS_DEFAULTS, API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { DynamicSettingsType, DynamicSettings } from '@kbn/synthetics-plugin/common/runtime_types'; +import { DYNAMIC_SETTINGS_DEFAULTS, API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts index 81bcc58c9da85..be94aedc293b3 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts @@ -7,9 +7,9 @@ import expect from '@kbn/expect'; import { omit } from 'lodash'; import { SimpleSavedObject } from '@kbn/core/public'; -import { secretKeys } from '@kbn/uptime-plugin/common/constants/monitor_management'; -import { ConfigKey, HTTPFields, MonitorFields } from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { secretKeys } from '@kbn/synthetics-plugin/common/constants/monitor_management'; +import { ConfigKey, HTTPFields, MonitorFields } from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { getFixtureJson } from './helper/get_fixture_json'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/get_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/get_monitor.ts index 311c52eecb98d..0fa5ed26b791e 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/get_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/get_monitor.ts @@ -7,9 +7,9 @@ import expect from '@kbn/expect'; import { SimpleSavedObject } from '@kbn/core/public'; -import { MonitorFields } from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; -import { formatSecrets } from '@kbn/uptime-plugin/server/lib/synthetics_service/utils/secrets'; +import { MonitorFields } from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { formatSecrets } from '@kbn/synthetics-plugin/server/lib/synthetics_service/utils/secrets'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { getFixtureJson } from './helper/get_fixture_json'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts index 1ab5b6f2af082..3bfe81534c330 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -8,7 +8,7 @@ import { settingsObjectId, settingsObjectType, -} from '@kbn/uptime-plugin/server/lib/saved_objects/uptime_settings'; +} from '@kbn/synthetics-plugin/server/lib/saved_objects/uptime_settings'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, loadTestFile }: FtrProviderContext) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/index_status.ts b/x-pack/test/api_integration/apis/uptime/rest/index_status.ts index 826569041a7bd..620621274a078 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index_status.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index_status.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { expectFixtureEql } from './helper/expect_fixture_eql'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts index 8606c81e94641..abd1ac69732b1 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts index 9e4632f552a90..e5cf59be67233 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts index 54112045db13f..5bbe7f7312102 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_generated.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { MonitorSummary } from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { MonitorSummary } from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus } from './helper/make_checks'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts index 0ca3d4d75b9bd..438211665674a 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts @@ -10,8 +10,8 @@ import { isRight } from 'fp-ts/lib/Either'; import { MonitorSummariesResult, MonitorSummariesResultType, -} from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +} from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; interface ExpectedMonitorStatesPage { diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts index bc30a932e77b2..235ae17b7c9e7 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts index 84d4af6f650be..5c179a15b7525 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -8,8 +8,8 @@ import expect from '@kbn/expect'; import { isLeft } from 'fp-ts/lib/Either'; import { PathReporter } from 'io-ts/lib/PathReporter'; -import { PingsResponseType } from '@kbn/uptime-plugin/common/runtime_types'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { PingsResponseType } from '@kbn/synthetics-plugin/common/runtime_types'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; function decodePingsResponseData(response: any) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts index 98954776cf2cf..d5722fce17b0f 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus, getChecksDateRange } from './helper/make_checks'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/synthetics_enablement.ts b/x-pack/test/api_integration/apis/uptime/rest/synthetics_enablement.ts index 72a5422338ef6..04a718e5c7c8f 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/synthetics_enablement.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/synthetics_enablement.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; -import { serviceApiKeyPrivileges } from '@kbn/uptime-plugin/server/lib/synthetics_service/get_api_key'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; +import { serviceApiKeyPrivileges } from '@kbn/synthetics-plugin/server/lib/synthetics_service/get_api_key'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts index cc493b31115a9..9c9088e015373 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus } from './helper/make_checks'; diff --git a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts index 41716323ffd9e..7760ef5c13da9 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/telemetry_collectors_fleet.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { API_URLS } from '@kbn/uptime-plugin/common/constants'; +import { API_URLS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus } from './helper/make_checks'; diff --git a/x-pack/test/functional/apps/maps/index.js b/x-pack/test/functional/apps/maps/index.js index dbfacc7941794..9d7e7a9cbddcc 100644 --- a/x-pack/test/functional/apps/maps/index.js +++ b/x-pack/test/functional/apps/maps/index.js @@ -87,6 +87,7 @@ export default function ({ loadTestFile, getService }) { this.tags('ciGroup10'); loadTestFile(require.resolve('./es_pew_pew_source')); loadTestFile(require.resolve('./joins')); + loadTestFile(require.resolve('./mvt_joins')); loadTestFile(require.resolve('./mapbox_styles')); loadTestFile(require.resolve('./mvt_scaling')); loadTestFile(require.resolve('./mvt_geotile_grid')); diff --git a/x-pack/test/functional/apps/maps/mvt_joins.ts b/x-pack/test/functional/apps/maps/mvt_joins.ts new file mode 100644 index 0000000000000..2ae8f7ea5943b --- /dev/null +++ b/x-pack/test/functional/apps/maps/mvt_joins.ts @@ -0,0 +1,95 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const PageObjects = getPageObjects(['maps']); + const security = getService('security'); + const find = getService('find'); + + describe('vector tile layer with joins', () => { + before(async () => { + await security.testUser.setRoles( + ['global_maps_all', 'geoshape_data_reader', 'meta_for_geoshape_data_reader'], + { skipBrowserRefresh: true } + ); + await PageObjects.maps.loadSavedMap('mvt join example'); + }); + + after(async () => { + await security.testUser.restoreDefaults(); + }); + + it('should show dynamic data range in legend', async () => { + const layerTOCDetails = await PageObjects.maps.getLayerTOCDetails('geo_shapes*'); + const split = layerTOCDetails.trim().split('\n'); + + // field display name + expect(split[0]).to.equal('max prop1'); + + // bands 1-8 + expect(split[1]).to.equal('< 4.13'); + expect(split[2]).to.equal('4.13 up to 5.25'); + expect(split[3]).to.equal('5.25 up to 6.38'); + expect(split[4]).to.equal('6.38 up to 7.5'); + expect(split[5]).to.equal('7.5 up to 8.63'); + expect(split[6]).to.equal('8.63 up to 9.75'); + expect(split[7]).to.equal('9.75 up to 11'); + expect(split[8]).to.equal('>= 11'); + }); + + it('should show join metrics in tooltip', async () => { + // zoom in on feature so tooltip click can not miss + await PageObjects.maps.setView(-1, 60, 9); + await PageObjects.maps.lockTooltipAtPosition(200, -200); + + const tooltipRows = await find.allByCssSelector(`tr[class='mapFeatureTooltip_row']`); + expect(tooltipRows.length).to.equal(2); + expect(await tooltipRows[0].getVisibleText()).to.equal('name charlie'); + expect(await tooltipRows[1].getVisibleText()).to.equal('max prop1 12'); + }); + + describe('query bar', () => { + before(async () => { + await PageObjects.maps.setAndSubmitQuery('prop1 < 10'); + }); + + after(async () => { + await PageObjects.maps.setAndSubmitQuery(''); + }); + + it('should update dynamic data range in legend', async () => { + const layerTOCDetails = await PageObjects.maps.getLayerTOCDetails('geo_shapes*'); + const split = layerTOCDetails.trim().split('\n'); + + // field display name + expect(split[0]).to.equal('max prop1'); + + // bands 1-8 + expect(split[1]).to.equal('< 3.63'); + expect(split[2]).to.equal('3.63 up to 4.25'); + expect(split[3]).to.equal('4.25 up to 4.88'); + expect(split[4]).to.equal('4.88 up to 5.5'); + expect(split[5]).to.equal('5.5 up to 6.13'); + expect(split[6]).to.equal('6.13 up to 6.75'); + expect(split[7]).to.equal('6.75 up to 7.38'); + expect(split[8]).to.equal('>= 7.38'); + }); + + it('fit to bounds should exclude source features without join matches', async () => { + await PageObjects.maps.clickFitToData(); + + const { lat, lon, zoom } = await PageObjects.maps.getView(); + expect(Math.round(lat)).to.equal(0); + expect(Math.round(lon)).to.equal(90); + expect(Math.ceil(zoom)).to.equal(5); + }); + }); + }); +} diff --git a/x-pack/test/functional/apps/spaces/index.ts b/x-pack/test/functional/apps/spaces/index.ts index 3f0b35ff9236a..780d355e1f5c6 100644 --- a/x-pack/test/functional/apps/spaces/index.ts +++ b/x-pack/test/functional/apps/spaces/index.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function spacesApp({ loadTestFile }: FtrProviderContext) { describe('Spaces app', function spacesAppTestSuite() { - this.tags('ciGroup4'); + this.tags('ciGroup9'); loadTestFile(require.resolve('./copy_saved_objects')); loadTestFile(require.resolve('./feature_controls/spaces_security')); diff --git a/x-pack/test/functional/apps/uptime/index.ts b/x-pack/test/functional/apps/uptime/index.ts index 68065129a28af..cc0578602951a 100644 --- a/x-pack/test/functional/apps/uptime/index.ts +++ b/x-pack/test/functional/apps/uptime/index.ts @@ -8,7 +8,7 @@ import { settingsObjectId, settingsObjectType, -} from '@kbn/uptime-plugin/server/lib/saved_objects/uptime_settings'; +} from '@kbn/synthetics-plugin/server/lib/saved_objects/uptime_settings'; import { FtrProviderContext } from '../../ftr_provider_context'; const ARCHIVE = 'x-pack/test/functional/es_archives/uptime/full_heartbeat'; diff --git a/x-pack/test/functional/apps/uptime/settings.ts b/x-pack/test/functional/apps/uptime/settings.ts index 5beace54c1b06..585de566f2aba 100644 --- a/x-pack/test/functional/apps/uptime/settings.ts +++ b/x-pack/test/functional/apps/uptime/settings.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import { DynamicSettings } from '@kbn/uptime-plugin/common/runtime_types'; -import { DYNAMIC_SETTINGS_DEFAULTS } from '@kbn/uptime-plugin/common/constants'; +import { DynamicSettings } from '@kbn/synthetics-plugin/common/runtime_types'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '@kbn/synthetics-plugin/common/constants'; import { FtrProviderContext } from '../../ftr_provider_context'; import { makeChecks } from '../../../api_integration/apis/uptime/rest/helper/make_checks'; diff --git a/x-pack/test/functional/apps/visualize/index.ts b/x-pack/test/functional/apps/visualize/index.ts index e821c1d93edf1..105303aa1b537 100644 --- a/x-pack/test/functional/apps/visualize/index.ts +++ b/x-pack/test/functional/apps/visualize/index.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function visualize({ loadTestFile }: FtrProviderContext) { describe('Visualize', function visualizeTestSuite() { - this.tags(['ciGroup4', 'skipFirefox']); + this.tags(['ciGroup30', 'skipFirefox']); loadTestFile(require.resolve('./feature_controls/visualize_security')); loadTestFile(require.resolve('./feature_controls/visualize_spaces')); diff --git a/x-pack/test/functional/fixtures/kbn_archiver/maps.json b/x-pack/test/functional/fixtures/kbn_archiver/maps.json index 5564e8d502944..e9f4f4290c70d 100644 --- a/x-pack/test/functional/fixtures/kbn_archiver/maps.json +++ b/x-pack/test/functional/fixtures/kbn_archiver/maps.json @@ -104,6 +104,35 @@ "version": "WzUxLDJd" } +{ + "attributes": { + "description": "", + "layerListJSON": "[{\"id\":\"n1t6f\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"sourceDescriptor\":{\"id\":\"62eca1fc-fe42-11e8-8eb2-f2801f1b9fd1\",\"type\":\"ES_SEARCH\",\"geoField\":\"geometry\",\"limit\":2048,\"filterByMapBounds\":false,\"showTooltip\":true,\"tooltipProperties\":[\"name\"],\"applyGlobalQuery\":false,\"scalingType\":\"MVT\",\"indexPatternRefName\":\"layer_0_source_index_pattern\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3},\"field\":{\"label\":\"max(prop1) group by meta_for_geo_shapes*.runtime_shape_name\",\"name\":\"__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1\",\"origin\":\"join\"},\"color\":\"Blues\"}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}},\"temporary\":true,\"previousStyle\":null},\"type\":\"MVT_VECTOR\",\"joins\":[{\"leftField\":\"name\",\"right\":{\"id\":\"855ccb86-fe42-11e8-8eb2-f2801f1b9fd1\",\"indexPatternTitle\":\"meta_for_geo_shapes*\",\"term\":\"runtime_shape_name\",\"metrics\":[{\"type\":\"max\",\"field\":\"prop1\"}],\"applyGlobalQuery\":true,\"type\":\"ES_TERM_SOURCE\",\"indexPatternRefName\":\"layer_0_join_0_index_pattern\"}}]}]", + "mapStateJSON": "{\"zoom\":3.02,\"center\":{\"lon\":77.33426,\"lat\":-0.04647},\"timeFilters\":{\"from\":\"now-17m\",\"to\":\"now\",\"mode\":\"quick\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":1000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}", + "title": "mvt join example", + "uiStateJSON": "{\"isLayerTOCOpen\":true,\"openTOCDetails\":[\"n1t6f\"]}" + }, + "coreMigrationVersion": "8.3.0", + "id": "f85dc420-ba99-11ec-8403-51529e77089a", + "migrationVersion": { + "map": "8.1.0" + }, + "references": [ + { + "id": "561253e0-f731-11e8-8487-11b9dd924f96", + "name": "layer_0_source_index_pattern", + "type": "index-pattern" + }, + { + "id": "e20b2a30-f735-11e8-8ce0-9723965e01e3", + "name": "layer_0_join_0_index_pattern", + "type": "index-pattern" + } + ], + "type": "map", + "version": "Wzk0LDFd" +} + { "attributes": { "fields": "[{\"name\":\"hour_of_day\",\"type\":\"number\",\"count\":0,\"scripted\":true,\"script\":\"doc['@timestamp'].value.getHour()\",\"lang\":\"painless\",\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false}]", diff --git a/x-pack/test/functional/services/uptime/settings.ts b/x-pack/test/functional/services/uptime/settings.ts index e6493efd9b264..846fdc7216f63 100644 --- a/x-pack/test/functional/services/uptime/settings.ts +++ b/x-pack/test/functional/services/uptime/settings.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { DynamicSettings } from '@kbn/uptime-plugin/common/runtime_types'; +import { DynamicSettings } from '@kbn/synthetics-plugin/common/runtime_types'; import { FtrProviderContext } from '../../ftr_provider_context'; export function UptimeSettingsProvider({ getService }: FtrProviderContext) { diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 91b82bc785ae9..d6bdf8cfaa6fd 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -101,6 +101,6 @@ { "path": "../plugins/remote_clusters/tsconfig.json" }, { "path": "../plugins/cross_cluster_replication/tsconfig.json" }, { "path": "../plugins/index_lifecycle_management/tsconfig.json"}, - { "path": "../plugins/uptime/tsconfig.json" } + { "path": "../plugins/synthetics/tsconfig.json"} ] } diff --git a/yarn.lock b/yarn.lock index b6caac62d279a..a1c9373e08175 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3080,6 +3080,10 @@ version "0.0.0" uid "" +"@kbn/kibana-json-schema@link:bazel-bin/packages/kbn-kibana-json-schema": + version "0.0.0" + uid "" + "@kbn/logging-mocks@link:bazel-bin/packages/kbn-logging-mocks": version "0.0.0" uid "" @@ -6148,6 +6152,10 @@ version "0.0.0" uid "" +"@types/kbn__kibana-json-schema@link:bazel-bin/packages/kbn-kibana-json-schema/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__logging-mocks@link:bazel-bin/packages/kbn-logging-mocks/npm_module_types": version "0.0.0" uid "" @@ -18585,6 +18593,11 @@ json-schema-traverse@^1.0.0: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== +json-schema-typed@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/json-schema-typed/-/json-schema-typed-7.0.3.tgz#23ff481b8b4eebcd2ca123b4fa0409e66469a2d9" + integrity sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A== + json-schema@0.2.3, json-schema@0.4.0, json-schema@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5"