From 5c485d405dc4a0924d89ae8f65c851e2772f633b Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Thu, 28 Apr 2022 23:16:23 -0700 Subject: [PATCH 01/89] Renable logs disabled callout for managed policies (#131204) --- .../components/agent_logs/agent_logs.tsx | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx index 14fc3eb1d24c3..cc7a9bec975ef 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx @@ -84,25 +84,27 @@ const AgentPolicyLogsNotEnabledCallout: React.FunctionComponent<{ agentPolicy: A /> } > - - - - ), - }} - /> + {agentPolicy.is_managed ? null : ( + + + + ), + }} + /> + )} ); @@ -278,9 +280,9 @@ export const AgentLogsUI: React.FunctionComponent = memo( return ( - {agentPolicy && - !agentPolicy.monitoring_enabled?.includes('logs') && - !agentPolicy.is_managed && } + {agentPolicy && !agentPolicy.monitoring_enabled?.includes('logs') && ( + + )} From b0fff69b2a0e5091170ac492b6e3b69edf2903c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ester=20Mart=C3=AD=20Vilaseca?= Date: Fri, 29 Apr 2022 09:02:46 +0200 Subject: [PATCH 02/89] [Unified Observability] Clean overview page feature toggle (#130650) * Move old overview page to index * remove overview page feature toggle * Remove code for old alerts section * Fix translations * remove feature toggle from tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../test_suites/core_plugins/rendering.ts | 1 - .../public/application/application.test.tsx | 1 - .../components/app/section/alerts/index.tsx | 195 ----------- .../components/app/section/apm/index.test.tsx | 1 - x-pack/plugins/observability/public/index.ts | 1 - .../public/pages/overview/index.test.tsx | 87 ----- .../public/pages/overview/index.tsx | 299 ++++++++++++++++- .../pages/overview/old_overview_page.tsx | 302 ------------------ .../pages/overview/overview.stories.tsx | 1 - .../public/pages/overview/overview_page.tsx | 110 ------- .../public/utils/test_helper.tsx | 1 - x-pack/plugins/observability/server/index.ts | 1 - .../translations/translations/fr-FR.json | 6 - .../translations/translations/ja-JP.json | 6 - .../translations/translations/zh-CN.json | 6 - 15 files changed, 287 insertions(+), 731 deletions(-) delete mode 100644 x-pack/plugins/observability/public/components/app/section/alerts/index.tsx delete mode 100644 x-pack/plugins/observability/public/pages/overview/index.test.tsx delete mode 100644 x-pack/plugins/observability/public/pages/overview/old_overview_page.tsx delete mode 100644 x-pack/plugins/observability/public/pages/overview/overview_page.tsx diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index b7adbfa17301c..c4c9d86a4df2f 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -182,7 +182,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.maps.showMapsInspectorAdapter (boolean)', 'xpack.observability.unsafe.alertingExperience.enabled (boolean)', 'xpack.observability.unsafe.cases.enabled (boolean)', - 'xpack.observability.unsafe.overviewNext.enabled (boolean)', 'xpack.observability.unsafe.rules.enabled (boolean)', 'xpack.osquery.actionEnabled (boolean)', 'xpack.osquery.packs (boolean)', diff --git a/x-pack/plugins/observability/public/application/application.test.tsx b/x-pack/plugins/observability/public/application/application.test.tsx index a3160d713d1b7..a03f007c2d751 100644 --- a/x-pack/plugins/observability/public/application/application.test.tsx +++ b/x-pack/plugins/observability/public/application/application.test.tsx @@ -63,7 +63,6 @@ describe('renderApp', () => { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true }, - overviewNext: { enabled: false }, rules: { enabled: true }, }, }; diff --git a/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx b/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx deleted file mode 100644 index 9c65df16d9060..0000000000000 --- a/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx +++ /dev/null @@ -1,195 +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 { - EuiBadge, - EuiFlexGroup, - EuiFlexItem, - EuiLink, - EuiText, - EuiSpacer, - EuiTitle, - EuiButtonEmpty, - EuiLoadingSpinner, - EuiCallOut, - EuiPanel, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n-react'; -import moment from 'moment'; -import React, { useState, useMemo } from 'react'; -import { EuiSelect } from '@elastic/eui'; -import { uniqBy } from 'lodash'; -import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { usePluginContext } from '../../../../hooks/use_plugin_context'; -import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; -import { getObservabilityAlerts } from '../../../../services/get_observability_alerts'; -import { paths } from '../../../../config'; -import { ObservabilityAppServices } from '../../../../application/types'; - -const ALL_TYPES = 'ALL_TYPES'; -const allTypes = { - value: ALL_TYPES, - text: i18n.translate('xpack.observability.overview.alert.allTypes', { - defaultMessage: 'All types', - }), -}; - -export function AlertsSection() { - const { config } = usePluginContext(); - const { http } = useKibana().services; - const [filter, setFilter] = useState(ALL_TYPES); - const manageLink = config.unsafe.alertingExperience.enabled - ? http.basePath.prepend(paths.observability.alerts) - : http.basePath.prepend(paths.management.rules); - - const { data, status } = useFetcher(() => getObservabilityAlerts({ http }), [http]); - - const alerts = useMemo(() => data ?? [], [data]); - - const filterOptions = useMemo(() => { - if (!alerts) { - return []; - } - return uniqBy(alerts, (alert) => alert.consumer).map(({ consumer }) => ({ - value: consumer, - text: consumer, - })); - }, [alerts]); - - const isError = status === FETCH_STATUS.FAILURE; - const isLoading = status !== FETCH_STATUS.SUCCESS && !isError; - - if (isLoading) { - return ( - - - - - - ); - } - - if (isError) { - return ( - - - -

- -

-
-
-
- ); - } - - return ( -
- - - -

- {i18n.translate('xpack.observability.overview.alerts.title', { - defaultMessage: 'Alerts', - })} -

-
-
- - - {i18n.translate('xpack.observability.overview.alert.appLink', { - defaultMessage: 'Show all alerts', - })} - - -
- <> - - - setFilter(e.target.value)} - prepend="Show" - /> - - - {alerts - .filter((alert) => filter === ALL_TYPES || alert.consumer === filter) - .map((alert, index) => { - return ( - - - - - - - {alert.name} - - - - - - {alert.alertTypeId} - - {alert.tags.map((tag, idx) => { - return ( - - {tag} - - ); - })} - - - - - {alert.muteAll && ( - - - {i18n.translate('xpack.observability.overview.alerts.muted', { - defaultMessage: 'Muted', - })} - - - )} - - - Last updated{' '} - {moment.duration(moment().diff(alert.updatedAt)).humanize()} ago - - - - - - - - - ); - })} - -
- ); -} diff --git a/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx b/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx index a8f49f7d9cbb4..179e8ef70deb1 100644 --- a/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx +++ b/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx @@ -48,7 +48,6 @@ describe('APMSection', () => { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true }, - overviewNext: { enabled: false }, rules: { enabled: true }, }, }, diff --git a/x-pack/plugins/observability/public/index.ts b/x-pack/plugins/observability/public/index.ts index cfabbaaec4afa..19468ef0e2736 100644 --- a/x-pack/plugins/observability/public/index.ts +++ b/x-pack/plugins/observability/public/index.ts @@ -36,7 +36,6 @@ export interface ConfigSchema { alertingExperience: { enabled: boolean }; rules: { enabled: boolean }; cases: { enabled: boolean }; - overviewNext: { enabled: boolean }; }; } diff --git a/x-pack/plugins/observability/public/pages/overview/index.test.tsx b/x-pack/plugins/observability/public/pages/overview/index.test.tsx deleted file mode 100644 index 45206e4440205..0000000000000 --- a/x-pack/plugins/observability/public/pages/overview/index.test.tsx +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React from 'react'; -import { shallow } from 'enzyme'; -import * as PluginContext from '../../hooks/use_plugin_context'; -import { PluginContextValue } from '../../context/plugin_context'; -import { OverviewPage } from '.'; -import { OverviewPage as OldOverviewPage } from './old_overview_page'; -import { OverviewPage as NewOverviewPage } from './overview_page'; - -describe('Overview page', () => { - it('should render the old overview page when feature flag is disabled and queryParams are empty', () => { - const pluginContext = { - config: { - unsafe: { - overviewNext: { enabled: false }, - }, - }, - }; - - jest - .spyOn(PluginContext, 'usePluginContext') - .mockReturnValue(pluginContext as PluginContextValue); - - const component = shallow(); - expect(component.find(OldOverviewPage)).toHaveLength(1); - expect(component.find(NewOverviewPage)).toHaveLength(0); - }); - - it('should render the new overview page when feature flag is enabled and queryParams are empty', () => { - const pluginContext = { - config: { - unsafe: { - overviewNext: { enabled: true }, - }, - }, - }; - - jest - .spyOn(PluginContext, 'usePluginContext') - .mockReturnValue(pluginContext as PluginContextValue); - - const component = shallow(); - expect(component.find(OldOverviewPage)).toHaveLength(0); - expect(component.find(NewOverviewPage)).toHaveLength(1); - }); - - it('should render the new overview page when feature flag is enabled and alpha param is in the url', () => { - const pluginContext = { - config: { - unsafe: { - overviewNext: { enabled: true }, - }, - }, - }; - - jest - .spyOn(PluginContext, 'usePluginContext') - .mockReturnValue(pluginContext as PluginContextValue); - - const component = shallow(); - expect(component.find(OldOverviewPage)).toHaveLength(0); - expect(component.find(NewOverviewPage)).toHaveLength(1); - }); - - it('should render the new overview page when feature flag is disabled and alpha param is in the url', () => { - const pluginContext = { - config: { - unsafe: { - overviewNext: { enabled: false }, - }, - }, - }; - - jest - .spyOn(PluginContext, 'usePluginContext') - .mockReturnValue(pluginContext as PluginContextValue); - - const component = shallow(); - expect(component.find(OldOverviewPage)).toHaveLength(0); - expect(component.find(NewOverviewPage)).toHaveLength(1); - }); -}); diff --git a/x-pack/plugins/observability/public/pages/overview/index.tsx b/x-pack/plugins/observability/public/pages/overview/index.tsx index 6b773b303031e..6733c90dd0f7a 100644 --- a/x-pack/plugins/observability/public/pages/overview/index.tsx +++ b/x-pack/plugins/observability/public/pages/overview/index.tsx @@ -4,25 +4,300 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import React from 'react'; -import { RouteParams } from '../../routes'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiSpacer, + EuiHorizontalRule, + EuiButton, + EuiFlyout, + EuiFlyoutHeader, + EuiTitle, + EuiFlyoutBody, + EuiText, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; +import React, { useMemo, useRef, useCallback, useState, useEffect } from 'react'; +import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { Storage } from '@kbn/kibana-utils-plugin/public'; +import { observabilityFeatureId } from '../../../common'; +import { useTrackPageview, useUiTracker } from '../..'; +import { EmptySections } from '../../components/app/empty_sections'; +import { ObservabilityHeaderMenu } from '../../components/app/header'; +import { NewsFeed } from '../../components/app/news_feed'; +import { Resources } from '../../components/app/resources'; +import { DatePicker } from '../../components/shared/date_picker'; +import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; +import { useFetcher } from '../../hooks/use_fetcher'; +import { useHasData } from '../../hooks/use_has_data'; import { usePluginContext } from '../../hooks/use_plugin_context'; -import { OverviewPage as OldOverviewPage } from './old_overview_page'; -import { OverviewPage as NewOverviewPage } from './overview_page'; +import { useAlertIndexNames } from '../../hooks/use_alert_index_names'; +import { RouteParams } from '../../routes'; +import { getNewsFeed } from '../../services/get_news_feed'; +import { getBucketSize } from '../../utils/get_bucket_size'; +import { getNoDataConfig } from '../../utils/no_data_config'; +import { DataSections } from './data_sections'; +import { LoadingObservability } from './loading_observability'; +import { AlertsTableTGrid } from '../alerts/containers/alerts_table_t_grid/alerts_table_t_grid'; +import { SectionContainer } from '../../components/app/section'; +import { ObservabilityAppServices } from '../../application/types'; +import { useGetUserCasesPermissions } from '../../hooks/use_get_user_cases_permissions'; +import { paths } from '../../config'; +import { useDatePickerContext } from '../../hooks/use_date_picker_context'; +import { ObservabilityStatusProgress } from '../../components/app/observability_status/observability_status_progress'; +import { ObservabilityStatus } from '../../components/app/observability_status'; +import { useGuidedSetupProgress } from '../../hooks/use_guided_setup_progress'; -export type { BucketSize } from './old_overview_page'; +export type BucketSize = ReturnType; interface Props { routeParams: RouteParams<'/overview'>; } -export function OverviewPage(props: Props) { - const { config } = usePluginContext(); - const alpha = props.routeParams.query.alpha; +const CAPABILITIES_KEYS = ['logs', 'infrastructure', 'apm', 'uptime']; - if (config.unsafe.overviewNext.enabled || alpha) { - return ; - } else { - return ; +function calculateBucketSize({ start, end }: { start?: number; end?: number }) { + if (start && end) { + return getBucketSize({ start, end, minInterval: '60s' }); } } + +const ALERT_TABLE_STATE_STORAGE_KEY = 'xpack.observability.overview.alert.tableState'; + +export function OverviewPage({ routeParams }: Props) { + const trackMetric = useUiTracker({ app: 'observability-overview' }); + useTrackPageview({ app: 'observability-overview', path: 'overview' }); + useTrackPageview({ app: 'observability-overview', path: 'overview', delay: 15000 }); + useBreadcrumbs([ + { + text: i18n.translate('xpack.observability.breadcrumbs.overviewLinkText', { + defaultMessage: 'Overview', + }), + }, + ]); + const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); + + const indexNames = useAlertIndexNames(); + const { + cases, + docLinks, + http, + application: { capabilities }, + } = useKibana().services; + + const { ObservabilityPageTemplate, config } = usePluginContext(); + const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useDatePickerContext(); + + const { data: newsFeed } = useFetcher(() => getNewsFeed({ http }), [http]); + + const { hasAnyData, isAllRequestsComplete } = useHasData(); + const refetch = useRef<() => void>(); + + const { isGuidedSetupProgressDismissed } = useGuidedSetupProgress(); + + const bucketSize = useMemo( + () => + calculateBucketSize({ + start: absoluteStart, + end: absoluteEnd, + }), + [absoluteStart, absoluteEnd] + ); + + const setRefetch = useCallback((ref) => { + refetch.current = ref; + }, []); + + const handleGuidedSetupClick = useCallback(() => { + if (isGuidedSetupProgressDismissed) { + trackMetric({ metric: 'guided_setup_view_details_after_dismiss' }); + } + + setIsFlyoutVisible(true); + }, [trackMetric, isGuidedSetupProgressDismissed]); + + const onTimeRangeRefresh = useCallback(() => { + return refetch.current && refetch.current(); + }, []); + + const CasesContext = cases.ui.getCasesContext(); + const userPermissions = useGetUserCasesPermissions(); + + useEffect(() => { + if (hasAnyData !== true) { + return; + } + + CAPABILITIES_KEYS.forEach((feature) => { + if (capabilities[feature].show === false) { + trackMetric({ + metric: `oblt_disabled_feature_${feature === 'infrastructure' ? 'metrics' : feature}`, + }); + } + }); + }, [capabilities, hasAnyData, trackMetric]); + + if (hasAnyData === undefined) { + return ; + } + + const hasData = hasAnyData === true || (isAllRequestsComplete === false ? undefined : false); + + const noDataConfig = getNoDataConfig({ + hasData, + basePath: http.basePath, + docsLink: docLinks.links.observability.guide, + }); + + const alertsLink = config.unsafe.alertingExperience.enabled + ? paths.observability.alerts + : paths.management.rules; + + return ( + + ), + } + : undefined + } + > + {hasData && ( + <> + + setIsFlyoutVisible(true)} /> + + + + + + + + + + {/* Data sections */} + {hasAnyData && } + + + + + + + + {/* Resources / What's New sections */} + + + {!!newsFeed?.items?.length && } + + + + + + + + + )} + {isFlyoutVisible && ( + setIsFlyoutVisible(false)} + aria-labelledby="statusVisualizationFlyoutTitle" + > + + +

+ +

+
+ + +

+ +

+
+
+ + + +
+ )} +
+ ); +} + +interface PageHeaderProps { + handleGuidedSetupClick: () => void; + onTimeRangeRefresh: () => void; +} + +function PageHeader({ handleGuidedSetupClick, onTimeRangeRefresh }: PageHeaderProps) { + const { relativeStart, relativeEnd, refreshInterval, refreshPaused } = useDatePickerContext(); + return ( + + + +

{overviewPageTitle}

+
+
+ + + + + + + + +
+ ); +} + +const overviewPageTitle = i18n.translate('xpack.observability.overview.pageTitle', { + defaultMessage: 'Overview', +}); diff --git a/x-pack/plugins/observability/public/pages/overview/old_overview_page.tsx b/x-pack/plugins/observability/public/pages/overview/old_overview_page.tsx deleted file mode 100644 index 0c95362b15dbb..0000000000000 --- a/x-pack/plugins/observability/public/pages/overview/old_overview_page.tsx +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - EuiFlexGroup, - EuiFlexItem, - EuiSpacer, - EuiHorizontalRule, - EuiButton, - EuiFlyout, - EuiFlyoutHeader, - EuiTitle, - EuiFlyoutBody, - EuiText, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n-react'; -import React, { useMemo, useRef, useCallback, useState, useEffect } from 'react'; -import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { observabilityFeatureId } from '../../../common'; -import { useTrackPageview, useUiTracker } from '../..'; -import { EmptySections } from '../../components/app/empty_sections'; -import { ObservabilityHeaderMenu } from '../../components/app/header'; -import { NewsFeed } from '../../components/app/news_feed'; -import { Resources } from '../../components/app/resources'; -import { DatePicker } from '../../components/shared/date_picker'; -import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; -import { useFetcher } from '../../hooks/use_fetcher'; -import { useHasData } from '../../hooks/use_has_data'; -import { usePluginContext } from '../../hooks/use_plugin_context'; -import { useAlertIndexNames } from '../../hooks/use_alert_index_names'; -import { RouteParams } from '../../routes'; -import { getNewsFeed } from '../../services/get_news_feed'; -import { getBucketSize } from '../../utils/get_bucket_size'; -import { getNoDataConfig } from '../../utils/no_data_config'; -import { DataSections } from './data_sections'; -import { LoadingObservability } from './loading_observability'; -import { AlertsTableTGrid } from '../alerts/containers/alerts_table_t_grid/alerts_table_t_grid'; -import { SectionContainer } from '../../components/app/section'; -import { ObservabilityAppServices } from '../../application/types'; -import { useGetUserCasesPermissions } from '../../hooks/use_get_user_cases_permissions'; -import { paths } from '../../config'; -import { useDatePickerContext } from '../../hooks/use_date_picker_context'; -import { ObservabilityStatusProgress } from '../../components/app/observability_status/observability_status_progress'; -import { ObservabilityStatus } from '../../components/app/observability_status'; -import { useGuidedSetupProgress } from '../../hooks/use_guided_setup_progress'; -interface Props { - routeParams: RouteParams<'/overview'>; -} -export type BucketSize = ReturnType; - -const CAPABILITIES_KEYS = ['logs', 'infrastructure', 'apm', 'uptime']; - -function calculateBucketSize({ start, end }: { start?: number; end?: number }) { - if (start && end) { - return getBucketSize({ start, end, minInterval: '60s' }); - } -} - -const ALERT_TABLE_STATE_STORAGE_KEY = 'xpack.observability.overview.alert.tableState'; - -export function OverviewPage({ routeParams }: Props) { - const trackMetric = useUiTracker({ app: 'observability-overview' }); - useTrackPageview({ app: 'observability-overview', path: 'overview' }); - useTrackPageview({ app: 'observability-overview', path: 'overview', delay: 15000 }); - useBreadcrumbs([ - { - text: i18n.translate('xpack.observability.breadcrumbs.overviewLinkText', { - defaultMessage: 'Overview', - }), - }, - ]); - const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); - - const indexNames = useAlertIndexNames(); - const { - cases, - docLinks, - http, - application: { capabilities }, - } = useKibana().services; - - const { ObservabilityPageTemplate, config } = usePluginContext(); - const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useDatePickerContext(); - - const { data: newsFeed } = useFetcher(() => getNewsFeed({ http }), [http]); - - const { hasAnyData, isAllRequestsComplete } = useHasData(); - const refetch = useRef<() => void>(); - - const { isGuidedSetupProgressDismissed } = useGuidedSetupProgress(); - - const bucketSize = useMemo( - () => - calculateBucketSize({ - start: absoluteStart, - end: absoluteEnd, - }), - [absoluteStart, absoluteEnd] - ); - - const setRefetch = useCallback((ref) => { - refetch.current = ref; - }, []); - - const handleGuidedSetupClick = useCallback(() => { - if (isGuidedSetupProgressDismissed) { - trackMetric({ metric: 'guided_setup_view_details_after_dismiss' }); - } - - setIsFlyoutVisible(true); - }, [trackMetric, isGuidedSetupProgressDismissed]); - - const onTimeRangeRefresh = useCallback(() => { - return refetch.current && refetch.current(); - }, []); - - const CasesContext = cases.ui.getCasesContext(); - const userPermissions = useGetUserCasesPermissions(); - - useEffect(() => { - if (hasAnyData !== true) { - return; - } - - CAPABILITIES_KEYS.forEach((feature) => { - if (capabilities[feature].show === false) { - trackMetric({ - metric: `oblt_disabled_feature_${feature === 'infrastructure' ? 'metrics' : feature}`, - }); - } - }); - }, [capabilities, hasAnyData, trackMetric]); - - if (hasAnyData === undefined) { - return ; - } - - const hasData = hasAnyData === true || (isAllRequestsComplete === false ? undefined : false); - - const noDataConfig = getNoDataConfig({ - hasData, - basePath: http.basePath, - docsLink: docLinks.links.observability.guide, - }); - - const alertsLink = config.unsafe.alertingExperience.enabled - ? paths.observability.alerts - : paths.management.rules; - - return ( - - ), - } - : undefined - } - > - {hasData && ( - <> - - setIsFlyoutVisible(true)} /> - - - - - - - - - - {/* Data sections */} - {hasAnyData && } - - - - - - - - {/* Resources / What's New sections */} - - - {!!newsFeed?.items?.length && } - - - - - - - - - )} - {isFlyoutVisible && ( - setIsFlyoutVisible(false)} - aria-labelledby="statusVisualizationFlyoutTitle" - > - - -

- -

-
- - -

- -

-
-
- - - -
- )} -
- ); -} - -interface PageHeaderProps { - handleGuidedSetupClick: () => void; - onTimeRangeRefresh: () => void; -} - -function PageHeader({ handleGuidedSetupClick, onTimeRangeRefresh }: PageHeaderProps) { - const { relativeStart, relativeEnd, refreshInterval, refreshPaused } = useDatePickerContext(); - return ( - - - -

{overviewPageTitle}

-
-
- - - - - - - - -
- ); -} - -const overviewPageTitle = i18n.translate('xpack.observability.overview.pageTitle', { - defaultMessage: 'Overview', -}); diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index b975e45ac06df..95d263168f82e 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -85,7 +85,6 @@ const withCore = makeDecorator({ unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true }, - overviewNext: { enabled: false }, rules: { enabled: true }, }, }, diff --git a/x-pack/plugins/observability/public/pages/overview/overview_page.tsx b/x-pack/plugins/observability/public/pages/overview/overview_page.tsx deleted file mode 100644 index 7f81f71cf6683..0000000000000 --- a/x-pack/plugins/observability/public/pages/overview/overview_page.tsx +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { i18n } from '@kbn/i18n'; -import React, { useState } from 'react'; -import { EuiButton, EuiFlyout, EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui'; -import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { useTrackPageview } from '../..'; -import { DatePicker } from '../../components/shared/date_picker'; -import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; -import { useHasData } from '../../hooks/use_has_data'; -import { usePluginContext } from '../../hooks/use_plugin_context'; -import { useDatePickerContext } from '../../hooks/use_date_picker_context'; -import { RouteParams } from '../../routes'; -import { getNoDataConfig } from '../../utils/no_data_config'; -import { LoadingObservability } from './loading_observability'; -import { ObservabilityStatus } from '../../components/app/observability_status'; -import { ObservabilityAppServices } from '../../application/types'; - -interface Props { - routeParams: RouteParams<'/overview'>; -} - -export function OverviewPage({ routeParams }: Props) { - useTrackPageview({ app: 'observability-overview', path: 'overview' }); - useTrackPageview({ app: 'observability-overview', path: 'overview', delay: 15000 }); - useBreadcrumbs([ - { - text: i18n.translate('xpack.observability.breadcrumbs.overviewLinkText', { - defaultMessage: 'Overview', - }), - }, - ]); - - const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); - - const { docLinks, http } = useKibana().services; - const { ObservabilityPageTemplate } = usePluginContext(); - - const { relativeStart, relativeEnd } = useDatePickerContext(); - - const relativeTime = { start: relativeStart, end: relativeEnd }; - - const { hasAnyData, isAllRequestsComplete } = useHasData(); - - if (hasAnyData === undefined) { - return ; - } - - const hasData = hasAnyData === true || (isAllRequestsComplete === false ? undefined : false); - - const noDataConfig = getNoDataConfig({ - hasData, - basePath: http.basePath, - docsLink: docLinks.links.observability.guide, - }); - - const { refreshInterval = 10000, refreshPaused = true } = routeParams.query; - - return ( - , - ], - } - : undefined - } - > - {hasData && ( - <> - setIsFlyoutVisible(true)}>Show observability status - {isFlyoutVisible && ( - setIsFlyoutVisible(false)} - aria-labelledby="flyout-id" - > - - -

Status

-
-
- - - -
- )} - - )} -
- ); -} - -const overviewPageTitle = i18n.translate('xpack.observability.overview.pageTitle', { - defaultMessage: 'Overview', -}); diff --git a/x-pack/plugins/observability/public/utils/test_helper.tsx b/x-pack/plugins/observability/public/utils/test_helper.tsx index d5607b5ee8b48..bdbb9dd71164a 100644 --- a/x-pack/plugins/observability/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability/public/utils/test_helper.tsx @@ -26,7 +26,6 @@ const config = { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true }, - overviewNext: { enabled: false }, rules: { enabled: true }, }, }; diff --git a/x-pack/plugins/observability/server/index.ts b/x-pack/plugins/observability/server/index.ts index 39537a67a8cbf..ab2a566fc6b85 100644 --- a/x-pack/plugins/observability/server/index.ts +++ b/x-pack/plugins/observability/server/index.ts @@ -35,7 +35,6 @@ export const config: PluginConfigDescriptor = { alertingExperience: schema.object({ enabled: schema.boolean({ defaultValue: true }) }), rules: schema.object({ enabled: schema.boolean({ defaultValue: true }) }), cases: schema.object({ enabled: schema.boolean({ defaultValue: true }) }), - overviewNext: schema.object({ enabled: schema.boolean({ defaultValue: false }) }), }), }), }; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index cb59649d7710c..a259dc0d21e96 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -21658,12 +21658,6 @@ "xpack.observability.noDataConfig.beatsCard.title": "Ajouter des intégrations", "xpack.observability.noDataConfig.solutionName": "Observabilité", "xpack.observability.notAvailable": "S. O.", - "xpack.observability.overview.alert.allTypes": "Tous les types", - "xpack.observability.overview.alert.appLink": "Afficher toutes les alertes", - "xpack.observability.overview.alert.errorMessage": "Une erreur s’est produite lors du chargement des données d’alerte. Réessayez plus tard.", - "xpack.observability.overview.alert.errorTitle": "Impossible de charger les données d’alerte.", - "xpack.observability.overview.alerts.appLink": "Afficher les alertes", - "xpack.observability.overview.alerts.muted": "Muet", "xpack.observability.overview.alerts.title": "Alertes", "xpack.observability.overview.apm.appLink": "Afficher l’inventaire des services", "xpack.observability.overview.apm.services": "Services", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index e62c4f671e4f1..161eb996dcd8c 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -21815,12 +21815,6 @@ "xpack.observability.noDataConfig.beatsCard.title": "統合の追加", "xpack.observability.noDataConfig.solutionName": "Observability", "xpack.observability.notAvailable": "N/A", - "xpack.observability.overview.alert.allTypes": "すべてのタイプ", - "xpack.observability.overview.alert.appLink": "すべてのアラートを表示", - "xpack.observability.overview.alert.errorMessage": "アラートデータの読み込みエラーが発生しました。しばらくたってから再試行してください。", - "xpack.observability.overview.alert.errorTitle": "アラートデータを読み込めませんでした", - "xpack.observability.overview.alerts.appLink": "アラートを表示", - "xpack.observability.overview.alerts.muted": "ミュート", "xpack.observability.overview.alerts.title": "アラート", "xpack.observability.overview.apm.appLink": "サービスインベントリを表示", "xpack.observability.overview.apm.services": "サービス", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 75c0098fa1f77..7140c9b78accc 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -21847,12 +21847,6 @@ "xpack.observability.noDataConfig.beatsCard.title": "添加集成", "xpack.observability.noDataConfig.solutionName": "Observability", "xpack.observability.notAvailable": "不可用", - "xpack.observability.overview.alert.allTypes": "所有类型", - "xpack.observability.overview.alert.appLink": "显示所有告警", - "xpack.observability.overview.alert.errorMessage": "加载告警数据时出现错误。请稍后重试。", - "xpack.observability.overview.alert.errorTitle": "我们无法加载告警数据", - "xpack.observability.overview.alerts.appLink": "显示告警", - "xpack.observability.overview.alerts.muted": "已静音", "xpack.observability.overview.alerts.title": "告警", "xpack.observability.overview.apm.appLink": "显示服务库存", "xpack.observability.overview.apm.services": "服务", From 0b988f3dd2cd34ad04c228c2dfbbc83ca8c6690a Mon Sep 17 00:00:00 2001 From: Tomasz Ciecierski Date: Fri, 29 Apr 2022 09:06:51 +0200 Subject: [PATCH 03/89] [Osquery] Add to timeline button (#128596) --- .../cypress/integration/all/alerts.spec.ts | 14 ++-- .../osquery/cypress/tasks/live_query.ts | 5 +- .../public/live_queries/form/index.tsx | 10 +-- .../osquery/public/live_queries/index.tsx | 6 +- .../osquery/public/results/results_table.tsx | 32 +++++++-- .../public/routes/saved_queries/edit/tabs.tsx | 8 +-- .../saved_queries/saved_query_flyout.tsx | 4 +- .../osquery_action/index.tsx | 14 ++-- .../osquery_action/osquery_action.test.tsx | 34 +++------- .../components/osquery/osquery_flyout.tsx | 67 +++++++++++++++---- .../osquery/osquery_flyout_header.tsx | 30 --------- 11 files changed, 128 insertions(+), 96 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout_header.tsx diff --git a/x-pack/plugins/osquery/cypress/integration/all/alerts.spec.ts b/x-pack/plugins/osquery/cypress/integration/all/alerts.spec.ts index 7813a94e2bfe3..21d3584b9fc46 100644 --- a/x-pack/plugins/osquery/cypress/integration/all/alerts.spec.ts +++ b/x-pack/plugins/osquery/cypress/integration/all/alerts.spec.ts @@ -37,6 +37,7 @@ describe('Alert Event Details', () => { it('should be able to run live query', () => { const PACK_NAME = 'testpack'; const RULE_NAME = 'Test-rule'; + const TIMELINE_NAME = 'Untitled timeline'; navigateTo('/app/osquery/packs'); preparePack(PACK_NAME); findAndClickButton('Edit'); @@ -57,6 +58,7 @@ describe('Alert Event Details', () => { cy.getBySel('ruleSwitch').click(); cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'true'); cy.visit('/app/security/alerts'); + cy.wait(500); cy.getBySel('expand-event').first().click(); cy.getBySel('take-action-dropdown-btn').click(); cy.getBySel('osquery-action-item').click(); @@ -64,12 +66,16 @@ describe('Alert Event Details', () => { inputQuery('select * from uptime;'); submitQuery(); checkResults(); - + cy.contains('Save for later').click(); + cy.contains('Save query'); + cy.get('.euiButtonEmpty--flushLeft').contains('Cancel').click(); + cy.getBySel('add-to-timeline').first().click(); + cy.getBySel('globalToastList').contains('Added'); cy.getBySel(RESULTS_TABLE).within(() => { cy.getBySel(RESULTS_TABLE_BUTTON).should('not.exist'); }); - cy.contains('Save for later').click(); - cy.contains('Save query'); - cy.contains(/^Save$/); + cy.contains('Cancel').click(); + cy.contains(TIMELINE_NAME).click(); + cy.getBySel('draggableWrapperKeyboardHandler').contains('action_id: "'); }); }); diff --git a/x-pack/plugins/osquery/cypress/tasks/live_query.ts b/x-pack/plugins/osquery/cypress/tasks/live_query.ts index b3006a3d1074a..7bdc1d3fc3cf3 100644 --- a/x-pack/plugins/osquery/cypress/tasks/live_query.ts +++ b/x-pack/plugins/osquery/cypress/tasks/live_query.ts @@ -11,7 +11,10 @@ export const DEFAULT_QUERY = 'select * from processes;'; export const BIG_QUERY = 'select * from processes, users;'; export const selectAllAgents = () => { - cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }).type('All agents'); + cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }) + .find('input') + .should('not.be.disabled'); + cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }).click(); cy.react('EuiFilterSelectItem').contains('All agents').should('exist'); cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }).type( '{downArrow}{enter}{esc}' diff --git a/x-pack/plugins/osquery/public/live_queries/form/index.tsx b/x-pack/plugins/osquery/public/live_queries/form/index.tsx index e63ad38aaa695..43940c2982161 100644 --- a/x-pack/plugins/osquery/public/live_queries/form/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/form/index.tsx @@ -62,7 +62,7 @@ interface LiveQueryFormProps { ecsMappingField?: boolean; formType?: FormType; enabled?: boolean; - isExternal?: true; + addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } const LiveQueryFormComponent: React.FC = ({ @@ -73,7 +73,7 @@ const LiveQueryFormComponent: React.FC = ({ ecsMappingField = true, formType = 'steps', enabled = true, - isExternal, + addToTimeline, }) => { const ecsFieldRef = useRef(); const permissions = useKibana().services.application.capabilities.osquery; @@ -393,10 +393,10 @@ const LiveQueryFormComponent: React.FC = ({ actionId={actionId} endDate={data?.actions[0].expiration} agentIds={agentIds} - isExternal={isExternal} + addToTimeline={addToTimeline} /> ) : null, - [actionId, agentIds, data?.actions, isExternal] + [actionId, agentIds, data?.actions, addToTimeline] ); const formSteps: EuiContainedStepProps[] = useMemo( @@ -467,7 +467,7 @@ const LiveQueryFormComponent: React.FC = ({ {showSavedQueryFlyout ? ( diff --git a/x-pack/plugins/osquery/public/live_queries/index.tsx b/x-pack/plugins/osquery/public/live_queries/index.tsx index 56cac9cdf5ec7..b002f9e391a8a 100644 --- a/x-pack/plugins/osquery/public/live_queries/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/index.tsx @@ -28,7 +28,7 @@ interface LiveQueryProps { ecsMappingField?: boolean; enabled?: boolean; formType?: 'steps' | 'simple'; - isExternal?: true; + addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } const LiveQueryComponent: React.FC = ({ @@ -45,7 +45,7 @@ const LiveQueryComponent: React.FC = ({ ecsMappingField, formType, enabled, - isExternal, + addToTimeline, }) => { const { data: hasActionResultsPrivileges, isLoading } = useActionResultsPrivileges(); @@ -115,7 +115,7 @@ const LiveQueryComponent: React.FC = ({ onSuccess={onSuccess} formType={formType} enabled={enabled} - isExternal={isExternal} + addToTimeline={addToTimeline} /> ); }; diff --git a/x-pack/plugins/osquery/public/results/results_table.tsx b/x-pack/plugins/osquery/public/results/results_table.tsx index 9b3dc144a7e3f..c5017903564b1 100644 --- a/x-pack/plugins/osquery/public/results/results_table.tsx +++ b/x-pack/plugins/osquery/public/results/results_table.tsx @@ -18,6 +18,8 @@ import { EuiProgress, EuiSpacer, EuiIconTip, + EuiDataGridCellValueElementProps, + EuiDataGridControlColumn, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -46,7 +48,7 @@ interface ResultsTableComponentProps { agentIds?: string[]; endDate?: string; startDate?: string; - isExternal?: true; + addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } const ResultsTableComponent: React.FC = ({ @@ -54,7 +56,7 @@ const ResultsTableComponent: React.FC = ({ agentIds, startDate, endDate, - isExternal, + addToTimeline, }) => { const [isLive, setIsLive] = useState(true); const { data: hasActionResultsPrivileges } = useActionResultsPrivileges(); @@ -309,10 +311,30 @@ const ResultsTableComponent: React.FC = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [allResultsData?.columns.length, ecsMappingColumns, getHeaderDisplay]); + const leadingControlColumns: EuiDataGridControlColumn[] = useMemo(() => { + const data = allResultsData?.edges; + if (addToTimeline && data) { + return [ + { + id: 'timeline', + width: 38, + headerCellRender: () => null, + rowCellRender: (actionProps: EuiDataGridCellValueElementProps) => { + const eventId = data[actionProps.rowIndex]._id; + + return addToTimeline({ query: ['_id', eventId], isIcon: true }); + }, + }, + ]; + } + + return []; + }, [addToTimeline, allResultsData?.edges]); + const toolbarVisibility = useMemo( () => ({ showDisplaySelector: false, - showFullScreenSelector: !isExternal, + showFullScreenSelector: !addToTimeline, additionalControls: ( <> = ({ endDate={endDate} startDate={startDate} /> + {addToTimeline && addToTimeline({ query: ['action_id', actionId] })} ), }), - [actionId, endDate, startDate, isExternal] + [actionId, addToTimeline, endDate, startDate] ); useEffect( @@ -380,6 +403,7 @@ const ResultsTableComponent: React.FC = ({ columnVisibility={columnVisibility} rowCount={allResultsData?.totalCount ?? 0} renderCellValue={renderCellValue} + leadingControlColumns={leadingControlColumns} sorting={tableSorting} pagination={tablePagination} height="500px" diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx index 0956dc6528a7f..76e8bfd9dd029 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx @@ -17,7 +17,7 @@ interface ResultTabsProps { agentIds?: string[]; startDate?: string; endDate?: string; - isExternal?: true; + addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } const ResultTabsComponent: React.FC = ({ @@ -25,7 +25,7 @@ const ResultTabsComponent: React.FC = ({ agentIds, endDate, startDate, - isExternal, + addToTimeline, }) => { const tabs = useMemo( () => [ @@ -40,7 +40,7 @@ const ResultTabsComponent: React.FC = ({ agentIds={agentIds} startDate={startDate} endDate={endDate} - isExternal={isExternal} + addToTimeline={addToTimeline} /> ), @@ -60,7 +60,7 @@ const ResultTabsComponent: React.FC = ({ ), }, ], - [actionId, agentIds, endDate, startDate, isExternal] + [actionId, agentIds, endDate, startDate, addToTimeline] ); return ( diff --git a/x-pack/plugins/osquery/public/saved_queries/saved_query_flyout.tsx b/x-pack/plugins/osquery/public/saved_queries/saved_query_flyout.tsx index 899c27a1ef8fd..579e25b5e37a1 100644 --- a/x-pack/plugins/osquery/public/saved_queries/saved_query_flyout.tsx +++ b/x-pack/plugins/osquery/public/saved_queries/saved_query_flyout.tsx @@ -28,7 +28,7 @@ import { useCreateSavedQuery } from './use_create_saved_query'; interface AddQueryFlyoutProps { defaultValue: unknown; onClose: () => void; - isExternal?: true; + isExternal?: boolean; } const additionalZIndexStyle = { style: 'z-index: 6000' }; @@ -60,7 +60,7 @@ const SavedQueryFlyoutComponent: React.FC = ({ ownFocus onClose={onClose} aria-labelledby="flyoutTitle" - maskProps={isExternal && additionalZIndexStyle} // For an edge case to display above the alerts flyout + maskProps={isExternal ? additionalZIndexStyle : undefined} // For an edge case to display above the alerts flyout > diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx index 5fbc6caedcd15..51dba40f8114e 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx @@ -26,10 +26,14 @@ import { useIsOsqueryAvailable } from './use_is_osquery_available'; interface OsqueryActionProps { agentId?: string; formType: 'steps' | 'simple'; - isExternal?: true; + addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } -const OsqueryActionComponent: React.FC = ({ agentId, formType = 'simple' }) => { +const OsqueryActionComponent: React.FC = ({ + agentId, + formType = 'simple', + addToTimeline, +}) => { const permissions = useKibana().services.application.capabilities.osquery; const emptyPrompt = useMemo( @@ -99,18 +103,18 @@ const OsqueryActionComponent: React.FC = ({ agentId, formTyp ); } - return ; + return ; }; export const OsqueryAction = React.memo(OsqueryActionComponent); // @ts-expect-error update types -const OsqueryActionWrapperComponent = ({ services, agentId, formType, isExternal }) => ( +const OsqueryActionWrapperComponent = ({ services, agentId, formType, addToTimeline }) => ( - + diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_action/osquery_action.test.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_action/osquery_action.test.tsx index f6128642ba645..4c9214ca3ea14 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_action/osquery_action.test.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_action/osquery_action.test.tsx @@ -78,35 +78,27 @@ describe('Osquery Action', () => { spyOsquery(); mockKibana(); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(EMPTY_PROMPT)).toBeInTheDocument(); }); it('should return empty prompt when no agentId', async () => { spyOsquery(); mockKibana(); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(EMPTY_PROMPT)).toBeInTheDocument(); }); it('should return permission denied when agentFetched and agentData available', async () => { spyOsquery({ agentData: {} }); mockKibana(); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(PERMISSION_DENIED)).toBeInTheDocument(); }); it('should return agent status error when permissions are ok and agent status is wrong', async () => { spyOsquery({ agentData: {} }); mockKibana(properPermissions); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(AGENT_STATUS_ERROR)).toBeInTheDocument(); }); it('should return permission denied if just one permission (runSavedQueries) is available', async () => { @@ -116,9 +108,7 @@ describe('Osquery Action', () => { runSavedQueries: true, }, }); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(PERMISSION_DENIED)).toBeInTheDocument(); }); it('should return permission denied if just one permission (readSavedQueries) is available', async () => { @@ -128,9 +118,7 @@ describe('Osquery Action', () => { readSavedQueries: true, }, }); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(PERMISSION_DENIED)).toBeInTheDocument(); }); it('should return permission denied if no writeLiveQueries', async () => { @@ -140,9 +128,7 @@ describe('Osquery Action', () => { writeLiveQueries: true, }, }); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(AGENT_STATUS_ERROR)).toBeInTheDocument(); }); it('should return not available prompt if osquery is not available', async () => { @@ -152,9 +138,7 @@ describe('Osquery Action', () => { writeLiveQueries: true, }, }); - const { getByText } = renderWithContext( - - ); + const { getByText } = renderWithContext(); expect(getByText(NOT_AVAILABLE)).toBeInTheDocument(); }); it('should not return any errors when all data is ok', async () => { @@ -162,7 +146,7 @@ describe('Osquery Action', () => { mockKibana(properPermissions); const { queryByText } = renderWithContext( - + ); expect(queryByText(EMPTY_PROMPT)).not.toBeInTheDocument(); expect(queryByText(PERMISSION_DENIED)).not.toBeInTheDocument(); diff --git a/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout.tsx b/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout.tsx index 3262fc36abf75..f19601649a2f3 100644 --- a/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout.tsx @@ -5,13 +5,20 @@ * 2.0. */ -import React from 'react'; +import React, { useCallback } from 'react'; import styled from 'styled-components'; -import { EuiFlyout, EuiFlyoutFooter, EuiFlyoutBody, EuiFlyoutHeader } from '@elastic/eui'; +import { + EuiFlyout, + EuiFlyoutFooter, + EuiFlyoutBody, + EuiFlyoutHeader, + EuiButtonEmpty, + EuiTitle, +} from '@elastic/eui'; import { useKibana } from '../../../common/lib/kibana'; import { OsqueryEventDetailsFooter } from './osquery_flyout_footer'; -import { OsqueryEventDetailsHeader } from './osquery_flyout_header'; import { ACTION_OSQUERY } from './translations'; +import { DataProvider } from '../../../timelines/components/timeline/data_providers/data_provider'; const OsqueryActionWrapper = styled.div` padding: 8px; @@ -22,11 +29,47 @@ export interface OsqueryFlyoutProps { onClose: () => void; } -export const OsqueryFlyout: React.FC = ({ agentId, onClose }) => { +const TimelineComponent = React.memo((props) => { + return ; +}); +TimelineComponent.displayName = 'TimelineComponent'; + +export const OsqueryFlyoutComponent: React.FC = ({ agentId, onClose }) => { const { - services: { osquery }, + services: { osquery, timelines }, } = useKibana(); + const { getAddToTimelineButton } = timelines.getHoverActions(); + + const handleAddToTimeline = useCallback( + (payload: { query: [string, string]; isIcon?: true }) => { + const { + query: [field, value], + isIcon, + } = payload; + const providerA: DataProvider = { + and: [], + enabled: true, + excluded: false, + id: value, + kqlQuery: '', + name: value, + queryMatch: { + field, + value, + operator: ':', + }, + }; + + return getAddToTimelineButton({ + dataProvider: providerA, + field: value, + ownFocus: false, + ...(isIcon ? { showTooltip: true } : { Component: TimelineComponent }), + }); + }, + [getAddToTimelineButton] + ); // @ts-expect-error const { OsqueryAction } = osquery; return ( @@ -36,16 +79,14 @@ export const OsqueryFlyout: React.FC = ({ agentId, onClose } size="m" onClose={onClose} > - - {ACTION_OSQUERY}} - handleClick={onClose} - data-test-subj="flyout-header-osquery" - /> + + +

{ACTION_OSQUERY}

+
- + @@ -55,4 +96,4 @@ export const OsqueryFlyout: React.FC = ({ agentId, onClose } ); }; -OsqueryFlyout.displayName = 'OsqueryFlyout'; +export const OsqueryFlyout = React.memo(OsqueryFlyoutComponent); diff --git a/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout_header.tsx b/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout_header.tsx deleted file mode 100644 index 7a0f7f15f3e74..0000000000000 --- a/x-pack/plugins/security_solution/public/detections/components/osquery/osquery_flyout_header.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { EuiButtonEmpty, EuiText, EuiTitle } from '@elastic/eui'; -import { BACK_TO_ALERT_DETAILS } from './translations'; - -interface IProps { - primaryText: React.ReactElement; - handleClick: () => void; -} - -const OsqueryEventDetailsHeaderComponent: React.FC = ({ primaryText, handleClick }) => { - return ( - <> - - -

{BACK_TO_ALERT_DETAILS}

-
-
- {primaryText} - - ); -}; - -export const OsqueryEventDetailsHeader = React.memo(OsqueryEventDetailsHeaderComponent); From 50bd2cc4f5a38173245c1b6278aebe63bcb13928 Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Fri, 29 Apr 2022 09:49:27 +0200 Subject: [PATCH 04/89] [Actions Triggers UI] Register initial alerts table configuration registry inside security_solution (#130881) Co-authored-by: Xavier Mouligneau --- .../register_alerts_table_configuration.tsx | 28 +++++++++++++++++++ .../security_solution/public/plugin.tsx | 17 +++++++++++ .../triggers_actions_ui/public/index.ts | 1 + 3 files changed, 46 insertions(+) create mode 100644 x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx diff --git a/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx b/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx new file mode 100644 index 0000000000000..1771654780fea --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Storage } from '@kbn/kibana-utils-plugin/public'; +import { AlertsTableConfigurationRegistryContract } from '@kbn/triggers-actions-ui-plugin/public'; + +import { APP_ID } from '../../../../common/constants'; +import { getTimelinesInStorageByIds } from '../../../timelines/containers/local_storage'; +import { TimelineId } from '../../../../common/types'; +import { columns } from '../../../detections/configurations/security_solution_detections'; + +const registerAlertsTableConfiguration = ( + registry: AlertsTableConfigurationRegistryContract, + storage: Storage +) => { + const timelineStorage = getTimelinesInStorageByIds(storage, [TimelineId.detectionsPage]); + const alertColumns = timelineStorage?.[TimelineId.detectionsPage]?.columns ?? columns; + registry.register({ + id: APP_ID, + columns: alertColumns, + }); +}; + +export { registerAlertsTableConfiguration }; diff --git a/x-pack/plugins/security_solution/public/plugin.tsx b/x-pack/plugins/security_solution/public/plugin.tsx index bea6ace83cf23..343259d88cb76 100644 --- a/x-pack/plugins/security_solution/public/plugin.tsx +++ b/x-pack/plugins/security_solution/public/plugin.tsx @@ -142,6 +142,12 @@ export class Plugin implements IPlugin { + // required to show the alert table inside cases + const { alertsTableConfigurationRegistry } = plugins.triggersActionsUi; + const { registerAlertsTableConfiguration } = + await this.lazyRegisterAlertsTableConfiguration(); + registerAlertsTableConfiguration(alertsTableConfigurationRegistry, this.storage); + const [coreStart, startPlugins] = await core.getStartServices(); const subPlugins = await this.startSubPlugins(this.storage, coreStart, startPlugins); const { renderApp } = await this.lazyApplicationDependencies(); @@ -283,6 +289,17 @@ export class Plugin implements IPlugin Date: Fri, 29 Apr 2022 14:11:31 +0500 Subject: [PATCH 05/89] [Console] Fix linebreaks (\r\n) mis-applied from history (#131037) * Apply formatting request data from history * Address PR comment regarding second argument passed to formatRequestBodyDoc Co-authored-by: Muhammad Ibragimov Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../containers/console_history/history_viewer.tsx | 5 ++++- .../restore_request_from_history.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/console/public/application/containers/console_history/history_viewer.tsx b/src/plugins/console/public/application/containers/console_history/history_viewer.tsx index 605f9a254f228..11f4b0a99a993 100644 --- a/src/plugins/console/public/application/containers/console_history/history_viewer.tsx +++ b/src/plugins/console/public/application/containers/console_history/history_viewer.tsx @@ -17,6 +17,7 @@ import * as InputMode from '../../models/legacy_core_editor/mode/input'; const inputMode = new InputMode.Mode(); import * as editor from '../../models/legacy_core_editor'; import { applyCurrentSettings } from '../editor/legacy/console_editor/apply_editor_settings'; +import { formatRequestBodyDoc } from '../../../lib/utils'; interface Props { settings: DevToolsSettings; @@ -41,7 +42,9 @@ export function HistoryViewer({ settings, req }: Props) { if (viewerRef.current) { const { current: viewer } = viewerRef; if (req) { - const s = req.method + ' ' + req.endpoint + '\n' + (req.data || ''); + const indent = true; + const formattedData = req.data ? formatRequestBodyDoc([req.data], indent).data : ''; + const s = req.method + ' ' + req.endpoint + '\n' + formattedData; viewer.update(s, inputMode); viewer.clearSelection(); } else { diff --git a/src/plugins/console/public/application/hooks/use_restore_request_from_history/restore_request_from_history.ts b/src/plugins/console/public/application/hooks/use_restore_request_from_history/restore_request_from_history.ts index 85c9cf6b9f014..ca8a118e767b6 100644 --- a/src/plugins/console/public/application/hooks/use_restore_request_from_history/restore_request_from_history.ts +++ b/src/plugins/console/public/application/hooks/use_restore_request_from_history/restore_request_from_history.ts @@ -9,6 +9,7 @@ import RowParser from '../../../lib/row_parser'; import { ESRequest } from '../../../types'; import { SenseEditor } from '../../models/sense_editor'; +import { formatRequestBodyDoc } from '../../../lib/utils'; export function restoreRequestFromHistory(editor: SenseEditor, req: ESRequest) { const coreEditor = editor.getCoreEditor(); @@ -32,7 +33,9 @@ export function restoreRequestFromHistory(editor: SenseEditor, req: ESRequest) { let s = prefix + req.method + ' ' + req.endpoint; if (req.data) { - s += '\n' + req.data; + const indent = true; + const formattedData = formatRequestBodyDoc([req.data], indent); + s += '\n' + formattedData.data; } s += suffix; From de9afdf3aa31fdae643b704fd86092c2b230a5f1 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 29 Apr 2022 12:21:13 +0200 Subject: [PATCH 06/89] make series agg work after math (#130867) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../response_processors/series/math.js | 3 ++- .../response_processors/series/math.test.js | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js index 46dde6653647d..1d6db3704b95b 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.js @@ -7,6 +7,7 @@ */ import { convertIntervalToUnit } from '../../helpers/unit_to_seconds'; +import { getLastMetric } from '../../helpers/get_last_metric'; import { SERIES_SEPARATOR } from '../../../../../common/constants'; const percentileValueMatch = /\[([0-9\.]+)\]$/; @@ -16,7 +17,7 @@ import { evaluate } from '@kbn/tinymath'; export function mathAgg(resp, panel, series, meta, extractFields) { return (next) => async (results) => { - const mathMetric = last(series.metrics); + const mathMetric = getLastMetric(series); if (mathMetric.type !== 'math') return next(results); // Filter the results down to only the ones that match the series.id. Sometimes // there will be data from other series mixed in. diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js index 14c66866d323a..777929037f04f 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/response_processors/series/math.test.js @@ -108,6 +108,33 @@ describe('math(resp, panel, series)', () => { }); }); + test('handles math even if there is a series agg', async () => { + series.metrics.push({ + id: 'myid', + type: 'series_agg', + function: 'sum', + }); + const next = await mathAgg(resp, panel, series)((results) => results); + const results = await stdMetric(resp, panel, series)(next)([]); + + expect(results).toHaveLength(1); + + expect(results[0]).toEqual({ + id: 'test╰┄►example-01', + label: 'example-01', + color: 'rgb(255, 0, 0)', + stack: false, + seriesId: 'test', + lines: { show: true, fill: 0, lineWidth: 1, steps: false }, + points: { show: true, radius: 1, lineWidth: 1 }, + bars: { fill: 0, lineWidth: 1, show: false }, + data: [ + [1, 2], + [2, 1], + ], + }); + }); + test('turns division by zero into null values', async () => { resp.aggregations.test.buckets[0].timeseries.buckets[0].mincpu = 0; const next = await mathAgg(resp, panel, series)((results) => results); From 95cef18222834e87b4e92f6bded401385270fcb5 Mon Sep 17 00:00:00 2001 From: Milton Hultgren Date: Fri, 29 Apr 2022 13:39:37 +0200 Subject: [PATCH 07/89] [Stack Monitoring] Fix node type detection for external collection (#131156) --- x-pack/plugins/monitoring/common/types/es.ts | 1 + .../nodes/get_node_type_class_label.ts | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/monitoring/common/types/es.ts b/x-pack/plugins/monitoring/common/types/es.ts index fc19ef0e9aab9..f4c4b385d625d 100644 --- a/x-pack/plugins/monitoring/common/types/es.ts +++ b/x-pack/plugins/monitoring/common/types/es.ts @@ -412,6 +412,7 @@ export interface ElasticsearchIndexRecoveryShard { export interface ElasticsearchMetricbeatNode { name?: string; stats?: ElasticsearchNodeStats; + master: boolean; } export interface ElasticsearchMetricbeatSource { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts index c0a4f4ff2a48c..057e4ec7efee0 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts @@ -21,7 +21,13 @@ export function getNodeTypeClassLabel( node: ElasticsearchLegacySource['source_node'] | ElasticsearchMetricbeatNode, type: keyof typeof nodeTypeLabel ) { - const nodeType = node && 'master' in node ? 'master' : type; + let nodeType = null; + if (isElasticsearchMetricbeatNode(node)) { + nodeType = node.master ? 'master' : type; + } else { + nodeType = type; + } + const returnObj = { nodeType, nodeTypeLabel: nodeTypeLabel[nodeType], @@ -29,3 +35,13 @@ export function getNodeTypeClassLabel( }; return returnObj; } + +function isElasticsearchMetricbeatNode( + node: ElasticsearchLegacySource['source_node'] | ElasticsearchMetricbeatNode +): node is ElasticsearchMetricbeatNode { + if (!node) { + return false; + } + + return 'master' in node; +} From fb5ebc134d84ad33c58aa0ac4c9176209d47db6d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 29 Apr 2022 14:02:18 +0200 Subject: [PATCH 08/89] Update dependency elastic-apm-node to ^3.32.0 (#130763) Co-authored-by: Renovate Bot --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 89c36118479ca..43ab61feba638 100644 --- a/package.json +++ b/package.json @@ -249,7 +249,7 @@ "deep-freeze-strict": "^1.1.1", "deepmerge": "^4.2.2", "del": "^5.1.0", - "elastic-apm-node": "^3.31.0", + "elastic-apm-node": "^3.32.0", "email-addresses": "^5.0.0", "execa": "^4.0.2", "exit-hook": "^2.2.0", diff --git a/yarn.lock b/yarn.lock index 49406dc42e27f..afc8afb39df49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13009,10 +13009,10 @@ elastic-apm-http-client@11.0.1: semver "^6.3.0" stream-chopper "^3.0.1" -elastic-apm-node@^3.31.0: - version "3.31.0" - resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-3.31.0.tgz#6e0bf622d922c95ff0127a263babcdeaeea71457" - integrity sha512-0OulazfhkXYbOaGkHncqjwOfxtcvzsDyzUKr6Y1k95HwKrjf1Vi+xPutZv4p/WfDdO+JadphI0U2Uu5ncGB2iA== +elastic-apm-node@^3.32.0: + version "3.32.0" + resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-3.32.0.tgz#fdad3c03aabc4e7994b4155b031f68d9774af49a" + integrity sha512-6vOe1FZv5toCouuyfiXZuWNE1+1fim9zvsv7H56BKRYa7xQ3X1fxq7QAP2gLd/Z9zvSDLGNXS4DPE1eqX1A1Jw== dependencies: "@elastic/ecs-pino-format" "^1.2.0" after-all-results "^2.0.0" From ced7f112c54df067ad7fe430569519ef334d860e Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Fri, 29 Apr 2022 14:02:43 +0200 Subject: [PATCH 09/89] SO Tagging: Expose tag client / assignment service from start contract (#130774) * SO Tagging: Expose tag client / assignment service from start contract * expose server mocks * add unit tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../saved_objects_tagging/server/index.ts | 7 + .../saved_objects_tagging/server/mocks.ts | 28 ++ .../server/plugin.test.ts | 18 +- .../saved_objects_tagging/server/plugin.ts | 34 +- .../assignments/assignment_service.test.ts | 467 +++++++++++------- .../assignments/assignment_service.ts | 25 +- .../saved_objects_tagging/server/types.ts | 37 +- 7 files changed, 421 insertions(+), 195 deletions(-) create mode 100644 x-pack/plugins/saved_objects_tagging/server/mocks.ts diff --git a/x-pack/plugins/saved_objects_tagging/server/index.ts b/x-pack/plugins/saved_objects_tagging/server/index.ts index 5f731c77caac7..b9fcdcdbb7b4e 100644 --- a/x-pack/plugins/saved_objects_tagging/server/index.ts +++ b/x-pack/plugins/saved_objects_tagging/server/index.ts @@ -9,6 +9,13 @@ import { PluginInitializerContext } from '@kbn/core/server'; import { SavedObjectTaggingPlugin } from './plugin'; export { config } from './config'; +export type { + SavedObjectTaggingStart, + CreateTagAssignmentServiceOptions, + CreateTagClientOptions, +} from './types'; +export type { IAssignmentService } from './services'; +export type { ITagsClient } from '../common'; export const plugin = (initializerContext: PluginInitializerContext) => new SavedObjectTaggingPlugin(); diff --git a/x-pack/plugins/saved_objects_tagging/server/mocks.ts b/x-pack/plugins/saved_objects_tagging/server/mocks.ts new file mode 100644 index 0000000000000..6e1b456090dd4 --- /dev/null +++ b/x-pack/plugins/saved_objects_tagging/server/mocks.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SavedObjectTaggingStart } from './types'; +import { tagsClientMock } from './services/tags/tags_client.mock'; +import { assigmentServiceMock } from './services/assignments/assignment_service.mock'; + +const createStartMock = () => { + const start: jest.Mocked = { + createTagClient: jest.fn(), + createInternalAssignmentService: jest.fn(), + }; + + start.createTagClient.mockImplementation(() => tagsClientMock.create()); + start.createInternalAssignmentService.mockImplementation(() => assigmentServiceMock.create()); + + return start; +}; + +export const savedObjectsTaggingMock = { + createStartContract: createStartMock, + createTagClient: tagsClientMock.create, + createAssignmentService: assigmentServiceMock.create, +}; diff --git a/x-pack/plugins/saved_objects_tagging/server/plugin.test.ts b/x-pack/plugins/saved_objects_tagging/server/plugin.test.ts index a62952937bc21..78cd2cd1f1f95 100644 --- a/x-pack/plugins/saved_objects_tagging/server/plugin.test.ts +++ b/x-pack/plugins/saved_objects_tagging/server/plugin.test.ts @@ -41,7 +41,7 @@ describe('SavedObjectTaggingPlugin', () => { it('registers the globalSearch route handler context', async () => { const coreSetup = coreMock.createSetup(); - await plugin.setup(coreSetup, { features: featuresPluginSetup }); + plugin.setup(coreSetup, { features: featuresPluginSetup }); expect(coreSetup.http.registerRouteHandlerContext).toHaveBeenCalledTimes(1); expect(coreSetup.http.registerRouteHandlerContext).toHaveBeenCalledWith( 'tags', @@ -50,7 +50,7 @@ describe('SavedObjectTaggingPlugin', () => { }); it('registers the `savedObjectsTagging` feature', async () => { - await plugin.setup(coreMock.createSetup(), { features: featuresPluginSetup }); + plugin.setup(coreMock.createSetup(), { features: featuresPluginSetup }); expect(featuresPluginSetup.registerKibanaFeature).toHaveBeenCalledTimes(1); expect(featuresPluginSetup.registerKibanaFeature).toHaveBeenCalledWith( savedObjectsTaggingFeature @@ -61,7 +61,7 @@ describe('SavedObjectTaggingPlugin', () => { const tagUsageCollector = Symbol('saved_objects_tagging'); createTagUsageCollectorMock.mockReturnValue(tagUsageCollector); - await plugin.setup(coreMock.createSetup(), { + plugin.setup(coreMock.createSetup(), { features: featuresPluginSetup, usageCollection: usageCollectionSetup, }); @@ -70,4 +70,16 @@ describe('SavedObjectTaggingPlugin', () => { expect(usageCollectionSetup.registerCollector).toHaveBeenCalledWith(tagUsageCollector); }); }); + + describe('#start', () => { + it('returns the expected contract', () => { + plugin.setup(coreMock.createSetup(), { features: featuresPluginSetup }); + const contract = plugin.start(coreMock.createStart(), {}); + + expect(contract).toEqual({ + createTagClient: expect.any(Function), + createInternalAssignmentService: expect.any(Function), + }); + }); + }); }); diff --git a/x-pack/plugins/saved_objects_tagging/server/plugin.ts b/x-pack/plugins/saved_objects_tagging/server/plugin.ts index 05a2bb31514f1..59c40ab4f124b 100644 --- a/x-pack/plugins/saved_objects_tagging/server/plugin.ts +++ b/x-pack/plugins/saved_objects_tagging/server/plugin.ts @@ -8,13 +8,19 @@ import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server'; import { PluginSetupContract as FeaturesPluginSetup } from '@kbn/features-plugin/server'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; -import { SecurityPluginSetup } from '@kbn/security-plugin/server'; +import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; import { savedObjectsTaggingFeature } from './features'; import { tagType } from './saved_objects'; -import type { TagsHandlerContext } from './types'; +import type { + TagsHandlerContext, + SavedObjectTaggingStart, + CreateTagClientOptions, + CreateTagAssignmentServiceOptions, +} from './types'; import { TagsRequestHandlerContext } from './request_handler_context'; import { registerRoutes } from './routes'; import { createTagUsageCollector } from './usage'; +import { TagsClient, AssignmentService } from './services'; interface SetupDeps { features: FeaturesPluginSetup; @@ -22,7 +28,13 @@ interface SetupDeps { security?: SecurityPluginSetup; } -export class SavedObjectTaggingPlugin implements Plugin<{}, {}, SetupDeps, {}> { +interface StartDeps { + security?: SecurityPluginStart; +} + +export class SavedObjectTaggingPlugin + implements Plugin<{}, SavedObjectTaggingStart, SetupDeps, StartDeps> +{ public setup( { savedObjects, http }: CoreSetup, { features, usageCollection, security }: SetupDeps @@ -53,7 +65,19 @@ export class SavedObjectTaggingPlugin implements Plugin<{}, {}, SetupDeps, {}> { return {}; } - public start(core: CoreStart) { - return {}; + public start(core: CoreStart, { security }: StartDeps) { + return { + createTagClient: ({ client }: CreateTagClientOptions) => { + return new TagsClient({ client }); + }, + createInternalAssignmentService: ({ client }: CreateTagAssignmentServiceOptions) => { + return new AssignmentService({ + client, + authorization: security?.authz, + typeRegistry: core.savedObjects.getTypeRegistry(), + internal: true, + }); + }, + }; } } diff --git a/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.test.ts b/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.test.ts index 3cc4c00da5b30..61e4fbc2fb651 100644 --- a/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.test.ts +++ b/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.test.ts @@ -28,245 +28,350 @@ describe('AssignmentService', () => { authorization = securityMock.createSetup().authz; savedObjectClient = savedObjectsClientMock.create(); typeRegistry = savedObjectsTypeRegistryMock.create(); - - service = new AssignmentService({ - request, - typeRegistry, - authorization, - client: savedObjectClient, - }); }); afterEach(() => { getUpdatableSavedObjectTypesMock.mockReset(); }); - describe('#updateTagAssignments', () => { + describe('scoped service', () => { beforeEach(() => { - getUpdatableSavedObjectTypesMock.mockImplementation(({ types }) => Promise.resolve(types)); - - savedObjectClient.bulkGet.mockResolvedValue({ - saved_objects: [], + service = new AssignmentService({ + request, + typeRegistry, + authorization, + client: savedObjectClient, }); }); - it('throws an error if trying to assign non-taggable types', async () => { - await expect( - service.updateTagAssignments({ - tags: ['tag-1', 'tag-2'], - assign: [ - { type: 'dashboard', id: 'dash-1' }, - { type: 'not-supported', id: 'foo' }, - ], - unassign: [], - }) - ).rejects.toThrowErrorMatchingInlineSnapshot(`"Unsupported type [not-supported]"`); + it('throws when instantiated with `internal: false` if no request is provided', () => { + expect(() => { + new AssignmentService({ + internal: false, + typeRegistry, + authorization, + client: savedObjectClient, + }); + }).toThrowErrorMatchingInlineSnapshot(`"request required for non-internal usages"`); }); - it('throws an error if trying to assign non-assignable types', async () => { - getUpdatableSavedObjectTypesMock.mockResolvedValue(['dashboard']); + describe('#updateTagAssignments', () => { + beforeEach(() => { + getUpdatableSavedObjectTypesMock.mockImplementation(({ types }) => Promise.resolve(types)); + + savedObjectClient.bulkGet.mockResolvedValue({ + saved_objects: [], + }); + }); + + it('throws an error if trying to assign non-taggable types', async () => { + await expect( + service.updateTagAssignments({ + tags: ['tag-1', 'tag-2'], + assign: [ + { type: 'dashboard', id: 'dash-1' }, + { type: 'not-supported', id: 'foo' }, + ], + unassign: [], + }) + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Unsupported type [not-supported]"`); + }); - await expect( - service.updateTagAssignments({ + it('throws an error if trying to assign non-assignable types', async () => { + getUpdatableSavedObjectTypesMock.mockResolvedValue(['dashboard']); + + await expect( + service.updateTagAssignments({ + tags: ['tag-1', 'tag-2'], + assign: [ + { type: 'dashboard', id: 'dash-1' }, + { type: 'map', id: 'map-1' }, + ], + unassign: [], + }) + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Forbidden type [map]"`); + }); + + it('calls `soClient.bulkGet` with the correct parameters', async () => { + await service.updateTagAssignments({ tags: ['tag-1', 'tag-2'], - assign: [ - { type: 'dashboard', id: 'dash-1' }, - { type: 'map', id: 'map-1' }, - ], - unassign: [], - }) - ).rejects.toThrowErrorMatchingInlineSnapshot(`"Forbidden type [map]"`); - }); + assign: [{ type: 'dashboard', id: 'dash-1' }], + unassign: [{ type: 'map', id: 'map-1' }], + }); - it('calls `soClient.bulkGet` with the correct parameters', async () => { - await service.updateTagAssignments({ - tags: ['tag-1', 'tag-2'], - assign: [{ type: 'dashboard', id: 'dash-1' }], - unassign: [{ type: 'map', id: 'map-1' }], + expect(savedObjectClient.bulkGet).toHaveBeenCalledTimes(1); + expect(savedObjectClient.bulkGet).toHaveBeenCalledWith([ + { type: 'dashboard', id: 'dash-1', fields: [] }, + { type: 'map', id: 'map-1', fields: [] }, + ]); }); - expect(savedObjectClient.bulkGet).toHaveBeenCalledTimes(1); - expect(savedObjectClient.bulkGet).toHaveBeenCalledWith([ - { type: 'dashboard', id: 'dash-1', fields: [] }, - { type: 'map', id: 'map-1', fields: [] }, - ]); - }); + it('throws an error if any result from `soClient.bulkGet` has an error', async () => { + savedObjectClient.bulkGet.mockResolvedValue({ + saved_objects: [ + createSavedObject({ type: 'dashboard', id: 'dash-1' }), + createSavedObject({ + type: 'map', + id: 'map-1', + error: { + statusCode: 404, + message: 'not found', + error: 'object was not found', + }, + }), + ], + }); - it('throws an error if any result from `soClient.bulkGet` has an error', async () => { - savedObjectClient.bulkGet.mockResolvedValue({ - saved_objects: [ - createSavedObject({ type: 'dashboard', id: 'dash-1' }), - createSavedObject({ - type: 'map', - id: 'map-1', - error: { - statusCode: 404, - message: 'not found', - error: 'object was not found', - }, - }), - ], + await expect( + service.updateTagAssignments({ + tags: ['tag-1', 'tag-2'], + assign: [{ type: 'dashboard', id: 'dash-1' }], + unassign: [{ type: 'map', id: 'map-1' }], + }) + ).rejects.toThrowErrorMatchingInlineSnapshot(`"not found"`); }); - await expect( - service.updateTagAssignments({ + it('calls `soClient.bulkUpdate` to update the references', async () => { + savedObjectClient.bulkGet.mockResolvedValue({ + saved_objects: [ + createSavedObject({ + type: 'dashboard', + id: 'dash-1', + references: [], + }), + createSavedObject({ + type: 'map', + id: 'map-1', + references: [createReference('dashboard', 'dash-1'), createReference('tag', 'tag-1')], + }), + ], + }); + + await service.updateTagAssignments({ tags: ['tag-1', 'tag-2'], assign: [{ type: 'dashboard', id: 'dash-1' }], unassign: [{ type: 'map', id: 'map-1' }], - }) - ).rejects.toThrowErrorMatchingInlineSnapshot(`"not found"`); - }); + }); - it('calls `soClient.bulkUpdate` to update the references', async () => { - savedObjectClient.bulkGet.mockResolvedValue({ - saved_objects: [ - createSavedObject({ + expect(savedObjectClient.bulkUpdate).toHaveBeenCalledTimes(1); + expect(savedObjectClient.bulkUpdate).toHaveBeenCalledWith([ + { type: 'dashboard', id: 'dash-1', - references: [], - }), - createSavedObject({ + attributes: {}, + references: [createReference('tag', 'tag-1'), createReference('tag', 'tag-2')], + }, + { type: 'map', id: 'map-1', - references: [createReference('dashboard', 'dash-1'), createReference('tag', 'tag-1')], - }), - ], + attributes: {}, + references: [createReference('dashboard', 'dash-1')], + }, + ]); }); + }); - await service.updateTagAssignments({ - tags: ['tag-1', 'tag-2'], - assign: [{ type: 'dashboard', id: 'dash-1' }], - unassign: [{ type: 'map', id: 'map-1' }], + describe('#findAssignableObjects', () => { + beforeEach(() => { + getUpdatableSavedObjectTypesMock.mockImplementation(({ types }) => Promise.resolve(types)); + typeRegistry.getType.mockImplementation( + (name) => + ({ + management: { + defaultSearchField: `${name}-search-field`, + }, + } as any) + ); + savedObjectClient.find.mockResolvedValue({ + saved_objects: [], + total: 0, + page: 1, + per_page: 20, + }); }); - expect(savedObjectClient.bulkUpdate).toHaveBeenCalledTimes(1); - expect(savedObjectClient.bulkUpdate).toHaveBeenCalledWith([ - { - type: 'dashboard', - id: 'dash-1', - attributes: {}, - references: [createReference('tag', 'tag-1'), createReference('tag', 'tag-2')], - }, - { - type: 'map', - id: 'map-1', - attributes: {}, - references: [createReference('dashboard', 'dash-1')], - }, - ]); - }); - }); + it('calls `soClient.find` with the correct parameters', async () => { + await service.findAssignableObjects({ + types: ['dashboard', 'map'], + search: 'term', + maxResults: 20, + }); - describe('#findAssignableObjects', () => { - beforeEach(() => { - getUpdatableSavedObjectTypesMock.mockImplementation(({ types }) => Promise.resolve(types)); - typeRegistry.getType.mockImplementation( - (name) => - ({ - management: { - defaultSearchField: `${name}-search-field`, - }, - } as any) - ); - savedObjectClient.find.mockResolvedValue({ - saved_objects: [], - total: 0, - page: 1, - per_page: 20, + expect(savedObjectClient.find).toHaveBeenCalledTimes(1); + expect(savedObjectClient.find).toHaveBeenCalledWith({ + page: 1, + perPage: 20, + search: 'term', + type: ['dashboard', 'map'], + searchFields: ['dashboard-search-field', 'map-search-field'], + }); }); - }); - it('calls `soClient.find` with the correct parameters', async () => { - await service.findAssignableObjects({ - types: ['dashboard', 'map'], - search: 'term', - maxResults: 20, + it('filters the non-assignable types', async () => { + getUpdatableSavedObjectTypesMock.mockResolvedValue(['dashboard']); + + await service.findAssignableObjects({ + types: ['dashboard', 'map'], + search: 'term', + maxResults: 20, + }); + + expect(savedObjectClient.find).toHaveBeenCalledTimes(1); + expect(savedObjectClient.find).toHaveBeenCalledWith( + expect.objectContaining({ + type: ['dashboard'], + }) + ); }); - expect(savedObjectClient.find).toHaveBeenCalledTimes(1); - expect(savedObjectClient.find).toHaveBeenCalledWith({ - page: 1, - perPage: 20, - search: 'term', - type: ['dashboard', 'map'], - searchFields: ['dashboard-search-field', 'map-search-field'], + it('converts the results returned from `soClient.find`', async () => { + savedObjectClient.find.mockResolvedValue({ + saved_objects: [ + createSavedObject({ + type: 'dashboard', + id: 'dash-1', + }), + createSavedObject({ + type: 'map', + id: 'dash-2', + }), + ] as any[], + total: 2, + page: 1, + per_page: 20, + }); + + const results = await service.findAssignableObjects({ + types: ['dashboard', 'map'], + search: 'term', + maxResults: 20, + }); + + expect(results.map(({ type, id }) => ({ type, id }))).toEqual([ + { type: 'dashboard', id: 'dash-1' }, + { type: 'map', id: 'dash-2' }, + ]); }); }); - it('filters the non-assignable types', async () => { - getUpdatableSavedObjectTypesMock.mockResolvedValue(['dashboard']); + describe('#getAssignableTypes', () => { + it('calls `getUpdatableSavedObjectTypes` with the correct parameters', async () => { + await service.getAssignableTypes(['type-a', 'type-b']); - await service.findAssignableObjects({ - types: ['dashboard', 'map'], - search: 'term', - maxResults: 20, + expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledTimes(1); + expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledWith({ + request, + authorization, + types: ['type-a', 'type-b'], + }); }); + it('calls `getUpdatableSavedObjectTypes` with `taggableTypes` when `types` is not specified ', async () => { + await service.getAssignableTypes(); - expect(savedObjectClient.find).toHaveBeenCalledTimes(1); - expect(savedObjectClient.find).toHaveBeenCalledWith( - expect.objectContaining({ - type: ['dashboard'], - }) - ); + expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledTimes(1); + expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledWith({ + request, + authorization, + types: taggableTypes, + }); + }); + it('forward the result of `getUpdatableSavedObjectTypes`', async () => { + getUpdatableSavedObjectTypesMock.mockReturnValue(['updatable-a', 'updatable-b']); + + const assignableTypes = await service.getAssignableTypes(); + + expect(assignableTypes).toEqual(['updatable-a', 'updatable-b']); + }); }); + }); - it('converts the results returned from `soClient.find`', async () => { - savedObjectClient.find.mockResolvedValue({ - saved_objects: [ - createSavedObject({ - type: 'dashboard', - id: 'dash-1', - }), - createSavedObject({ - type: 'map', - id: 'dash-2', - }), - ] as any[], - total: 2, - page: 1, - per_page: 20, + describe('internal service', () => { + beforeEach(() => { + service = new AssignmentService({ + internal: true, + typeRegistry, + authorization, + client: savedObjectClient, }); + }); - const results = await service.findAssignableObjects({ - types: ['dashboard', 'map'], - search: 'term', - maxResults: 20, + describe('#updateTagAssignments', () => { + beforeEach(() => { + getUpdatableSavedObjectTypesMock.mockImplementation(({ types }) => Promise.resolve(types)); + + savedObjectClient.bulkGet.mockResolvedValue({ + saved_objects: [], + }); }); - expect(results.map(({ type, id }) => ({ type, id }))).toEqual([ - { type: 'dashboard', id: 'dash-1' }, - { type: 'map', id: 'dash-2' }, - ]); - }); - }); + it('does not calls `getUpdatableSavedObjectTypes`', async () => { + getUpdatableSavedObjectTypesMock.mockResolvedValue(['dashboard']); - describe('#getAssignableTypes', () => { - it('calls `getUpdatableSavedObjectTypes` with the correct parameters', async () => { - await service.getAssignableTypes(['type-a', 'type-b']); + await service.updateTagAssignments({ + tags: ['tag-1', 'tag-2'], + assign: [ + { type: 'dashboard', id: 'dash-1' }, + { type: 'map', id: 'map-1' }, + ], + unassign: [], + }); - expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledTimes(1); - expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledWith({ - request, - authorization, - types: ['type-a', 'type-b'], + expect(getUpdatableSavedObjectTypesMock).not.toHaveBeenCalled(); + expect(savedObjectClient.bulkGet).toHaveBeenCalledTimes(1); + expect(savedObjectClient.bulkGet).toHaveBeenCalledWith([ + { type: 'dashboard', id: 'dash-1', fields: [] }, + { type: 'map', id: 'map-1', fields: [] }, + ]); }); }); - it('calls `getUpdatableSavedObjectTypes` with `taggableTypes` when `types` is not specified ', async () => { - await service.getAssignableTypes(); - expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledTimes(1); - expect(getUpdatableSavedObjectTypesMock).toHaveBeenCalledWith({ - request, - authorization, - types: taggableTypes, + describe('#findAssignableObjects', () => { + beforeEach(() => { + typeRegistry.getType.mockImplementation( + (name) => + ({ + management: { + defaultSearchField: `${name}-search-field`, + }, + } as any) + ); + savedObjectClient.find.mockResolvedValue({ + saved_objects: [], + total: 0, + page: 1, + per_page: 20, + }); + }); + + it('does not calls `getUpdatableSavedObjectTypes`', async () => { + getUpdatableSavedObjectTypesMock.mockResolvedValue(['dashboard']); + + await service.findAssignableObjects({ + types: ['dashboard', 'map'], + search: 'term', + maxResults: 20, + }); + + expect(getUpdatableSavedObjectTypesMock).not.toHaveBeenCalled(); + expect(savedObjectClient.find).toHaveBeenCalledTimes(1); + expect(savedObjectClient.find).toHaveBeenCalledWith( + expect.objectContaining({ + type: ['dashboard', 'map'], + }) + ); }); }); - it('forward the result of `getUpdatableSavedObjectTypes`', async () => { - getUpdatableSavedObjectTypesMock.mockReturnValue(['updatable-a', 'updatable-b']); - const assignableTypes = await service.getAssignableTypes(); + describe('#getAssignableTypes', () => { + it('does not calls `getUpdatableSavedObjectTypes`', async () => { + await service.getAssignableTypes(['type-a', 'type-b']); - expect(assignableTypes).toEqual(['updatable-a', 'updatable-b']); + expect(getUpdatableSavedObjectTypesMock).not.toHaveBeenCalled(); + }); + it('returns the list of all taggable types', async () => { + const assignableTypes = await service.getAssignableTypes(); + expect(assignableTypes).toEqual(taggableTypes); + }); }); }); }); diff --git a/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.ts b/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.ts index d6d14f68357be..09a726db856c2 100644 --- a/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.ts +++ b/x-pack/plugins/saved_objects_tagging/server/services/assignments/assignment_service.ts @@ -28,10 +28,11 @@ import { AssignmentError } from './errors'; import { toAssignableObject } from './utils'; interface AssignmentServiceOptions { - request: KibanaRequest; + request?: KibanaRequest; client: SavedObjectsClientContract; typeRegistry: ISavedObjectTypeRegistry; authorization?: SecurityPluginSetup['authz']; + internal?: boolean; } export type IAssignmentService = PublicMethodsOf; @@ -40,9 +41,20 @@ export class AssignmentService { private readonly soClient: SavedObjectsClientContract; private readonly typeRegistry: ISavedObjectTypeRegistry; private readonly authorization?: SecurityPluginSetup['authz']; - private readonly request: KibanaRequest; - - constructor({ client, typeRegistry, authorization, request }: AssignmentServiceOptions) { + private readonly request?: KibanaRequest; + private readonly internal: boolean; + + constructor({ + client, + typeRegistry, + authorization, + request, + internal = false, + }: AssignmentServiceOptions) { + if (!internal && !request) { + throw new Error('request required for non-internal usages'); + } + this.internal = internal; this.soClient = client; this.typeRegistry = typeRegistry; this.authorization = authorization; @@ -84,8 +96,11 @@ export class AssignmentService { } public async getAssignableTypes(types?: string[]) { + if (this.internal) { + return types ?? taggableTypes; + } return getUpdatableSavedObjectTypes({ - request: this.request, + request: this.request!, types: types ?? taggableTypes, authorization: this.authorization, }); diff --git a/x-pack/plugins/saved_objects_tagging/server/types.ts b/x-pack/plugins/saved_objects_tagging/server/types.ts index 366f2779b6a81..0bc023214151d 100644 --- a/x-pack/plugins/saved_objects_tagging/server/types.ts +++ b/x-pack/plugins/saved_objects_tagging/server/types.ts @@ -5,7 +5,11 @@ * 2.0. */ -import type { IRouter, CustomRequestHandlerContext } from '@kbn/core/server'; +import type { + IRouter, + CustomRequestHandlerContext, + SavedObjectsClientContract, +} from '@kbn/core/server'; import { ITagsClient } from '../common/types'; import { IAssignmentService } from './services'; @@ -14,6 +18,37 @@ export interface ITagsRequestHandlerContext { assignmentService: IAssignmentService; } +/** @public */ +export interface CreateTagClientOptions { + client: SavedObjectsClientContract; +} + +/** @public */ +export interface CreateTagAssignmentServiceOptions { + client: SavedObjectsClientContract; +} + +/** @public */ +export interface SavedObjectTaggingStart { + /** + * Creates a TagClient bound to the provided SavedObject client. + */ + createTagClient: (options: CreateTagClientOptions) => ITagsClient; + + /** + * Creates an internal AssignmentService bound to the provided SavedObject client. + * + * @remark: As assignment services created via this API will not be performing authz check to ensure + * that the current user is allowed to update the assigned/unassigned objects. + * This API is only meant to be used to perform operations on behalf of the 'internal' Kibana user. + * When trying to assign or unassign tags on behalf of a user, use the `tags` request handler context + * instead. + */ + createInternalAssignmentService: ( + options: CreateTagAssignmentServiceOptions + ) => IAssignmentService; +} + /** * @internal */ From c5399232e9cd69dedaa0f3efbb772a5d30b12757 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Fri, 29 Apr 2022 13:03:01 +0100 Subject: [PATCH 10/89] [ML] Additional testing of trained model in UI (#129209) * [ML] Fixing text classification testing in the UI * disabling unsupported models * code clean up * small refactor * adding zero shot classification * translation id * adding text embedding * adding fill_mask * translation id * code clean up * adding observable for inference * refactoring for observables * removing comment * refactor * removing num_top_classes override * adding optional num_top_classes * translations * removing any * updating error type * removing any type * correcting type * combining checks * fixing lang ident * added start check Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../ml/common/constants/trained_models.ts | 8 +- .../ml/common/util/errors/errors.test.ts | 6 +- x-pack/plugins/ml/common/util/errors/types.ts | 11 +- .../util/model_memory_estimator.ts | 10 +- .../models_management/models_list.tsx | 3 + .../test_models/models/index.ts | 23 ++++ .../test_models/models/inference_base.ts | 44 ++++++- .../models/inference_input_form.tsx | 79 +++++-------- .../test_models/models/lang_ident/index.ts | 4 +- .../models/lang_ident/lang_ident_inference.ts | 110 +++++++++++------- .../models/lang_ident/lang_ident_output.tsx | 18 ++- .../test_models/models/ner/index.ts | 4 +- .../test_models/models/ner/ner_inference.ts | 52 +++++++-- .../test_models/models/ner/ner_output.tsx | 15 ++- .../test_models/models/raw_output.tsx | 50 ++++++++ .../models/text_classification/common.ts | 84 +++++++++++++ .../fill_mask_inference.ts | 70 +++++++++++ .../text_classification/fill_mask_output.tsx | 51 ++++++++ .../models/text_classification/index.ts | 17 +++ .../text_classification_inference.ts | 54 +++++++++ .../text_classification_output.tsx | 42 +++++++ .../zero_shot_classification_inference.ts | 62 ++++++++++ .../zero_shot_classification_input.tsx | 59 ++++++++++ .../models/text_embedding/index.ts | 14 +++ .../text_embedding_inference.ts | 68 +++++++++++ .../text_embedding/text_embedding_output.tsx | 43 +++++++ .../test_models/models/text_input.tsx | 47 ++++++++ .../test_models/selected_model.tsx | 60 ++++++---- .../server/routes/schemas/inference_schema.ts | 1 + .../ml/server/routes/trained_models.ts | 7 +- .../translations/translations/ja-JP.json | 3 - .../translations/translations/zh-CN.json | 3 - 32 files changed, 951 insertions(+), 171 deletions(-) create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/index.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/raw_output.tsx create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/common.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_inference.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/index.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_inference.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_output.tsx create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_inference.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/index.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_inference.ts create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_output.tsx create mode 100644 x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx diff --git a/x-pack/plugins/ml/common/constants/trained_models.ts b/x-pack/plugins/ml/common/constants/trained_models.ts index 79fe65936b231..75ea25dcc9efa 100644 --- a/x-pack/plugins/ml/common/constants/trained_models.ts +++ b/x-pack/plugins/ml/common/constants/trained_models.ts @@ -22,10 +22,10 @@ export type TrainedModelType = typeof TRAINED_MODEL_TYPE[keyof typeof TRAINED_MO export const SUPPORTED_PYTORCH_TASKS = { NER: 'ner', - // ZERO_SHOT_CLASSIFICATION: 'zero_shot_classification', - // CLASSIFICATION_LABELS: 'classification_labels', - // TEXT_CLASSIFICATION: 'text_classification', - // TEXT_EMBEDDING: 'text_embedding', + ZERO_SHOT_CLASSIFICATION: 'zero_shot_classification', + TEXT_CLASSIFICATION: 'text_classification', + TEXT_EMBEDDING: 'text_embedding', + FILL_MASK: 'fill_mask', } as const; export type SupportedPytorchTasksType = typeof SUPPORTED_PYTORCH_TASKS[keyof typeof SUPPORTED_PYTORCH_TASKS]; diff --git a/x-pack/plugins/ml/common/util/errors/errors.test.ts b/x-pack/plugins/ml/common/util/errors/errors.test.ts index 625374857c7ce..e299c67d882f4 100644 --- a/x-pack/plugins/ml/common/util/errors/errors.test.ts +++ b/x-pack/plugins/ml/common/util/errors/errors.test.ts @@ -7,7 +7,7 @@ import Boom from '@hapi/boom'; -import { extractErrorMessage, MLHttpFetchError, MLResponseError, EsErrorBody } from '.'; +import { extractErrorMessage, MLHttpFetchError, EsErrorBody } from '.'; describe('ML - error message utils', () => { describe('extractErrorMessage', () => { @@ -39,7 +39,7 @@ describe('ML - error message utils', () => { expect(extractErrorMessage(stringMessage)).toBe(testMsg); // kibana error without attributes - const bodyWithoutAttributes: MLHttpFetchError = { + const bodyWithoutAttributes: MLHttpFetchError = { name: 'name', req: {} as Request, request: {} as Request, @@ -53,7 +53,7 @@ describe('ML - error message utils', () => { expect(extractErrorMessage(bodyWithoutAttributes)).toBe(testMsg); // kibana error with attributes - const bodyWithAttributes: MLHttpFetchError = { + const bodyWithAttributes: MLHttpFetchError = { name: 'name', req: {} as Request, request: {} as Request, diff --git a/x-pack/plugins/ml/common/util/errors/types.ts b/x-pack/plugins/ml/common/util/errors/types.ts index d1f0d3216f42e..fafbeeb4c1a12 100644 --- a/x-pack/plugins/ml/common/util/errors/types.ts +++ b/x-pack/plugins/ml/common/util/errors/types.ts @@ -45,16 +45,13 @@ export interface MLErrorObject { fullError?: EsErrorBody; } -export interface MLHttpFetchError extends HttpFetchError { +export interface MLHttpFetchErrorBase extends HttpFetchError { body: T; } -export type ErrorType = - | MLHttpFetchError - | EsErrorBody - | Boom.Boom - | string - | undefined; +export type MLHttpFetchError = MLHttpFetchErrorBase; + +export type ErrorType = MLHttpFetchError | EsErrorBody | Boom.Boom | string | undefined; export function isEsErrorBody(error: any): error is EsErrorBody { return error && error.error?.reason !== undefined; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts index 1e28ac6ef8a2d..a0ca9e4502cc2 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/model_memory_estimator.ts @@ -24,11 +24,7 @@ import { useEffect, useMemo } from 'react'; import { DEFAULT_MODEL_MEMORY_LIMIT } from '../../../../../../../common/constants/new_job'; import { ml } from '../../../../../services/ml_api_service'; import { JobValidator, VALIDATION_DELAY_MS } from '../../job_validator/job_validator'; -import { - MLHttpFetchError, - MLResponseError, - extractErrorMessage, -} from '../../../../../../../common/util/errors'; +import { MLHttpFetchError, extractErrorMessage } from '../../../../../../../common/util/errors'; import { useMlKibana } from '../../../../../contexts/kibana'; import { JobCreator } from '../job_creator'; @@ -41,10 +37,10 @@ export const modelMemoryEstimatorProvider = ( jobValidator: JobValidator ) => { const modelMemoryCheck$ = new Subject(); - const error$ = new Subject>(); + const error$ = new Subject(); return { - get error$(): Observable> { + get error$(): Observable { return error$.asObservable(); }, get updates$(): Observable { diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx index 063235e9db9fd..357015b057996 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/models_list.tsx @@ -484,6 +484,9 @@ export const ModelsList: FC = ({ isPrimary: true, available: isTestable, onClick: setShowTestFlyout, + enabled: (item) => + isPopulatedObject(item.stats?.deployment_stats) && + item.stats?.deployment_stats?.state === DEPLOYMENT_STATE.STARTED, }, ] as Array>) ); diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/index.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/index.ts new file mode 100644 index 0000000000000..ef46c223f609e --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/index.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 { NerInference } from './ner'; +import { + TextClassificationInference, + ZeroShotClassificationInference, + FillMaskInference, +} from './text_classification'; +import { TextEmbeddingInference } from './text_embedding'; +import { LangIdentInference } from './lang_ident'; + +export type InferrerType = + | NerInference + | TextClassificationInference + | TextEmbeddingInference + | ZeroShotClassificationInference + | FillMaskInference + | LangIdentInference; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_base.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_base.ts index 777ca2d314c4d..db27fb96e9c2a 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_base.ts +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_base.ts @@ -5,19 +5,38 @@ * 2.0. */ +import { BehaviorSubject } from 'rxjs'; import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { MLHttpFetchError } from '../../../../../../common/util/errors'; import { trainedModelsApiProvider } from '../../../../services/ml_api_service/trained_models'; const DEFAULT_INPUT_FIELD = 'text_field'; -export type FormattedNerResp = Array<{ +export type FormattedNerResponse = Array<{ value: string; entity: estypes.MlTrainedModelEntities | null; }>; +export interface InferResponse { + inputText: string; + response: T; + rawResponse: U; +} + +export enum RUNNING_STATE { + STOPPED, + RUNNING, + FINISHED, + FINISHED_WITH_ERRORS, +} + export abstract class InferenceBase { protected readonly inputField: string; + public inputText$ = new BehaviorSubject(''); + public inferenceResult$ = new BehaviorSubject(null); + public inferenceError$ = new BehaviorSubject(null); + public runningState$ = new BehaviorSubject(RUNNING_STATE.STOPPED); constructor( protected trainedModelsApi: ReturnType, @@ -26,5 +45,26 @@ export abstract class InferenceBase { this.inputField = model.input?.field_names[0] ?? DEFAULT_INPUT_FIELD; } - protected abstract infer(inputText: string): Promise; + public setStopped() { + this.inferenceError$.next(null); + this.runningState$.next(RUNNING_STATE.STOPPED); + } + public setRunning() { + this.inferenceError$.next(null); + this.runningState$.next(RUNNING_STATE.RUNNING); + } + + public setFinished() { + this.runningState$.next(RUNNING_STATE.FINISHED); + } + + public setFinishedWithErrors(error: MLHttpFetchError) { + this.inferenceError$.next(error); + this.runningState$.next(RUNNING_STATE.FINISHED_WITH_ERRORS); + } + + protected abstract getInputComponent(): JSX.Element; + protected abstract getOutputComponent(): JSX.Element; + + protected abstract infer(): Promise; } diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx index 6503486d98211..0ee33791ef55e 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/inference_input_form.tsx @@ -5,25 +5,20 @@ * 2.0. */ -import React, { FC, useState } from 'react'; +import React, { FC, useState, useMemo } from 'react'; -import { i18n } from '@kbn/i18n'; +import useObservable from 'react-use/lib/useObservable'; import { FormattedMessage } from '@kbn/i18n-react'; -import { EuiSpacer, EuiTextArea, EuiButton, EuiTabs, EuiTab } from '@elastic/eui'; - -import { LangIdentInference } from './lang_ident/lang_ident_inference'; -import { NerInference } from './ner/ner_inference'; -import type { FormattedLangIdentResp } from './lang_ident/lang_ident_inference'; -import type { FormattedNerResp } from './ner/ner_inference'; - -import { MLJobEditor } from '../../../../jobs/jobs_list/components/ml_job_editor'; +import { EuiSpacer, EuiButton, EuiTabs, EuiTab } from '@elastic/eui'; import { extractErrorMessage } from '../../../../../../common/util/errors'; import { ErrorMessage } from '../inference_error'; import { OutputLoadingContent } from '../output_loading'; +import { RUNNING_STATE } from './inference_base'; +import { RawOutput } from './raw_output'; +import type { InferrerType } from '.'; interface Props { - inferrer: LangIdentInference | NerInference; - getOutputComponent(output: any): JSX.Element; + inferrer: InferrerType; } enum TAB { @@ -31,61 +26,41 @@ enum TAB { RAW, } -export const InferenceInputForm: FC = ({ inferrer, getOutputComponent }) => { - const [inputText, setInputText] = useState(''); - const [isRunning, setIsRunning] = useState(false); - const [output, setOutput] = useState(null); - const [rawOutput, setRawOutput] = useState(null); +export const InferenceInputForm: FC = ({ inferrer }) => { const [selectedTab, setSelectedTab] = useState(TAB.TEXT); - const [showOutput, setShowOutput] = useState(false); const [errorText, setErrorText] = useState(null); + const runningState = useObservable(inferrer.runningState$); + const inputText = useObservable(inferrer.inputText$); + const inputComponent = useMemo(() => inferrer.getInputComponent(), []); + const outputComponent = useMemo(() => inferrer.getOutputComponent(), []); + async function run() { - setShowOutput(true); - setOutput(null); - setRawOutput(null); - setIsRunning(true); setErrorText(null); try { - const { response, rawResponse } = await inferrer.infer(inputText); - setOutput(response); - setRawOutput(JSON.stringify(rawResponse, null, 2)); + await inferrer.infer(); } catch (e) { - setIsRunning(false); - setOutput(null); setErrorText(extractErrorMessage(e)); - setRawOutput(JSON.stringify(e.body ?? e, null, 2)); } - setIsRunning(false); } return ( <> - { - setInputText(e.target.value); - }} - /> + <>{inputComponent}
- {showOutput === true ? ( + {runningState !== RUNNING_STATE.STOPPED ? ( <> @@ -94,7 +69,7 @@ export const InferenceInputForm: FC = ({ inferrer, getOutputComponent }) onClick={setSelectedTab.bind(null, TAB.TEXT)} > @@ -103,7 +78,7 @@ export const InferenceInputForm: FC = ({ inferrer, getOutputComponent }) onClick={setSelectedTab.bind(null, TAB.RAW)} > @@ -113,16 +88,16 @@ export const InferenceInputForm: FC = ({ inferrer, getOutputComponent }) {selectedTab === TAB.TEXT ? ( <> - {errorText !== null ? ( + {runningState === RUNNING_STATE.RUNNING ? : null} + + {errorText !== null || runningState === RUNNING_STATE.FINISHED_WITH_ERRORS ? ( - ) : output === null ? ( - - ) : ( - <>{getOutputComponent(output)} - )} + ) : null} + + {runningState === RUNNING_STATE.FINISHED ? <>{outputComponent} : null} ) : ( - + )} ) : null} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/index.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/index.ts index b3439d90e8828..8e5bd8cdbeb5f 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/index.ts +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/index.ts @@ -5,6 +5,6 @@ * 2.0. */ -export type { FormattedLangIdentResp } from './lang_ident_inference'; +export type { FormattedLangIdentResponse, LangIdentResponse } from './lang_ident_inference'; export { LangIdentInference } from './lang_ident_inference'; -export { LangIdentOutput } from './lang_ident_output'; +export { getLangIdentOutputComponent } from './lang_ident_output'; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_inference.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_inference.ts index 9108a59197617..34893d7dc9402 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_inference.ts +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_inference.ts @@ -7,62 +7,86 @@ import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { InferenceBase } from '../inference_base'; +import { InferenceBase, InferResponse } from '../inference_base'; +import { getGeneralInputComponent } from '../text_input'; +import { getLangIdentOutputComponent } from './lang_ident_output'; -export type FormattedLangIdentResp = Array<{ +export type FormattedLangIdentResponse = Array<{ className: string; classProbability: number; classScore: number; }>; -interface InferResponse { - response: FormattedLangIdentResp; - rawResponse: estypes.IngestSimulateResponse; -} +export type LangIdentResponse = InferResponse< + FormattedLangIdentResponse, + estypes.IngestSimulateResponse +>; -export class LangIdentInference extends InferenceBase { - public async infer(inputText: string) { - const payload: estypes.IngestSimulateRequest['body'] = { - pipeline: { - processors: [ - { - inference: { - model_id: this.model.model_id, - inference_config: { - // @ts-expect-error classification missing from type - classification: { - num_top_classes: 3, +export class LangIdentInference extends InferenceBase { + public async infer() { + try { + this.setRunning(); + const inputText = this.inputText$.value; + const payload: estypes.IngestSimulateRequest['body'] = { + pipeline: { + processors: [ + { + inference: { + model_id: this.model.model_id, + inference_config: { + // @ts-expect-error classification missing from type + classification: { + num_top_classes: 3, + }, }, + field_mappings: { + contents: this.inputField, + }, + target_field: '_ml.lang_ident', }, - field_mappings: { - contents: this.inputField, - }, - target_field: '_ml.lang_ident', + }, + ], + }, + docs: [ + { + _source: { + contents: inputText, }, }, ], - }, - docs: [ - { - _source: { - contents: inputText, - }, - }, - ], - }; - const resp = await this.trainedModelsApi.ingestPipelineSimulate(payload); - if (resp.docs.length) { - const topClasses = resp.docs[0].doc?._source._ml?.lang_ident?.top_classes ?? []; - - return { - response: topClasses.map((t: any) => ({ - className: t.class_name, - classProbability: t.class_probability, - classScore: t.class_score, - })), - rawResponse: resp, }; + const resp = await this.trainedModelsApi.ingestPipelineSimulate(payload); + if (resp.docs.length) { + const topClasses = resp.docs[0].doc?._source._ml?.lang_ident?.top_classes ?? []; + + const r: LangIdentResponse = { + response: topClasses.map((t: estypes.MlTopClassEntry) => ({ + className: t.class_name, + classProbability: t.class_probability, + classScore: t.class_score, + })), + rawResponse: resp, + inputText, + }; + this.inferenceResult$.next(r); + this.setFinished(); + return r; + } + const r: LangIdentResponse = { response: [], rawResponse: resp, inputText }; + this.inferenceResult$.next(r); + this.setFinished(); + return r; + } catch (error) { + this.setFinishedWithErrors(error); + throw error; } - return { response: [], rawResponse: resp }; + } + + public getInputComponent(): JSX.Element { + return getGeneralInputComponent(this); + } + + public getOutputComponent(): JSX.Element { + return getLangIdentOutputComponent(this); } } diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_output.tsx index e4968bc516f83..584e367aac784 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_output.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/lang_ident/lang_ident_output.tsx @@ -6,22 +6,28 @@ */ import React, { FC } from 'react'; +import useObservable from 'react-use/lib/useObservable'; import { i18n } from '@kbn/i18n'; import { EuiSpacer, EuiBasicTable, EuiTitle } from '@elastic/eui'; -import type { FormattedLangIdentResp } from './lang_ident_inference'; +import type { LangIdentInference } from './lang_ident_inference'; import { getLanguage } from './lang_codes'; const PROBABILITY_SIG_FIGS = 3; -export const LangIdentOutput: FC<{ result: FormattedLangIdentResp }> = ({ result }) => { - if (result.length === 0) { +export const getLangIdentOutputComponent = (inferrer: LangIdentInference) => ( + +); + +const LangIdentOutput: FC<{ inferrer: LangIdentInference }> = ({ inferrer }) => { + const result = useObservable(inferrer.inferenceResult$); + if (!result || result.response.length === 0) { return null; } - const lang = getLanguage(result[0].className); + const lang = getLanguage(result.response[0].className); - const items = result.map(({ className, classProbability }, i) => { + const items = result.response.map(({ className, classProbability }, i) => { return { noa: `${i + 1}`, className: getLanguage(className), @@ -70,7 +76,7 @@ export const LangIdentOutput: FC<{ result: FormattedLangIdentResp }> = ({ result }) : i18n.translate('xpack.ml.trainedModels.testModelsFlyout.langIdent.output.titleUnknown', { defaultMessage: 'Language code unknown: {code}', - values: { code: result[0].className }, + values: { code: result.response[0].className }, }); return ( diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/index.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/index.ts index 38ddad8bdeb80..5e5a029997965 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/index.ts +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/index.ts @@ -5,6 +5,6 @@ * 2.0. */ -export type { FormattedNerResp } from './ner_inference'; +export type { FormattedNerResponse, NerResponse } from './ner_inference'; export { NerInference } from './ner_inference'; -export { NerOutput } from './ner_output'; +export { getNerOutputComponent } from './ner_output'; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_inference.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_inference.ts index e4dcfcc2c6333..4125dcd02c6db 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_inference.ts +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_inference.ts @@ -7,28 +7,56 @@ import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { InferenceBase } from '../inference_base'; +import { InferenceBase, InferResponse } from '../inference_base'; +import { getGeneralInputComponent } from '../text_input'; +import { getNerOutputComponent } from './ner_output'; -export type FormattedNerResp = Array<{ +export type FormattedNerResponse = Array<{ value: string; entity: estypes.MlTrainedModelEntities | null; }>; -interface InferResponse { - response: FormattedNerResp; - rawResponse: estypes.MlInferTrainedModelDeploymentResponse; -} +export type NerResponse = InferResponse< + FormattedNerResponse, + estypes.MlInferTrainedModelDeploymentResponse +>; + +export class NerInference extends InferenceBase { + public async infer() { + try { + this.setRunning(); + const inputText = this.inputText$.value; + const payload = { docs: { [this.inputField]: inputText } }; + const resp = await this.trainedModelsApi.inferTrainedModel( + this.model.model_id, + payload, + '30s' + ); + + const processedResponse: NerResponse = { + response: parseResponse(resp), + rawResponse: resp, + inputText, + }; + this.inferenceResult$.next(processedResponse); + this.setFinished(); + return processedResponse; + } catch (error) { + this.setFinishedWithErrors(error); + throw error; + } + } -export class NerInference extends InferenceBase { - public async infer(inputText: string) { - const payload = { docs: { [this.inputField]: inputText } }; - const resp = await this.trainedModelsApi.inferTrainedModel(this.model.model_id, payload, '30s'); + public getInputComponent(): JSX.Element { + return getGeneralInputComponent(this); + } - return { response: parseResponse(resp), rawResponse: resp }; + public getOutputComponent(): JSX.Element { + return getNerOutputComponent(this); } } -function parseResponse(resp: estypes.MlInferTrainedModelDeploymentResponse): FormattedNerResp { +function parseResponse(resp: estypes.MlInferTrainedModelDeploymentResponse): FormattedNerResponse { const { predicted_value: predictedValue, entities } = resp; const splitWordsAndEntitiesRegex = /(\[.*?\]\(.*?&.*?\))/; const matchEntityRegex = /(\[.*?\])\((.*?)&(.*?)\)/; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_output.tsx index e9db3fa8efd36..76c154e1000b1 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_output.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/ner/ner_output.tsx @@ -7,6 +7,7 @@ import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import React, { FC, ReactNode } from 'react'; +import useObservable from 'react-use/lib/useObservable'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiHorizontalRule, @@ -21,7 +22,7 @@ import { useCurrentEuiTheme, EuiThemeType, } from '../../../../../components/color_range_legend/use_color_range'; -import type { FormattedNerResp } from './ner_inference'; +import type { NerInference } from './ner_inference'; const ICON_PADDING = '2px'; const PROBABILITY_SIG_FIGS = 3; @@ -60,10 +61,18 @@ const UNKNOWN_ENTITY_TYPE = { borderColor: 'euiColorVis5', }; -export const NerOutput: FC<{ result: FormattedNerResp }> = ({ result }) => { +export const getNerOutputComponent = (inferrer: NerInference) => ; + +const NerOutput: FC<{ inferrer: NerInference }> = ({ inferrer }) => { const { euiTheme } = useCurrentEuiTheme(); + const result = useObservable(inferrer.inferenceResult$); + + if (!result) { + return null; + } + const lineSplit: JSX.Element[] = []; - result.forEach(({ value, entity }) => { + result.response.forEach(({ value, entity }) => { if (entity === null) { const lines = value .split(/(\n)/) diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/raw_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/raw_output.tsx new file mode 100644 index 0000000000000..0031aafa81443 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/raw_output.tsx @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { Observable } from 'rxjs'; +import useObservable from 'react-use/lib/useObservable'; +import { MLJobEditor } from '../../../../jobs/jobs_list/components/ml_job_editor'; + +import type { InferrerType } from '.'; +import { NerResponse } from './ner'; +import { TextClassificationResponse } from './text_classification'; +import { TextEmbeddingResponse } from './text_embedding'; +import { LangIdentResponse } from './lang_ident'; +import { RUNNING_STATE } from './inference_base'; + +type InferenceResponse = + | LangIdentResponse + | NerResponse + | TextClassificationResponse + | TextEmbeddingResponse; + +export const RawOutput: FC<{ + inferrer: InferrerType; +}> = ({ inferrer }) => { + const inferenceError = useObservable(inferrer.inferenceError$); + const runningState = useObservable(inferrer.runningState$); + const inferenceResult = useObservable(inferrer.inferenceResult$ as Observable); + + if ( + (runningState === RUNNING_STATE.FINISHED_WITH_ERRORS && !inferenceError) || + (runningState === RUNNING_STATE.FINISHED && !inferenceResult) + ) { + return null; + } + + const rawResponse = + runningState === RUNNING_STATE.FINISHED_WITH_ERRORS + ? JSON.stringify(inferenceError?.body ?? inferenceError, null, 2) + : JSON.stringify(inferenceResult?.rawResponse, null, 2); + + return ( + <> + + + ); +}; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/common.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/common.ts new file mode 100644 index 0000000000000..d360711995f98 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/common.ts @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { InferResponse } from '../inference_base'; + +const PROBABILITY_SIG_FIGS = 3; + +export interface RawTextClassificationResponse { + predicted_value: string; + prediction_probability: number; + top_classes?: Array<{ + class_name: string; + class_probability: number; + class_score: number; + }>; +} + +export type FormattedTextClassificationResponse = Array<{ + value: string; + predictionProbability: number; +}>; + +export type TextClassificationResponse = InferResponse< + FormattedTextClassificationResponse, + RawTextClassificationResponse +>; + +export function processResponse( + resp: RawTextClassificationResponse, + model: estypes.MlTrainedModelConfig, + inputText: string +): TextClassificationResponse { + const labels: string[] = + // @ts-expect-error inference config is wrong + model.inference_config.text_classification?.classification_labels ?? []; + + let formattedResponse = [ + { + value: resp.predicted_value, + predictionProbability: resp.prediction_probability, + }, + ]; + + if (resp.top_classes !== undefined) { + // if num_top_classes has been specified in the model, + // base the returned results on this list + formattedResponse = resp.top_classes.map((topClass) => { + return { + value: topClass.class_name, + predictionProbability: topClass.class_probability, + }; + }); + } else if (labels.length === 2) { + // otherwise, if the config only contains two classification_labels + // we can safely assume the non-top value and return two results + formattedResponse = labels.map((value) => { + const predictionProbability = + resp.predicted_value === value + ? resp.prediction_probability + : 1 - resp.prediction_probability; + + return { + value, + predictionProbability, + }; + }); + } + + return { + response: formattedResponse + .map(({ value, predictionProbability }) => ({ + value, + predictionProbability: Number(predictionProbability.toPrecision(PROBABILITY_SIG_FIGS)), + })) + .sort((a, b) => a.predictionProbability - b.predictionProbability) + .reverse(), + rawResponse: resp, + inputText, + }; +} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_inference.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_inference.ts new file mode 100644 index 0000000000000..c8c993785dac2 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_inference.ts @@ -0,0 +1,70 @@ +/* + * Copyright 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 { InferenceBase } from '../inference_base'; +import type { TextClassificationResponse, RawTextClassificationResponse } from './common'; +import { processResponse } from './common'; +import { getGeneralInputComponent } from '../text_input'; +import { getFillMaskOutputComponent } from './fill_mask_output'; + +const MASK = '[MASK]'; + +export class FillMaskInference extends InferenceBase { + // @ts-expect-error model type is wrong + private numTopClasses = this.model.inference_config?.fill_mask?.num_top_classes || 5; + + public async infer() { + try { + this.setRunning(); + const inputText = this.inputText$.value; + const payload = { + docs: { [this.inputField]: inputText }, + inference_config: { fill_mask: { num_top_classes: this.numTopClasses } }, + }; + const resp = (await this.trainedModelsApi.inferTrainedModel( + this.model.model_id, + payload, + '30s' + )) as unknown as RawTextClassificationResponse; + + const processedResponse = processResponse(resp, this.model, inputText); + this.inferenceResult$.next(processedResponse); + this.setFinished(); + + return processedResponse; + } catch (error) { + this.setFinishedWithErrors(error); + throw error; + } + } + + public predictedValue() { + const result = this.inferenceResult$.value; + if (result === null) { + return ''; + } + return result.response[0]?.value + ? result.inputText.replace(MASK, result.response[0].value) + : result.inputText; + } + + public getInputComponent(): JSX.Element { + const placeholder = i18n.translate( + 'xpack.ml.trainedModels.testModelsFlyout.langIdent.inputText', + { + defaultMessage: 'Mask token: [MASK]. e.g. Paris is the [MASK] of France.', + } + ); + + return getGeneralInputComponent(this, placeholder); + } + + public getOutputComponent(): JSX.Element { + return getFillMaskOutputComponent(this); + } +} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx new file mode 100644 index 0000000000000..dee08392aad09 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/fill_mask_output.tsx @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useMemo } from 'react'; +import useObservable from 'react-use/lib/useObservable'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiProgress, EuiTitle } from '@elastic/eui'; + +import type { FillMaskInference } from './fill_mask_inference'; + +export const getFillMaskOutputComponent = (inferrer: FillMaskInference) => ( + +); + +const FillMaskOutput: FC<{ + inferrer: FillMaskInference; +}> = ({ inferrer }) => { + const result = useObservable(inferrer.inferenceResult$); + const title = useMemo(() => inferrer.predictedValue(), []); + + if (!result) { + return null; + } + + return ( + <> + +

{title}

+
+ + + + {result.response.map(({ value, predictionProbability }) => ( + <> + + + + <> + {value} + {predictionProbability} + + + + + ))} + + ); +}; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/index.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/index.ts new file mode 100644 index 0000000000000..4eeef37519ff2 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { TextClassificationResponse, FormattedTextClassificationResponse } from './common'; + +export { TextClassificationInference } from './text_classification_inference'; +export { getTextClassificationOutputComponent } from './text_classification_output'; + +export { ZeroShotClassificationInference } from './zero_shot_classification_inference'; +export { getZeroShotClassificationInput } from './zero_shot_classification_input'; + +export { FillMaskInference } from './fill_mask_inference'; +export { getFillMaskOutputComponent } from './fill_mask_output'; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_inference.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_inference.ts new file mode 100644 index 0000000000000..1bebdc6ac82e4 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_inference.ts @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { InferenceBase } from '../inference_base'; +import { processResponse } from './common'; +import type { TextClassificationResponse, RawTextClassificationResponse } from './common'; +import { getGeneralInputComponent } from '../text_input'; +import { getTextClassificationOutputComponent } from './text_classification_output'; + +export class TextClassificationInference extends InferenceBase { + // @ts-expect-error model type is wrong + private numTopClasses = this.model.inference_config?.text_classification?.num_top_classes || 5; + + public async infer() { + try { + this.setRunning(); + const inputText = this.inputText$.value; + const payload = { + docs: { [this.inputField]: inputText }, + inference_config: { text_classification: { num_top_classes: this.numTopClasses } }, + }; + const resp = (await this.trainedModelsApi.inferTrainedModel( + this.model.model_id, + payload, + '30s' + )) as unknown as RawTextClassificationResponse; + + const processedResponse: TextClassificationResponse = processResponse( + resp, + this.model, + inputText + ); + this.inferenceResult$.next(processedResponse); + this.setFinished(); + + return processedResponse; + } catch (error) { + this.setFinishedWithErrors(error); + throw error; + } + } + + public getInputComponent(): JSX.Element { + return getGeneralInputComponent(this); + } + + public getOutputComponent(): JSX.Element { + return getTextClassificationOutputComponent(this); + } +} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_output.tsx new file mode 100644 index 0000000000000..faeed456d1a21 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/text_classification_output.tsx @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import useObservable from 'react-use/lib/useObservable'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiProgress } from '@elastic/eui'; + +import type { TextClassificationInference, ZeroShotClassificationInference } from '.'; + +export const getTextClassificationOutputComponent = ( + inferrer: TextClassificationInference | ZeroShotClassificationInference +) => ; + +const TextClassificationOutput: FC<{ + inferrer: TextClassificationInference | ZeroShotClassificationInference; +}> = ({ inferrer }) => { + const result = useObservable(inferrer.inferenceResult$); + if (!result) { + return null; + } + return ( + <> + {result.response.map(({ value, predictionProbability }) => ( + <> + + + + <> + {value} + {predictionProbability} + + + + + ))} + + ); +}; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_inference.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_inference.ts new file mode 100644 index 0000000000000..b8897c439ece8 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_inference.ts @@ -0,0 +1,62 @@ +/* + * Copyright 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 { BehaviorSubject } from 'rxjs'; +import { InferenceBase } from '../inference_base'; +import { processResponse } from './common'; +import type { TextClassificationResponse, RawTextClassificationResponse } from './common'; + +import { getZeroShotClassificationInput } from './zero_shot_classification_input'; +import { getTextClassificationOutputComponent } from './text_classification_output'; + +export class ZeroShotClassificationInference extends InferenceBase { + public labelsText$ = new BehaviorSubject(''); + + public async infer() { + try { + this.setRunning(); + const inputText = this.inputText$.value; + const labelsText = this.labelsText$.value; + const inputLabels = labelsText?.split(',').map((l) => l.trim()); + const payload = { + docs: { [this.inputField]: inputText }, + inference_config: { + zero_shot_classification: { + labels: inputLabels, + multi_label: false, + }, + }, + }; + const resp = (await this.trainedModelsApi.inferTrainedModel( + this.model.model_id, + payload, + '30s' + )) as unknown as RawTextClassificationResponse; + + const processedResponse: TextClassificationResponse = processResponse( + resp, + this.model, + inputText + ); + this.inferenceResult$.next(processedResponse); + this.setFinished(); + + return processedResponse; + } catch (error) { + this.setFinishedWithErrors(error); + throw error; + } + } + + public getInputComponent(): JSX.Element { + return getZeroShotClassificationInput(this); + } + + public getOutputComponent(): JSX.Element { + return getTextClassificationOutputComponent(this); + } +} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx new file mode 100644 index 0000000000000..60f06bb8baf79 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_classification/zero_shot_classification_input.tsx @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useEffect, useState } from 'react'; +import useObservable from 'react-use/lib/useObservable'; +import { i18n } from '@kbn/i18n'; + +import { EuiSpacer, EuiFieldText, EuiFormRow } from '@elastic/eui'; + +import { TextInput } from '../text_input'; +import { ZeroShotClassificationInference } from './zero_shot_classification_inference'; +import { RUNNING_STATE } from '../inference_base'; + +const ClassNameInput: FC<{ + inferrer: ZeroShotClassificationInference; +}> = ({ inferrer }) => { + const [labelsText, setLabelsText] = useState(''); + + useEffect(() => { + inferrer.labelsText$.next(labelsText); + }, [labelsText]); + + const runningState = useObservable(inferrer.runningState$); + return ( + + { + setLabelsText(e.target.value); + }} + /> + + ); +}; + +export const getZeroShotClassificationInput = ( + inferrer: ZeroShotClassificationInference, + placeholder?: string +) => ( + <> + + + + +); diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/index.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/index.ts new file mode 100644 index 0000000000000..cafa529c5e301 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { + TextEmbeddingResponse, + FormattedTextEmbeddingResponse, +} from './text_embedding_inference'; + +export { TextEmbeddingInference } from './text_embedding_inference'; +export { getTextEmbeddingOutputComponent } from './text_embedding_output'; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_inference.ts b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_inference.ts new file mode 100644 index 0000000000000..ffddc81938f19 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_inference.ts @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; + +import { InferenceBase, InferResponse } from '../inference_base'; +import { getGeneralInputComponent } from '../text_input'; +import { getTextEmbeddingOutputComponent } from './text_embedding_output'; + +export interface RawTextEmbeddingResponse { + predicted_value: number[]; +} + +export interface FormattedTextEmbeddingResponse { + predictedValue: number[]; +} + +export type TextEmbeddingResponse = InferResponse< + FormattedTextEmbeddingResponse, + RawTextEmbeddingResponse +>; + +export class TextEmbeddingInference extends InferenceBase { + public async infer() { + try { + this.setRunning(); + const inputText = this.inputText$.value; + const payload = { + docs: { [this.inputField]: inputText }, + }; + const resp = (await this.trainedModelsApi.inferTrainedModel( + this.model.model_id, + payload, + '30s' + )) as unknown as RawTextEmbeddingResponse; + + const processedResponse: TextEmbeddingResponse = processResponse(resp, this.model, inputText); + this.inferenceResult$.next(processedResponse); + this.setFinished(); + + return processedResponse; + } catch (error) { + this.setFinishedWithErrors(error); + throw error; + } + } + + public getInputComponent(): JSX.Element { + return getGeneralInputComponent(this); + } + + public getOutputComponent(): JSX.Element { + return getTextEmbeddingOutputComponent(this); + } +} + +function processResponse( + resp: RawTextEmbeddingResponse, + model: estypes.MlTrainedModelConfig, + inputText: string +) { + const predictedValue = resp.predicted_value; + return { response: { predictedValue }, rawResponse: resp, inputText }; +} diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_output.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_output.tsx new file mode 100644 index 0000000000000..bb60140d39e68 --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_embedding/text_embedding_output.tsx @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import useObservable from 'react-use/lib/useObservable'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiTextArea, EuiCopy, EuiButton } from '@elastic/eui'; + +import type { TextEmbeddingInference } from './text_embedding_inference'; + +export const getTextEmbeddingOutputComponent = (inferrer: TextEmbeddingInference) => ( + +); + +const TextEmbeddingOutput: FC<{ + inferrer: TextEmbeddingInference; +}> = ({ inferrer }) => { + const result = useObservable(inferrer.inferenceResult$); + if (!result) { + return null; + } + + const value = result.response.predictedValue.toString(); + return ( + <> + + + {(copy) => ( + + + + )} + + + ); +}; diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.tsx new file mode 100644 index 0000000000000..a154bf97ef56b --- /dev/null +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/models/text_input.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 React, { FC, useState, useEffect } from 'react'; +import { i18n } from '@kbn/i18n'; +import useObservable from 'react-use/lib/useObservable'; +import { EuiTextArea } from '@elastic/eui'; +import { RUNNING_STATE } from './inference_base'; +import type { InferrerType } from '.'; + +export const TextInput: FC<{ + placeholder?: string; + inferrer: InferrerType; +}> = ({ placeholder, inferrer }) => { + const [inputText, setInputText] = useState(''); + + useEffect(() => { + inferrer.inputText$.next(inputText); + }, [inputText]); + + const runningState = useObservable(inferrer.runningState$); + + return ( + { + setInputText(e.target.value); + }} + /> + ); +}; + +export const getGeneralInputComponent = (inferrer: InferrerType, placeholder?: string) => ( + +); diff --git a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/selected_model.tsx b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/selected_model.tsx index 29dbb855b0084..50a5f9615d126 100644 --- a/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/selected_model.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/models_management/test_models/selected_model.tsx @@ -8,10 +8,17 @@ import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import React, { FC } from 'react'; -import { NerOutput, NerInference } from './models/ner'; -import type { FormattedNerResp } from './models/ner'; -import { LangIdentOutput, LangIdentInference } from './models/lang_ident'; -import type { FormattedLangIdentResp } from './models/lang_ident'; +import { NerInference } from './models/ner'; + +import { LangIdentInference } from './models/lang_ident'; + +import { + TextClassificationInference, + FillMaskInference, + ZeroShotClassificationInference, +} from './models/text_classification'; + +import { TextEmbeddingInference } from './models/text_embedding'; import { TRAINED_MODEL_TYPE, @@ -31,26 +38,37 @@ export const SelectedModel: FC = ({ model }) => { return null; } - if ( - model.model_type === TRAINED_MODEL_TYPE.PYTORCH && - Object.keys(model.inference_config)[0] === SUPPORTED_PYTORCH_TASKS.NER - ) { - const inferrer = new NerInference(trainedModels, model); - return ( - } - /> - ); + if (model.model_type === TRAINED_MODEL_TYPE.PYTORCH) { + if (Object.keys(model.inference_config)[0] === SUPPORTED_PYTORCH_TASKS.NER) { + const inferrer = new NerInference(trainedModels, model); + return ; + } + + if (Object.keys(model.inference_config)[0] === SUPPORTED_PYTORCH_TASKS.TEXT_CLASSIFICATION) { + const inferrer = new TextClassificationInference(trainedModels, model); + return ; + } + + if ( + Object.keys(model.inference_config)[0] === SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION + ) { + const inferrer = new ZeroShotClassificationInference(trainedModels, model); + return ; + } + + if (Object.keys(model.inference_config)[0] === SUPPORTED_PYTORCH_TASKS.TEXT_EMBEDDING) { + const inferrer = new TextEmbeddingInference(trainedModels, model); + return ; + } + + if (Object.keys(model.inference_config)[0] === SUPPORTED_PYTORCH_TASKS.FILL_MASK) { + const inferrer = new FillMaskInference(trainedModels, model); + return ; + } } if (model.model_type === TRAINED_MODEL_TYPE.LANG_IDENT) { const inferrer = new LangIdentInference(trainedModels, model); - return ( - } - /> - ); + return ; } return null; diff --git a/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts b/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts index 1b9a865dcfca9..ea18930cdec36 100644 --- a/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts @@ -45,4 +45,5 @@ export const pipelineSchema = schema.object({ export const inferTrainedModelQuery = schema.object({ timeout: schema.maybe(schema.string()) }); export const inferTrainedModelBody = schema.object({ docs: schema.any(), + inference_config: schema.maybe(schema.any()), }); diff --git a/x-pack/plugins/ml/server/routes/trained_models.ts b/x-pack/plugins/ml/server/routes/trained_models.ts index 27a062b45767c..731d159032d45 100644 --- a/x-pack/plugins/ml/server/routes/trained_models.ts +++ b/x-pack/plugins/ml/server/routes/trained_models.ts @@ -381,7 +381,12 @@ export function trainedModelsRoutes({ router, routeGuard }: RouteInitialization) const { modelId } = request.params; const body = await mlClient.inferTrainedModelDeployment({ model_id: modelId, - docs: request.body.docs, + body: { + docs: request.body.docs, + ...(request.body.inference_config + ? { inference_config: request.body.inference_config } + : {}), + }, ...(request.query.timeout ? { timeout: request.query.timeout } : {}), }); return response.ok({ diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 161eb996dcd8c..262515a21ffc8 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -19969,13 +19969,10 @@ "xpack.ml.trainedModels.testModelsFlyout.headerLabel": "学習済みモデルのテスト", "xpack.ml.trainedModels.testModelsFlyout.inferenceError": "エラーが発生しました", "xpack.ml.trainedModels.testModelsFlyout.langIdent.inputText": "入力テキスト", - "xpack.ml.trainedModels.testModelsFlyout.langIdent.markupTab": "アウトプット", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.language_title": "言語", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.probability_title": "確率", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.title": "これは{lang}のようになります", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.titleUnknown": "不明な言語コード:{code}", - "xpack.ml.trainedModels.testModelsFlyout.langIdent.rawOutput": "元の出力", - "xpack.ml.trainedModels.testModelsFlyout.langIdent.runButton": "テスト", "xpack.ml.trainedModels.testModelsFlyout.ner.output.probabilityTitle": "確率", "xpack.ml.trainedModels.testModelsFlyout.ner.output.typeTitle": "型", "xpack.ml.trainedModelsBreadcrumbs.nodeOverviewLabel": "ノード", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 7140c9b78accc..e3e90d584f15e 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -19999,13 +19999,10 @@ "xpack.ml.trainedModels.testModelsFlyout.headerLabel": "测试已训练模型", "xpack.ml.trainedModels.testModelsFlyout.inferenceError": "发生错误", "xpack.ml.trainedModels.testModelsFlyout.langIdent.inputText": "输入文本", - "xpack.ml.trainedModels.testModelsFlyout.langIdent.markupTab": "输出", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.language_title": "语言", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.probability_title": "可能性", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.title": "这像是 {lang}", "xpack.ml.trainedModels.testModelsFlyout.langIdent.output.titleUnknown": "语言代码未知:{code}", - "xpack.ml.trainedModels.testModelsFlyout.langIdent.rawOutput": "原始输出", - "xpack.ml.trainedModels.testModelsFlyout.langIdent.runButton": "测试", "xpack.ml.trainedModels.testModelsFlyout.ner.output.probabilityTitle": "可能性", "xpack.ml.trainedModels.testModelsFlyout.ner.output.typeTitle": "类型", "xpack.ml.trainedModelsBreadcrumbs.nodeOverviewLabel": "节点", From 3b07ec64b22393d324f00bb5fa2e1792e05755ec Mon Sep 17 00:00:00 2001 From: Josh Dover <1813008+joshdover@users.noreply.github.com> Date: Fri, 29 Apr 2022 14:08:27 +0200 Subject: [PATCH 11/89] [Fleet] Add APM instrumentation for package install process (#131223) --- .../services/epm/packages/_install_package.ts | 136 ++++++++---------- .../server/services/epm/packages/install.ts | 29 +++- .../server/services/epm/packages/utils.ts | 11 ++ .../server/services/epm/registry/index.ts | 93 ++++++------ 4 files changed, 153 insertions(+), 116 deletions(-) create mode 100644 x-pack/plugins/fleet/server/services/epm/packages/utils.ts diff --git a/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts b/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts index 34ada19685f83..796269eee38b1 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts @@ -42,11 +42,11 @@ import { packagePolicyService } from '../..'; import { createInstallation, saveKibanaAssetsRefs, updateVersion } from './install'; import { deleteKibanaSavedObjectsAssets } from './remove'; +import { withPackageSpan } from './utils'; // this is only exported for testing // use a leading underscore to indicate it's not the supported path // only the more explicit `installPackage*` functions should be used - export async function _installPackage({ savedObjectsClient, savedObjectsImporter, @@ -106,60 +106,46 @@ export async function _installPackage({ }); } - const kibanaAssets = await getKibanaAssets(paths); - if (installedPkg) await deleteKibanaSavedObjectsAssets({ savedObjectsClient, installedPkg }); - // save new kibana refs before installing the assets - const installedKibanaAssetsRefs = await saveKibanaAssetsRefs( - savedObjectsClient, - pkgName, - kibanaAssets - ); + const installedKibanaAssetsRefs = await withPackageSpan('Install Kibana assets', async () => { + const kibanaAssets = await getKibanaAssets(paths); + if (installedPkg) await deleteKibanaSavedObjectsAssets({ savedObjectsClient, installedPkg }); + // save new kibana refs before installing the assets + const assetRefs = await saveKibanaAssetsRefs(savedObjectsClient, pkgName, kibanaAssets); + + await installKibanaAssets({ + logger, + savedObjectsImporter, + pkgName, + kibanaAssets, + }); - await installKibanaAssets({ - logger, - savedObjectsImporter, - pkgName, - kibanaAssets, + return assetRefs; }); // the rest of the installation must happen in sequential order // currently only the base package has an ILM policy // at some point ILM policies can be installed/modified // per data stream and we should then save them - await installILMPolicy(packageInfo, paths, esClient, logger); + await withPackageSpan('Install ILM policies', () => + installILMPolicy(packageInfo, paths, esClient, logger) + ); - const installedDataStreamIlm = await installIlmForDataStream( - packageInfo, - paths, - esClient, - savedObjectsClient, - logger + const installedDataStreamIlm = await withPackageSpan('Install Data Stream ILM policies', () => + installIlmForDataStream(packageInfo, paths, esClient, savedObjectsClient, logger) ); // installs ml models - const installedMlModel = await installMlModel( - packageInfo, - paths, - esClient, - savedObjectsClient, - logger + const installedMlModel = await withPackageSpan('Install ML models', () => + installMlModel(packageInfo, paths, esClient, savedObjectsClient, logger) ); // installs versionized pipelines without removing currently installed ones - const installedPipelines = await installPipelines( - packageInfo, - paths, - esClient, - savedObjectsClient, - logger + const installedPipelines = await withPackageSpan('Install ingest pipelines', () => + installPipelines(packageInfo, paths, esClient, savedObjectsClient, logger) ); // install or update the templates referencing the newly installed pipelines - const installedTemplates = await installTemplates( - packageInfo, - esClient, - logger, - paths, - savedObjectsClient + const installedTemplates = await withPackageSpan('Install index templates', () => + installTemplates(packageInfo, esClient, logger, paths, savedObjectsClient) ); try { @@ -169,14 +155,12 @@ export async function _installPackage({ } // update current backing indices of each data stream - await updateCurrentWriteIndices(esClient, logger, installedTemplates); + await withPackageSpan('Update write indices', () => + updateCurrentWriteIndices(esClient, logger, installedTemplates) + ); - const installedTransforms = await installTransform( - packageInfo, - paths, - esClient, - savedObjectsClient, - logger + const installedTransforms = await withPackageSpan('Install transforms', () => + installTransform(packageInfo, paths, esClient, savedObjectsClient, logger) ); // If this is an update or retrying an update, delete the previous version's pipelines @@ -187,30 +171,36 @@ export async function _installPackage({ (installType === 'update' || installType === 'reupdate') && installedPkg ) { - await deletePreviousPipelines( - esClient, - savedObjectsClient, - pkgName, - installedPkg.attributes.version + await withPackageSpan('Delete previous ingest pipelines', () => + deletePreviousPipelines( + esClient, + savedObjectsClient, + pkgName, + installedPkg.attributes.version + ) ); } // pipelines from a different version may have installed during a failed update if (installType === 'rollback' && installedPkg) { - await deletePreviousPipelines( - esClient, - savedObjectsClient, - pkgName, - installedPkg.attributes.install_version + await await withPackageSpan('Delete previous ingest pipelines', () => + deletePreviousPipelines( + esClient, + savedObjectsClient, + pkgName, + installedPkg.attributes.install_version + ) ); } const installedTemplateRefs = getAllTemplateRefs(installedTemplates); - const packageAssetResults = await saveArchiveEntries({ - savedObjectsClient, - paths, - packageInfo, - installSource, - }); + const packageAssetResults = await withPackageSpan('Update archive entries', () => + saveArchiveEntries({ + savedObjectsClient, + paths, + packageInfo, + installSource, + }) + ); const packageAssetRefs: PackageAssetReference[] = packageAssetResults.saved_objects.map( (result) => ({ id: result.id, @@ -221,26 +211,26 @@ export async function _installPackage({ // update to newly installed version when all assets are successfully installed if (installedPkg) await updateVersion(savedObjectsClient, pkgName, pkgVersion); - const updatedPackage = await savedObjectsClient.update( - PACKAGES_SAVED_OBJECT_TYPE, - pkgName, - { + const updatedPackage = await withPackageSpan('Update install status', () => + savedObjectsClient.update(PACKAGES_SAVED_OBJECT_TYPE, pkgName, { install_version: pkgVersion, install_status: 'installed', package_assets: packageAssetRefs, - } + }) ); // If the package is flagged with the `keep_policies_up_to_date` flag, upgrade its // associated package policies after installation if (updatedPackage.attributes.keep_policies_up_to_date) { - const policyIdsToUpgrade = await packagePolicyService.listIds(savedObjectsClient, { - page: 1, - perPage: SO_SEARCH_LIMIT, - kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name:${pkgName}`, - }); + await withPackageSpan('Upgrade package policies', async () => { + const policyIdsToUpgrade = await packagePolicyService.listIds(savedObjectsClient, { + page: 1, + perPage: SO_SEARCH_LIMIT, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name:${pkgName}`, + }); - await packagePolicyService.upgrade(savedObjectsClient, esClient, policyIdsToUpgrade.items); + await packagePolicyService.upgrade(savedObjectsClient, esClient, policyIdsToUpgrade.items); + }); } return [ diff --git a/x-pack/plugins/fleet/server/services/epm/packages/install.ts b/x-pack/plugins/fleet/server/services/epm/packages/install.ts index 3ecec951dde7e..9ae549982399c 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/install.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/install.ts @@ -5,6 +5,7 @@ * 2.0. */ +import apm from 'elastic-apm-node'; import { i18n } from '@kbn/i18n'; import semverLt from 'semver/functions/lt'; import type Boom from '@hapi/boom'; @@ -250,6 +251,10 @@ async function installPackageFromRegistry({ // TODO: change epm API to /packageName/version so we don't need to do this const { pkgName, pkgVersion } = Registry.splitPkgKey(pkgkey); + // Workaround apm issue with async spans: https://github.com/elastic/apm-agent-nodejs/issues/2611 + await Promise.resolve(); + const span = apm.startSpan(`Install package from registry ${pkgName}@${pkgVersion}`, 'package'); + // if an error happens during getInstallType, report that we don't know let installType: InstallType = 'unknown'; @@ -260,6 +265,12 @@ async function installPackageFromRegistry({ const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); installType = getInstallType({ pkgVersion, installedPkg }); + span?.addLabels({ + packageName: pkgName, + packageVersion: pkgVersion, + installType, + }); + // get latest package version const latestPackage = await Registry.fetchFindLatestPackageOrThrow(pkgName, { ignoreConstraints, @@ -326,7 +337,7 @@ async function installPackageFromRegistry({ // try installing the package, if there was an error, call error handler and rethrow // @ts-expect-error status is string instead of InstallResult.status 'installed' | 'already_installed' - return _installPackage({ + return await _installPackage({ savedObjectsClient, savedObjectsImporter, esClient, @@ -377,6 +388,8 @@ async function installPackageFromRegistry({ installType, installSource: 'registry', }; + } finally { + span?.end(); } } @@ -395,6 +408,10 @@ async function installPackageByUpload({ contentType, spaceId, }: InstallUploadedArchiveParams): Promise { + // Workaround apm issue with async spans: https://github.com/elastic/apm-agent-nodejs/issues/2611 + await Promise.resolve(); + const span = apm.startSpan(`Install package from upload`, 'package'); + const logger = appContextService.getLogger(); // if an error happens during getInstallType, report that we don't know let installType: InstallType = 'unknown'; @@ -409,6 +426,12 @@ async function installPackageByUpload({ installType = getInstallType({ pkgVersion: packageInfo.version, installedPkg }); + span?.addLabels({ + packageName: packageInfo.name, + packageVersion: packageInfo.version, + installType, + }); + telemetryEvent.packageName = packageInfo.name; telemetryEvent.newVersion = packageInfo.version; telemetryEvent.installType = installType; @@ -434,7 +457,7 @@ async function installPackageByUpload({ .createImporter(savedObjectsClient); // @ts-expect-error status is string instead of InstallResult.status 'installed' | 'already_installed' - return _installPackage({ + return await _installPackage({ savedObjectsClient, savedObjectsImporter, esClient, @@ -466,6 +489,8 @@ async function installPackageByUpload({ errorMessage: e.message, }); return { error: e, installType, installSource: 'upload' }; + } finally { + span?.end(); } } diff --git a/x-pack/plugins/fleet/server/services/epm/packages/utils.ts b/x-pack/plugins/fleet/server/services/epm/packages/utils.ts new file mode 100644 index 0000000000000..0cb97ca007daf --- /dev/null +++ b/x-pack/plugins/fleet/server/services/epm/packages/utils.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { withSpan } from '@kbn/apm-utils'; + +export const withPackageSpan = (stepName: string, func: () => Promise) => + withSpan({ name: stepName, type: 'package' }, func); diff --git a/x-pack/plugins/fleet/server/services/epm/registry/index.ts b/x-pack/plugins/fleet/server/services/epm/registry/index.ts index 182f20297afd5..2ae531f63379d 100644 --- a/x-pack/plugins/fleet/server/services/epm/registry/index.ts +++ b/x-pack/plugins/fleet/server/services/epm/registry/index.ts @@ -37,6 +37,8 @@ import { PackageNotFoundError, PackageCacheError, RegistryResponseError } from ' import { getBundledPackageByName } from '../packages/bundled_packages'; +import { withPackageSpan } from '../packages/utils'; + import { fetchUrl, getResponse, getResponseStream } from './requests'; import { getRegistryUrl } from './registry_url'; @@ -75,42 +77,44 @@ async function _fetchFindLatestPackage( packageName: string, options?: FetchFindLatestPackageOptions ) { - const logger = appContextService.getLogger(); - const { ignoreConstraints = false } = options ?? {}; + return withPackageSpan(`Find latest package ${packageName}`, async () => { + const logger = appContextService.getLogger(); + const { ignoreConstraints = false } = options ?? {}; - const bundledPackage = await getBundledPackageByName(packageName); + const bundledPackage = await getBundledPackageByName(packageName); - const registryUrl = getRegistryUrl(); - const url = new URL(`${registryUrl}/search?package=${packageName}&experimental=true`); + const registryUrl = getRegistryUrl(); + const url = new URL(`${registryUrl}/search?package=${packageName}&experimental=true`); - if (!ignoreConstraints) { - setKibanaVersion(url); - } + if (!ignoreConstraints) { + setKibanaVersion(url); + } - try { - const res = await fetchUrl(url.toString(), 1); - const searchResults: RegistryPackage[] = JSON.parse(res); + try { + const res = await fetchUrl(url.toString(), 1); + const searchResults: RegistryPackage[] = JSON.parse(res); - const latestPackageFromRegistry = searchResults[0] ?? null; + const latestPackageFromRegistry = searchResults[0] ?? null; - if (bundledPackage && semverGte(bundledPackage.version, latestPackageFromRegistry.version)) { - return bundledPackage; - } + if (bundledPackage && semverGte(bundledPackage.version, latestPackageFromRegistry.version)) { + return bundledPackage; + } - return latestPackageFromRegistry; - } catch (error) { - logger.error( - `Failed to fetch latest version of ${packageName} from registry: ${error.message}` - ); + return latestPackageFromRegistry; + } catch (error) { + logger.error( + `Failed to fetch latest version of ${packageName} from registry: ${error.message}` + ); - // Fall back to the bundled version of the package if it exists - if (bundledPackage) { - return bundledPackage; - } + // Fall back to the bundled version of the package if it exists + if (bundledPackage) { + return bundledPackage; + } - // Otherwise, return null and allow callers to determine whether they'll consider this an error or not - return null; - } + // Otherwise, return null and allow callers to determine whether they'll consider this an error or not + return null; + } + }); } export async function fetchFindLatestPackageOrThrow( @@ -207,12 +211,14 @@ export async function fetchCategories( } export async function getInfo(name: string, version: string) { - let packageInfo = getPackageInfo({ name, version }); - if (!packageInfo) { - packageInfo = await fetchInfo(name, version); - setPackageInfo({ name, version, packageInfo }); - } - return packageInfo as RegistryPackage; + return withPackageSpan('Fetch package info', async () => { + let packageInfo = getPackageInfo({ name, version }); + if (!packageInfo) { + packageInfo = await fetchInfo(name, version); + setPackageInfo({ name, version, packageInfo }); + } + return packageInfo as RegistryPackage; + }); } export async function getRegistryPackage( @@ -222,14 +228,19 @@ export async function getRegistryPackage( const installSource = 'registry'; let paths = getArchiveFilelist({ name, version }); if (!paths || paths.length === 0) { - const { archiveBuffer, archivePath } = await fetchArchiveBuffer(name, version); - paths = await unpackBufferToCache({ - name, - version, - installSource, - archiveBuffer, - contentType: ensureContentType(archivePath), - }); + const { archiveBuffer, archivePath } = await withPackageSpan( + 'Fetch package archive from registry', + () => fetchArchiveBuffer(name, version) + ); + paths = await withPackageSpan('Unpack archive', () => + unpackBufferToCache({ + name, + version, + installSource, + archiveBuffer, + contentType: ensureContentType(archivePath), + }) + ); } const packageInfo = await getInfo(name, version); From d124a4d17c0344018d5fd8889f5cf6a20ac58e4b Mon Sep 17 00:00:00 2001 From: mgiota Date: Fri, 29 Apr 2022 14:28:51 +0200 Subject: [PATCH 12/89] [Actionable Observability] Consume rules dropdown with fixed tests (#131108) * consume shareable status dropdown from triggers_actions_ui plugin * add getRuleStatusDropdown to triggersActionsUiStartMock * remove unused interval --- ...observability_public_plugins_start.mock.ts | 1 + .../public/pages/rules/components/status.tsx | 34 ------ .../pages/rules/components/status_context.tsx | 103 ------------------ .../public/pages/rules/index.tsx | 27 +++-- 4 files changed, 14 insertions(+), 151 deletions(-) delete mode 100644 x-pack/plugins/observability/public/pages/rules/components/status.tsx delete mode 100644 x-pack/plugins/observability/public/pages/rules/components/status_context.tsx diff --git a/x-pack/plugins/observability/public/observability_public_plugins_start.mock.ts b/x-pack/plugins/observability/public/observability_public_plugins_start.mock.ts index 7e5ad089cd50f..930b75f578eb1 100644 --- a/x-pack/plugins/observability/public/observability_public_plugins_start.mock.ts +++ b/x-pack/plugins/observability/public/observability_public_plugins_start.mock.ts @@ -36,6 +36,7 @@ const triggersActionsUiStartMock = { createStart() { return { getAddAlertFlyout: jest.fn(), + getRuleStatusDropdown: jest.fn(), getRuleTagBadge: jest.fn(), ruleTypeRegistry: { has: jest.fn(), diff --git a/x-pack/plugins/observability/public/pages/rules/components/status.tsx b/x-pack/plugins/observability/public/pages/rules/components/status.tsx deleted file mode 100644 index 612d6f8f30bdd..0000000000000 --- a/x-pack/plugins/observability/public/pages/rules/components/status.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, { useMemo } from 'react'; -import { EuiBadge } from '@elastic/eui'; -import { noop } from 'lodash/fp'; -import { StatusProps } from '../types'; -import { statusMap } from '../config'; -import { RULES_CHANGE_STATUS } from '../translations'; - -export function Status({ type, disabled, onClick }: StatusProps) { - const props = useMemo( - () => ({ - color: statusMap[type].color, - ...(!disabled ? { onClick } : { onClick: noop }), - ...(!disabled ? { iconType: 'arrowDown', iconSide: 'right' as const } : {}), - ...(!disabled ? { iconOnClick: onClick } : { iconOnClick: noop }), - }), - [disabled, onClick, type] - ); - return ( - - {statusMap[type].label} - - ); -} diff --git a/x-pack/plugins/observability/public/pages/rules/components/status_context.tsx b/x-pack/plugins/observability/public/pages/rules/components/status_context.tsx deleted file mode 100644 index c7bd29d85b17a..0000000000000 --- a/x-pack/plugins/observability/public/pages/rules/components/status_context.tsx +++ /dev/null @@ -1,103 +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, { useState, useCallback, useMemo } from 'react'; -import { - EuiPopover, - EuiContextMenuItem, - EuiContextMenuPanel, - EuiLoadingSpinner, -} from '@elastic/eui'; -import { Status } from './status'; -import { RuleStatus, StatusContextProps } from '../types'; -import { statusMap } from '../config'; - -export function StatusContext({ - item, - disabled = false, - onStatusChanged, - enableRule, - disableRule, - muteRule, - unMuteRule, -}: StatusContextProps) { - const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const [isUpdating, setIsUpdating] = useState(false); - const togglePopover = useCallback(() => setIsPopoverOpen(!isPopoverOpen), [isPopoverOpen]); - - let currentStatus: RuleStatus; - if (item.enabled) { - currentStatus = item.muteAll ? RuleStatus.snoozed : RuleStatus.enabled; - } else { - currentStatus = RuleStatus.disabled; - } - const popOverButton = useMemo( - () => , - [disabled, currentStatus, togglePopover] - ); - - const onContextMenuItemClick = useCallback( - async (status: RuleStatus) => { - togglePopover(); - if (currentStatus !== status) { - setIsUpdating(true); - - if (status === RuleStatus.enabled) { - await enableRule({ ...item, enabled: true }); - if (item.muteAll) { - await unMuteRule({ ...item, muteAll: false }); - } - } else if (status === RuleStatus.disabled) { - await disableRule({ ...item, enabled: false }); - } else if (status === RuleStatus.snoozed) { - await muteRule({ ...item, muteAll: true }); - } - setIsUpdating(false); - onStatusChanged(status); - } - }, - [ - item, - togglePopover, - enableRule, - disableRule, - muteRule, - unMuteRule, - currentStatus, - onStatusChanged, - ] - ); - - const panelItems = useMemo( - () => - Object.values(RuleStatus).map((status: RuleStatus) => ( - onContextMenuItemClick(status)} - disabled={status === RuleStatus.snoozed && currentStatus === RuleStatus.disabled} - > - {statusMap[status].label} - - )), - [currentStatus, onContextMenuItemClick] - ); - - return isUpdating ? ( - - ) : ( - setIsPopoverOpen(false)} - anchorPosition="downLeft" - isOpen={isPopoverOpen} - panelPaddingSize="none" - > - - - ); -} diff --git a/x-pack/plugins/observability/public/pages/rules/index.tsx b/x-pack/plugins/observability/public/pages/rules/index.tsx index b33b252cbecc7..dd8829937a876 100644 --- a/x-pack/plugins/observability/public/pages/rules/index.tsx +++ b/x-pack/plugins/observability/public/pages/rules/index.tsx @@ -25,9 +25,9 @@ import { RuleTableItem, enableRule, disableRule, - muteRule, + snoozeRule, useLoadRuleTypes, - unmuteRule, + unsnoozeRule, } from '@kbn/triggers-actions-ui-plugin/public'; import { RuleExecutionStatus, ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common'; import { usePluginContext } from '../../hooks/use_plugin_context'; @@ -38,7 +38,6 @@ import { RulesTable } from './components/rules_table'; import { Name } from './components/name'; import { LastResponseFilter } from './components/last_response_filter'; import { TypeFilter } from './components/type_filter'; -import { StatusContext } from './components/status_context'; import { ExecutionStatus } from './components/execution_status'; import { LastRun } from './components/last_run'; import { EditRuleFlyout } from './components/edit_rule_flyout'; @@ -211,17 +210,17 @@ export function RulesPage() { name: STATUS_COLUMN_TITLE, sortable: true, render: (_enabled: boolean, item: RuleTableItem) => { - return ( - reload()} - enableRule={async () => await enableRule({ http, id: item.id })} - disableRule={async () => await disableRule({ http, id: item.id })} - muteRule={async () => await muteRule({ http, id: item.id })} - unMuteRule={async () => await unmuteRule({ http, id: item.id })} - /> - ); + return triggersActionsUi.getRuleStatusDropdown({ + rule: item, + enableRule: async () => await enableRule({ http, id: item.id }), + disableRule: async () => await disableRule({ http, id: item.id }), + onRuleChanged: () => reload(), + isEditable: item.isEditable && isRuleTypeEditableInContext(item.ruleTypeId), + snoozeRule: async (snoozeEndTime: string | -1) => { + await snoozeRule({ http, id: item.id, snoozeEndTime }); + }, + unsnoozeRule: async () => await unsnoozeRule({ http, id: item.id }), + }); }, }, { From e1bd7da1d1f782845a5d1d09679402106b5fffc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Kopyci=C5=84ski?= Date: Fri, 29 Apr 2022 14:53:50 +0200 Subject: [PATCH 13/89] [Osquery] Refactor ECS editor field (#130582) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../node_details/tabs/osquery/index.tsx | 2 +- .../osquery/common/schemas/common/utils.ts | 39 + .../all/delete_all_ecs_mappings.spec.ts | 5 +- .../integration/all/live_query.spec.ts | 8 +- .../cypress/integration/all/packs.spec.ts | 10 +- .../integration/roles/t1_analyst.spec.ts | 2 +- .../integration/roles/t2_analyst.spec.ts | 5 +- .../osquery/cypress/tasks/live_query.ts | 21 +- .../action_results/use_action_results.ts | 4 +- .../public/actions/use_action_details.ts | 4 +- .../osquery/public/actions/use_all_actions.ts | 4 +- .../osquery/public/agents/agents_table.tsx | 46 +- .../plugins/osquery/public/agents/helpers.ts | 12 +- .../osquery/public/agents/use_agent_groups.ts | 111 +- .../osquery/public/agents/use_all_agents.ts | 26 +- .../public/agents/use_osquery_policies.ts | 8 +- .../public/live_queries/form/index.tsx | 179 ++-- .../public/live_queries/form/schema.ts | 18 - .../osquery/public/live_queries/index.tsx | 5 +- .../queries/ecs_mapping_editor_field.tsx | 970 ++++++++---------- .../queries/lazy_ecs_mapping_editor_field.tsx | 7 +- .../public/packs/queries/query_flyout.tsx | 87 +- .../osquery/public/packs/queries/schema.tsx | 2 +- .../packs/queries/use_pack_query_form.tsx | 33 +- .../osquery/public/results/results_table.tsx | 49 +- .../osquery/public/results/use_all_results.ts | 4 +- .../public/routes/saved_queries/edit/form.tsx | 8 +- .../public/routes/saved_queries/new/form.tsx | 8 +- .../public/saved_queries/form/index.tsx | 221 ++-- .../saved_queries/form/playground_flyout.tsx | 11 +- .../form/use_saved_query_form.tsx | 36 +- .../saved_queries/saved_queries_dropdown.tsx | 14 +- .../saved_queries/saved_query_flyout.tsx | 8 +- .../osquery_action/index.tsx | 31 +- .../plugins/osquery/public/shared_imports.ts | 2 + .../translations/translations/fr-FR.json | 3 - .../translations/translations/ja-JP.json | 3 - .../translations/translations/zh-CN.json | 3 - 38 files changed, 904 insertions(+), 1105 deletions(-) create mode 100644 x-pack/plugins/osquery/common/schemas/common/utils.ts delete mode 100644 x-pack/plugins/osquery/public/live_queries/form/schema.ts diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx index 1bd6cfd353140..ce023064edee1 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/osquery/index.tsx @@ -48,7 +48,7 @@ const TabComponent = (props: TabProps) => { return ( - + ); }, [OsqueryAction, loading, metadata]); diff --git a/x-pack/plugins/osquery/common/schemas/common/utils.ts b/x-pack/plugins/osquery/common/schemas/common/utils.ts new file mode 100644 index 0000000000000..95b2bdd7a4050 --- /dev/null +++ b/x-pack/plugins/osquery/common/schemas/common/utils.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { isEmpty, reduce } from 'lodash'; + +export const convertECSMappingToArray = (ecsMapping: Record | undefined) => + ecsMapping + ? Object.entries(ecsMapping).map((item) => ({ + key: item[0], + value: item[1], + })) + : undefined; + +export const convertECSMappingToObject = ( + ecsMapping: Array<{ + key: string; + result: { + type: string; + value: string; + }; + }> +): Record => + reduce( + ecsMapping, + (acc, value) => { + if (!isEmpty(value?.key) && !isEmpty(value.result?.type) && !isEmpty(value.result?.value)) { + acc[value.key] = { + [value.result.type]: value.result.value, + }; + } + + return acc; + }, + {} as Record + ); diff --git a/x-pack/plugins/osquery/cypress/integration/all/delete_all_ecs_mappings.spec.ts b/x-pack/plugins/osquery/cypress/integration/all/delete_all_ecs_mappings.spec.ts index dab935d919a28..1ce25a77f834a 100644 --- a/x-pack/plugins/osquery/cypress/integration/all/delete_all_ecs_mappings.spec.ts +++ b/x-pack/plugins/osquery/cypress/integration/all/delete_all_ecs_mappings.spec.ts @@ -31,7 +31,10 @@ describe('ALL - Delete ECS Mappings', () => { }).click(); cy.contains('Custom key/value pairs.').should('exist'); cy.contains('Hours of uptime').should('exist'); - cy.react('EuiButtonIcon', { props: { id: 'labels-trash' } }).click(); + cy.react('ECSComboboxFieldComponent', { props: { field: { value: 'labels' } } }) + .parents('[data-test-subj="ECSMappingEditorForm"]') + .react('EuiButtonIcon', { props: { iconType: 'trash' } }) + .click(); cy.react('EuiButton').contains('Update query').click(); cy.wait(5000); diff --git a/x-pack/plugins/osquery/cypress/integration/all/live_query.spec.ts b/x-pack/plugins/osquery/cypress/integration/all/live_query.spec.ts index 6a9d102784a58..7cdc55c014505 100644 --- a/x-pack/plugins/osquery/cypress/integration/all/live_query.spec.ts +++ b/x-pack/plugins/osquery/cypress/integration/all/live_query.spec.ts @@ -61,10 +61,8 @@ describe('ALL - Live Query', () => { }).should('exist'); cy.react(RESULTS_TABLE_CELL_WRRAPER, { props: { id: 'osquery.days.number', index: 2 }, - }).within(() => { - cy.get('.euiToolTipAnchor').within(() => { - cy.get('svg').should('exist'); - }); - }); + }) + .react('EuiIconTip', { props: { type: 'indexMapping' } }) + .should('exist'); }); }); diff --git a/x-pack/plugins/osquery/cypress/integration/all/packs.spec.ts b/x-pack/plugins/osquery/cypress/integration/all/packs.spec.ts index 255dabbc433b0..917147fe88457 100644 --- a/x-pack/plugins/osquery/cypress/integration/all/packs.spec.ts +++ b/x-pack/plugins/osquery/cypress/integration/all/packs.spec.ts @@ -55,7 +55,7 @@ describe('ALL - Packs', () => { cy.react('List').first().click(); findAndClickButton('Add query'); cy.contains('Attach next query'); - getSavedQueriesDropdown().click().type(`${SAVED_QUERY_ID}{downArrow}{enter}`); + getSavedQueriesDropdown().type(`${SAVED_QUERY_ID}{downArrow}{enter}`); cy.react('EuiFormRow', { props: { label: 'Interval (s)' } }) .click() .clear() @@ -92,7 +92,7 @@ describe('ALL - Packs', () => { findAndClickButton('Add query'); cy.contains('Attach next query'); cy.contains('ID must be unique').should('not.exist'); - getSavedQueriesDropdown().click().type(`${SAVED_QUERY_ID}{downArrow}{enter}`); + getSavedQueriesDropdown().type(`${SAVED_QUERY_ID}{downArrow}{enter}`); cy.contains('ID must be unique').should('exist'); cy.react('EuiFlyoutFooter').react('EuiButtonEmpty').contains('Cancel').click(); }); @@ -170,7 +170,7 @@ describe('ALL - Packs', () => { findAndClickButton('Add query'); - getSavedQueriesDropdown().click().type('Multiple {downArrow} {enter}'); + getSavedQueriesDropdown().type('Multiple {downArrow} {enter}'); cy.contains('Custom key/value pairs'); cy.contains('Days of uptime'); cy.contains('List of keywords used to tag each'); @@ -178,7 +178,7 @@ describe('ALL - Packs', () => { cy.contains('Client network address.'); cy.contains('Total uptime seconds'); - getSavedQueriesDropdown().click().type('NOMAPPING {downArrow} {enter}'); + getSavedQueriesDropdown().type('NOMAPPING {downArrow} {enter}'); cy.contains('Custom key/value pairs').should('not.exist'); cy.contains('Days of uptime').should('not.exist'); cy.contains('List of keywords used to tag each').should('not.exist'); @@ -186,7 +186,7 @@ describe('ALL - Packs', () => { cy.contains('Client network address.').should('not.exist'); cy.contains('Total uptime seconds').should('not.exist'); - getSavedQueriesDropdown().click().type('ONE_MAPPING {downArrow} {enter}'); + getSavedQueriesDropdown().type('ONE_MAPPING {downArrow} {enter}'); cy.contains('Name of the continent'); cy.contains('Seconds of uptime'); diff --git a/x-pack/plugins/osquery/cypress/integration/roles/t1_analyst.spec.ts b/x-pack/plugins/osquery/cypress/integration/roles/t1_analyst.spec.ts index 64d72c92dda04..51270332e0a51 100644 --- a/x-pack/plugins/osquery/cypress/integration/roles/t1_analyst.spec.ts +++ b/x-pack/plugins/osquery/cypress/integration/roles/t1_analyst.spec.ts @@ -60,7 +60,7 @@ describe('T1 Analyst - READ + runSavedQueries ', () => { cy.waitForReact(1000); cy.contains('New live query').should('not.be.disabled').click(); selectAllAgents(); - getSavedQueriesDropdown().click().type(`${SAVED_QUERY_ID}{downArrow} {enter}`); + getSavedQueriesDropdown().type(`${SAVED_QUERY_ID}{downArrow} {enter}`); cy.contains('select * from uptime'); submitQuery(); checkResults(); diff --git a/x-pack/plugins/osquery/cypress/integration/roles/t2_analyst.spec.ts b/x-pack/plugins/osquery/cypress/integration/roles/t2_analyst.spec.ts index 619865e50bb6b..28a8f8a7880ac 100644 --- a/x-pack/plugins/osquery/cypress/integration/roles/t2_analyst.spec.ts +++ b/x-pack/plugins/osquery/cypress/integration/roles/t2_analyst.spec.ts @@ -104,7 +104,10 @@ describe('T2 Analyst - READ + Write Live/Saved + runSavedQueries ', () => { }).click(); cy.contains('Custom key/value pairs.').should('exist'); cy.contains('Hours of uptime').should('exist'); - cy.react('EuiButtonIcon', { props: { id: 'labels-trash' } }).click(); + cy.react('ECSComboboxFieldComponent', { props: { field: { value: 'labels' } } }) + .parents('[data-test-subj="ECSMappingEditorForm"]') + .react('EuiButtonIcon', { props: { iconType: 'trash' } }) + .click(); cy.react('EuiButton').contains('Update query').click(); cy.wait(5000); diff --git a/x-pack/plugins/osquery/cypress/tasks/live_query.ts b/x-pack/plugins/osquery/cypress/tasks/live_query.ts index 7bdc1d3fc3cf3..ca232d8507d2a 100644 --- a/x-pack/plugins/osquery/cypress/tasks/live_query.ts +++ b/x-pack/plugins/osquery/cypress/tasks/live_query.ts @@ -8,17 +8,15 @@ import { LIVE_QUERY_EDITOR } from '../screens/live_query'; export const DEFAULT_QUERY = 'select * from processes;'; -export const BIG_QUERY = 'select * from processes, users;'; +export const BIG_QUERY = 'select * from processes, users limit 200;'; export const selectAllAgents = () => { - cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }) - .find('input') - .should('not.be.disabled'); - cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }).click(); + cy.react('AgentsTable').find('input').should('not.be.disabled'); + cy.react('AgentsTable EuiComboBox', { + props: { placeholder: 'Select agents or groups' }, + }).click(); cy.react('EuiFilterSelectItem').contains('All agents').should('exist'); - cy.react('EuiComboBox', { props: { placeholder: 'Select agents or groups' } }).type( - '{downArrow}{enter}{esc}' - ); + cy.react('AgentsTable EuiComboBox').type('{downArrow}{enter}{esc}'); cy.contains('1 agent selected.'); }; @@ -27,12 +25,11 @@ export const inputQuery = (query: string) => cy.get(LIVE_QUERY_EDITOR).type(quer export const submitQuery = () => cy.contains('Submit').click(); export const checkResults = () => - cy.getBySel('dataGridRowCell', { timeout: 60000 }).should('have.lengthOf.above', 0); + cy.getBySel('dataGridRowCell', { timeout: 120000 }).should('have.lengthOf.above', 0); -export const typeInECSFieldInput = (text: string) => - cy.getBySel('ECS-field-input').click().type(text); +export const typeInECSFieldInput = (text: string) => cy.getBySel('ECS-field-input').type(text); export const typeInOsqueryFieldInput = (text: string) => - cy.react('OsqueryColumnFieldComponent').first().react('ResultComboBox').click().type(text); + cy.react('OsqueryColumnFieldComponent').first().react('ResultComboBox').type(text); export const findFormFieldByRowsLabelAndType = (label: string, text: string) => { cy.react('EuiFormRow', { props: { label } }).type(text); diff --git a/x-pack/plugins/osquery/public/action_results/use_action_results.ts b/x-pack/plugins/osquery/public/action_results/use_action_results.ts index e567c7ccdb635..d8dd3186238f7 100644 --- a/x-pack/plugins/osquery/public/action_results/use_action_results.ts +++ b/x-pack/plugins/osquery/public/action_results/use_action_results.ts @@ -9,7 +9,7 @@ import { flatten, reverse, uniqBy } from 'lodash/fp'; import { useQuery } from 'react-query'; import { i18n } from '@kbn/i18n'; -import { firstValueFrom } from 'rxjs'; +import { lastValueFrom } from 'rxjs'; import { createFilter, getInspectResponse, @@ -68,7 +68,7 @@ export const useActionResults = ({ return useQuery( ['actionResults', { actionId }], async () => { - const responseData = await firstValueFrom( + const responseData = await lastValueFrom( data.search.search( { actionId, diff --git a/x-pack/plugins/osquery/public/actions/use_action_details.ts b/x-pack/plugins/osquery/public/actions/use_action_details.ts index 1a6550d8f47dd..32b8d4578cb77 100644 --- a/x-pack/plugins/osquery/public/actions/use_action_details.ts +++ b/x-pack/plugins/osquery/public/actions/use_action_details.ts @@ -8,7 +8,7 @@ import { useQuery } from 'react-query'; import { i18n } from '@kbn/i18n'; -import { firstValueFrom } from 'rxjs'; +import { lastValueFrom } from 'rxjs'; import { createFilter } from '../common/helpers'; import { useKibana } from '../common/lib/kibana'; import { @@ -37,7 +37,7 @@ export const useActionDetails = ({ actionId, filterQuery, skip = false }: UseAct return useQuery( ['actionDetails', { actionId, filterQuery }], async () => { - const responseData = await firstValueFrom( + const responseData = await lastValueFrom( data.search.search( { actionId, diff --git a/x-pack/plugins/osquery/public/actions/use_all_actions.ts b/x-pack/plugins/osquery/public/actions/use_all_actions.ts index d1fe00c81a0b5..34a25fa47b6e9 100644 --- a/x-pack/plugins/osquery/public/actions/use_all_actions.ts +++ b/x-pack/plugins/osquery/public/actions/use_all_actions.ts @@ -8,7 +8,7 @@ import { useQuery } from 'react-query'; import { i18n } from '@kbn/i18n'; -import { firstValueFrom } from 'rxjs'; +import { lastValueFrom } from 'rxjs'; import { createFilter, generateTablePaginationOptions, @@ -60,7 +60,7 @@ export const useAllActions = ({ return useQuery( ['actions', { activePage, direction, limit, sortField }], async () => { - const responseData = await firstValueFrom( + const responseData = await lastValueFrom( data.search.search( { factoryQueryType: OsqueryQueries.actions, diff --git a/x-pack/plugins/osquery/public/agents/agents_table.tsx b/x-pack/plugins/osquery/public/agents/agents_table.tsx index 55e63456fe916..75d073c4d9292 100644 --- a/x-pack/plugins/osquery/public/agents/agents_table.tsx +++ b/x-pack/plugins/osquery/public/agents/agents_table.tsx @@ -6,13 +6,13 @@ */ import { find } from 'lodash/fp'; -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { EuiComboBox, EuiHealth, EuiHighlight, EuiSpacer } from '@elastic/eui'; +import deepEqual from 'fast-deep-equal'; import useDebounce from 'react-use/lib/useDebounce'; import { useAllAgents } from './use_all_agents'; import { useAgentGroups } from './use_agent_groups'; -import { useOsqueryPolicies } from './use_osquery_policies'; import { AgentGrouper } from './agent_grouper'; import { getNumAgentsInGrouping, @@ -61,19 +61,16 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh ); // grouping related - const osqueryPolicyData = useOsqueryPolicies(); const { - loading: groupsLoading, - totalCount: totalNumAgents, - groups, + isLoading: groupsLoading, + data: agentGroupsData, isFetched: groupsFetched, - } = useAgentGroups(osqueryPolicyData); - const grouper = useMemo(() => new AgentGrouper(), []); + } = useAgentGroups(); const { isLoading: agentsLoading, data: agents, isFetched: agentsFetched, - } = useAllAgents(osqueryPolicyData, debouncedSearchValue, { + } = useAllAgents(debouncedSearchValue, { perPage, }); @@ -96,7 +93,7 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh selectedGroups: SelectedGroups; } = generateAgentSelection(selection); if (newAgentSelection.allAgentsSelected) { - setNumAgentsSelected(totalNumAgents); + setNumAgentsSelected(agentGroupsData?.totalCount ?? 0); } else { const checkAgent = generateAgentCheck(selectedGroups); setNumAgentsSelected( @@ -105,14 +102,14 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh // add the number of agents added via policy and platform groups getNumAgentsInGrouping(selectedGroups) - // subtract the number of agents double counted by policy/platform selections - getNumOverlapped(selectedGroups, groups.overlap) + getNumOverlapped(selectedGroups, agentGroupsData?.groups?.overlap ?? {}) ); } onChange(newAgentSelection); setSelectedOptions(selection); }, - [groups, onChange, totalNumAgents] + [agentGroupsData, onChange] ); useEffect(() => { @@ -154,26 +151,18 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh }, [agentSelection, onSelection, options, selectedOptions]); useEffect(() => { - if (agentsFetched && groupsFetched) { + if (agentsFetched && groupsFetched && agentGroupsData) { + const grouper = new AgentGrouper(); // update the groups when groups or agents have changed - grouper.setTotalAgents(totalNumAgents); - grouper.updateGroup(AGENT_GROUP_KEY.Platform, groups.platforms); - grouper.updateGroup(AGENT_GROUP_KEY.Policy, groups.policies); + grouper.setTotalAgents(agentGroupsData?.totalCount); + grouper.updateGroup(AGENT_GROUP_KEY.Platform, agentGroupsData?.groups.platforms); + grouper.updateGroup(AGENT_GROUP_KEY.Policy, agentGroupsData?.groups.policies); // @ts-expect-error update types grouper.updateGroup(AGENT_GROUP_KEY.Agent, agents); const newOptions = grouper.generateOptions(); - setOptions(newOptions); + setOptions((prevOptions) => (!deepEqual(prevOptions, newOptions) ? newOptions : prevOptions)); } - }, [ - groups.platforms, - groups.policies, - totalNumAgents, - groupsLoading, - agents, - agentsFetched, - groupsFetched, - grouper, - ]); + }, [groupsLoading, agents, agentsFetched, groupsFetched, agentGroupsData]); const renderOption = useCallback((option, searchVal, contentClassName) => { const { label, value } = option; @@ -202,6 +191,7 @@ const AgentsTableComponent: React.FC = ({ agentSelection, onCh return (
= ({ agentSelection, onCh ); }; +AgentsTableComponent.displayName = 'AgentsTable'; + export const AgentsTable = React.memo(AgentsTableComponent); diff --git a/x-pack/plugins/osquery/public/agents/helpers.ts b/x-pack/plugins/osquery/public/agents/helpers.ts index 1c23eac3ca201..db48b5d417c96 100644 --- a/x-pack/plugins/osquery/public/agents/helpers.ts +++ b/x-pack/plugins/osquery/public/agents/helpers.ts @@ -38,7 +38,17 @@ interface Aggs extends estypes.AggregationsTermsAggregateBase { buckets: AggregationDataPoint[]; } -export const processAggregations = (aggs: Record) => { +export const processAggregations = ( + aggs: Record | undefined +) => { + if (!aggs) { + return { + platforms: [], + overlap: {}, + policies: [], + }; + } + const platforms: Group[] = []; const overlap: Overlap = {}; const platformTerms = aggs.platforms as Aggs; diff --git a/x-pack/plugins/osquery/public/agents/use_agent_groups.ts b/x-pack/plugins/osquery/public/agents/use_agent_groups.ts index 2dba1c471a786..3dc96c1f150c7 100644 --- a/x-pack/plugins/osquery/public/agents/use_agent_groups.ts +++ b/x-pack/plugins/osquery/public/agents/use_agent_groups.ts @@ -4,10 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { useState } from 'react'; import { useQuery } from 'react-query'; import { i18n } from '@kbn/i18n'; -import { firstValueFrom } from 'rxjs'; +import { lastValueFrom } from 'rxjs'; import { useKibana } from '../common/lib/kibana'; import { useAgentPolicies } from './use_agent_policies'; @@ -19,28 +18,27 @@ import { import { processAggregations } from './helpers'; import { generateTablePaginationOptions } from '../common/helpers'; -import { Overlap, Group } from './types'; import { useErrorToast } from '../common/hooks/use_error_toast'; +import { useOsqueryPolicies } from './use_osquery_policies'; -interface UseAgentGroups { - osqueryPolicies: string[]; - osqueryPoliciesLoading: boolean; -} - -export const useAgentGroups = ({ osqueryPolicies, osqueryPoliciesLoading }: UseAgentGroups) => { +export const useAgentGroups = () => { const { data } = useKibana().services; const setErrorToast = useErrorToast(); + const { data: osqueryPolicies, isFetched: isOsqueryPoliciesFetched } = useOsqueryPolicies(); const { agentPoliciesLoading, agentPolicyById } = useAgentPolicies(osqueryPolicies); - const [platforms, setPlatforms] = useState([]); - const [policies, setPolicies] = useState([]); - const [loading, setLoading] = useState(true); - const [overlap, setOverlap] = useState(() => ({})); - const [totalCount, setTotalCount] = useState(0); - const { isFetched } = useQuery( + + return useQuery< + AgentsStrategyResponse, + unknown, + { + totalCount: number; + groups: ReturnType; + } + >( ['agentGroups'], async () => { - const responseData = await firstValueFrom( + const responseData = await lastValueFrom( data.search.search( { filterQuery: { terms: { policy_id: osqueryPolicies } }, @@ -76,32 +74,54 @@ export const useAgentGroups = ({ osqueryPolicies, osqueryPoliciesLoading }: UseA ) ); - if (responseData.rawResponse.aggregations) { - const { - platforms: newPlatforms, - overlap: newOverlap, - policies: newPolicies, - } = processAggregations(responseData.rawResponse.aggregations); - - setPlatforms(newPlatforms); - setOverlap(newOverlap); - setPolicies( - newPolicies.map((p) => { - const name = agentPolicyById[p.id]?.name ?? p.name; - - return { - ...p, - name, - }; - }) - ); - } - - setLoading(false); - setTotalCount(responseData.totalCount); + return responseData; }, { - enabled: !osqueryPoliciesLoading && !agentPoliciesLoading, + select: (response) => { + const { platforms, overlap, policies } = processAggregations( + response.rawResponse.aggregations + ); + + return { + totalCount: response.totalCount, + groups: { + platforms, + overlap, + policies: policies.map((p) => { + const name = agentPolicyById[p.id]?.name ?? p.name; + + return { + ...p, + name, + }; + }), + }, + }; + }, + placeholderData: { + totalCount: 0, + edges: [], + pageInfo: { + activePage: 1, + fakeTotalCount: 100, + showMorePagesIndicator: true, + }, + rawResponse: { + took: 0, + timed_out: false, + _shards: { + failed: 0, + successful: 0, + total: 0, + }, + hits: { + hits: [], + }, + }, + }, + refetchOnWindowFocus: false, + keepPreviousData: true, + enabled: isOsqueryPoliciesFetched && !agentPoliciesLoading, onSuccess: () => setErrorToast(), onError: (error) => setErrorToast(error as Error, { @@ -111,15 +131,4 @@ export const useAgentGroups = ({ osqueryPolicies, osqueryPoliciesLoading }: UseA }), } ); - - return { - isFetched, - loading, - totalCount, - groups: { - platforms, - policies, - overlap, - }, - }; }; diff --git a/x-pack/plugins/osquery/public/agents/use_all_agents.ts b/x-pack/plugins/osquery/public/agents/use_all_agents.ts index 9ffcaae16bc6d..defe625eb9a28 100644 --- a/x-pack/plugins/osquery/public/agents/use_all_agents.ts +++ b/x-pack/plugins/osquery/public/agents/use_all_agents.ts @@ -11,11 +11,7 @@ import { useQuery } from 'react-query'; import { GetAgentsResponse } from '@kbn/fleet-plugin/common'; import { useErrorToast } from '../common/hooks/use_error_toast'; import { useKibana } from '../common/lib/kibana'; - -interface UseAllAgents { - osqueryPolicies: string[]; - osqueryPoliciesLoading: boolean; -} +import { useOsqueryPolicies } from './use_osquery_policies'; interface RequestOptions { perPage?: number; @@ -23,22 +19,24 @@ interface RequestOptions { } // TODO: break out the paginated vs all cases into separate hooks -export const useAllAgents = ( - { osqueryPolicies, osqueryPoliciesLoading }: UseAllAgents, - searchValue = '', - opts: RequestOptions = { perPage: 9000 } -) => { +export const useAllAgents = (searchValue = '', opts: RequestOptions = { perPage: 9000 }) => { const { perPage } = opts; const { http } = useKibana().services; const setErrorToast = useErrorToast(); + const { data: osqueryPolicies, isFetched } = useOsqueryPolicies(); + return useQuery( ['agents', osqueryPolicies, searchValue, perPage], () => { - let kuery = `(${osqueryPolicies.map((p) => `policy_id:${p}`).join(' or ')})`; + let kuery = ''; + + if (osqueryPolicies?.length) { + kuery = `(${osqueryPolicies.map((p) => `policy_id:${p}`).join(' or ')})`; - if (searchValue) { - kuery += ` and (local_metadata.host.hostname:*${searchValue}* or local_metadata.elastic.agent.id:*${searchValue}*)`; + if (searchValue) { + kuery += ` and (local_metadata.host.hostname:*${searchValue}* or local_metadata.elastic.agent.id:*${searchValue}*)`; + } } return http.get(`/internal/osquery/fleet_wrapper/agents`, { @@ -51,7 +49,7 @@ export const useAllAgents = ( { // @ts-expect-error update types select: (data) => data?.agents || [], - enabled: !osqueryPoliciesLoading && osqueryPolicies.length > 0, + enabled: isFetched && !!osqueryPolicies?.length, onSuccess: () => setErrorToast(), onError: (error) => // @ts-expect-error update types diff --git a/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts b/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts index 679aeef1bd23b..9ecf5d14c6b38 100644 --- a/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts +++ b/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts @@ -7,7 +7,6 @@ import { uniq } from 'lodash'; import { useQuery } from 'react-query'; -import { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { useKibana } from '../common/lib/kibana'; import { useErrorToast } from '../common/hooks/use_error_toast'; @@ -16,7 +15,7 @@ export const useOsqueryPolicies = () => { const { http } = useKibana().services; const setErrorToast = useErrorToast(); - const { isLoading: osqueryPoliciesLoading, data: osqueryPolicies = [] } = useQuery( + return useQuery( ['osqueryPolicies'], () => http.get<{ items: Array<{ policy_id: string }> }>( @@ -33,9 +32,4 @@ export const useOsqueryPolicies = () => { }), } ); - - return useMemo( - () => ({ osqueryPoliciesLoading, osqueryPolicies }), - [osqueryPoliciesLoading, osqueryPolicies] - ); }; diff --git a/x-pack/plugins/osquery/public/live_queries/form/index.tsx b/x-pack/plugins/osquery/public/live_queries/form/index.tsx index 43940c2982161..6a72a0b59979f 100644 --- a/x-pack/plugins/osquery/public/live_queries/form/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/form/index.tsx @@ -8,22 +8,21 @@ import { EuiButton, EuiButtonEmpty, - EuiSteps, EuiSpacer, EuiFlexGroup, EuiFlexItem, EuiAccordion, EuiAccordionProps, } from '@elastic/eui'; -import { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import React, { useCallback, useEffect, useMemo, useState, useRef } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useMutation } from 'react-query'; import deepMerge from 'deepmerge'; import styled from 'styled-components'; -import { pickBy, isEmpty } from 'lodash'; +import { pickBy, isEmpty, map } from 'lodash'; +import { convertECSMappingToObject } from '../../../common/schemas/common/utils'; import { UseField, Form, FormData, useForm, useFormData, FIELD_TYPES } from '../../shared_imports'; import { AgentsTableField } from './agents_table_field'; import { LiveQueryQueryField } from './live_query_query_field'; @@ -33,16 +32,13 @@ import { queryFieldValidation } from '../../common/validations'; import { fieldValidators } from '../../shared_imports'; import { SavedQueryFlyout } from '../../saved_queries'; import { useErrorToast } from '../../common/hooks/use_error_toast'; -import { - ECSMappingEditorField, - ECSMappingEditorFieldRef, -} from '../../packs/queries/lazy_ecs_mapping_editor_field'; +import { ECSMappingEditorField } from '../../packs/queries/lazy_ecs_mapping_editor_field'; import { SavedQueriesDropdown } from '../../saved_queries/saved_queries_dropdown'; const FORM_ID = 'liveQueryForm'; const StyledEuiAccordion = styled(EuiAccordion)` - ${({ isDisabled }: { isDisabled: boolean }) => isDisabled && 'display: none;'} + ${({ isDisabled }: { isDisabled?: boolean }) => isDisabled && 'display: none;'} .euiAccordion__button { color: ${({ theme }) => theme.eui.euiColorPrimary}; } @@ -55,27 +51,26 @@ const GhostFormField = () => <>; type FormType = 'simple' | 'steps'; interface LiveQueryFormProps { - defaultValue?: Partial | undefined; + defaultValue?: Partial; onSuccess?: () => void; - agentsField?: boolean; queryField?: boolean; ecsMappingField?: boolean; formType?: FormType; enabled?: boolean; + hideAgentsField?: boolean; addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } const LiveQueryFormComponent: React.FC = ({ defaultValue, onSuccess, - agentsField = true, queryField = true, ecsMappingField = true, formType = 'steps', enabled = true, + hideAgentsField = false, addToTimeline, }) => { - const ecsFieldRef = useRef(); const permissions = useKibana().services.application.capabilities.osquery; const { http } = useKibana().services; const [advancedContentState, setAdvancedContentState] = @@ -136,7 +131,7 @@ const LiveQueryFormComponent: React.FC = ({ ], }, ecs_mapping: { - defaultValue: {}, + defaultValue: [], type: FIELD_TYPES.JSON, validations: [], }, @@ -146,18 +141,9 @@ const LiveQueryFormComponent: React.FC = ({ id: FORM_ID, schema: formSchema, onSubmit: async (formData, isValid) => { - const ecsFieldValue = await ecsFieldRef?.current?.validate(); - if (isValid && (!ecsMappingField || !!ecsFieldValue)) { + if (isValid) { try { - await mutateAsync( - pickBy( - { - ...formData, - ...(isEmpty(ecsFieldValue) ? {} : { ecs_mapping: ecsFieldValue }), - }, - (value) => !isEmpty(value) - ) - ); + await mutateAsync(pickBy(formData, (value) => !isEmpty(value))); // eslint-disable-next-line no-empty } catch (e) {} } @@ -165,8 +151,16 @@ const LiveQueryFormComponent: React.FC = ({ options: { stripEmptyFields: false, }, - serializer: ({ savedQueryId, ...formData }) => - pickBy({ ...formData, saved_query_id: savedQueryId }, (value) => !isEmpty(value)), + // eslint-disable-next-line @typescript-eslint/naming-convention + serializer: ({ savedQueryId, ecs_mapping, ...formData }) => + pickBy( + { + ...formData, + saved_query_id: savedQueryId, + ecs_mapping: convertECSMappingToObject(ecs_mapping), + }, + (value) => !isEmpty(value) + ), defaultValue: deepMerge( { agentSelection: { @@ -177,12 +171,13 @@ const LiveQueryFormComponent: React.FC = ({ }, query: '', savedQueryId: null, + ecs_mapping: [], }, defaultValue ?? {} ), }); - const { setFieldValue, submit, isSubmitting } = form; + const { updateFieldValues, setFieldValue, submit, isSubmitting } = form; const actionId = useMemo(() => data?.actions[0].action_id, [data?.actions]); const agentIds = useMemo(() => data?.actions[0].agents, [data?.actions]); @@ -207,13 +202,12 @@ const LiveQueryFormComponent: React.FC = ({ const queryValueProvided = useMemo(() => !!query?.length, [query]); const queryStatus = useMemo(() => { - if (!agentSelected) return 'disabled'; - if (isError || !form.getFields().query.isValid) return 'danger'; + if (isError || !form.getFields().query?.isValid) return 'danger'; if (isLoading) return 'loading'; if (isSuccess) return 'complete'; return 'incomplete'; - }, [agentSelected, isError, isLoading, isSuccess, form]); + }, [isError, isLoading, isSuccess, form]); const resultsStatus = useMemo( () => (queryStatus === 'complete' ? 'incomplete' : 'disabled'), @@ -223,19 +217,28 @@ const LiveQueryFormComponent: React.FC = ({ const handleSavedQueryChange = useCallback( (savedQuery) => { if (savedQuery) { - setFieldValue('query', savedQuery.query); - setFieldValue('savedQueryId', savedQuery.savedQueryId); + updateFieldValues({ + query: savedQuery.query, + savedQueryId: savedQuery.savedQueryId, + ecs_mapping: savedQuery.ecs_mapping + ? map(savedQuery.ecs_mapping, (value, key) => ({ + key, + result: { + type: Object.keys(value)[0], + value: Object.values(value)[0], + }, + })) + : [], + }); + if (!isEmpty(savedQuery.ecs_mapping)) { - setFieldValue('ecs_mapping', savedQuery.ecs_mapping); setAdvancedContentState('open'); - } else { - setFieldValue('ecs_mapping', {}); } } else { setFieldValue('savedQueryId', null); } }, - [setFieldValue] + [setFieldValue, updateFieldValues] ); const commands = useMemo( @@ -251,10 +254,9 @@ const LiveQueryFormComponent: React.FC = ({ const queryComponentProps = useMemo( () => ({ - disabled: queryStatus === 'disabled', commands, }), - [queryStatus, commands] + [commands] ); const flyoutFormDefaultValue = useMemo( @@ -275,9 +277,8 @@ const LiveQueryFormComponent: React.FC = ({ ); const isSavedQueryDisabled = useMemo( - () => - queryComponentProps.disabled || !permissions.runSavedQueries || !permissions.readSavedQueries, - [permissions.readSavedQueries, permissions.runSavedQueries, queryComponentProps.disabled] + () => !permissions.runSavedQueries || !permissions.readSavedQueries, + [permissions.readSavedQueries, permissions.runSavedQueries] ); const queryFieldStepContent = useMemo( @@ -314,16 +315,9 @@ const LiveQueryFormComponent: React.FC = ({ forceState={advancedContentState} onToggle={handleToggle} buttonContent="Advanced" - isDisabled={queryComponentProps.disabled} > - + ) : ( @@ -372,7 +366,6 @@ const LiveQueryFormComponent: React.FC = ({ ecsMappingField, advancedContentState, handleToggle, - query, ecsFieldProps, formType, agentSelected, @@ -399,70 +392,38 @@ const LiveQueryFormComponent: React.FC = ({ [actionId, agentIds, data?.actions, addToTimeline] ); - const formSteps: EuiContainedStepProps[] = useMemo( - () => [ - { - title: i18n.translate('xpack.osquery.liveQueryForm.steps.agentsStepHeading', { - defaultMessage: 'Select agents', - }), - children: , - status: agentSelected ? 'complete' : 'incomplete', - }, - { - title: i18n.translate('xpack.osquery.liveQueryForm.steps.queryStepHeading', { - defaultMessage: 'Enter query', - }), - children: queryFieldStepContent, - status: queryStatus, - }, - { - title: i18n.translate('xpack.osquery.liveQueryForm.steps.resultsStepHeading', { - defaultMessage: 'Check results', - }), - children: resultsStepContent, - status: resultsStatus, - }, - ], - [agentSelected, queryFieldStepContent, queryStatus, resultsStepContent, resultsStatus] - ); - - const simpleForm = useMemo( - () => ( - - - {queryFieldStepContent} - {resultsStepContent} - - ), - [agentsField, queryFieldStepContent, resultsStepContent] - ); - useEffect(() => { - if (defaultValue?.agentSelection) { - setFieldValue('agentSelection', defaultValue?.agentSelection); - } - - if (defaultValue?.query) { - setFieldValue('query', defaultValue?.query); - } - - // TODO: Set query and ECS mapping from savedQueryId object - if (defaultValue?.savedQueryId) { - setFieldValue('savedQueryId', defaultValue?.savedQueryId); - } - - if (!isEmpty(defaultValue?.ecs_mapping)) { - setFieldValue('ecs_mapping', defaultValue?.ecs_mapping); + if (defaultValue) { + updateFieldValues({ + agentSelection: defaultValue.agentSelection, + query: defaultValue.query, + savedQueryId: defaultValue.savedQueryId, + ecs_mapping: defaultValue.ecs_mapping + ? map(defaultValue.ecs_mapping, (value, key) => ({ + key, + result: { + type: Object.keys(value)[0], + value: Object.values(value)[0], + }, + })) + : undefined, + }); } - }, [defaultValue, setFieldValue]); + }, [defaultValue, updateFieldValues]); return ( <>
- {formType === 'steps' ? : simpleForm} + + + + + {queryFieldStepContent} + {resultsStepContent} + {showSavedQueryFlyout ? ( diff --git a/x-pack/plugins/osquery/public/live_queries/form/schema.ts b/x-pack/plugins/osquery/public/live_queries/form/schema.ts deleted file mode 100644 index 3d0195a112fec..0000000000000 --- a/x-pack/plugins/osquery/public/live_queries/form/schema.ts +++ /dev/null @@ -1,18 +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 { FIELD_TYPES, FormSchema } from '../../shared_imports'; - -export const formSchema: FormSchema = { - agents: { - type: FIELD_TYPES.MULTI_SELECT, - }, - query: { - type: FIELD_TYPES.TEXTAREA, - validations: [], - }, -}; diff --git a/x-pack/plugins/osquery/public/live_queries/index.tsx b/x-pack/plugins/osquery/public/live_queries/index.tsx index b002f9e391a8a..a147f929f7f25 100644 --- a/x-pack/plugins/osquery/public/live_queries/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/index.tsx @@ -28,6 +28,7 @@ interface LiveQueryProps { ecsMappingField?: boolean; enabled?: boolean; formType?: 'steps' | 'simple'; + hideAgentsField?: boolean; addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } @@ -40,11 +41,11 @@ const LiveQueryComponent: React.FC = ({ savedQueryId, // eslint-disable-next-line @typescript-eslint/naming-convention ecs_mapping, - agentsField, queryField, ecsMappingField, formType, enabled, + hideAgentsField, addToTimeline, }) => { const { data: hasActionResultsPrivileges, isLoading } = useActionResultsPrivileges(); @@ -108,13 +109,13 @@ const LiveQueryComponent: React.FC = ({ return ( ); diff --git a/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx b/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx index bca3036d19f4c..a9c663051e273 100644 --- a/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import { produce } from 'immer'; import { castArray, each, @@ -19,16 +18,7 @@ import { trim, get, } from 'lodash'; -import React, { - forwardRef, - useCallback, - useEffect, - useMemo, - useRef, - useState, - useImperativeHandle, - MutableRefObject, -} from 'react'; +import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'; import { EuiFormLabel, EuiButtonIcon, @@ -49,7 +39,6 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; import deepEqual from 'fast-deep-equal'; -import deepmerge from 'deepmerge'; import ECSSchema from '../../common/schemas/ecs/v8.2.0.json'; import osquerySchema from '../../common/schemas/osquery/v5.2.2.json'; @@ -57,17 +46,17 @@ import osquerySchema from '../../common/schemas/osquery/v5.2.2.json'; import { FieldIcon } from '../../common/lib/kibana'; import { FIELD_TYPES, - Form, - FormData, FieldHook, getFieldValidityAndErrorMessage, - useForm, useFormData, Field, getUseField, fieldValidators, ValidationFuncArg, UseMultiFields, + UseArray, + ArrayItem, + FormArrayField, } from '../../shared_imports'; import { OsqueryIcon } from '../../components/osquery_icon'; @@ -179,7 +168,7 @@ const ECSComboboxFieldComponent: React.FC = ({ setSelected(newSelectedOptions); setValue(newSelectedOptions[0]?.label ?? ''); }, - [setSelected, setValue] + [setValue] ); // TODO: Create own component for this. @@ -339,7 +328,7 @@ const OsqueryColumnFieldComponent: React.FC = ({ }) => { const inputRef = useRef(); const { setValue } = resultValue; - const { setValue: setType } = resultType; + const { value: typeValue, setValue: setType } = resultType; const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(resultValue); const describedByIds = useMemo(() => (idAria ? [idAria] : []), [idAria]); const [selectedOptions, setSelected] = useState< @@ -383,12 +372,12 @@ const OsqueryColumnFieldComponent: React.FC = ({ const onTypeChange = useCallback( (newType) => { - if (newType !== resultType.value) { + if (newType !== typeValue) { setType(newType); setValue(newType === 'value' && euiFieldProps.singleSelection === false ? [] : ''); } }, - [resultType.value, setType, setValue, euiFieldProps.singleSelection] + [typeValue, setType, setValue, euiFieldProps.singleSelection] ); const handleCreateOption = useCallback( @@ -416,8 +405,9 @@ const OsqueryColumnFieldComponent: React.FC = ({ const Prepend = useMemo( () => ( = ({ onChange={onTypeChange} /> ), - [onTypeChange, resultType.value] + [euiFieldProps.isDisabled, onTypeChange, typeValue] ); useEffect(() => { @@ -438,8 +428,7 @@ const OsqueryColumnFieldComponent: React.FC = ({ if (!euiFieldProps?.singleSelection && !isArray(resultValue.value)) { setValue(resultValue.value.length ? [resultValue.value] : []); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [euiFieldProps?.singleSelection, setValue]); + }, [euiFieldProps?.singleSelection, resultValue.value, setValue]); useEffect(() => { setSelected(() => { @@ -482,7 +471,7 @@ const OsqueryColumnFieldComponent: React.FC = ({ rowHeight={32} isClearable {...euiFieldProps} - options={(resultType.value === 'field' && euiFieldProps.options) || EMPTY_ARRAY} + options={(typeValue === 'field' && euiFieldProps.options) || EMPTY_ARRAY} /> @@ -490,105 +479,96 @@ const OsqueryColumnFieldComponent: React.FC = ({ ); }; -export const OsqueryColumnField = React.memo( - OsqueryColumnFieldComponent, - (prevProps, nextProps) => - prevProps.resultType.value === nextProps.resultType.value && - prevProps.resultType.isChangingValue === nextProps.resultType.isChangingValue && - prevProps.resultType.errors === nextProps.resultType.errors && - prevProps.resultValue.value === nextProps.resultValue.value && - prevProps.resultValue.isChangingValue === nextProps.resultValue.isChangingValue && - prevProps.resultValue.errors === nextProps.resultValue.errors && - deepEqual(prevProps.euiFieldProps, nextProps.euiFieldProps) -); - -export interface ECSMappingEditorFieldRef { - validate: () => Promise< - | Record< - string, - { - field: string; - } - > - | false - | {} - >; -} +export const OsqueryColumnField = React.memo(OsqueryColumnFieldComponent); export interface ECSMappingEditorFieldProps { - field: FieldHook>; - query: string; - fieldRef: MutableRefObject; - euiFieldProps: EuiComboBoxProps<{}>; + euiFieldProps?: EuiComboBoxProps<{}>; } interface ECSMappingEditorFormProps { isDisabled?: boolean; osquerySchemaOptions: OsquerySchemaOption[]; - defaultValue?: FormData; - onAdd?: (payload: FormData) => void; - onChange?: (payload: FormData) => void; - onDelete?: (key: string) => void; + item: ArrayItem; + isLastItem?: boolean; + onDelete?: FormArrayField['removeItem']; } -const getEcsFieldValidator = - (editForm: boolean) => - (args: ValidationFuncArg) => { - const fieldRequiredError = fieldValidators.emptyField( - i18n.translate('xpack.osquery.pack.queryFlyoutForm.ecsFieldRequiredErrorMessage', { - defaultMessage: 'ECS field is required.', - }) - )(args); - +const ecsFieldValidator = ( + args: ValidationFuncArg & { + customData: { + value: { + editForm: boolean; + }; + }; + } +) => { + const editForm: boolean = args.customData.value?.editForm; + const rootPath = args.path.split('.')[0]; + + const fieldRequiredError = fieldValidators.emptyField( + i18n.translate('xpack.osquery.pack.queryFlyoutForm.ecsFieldRequiredErrorMessage', { + defaultMessage: 'ECS field is required.', + }) + )(args); + + if ( + fieldRequiredError && // @ts-expect-error update types - if (fieldRequiredError && ((!editForm && args.formData['result.value'].length) || editForm)) { - return fieldRequiredError; - } + ((!editForm && args.formData[`${rootPath}.result.value`]?.length) || editForm) + ) { + return fieldRequiredError; + } - return undefined; - }; + return undefined; +}; -const getOsqueryResultFieldValidator = - (osquerySchemaOptions: OsquerySchemaOption[], editForm: boolean) => - ( - args: ValidationFuncArg - ) => { - const fieldRequiredError = fieldValidators.emptyField( - i18n.translate('xpack.osquery.pack.queryFlyoutForm.osqueryResultFieldRequiredErrorMessage', { - defaultMessage: 'Value is required.', - }) - )(args); - - if (fieldRequiredError && ((!editForm && args.formData.key.length) || editForm)) { - return fieldRequiredError; - } +const osqueryResultFieldValidator = async ( + args: ValidationFuncArg & { + customData: { + value: { + editForm: boolean; + osquerySchemaOptions: OsquerySchemaOption[]; + }; + }; + } +) => { + const rootPath = args.path.split('.')[0]; + const { editForm, osquerySchemaOptions } = args.customData.value; + const fieldRequiredError = fieldValidators.emptyField( + i18n.translate('xpack.osquery.pack.queryFlyoutForm.osqueryResultFieldRequiredErrorMessage', { + defaultMessage: 'Value is required.', + }) + )(args); + + // @ts-expect-error update types + if (fieldRequiredError && ((!editForm && args.formData[`${rootPath}.key`]?.length) || editForm)) { + return fieldRequiredError; + } - // @ts-expect-error update types - if (!args.value?.length || args.formData['result.type'] !== 'field') return; - - const osqueryColumnExists = find(osquerySchemaOptions, ['label', args.value]); - - return !osqueryColumnExists - ? { - code: 'ERR_FIELD_FORMAT', - path: args.path, - message: i18n.translate( - 'xpack.osquery.pack.queryFlyoutForm.osqueryResultFieldValueMissingErrorMessage', - { - defaultMessage: 'The current query does not return a {columnName} field', - values: { - columnName: args.value, - }, - } - ), - __isBlocking__: false, - } - : undefined; - }; + // @ts-expect-error update types + if (!args.value?.length || args.formData[`${rootPath}.result.type`] !== 'field') return; + + const osqueryColumnExists = find(osquerySchemaOptions, [ + 'label', + isArray(args.value) ? args.value[0] : args.value, + ]); -const FORM_DEFAULT_VALUE = { - key: '', - value: { field: '' }, + return !osqueryColumnExists + ? { + code: 'ERR_FIELD_FORMAT', + path: args.path, + message: i18n.translate( + 'xpack.osquery.pack.queryFlyoutForm.osqueryResultFieldValueMissingErrorMessage', + { + defaultMessage: 'The current query does not return a {columnName} field', + values: { + columnName: args.value, + }, + } + ), + __isBlocking__: false, + } + : undefined; }; interface ECSMappingEditorFormData { @@ -599,217 +579,141 @@ interface ECSMappingEditorFormData { }; } -interface ECSMappingEditorFormRef { - validate: () => Promise<{ - data: ECSMappingEditorFormData | {}; - isValid: boolean; - }>; -} +export const ECSMappingEditorForm: React.FC = ({ + isDisabled, + osquerySchemaOptions, + item, + isLastItem, + onDelete, +}) => { + const multipleValuesField = useRef(false); -export const ECSMappingEditorForm = forwardRef( - ({ isDisabled, osquerySchemaOptions, defaultValue, onAdd, onChange, onDelete }, ref) => { - const editForm = !!defaultValue; - const multipleValuesField = useRef(false); - const currentFormData = useRef(defaultValue); - const formSchema = useMemo( - () => ({ - key: { - type: FIELD_TYPES.COMBO_BOX, - fieldsToValidateOnChange: ['result.value', 'key'], - validations: [ - { - validator: getEcsFieldValidator(editForm), + const MultiFields = useMemo( + () => ( + ({ - key: data.key ?? '', - result: { - type: data.value - ? Object.keys(data.value)[0] - : OSQUERY_COLUMN_VALUE_TYPE_OPTIONS[0].value, - value: data.value ? Object.values(data.value)[0] : '', - }, - }), - }); - - const { submit, reset, validate, validateFields } = form; - - const [formData] = useFormData({ form }); - - const handleSubmit = useCallback(async () => { - validate(); - validateFields(['result.value', 'key']); - const { data, isValid } = await submit(); - - if (isValid) { - const serializedData = { - key: data.key, - value: { - [data.result.type]: data.result.value, }, - }; - if (onAdd) { - onAdd(serializedData); - } - - if (onChange) { - onChange(serializedData); - } - - reset(); - } - }, [validate, validateFields, submit, onAdd, onChange, reset]); - - const handleDeleteClick = useCallback(() => { - if (defaultValue?.key && onDelete) { - onDelete(defaultValue.key); - } - }, [defaultValue, onDelete]); - - const MultiFields = useMemo( - () => ( - - {(fields) => ( - - )} - - ), - [osquerySchemaOptions, isDisabled] - ); - - const ecsComboBoxEuiFieldProps = useMemo(() => ({ isDisabled }), [isDisabled]); + }, + }} + > + {(fields) => ( + + )} + + ), + [item.path, osquerySchemaOptions, isLastItem, isDisabled] + ); - useImperativeHandle( - ref, - () => ({ - validate: async () => { - if (!editForm && deepEqual(formData, FORM_DEFAULT_VALUE)) { - return { data: {}, isValid: true }; - } + const ecsComboBoxEuiFieldProps = useMemo(() => ({ isDisabled }), [isDisabled]); - validateFields(['result.value', 'key']); - const isValid = await validate(); + const validationData = useMemo(() => ({ editForm: !isLastItem }), [isLastItem]); - return { - data: formData?.key?.length - ? { - [formData.key]: { - [formData.result.type]: formData.result.value, - }, - } - : {}, - isValid, - }; + const config = useMemo( + () => ({ + valueChangeDebounceTime: 300, + fieldsToValidateOnChange: [`${item.path}.key`, `${item.path}.result.value`], + validations: [ + { + validator: ecsFieldValidator, }, - }), - [validateFields, editForm, formData, validate] - ); + ], + }), + [item.path] + ); - useEffect(() => { - if (!deepEqual(formData, currentFormData.current)) { - currentFormData.current = formData; - const ecsOption = find(ECSSchemaOptions, ['label', formData.key]); - multipleValuesField.current = - ecsOption?.value?.normalization === 'array' && formData.result.type === 'value'; - handleSubmit(); - } - }, [handleSubmit, formData, onAdd]); + const handleDeleteClick = useCallback(() => { + if (onDelete) { + onDelete(item.id); + } + }, [item.id, onDelete]); - return ( -
- - - - - - + return ( + <> + + + + + + + + + : + + + + + + + {MultiFields} + {!isDisabled && ( - - : - + + {!isLastItem && ( + + )} + - - - - - {MultiFields} - {!isDisabled && ( - - - {defaultValue && ( - - )} - - - )} - - - - - - ); - } -); + )} + + +
+ + + ); +}; interface OsquerySchemaOption { label: string; @@ -831,177 +735,155 @@ interface OsqueryColumn { } export const ECSMappingEditorField = React.memo( - ({ field, query, fieldRef, euiFieldProps }: ECSMappingEditorFieldProps) => { - const { setValue, value = {} } = field; - const [osquerySchemaOptions, setOsquerySchemaOptions] = useState([]); - const formRefs = useRef>({}); - - useImperativeHandle( - fieldRef, - () => ({ - validate: async () => { - const validations = await Promise.all( - Object.values(formRefs.current).map(async (formRef) => { - const { data, isValid } = await formRef.validate(); - - return [data, isValid]; - }) - ); - - if (find(validations, (result) => result[1] === false)) { - return false; - } - - return deepmerge.all(map(validations, '[0]')); - }, - }), - [] - ); + ({ euiFieldProps }: ECSMappingEditorFieldProps) => { + const lastItemPath = useRef(); + const onAdd = useRef(); + const osquerySchemaOptions = useRef([]); + const [{ query, ...formData }, formDataSerializer, isMounted] = useFormData(); useEffect(() => { - setOsquerySchemaOptions((currentValue) => { - if (!query?.length) { - return currentValue; - } + if (!query?.length) { + return; + } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let ast: Record | undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let ast: Record | undefined; - try { - ast = sqlParser.parse(query)?.value; - } catch (e) { - return currentValue; - } + try { + ast = sqlParser.parse(query)?.value; + } catch (e) { + return; + } - const astOsqueryTables: Record< - string, - { - columns: OsqueryColumn[]; - order: number; - } - > = - ast?.from?.value?.reduce( - ( - acc: { - [x: string]: { - columns: OsqueryColumn[]; - order: number; - }; - }, - table: { - value: { - left?: { value: { value: string }; alias?: { value: string } }; - right?: { value: { value: string }; alias?: { value: string } }; - value?: { value: string }; - alias?: { value: string }; - }; - } - ) => { - each(['value.left', 'value.right', 'value'], (valueKey) => { - if (valueKey) { - const osqueryTable = find(osquerySchema, [ - 'name', - get(table, `${valueKey}.value.value`), - ]); - - if (osqueryTable) { - acc[ - get(table, `${valueKey}.alias.value`) ?? get(table, `${valueKey}.value.value`) - ] = { - columns: osqueryTable.columns, - order: Object.keys(acc).length, - }; - } + const astOsqueryTables: Record< + string, + { + columns: OsqueryColumn[]; + order: number; + } + > = + ast?.from?.value?.reduce( + ( + acc: { + [x: string]: { + columns: OsqueryColumn[]; + order: number; + }; + }, + table: { + value: { + left?: { value: { value: string }; alias?: { value: string } }; + right?: { value: { value: string }; alias?: { value: string } }; + value?: { value: string }; + alias?: { value: string }; + }; + } + ) => { + each(['value.left', 'value.right', 'value'], (valueKey) => { + if (valueKey) { + const osqueryTable = find(osquerySchema, [ + 'name', + get(table, `${valueKey}.value.value`), + ]); + + if (osqueryTable) { + acc[ + get(table, `${valueKey}.alias.value`) ?? get(table, `${valueKey}.value.value`) + ] = { + columns: osqueryTable.columns, + order: Object.keys(acc).length, + }; } - }); + } + }); - return acc; - }, - {} - ) ?? {}; + return acc; + }, + {} + ) ?? {}; - // Table doesn't exist in osquery schema - if (isEmpty(astOsqueryTables)) { - return currentValue; - } + // Table doesn't exist in osquery schema + if (isEmpty(astOsqueryTables)) { + return; + } - const suggestions = - isArray(ast?.selectItems?.value) && - ast?.selectItems?.value - ?.map((selectItem: { type: string; value: string; hasAs: boolean; alias?: string }) => { - if (selectItem.type === 'Identifier') { - /* + const suggestions = + isArray(ast?.selectItems?.value) && + ast?.selectItems?.value + ?.map((selectItem: { type: string; value: string; hasAs: boolean; alias?: string }) => { + if (selectItem.type === 'Identifier') { + /* select * from routes, uptime; */ - if (ast?.selectItems?.value.length === 1 && selectItem.value === '*') { - return reduce( - astOsqueryTables, - (acc, { columns: osqueryColumns, order: tableOrder }, table) => { - acc.push( - ...osqueryColumns.map((osqueryColumn) => ({ - label: osqueryColumn.name, - value: { - name: osqueryColumn.name, - description: osqueryColumn.description, - table, - tableOrder, - suggestion_label: osqueryColumn.name, - }, - })) - ); - - return acc; - }, - [] as OsquerySchemaOption[] - ); - } - - /* - select i.*, p.resident_size, p.user_time, p.system_time, time.minutes as counter from osquery_info i, processes p, time where p.pid = i.pid; - */ - - const [table, column] = selectItem.value.includes('.') - ? selectItem.value?.split('.') - : [Object.keys(astOsqueryTables)[0], selectItem.value]; - - if (column === '*' && astOsqueryTables[table]) { - const { columns: osqueryColumns, order: tableOrder } = astOsqueryTables[table]; - - return osqueryColumns.map((osqueryColumn) => ({ - label: osqueryColumn.name, - value: { - name: osqueryColumn.name, - description: osqueryColumn.description, - table, - tableOrder, - suggestion_label: `${osqueryColumn.name}`, - }, - })); - } - - if (astOsqueryTables[table]) { - const osqueryColumn = find(astOsqueryTables[table].columns, ['name', column]); - - if (osqueryColumn) { - const label = selectItem.hasAs ? selectItem.alias : column; - - return [ - { - label, + if (ast?.selectItems?.value.length === 1 && selectItem.value === '*') { + return reduce( + astOsqueryTables, + (acc, { columns: osqueryColumns, order: tableOrder }, table) => { + acc.push( + ...osqueryColumns.map((osqueryColumn) => ({ + label: osqueryColumn.name, value: { name: osqueryColumn.name, description: osqueryColumn.description, table, - tableOrder: astOsqueryTables[table].order, - suggestion_label: `${label}`, + tableOrder, + suggestion_label: osqueryColumn.name, }, + })) + ); + + return acc; + }, + [] as OsquerySchemaOption[] + ); + } + + /* + select i.*, p.resident_size, p.user_time, p.system_time, time.minutes as counter from osquery_info i, processes p, time where p.pid = i.pid; + */ + + const [table, column] = selectItem.value.includes('.') + ? selectItem.value?.split('.') + : [Object.keys(astOsqueryTables)[0], selectItem.value]; + + if (column === '*' && astOsqueryTables[table]) { + const { columns: osqueryColumns, order: tableOrder } = astOsqueryTables[table]; + + return osqueryColumns.map((osqueryColumn) => ({ + label: osqueryColumn.name, + value: { + name: osqueryColumn.name, + description: osqueryColumn.description, + table, + tableOrder, + suggestion_label: `${osqueryColumn.name}`, + }, + })); + } + + if (astOsqueryTables[table]) { + const osqueryColumn = find(astOsqueryTables[table].columns, ['name', column]); + + if (osqueryColumn) { + const label = selectItem.hasAs ? selectItem.alias : column; + + return [ + { + label, + value: { + name: osqueryColumn.name, + description: osqueryColumn.description, + table, + tableOrder: astOsqueryTables[table].order, + suggestion_label: `${label}`, }, - ]; - } + }, + ]; } } + } - /* + /* SELECT pid, uid, name, ROUND(( (user_time + system_time) / (cpu_time.tsb - cpu_time.itsb) ) * 100, 2) AS percentage @@ -1015,95 +897,57 @@ export const ECSMappingEditorField = React.memo( LIMIT 5; */ - if (selectItem.hasAs && selectItem.alias) { - return [ - { - label: selectItem.alias, - value: { - name: selectItem.alias, - description: '', - table: '', - tableOrder: -1, - suggestion_label: selectItem.alias, - }, + if (selectItem.hasAs && selectItem.alias) { + return [ + { + label: selectItem.alias, + value: { + name: selectItem.alias, + description: '', + table: '', + tableOrder: -1, + suggestion_label: selectItem.alias, }, - ]; - } + }, + ]; + } - return []; - }) - .flat(); + return []; + }) + .flat(); - // Remove column duplicates by keeping the column from the table that appears last in the query - return sortedUniqBy( - orderBy(suggestions, ['value.suggestion_label', 'value.tableOrder'], ['asc', 'desc']), - 'label' - ); - }); + // Remove column duplicates by keeping the column from the table that appears last in the query + osquerySchemaOptions.current = sortedUniqBy( + orderBy(suggestions, ['value.suggestion_label', 'value.tableOrder'], ['asc', 'desc']), + 'label' + ); }, [query]); - useEffect(() => { - Object.keys(formRefs.current).forEach((key) => { - if (!value[key]) { - delete formRefs.current[key]; - } - }); - }, [value]); - - const handleAddRow = useCallback( - (newRow) => { - if (newRow?.key && newRow?.value) { - setValue( - produce((draft) => { - draft[newRow.key] = newRow.value; - - return draft; - }) - ); - } - }, - [setValue] - ); - - const handleUpdateRow = useCallback( - (currentKey: string) => (updatedRow: FormData) => { - if (updatedRow?.key && updatedRow?.value) { - setValue( - produce((draft) => { - if (currentKey !== updatedRow.key) { - delete draft[currentKey]; - } + useLayoutEffect(() => { + if (isMounted) { + if (!lastItemPath.current && onAdd.current) { + onAdd.current(); - draft[updatedRow.key] = updatedRow.value; + return; + } - return draft; - }) - ); + if (euiFieldProps?.isDisabled) { + return; } - }, - [setValue] - ); - const handleDeleteRow = useCallback( - (key) => { - if (key) { - setValue( - produce((draft) => { - if (draft[key]) { - delete draft[key]; - } + const itemKey = get(formData, `${lastItemPath.current}.key`); - return draft; - }) - ); + if (itemKey) { + const serializedFormData = formDataSerializer(); + const itemValue = + serializedFormData.ecs_mapping && serializedFormData.ecs_mapping[`${itemKey}`]?.field; - if (formRefs.current[key]) { - delete formRefs.current[key]; + if (itemValue && onAdd.current) { + onAdd.current(); } } - }, - [setValue] - ); + } + }, [euiFieldProps?.isDisabled, formData, formDataSerializer, isMounted, onAdd]); return ( <> @@ -1145,45 +989,31 @@ export const ECSMappingEditorField = React.memo( - {Object.entries(value).map(([ecsKey, ecsValue]) => ( - { - if (formRef) { - formRefs.current[ecsKey] = formRef; - } - }} - key={ecsKey} - osquerySchemaOptions={osquerySchemaOptions} - // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop - defaultValue={{ - key: ecsKey, - value: ecsValue, - }} - onChange={handleUpdateRow(ecsKey)} - onDelete={handleDeleteRow} - isDisabled={!!euiFieldProps?.isDisabled} - /> - ))} - {!euiFieldProps?.isDisabled && ( - { - if (formRef) { - formRefs.current.new = formRef; - } - }} - osquerySchemaOptions={osquerySchemaOptions} - onAdd={handleAddRow} - /> - )} + + {({ items, addItem, removeItem }) => { + lastItemPath.current = items[items.length - 1]?.path; + onAdd.current = addItem; + + return ( + <> + {items.map((item, index) => ( + + ))} + + ); + }} + ); }, - (prevProps, nextProps) => - prevProps.field.value === nextProps.field.value && - prevProps.query === nextProps.query && - deepEqual(prevProps.euiFieldProps, nextProps.euiFieldProps) + (prevProps, nextProps) => deepEqual(prevProps.euiFieldProps, nextProps.euiFieldProps) ); // eslint-disable-next-line import/no-default-export diff --git a/x-pack/plugins/osquery/public/packs/queries/lazy_ecs_mapping_editor_field.tsx b/x-pack/plugins/osquery/public/packs/queries/lazy_ecs_mapping_editor_field.tsx index 69c3e4bc477c9..e2e4d45b669ee 100644 --- a/x-pack/plugins/osquery/public/packs/queries/lazy_ecs_mapping_editor_field.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/lazy_ecs_mapping_editor_field.tsx @@ -6,14 +6,11 @@ */ import React, { lazy, Suspense } from 'react'; -import type { - ECSMappingEditorFieldProps, - ECSMappingEditorFieldRef, -} from './ecs_mapping_editor_field'; +import type { ECSMappingEditorFieldProps } from './ecs_mapping_editor_field'; const LazyECSMappingEditorField = lazy(() => import('./ecs_mapping_editor_field')); -export type { ECSMappingEditorFieldProps, ECSMappingEditorFieldRef }; +export type { ECSMappingEditorFieldProps }; export const ECSMappingEditorField = (props: ECSMappingEditorFieldProps) => ( diff --git a/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx b/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx index 8590968b58fb0..9bb0b521fb132 100644 --- a/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { isEmpty } from 'lodash'; +import { map } from 'lodash'; import { EuiFlyout, EuiTitle, @@ -19,17 +19,17 @@ import { EuiButton, EuiText, } from '@elastic/eui'; -import React, { useCallback, useMemo, useState, useRef } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { CodeEditorField } from '../../saved_queries/form/code_editor_field'; -import { Form, getUseField, Field, useFormData } from '../../shared_imports'; +import { Form, getUseField, Field } from '../../shared_imports'; import { PlatformCheckBoxGroupField } from './platform_checkbox_group_field'; import { ALL_OSQUERY_VERSIONS_OPTIONS } from './constants'; import { UsePackQueryFormProps, PackFormData, usePackQueryForm } from './use_pack_query_form'; import { SavedQueriesDropdown } from '../../saved_queries/saved_queries_dropdown'; -import { ECSMappingEditorField, ECSMappingEditorFieldRef } from './lazy_ecs_mapping_editor_field'; +import { ECSMappingEditorField } from './lazy_ecs_mapping_editor_field'; const CommonUseField = getUseField({ component: Field }); @@ -46,70 +46,46 @@ const QueryFlyoutComponent: React.FC = ({ onSave, onClose, }) => { - const ecsFieldRef = useRef(); const [isEditMode] = useState(!!defaultValue); const { form } = usePackQueryForm({ uniqueQueryIds, defaultValue, - handleSubmit: async (payload, isValid) => { - const ecsFieldValue = await ecsFieldRef?.current?.validate(); - const isEcsFieldValueValid = - ecsFieldValue && - Object.values(ecsFieldValue).every((field) => !isEmpty(Object.values(field)[0])); - - return new Promise((resolve) => { - if (isValid && isEcsFieldValueValid) { - onSave({ - ...payload, - ...(isEmpty(ecsFieldValue) ? {} : { ecs_mapping: ecsFieldValue }), - }); + handleSubmit: async (payload, isValid) => + new Promise((resolve) => { + if (isValid) { + onSave(payload); onClose(); } resolve(); - }); - }, + }), }); - const { submit, setFieldValue, reset, isSubmitting, validate } = form; - - const [{ query }] = useFormData({ - form, - watch: ['query'], - }); + const { submit, isSubmitting, updateFieldValues } = form; const handleSetQueryValue = useCallback( (savedQuery) => { - reset(); - if (savedQuery) { - setFieldValue('id', savedQuery.id); - setFieldValue('query', savedQuery.query); - - if (savedQuery.description) { - setFieldValue('description', savedQuery.description); - } - - if (savedQuery.interval) { - setFieldValue('interval', savedQuery.interval); - } - - if (savedQuery.platform) { - setFieldValue('platform', savedQuery.platform); - } - - if (savedQuery.version) { - setFieldValue('version', [savedQuery.version]); - } - - if (savedQuery.ecs_mapping) { - setFieldValue('ecs_mapping', savedQuery.ecs_mapping); - } + updateFieldValues({ + id: savedQuery.id, + query: savedQuery.query, + description: savedQuery.description, + platform: savedQuery.platform, + version: savedQuery.version, + interval: savedQuery.interval, + // @ts-expect-error update types + ecs_mapping: + map(savedQuery.ecs_mapping, (value, key) => ({ + key, + result: { + type: Object.keys(value)[0], + value: Object.values(value)[0], + }, + })) ?? [], + }); } - - validate(); }, - [reset, validate, setFieldValue] + [updateFieldValues] ); /* Avoids accidental closing of the flyout when the user clicks outside of the flyout */ const maskProps = useMemo(() => ({ onClick: () => ({}) }), []); @@ -190,12 +166,7 @@ const QueryFlyoutComponent: React.FC = ({ - + diff --git a/x-pack/plugins/osquery/public/packs/queries/schema.tsx b/x-pack/plugins/osquery/public/packs/queries/schema.tsx index d5b169b2c116c..526de9b73b0ea 100644 --- a/x-pack/plugins/osquery/public/packs/queries/schema.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/schema.tsx @@ -71,7 +71,7 @@ export const createFormSchema = (ids: Set) => ({ validations: [], }, ecs_mapping: { - defaultValue: {}, + defaultValue: [], type: FIELD_TYPES.JSON, validations: [], }, diff --git a/x-pack/plugins/osquery/public/packs/queries/use_pack_query_form.tsx b/x-pack/plugins/osquery/public/packs/queries/use_pack_query_form.tsx index b46230a65267e..2b044a443004d 100644 --- a/x-pack/plugins/osquery/public/packs/queries/use_pack_query_form.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/use_pack_query_form.tsx @@ -5,11 +5,12 @@ * 2.0. */ -import { isArray, isEmpty, xor } from 'lodash'; +import { isArray, isEmpty, xor, map } from 'lodash'; import uuid from 'uuid'; import { produce } from 'immer'; import { useMemo } from 'react'; +import { convertECSMappingToObject } from '../../../common/schemas/common/utils'; import { FormConfig, useForm } from '../../shared_imports'; import { createFormSchema } from './schema'; @@ -37,11 +38,14 @@ export interface PackFormData { platform?: string | undefined; version?: string | undefined; ecs_mapping?: - | Record< - string, - { - field: string; - } + | Array< + Record< + string, + { + field?: string; + value?: string; + } + > > | undefined; } @@ -76,7 +80,7 @@ export const usePackQueryForm = ({ id: '', query: '', interval: 3600, - ecs_mapping: {}, + ecs_mapping: [], }, // @ts-expect-error update types serializer: (payload) => @@ -100,6 +104,9 @@ export const usePackQueryForm = ({ if (isEmpty(draft.ecs_mapping)) { delete draft.ecs_mapping; + } else { + // @ts-expect-error update types + draft.ecs_mapping = convertECSMappingToObject(payload.ecs_mapping); } return draft; @@ -114,7 +121,17 @@ export const usePackQueryForm = ({ interval: payload.interval, platform: payload.platform, version: payload.version ? [payload.version] : [], - ecs_mapping: payload.ecs_mapping ?? {}, + ecs_mapping: !isArray(payload.ecs_mapping) + ? map(payload.ecs_mapping, (value, key) => ({ + key, + result: { + // @ts-expect-error update types + type: Object.keys(value)[0], + // @ts-expect-error update types + value: Object.values(value)[0], + }, + })) + : payload.ecs_mapping, }; }, // @ts-expect-error update types diff --git a/x-pack/plugins/osquery/public/results/results_table.tsx b/x-pack/plugins/osquery/public/results/results_table.tsx index c5017903564b1..229714eaaed99 100644 --- a/x-pack/plugins/osquery/public/results/results_table.tsx +++ b/x-pack/plugins/osquery/public/results/results_table.tsx @@ -109,11 +109,7 @@ const ResultsTableComponent: React.FC = ({ ]); const [columns, setColumns] = useState([]); - const { - data: allResultsData, - isFetched, - isLoading, - } = useAllResults({ + const { data: allResultsData, isLoading } = useAllResults({ actionId, activePage: pagination.pageIndex, limit: pagination.pageSize, @@ -361,20 +357,44 @@ const ResultsTableComponent: React.FC = ({ setIsLive(() => { if (!agentIds?.length || expired) return false; - return !!(aggregations.totalResponded !== agentIds?.length); + return !!( + aggregations.totalResponded !== agentIds?.length || + allResultsData?.totalCount !== aggregations?.totalRowCount || + (allResultsData?.totalCount && !allResultsData?.edges.length) + ); }), - [agentIds?.length, aggregations.failed, aggregations.totalResponded, expired] + [ + agentIds?.length, + aggregations.totalResponded, + aggregations?.totalRowCount, + allResultsData?.edges.length, + allResultsData?.totalCount, + expired, + ] ); if (!hasActionResultsPrivileges) { return ( - + + } + color="danger" + iconType="alert" + >

- {'Your user role doesn’t have index read permissions on the '} - logs-{OSQUERY_INTEGRATION_NAME}.result* - { - 'index. Access to this index is required to view osquery results. Administrators can update role permissions in Stack Management > Roles.' - } + read, + logs: logs-{OSQUERY_INTEGRATION_NAME}.result*, + }} + />

); @@ -388,13 +408,12 @@ const ResultsTableComponent: React.FC = ({ <> {isLive && } - {isFetched && !allResultsData?.edges.length && !aggregations?.totalRowCount ? ( + {!allResultsData?.edges.length ? ( <> ) : ( - // @ts-expect-error update types { - const responseData = await firstValueFrom( + const responseData = await lastValueFrom( data.search.search( { actionId, diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx index 432a108c8ece3..75969fd8f5dd1 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx @@ -13,12 +13,12 @@ import { EuiFlexItem, EuiSpacer, } from '@elastic/eui'; -import React, { useRef } from 'react'; +import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { useRouterNavigate } from '../../../common/lib/kibana'; import { Form } from '../../../shared_imports'; -import { SavedQueryForm, SavedQueryFormRefObject } from '../../../saved_queries/form'; +import { SavedQueryForm } from '../../../saved_queries/form'; import { useSavedQueryForm } from '../../../saved_queries/form/use_saved_query_form'; interface EditSavedQueryFormProps { @@ -32,19 +32,17 @@ const EditSavedQueryFormComponent: React.FC = ({ handleSubmit, viewMode, }) => { - const savedQueryFormRef = useRef(null); const savedQueryListProps = useRouterNavigate('saved_queries'); const { form } = useSavedQueryForm({ defaultValue, - savedQueryFormRef, handleSubmit, }); const { submit, isSubmitting } = form; return (
- + {!viewMode && ( <> diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx index 80899c476f2a3..414cfaabf7f83 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx @@ -13,12 +13,12 @@ import { EuiFlexItem, EuiSpacer, } from '@elastic/eui'; -import React, { useRef } from 'react'; +import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { useRouterNavigate } from '../../../common/lib/kibana'; import { Form } from '../../../shared_imports'; -import { SavedQueryForm, SavedQueryFormRefObject } from '../../../saved_queries/form'; +import { SavedQueryForm } from '../../../saved_queries/form'; import { useSavedQueryForm } from '../../../saved_queries/form/use_saved_query_form'; interface NewSavedQueryFormProps { @@ -30,19 +30,17 @@ const NewSavedQueryFormComponent: React.FC = ({ defaultValue, handleSubmit, }) => { - const savedQueryFormRef = useRef(null); const savedQueryListProps = useRouterNavigate('saved_queries'); const { form } = useSavedQueryForm({ defaultValue, - savedQueryFormRef, handleSubmit, }); const { submit, isSubmitting, isValid } = form; return ( - + diff --git a/x-pack/plugins/osquery/public/saved_queries/form/index.tsx b/x-pack/plugins/osquery/public/saved_queries/form/index.tsx index cc0aa8ee08ca4..44fae4efd3608 100644 --- a/x-pack/plugins/osquery/public/saved_queries/form/index.tsx +++ b/x-pack/plugins/osquery/public/saved_queries/form/index.tsx @@ -13,25 +13,15 @@ import { EuiText, EuiButtonEmpty, } from '@elastic/eui'; -import React, { - useCallback, - useMemo, - useRef, - forwardRef, - useImperativeHandle, - useState, -} from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { ALL_OSQUERY_VERSIONS_OPTIONS } from '../../packs/queries/constants'; import { PlatformCheckBoxGroupField } from '../../packs/queries/platform_checkbox_group_field'; -import { Field, getUseField, UseField, useFormData } from '../../shared_imports'; +import { Field, getUseField, UseField } from '../../shared_imports'; import { CodeEditorField } from './code_editor_field'; -import { - ECSMappingEditorField, - ECSMappingEditorFieldRef, -} from '../../packs/queries/lazy_ecs_mapping_editor_field'; +import { ECSMappingEditorField } from '../../packs/queries/lazy_ecs_mapping_editor_field'; import { PlaygroundFlyout } from './playground_flyout'; export const CommonUseField = getUseField({ component: Field }); @@ -41,131 +31,112 @@ interface SavedQueryFormProps { hasPlayground?: boolean; isValid?: boolean; } -export interface SavedQueryFormRefObject { - validateEcsMapping: ECSMappingEditorFieldRef['validate']; -} -const SavedQueryFormComponent = forwardRef( - ({ viewMode, hasPlayground, isValid }, ref) => { - const [playgroundVisible, setPlaygroundVisible] = useState(false); - const ecsFieldRef = useRef(); - - const euiFieldProps = useMemo( - () => ({ - isDisabled: !!viewMode, - }), - [viewMode] - ); +const SavedQueryFormComponent: React.FC = ({ + viewMode, + hasPlayground, + isValid, +}) => { + const [playgroundVisible, setPlaygroundVisible] = useState(false); - const [{ query }] = useFormData({ watch: ['query'] }); + const euiFieldProps = useMemo( + () => ({ + isDisabled: !!viewMode, + }), + [viewMode] + ); - const handleHidePlayground = useCallback(() => setPlaygroundVisible(false), []); + const handleHidePlayground = useCallback(() => setPlaygroundVisible(false), []); - const handleTogglePlayground = useCallback( - () => setPlaygroundVisible((prevValue) => !prevValue), - [] - ); + const handleTogglePlayground = useCallback( + () => setPlaygroundVisible((prevValue) => !prevValue), + [] + ); - useImperativeHandle( - ref, - () => ({ - validateEcsMapping: () => { - if (ecsFieldRef.current) { - return ecsFieldRef.current.validate(); - } + const intervalEuiFieldProps = useMemo( + () => ({ + append: 's', + ...euiFieldProps, + }), + [euiFieldProps] + ); - return Promise.resolve(false); - }, + const versionEuiFieldProps = useMemo( + () => ({ + noSuggestions: false, + singleSelection: { asPlainText: true }, + placeholder: i18n.translate('xpack.osquery.pack.queriesTable.osqueryVersionAllLabel', { + defaultMessage: 'ALL', }), - [] - ); + options: ALL_OSQUERY_VERSIONS_OPTIONS, + onCreateOption: undefined, + ...euiFieldProps, + }), + [euiFieldProps] + ); - return ( - <> - - - - - - + return ( + <> + + + + + + + + + + + + {!viewMode && hasPlayground && ( - - + + + Test configuration + - {!viewMode && hasPlayground && ( - - - - Test configuration - - - - )} - - - - -
- -
-
- + )} + + + + +
- - - - - - - + + + - - - - - - - - {playgroundVisible && ( - - )} - - ); - } -); + + + + + + + + + + + + + + + {playgroundVisible && ( + + )} + + ); +}; + +SavedQueryFormComponent.displayName = 'SavedQueryForm'; export const SavedQueryForm = React.memo(SavedQueryFormComponent); diff --git a/x-pack/plugins/osquery/public/saved_queries/form/playground_flyout.tsx b/x-pack/plugins/osquery/public/saved_queries/form/playground_flyout.tsx index 60f1dff400867..b5af2652fd110 100644 --- a/x-pack/plugins/osquery/public/saved_queries/form/playground_flyout.tsx +++ b/x-pack/plugins/osquery/public/saved_queries/form/playground_flyout.tsx @@ -6,7 +6,7 @@ */ import { EuiFlyout, EuiFlyoutHeader, EuiTitle, EuiFlyoutBody } from '@elastic/eui'; -import React from 'react'; +import React, { useMemo } from 'react'; import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -26,11 +26,14 @@ interface PlaygroundFlyoutProps { } const PlaygroundFlyoutComponent: React.FC = ({ enabled, onClose }) => { - // eslint-disable-next-line @typescript-eslint/naming-convention - const [{ query, ecs_mapping, id }] = useFormData({ + const [{ query, ecs_mapping: ecsMapping, id }, formDataSerializer] = useFormData({ watch: ['query', 'ecs_mapping', 'savedQueryId'], }); + /* recalculate the form data when ecs_mapping changes */ + // eslint-disable-next-line react-hooks/exhaustive-deps + const serializedFormData = useMemo(() => formDataSerializer(), [ecsMapping, formDataSerializer]); + return ( @@ -48,7 +51,7 @@ const PlaygroundFlyoutComponent: React.FC = ({ enabled, o enabled={enabled && query !== ''} formType="simple" query={query} - ecs_mapping={ecs_mapping} + ecs_mapping={serializedFormData.ecs_mapping} savedQueryId={id} queryField={false} ecsMappingField={false} diff --git a/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx b/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx index bf4123fd86128..6da252f78aedf 100644 --- a/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx +++ b/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx @@ -8,27 +8,22 @@ import { isArray, isEmpty, map } from 'lodash'; import uuid from 'uuid'; import { produce } from 'immer'; -import { RefObject, useMemo } from 'react'; +import { useMemo } from 'react'; +import { convertECSMappingToObject } from '../../../common/schemas/common/utils'; import { useForm } from '../../shared_imports'; import { createFormSchema } from '../../packs/queries/schema'; import { PackFormData } from '../../packs/queries/use_pack_query_form'; import { useSavedQueries } from '../use_saved_queries'; -import { SavedQueryFormRefObject } from '.'; const SAVED_QUERY_FORM_ID = 'savedQueryForm'; interface UseSavedQueryFormProps { defaultValue?: unknown; handleSubmit: (payload: unknown) => Promise; - savedQueryFormRef: RefObject; } -export const useSavedQueryForm = ({ - defaultValue, - handleSubmit, - savedQueryFormRef, -}: UseSavedQueryFormProps) => { +export const useSavedQueryForm = ({ defaultValue, handleSubmit }: UseSavedQueryFormProps) => { const { data } = useSavedQueries({}); const ids: string[] = useMemo( () => map(data?.saved_objects, 'attributes.id') ?? [], @@ -50,14 +45,9 @@ export const useSavedQueryForm = ({ id: SAVED_QUERY_FORM_ID + uuid.v4(), schema: formSchema, onSubmit: async (formData, isValid) => { - const ecsFieldValue = await savedQueryFormRef?.current?.validateEcsMapping(); - - if (isValid && !!ecsFieldValue) { + if (isValid) { try { - await handleSubmit({ - ...formData, - ecs_mapping: ecsFieldValue, - }); + await handleSubmit(formData); // eslint-disable-next-line no-empty } catch (e) {} } @@ -82,9 +72,12 @@ export const useSavedQueryForm = ({ } } - if (isEmpty(draft.ecs_mapping)) { + if (isEmpty(payload.ecs_mapping)) { // @ts-expect-error update types delete draft.ecs_mapping; + } else { + // @ts-expect-error update types + draft.ecs_mapping = convertECSMappingToObject(payload.ecs_mapping); } // @ts-expect-error update types @@ -103,7 +96,16 @@ export const useSavedQueryForm = ({ interval: payload.interval ?? 3600, platform: payload.platform, version: payload.version ? [payload.version] : [], - ecs_mapping: payload.ecs_mapping ?? {}, + ecs_mapping: + (!isEmpty(payload.ecs_mapping) && + map(payload.ecs_mapping, (value, key) => ({ + key, + result: { + type: Object.keys(value)[0], + value: Object.values(value)[0], + }, + }))) ?? + [], }; }, }); diff --git a/x-pack/plugins/osquery/public/saved_queries/saved_queries_dropdown.tsx b/x-pack/plugins/osquery/public/saved_queries/saved_queries_dropdown.tsx index 4d352b7fd2516..eec949fbe312b 100644 --- a/x-pack/plugins/osquery/public/saved_queries/saved_queries_dropdown.tsx +++ b/x-pack/plugins/osquery/public/saved_queries/saved_queries_dropdown.tsx @@ -12,7 +12,6 @@ import { SimpleSavedObject } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import styled from 'styled-components'; -import deepEqual from 'fast-deep-equal'; import { useSavedQueries } from './use_saved_queries'; import { useFormData } from '../shared_imports'; @@ -47,10 +46,7 @@ const SavedQueriesDropdownComponent: React.FC = ({ }) => { const [selectedOptions, setSelectedOptions] = useState([]); - // eslint-disable-next-line @typescript-eslint/naming-convention - const [{ query, ecs_mapping, savedQueryId }] = useFormData({ - watch: ['ecs_mapping', 'query', 'savedQueryId'], - }); + const [{ savedQueryId }] = useFormData(); const { data } = useSavedQueries({}); @@ -122,15 +118,11 @@ const SavedQueriesDropdownComponent: React.FC = ({ if ( selectedOptions.length && // @ts-expect-error update types - (selectedOptions[0].value.savedQueryId !== savedQueryId || - // @ts-expect-error update types - selectedOptions[0].value.query !== query || - // @ts-expect-error update types - !deepEqual(selectedOptions[0].value.ecs_mapping, ecs_mapping)) + selectedOptions[0].value.savedQueryId !== savedQueryId ) { setSelectedOptions([]); } - }, [ecs_mapping, query, savedQueryId, selectedOptions]); + }, [savedQueryId, selectedOptions]); return ( = ({ onClose, isExternal, }) => { - const savedQueryFormRef = useRef(null); const createSavedQueryMutation = useCreateSavedQuery({ withRedirect: false }); const handleSubmit = useCallback( @@ -48,7 +47,6 @@ const SavedQueryFlyoutComponent: React.FC = ({ const { form } = useSavedQueryForm({ defaultValue, - savedQueryFormRef, handleSubmit, }); const { submit, isSubmitting } = form; @@ -74,7 +72,7 @@ const SavedQueryFlyoutComponent: React.FC = ({ - + diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx index 51dba40f8114e..01285ed69c5d0 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx @@ -8,6 +8,7 @@ import { EuiErrorBoundary, EuiLoadingContent, EuiEmptyPrompt, EuiCode } from '@elastic/eui'; import React, { useMemo } from 'react'; import { QueryClientProvider } from 'react-query'; +import { CoreStart } from '@kbn/core/public'; import { AGENT_STATUS_ERROR, EMPTY_PROMPT, @@ -22,16 +23,19 @@ import { queryClient } from '../../query_client'; import { OsqueryIcon } from '../../components/osquery_icon'; import { KibanaThemeProvider } from '../../shared_imports'; import { useIsOsqueryAvailable } from './use_is_osquery_available'; +import { StartPlugins } from '../../types'; interface OsqueryActionProps { agentId?: string; formType: 'steps' | 'simple'; + hideAgentsField?: boolean; addToTimeline?: (payload: { query: [string, string]; isIcon?: true }) => React.ReactElement; } const OsqueryActionComponent: React.FC = ({ agentId, formType = 'simple', + hideAgentsField, addToTimeline, }) => { const permissions = useKibana().services.application.capabilities.osquery; @@ -103,18 +107,37 @@ const OsqueryActionComponent: React.FC = ({ ); } - return ; + return ( + + ); }; export const OsqueryAction = React.memo(OsqueryActionComponent); -// @ts-expect-error update types -const OsqueryActionWrapperComponent = ({ services, agentId, formType, addToTimeline }) => ( +type OsqueryActionWrapperProps = { services: CoreStart & StartPlugins } & OsqueryActionProps; + +const OsqueryActionWrapperComponent: React.FC = ({ + services, + agentId, + formType, + hideAgentsField = false, + addToTimeline, +}) => ( - + diff --git a/x-pack/plugins/osquery/public/shared_imports.ts b/x-pack/plugins/osquery/public/shared_imports.ts index 4e08bcd46d9ee..843cc512826c6 100644 --- a/x-pack/plugins/osquery/public/shared_imports.ts +++ b/x-pack/plugins/osquery/public/shared_imports.ts @@ -23,6 +23,8 @@ export { Form, FormDataProvider, UseArray, + ArrayItem, + FormArrayField, UseField, UseMultiFields, useForm, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index a259dc0d21e96..84fee5016b778 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -21965,9 +21965,6 @@ "xpack.osquery.liveQueryDetails.viewLiveQueriesHistoryTitle": "Afficher l'historique des recherches en direct", "xpack.osquery.liveQueryForm.form.saveForLaterButtonLabel": "Enregistrer pour plus tard", "xpack.osquery.liveQueryForm.form.submitButtonLabel": "Envoyer", - "xpack.osquery.liveQueryForm.steps.agentsStepHeading": "Sélectionner les agents", - "xpack.osquery.liveQueryForm.steps.queryStepHeading": "Entrer la recherche", - "xpack.osquery.liveQueryForm.steps.resultsStepHeading": "Vérifier les résultats", "xpack.osquery.liveQueryResults.table.agentColumnTitle": "agent", "xpack.osquery.liveQueryResults.table.fieldMappedLabel": "Le champ est mappé à", "xpack.osquery.newLiveQuery.pageTitle": "Nouvelle recherche en direct", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 262515a21ffc8..a74c31404cedc 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -22118,9 +22118,6 @@ "xpack.osquery.liveQueryDetails.viewLiveQueriesHistoryTitle": "ライブクエリ履歴を表示", "xpack.osquery.liveQueryForm.form.saveForLaterButtonLabel": "後で使用するために保存する", "xpack.osquery.liveQueryForm.form.submitButtonLabel": "送信", - "xpack.osquery.liveQueryForm.steps.agentsStepHeading": "エージェントを選択", - "xpack.osquery.liveQueryForm.steps.queryStepHeading": "クエリを入力", - "xpack.osquery.liveQueryForm.steps.resultsStepHeading": "結果を確認", "xpack.osquery.liveQueryResults.table.agentColumnTitle": "エージェント", "xpack.osquery.liveQueryResults.table.fieldMappedLabel": "フィールドは以下にマッピングされています", "xpack.osquery.newLiveQuery.pageTitle": "新しいライブクエリ", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index e3e90d584f15e..9f2a139a65c36 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -22149,9 +22149,6 @@ "xpack.osquery.liveQueryDetails.viewLiveQueriesHistoryTitle": "查看实时查询历史记录", "xpack.osquery.liveQueryForm.form.saveForLaterButtonLabel": "保存,以后继续", "xpack.osquery.liveQueryForm.form.submitButtonLabel": "提交", - "xpack.osquery.liveQueryForm.steps.agentsStepHeading": "选择代理", - "xpack.osquery.liveQueryForm.steps.queryStepHeading": "输入查询", - "xpack.osquery.liveQueryForm.steps.resultsStepHeading": "检查结果", "xpack.osquery.liveQueryResults.table.agentColumnTitle": "代理", "xpack.osquery.liveQueryResults.table.fieldMappedLabel": "字段已映射到", "xpack.osquery.newLiveQuery.pageTitle": "新建实时查询", From cf46ec995062b78894b94cd4b36142db2c2cc476 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Fri, 29 Apr 2022 16:35:27 +0300 Subject: [PATCH 14/89] [TSVB] include/exclude values should be ignored for multi_terms (#130884) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../splits/__snapshots__/terms.test.js.snap | 2 ++ .../application/components/splits/terms.js | 6 ++-- .../series/split_by_terms.js | 13 ++++---- .../series/split_by_terms.test.js | 31 +++++++++++++++++++ 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/plugins/vis_types/timeseries/public/application/components/splits/__snapshots__/terms.test.js.snap b/src/plugins/vis_types/timeseries/public/application/components/splits/__snapshots__/terms.test.js.snap index b7c5095535fbc..fdfe472f46689 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/splits/__snapshots__/terms.test.js.snap +++ b/src/plugins/vis_types/timeseries/public/application/components/splits/__snapshots__/terms.test.js.snap @@ -90,6 +90,7 @@ exports[`src/legacy/core_plugins/metrics/public/components/splits/terms.test.js @@ -113,6 +114,7 @@ exports[`src/legacy/core_plugins/metrics/public/components/splits/terms.test.js diff --git a/src/plugins/vis_types/timeseries/public/application/components/splits/terms.js b/src/plugins/vis_types/timeseries/public/application/components/splits/terms.js index bfc31f7e46d48..071e91ffee981 100644 --- a/src/plugins/vis_types/timeseries/public/application/components/splits/terms.js +++ b/src/plugins/vis_types/timeseries/public/application/components/splits/terms.js @@ -95,6 +95,8 @@ export const SplitByTermsUI = ({ (selectedOptions) => { onChange({ terms_field: selectedOptions.length === 1 ? selectedOptions[0] : selectedOptions, + terms_include: undefined, + terms_exclude: undefined, }); }, [onChange] @@ -174,7 +176,7 @@ export const SplitByTermsUI = ({ } > @@ -191,7 +193,7 @@ export const SplitByTermsUI = ({ } > diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js index 07e8ef4a0e5fd..d093019fee3d8 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.js @@ -37,15 +37,16 @@ export function splitByTerms(req, panel, series, esQueryConfig, seriesIndex) { ); } else { overwrite(doc, `aggs.${series.id}.${termsType}.field`, termsIds[0]); + if (series.terms_include) { + overwrite(doc, `aggs.${series.id}.${termsType}.include`, series.terms_include); + } + if (series.terms_exclude) { + overwrite(doc, `aggs.${series.id}.${termsType}.exclude`, series.terms_exclude); + } } overwrite(doc, `aggs.${series.id}.${termsType}.size`, series.terms_size); - if (series.terms_include) { - overwrite(doc, `aggs.${series.id}.${termsType}.include`, series.terms_include); - } - if (series.terms_exclude) { - overwrite(doc, `aggs.${series.id}.${termsType}.exclude`, series.terms_exclude); - } + if (metric && metric.type !== 'count' && ~basicAggs.indexOf(metric.type)) { const sortAggKey = `${orderByTerms}-SORT`; const fn = bucketTransform[metric.type]; diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js b/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js index 984eb385ca4a6..0795e3390eb2f 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/request_processors/series/split_by_terms.test.js @@ -111,6 +111,37 @@ describe('splitByTerms', () => { }); }); + test('should ignore "include/exclude" for multi terms', () => { + series.terms_include = 'a'; + series.terms_exclude = 'b'; + series.terms_field = ['c', 'd']; + const next = jest.fn((doc) => doc); + const doc = splitByTerms(req, panel, series, config, seriesIndex)(next)({}); + + expect(doc).toMatchInlineSnapshot(` + Object { + "aggs": Object { + "test": Object { + "multi_terms": Object { + "order": Object { + "_count": "desc", + }, + "size": 10, + "terms": Array [ + Object { + "field": "c", + }, + Object { + "field": "d", + }, + ], + }, + }, + }, + } + `); + }); + test('calls next and does not add a terms agg', () => { series.split_mode = 'everything'; const next = jest.fn((doc) => doc); From 9d15ab1ec2dc29b9b8014fade9255233e48062f0 Mon Sep 17 00:00:00 2001 From: Ying Mao Date: Fri, 29 Apr 2022 09:35:39 -0400 Subject: [PATCH 15/89] [Connector] API for adding OAuth support to ServiceNow connectors (#131084) * Adding new OAuth fields to ServiceNow ExternalIncidentServiceConfigurationBase and ExternalIncidentServiceSecretConfiguration * Creating new function in ConnectorTokenClient for updating or replacing token * Update servicenow executors to get Oauth access tokens if configured. Still need to update unit tests for services * Creating wrapper function for createService to only create one axios instance * Fixing translation check error * Adding migration for adding isOAuth to service now connectors * Fixing unit tests * Fixing functional test * Not requiring privateKeyPassword * Fixing tests * Adding functional tests for connector creation * Adding functional tests * Fixing functional test * PR feedback * Fixing test * PR feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../lib/connector_token_client.mock.ts | 1 + .../lib/connector_token_client.test.ts | 141 ++++++ .../lib/connector_token_client.ts | 39 ++ .../lib/create_jwt_assertion.test.ts | 24 ++ .../lib/create_jwt_assertion.ts | 20 +- .../lib/send_email.test.ts | 2 +- .../builtin_action_types/lib/send_email.ts | 31 +- .../servicenow/create_service_wrapper.test.ts | 89 ++++ .../servicenow/create_service_wrapper.ts | 54 +++ .../builtin_action_types/servicenow/index.ts | 31 +- .../builtin_action_types/servicenow/schema.ts | 11 +- .../servicenow/service.test.ts | 360 ++++++++++++---- .../servicenow/service.ts | 46 +- .../servicenow/service_itom.test.ts | 11 +- .../servicenow/service_itom.ts | 35 +- .../servicenow/service_sir.test.ts | 11 +- .../servicenow/service_sir.ts | 37 +- .../servicenow/translations.ts | 39 ++ .../builtin_action_types/servicenow/types.ts | 24 +- .../servicenow/utils.test.ts | 310 +++++++++++++- .../builtin_action_types/servicenow/utils.ts | 141 +++++- .../servicenow/validators.test.ts | 401 ++++++++++++++++++ .../servicenow/validators.ts | 92 +++- .../saved_objects/actions_migrations.test.ts | 60 ++- .../saved_objects/actions_migrations.ts | 33 ++ .../builtin_action_types/servicenow_itom.ts | 232 +++++++++- .../builtin_action_types/servicenow_itsm.ts | 258 +++++++++-- .../builtin_action_types/servicenow_sir.ts | 251 ++++++++++- .../spaces_only/tests/actions/migrations.ts | 18 + .../cases_api_integration/common/lib/utils.ts | 19 +- .../tests/trial/configure/get_connectors.ts | 36 +- .../tests/trial/configure/get_connectors.ts | 45 +- .../functional/es_archives/actions/data.json | 92 ++++ 33 files changed, 2695 insertions(+), 299 deletions(-) create mode 100644 x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.test.ts create mode 100644 x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.ts create mode 100644 x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.test.ts diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.mock.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.mock.ts index 71d0a2f4466a4..4b38f6fcb53e6 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.mock.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.mock.ts @@ -14,6 +14,7 @@ const createConnectorTokenClientMock = () => { get: jest.fn(), update: jest.fn(), deleteConnectorTokens: jest.fn(), + updateOrReplace: jest.fn(), }; return mocked; }; diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.test.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.test.ts index e3e9f3b362ae9..54765b9e01b8f 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.test.ts @@ -357,3 +357,144 @@ describe('delete()', () => { `); }); }); + +describe('updateOrReplace()', () => { + test('creates new SO if current token is null', async () => { + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '1', + type: 'connector_token', + attributes: { + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + expiresAt: new Date().toISOString(), + }, + references: [], + }); + await connectorTokenClient.updateOrReplace({ + connectorId: '1', + token: null, + newToken: 'newToken', + expiresInSec: 1000, + deleteExisting: false, + }); + expect(unsecuredSavedObjectsClient.create).toHaveBeenCalledTimes(1); + expect((unsecuredSavedObjectsClient.create.mock.calls[0][1] as ConnectorToken).token).toBe( + 'newToken' + ); + + expect(unsecuredSavedObjectsClient.find).not.toHaveBeenCalled(); + expect(unsecuredSavedObjectsClient.delete).not.toHaveBeenCalled(); + }); + + test('creates new SO and deletes all existing tokens for connector if current token is null and deleteExisting is true', async () => { + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '1', + type: 'connector_token', + attributes: { + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + expiresAt: new Date().toISOString(), + }, + references: [], + }); + unsecuredSavedObjectsClient.find.mockResolvedValueOnce({ + total: 1, + per_page: 10, + page: 1, + saved_objects: [ + { + id: '1', + type: 'connector_token', + attributes: { + connectorId: '123', + tokenType: 'access_token', + createdAt: new Date().toISOString(), + expiresAt: new Date().toISOString(), + }, + score: 1, + references: [], + }, + { + id: '2', + type: 'connector_token', + attributes: { + connectorId: '123', + tokenType: 'access_token', + createdAt: new Date().toISOString(), + expiresAt: new Date().toISOString(), + }, + score: 1, + references: [], + }, + ], + }); + await connectorTokenClient.updateOrReplace({ + connectorId: '1', + token: null, + newToken: 'newToken', + expiresInSec: 1000, + deleteExisting: true, + }); + expect(unsecuredSavedObjectsClient.create).toHaveBeenCalledTimes(1); + expect((unsecuredSavedObjectsClient.create.mock.calls[0][1] as ConnectorToken).token).toBe( + 'newToken' + ); + + expect(unsecuredSavedObjectsClient.find).toHaveBeenCalledTimes(1); + expect(unsecuredSavedObjectsClient.delete).toHaveBeenCalledTimes(2); + }); + + test('updates existing SO if current token exists', async () => { + unsecuredSavedObjectsClient.get.mockResolvedValueOnce({ + id: '1', + type: 'connector_token', + attributes: { + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + createdAt: new Date().toISOString(), + }, + references: [], + }); + unsecuredSavedObjectsClient.checkConflicts.mockResolvedValueOnce({ + errors: [], + }); + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '1', + type: 'connector_token', + attributes: { + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + expiresAt: new Date().toISOString(), + }, + references: [], + }); + await connectorTokenClient.updateOrReplace({ + connectorId: '1', + token: { + id: '3', + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + createdAt: new Date().toISOString(), + expiresAt: new Date().toISOString(), + }, + newToken: 'newToken', + expiresInSec: 1000, + deleteExisting: true, + }); + + expect(unsecuredSavedObjectsClient.find).not.toHaveBeenCalled(); + expect(unsecuredSavedObjectsClient.delete).not.toHaveBeenCalled(); + + expect(unsecuredSavedObjectsClient.get).toHaveBeenCalledTimes(1); + expect(unsecuredSavedObjectsClient.checkConflicts).toHaveBeenCalledTimes(1); + expect(unsecuredSavedObjectsClient.create).toHaveBeenCalledTimes(1); + expect((unsecuredSavedObjectsClient.create.mock.calls[0][1] as ConnectorToken).token).toBe( + 'newToken' + ); + }); +}); diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.ts index 949ec855ee3f0..6ce91fad94546 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/connector_token_client.ts @@ -33,6 +33,13 @@ export interface UpdateOptions { tokenType?: string; } +interface UpdateOrReplaceOptions { + connectorId: string; + token: ConnectorToken | null; + newToken: string; + expiresInSec: number; + deleteExisting: boolean; +} export class ConnectorTokenClient { private readonly logger: Logger; private readonly unsecuredSavedObjectsClient: SavedObjectsClientContract; @@ -245,4 +252,36 @@ export class ConnectorTokenClient { throw err; } } + + public async updateOrReplace({ + connectorId, + token, + newToken, + expiresInSec, + deleteExisting, + }: UpdateOrReplaceOptions) { + expiresInSec = expiresInSec ?? 3600; + if (token === null) { + if (deleteExisting) { + await this.deleteConnectorTokens({ + connectorId, + tokenType: 'access_token', + }); + } + + await this.create({ + connectorId, + token: newToken, + expiresAtMillis: new Date(Date.now() + expiresInSec * 1000).toISOString(), + tokenType: 'access_token', + }); + } else { + await this.update({ + id: token.id!.toString(), + token: newToken, + expiresAtMillis: new Date(Date.now() + expiresInSec * 1000).toISOString(), + tokenType: 'access_token', + }); + } + } } diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.test.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.test.ts index d68cc9a5e4398..d679564c82472 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.test.ts @@ -17,6 +17,8 @@ import { createJWTAssertion } from './create_jwt_assertion'; const jwtSign = jwt.sign as jest.Mock; const mockLogger = loggingSystemMock.create().get() as jest.Mocked; +Date.now = jest.fn(() => 0); + describe('createJWTAssertion', () => { test('creating a JWT token from provided claims with default values', () => { jwtSign.mockReturnValueOnce('123456qwertyjwttoken'); @@ -27,6 +29,28 @@ describe('createJWTAssertion', () => { subject: 'test@gmail.com', }); + expect(jwtSign).toHaveBeenCalledWith( + { aud: '1', exp: 3600, iat: 0, iss: 'someappid', sub: 'test@gmail.com' }, + { key: 'test', passphrase: '123456' }, + { algorithm: 'RS256' } + ); + expect(assertion).toMatchInlineSnapshot('"123456qwertyjwttoken"'); + }); + + test('creating a JWT token when private key password is null', () => { + jwtSign.mockReturnValueOnce('123456qwertyjwttoken'); + + const assertion = createJWTAssertion(mockLogger, 'test', null, { + audience: '1', + issuer: 'someappid', + subject: 'test@gmail.com', + }); + + expect(jwtSign).toHaveBeenCalledWith( + { aud: '1', exp: 3600, iat: 0, iss: 'someappid', sub: 'test@gmail.com' }, + 'test', + { algorithm: 'RS256' } + ); expect(assertion).toMatchInlineSnapshot('"123456qwertyjwttoken"'); }); diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.ts index f4723e59b418c..b33a2d17ed9d8 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/create_jwt_assertion.ts @@ -12,18 +12,18 @@ export interface JWTClaims { audience: string; subject: string; issuer: string; - expireInMilisecons?: number; + expireInMilliseconds?: number; keyId?: string; } export function createJWTAssertion( logger: Logger, privateKey: string, - privateKeyPassword: string, + privateKeyPassword: string | null, reservedClaims: JWTClaims, customClaims?: Record ): string { - const { subject, audience, issuer, expireInMilisecons, keyId } = reservedClaims; + const { subject, audience, issuer, expireInMilliseconds, keyId } = reservedClaims; const iat = Math.floor(Date.now() / 1000); const headerObj = { algorithm: 'RS256' as Algorithm, ...(keyId ? { keyid: keyId } : {}) }; @@ -33,17 +33,19 @@ export function createJWTAssertion( aud: audience, // audience claim identifies the recipients that the JWT is intended for iss: issuer, // issuer claim identifies the principal that issued the JWT iat, // issued at claim identifies the time at which the JWT was issued - exp: iat + (expireInMilisecons ?? 3600), // expiration time claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing + exp: iat + (expireInMilliseconds ?? 3600), // expiration time claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing ...(customClaims ?? {}), }; try { const jwtToken = jwt.sign( - JSON.stringify(payloadObj), - { - key: privateKey, - passphrase: privateKeyPassword, - }, + payloadObj, + privateKeyPassword + ? { + key: privateKey, + passphrase: privateKeyPassword, + } + : privateKey, headerObj ); return jwtToken; diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts index 8c36113032461..1d1c2c46cb0e4 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.test.ts @@ -601,7 +601,7 @@ describe('send_email module', () => { await sendEmail(mockLogger, sendEmailOptions, connectorTokenClientM); expect(requestOAuthClientCredentialsTokenMock.mock.calls.length).toBe(1); - expect(connectorTokenClientM.deleteConnectorTokens.mock.calls.length).toBe(1); + expect(connectorTokenClientM.updateOrReplace.mock.calls.length).toBe(1); delete sendEmailGraphApiMock.mock.calls[0][0].options.configurationUtilities; sendEmailGraphApiMock.mock.calls[0].pop(); diff --git a/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.ts b/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.ts index a664b22f9df34..983846adc71e0 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/lib/send_email.ts @@ -105,30 +105,13 @@ async function sendEmailWithExchange( // try to update connector_token SO try { - if (connectorToken === null) { - if (hasErrors) { - // delete existing access tokens - await connectorTokenClient.deleteConnectorTokens({ - connectorId, - tokenType: 'access_token', - }); - } - await connectorTokenClient.create({ - connectorId, - token: accessToken, - // convert MS Exchange expiresIn from seconds to milliseconds - expiresAtMillis: new Date(Date.now() + tokenResult.expiresIn * 1000).toISOString(), - tokenType: 'access_token', - }); - } else { - await connectorTokenClient.update({ - id: connectorToken.id!.toString(), - token: accessToken, - // convert MS Exchange expiresIn from seconds to milliseconds - expiresAtMillis: new Date(Date.now() + tokenResult.expiresIn * 1000).toISOString(), - tokenType: 'access_token', - }); - } + await connectorTokenClient.updateOrReplace({ + connectorId, + token: connectorToken, + newToken: accessToken, + expiresInSec: tokenResult.expiresIn, + deleteExisting: hasErrors, + }); } catch (err) { logger.warn( `Not able to update connector token for connectorId: ${connectorId} due to error: ${err.message}` diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.test.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.test.ts new file mode 100644 index 0000000000000..37ada260c75a9 --- /dev/null +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.test.ts @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import axios from 'axios'; +import { createServiceWrapper } from './create_service_wrapper'; +import { Logger } from '@kbn/core/server'; +import { loggingSystemMock } from '@kbn/core/server/mocks'; +import { actionsConfigMock } from '../../actions_config.mock'; +import { connectorTokenClientMock } from '../lib/connector_token_client.mock'; +import { snExternalServiceConfig } from './config'; + +const logger = loggingSystemMock.create().get() as jest.Mocked; +const connectorTokenClient = connectorTokenClientMock.create(); +const configurationUtilities = actionsConfigMock.create(); + +jest.mock('axios'); +axios.create = jest.fn(() => axios); + +describe('createServiceWrapper', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + test('creates axios instance with apiUrl', () => { + const createServiceFn = jest.fn(); + const credentials = { + config: { + apiUrl: 'https://test-sn.service-now.com', + }, + secrets: { + username: 'username', + password: 'password', + }, + }; + const serviceConfig = snExternalServiceConfig['.servicenow']; + createServiceWrapper({ + connectorId: '123', + credentials, + logger, + configurationUtilities, + serviceConfig, + connectorTokenClient, + createServiceFn, + }); + + expect(createServiceFn).toHaveBeenCalledWith({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance: axios, + }); + }); + + test('handles apiUrl with trailing slash', () => { + const createServiceFn = jest.fn(); + const credentials = { + config: { + apiUrl: 'https://test-sn.service-now.com/', + }, + secrets: { + username: 'username', + password: 'password', + }, + }; + const serviceConfig = snExternalServiceConfig['.servicenow']; + createServiceWrapper({ + connectorId: '123', + credentials, + logger, + configurationUtilities, + serviceConfig, + connectorTokenClient, + createServiceFn, + }); + + expect(createServiceFn).toHaveBeenCalledWith({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance: axios, + }); + }); +}); diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.ts new file mode 100644 index 0000000000000..cd431027a720f --- /dev/null +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/create_service_wrapper.ts @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Logger } from '@kbn/core/server'; +import { ExternalService, ExternalServiceCredentials, SNProductsConfigValue } from './types'; + +import { ServiceNowPublicConfigurationType, ServiceFactory } from './types'; +import { ActionsConfigurationUtilities } from '../../actions_config'; +import { getAxiosInstance } from './utils'; +import { ConnectorTokenClientContract } from '../../types'; + +interface CreateServiceWrapperOpts { + connectorId: string; + credentials: ExternalServiceCredentials; + logger: Logger; + configurationUtilities: ActionsConfigurationUtilities; + serviceConfig: SNProductsConfigValue; + connectorTokenClient: ConnectorTokenClientContract; + createServiceFn: ServiceFactory; +} + +export function createServiceWrapper({ + connectorId, + credentials, + logger, + configurationUtilities, + serviceConfig, + connectorTokenClient, + createServiceFn, +}: CreateServiceWrapperOpts): T { + const { config } = credentials; + const { apiUrl: url } = config as ServiceNowPublicConfigurationType; + const urlWithoutTrailingSlash = url.endsWith('/') ? url.slice(0, -1) : url; + const axiosInstance = getAxiosInstance({ + connectorId, + logger, + configurationUtilities, + credentials, + snServiceUrl: urlWithoutTrailingSlash, + connectorTokenClient, + }); + + return createServiceFn({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance, + }); +} diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/index.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/index.ts index e22c65a3694bb..17a3b1982f487 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/index.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/index.ts @@ -39,6 +39,7 @@ import { ExternalServiceApiITOM, ExternalServiceITOM, ServiceNowPublicConfigurationBaseType, + ExternalService, } from './types'; import { ServiceNowITOMActionTypeId, @@ -53,6 +54,7 @@ import { apiSIR } from './api_sir'; import { throwIfSubActionIsNotSupported } from './utils'; import { createExternalServiceITOM } from './service_itom'; import { apiITOM } from './api_itom'; +import { createServiceWrapper } from './create_service_wrapper'; export { ServiceNowITSMActionTypeId, @@ -97,6 +99,7 @@ export function getServiceNowITSMActionType( secrets: schema.object(ExternalIncidentServiceSecretConfiguration, { validate: curry(validate.secrets)(configurationUtilities), }), + connector: validate.connector, params: ExecutorParamsSchemaITSM, }, executor: curry(executor)({ @@ -124,6 +127,7 @@ export function getServiceNowSIRActionType( secrets: schema.object(ExternalIncidentServiceSecretConfiguration, { validate: curry(validate.secrets)(configurationUtilities), }), + connector: validate.connector, params: ExecutorParamsSchemaSIR, }, executor: curry(executor)({ @@ -151,6 +155,7 @@ export function getServiceNowITOMActionType( secrets: schema.object(ExternalIncidentServiceSecretConfiguration, { validate: curry(validate.secrets)(configurationUtilities), }), + connector: validate.connector, params: ExecutorParamsSchemaITOM, }, executor: curry(executorITOM)({ @@ -184,20 +189,24 @@ async function executor( ExecutorParams > ): Promise> { - const { actionId, config, params, secrets } = execOptions; + const { actionId, config, params, secrets, services } = execOptions; const { subAction, subActionParams } = params; + const connectorTokenClient = services.connectorTokenClient; const externalServiceConfig = snExternalServiceConfig[actionTypeId]; let data: ServiceNowExecutorResultData | null = null; - const externalService = createService( - { + const externalService = createServiceWrapper({ + connectorId: actionId, + credentials: { config, secrets, }, logger, configurationUtilities, - externalServiceConfig - ); + serviceConfig: externalServiceConfig, + connectorTokenClient, + createServiceFn: createService, + }); const apiAsRecord = api as unknown as Record; throwIfSubActionIsNotSupported({ api: apiAsRecord, subAction, supportedSubActions, logger }); @@ -260,18 +269,22 @@ async function executorITOM( ): Promise> { const { actionId, config, params, secrets } = execOptions; const { subAction, subActionParams } = params; + const connectorTokenClient = execOptions.services.connectorTokenClient; const externalServiceConfig = snExternalServiceConfig[actionTypeId]; let data: ServiceNowExecutorResultData | null = null; - const externalService = createService( - { + const externalService = createServiceWrapper({ + connectorId: actionId, + credentials: { config, secrets, }, logger, configurationUtilities, - externalServiceConfig - ) as ExternalServiceITOM; + serviceConfig: externalServiceConfig, + connectorTokenClient, + createServiceFn: createService, + }); const apiAsRecord = api as unknown as Record; diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/schema.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/schema.ts index e41eea24834c7..5f5ea6ab0ff93 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/schema.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/schema.ts @@ -10,6 +10,10 @@ import { DEFAULT_ALERTS_GROUPING_KEY } from './config'; export const ExternalIncidentServiceConfigurationBase = { apiUrl: schema.string(), + isOAuth: schema.boolean({ defaultValue: false }), + userIdentifierValue: schema.nullable(schema.string()), // required if isOAuth = true + clientId: schema.nullable(schema.string()), // required if isOAuth = true + jwtKeyId: schema.nullable(schema.string()), // required if isOAuth = true }; export const ExternalIncidentServiceConfiguration = { @@ -26,8 +30,11 @@ export const ExternalIncidentServiceConfigurationSchema = schema.object( ); export const ExternalIncidentServiceSecretConfiguration = { - password: schema.string(), - username: schema.string(), + password: schema.nullable(schema.string()), // required if isOAuth = false + username: schema.nullable(schema.string()), // required if isOAuth = false + clientSecret: schema.nullable(schema.string()), // required if isOAuth = true + privateKey: schema.nullable(schema.string()), // required if isOAuth = true + privateKeyPassword: schema.nullable(schema.string()), }; export const ExternalIncidentServiceSecretConfigurationSchema = schema.object( diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.test.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.test.ts index c179277956aa9..68fa57e93f31b 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.test.ts @@ -147,64 +147,240 @@ describe('ServiceNow service', () => { let service: ExternalService; beforeEach(() => { - service = createExternalService( - { + jest.clearAllMocks(); + service = createExternalService({ + credentials: { // The trailing slash at the end of the url is intended. // All API calls need to have the trailing slash removed. - config: { apiUrl: 'https://example.com/' }, + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - snExternalServiceConfig['.servicenow'] - ); - }); - - beforeEach(() => { - jest.clearAllMocks(); + serviceConfig: snExternalServiceConfig['.servicenow'], + axiosInstance: axios, + }); }); describe('createExternalService', () => { test('throws without url', () => { expect(() => - createExternalService( - { - config: { apiUrl: null }, + createExternalService({ + credentials: { + config: { apiUrl: null, isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - snExternalServiceConfig['.servicenow'] - ) + serviceConfig: snExternalServiceConfig['.servicenow'], + axiosInstance: axios, + }) ).toThrow(); }); - test('throws without username', () => { - expect(() => - createExternalService( - { - config: { apiUrl: 'test.com' }, - secrets: { username: '', password: 'admin' }, - }, - logger, - configurationUtilities, - snExternalServiceConfig['.servicenow'] - ) - ).toThrow(); + test('throws when isOAuth is false and basic auth required values are falsy', () => { + const badBasicCredentials = [ + { + config: { apiUrl: 'test.com', isOAuth: false }, + secrets: { username: '', password: 'admin' }, + }, + { + config: { apiUrl: 'test.com', isOAuth: false }, + secrets: { username: null, password: 'admin' }, + }, + { + config: { apiUrl: 'test.com', isOAuth: false }, + secrets: { password: 'admin' }, + }, + { + config: { apiUrl: 'test.com', isOAuth: false }, + secrets: { username: 'admin', password: '' }, + }, + { + config: { apiUrl: 'test.com', isOAuth: false }, + secrets: { username: 'admin', password: null }, + }, + { + config: { apiUrl: 'test.com', isOAuth: false }, + secrets: { username: 'admin' }, + }, + ]; + + badBasicCredentials.forEach((badCredentials) => { + expect(() => + createExternalService({ + credentials: badCredentials, + logger, + configurationUtilities, + serviceConfig: snExternalServiceConfig['.servicenow'], + axiosInstance: axios, + }) + ).toThrow(); + }); }); - test('throws without password', () => { - expect(() => - createExternalService( - { - config: { apiUrl: 'test.com' }, - secrets: { username: '', password: undefined }, + test('throws when isOAuth is true and OAuth required values are falsy', () => { + const badOAuthCredentials = [ + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: '', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', }, - logger, - configurationUtilities, - snExternalServiceConfig['.servicenow'] - ) - ).toThrow(); + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: null, + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: '', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: null, + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: '', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: null, + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + }, + secrets: { clientSecret: 'clientSecret', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: '', privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: null, privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { privateKey: 'privateKey' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: '' }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret', privateKey: null }, + }, + { + config: { + apiUrl: 'test.com', + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'user@email.com', + }, + secrets: { clientSecret: 'clientSecret' }, + }, + ]; + + badOAuthCredentials.forEach((badCredentials) => { + expect(() => + createExternalService({ + credentials: badCredentials, + logger, + configurationUtilities, + serviceConfig: snExternalServiceConfig['.servicenow'], + axiosInstance: axios, + }) + ).toThrow(); + }); }); }); @@ -233,15 +409,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow'], table: 'sn_si_incident' } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow'], table: 'sn_si_incident' }, + axiosInstance: axios, + }); requestMock.mockImplementation(() => ({ data: { result: { sys_id: '1', number: 'INC01' } }, @@ -298,15 +475,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - snExternalServiceConfig['.servicenow-sir'] - ); + serviceConfig: snExternalServiceConfig['.servicenow-sir'], + axiosInstance: axios, + }); const res = await createIncident(service); @@ -382,15 +560,16 @@ describe('ServiceNow service', () => { // old connectors describe('table API', () => { beforeEach(() => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow'], useImportAPI: false } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow'], useImportAPI: false }, + axiosInstance: axios, + }); }); test('it creates the incident correctly', async () => { @@ -418,15 +597,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow-sir'], useImportAPI: false } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow-sir'], useImportAPI: false }, + axiosInstance: axios, + }); mockIncidentResponse(false); @@ -468,15 +648,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - snExternalServiceConfig['.servicenow-sir'] - ); + serviceConfig: snExternalServiceConfig['.servicenow-sir'], + axiosInstance: axios, + }); const res = await updateIncident(service); expect(requestMock).toHaveBeenNthCalledWith(1, { @@ -554,15 +735,16 @@ describe('ServiceNow service', () => { // old connectors describe('table API', () => { beforeEach(() => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow'], useImportAPI: false } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow'], useImportAPI: false }, + axiosInstance: axios, + }); }); test('it updates the incident correctly', async () => { @@ -591,15 +773,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow-sir'], useImportAPI: false } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow-sir'], useImportAPI: false }, + axiosInstance: axios, + }); mockIncidentResponse(false); @@ -646,15 +829,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow'], table: 'sn_si_incident' } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow'], table: 'sn_si_incident' }, + axiosInstance: axios, + }); requestMock.mockImplementation(() => ({ data: { result: serviceNowCommonFields }, @@ -714,15 +898,16 @@ describe('ServiceNow service', () => { }); test('it should call request with correct arguments when table changes', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow'], table: 'sn_si_incident' } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow'], table: 'sn_si_incident' }, + axiosInstance: axios, + }); requestMock.mockImplementation(() => ({ data: { result: serviceNowChoices }, @@ -818,15 +1003,16 @@ describe('ServiceNow service', () => { }); test('it does not log if useOldApi = true', async () => { - service = createExternalService( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalService({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - { ...snExternalServiceConfig['.servicenow'], useImportAPI: false } - ); + serviceConfig: { ...snExternalServiceConfig['.servicenow'], useImportAPI: false }, + axiosInstance: axios, + }); await service.checkIfApplicationIsInstalled(); expect(requestMock).not.toHaveBeenCalled(); expect(logger.debug).not.toHaveBeenCalled(); diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.ts index 8e606ca5f8ef7..5a1b1f604cb81 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service.ts @@ -5,11 +5,9 @@ * 2.0. */ -import axios, { AxiosResponse } from 'axios'; +import { AxiosResponse } from 'axios'; -import { Logger } from '@kbn/core/server'; import { - ExternalServiceCredentials, ExternalService, ExternalServiceParamsCreate, ExternalServiceParamsUpdate, @@ -17,29 +15,41 @@ import { ImportSetApiResponseError, ServiceNowIncident, GetApplicationInfoResponse, - SNProductsConfigValue, ServiceFactory, } from './types'; import * as i18n from './translations'; import { ServiceNowPublicConfigurationType, ServiceNowSecretConfigurationType } from './types'; import { request } from '../lib/axios_utils'; -import { ActionsConfigurationUtilities } from '../../actions_config'; import { createServiceError, getPushedDate, prepareIncident } from './utils'; export const SYS_DICTIONARY_ENDPOINT = `api/now/table/sys_dictionary`; -export const createExternalService: ServiceFactory = ( - { config, secrets }: ExternalServiceCredentials, - logger: Logger, - configurationUtilities: ActionsConfigurationUtilities, - { table, importSetTable, useImportAPI, appScope }: SNProductsConfigValue -): ExternalService => { - const { apiUrl: url, usesTableApi: usesTableApiConfigValue } = - config as ServiceNowPublicConfigurationType; - const { username, password } = secrets as ServiceNowSecretConfigurationType; - - if (!url || !username || !password) { +export const createExternalService: ServiceFactory = ({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance, +}): ExternalService => { + const { config, secrets } = credentials; + const { table, importSetTable, useImportAPI, appScope } = serviceConfig; + const { + apiUrl: url, + usesTableApi: usesTableApiConfigValue, + isOAuth, + clientId, + jwtKeyId, + userIdentifierValue, + } = config as ServiceNowPublicConfigurationType; + const { username, password, clientSecret, privateKey } = + secrets as ServiceNowSecretConfigurationType; + + if ( + !url || + (!isOAuth && (!username || !password)) || + (isOAuth && (!clientSecret || !privateKey || !clientId || !jwtKeyId || !userIdentifierValue)) + ) { throw Error(`[Action]${i18n.SERVICENOW}: Wrong configuration.`); } @@ -54,10 +64,6 @@ export const createExternalService: ServiceFactory = ( */ const getVersionUrl = () => `${urlWithoutTrailingSlash}/api/${appScope}/elastic_api/health`; - const axiosInstance = axios.create({ - auth: { username, password }, - }); - const useTableApi = !useImportAPI || usesTableApiConfigValue; const getCreateIncidentUrl = () => (useTableApi ? tableApiIncidentUrl : importSetTableUrl); diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.test.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.test.ts index 57e7a7506171a..855cff79d608e 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.test.ts @@ -35,15 +35,16 @@ describe('ServiceNow SIR service', () => { let service: ExternalServiceITOM; beforeEach(() => { - service = createExternalServiceITOM( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalServiceITOM({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - snExternalServiceConfig['.servicenow-itom'] - ) as ExternalServiceITOM; + serviceConfig: snExternalServiceConfig['.servicenow-itom'], + axiosInstance: axios, + }) as ExternalServiceITOM; }); beforeEach(() => { diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.ts index 65c9c70545acc..3e33564fe7364 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_itom.ts @@ -4,41 +4,28 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import axios from 'axios'; -import { Logger } from '@kbn/core/server'; -import { - ExternalServiceCredentials, - SNProductsConfigValue, - ServiceFactory, - ExternalServiceITOM, - ExecutorSubActionAddEventParams, -} from './types'; +import { ServiceFactory, ExternalServiceITOM, ExecutorSubActionAddEventParams } from './types'; -import { ServiceNowSecretConfigurationType } from './types'; import { request } from '../lib/axios_utils'; -import { ActionsConfigurationUtilities } from '../../actions_config'; import { createExternalService } from './service'; import { createServiceError } from './utils'; const getAddEventURL = (url: string) => `${url}/api/global/em/jsonv2`; -export const createExternalServiceITOM: ServiceFactory = ( - credentials: ExternalServiceCredentials, - logger: Logger, - configurationUtilities: ActionsConfigurationUtilities, - serviceConfig: SNProductsConfigValue -): ExternalServiceITOM => { - const snService = createExternalService( +export const createExternalServiceITOM: ServiceFactory = ({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance, +}): ExternalServiceITOM => { + const snService = createExternalService({ credentials, logger, configurationUtilities, - serviceConfig - ); - - const { username, password } = credentials.secrets as ServiceNowSecretConfigurationType; - const axiosInstance = axios.create({ - auth: { username, password }, + serviceConfig, + axiosInstance, }); const addEvent = async (params: ExecutorSubActionAddEventParams) => { diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.test.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.test.ts index cbd47fb2552c7..59c71ac6887c8 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.test.ts @@ -92,15 +92,16 @@ describe('ServiceNow SIR service', () => { let service: ExternalServiceSIR; beforeEach(() => { - service = createExternalServiceSIR( - { - config: { apiUrl: 'https://example.com/' }, + service = createExternalServiceSIR({ + credentials: { + config: { apiUrl: 'https://example.com/', isOAuth: false }, secrets: { username: 'admin', password: 'admin' }, }, logger, configurationUtilities, - snExternalServiceConfig['.servicenow-sir'] - ) as ExternalServiceSIR; + serviceConfig: snExternalServiceConfig['.servicenow-sir'], + axiosInstance: axios, + }) as ExternalServiceSIR; }); beforeEach(() => { diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.ts index 41c02a57643e3..0ecd838c93bd2 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/service_sir.ts @@ -5,21 +5,9 @@ * 2.0. */ -import axios from 'axios'; +import { Observable, ExternalServiceSIR, ObservableResponse, ServiceFactory } from './types'; -import { Logger } from '@kbn/core/server'; -import { - ExternalServiceCredentials, - SNProductsConfigValue, - Observable, - ExternalServiceSIR, - ObservableResponse, - ServiceFactory, -} from './types'; - -import { ServiceNowSecretConfigurationType } from './types'; import { request } from '../lib/axios_utils'; -import { ActionsConfigurationUtilities } from '../../actions_config'; import { createExternalService } from './service'; import { createServiceError } from './utils'; @@ -29,22 +17,19 @@ const getAddObservableToIncidentURL = (url: string, incidentID: string) => const getBulkAddObservableToIncidentURL = (url: string, incidentID: string) => `${url}/api/x_elas2_sir_int/elastic_api/incident/${incidentID}/observables/bulk`; -export const createExternalServiceSIR: ServiceFactory = ( - credentials: ExternalServiceCredentials, - logger: Logger, - configurationUtilities: ActionsConfigurationUtilities, - serviceConfig: SNProductsConfigValue -): ExternalServiceSIR => { - const snService = createExternalService( +export const createExternalServiceSIR: ServiceFactory = ({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance, +}): ExternalServiceSIR => { + const snService = createExternalService({ credentials, logger, configurationUtilities, - serviceConfig - ); - - const { username, password } = credentials.secrets as ServiceNowSecretConfigurationType; - const axiosInstance = axios.create({ - auth: { username, password }, + serviceConfig, + axiosInstance, }); const _addObservable = async (data: Observable | Observable[], url: string) => { diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/translations.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/translations.ts index 8b2bb9423d012..b007e57773989 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/translations.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/translations.ts @@ -30,3 +30,42 @@ export const ALLOWED_HOSTS_ERROR = (message: string) => message, }, }); + +export const CREDENTIALS_ERROR = i18n.translate( + 'xpack.actions.builtin.configuration.apiCredentialsError', + { + defaultMessage: 'Either basic auth or OAuth credentials must be specified', + } +); + +export const BASIC_AUTH_CREDENTIALS_ERROR = i18n.translate( + 'xpack.actions.builtin.configuration.apiBasicAuthCredentialsError', + { + defaultMessage: 'username and password must both be specified', + } +); + +export const OAUTH_CREDENTIALS_ERROR = i18n.translate( + 'xpack.actions.builtin.configuration.apiOAuthCredentialsError', + { + defaultMessage: 'clientSecret and privateKey must both be specified', + } +); + +export const VALIDATE_OAUTH_MISSING_FIELD_ERROR = (field: string, isOAuth: boolean) => + i18n.translate('xpack.actions.builtin.configuration.apiValidateMissingOAuthFieldError', { + defaultMessage: '{field} must be provided when isOAuth = {isOAuth}', + values: { + field, + isOAuth: isOAuth ? 'true' : 'false', + }, + }); + +export const VALIDATE_OAUTH_POPULATED_FIELD_ERROR = (field: string, isOAuth: boolean) => + i18n.translate('xpack.actions.builtin.configuration.apiValidateOAuthFieldError', { + defaultMessage: '{field} should not be provided with isOAuth = {isOAuth}', + values: { + field, + isOAuth: isOAuth ? 'true' : 'false', + }, + }); diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/types.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/types.ts index 4475832e1a7f7..ff3a92e935818 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/types.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/types.ts @@ -7,7 +7,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { AxiosError, AxiosResponse } from 'axios'; +import { AxiosError, AxiosInstance, AxiosResponse } from 'axios'; import { TypeOf } from '@kbn/config-schema'; import { Logger } from '@kbn/core/server'; import { @@ -78,6 +78,7 @@ export interface ExternalServiceCredentials { export interface ExternalServiceValidation { config: (configurationUtilities: ActionsConfigurationUtilities, configObject: any) => void; secrets: (configurationUtilities: ActionsConfigurationUtilities, secrets: any) => void; + connector: (config: any, secrets: any) => string | null; } export interface ExternalServiceIncidentResponse { @@ -277,12 +278,21 @@ export interface ExternalServiceSIR extends ExternalService { ) => Promise; } -export type ServiceFactory = ( - credentials: ExternalServiceCredentials, - logger: Logger, - configurationUtilities: ActionsConfigurationUtilities, - serviceConfig: SNProductsConfigValue -) => T; +interface ServiceFactoryOpts { + credentials: ExternalServiceCredentials; + logger: Logger; + configurationUtilities: ActionsConfigurationUtilities; + serviceConfig: SNProductsConfigValue; + axiosInstance: AxiosInstance; +} + +export type ServiceFactory = ({ + credentials, + logger, + configurationUtilities, + serviceConfig, + axiosInstance, +}: ServiceFactoryOpts) => T; /** * ITOM diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.test.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.test.ts index 7d66949d4473f..dae4e59728a0c 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.test.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { AxiosError } from 'axios'; +import axios, { AxiosError } from 'axios'; import { Logger } from '@kbn/core/server'; import { loggingSystemMock } from '@kbn/core/server/mocks'; @@ -14,10 +14,35 @@ import { createServiceError, getPushedDate, throwIfSubActionIsNotSupported, + getAccessToken, + getAxiosInstance, } from './utils'; +import { connectorTokenClientMock } from '../lib/connector_token_client.mock'; +import { actionsConfigMock } from '../../actions_config.mock'; +import { createJWTAssertion } from '../lib/create_jwt_assertion'; +import { requestOAuthJWTToken } from '../lib/request_oauth_jwt_token'; -const logger = loggingSystemMock.create().get() as jest.Mocked; +jest.mock('../lib/create_jwt_assertion', () => ({ + createJWTAssertion: jest.fn(), +})); +jest.mock('../lib/request_oauth_jwt_token', () => ({ + requestOAuthJWTToken: jest.fn(), +})); + +jest.mock('axios', () => ({ + create: jest.fn(), +})); +const createAxiosInstanceMock = axios.create as jest.Mock; +const axiosInstanceMock = { + interceptors: { + request: { eject: jest.fn(), use: jest.fn() }, + response: { eject: jest.fn(), use: jest.fn() }, + }, +}; +const connectorTokenClient = connectorTokenClientMock.create(); +const logger = loggingSystemMock.create().get() as jest.Mocked; +const configurationUtilities = actionsConfigMock.create(); /** * The purpose of this test is to * prevent developers from accidentally @@ -131,4 +156,285 @@ describe('utils', () => { ).not.toThrow(); }); }); + + describe('getAxiosInstance', () => { + beforeEach(() => { + jest.clearAllMocks(); + createAxiosInstanceMock.mockReturnValue(axiosInstanceMock); + }); + + test('creates axios instance with basic auth when isOAuth is false and username and password are defined', () => { + getAxiosInstance({ + connectorId: '123', + logger, + configurationUtilities, + credentials: { + config: { + apiUrl: 'https://servicenow', + usesTableApi: true, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, + }, + secrets: { + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + username: 'username', + password: 'password', + }, + }, + snServiceUrl: 'https://dev23432523.service-now.com', + connectorTokenClient, + }); + + expect(createAxiosInstanceMock).toHaveBeenCalledTimes(1); + expect(createAxiosInstanceMock).toHaveBeenCalledWith({ + auth: { password: 'password', username: 'username' }, + }); + }); + + test('creates axios instance with interceptor when isOAuth is true and OAuth fields are defined', () => { + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: { + id: '1', + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + createdAt: new Date().toISOString(), + expiresAt: new Date(Date.now() + 10000000000).toISOString(), + }, + }); + getAxiosInstance({ + connectorId: '123', + logger, + configurationUtilities, + credentials: { + config: { + apiUrl: 'https://servicenow', + usesTableApi: true, + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'userIdentifierValue', + }, + secrets: { + clientSecret: 'clientSecret', + privateKey: 'privateKey', + privateKeyPassword: null, + username: null, + password: null, + }, + }, + snServiceUrl: 'https://dev23432523.service-now.com', + connectorTokenClient, + }); + + expect(createAxiosInstanceMock).toHaveBeenCalledTimes(1); + expect(createAxiosInstanceMock).toHaveBeenCalledWith(); + expect(axiosInstanceMock.interceptors.request.use).toHaveBeenCalledTimes(1); + }); + }); + + describe('getAccessToken', () => { + const getAccessTokenOpts = { + connectorId: '123', + logger, + configurationUtilities, + credentials: { + config: { + apiUrl: 'https://servicenow', + usesTableApi: true, + isOAuth: true, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + userIdentifierValue: 'userIdentifierValue', + }, + secrets: { + clientSecret: 'clientSecret', + privateKey: 'privateKey', + privateKeyPassword: 'privateKeyPassword', + username: null, + password: null, + }, + }, + snServiceUrl: 'https://dev23432523.service-now.com', + connectorTokenClient, + }; + beforeEach(() => { + jest.resetAllMocks(); + jest.clearAllMocks(); + }); + + test('uses stored access token if it exists', async () => { + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: { + id: '1', + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + createdAt: new Date().toISOString(), + expiresAt: new Date(Date.now() + 10000000000).toISOString(), + }, + }); + const accessToken = await getAccessToken(getAccessTokenOpts); + + expect(accessToken).toEqual('testtokenvalue'); + expect(createJWTAssertion as jest.Mock).not.toHaveBeenCalled(); + expect(requestOAuthJWTToken as jest.Mock).not.toHaveBeenCalled(); + }); + + test('creates new assertion if stored access token does not exist', async () => { + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: null, + }); + (createJWTAssertion as jest.Mock).mockReturnValueOnce('newassertion'); + (requestOAuthJWTToken as jest.Mock).mockResolvedValueOnce({ + tokenType: 'access_token', + accessToken: 'brandnewaccesstoken', + expiresIn: 1000, + }); + + const accessToken = await getAccessToken(getAccessTokenOpts); + + expect(accessToken).toEqual('access_token brandnewaccesstoken'); + expect(createJWTAssertion as jest.Mock).toHaveBeenCalledWith( + logger, + 'privateKey', + 'privateKeyPassword', + { + audience: 'clientId', + issuer: 'clientId', + subject: 'userIdentifierValue', + keyId: 'jwtKeyId', + } + ); + expect(requestOAuthJWTToken as jest.Mock).toHaveBeenCalledWith( + 'https://dev23432523.service-now.com/oauth_token.do', + { clientId: 'clientId', clientSecret: 'clientSecret', assertion: 'newassertion' }, + logger, + configurationUtilities + ); + expect(connectorTokenClient.updateOrReplace).toHaveBeenCalledWith({ + connectorId: '123', + token: null, + newToken: 'access_token brandnewaccesstoken', + expiresInSec: 1000, + deleteExisting: false, + }); + }); + + test('creates new assertion if stored access token exists but is expired', async () => { + const createdAt = new Date().toISOString(); + const expiresAt = new Date(Date.now() - 100).toISOString(); + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: { + id: '1', + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + createdAt, + expiresAt, + }, + }); + (createJWTAssertion as jest.Mock).mockReturnValueOnce('newassertion'); + (requestOAuthJWTToken as jest.Mock).mockResolvedValueOnce({ + tokenType: 'access_token', + accessToken: 'brandnewaccesstoken', + expiresIn: 1000, + }); + + const accessToken = await getAccessToken(getAccessTokenOpts); + + expect(accessToken).toEqual('access_token brandnewaccesstoken'); + expect(createJWTAssertion as jest.Mock).toHaveBeenCalledWith( + logger, + 'privateKey', + 'privateKeyPassword', + { + audience: 'clientId', + issuer: 'clientId', + subject: 'userIdentifierValue', + keyId: 'jwtKeyId', + } + ); + expect(requestOAuthJWTToken as jest.Mock).toHaveBeenCalledWith( + 'https://dev23432523.service-now.com/oauth_token.do', + { clientId: 'clientId', clientSecret: 'clientSecret', assertion: 'newassertion' }, + logger, + configurationUtilities + ); + expect(connectorTokenClient.updateOrReplace).toHaveBeenCalledWith({ + connectorId: '123', + token: { + id: '1', + connectorId: '123', + tokenType: 'access_token', + token: 'testtokenvalue', + createdAt, + expiresAt, + }, + newToken: 'access_token brandnewaccesstoken', + expiresInSec: 1000, + deleteExisting: false, + }); + }); + + test('throws error if createJWTAssertion throws error', async () => { + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: null, + }); + (createJWTAssertion as jest.Mock).mockImplementationOnce(() => { + throw new Error('createJWTAssertion error!!'); + }); + + await expect(getAccessToken(getAccessTokenOpts)).rejects.toThrowErrorMatchingInlineSnapshot( + `"createJWTAssertion error!!"` + ); + }); + + test('throws error if requestOAuthJWTToken throws error', async () => { + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: null, + }); + (createJWTAssertion as jest.Mock).mockReturnValueOnce('newassertion'); + (requestOAuthJWTToken as jest.Mock).mockRejectedValueOnce( + new Error('requestOAuthJWTToken error!!') + ); + + await expect(getAccessToken(getAccessTokenOpts)).rejects.toThrowErrorMatchingInlineSnapshot( + `"requestOAuthJWTToken error!!"` + ); + }); + + test('logs warning if connectorTokenClient.updateOrReplace throws error', async () => { + connectorTokenClient.get.mockResolvedValueOnce({ + hasErrors: false, + connectorToken: null, + }); + (createJWTAssertion as jest.Mock).mockReturnValueOnce('newassertion'); + (requestOAuthJWTToken as jest.Mock).mockResolvedValueOnce({ + tokenType: 'access_token', + accessToken: 'brandnewaccesstoken', + expiresIn: 1000, + }); + connectorTokenClient.updateOrReplace.mockRejectedValueOnce( + new Error('updateOrReplace error') + ); + + const accessToken = await getAccessToken(getAccessTokenOpts); + + expect(accessToken).toEqual('access_token brandnewaccesstoken'); + expect(logger.warn).toHaveBeenCalledWith( + `Not able to update ServiceNow connector token for connectorId: 123 due to error: updateOrReplace error` + ); + }); + }); }); diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.ts index f18d09cdaedb9..84d6741398bce 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/utils.ts @@ -5,11 +5,24 @@ * 2.0. */ +import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'; import { Logger } from '@kbn/core/server'; -import { Incident, PartialIncident, ResponseError, ServiceNowError } from './types'; +import { + ExternalServiceCredentials, + Incident, + PartialIncident, + ResponseError, + ServiceNowError, + ServiceNowPublicConfigurationType, + ServiceNowSecretConfigurationType, +} from './types'; import { FIELD_PREFIX } from './config'; import { addTimeZoneToDate, getErrorMessage } from '../lib/axios_utils'; import * as i18n from './translations'; +import { ActionsConfigurationUtilities } from '../../actions_config'; +import { ConnectorTokenClientContract } from '../../types'; +import { createJWTAssertion } from '../lib/create_jwt_assertion'; +import { requestOAuthJWTToken } from '../lib/request_oauth_jwt_token'; export const prepareIncident = (useOldApi: boolean, incident: PartialIncident): PartialIncident => useOldApi @@ -69,3 +82,129 @@ export const throwIfSubActionIsNotSupported = ({ throw new Error(errorMessage); } }; + +export interface GetAccessTokenAndAxiosInstanceOpts { + connectorId: string; + logger: Logger; + configurationUtilities: ActionsConfigurationUtilities; + credentials: ExternalServiceCredentials; + snServiceUrl: string; + connectorTokenClient: ConnectorTokenClientContract; +} + +export const getAxiosInstance = ({ + connectorId, + logger, + configurationUtilities, + credentials, + snServiceUrl, + connectorTokenClient, +}: GetAccessTokenAndAxiosInstanceOpts): AxiosInstance => { + const { config, secrets } = credentials; + const { isOAuth } = config as ServiceNowPublicConfigurationType; + const { username, password } = secrets as ServiceNowSecretConfigurationType; + + let axiosInstance; + + if (!isOAuth && username && password) { + axiosInstance = axios.create({ + auth: { username, password }, + }); + } else { + axiosInstance = axios.create(); + axiosInstance.interceptors.request.use( + async (axiosConfig: AxiosRequestConfig) => { + const accessToken = await getAccessToken({ + connectorId, + logger, + configurationUtilities, + credentials: { + config: config as ServiceNowPublicConfigurationType, + secrets, + }, + snServiceUrl, + connectorTokenClient, + }); + axiosConfig.headers.Authorization = accessToken; + return axiosConfig; + }, + (error) => { + Promise.reject(error); + } + ); + } + + return axiosInstance; +}; + +export const getAccessToken = async ({ + connectorId, + logger, + configurationUtilities, + credentials, + snServiceUrl, + connectorTokenClient, +}: GetAccessTokenAndAxiosInstanceOpts) => { + const { isOAuth, clientId, jwtKeyId, userIdentifierValue } = + credentials.config as ServiceNowPublicConfigurationType; + const { clientSecret, privateKey, privateKeyPassword } = + credentials.secrets as ServiceNowSecretConfigurationType; + + let accessToken: string; + + // Check if there is a token stored for this connector + const { connectorToken, hasErrors } = await connectorTokenClient.get({ connectorId }); + + if (connectorToken === null || Date.parse(connectorToken.expiresAt) <= Date.now()) { + // generate a new assertion + if ( + !isOAuth || + !clientId || + !clientSecret || + !jwtKeyId || + !privateKey || + !userIdentifierValue + ) { + return null; + } + + const assertion = createJWTAssertion(logger, privateKey, privateKeyPassword, { + audience: clientId, + issuer: clientId, + subject: userIdentifierValue, + keyId: jwtKeyId, + }); + + // request access token with jwt assertion + const tokenResult = await requestOAuthJWTToken( + `${snServiceUrl}/oauth_token.do`, + { + clientId, + clientSecret, + assertion, + }, + logger, + configurationUtilities + ); + accessToken = `${tokenResult.tokenType} ${tokenResult.accessToken}`; + + // try to update connector_token SO + try { + await connectorTokenClient.updateOrReplace({ + connectorId, + token: connectorToken, + newToken: accessToken, + expiresInSec: tokenResult.expiresIn, + deleteExisting: hasErrors, + }); + } catch (err) { + logger.warn( + `Not able to update ServiceNow connector token for connectorId: ${connectorId} due to error: ${err.message}` + ); + } + } else { + // use existing valid token + accessToken = connectorToken.token; + } + return accessToken; +}; diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.test.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.test.ts new file mode 100644 index 0000000000000..547c025fcdb61 --- /dev/null +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.test.ts @@ -0,0 +1,401 @@ +/* + * Copyright 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 { validateCommonConfig, validateCommonSecrets, validateCommonConnector } from './validators'; +import { actionsConfigMock } from '../../actions_config.mock'; + +const configurationUtilities = actionsConfigMock.create(); + +describe('validateCommonConfig', () => { + test('config validation fails when apiUrl is not allowed', () => { + expect( + validateCommonConfig( + { + ...configurationUtilities, + ensureUriAllowed: (_) => { + throw new Error(`target url is not present in allowedHosts`); + }, + }, + { + apiUrl: 'example.com/do-something', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + } + ) + ).toEqual(`error configuring connector action: target url is not present in allowedHosts`); + }); + describe('when isOAuth = true', () => { + test('config validation fails when userIdentifierValue is null', () => { + expect( + validateCommonConfig(configurationUtilities, { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: null, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + }) + ).toEqual(`userIdentifierValue must be provided when isOAuth = true`); + }); + test('config validation fails when clientId is null', () => { + expect( + validateCommonConfig(configurationUtilities, { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: null, + jwtKeyId: 'jwtKeyId', + }) + ).toEqual(`clientId must be provided when isOAuth = true`); + }); + test('config validation fails when jwtKeyId is null', () => { + expect( + validateCommonConfig(configurationUtilities, { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: 'clientId', + jwtKeyId: null, + }) + ).toEqual(`jwtKeyId must be provided when isOAuth = true`); + }); + }); + + describe('when isOAuth = false', () => { + test('connector validation fails when username is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + }, + { + password: 'password', + username: null, + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual(`username must be provided when isOAuth = false`); + }); + test('connector validation fails when password is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + }, + { + password: null, + username: 'username', + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual(`password must be provided when isOAuth = false`); + }); + test('connector validation fails when any oauth related field is defined', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + }, + { + password: 'password', + username: 'username', + clientSecret: 'clientSecret', + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual( + `clientId, clientSecret, userIdentifierValue, jwtKeyId and privateKey should not be provided with isOAuth = false` + ); + }); + }); +}); + +describe('validateCommonSecrets', () => { + test('secrets validation fails when no credentials are defined', () => { + expect( + validateCommonSecrets(configurationUtilities, { + password: null, + username: null, + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + }) + ).toEqual(`Either basic auth or OAuth credentials must be specified`); + }); + + test('secrets validation fails when username is defined and password is not', () => { + expect( + validateCommonSecrets(configurationUtilities, { + password: null, + username: 'admin', + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + }) + ).toEqual(`username and password must both be specified`); + }); + + test('secrets validation fails when password is defined and username is not', () => { + expect( + validateCommonSecrets(configurationUtilities, { + password: 'password', + username: null, + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + }) + ).toEqual(`username and password must both be specified`); + }); + + test('secrets validation fails when clientSecret is defined and privateKey is not', () => { + expect( + validateCommonSecrets(configurationUtilities, { + password: null, + username: null, + clientSecret: 'secret', + privateKey: null, + privateKeyPassword: null, + }) + ).toEqual(`clientSecret and privateKey must both be specified`); + }); + + test('secrets validation fails when privateKey is defined and clientSecret is not', () => { + expect( + validateCommonSecrets(configurationUtilities, { + password: null, + username: null, + clientSecret: null, + privateKey: 'private', + privateKeyPassword: null, + }) + ).toEqual(`clientSecret and privateKey must both be specified`); + }); +}); + +describe('validateCommonConnector', () => { + describe('when isOAuth = true', () => { + test('connector validation fails when userIdentifierValue is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: null, + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + }, + { + password: null, + username: null, + clientSecret: 'clientSecret', + privateKey: 'privateKey', + privateKeyPassword: null, + } + ) + ).toEqual(`userIdentifierValue must be provided when isOAuth = true`); + }); + test('connector validation fails when clientId is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: null, + jwtKeyId: 'jwtKeyId', + }, + { + password: null, + username: null, + clientSecret: 'clientSecret', + privateKey: 'privateKey', + privateKeyPassword: null, + } + ) + ).toEqual(`clientId must be provided when isOAuth = true`); + }); + test('connector validation fails when jwtKeyId is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: 'clientId', + jwtKeyId: null, + }, + { + password: null, + username: null, + clientSecret: 'clientSecret', + privateKey: 'privateKey', + privateKeyPassword: null, + } + ) + ).toEqual(`jwtKeyId must be provided when isOAuth = true`); + }); + test('connector validation fails when clientSecret is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + }, + { + password: null, + username: null, + clientSecret: null, + privateKey: 'privateKey', + privateKeyPassword: null, + } + ) + ).toEqual(`clientSecret must be provided when isOAuth = true`); + }); + test('connector validation fails when privateKey is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + }, + { + password: null, + username: null, + clientSecret: 'clientSecret', + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual(`privateKey must be provided when isOAuth = true`); + }); + test('connector validation fails when username and password are not null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: true, + userIdentifierValue: 'userIdentifierValue', + clientId: 'clientId', + jwtKeyId: 'jwtKeyId', + }, + { + password: 'password', + username: 'username', + clientSecret: 'clientSecret', + privateKey: 'privateKey', + privateKeyPassword: null, + } + ) + ).toEqual(`Username and password should not be provided with isOAuth = true`); + }); + }); + + describe('when isOAuth = false', () => { + test('connector validation fails when username is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + }, + { + password: 'password', + username: null, + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual(`username must be provided when isOAuth = false`); + }); + test('connector validation fails when password is null', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + }, + { + password: null, + username: 'username', + clientSecret: null, + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual(`password must be provided when isOAuth = false`); + }); + test('connector validation fails when any oauth related field is defined', () => { + expect( + validateCommonConnector( + { + apiUrl: 'https://url', + usesTableApi: true, + isOAuth: false, + userIdentifierValue: null, + clientId: null, + jwtKeyId: null, + }, + { + password: 'password', + username: 'username', + clientSecret: 'clientSecret', + privateKey: null, + privateKeyPassword: null, + } + ) + ).toEqual( + `clientId, clientSecret, userIdentifierValue, jwtKeyId and privateKey should not be provided with isOAuth = false` + ); + }); + }); +}); diff --git a/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.ts b/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.ts index f074e28863642..87ea4922fa5cc 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/servicenow/validators.ts @@ -16,21 +16,107 @@ import * as i18n from './translations'; export const validateCommonConfig = ( configurationUtilities: ActionsConfigurationUtilities, - configObject: ServiceNowPublicConfigurationType + config: ServiceNowPublicConfigurationType ) => { + const { isOAuth, apiUrl, userIdentifierValue, clientId, jwtKeyId } = config; + try { - configurationUtilities.ensureUriAllowed(configObject.apiUrl); + configurationUtilities.ensureUriAllowed(apiUrl); } catch (allowedListError) { return i18n.ALLOWED_HOSTS_ERROR(allowedListError.message); } + + if (isOAuth) { + if (userIdentifierValue == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('userIdentifierValue', true); + } + + if (clientId == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('clientId', true); + } + + if (jwtKeyId == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('jwtKeyId', true); + } + } }; export const validateCommonSecrets = ( configurationUtilities: ActionsConfigurationUtilities, secrets: ServiceNowSecretConfigurationType -) => {}; +) => { + const { username, password, clientSecret, privateKey } = secrets; + + if (!username && !password && !clientSecret && !privateKey) { + return i18n.CREDENTIALS_ERROR; + } + + if (username || password) { + // Username and password must be set and set together + if (!username || !password) { + return i18n.BASIC_AUTH_CREDENTIALS_ERROR; + } + } else if (clientSecret || privateKey) { + // Client secret and private key must be set and set together + if (!clientSecret || !privateKey) { + return i18n.OAUTH_CREDENTIALS_ERROR; + } + } +}; + +export const validateCommonConnector = ( + config: ServiceNowPublicConfigurationType, + secrets: ServiceNowSecretConfigurationType +): string | null => { + const { isOAuth, userIdentifierValue, clientId, jwtKeyId } = config; + const { username, password, clientSecret, privateKey } = secrets; + + if (isOAuth) { + if (userIdentifierValue == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('userIdentifierValue', true); + } + + if (clientId == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('clientId', true); + } + + if (jwtKeyId == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('jwtKeyId', true); + } + + if (clientSecret == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('clientSecret', true); + } + + if (privateKey == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('privateKey', true); + } + + if (username || password) { + return i18n.VALIDATE_OAUTH_POPULATED_FIELD_ERROR('Username and password', true); + } + } else { + if (username == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('username', false); + } + + if (password == null) { + return i18n.VALIDATE_OAUTH_MISSING_FIELD_ERROR('password', false); + } + + if (clientSecret || clientId || userIdentifierValue || jwtKeyId || privateKey) { + return i18n.VALIDATE_OAUTH_POPULATED_FIELD_ERROR( + 'clientId, clientSecret, userIdentifierValue, jwtKeyId and privateKey', + false + ); + } + } + + return null; +}; export const validate: ExternalServiceValidation = { config: validateCommonConfig, secrets: validateCommonSecrets, + connector: validateCommonConnector, }; diff --git a/x-pack/plugins/actions/server/saved_objects/actions_migrations.test.ts b/x-pack/plugins/actions/server/saved_objects/actions_migrations.test.ts index d350e40c1b362..12bf3984907b4 100644 --- a/x-pack/plugins/actions/server/saved_objects/actions_migrations.test.ts +++ b/x-pack/plugins/actions/server/saved_objects/actions_migrations.test.ts @@ -168,7 +168,7 @@ describe('successful migrations', () => { test('set usesTableApi config property for .servicenow', () => { const migration716 = getActionsMigrations(encryptedSavedObjectsSetup)['7.16.0']; - const action = getMockDataForServiceNow(); + const action = getMockDataForServiceNow716({ usesTableApi: true }); const migratedAction = migration716(action, context); expect(migratedAction).toEqual({ @@ -185,7 +185,7 @@ describe('successful migrations', () => { test('set usesTableApi config property for .servicenow-sir', () => { const migration716 = getActionsMigrations(encryptedSavedObjectsSetup)['7.16.0']; - const action = getMockDataForServiceNow({ actionTypeId: '.servicenow-sir' }); + const action = getMockDataForServiceNow716({ actionTypeId: '.servicenow-sir' }); const migratedAction = migration716(action, context); expect(migratedAction).toEqual({ @@ -215,6 +215,52 @@ describe('successful migrations', () => { expect(migration800(action, context)).toEqual(action); }); }); + + describe('8.3.0', () => { + test('set isOAuth config property for .servicenow', () => { + const migration830 = getActionsMigrations(encryptedSavedObjectsSetup)['8.3.0']; + const action = getMockDataForServiceNow83(); + const migratedAction = migration830(action, context); + + expect(migratedAction.attributes.config).toEqual({ + apiUrl: 'https://example.com', + usesTableApi: true, + isOAuth: false, + }); + }); + + test('set isOAuth config property for .servicenow-sir', () => { + const migration830 = getActionsMigrations(encryptedSavedObjectsSetup)['8.3.0']; + const action = getMockDataForServiceNow83({ actionTypeId: '.servicenow-sir' }); + const migratedAction = migration830(action, context); + + expect(migratedAction.attributes.config).toEqual({ + apiUrl: 'https://example.com', + usesTableApi: true, + isOAuth: false, + }); + }); + + test('set isOAuth config property for .servicenow-itom', () => { + const migration830 = getActionsMigrations(encryptedSavedObjectsSetup)['8.3.0']; + const action = getMockDataForServiceNow83({ actionTypeId: '.servicenow-itom' }); + const migratedAction = migration830(action, context); + + expect(migratedAction.attributes.config).toEqual({ + apiUrl: 'https://example.com', + usesTableApi: true, + isOAuth: false, + }); + }); + + test('it does not set isOAuth config for other connectors', () => { + const migration830 = getActionsMigrations(encryptedSavedObjectsSetup)['8.3.0']; + const action = getMockData(); + const migratedAction = migration830(action, context); + + expect(migratedAction).toEqual(action); + }); + }); }); describe('handles errors during migrations', () => { @@ -348,7 +394,7 @@ function getMockData( }; } -function getMockDataForServiceNow( +function getMockDataForServiceNow716( overwrites: Record = {} ): SavedObjectUnsanitizedDoc> { return { @@ -363,3 +409,11 @@ function getMockDataForServiceNow( type: 'action', }; } + +function getMockDataForServiceNow83( + overwrites: Record = {} +): SavedObjectUnsanitizedDoc> { + return getMockDataForServiceNow716({ + config: { apiUrl: 'https://example.com', usesTableApi: true }, + }); +} diff --git a/x-pack/plugins/actions/server/saved_objects/actions_migrations.ts b/x-pack/plugins/actions/server/saved_objects/actions_migrations.ts index 4c113a09b81b5..f785fa9ee4ac9 100644 --- a/x-pack/plugins/actions/server/saved_objects/actions_migrations.ts +++ b/x-pack/plugins/actions/server/saved_objects/actions_migrations.ts @@ -78,12 +78,22 @@ export function getActionsMigrations( (doc) => doc // no-op ); + const migrationActions830 = createEsoMigration( + encryptedSavedObjects, + (doc): doc is SavedObjectUnsanitizedDoc => + doc.attributes.actionTypeId === '.servicenow' || + doc.attributes.actionTypeId === '.servicenow-sir' || + doc.attributes.actionTypeId === '.servicenow-itom', + pipeMigrations(addIsOAuthToServiceNowConnectors) + ); + return { '7.10.0': executeMigrationWithErrorHandling(migrationActionsTen, '7.10.0'), '7.11.0': executeMigrationWithErrorHandling(migrationActionsEleven, '7.11.0'), '7.14.0': executeMigrationWithErrorHandling(migrationActionsFourteen, '7.14.0'), '7.16.0': executeMigrationWithErrorHandling(migrationActionsSixteen, '7.16.0'), '8.0.0': executeMigrationWithErrorHandling(migrationActions800, '8.0.0'), + '8.3.0': executeMigrationWithErrorHandling(migrationActions830, '8.3.0'), }; } @@ -219,6 +229,29 @@ const addUsesTableApiToServiceNowConnectors = ( }; }; +const addIsOAuthToServiceNowConnectors = ( + doc: SavedObjectUnsanitizedDoc +): SavedObjectUnsanitizedDoc => { + if ( + doc.attributes.actionTypeId !== '.servicenow' && + doc.attributes.actionTypeId !== '.servicenow-sir' && + doc.attributes.actionTypeId !== '.servicenow-itom' + ) { + return doc; + } + + return { + ...doc, + attributes: { + ...doc.attributes, + config: { + ...doc.attributes.config, + isOAuth: false, + }, + }, + }; +}; + function pipeMigrations(...migrations: ActionMigration[]): ActionMigration { return (doc: SavedObjectUnsanitizedDoc) => migrations.reduce((migratedDoc, nextMigration) => nextMigration(migratedDoc), doc); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itom.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itom.ts index 9dcc3ef05266e..c685fff8abfc6 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itom.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itom.ts @@ -7,6 +7,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; +import { asyncForEach } from '@kbn/std'; import getPort from 'get-port'; import http from 'http'; @@ -19,14 +20,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const configService = getService('config'); - const mockServiceNow = { - config: { - apiUrl: 'www.servicenowisinkibanaactions.com', - }, - secrets: { - password: 'elastic', - username: 'changeme', - }, + const mockServiceNowCommon = { params: { subAction: 'addEvent', subActionParams: { @@ -44,6 +38,30 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { }, }, }; + const mockServiceNowBasic = { + ...mockServiceNowCommon, + config: { + apiUrl: 'www.servicenowisinkibanaactions.com', + }, + secrets: { + password: 'elastic', + username: 'changeme', + }, + }; + const mockServiceNowOAuth = { + ...mockServiceNowCommon, + config: { + apiUrl: 'www.servicenowisinkibanaactions.com', + isOAuth: true, + clientId: 'abc', + userIdentifierValue: 'elastic', + jwtKeyId: 'def', + }, + secrets: { + clientSecret: 'xyz', + privateKey: '-----BEGIN RSA PRIVATE KEY-----\nddddddd\n-----END RSA PRIVATE KEY-----', + }, + }; describe('ServiceNow ITOM', () => { let simulatedActionId = ''; @@ -76,7 +94,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { }); describe('ServiceNow ITOM - Action Creation', () => { - it('should return 200 when creating a servicenow action successfully', async () => { + it('should return 200 when creating a servicenow Basic Auth connector successfully', async () => { const { body: createdAction } = await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -86,7 +104,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(200); @@ -99,6 +117,10 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { is_missing_secrets: false, config: { apiUrl: serviceNowSimulatorURL, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, }, }); @@ -115,11 +137,67 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { is_missing_secrets: false, config: { apiUrl: serviceNowSimulatorURL, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, }, }); }); - it('should respond with a 400 Bad Request when creating a servicenow action with no apiUrl', async () => { + it('should return 200 when creating a servicenow OAuth connector successfully', async () => { + const { body: createdConnector } = await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-itom', + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: mockServiceNowOAuth.secrets, + }) + .expect(200); + + expect(createdConnector).to.eql({ + id: createdConnector.id, + is_preconfigured: false, + is_deprecated: false, + name: 'A servicenow action', + connector_type_id: '.servicenow-itom', + is_missing_secrets: false, + config: { + apiUrl: serviceNowSimulatorURL, + isOAuth: true, + clientId: mockServiceNowOAuth.config.clientId, + jwtKeyId: mockServiceNowOAuth.config.jwtKeyId, + userIdentifierValue: mockServiceNowOAuth.config.userIdentifierValue, + }, + }); + + const { body: fetchedConnector } = await supertest + .get(`/api/actions/connector/${createdConnector.id}`) + .expect(200); + + expect(fetchedConnector).to.eql({ + id: fetchedConnector.id, + is_preconfigured: false, + is_deprecated: false, + name: 'A servicenow action', + connector_type_id: '.servicenow-itom', + is_missing_secrets: false, + config: { + apiUrl: serviceNowSimulatorURL, + isOAuth: true, + clientId: mockServiceNowOAuth.config.clientId, + jwtKeyId: mockServiceNowOAuth.config.jwtKeyId, + userIdentifierValue: mockServiceNowOAuth.config.userIdentifierValue, + }, + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow Basic Auth connector with no apiUrl', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -139,7 +217,30 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { }); }); - it('should respond with a 400 Bad Request when creating a servicenow action with a not present in allowedHosts apiUrl', async () => { + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector with no apiUrl', async () => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-itom', + config: { + isOAuth: true, + }, + secrets: mockServiceNowOAuth.secrets, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: + 'error validating action type config: [apiUrl]: expected value of type [string] but got [undefined]', + }); + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow connector with a not present in allowedHosts apiUrl', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -149,7 +250,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { config: { apiUrl: 'http://servicenow.mynonexistent.com', }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(400) .then((resp: any) => { @@ -162,7 +263,29 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { }); }); - it('should respond with a 400 Bad Request when creating a servicenow action without secrets', async () => { + it('should respond with a 400 Bad Request when creating a servicenow Basic Auth connector without secrets', async () => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-itom', + config: { + apiUrl: serviceNowSimulatorURL, + }, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: + 'error validating action type secrets: Either basic auth or OAuth credentials must be specified', + }); + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector without secrets', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -170,6 +293,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { name: 'A servicenow action', connector_type_id: '.servicenow-itom', config: { + ...mockServiceNowOAuth.config, apiUrl: serviceNowSimulatorURL, }, }) @@ -179,10 +303,84 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'error validating action type secrets: [password]: expected value of type [string] but got [undefined]', + 'error validating action type secrets: Either basic auth or OAuth credentials must be specified', }); }); }); + + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector with missing fields', async () => { + const badConfigs = [ + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + clientId: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: clientId must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + userIdentifierValue: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: userIdentifierValue must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + jwtKeyId: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: jwtKeyId must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: { + ...mockServiceNowOAuth.secrets, + clientSecret: null, + }, + errorMessage: `error validating action type secrets: clientSecret and privateKey must both be specified`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: { + ...mockServiceNowOAuth.secrets, + privateKey: null, + }, + errorMessage: `error validating action type secrets: clientSecret and privateKey must both be specified`, + }, + ]; + + await asyncForEach(badConfigs, async (badConfig) => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-itom', + config: badConfig.config, + secrets: badConfig.secrets, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: badConfig.errorMessage, + }); + }); + }); + }); }); describe('ServiceNow ITOM - Executor', () => { @@ -196,7 +394,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }); simulatedActionId = body.id; }); @@ -284,7 +482,7 @@ export default function serviceNowITOMTest({ getService }: FtrProviderContext) { .post(`/api/actions/connector/${simulatedActionId}/_execute`) .set('kbn-xsrf', 'foo') .send({ - params: mockServiceNow.params, + params: mockServiceNowBasic.params, }) .expect(200); expect(result.status).to.eql('ok'); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts index 4cc65d7103a58..0f81753bbc731 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_itsm.ts @@ -7,6 +7,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; +import { asyncForEach } from '@kbn/std'; import getPort from 'get-port'; import http from 'http'; @@ -19,15 +20,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const configService = getService('config'); - const mockServiceNow = { - config: { - apiUrl: 'www.servicenowisinkibanaactions.com', - usesTableApi: false, - }, - secrets: { - password: 'elastic', - username: 'changeme', - }, + const mockServiceNowCommon = { params: { subAction: 'pushToService', subActionParams: { @@ -51,6 +44,33 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { }, }; + const mockServiceNowBasic = { + ...mockServiceNowCommon, + config: { + apiUrl: 'www.servicenowisinkibanaactions.com', + usesTableApi: false, + }, + secrets: { + password: 'elastic', + username: 'changeme', + }, + }; + const mockServiceNowOAuth = { + ...mockServiceNowCommon, + config: { + apiUrl: 'www.servicenowisinkibanaactions.com', + usesTableApi: false, + isOAuth: true, + clientId: 'abc', + userIdentifierValue: 'elastic', + jwtKeyId: 'def', + }, + secrets: { + clientSecret: 'xyz', + privateKey: '-----BEGIN RSA PRIVATE KEY-----\nddddddd\n-----END RSA PRIVATE KEY-----', + }, + }; + describe('ServiceNow ITSM', () => { let simulatedActionId = ''; let serviceNowSimulatorURL: string = ''; @@ -82,7 +102,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { }); describe('ServiceNow ITSM - Action Creation', () => { - it('should return 200 when creating a servicenow action successfully', async () => { + it('should return 200 when creating a servicenow Basic Auth connector successfully', async () => { const { body: createdAction } = await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -93,7 +113,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { apiUrl: serviceNowSimulatorURL, usesTableApi: false, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(200); @@ -107,6 +127,10 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, }, }); @@ -124,6 +148,64 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, + }, + }); + }); + + it('should return 200 when creating a servicenow OAuth connector successfully', async () => { + const { body: createdConnector } = await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow', + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: mockServiceNowOAuth.secrets, + }) + .expect(200); + + expect(createdConnector).to.eql({ + id: createdConnector.id, + is_preconfigured: false, + is_deprecated: false, + name: 'A servicenow action', + connector_type_id: '.servicenow', + is_missing_secrets: false, + config: { + apiUrl: serviceNowSimulatorURL, + usesTableApi: false, + isOAuth: true, + clientId: mockServiceNowOAuth.config.clientId, + jwtKeyId: mockServiceNowOAuth.config.jwtKeyId, + userIdentifierValue: mockServiceNowOAuth.config.userIdentifierValue, + }, + }); + + const { body: fetchedConnector } = await supertest + .get(`/api/actions/connector/${createdConnector.id}`) + .expect(200); + + expect(fetchedConnector).to.eql({ + id: fetchedConnector.id, + is_preconfigured: false, + is_deprecated: false, + name: 'A servicenow action', + connector_type_id: '.servicenow', + is_missing_secrets: false, + config: { + apiUrl: serviceNowSimulatorURL, + usesTableApi: false, + isOAuth: true, + clientId: mockServiceNowOAuth.config.clientId, + jwtKeyId: mockServiceNowOAuth.config.jwtKeyId, + userIdentifierValue: mockServiceNowOAuth.config.userIdentifierValue, }, }); }); @@ -138,7 +220,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(200); @@ -149,7 +231,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { expect(fetchedAction.config.usesTableApi).to.be(true); }); - it('should respond with a 400 Bad Request when creating a servicenow action with no apiUrl', async () => { + it('should respond with a 400 Bad Request when creating a servicenow Basic Auth connector with no apiUrl', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -169,7 +251,30 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { }); }); - it('should respond with a 400 Bad Request when creating a servicenow action with a not present in allowedHosts apiUrl', async () => { + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector with no apiUrl', async () => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow', + config: { + isOAuth: true, + }, + secrets: mockServiceNowOAuth.secrets, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: + 'error validating action type config: [apiUrl]: expected value of type [string] but got [undefined]', + }); + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow connector with a not present in allowedHosts apiUrl', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -179,7 +284,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { config: { apiUrl: 'http://servicenow.mynonexistent.com', }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(400) .then((resp: any) => { @@ -192,7 +297,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { }); }); - it('should respond with a 400 Bad Request when creating a servicenow action without secrets', async () => { + it('should respond with a 400 Bad Request when creating a servicenow Basic Auth connector without secrets', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -209,10 +314,107 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'error validating action type secrets: [password]: expected value of type [string] but got [undefined]', + 'error validating action type secrets: Either basic auth or OAuth credentials must be specified', }); }); }); + + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector without secrets', async () => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow', + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: + 'error validating action type secrets: Either basic auth or OAuth credentials must be specified', + }); + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector with missing fields', async () => { + const badConfigs = [ + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + clientId: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: clientId must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + userIdentifierValue: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: userIdentifierValue must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + jwtKeyId: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: jwtKeyId must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: { + ...mockServiceNowOAuth.secrets, + clientSecret: null, + }, + errorMessage: `error validating action type secrets: clientSecret and privateKey must both be specified`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: { + ...mockServiceNowOAuth.secrets, + privateKey: null, + }, + errorMessage: `error validating action type secrets: clientSecret and privateKey must both be specified`, + }, + ]; + + await asyncForEach(badConfigs, async (badConfig) => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow', + config: badConfig.config, + secrets: badConfig.secrets, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: badConfig.errorMessage, + }); + }); + }); + }); }); describe('ServiceNow ITSM - Executor', () => { @@ -227,7 +429,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { apiUrl: serviceNowSimulatorURL, usesTableApi: false, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }); simulatedActionId = body.id; }); @@ -289,7 +491,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { savedObjectId: 'success', }, @@ -312,10 +514,10 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { incident: { - ...mockServiceNow.params.subActionParams.incident, + ...mockServiceNowBasic.params.subActionParams.incident, short_description: 'success', }, comments: [{ comment: 'boo' }], @@ -339,10 +541,10 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { incident: { - ...mockServiceNow.params.subActionParams.incident, + ...mockServiceNowBasic.params.subActionParams.incident, short_description: 'success', }, comments: [{ commentId: 'success' }], @@ -393,9 +595,9 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { - incident: mockServiceNow.params.subActionParams.incident, + incident: mockServiceNowBasic.params.subActionParams.incident, comments: [], }, }, @@ -429,7 +631,7 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { apiUrl: serviceNowSimulatorURL, usesTableApi: true, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }); simulatedActionId = body.id; }); @@ -440,9 +642,9 @@ export default function serviceNowITSMTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { - incident: mockServiceNow.params.subActionParams.incident, + incident: mockServiceNowBasic.params.subActionParams.incident, comments: [], }, }, diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts index 305bbef7cf70a..0f5640f7edd3e 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/actions/builtin_action_types/servicenow_sir.ts @@ -7,6 +7,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; +import { asyncForEach } from '@kbn/std'; import getPort from 'get-port'; import http from 'http'; @@ -19,7 +20,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const configService = getService('config'); - const mockServiceNow = { + const mockServiceNowCommon = { config: { apiUrl: 'www.servicenowisinkibanaactions.com', usesTableApi: false, @@ -55,6 +56,33 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { }, }; + const mockServiceNowBasic = { + ...mockServiceNowCommon, + config: { + apiUrl: 'www.servicenowisinkibanaactions.com', + usesTableApi: false, + }, + secrets: { + password: 'elastic', + username: 'changeme', + }, + }; + const mockServiceNowOAuth = { + ...mockServiceNowCommon, + config: { + apiUrl: 'www.servicenowisinkibanaactions.com', + usesTableApi: false, + isOAuth: true, + clientId: 'abc', + userIdentifierValue: 'elastic', + jwtKeyId: 'def', + }, + secrets: { + clientSecret: 'xyz', + privateKey: '-----BEGIN RSA PRIVATE KEY-----\nddddddd\n-----END RSA PRIVATE KEY-----', + }, + }; + describe('ServiceNow SIR', () => { let simulatedActionId = ''; let serviceNowSimulatorURL: string = ''; @@ -86,7 +114,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { }); describe('ServiceNow SIR - Action Creation', () => { - it('should return 200 when creating a servicenow action successfully', async () => { + it('should return 200 when creating a servicenow Basic Auth connector successfully', async () => { const { body: createdAction } = await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -97,7 +125,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { apiUrl: serviceNowSimulatorURL, usesTableApi: false, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(200); @@ -111,6 +139,10 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, }, }); @@ -128,6 +160,64 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, + }, + }); + }); + + it('should return 200 when creating a servicenow OAuth connector successfully', async () => { + const { body: createdConnector } = await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-sir', + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: mockServiceNowOAuth.secrets, + }) + .expect(200); + + expect(createdConnector).to.eql({ + id: createdConnector.id, + is_preconfigured: false, + is_deprecated: false, + name: 'A servicenow action', + connector_type_id: '.servicenow-sir', + is_missing_secrets: false, + config: { + apiUrl: serviceNowSimulatorURL, + usesTableApi: false, + isOAuth: true, + clientId: mockServiceNowOAuth.config.clientId, + jwtKeyId: mockServiceNowOAuth.config.jwtKeyId, + userIdentifierValue: mockServiceNowOAuth.config.userIdentifierValue, + }, + }); + + const { body: fetchedConnector } = await supertest + .get(`/api/actions/connector/${createdConnector.id}`) + .expect(200); + + expect(fetchedConnector).to.eql({ + id: fetchedConnector.id, + is_preconfigured: false, + is_deprecated: false, + name: 'A servicenow action', + connector_type_id: '.servicenow-sir', + is_missing_secrets: false, + config: { + apiUrl: serviceNowSimulatorURL, + usesTableApi: false, + isOAuth: true, + clientId: mockServiceNowOAuth.config.clientId, + jwtKeyId: mockServiceNowOAuth.config.jwtKeyId, + userIdentifierValue: mockServiceNowOAuth.config.userIdentifierValue, }, }); }); @@ -142,7 +232,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(200); @@ -153,7 +243,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { expect(fetchedAction.config.usesTableApi).to.be(true); }); - it('should respond with a 400 Bad Request when creating a servicenow action with no apiUrl', async () => { + it('should respond with a 400 Bad Request when creating a servicenow Basic Auth connector with no apiUrl', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -173,7 +263,30 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { }); }); - it('should respond with a 400 Bad Request when creating a servicenow action with a not present in allowedHosts apiUrl', async () => { + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector with no apiUrl', async () => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-sir', + config: { + isOAuth: true, + }, + secrets: mockServiceNowOAuth.secrets, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: + 'error validating action type config: [apiUrl]: expected value of type [string] but got [undefined]', + }); + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow connector with a not present in allowedHosts apiUrl', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -183,7 +296,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { config: { apiUrl: 'http://servicenow.mynonexistent.com', }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }) .expect(400) .then((resp: any) => { @@ -196,7 +309,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { }); }); - it('should respond with a 400 Bad Request when creating a servicenow action without secrets', async () => { + it('should respond with a 400 Bad Request when creating a servicenow Basic Auth connector without secrets', async () => { await supertest .post('/api/actions/connector') .set('kbn-xsrf', 'foo') @@ -213,10 +326,107 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'error validating action type secrets: [password]: expected value of type [string] but got [undefined]', + 'error validating action type secrets: Either basic auth or OAuth credentials must be specified', }); }); }); + + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector without secrets', async () => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-sir', + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: + 'error validating action type secrets: Either basic auth or OAuth credentials must be specified', + }); + }); + }); + + it('should respond with a 400 Bad Request when creating a servicenow OAuth connector with missing fields', async () => { + const badConfigs = [ + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + clientId: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: clientId must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + userIdentifierValue: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: userIdentifierValue must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + jwtKeyId: null, + }, + secrets: mockServiceNowOAuth.secrets, + errorMessage: `error validating action type config: jwtKeyId must be provided when isOAuth = true`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: { + ...mockServiceNowOAuth.secrets, + clientSecret: null, + }, + errorMessage: `error validating action type secrets: clientSecret and privateKey must both be specified`, + }, + { + config: { + ...mockServiceNowOAuth.config, + apiUrl: serviceNowSimulatorURL, + }, + secrets: { + ...mockServiceNowOAuth.secrets, + privateKey: null, + }, + errorMessage: `error validating action type secrets: clientSecret and privateKey must both be specified`, + }, + ]; + + await asyncForEach(badConfigs, async (badConfig) => { + await supertest + .post('/api/actions/connector') + .set('kbn-xsrf', 'foo') + .send({ + name: 'A servicenow action', + connector_type_id: '.servicenow-sir', + config: badConfig.config, + secrets: badConfig.secrets, + }) + .expect(400) + .then((resp: any) => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: badConfig.errorMessage, + }); + }); + }); + }); }); describe('ServiceNow SIR - Executor', () => { @@ -230,8 +440,9 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { config: { apiUrl: serviceNowSimulatorURL, usesTableApi: false, + isOAuth: false, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }); simulatedActionId = body.id; }); @@ -293,7 +504,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { savedObjectId: 'success', }, @@ -316,10 +527,10 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { incident: { - ...mockServiceNow.params.subActionParams.incident, + ...mockServiceNowBasic.params.subActionParams.incident, short_description: 'success', }, comments: [{ comment: 'boo' }], @@ -343,10 +554,10 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { incident: { - ...mockServiceNow.params.subActionParams.incident, + ...mockServiceNowBasic.params.subActionParams.incident, short_description: 'success', }, comments: [{ commentId: 'success' }], @@ -397,9 +608,9 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { - incident: mockServiceNow.params.subActionParams.incident, + incident: mockServiceNowBasic.params.subActionParams.incident, comments: [], }, }, @@ -433,7 +644,7 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { apiUrl: serviceNowSimulatorURL, usesTableApi: true, }, - secrets: mockServiceNow.secrets, + secrets: mockServiceNowBasic.secrets, }); simulatedActionId = body.id; }); @@ -444,9 +655,9 @@ export default function serviceNowSIRTest({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'foo') .send({ params: { - ...mockServiceNow.params, + ...mockServiceNowBasic.params, subActionParams: { - incident: mockServiceNow.params.subActionParams.incident, + incident: mockServiceNowBasic.params.subActionParams.incident, comments: [], }, }, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/migrations.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/migrations.ts index 7b28161c18238..4f23a5ff3a727 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/migrations.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/migrations.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import { asyncForEach } from '@kbn/std'; import { getUrlPrefix } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; @@ -83,6 +84,23 @@ export default function createGetTests({ getService }: FtrProviderContext) { expect(connectorWithoutService.body.config.service).to.eql('other'); }); + it('8.3.0 migrates service now connectors to have `isOAuth` property', async () => { + const serviceNowConnectorIds = [ + '7d04bc30-c4c0-11ec-ae29-917aa31a5b75', + '8a9331b0-c4c0-11ec-ae29-917aa31a5b75', + '6d3a1250-c4c0-11ec-ae29-917aa31a5b75', + ]; + + await asyncForEach(serviceNowConnectorIds, async (serviceNowConnectorId) => { + const connectorResponse = await supertest.get( + `${getUrlPrefix(``)}/api/actions/action/${serviceNowConnectorId}` + ); + + expect(connectorResponse.status).to.eql(200); + expect(connectorResponse.body.config.isOAuth).to.eql(false); + }); + }); + it('decryption error during migration', async () => { const badEmailConnector = await supertest.get( `${getUrlPrefix(``)}/api/actions/connector/0f8f2810-0a59-11ec-9a7c-fd0c2b83ff7d` diff --git a/x-pack/test/cases_api_integration/common/lib/utils.ts b/x-pack/test/cases_api_integration/common/lib/utils.ts index 7714c85b11d9a..ec0f9074df099 100644 --- a/x-pack/test/cases_api_integration/common/lib/utils.ts +++ b/x-pack/test/cases_api_integration/common/lib/utils.ts @@ -217,6 +217,23 @@ export const getServiceNowConnector = () => ({ }, }); +export const getServiceNowOAuthConnector = () => ({ + name: 'ServiceNow OAuth Connector', + connector_type_id: '.servicenow', + secrets: { + clientSecret: 'xyz', + privateKey: '-----BEGIN RSA PRIVATE KEY-----\nddddddd\n-----END RSA PRIVATE KEY-----', + }, + config: { + apiUrl: 'http://some.non.existent.com', + usesTableApi: false, + isOAuth: true, + clientId: 'abc', + userIdentifierValue: 'elastic', + jwtKeyId: 'def', + }, +}); + export const getJiraConnector = () => ({ name: 'Jira Connector', connector_type_id: '.jira', @@ -262,7 +279,7 @@ export const getResilientConnector = () => ({ }); export const getServiceNowSIRConnector = () => ({ - name: 'ServiceNow Connector', + name: 'ServiceNow SIR Connector', connector_type_id: '.servicenow-sir', secrets: { username: 'admin', diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts b/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts index 26df77bfbc924..de72e0f343026 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts +++ b/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts @@ -11,6 +11,7 @@ import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import { getServiceNowConnector, + getServiceNowOAuthConnector, getJiraConnector, getResilientConnector, createConnector, @@ -31,6 +32,10 @@ export default ({ getService }: FtrProviderContext): void => { it('should return the correct connectors', async () => { const snConnector = await createConnector({ supertest, req: getServiceNowConnector() }); + const snOAuthConnector = await createConnector({ + supertest, + req: getServiceNowOAuthConnector(), + }); const emailConnector = await createConnector({ supertest, req: getEmailConnector() }); const jiraConnector = await createConnector({ supertest, req: getJiraConnector() }); const resilientConnector = await createConnector({ supertest, req: getResilientConnector() }); @@ -38,13 +43,15 @@ export default ({ getService }: FtrProviderContext): void => { actionsRemover.add('default', sir.id, 'action', 'actions'); actionsRemover.add('default', snConnector.id, 'action', 'actions'); + actionsRemover.add('default', snOAuthConnector.id, 'action', 'actions'); actionsRemover.add('default', emailConnector.id, 'action', 'actions'); actionsRemover.add('default', jiraConnector.id, 'action', 'actions'); actionsRemover.add('default', resilientConnector.id, 'action', 'actions'); const connectors = await getCaseConnectors({ supertest }); + const sortedConnectors = connectors.sort((a, b) => a.name.localeCompare(b.name)); - expect(connectors).to.eql([ + expect(sortedConnectors).to.eql([ { id: jiraConnector.id, actionTypeId: '.jira', @@ -90,6 +97,27 @@ export default ({ getService }: FtrProviderContext): void => { config: { apiUrl: 'http://some.non.existent.com', usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, + }, + isPreconfigured: false, + isDeprecated: false, + isMissingSecrets: false, + referencedByCount: 0, + }, + { + id: snOAuthConnector.id, + actionTypeId: '.servicenow', + name: 'ServiceNow OAuth Connector', + config: { + apiUrl: 'http://some.non.existent.com', + usesTableApi: false, + isOAuth: true, + clientId: 'abc', + userIdentifierValue: 'elastic', + jwtKeyId: 'def', }, isPreconfigured: false, isDeprecated: false, @@ -99,10 +127,14 @@ export default ({ getService }: FtrProviderContext): void => { { id: sir.id, actionTypeId: '.servicenow-sir', - name: 'ServiceNow Connector', + name: 'ServiceNow SIR Connector', config: { apiUrl: 'http://some.non.existent.com', usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, }, isPreconfigured: false, isDeprecated: false, diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts b/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts index c4115b5c4902d..0ca47597e7b6b 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts +++ b/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts @@ -11,6 +11,7 @@ import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import { getServiceNowConnector, + getServiceNowOAuthConnector, getJiraConnector, getResilientConnector, createConnector, @@ -39,7 +40,11 @@ export default ({ getService }: FtrProviderContext): void => { req: getServiceNowConnector(), auth: authSpace1, }); - + const snOAuthConnector = await createConnector({ + supertest, + req: getServiceNowOAuthConnector(), + auth: authSpace1, + }); const emailConnector = await createConnector({ supertest, req: getEmailConnector(), @@ -66,13 +71,15 @@ export default ({ getService }: FtrProviderContext): void => { actionsRemover.add(space, sir.id, 'action', 'actions'); actionsRemover.add(space, snConnector.id, 'action', 'actions'); + actionsRemover.add(space, snOAuthConnector.id, 'action', 'actions'); actionsRemover.add(space, emailConnector.id, 'action', 'actions'); actionsRemover.add(space, jiraConnector.id, 'action', 'actions'); actionsRemover.add(space, resilientConnector.id, 'action', 'actions'); const connectors = await getCaseConnectors({ supertest, auth: authSpace1 }); + const sortedConnectors = connectors.sort((a, b) => a.name.localeCompare(b.name)); - expect(connectors).to.eql([ + expect(sortedConnectors).to.eql([ { id: jiraConnector.id, actionTypeId: '.jira', @@ -118,6 +125,27 @@ export default ({ getService }: FtrProviderContext): void => { config: { apiUrl: 'http://some.non.existent.com', usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, + }, + isPreconfigured: false, + isDeprecated: false, + isMissingSecrets: false, + referencedByCount: 0, + }, + { + id: snOAuthConnector.id, + actionTypeId: '.servicenow', + name: 'ServiceNow OAuth Connector', + config: { + apiUrl: 'http://some.non.existent.com', + usesTableApi: false, + isOAuth: true, + clientId: 'abc', + userIdentifierValue: 'elastic', + jwtKeyId: 'def', }, isPreconfigured: false, isDeprecated: false, @@ -127,10 +155,14 @@ export default ({ getService }: FtrProviderContext): void => { { id: sir.id, actionTypeId: '.servicenow-sir', - name: 'ServiceNow Connector', + name: 'ServiceNow SIR Connector', config: { apiUrl: 'http://some.non.existent.com', usesTableApi: false, + isOAuth: false, + clientId: null, + jwtKeyId: null, + userIdentifierValue: null, }, isPreconfigured: false, isDeprecated: false, @@ -147,6 +179,12 @@ export default ({ getService }: FtrProviderContext): void => { auth: authSpace1, }); + const snOAuthConnector = await createConnector({ + supertest, + req: getServiceNowOAuthConnector(), + auth: authSpace1, + }); + const emailConnector = await createConnector({ supertest, req: getEmailConnector(), @@ -173,6 +211,7 @@ export default ({ getService }: FtrProviderContext): void => { actionsRemover.add(space, sir.id, 'action', 'actions'); actionsRemover.add(space, snConnector.id, 'action', 'actions'); + actionsRemover.add(space, snOAuthConnector.id, 'action', 'actions'); actionsRemover.add(space, emailConnector.id, 'action', 'actions'); actionsRemover.add(space, jiraConnector.id, 'action', 'actions'); actionsRemover.add(space, resilientConnector.id, 'action', 'actions'); diff --git a/x-pack/test/functional/es_archives/actions/data.json b/x-pack/test/functional/es_archives/actions/data.json index 79e7920872ab0..75206672358db 100644 --- a/x-pack/test/functional/es_archives/actions/data.json +++ b/x-pack/test/functional/es_archives/actions/data.json @@ -205,4 +205,96 @@ "updated_at": "2021-08-31T12:43:37.117Z" } } +} + +{ + "type": "doc", + "value": { + "id": "action:7d04bc30-c4c0-11ec-ae29-917aa31a5b75", + "index": ".kibana_1", + "source": { + "action": { + "actionTypeId" : ".servicenow-sir", + "name" : "test servicenow SecOps", + "isMissingSecrets" : false, + "config" : { + "apiUrl": "https://devtestsecops.service-now.com", + "usesTableApi": false + }, + "secrets" : "kPp4tl4ueQ2ZNWSfATR3dFrbxd+NNBo4MY8izS6GJf358Lmeg/YaYjb2rIymrbPktR6HnPBRaVyXWlRTvBGstRicJc0LJHZbx3wNJlTRIj4UFlVqZLGQWQ/GcSqFLSZ1JQbKwgAvyfLtF6BhjAhGYEovK3/OLUNzGc3gvUOOHBiPWjiAY8A=" + }, + "migrationVersion": { + "action": "8.0.0" + }, + "coreMigrationVersion" : "8.2.0", + "references": [ + ], + "namespaces": [ + "default" + ], + "type": "action", + "updated_at": "2022-04-25T17:52:35.201Z" + } + } +} + +{ + "type": "doc", + "value": { + "id": "action:8a9331b0-c4c0-11ec-ae29-917aa31a5b75", + "index": ".kibana_1", + "source": { + "action": { + "actionTypeId" : ".servicenow-itom", + "name" : "test servicenow ITOM", + "isMissingSecrets" : false, + "config" : { + "apiUrl": "https://devtestsecops.service-now.com" + }, + "secrets" : "yYThM4vbrSTIg5IjKWE+eMDrxzL7UO0JQIyh6FvEMgqoNREUxRrIavSo25v+DXQIX1DyfsvjjKg97pNPlZhvS3siCwDZZafSFrwkCKDl+S4KHORgIMX+slilcQeuEnzwit7bFxcY7Y/AcNF8Ks6jO0Gs1UR58ibSPUALXoK2VOlJnHSgtvE=" + }, + "migrationVersion": { + "action": "8.0.0" + }, + "coreMigrationVersion" : "8.2.0", + "references": [ + ], + "namespaces": [ + "default" + ], + "type": "action", + "updated_at": "2022-04-25T17:52:35.201Z" + } + } +} + +{ + "type": "doc", + "value": { + "id": "action:6d3a1250-c4c0-11ec-ae29-917aa31a5b75", + "index": ".kibana_1", + "source": { + "action": { + "actionTypeId" : ".servicenow", + "name" : "test servicenow ITSM", + "isMissingSecrets" : false, + "config" : { + "usesTableApi": false, + "apiUrl": "https://devtestsecops.service-now.com" + }, + "secrets" : "zfXUDtG0CyJkJUKnQ8rSqo75hb6ZhbRUWkV1NiFEjApM87b72Rcqz3Fv+sbm8eBDOO1Fdd9CVyK+Bfly4ZwVCgL2lR0qIbPzz34q36r267dnGVsaERyJIVv2WPy+EGdiRZKgfpy4XFbMNT1R3gyIsUkd4TT+McqGfVTont2XTFIpMW2A9y8=" + }, + "migrationVersion": { + "action": "8.0.0" + }, + "coreMigrationVersion" : "8.2.0", + "references": [ + ], + "namespaces": [ + "default" + ], + "type": "action", + "updated_at": "2022-04-25T17:52:35.201Z" + } + } } \ No newline at end of file From 6bc515fb644f7c8412e287b61447c983e2995268 Mon Sep 17 00:00:00 2001 From: Miriam <31922082+MiriamAparicio@users.noreply.github.com> Date: Fri, 29 Apr 2022 15:43:26 +0200 Subject: [PATCH 16/89] [APM] set max limit back to 500 (#131160) --- x-pack/plugins/apm/common/service_groups.ts | 2 +- .../apm/server/routes/service_groups/get_service_groups.ts | 4 ++-- .../apm/server/routes/service_groups/lookup_services.ts | 4 ++-- .../server/routes/services/__snapshots__/queries.test.ts.snap | 4 ++-- .../server/routes/services/get_services/get_services_items.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/apm/common/service_groups.ts b/x-pack/plugins/apm/common/service_groups.ts index d56acc846dc1b..1fa6e03f43719 100644 --- a/x-pack/plugins/apm/common/service_groups.ts +++ b/x-pack/plugins/apm/common/service_groups.ts @@ -7,7 +7,7 @@ export const APM_SERVICE_GROUP_SAVED_OBJECT_TYPE = 'apm-service-group'; export const SERVICE_GROUP_COLOR_DEFAULT = '#D1DAE7'; -export const MAX_NUMBER_OF_SERVICES_IN_GROUP = 500; +export const MAX_NUMBER_OF_SERVICE_GROUPS = 500; export interface ServiceGroup { groupName: string; diff --git a/x-pack/plugins/apm/server/routes/service_groups/get_service_groups.ts b/x-pack/plugins/apm/server/routes/service_groups/get_service_groups.ts index 6307d273e12f5..2e4690777d466 100644 --- a/x-pack/plugins/apm/server/routes/service_groups/get_service_groups.ts +++ b/x-pack/plugins/apm/server/routes/service_groups/get_service_groups.ts @@ -10,7 +10,7 @@ import { ServiceGroup, SavedServiceGroup, APM_SERVICE_GROUP_SAVED_OBJECT_TYPE, - MAX_NUMBER_OF_SERVICES_IN_GROUP, + MAX_NUMBER_OF_SERVICE_GROUPS, } from '../../../common/service_groups'; export async function getServiceGroups({ @@ -21,7 +21,7 @@ export async function getServiceGroups({ const result = await savedObjectsClient.find({ type: APM_SERVICE_GROUP_SAVED_OBJECT_TYPE, page: 1, - perPage: MAX_NUMBER_OF_SERVICES_IN_GROUP, + perPage: MAX_NUMBER_OF_SERVICE_GROUPS, }); return result.saved_objects.map( ({ id, attributes, updated_at: upatedAt }) => ({ diff --git a/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts b/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts index a9b0d9fe8c57b..78b066a538699 100644 --- a/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts +++ b/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts @@ -14,7 +14,7 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { ProcessorEvent } from '../../../common/processor_event'; import { Setup } from '../../lib/helpers/setup_request'; -import { MAX_NUMBER_OF_SERVICES_IN_GROUP } from '../../../common/service_groups'; +import { MAX_NUMBER_OF_SERVICE_GROUPS } from '../../../common/service_groups'; export async function lookupServices({ setup, @@ -49,7 +49,7 @@ export async function lookupServices({ services: { terms: { field: SERVICE_NAME, - size: MAX_NUMBER_OF_SERVICES_IN_GROUP, + size: MAX_NUMBER_OF_SERVICE_GROUPS, }, aggs: { environments: { diff --git a/x-pack/plugins/apm/server/routes/services/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/routes/services/__snapshots__/queries.test.ts.snap index e09c50708c476..8e2afb1bd1bf7 100644 --- a/x-pack/plugins/apm/server/routes/services/__snapshots__/queries.test.ts.snap +++ b/x-pack/plugins/apm/server/routes/services/__snapshots__/queries.test.ts.snap @@ -126,7 +126,7 @@ Array [ }, "terms": Object { "field": "service.name", - "size": 50, + "size": 500, }, }, }, @@ -186,7 +186,7 @@ Array [ }, "terms": Object { "field": "service.name", - "size": 50, + "size": 500, }, }, }, diff --git a/x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts index a5936dd68d026..de484ed309884 100644 --- a/x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_services_items.ts @@ -16,7 +16,7 @@ import { ServiceGroup } from '../../../../common/service_groups'; export type ServicesItemsSetup = Setup; -const MAX_NUMBER_OF_SERVICES = 50; +const MAX_NUMBER_OF_SERVICES = 500; export async function getServicesItems({ environment, From 6e6c9614f5afec1f068d877ab6c3d7e125c1d07a Mon Sep 17 00:00:00 2001 From: Paul Tavares <56442535+paul-tavares@users.noreply.github.com> Date: Fri, 29 Apr 2022 10:04:25 -0400 Subject: [PATCH 17/89] [Security Solution][Endpoint] Add default query options to React-Query client and adjust existing hooks (#131165) * Expose the QueryClient used in the app as SecuritySolutionQueryClient * Add defaults to `SecuritySolutionQueryClient` * Update existing hooks and remove defaults from useQuery * Fix option Type for hooks that use `useMutation()` from React-Query --- .../query_client/query_client_provider.tsx | 28 +++++++++++++++++-- .../artifacts/use_bulk_delete_artifact.tsx | 9 ++++-- .../artifacts/use_bulk_update_artifact.tsx | 9 ++++-- .../hooks/artifacts/use_create_artifact.tsx | 9 ++++-- .../hooks/artifacts/use_delete_artifact.tsx | 9 ++++-- .../hooks/artifacts/use_get_artifact.tsx | 11 ++------ .../hooks/artifacts/use_list_artifact.tsx | 12 ++------ .../hooks/artifacts/use_summary_artifact.tsx | 12 ++------ .../hooks/artifacts/use_update_artifact.tsx | 9 ++++-- .../view/ingest_manager_integration/mocks.tsx | 4 +-- .../render_context_providers.tsx | 8 ++++-- .../management/services/policies/hooks.ts | 26 ++++++----------- 12 files changed, 83 insertions(+), 63 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/containers/query_client/query_client_provider.tsx b/x-pack/plugins/security_solution/public/common/containers/query_client/query_client_provider.tsx index 9d2f9ca9f48fa..2f67dc2734fed 100644 --- a/x-pack/plugins/security_solution/public/common/containers/query_client/query_client_provider.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/query_client/query_client_provider.tsx @@ -8,14 +8,38 @@ import React, { memo, PropsWithChildren, useMemo } from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; +type QueryClientOptionsProp = ConstructorParameters[0]; + +/** + * A security solution specific react-query query client that sets defaults + */ +export class SecuritySolutionQueryClient extends QueryClient { + constructor(options: QueryClientOptionsProp = {}) { + const optionsWithDefaults: QueryClientOptionsProp = { + ...options, + defaultOptions: { + ...(options.defaultOptions ?? {}), + queries: { + refetchIntervalInBackground: false, + refetchOnWindowFocus: false, + refetchOnMount: true, + keepPreviousData: true, + ...(options?.defaultOptions?.queries ?? {}), + }, + }, + }; + super(optionsWithDefaults); + } +} + export type ReactQueryClientProviderProps = PropsWithChildren<{ - queryClient?: QueryClient; + queryClient?: SecuritySolutionQueryClient; }>; export const ReactQueryClientProvider = memo( ({ queryClient, children }) => { const client = useMemo(() => { - return queryClient || new QueryClient(); + return queryClient || new SecuritySolutionQueryClient(); }, [queryClient]); return {children}; } diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_delete_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_delete_artifact.tsx index 994ed4f466d00..f534cc01e62ee 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_delete_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_delete_artifact.tsx @@ -7,14 +7,19 @@ import pMap from 'p-map'; import { HttpFetchError } from '@kbn/core/public'; import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; -import { useMutation, UseMutationResult, UseQueryOptions } from 'react-query'; +import { useMutation, UseMutationOptions, UseMutationResult } from 'react-query'; import { ExceptionsListApiClient } from '../../services/exceptions_list/exceptions_list_api_client'; const DEFAULT_OPTIONS = Object.freeze({}); export function useBulkDeleteArtifact( exceptionListApiClient: ExceptionsListApiClient, - customOptions: UseQueryOptions = DEFAULT_OPTIONS, + customOptions: UseMutationOptions< + ExceptionListItemSchema[], + HttpFetchError, + Array<{ itemId?: string; id?: string }>, + () => void + > = DEFAULT_OPTIONS, options: { concurrency: number; } = { diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_update_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_update_artifact.tsx index 3389b3563577a..68090e2aabc90 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_update_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_bulk_update_artifact.tsx @@ -10,14 +10,19 @@ import { UpdateExceptionListItemSchema, ExceptionListItemSchema, } from '@kbn/securitysolution-io-ts-list-types'; -import { useMutation, UseMutationResult, UseQueryOptions } from 'react-query'; +import { useMutation, UseMutationOptions, UseMutationResult } from 'react-query'; import { ExceptionsListApiClient } from '../../services/exceptions_list/exceptions_list_api_client'; const DEFAULT_OPTIONS = Object.freeze({}); export function useBulkUpdateArtifact( exceptionListApiClient: ExceptionsListApiClient, - customOptions: UseQueryOptions = DEFAULT_OPTIONS, + customOptions: UseMutationOptions< + ExceptionListItemSchema[], + HttpFetchError, + UpdateExceptionListItemSchema[], + () => void + > = DEFAULT_OPTIONS, options: { concurrency: number; } = { diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_create_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_create_artifact.tsx index c1aed4be8005b..79dd59d744e7f 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_create_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_create_artifact.tsx @@ -9,14 +9,19 @@ import { ExceptionListItemSchema, } from '@kbn/securitysolution-io-ts-list-types'; import { HttpFetchError } from '@kbn/core/public'; -import { useMutation, UseMutationResult, UseQueryOptions } from 'react-query'; +import { useMutation, UseMutationOptions, UseMutationResult } from 'react-query'; import { ExceptionsListApiClient } from '../../services/exceptions_list/exceptions_list_api_client'; const DEFAULT_OPTIONS = Object.freeze({}); export function useCreateArtifact( exceptionListApiClient: ExceptionsListApiClient, - customOptions: UseQueryOptions = DEFAULT_OPTIONS + customOptions: UseMutationOptions< + ExceptionListItemSchema, + HttpFetchError, + CreateExceptionListItemSchema, + () => void + > = DEFAULT_OPTIONS ): UseMutationResult< ExceptionListItemSchema, HttpFetchError, diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_delete_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_delete_artifact.tsx index 16568a0766444..a12b3aaa9ba40 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_delete_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_delete_artifact.tsx @@ -6,14 +6,19 @@ */ import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { HttpFetchError } from '@kbn/core/public'; -import { useMutation, UseMutationResult, UseQueryOptions } from 'react-query'; +import { useMutation, UseMutationOptions, UseMutationResult } from 'react-query'; import { ExceptionsListApiClient } from '../../services/exceptions_list/exceptions_list_api_client'; const DEFAULT_OPTIONS = Object.freeze({}); export function useDeleteArtifact( exceptionListApiClient: ExceptionsListApiClient, - customOptions: UseQueryOptions = DEFAULT_OPTIONS + customOptions: UseMutationOptions< + ExceptionListItemSchema, + HttpFetchError, + { itemId?: string; id?: string }, + () => void + > = DEFAULT_OPTIONS ): UseMutationResult< ExceptionListItemSchema, HttpFetchError, diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_get_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_get_artifact.tsx index eb80a689e5a0d..36ae203707c28 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_get_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_get_artifact.tsx @@ -9,24 +9,17 @@ import { HttpFetchError } from '@kbn/core/public'; import { QueryObserverResult, useQuery, UseQueryOptions } from 'react-query'; import { ExceptionsListApiClient } from '../../services/exceptions_list/exceptions_list_api_client'; -const DEFAULT_OPTIONS = Object.freeze({}); - export function useGetArtifact( exceptionListApiClient: ExceptionsListApiClient, itemId?: string, id?: string, - customQueryOptions: UseQueryOptions = DEFAULT_OPTIONS + customQueryOptions?: UseQueryOptions ): QueryObserverResult { return useQuery( ['get', exceptionListApiClient, itemId, id], () => { return exceptionListApiClient.get(itemId, id); }, - { - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - refetchOnMount: true, - ...customQueryOptions, - } + customQueryOptions ); } diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_list_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_list_artifact.tsx index 68bee6de0113a..64a5b908e2d9e 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_list_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_list_artifact.tsx @@ -31,9 +31,7 @@ export function useListArtifact( excludedPolicies: string[]; }> = DEFAULT_OPTIONS, searchableFields: MaybeImmutable = DEFAULT_EXCEPTION_LIST_ITEM_SEARCHABLE_FIELDS, - customQueryOptions: Partial< - UseQueryOptions - > = DEFAULT_OPTIONS, + customQueryOptions?: Partial>, customQueryIds: string[] = [] ): QueryObserverResult { const { @@ -64,12 +62,6 @@ export function useListArtifact( return result; }, - { - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - refetchOnMount: true, - keepPreviousData: true, - ...customQueryOptions, - } + customQueryOptions ); } diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_summary_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_summary_artifact.tsx index 62e5372dc39aa..111fdb4565785 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_summary_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_summary_artifact.tsx @@ -21,9 +21,7 @@ export function useSummaryArtifact( policies: string[]; }> = DEFAULT_OPTIONS, searchableFields: MaybeImmutable = DEFAULT_EXCEPTION_LIST_ITEM_SEARCHABLE_FIELDS, - customQueryOptions: Partial< - UseQueryOptions - > = DEFAULT_OPTIONS + customQueryOptions: Partial> ): QueryObserverResult { const { filter = '', policies = [] } = options; @@ -37,12 +35,6 @@ export function useSummaryArtifact( }) ); }, - { - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - refetchOnMount: true, - keepPreviousData: true, - ...customQueryOptions, - } + customQueryOptions ); } diff --git a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_update_artifact.tsx b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_update_artifact.tsx index 92da096f71e66..e3a7e37eebf56 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_update_artifact.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/artifacts/use_update_artifact.tsx @@ -9,14 +9,19 @@ import { ExceptionListItemSchema, } from '@kbn/securitysolution-io-ts-list-types'; import { HttpFetchError } from '@kbn/core/public'; -import { useMutation, UseMutationResult, UseQueryOptions } from 'react-query'; +import { useMutation, UseMutationOptions, UseMutationResult } from 'react-query'; import { ExceptionsListApiClient } from '../../services/exceptions_list/exceptions_list_api_client'; const DEFAULT_OPTIONS = Object.freeze({}); export function useUpdateArtifact( exceptionListApiClient: ExceptionsListApiClient, - customQueryOptions: UseQueryOptions = DEFAULT_OPTIONS + customQueryOptions: UseMutationOptions< + ExceptionListItemSchema, + HttpFetchError, + UpdateExceptionListItemSchema, + () => void + > = DEFAULT_OPTIONS ): UseMutationResult< ExceptionListItemSchema, HttpFetchError, diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/mocks.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/mocks.tsx index 908ebc22a19cd..daa44f01dbffd 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/mocks.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/mocks.tsx @@ -13,7 +13,7 @@ import { I18nProvider } from '@kbn/i18n-react'; import type { PackageInfo } from '@kbn/fleet-plugin/common/types'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; -import { QueryClient } from 'react-query'; +import { SecuritySolutionQueryClient } from '../../../../../common/containers/query_client/query_client_provider'; import { AppContextTestRender, createAppRootMockRenderer, @@ -85,7 +85,7 @@ export const createFleetContextRendererMock = (): AppContextTestRender => { additionalMiddleware: [mockedContext.middlewareSpy.actionSpyMiddleware], }); - const queryClient = new QueryClient(); + const queryClient = new SecuritySolutionQueryClient(); const Wrapper: RenderOptions['wrapper'] = ({ children }) => { const services = useMemo(() => { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/with_security_context/render_context_providers.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/with_security_context/render_context_providers.tsx index 9b3472192a718..ec222de1713f0 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/with_security_context/render_context_providers.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/with_security_context/render_context_providers.tsx @@ -8,8 +8,10 @@ import React, { memo, PropsWithChildren } from 'react'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { Store } from 'redux'; -import type { QueryClient } from 'react-query'; -import { ReactQueryClientProvider } from '../../../../../../common/containers/query_client/query_client_provider'; +import { + ReactQueryClientProvider, + SecuritySolutionQueryClient, +} from '../../../../../../common/containers/query_client/query_client_provider'; import { SecuritySolutionStartDependenciesContext } from '../../../../../../common/components/user_privileges/endpoint/security_solution_start_dependencies'; import { CurrentLicense } from '../../../../../../common/components/current_license'; import { StartPlugins } from '../../../../../../types'; @@ -17,7 +19,7 @@ import { StartPlugins } from '../../../../../../types'; export type RenderContextProvidersProps = PropsWithChildren<{ store: Store; depsStart: Pick; - queryClient?: QueryClient; + queryClient?: SecuritySolutionQueryClient; }>; export const RenderContextProviders = memo( diff --git a/x-pack/plugins/security_solution/public/management/services/policies/hooks.ts b/x-pack/plugins/security_solution/public/management/services/policies/hooks.ts index 6cc6140d336d2..cf053128e5f37 100644 --- a/x-pack/plugins/security_solution/public/management/services/policies/hooks.ts +++ b/x-pack/plugins/security_solution/public/management/services/policies/hooks.ts @@ -40,11 +40,11 @@ export function useGetEndpointSpecificPolicies( }, }); }, - { - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - onError, - } + onError + ? { + onError, + } + : undefined ); } @@ -56,7 +56,7 @@ export function useGetEndpointSpecificPolicies( */ export function useGetAgentCountForPolicy({ policyIds, - customQueryOptions = {}, + customQueryOptions, }: { policyIds: string[]; customQueryOptions?: UseQueryOptions; @@ -72,11 +72,7 @@ export function useGetAgentCountForPolicy({ }, }); }, - { - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - ...customQueryOptions, - } + customQueryOptions ); } @@ -84,7 +80,7 @@ export function useGetAgentCountForPolicy({ * This hook returns the endpoint security package which contains endpoint version info */ export function useGetEndpointSecurityPackage({ - customQueryOptions = {}, + customQueryOptions, }: { customQueryOptions?: UseQueryOptions; }): QueryObserverResult { @@ -94,10 +90,6 @@ export function useGetEndpointSecurityPackage({ () => { return sendGetEndpointSecurityPackage(http); }, - { - refetchIntervalInBackground: false, - refetchOnWindowFocus: false, - ...customQueryOptions, - } + customQueryOptions ); } From e603d92552f14c609e76790f8e64af1c659bde30 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Fri, 29 Apr 2022 16:43:59 +0200 Subject: [PATCH 18/89] Remove `data_enhanced` plugin (#122075) Code moved into `data` plugin --- .../steps/storybooks/build_and_upload.js | 2 +- .github/CODEOWNERS | 1 - dev_docs/tutorials/data/search.mdx | 2 +- docs/developer/plugin-list.asciidoc | 4 - packages/kbn-optimizer/limits.yml | 3 +- .../resources/base/bin/kibana-docker | 7 + src/dev/storybook/aliases.ts | 2 +- .../plugins/data}/.storybook/main.js | 5 +- src/plugins/data/config.ts | 31 +- src/plugins/data/kibana.json | 12 +- src/plugins/data/public/plugin.ts | 10 +- .../data/public/search/search_service.test.ts | 14 +- .../data/public/search/search_service.ts | 101 ++- ...onnected_search_session_indicator.test.tsx | 11 +- .../connected_search_session_indicator.tsx | 15 +- .../index.ts | 5 +- .../search_session_tour.tsx | 8 +- .../search_session_view_state.ts | 5 +- .../session/session_indicator}/index.ts | 5 +- .../components}/index.ts | 5 +- .../components/search_session_name}/index.ts | 5 +- .../search_session_name.tsx | 16 +- .../search_session_indicator/custom_icons.tsx | 5 +- .../search_session_indicator/index.tsx | 5 +- .../search_session_indicator.scss | 0 .../search_session_indicator.stories.tsx | 7 +- .../search_session_indicator.test.tsx | 7 +- .../search_session_indicator.tsx | 113 ++-- .../sessions_mgmt/__mocks__/index.tsx | 5 +- .../sessions_mgmt/application/index.tsx | 29 +- .../sessions_mgmt/application/render.tsx | 5 +- .../components/actions/delete_button.tsx | 17 +- .../components/actions/extend_button.tsx | 17 +- .../components/actions/get_action.tsx | 5 +- .../components/actions/index.tsx | 5 +- .../components/actions/inspect_button.scss | 0 .../components/actions/inspect_button.tsx | 11 +- .../components/actions/popover_actions.tsx | 9 +- .../components/actions/rename_button.tsx | 24 +- .../sessions_mgmt/components/actions/types.ts | 5 +- .../sessions_mgmt/components/index.tsx | 5 +- .../sessions_mgmt/components/main.test.tsx | 23 +- .../sessions_mgmt/components/main.tsx | 19 +- .../sessions_mgmt/components/status.test.tsx | 7 +- .../sessions_mgmt/components/status.tsx | 47 +- .../components/table/app_filter.tsx | 7 +- .../sessions_mgmt/components/table/index.ts | 5 +- .../components/table/status_filter.tsx | 7 +- .../components/table/table.test.tsx | 31 +- .../sessions_mgmt/components/table/table.tsx | 32 +- .../sessions_mgmt/icons/extend_session.svg | 0 .../search/session}/sessions_mgmt/index.ts | 36 +- .../session}/sessions_mgmt/lib/api.test.ts | 13 +- .../search/session}/sessions_mgmt/lib/api.ts | 32 +- .../session}/sessions_mgmt/lib/date_string.ts | 5 +- .../sessions_mgmt/lib/documentation.ts | 5 +- .../sessions_mgmt/lib/get_columns.test.tsx | 59 +- .../sessions_mgmt/lib/get_columns.tsx | 41 +- .../lib/get_expiration_status.ts | 29 +- .../search/session}/sessions_mgmt/types.ts | 7 +- src/plugins/data/public/types.ts | 6 + .../data/server/config_deprecations.test.ts | 40 +- .../data/server/config_deprecations.ts | 11 +- src/plugins/data/server/index.ts | 2 + src/plugins/data/server/plugin.ts | 43 +- .../search/collectors/{ => search}/fetch.ts | 0 .../search/collectors/{ => search}/index.ts | 0 .../collectors/{ => search}/register.ts | 0 .../search/collectors/{ => search}/usage.ts | 4 +- .../collectors/search_session}/fetch.test.ts | 5 +- .../collectors/search_session}/fetch.ts | 8 +- .../collectors/search_session}/index.ts | 5 +- .../collectors/search_session}/register.ts | 5 +- src/plugins/data/server/search/index.ts | 4 +- src/plugins/data/server/search/mocks.ts | 1 - .../data/server/search/routes/index.ts | 1 + .../server/search}/routes/session.test.ts | 10 +- .../data/server/search}/routes/session.ts | 9 +- .../server/search}/saved_objects/index.ts | 5 +- .../search}/saved_objects/search_session.ts | 7 +- .../search_session_migration.test.ts | 7 +- .../saved_objects/search_session_migration.ts | 7 +- .../data/server/search/search_service.test.ts | 20 +- .../data/server/search/search_service.ts | 82 ++- .../check_non_persisted_sessions.test.ts | 18 +- .../session/check_non_persisted_sessions.ts | 16 +- .../session/check_persisted_sessions.test.ts | 9 +- .../session/check_persisted_sessions.ts | 19 +- .../session/expire_persisted_sessions.ts | 19 +- .../session/get_search_session_page.test.ts | 13 +- .../search/session/get_search_session_page.ts | 12 +- .../search/session/get_search_status.test.ts | 5 +- .../search/session/get_search_status.ts | 13 +- .../search/session/get_session_status.test.ts | 12 +- .../search/session/get_session_status.ts | 12 +- .../search/session/session_service.test.ts | 17 +- .../server/search/session/session_service.ts | 578 ++++++++++++++++-- .../data}/server/search/session/setup_task.ts | 14 +- .../data/server/search/session/types.ts | 52 +- .../session/update_session_status.test.ts | 7 +- .../search/session/update_session_status.ts | 19 +- .../data}/server/search/session/utils.test.ts | 5 +- .../data}/server/search/session/utils.ts | 7 +- .../es_search/es_search_strategy.ts | 6 +- .../ese_search/ese_search_strategy.ts | 2 +- src/plugins/data/server/search/types.ts | 13 +- src/plugins/data/tsconfig.json | 6 +- src/plugins/es_ui_shared/kibana.json | 2 +- .../public/indices/constants/index.ts | 6 +- .../field_validators/index_pattern_field.ts | 4 +- src/plugins/es_ui_shared/tsconfig.json | 2 +- src/plugins/telemetry/schema/oss_plugins.json | 13 + .../test_suites/core_plugins/rendering.ts | 28 +- test/scripts/jenkins_storybook.sh | 2 +- tsconfig.base.json | 2 - tsconfig.types.json | 8 +- x-pack/.i18nrc.json | 1 - x-pack/plugins/actions/tsconfig.json | 1 + x-pack/plugins/data_enhanced/README.md | 16 - x-pack/plugins/data_enhanced/common/index.ts | 6 - .../data_enhanced/common/search/index.ts | 6 - .../search_phase_execution_exception.json | 229 ------- x-pack/plugins/data_enhanced/config.ts | 17 - x-pack/plugins/data_enhanced/jest.config.js | 17 - x-pack/plugins/data_enhanced/kibana.json | 29 - x-pack/plugins/data_enhanced/public/index.ts | 17 - x-pack/plugins/data_enhanced/public/plugin.ts | 92 --- .../data_enhanced/public/search/index.ts | 8 - x-pack/plugins/data_enhanced/server/index.ts | 25 - x-pack/plugins/data_enhanced/server/plugin.ts | 71 --- .../data_enhanced/server/routes/index.ts | 8 - .../data_enhanced/server/search/index.ts | 8 - .../server/search/session/index.ts | 8 - .../server/search/session/session_service.ts | 548 ----------------- .../server/search/session/types.ts | 63 -- x-pack/plugins/data_enhanced/server/type.ts | 41 -- x-pack/plugins/data_enhanced/tsconfig.json | 31 - x-pack/plugins/infra/kibana.json | 1 - x-pack/plugins/infra/public/types.ts | 3 - x-pack/plugins/infra/tsconfig.json | 1 - x-pack/plugins/osquery/kibana.json | 1 - x-pack/plugins/osquery/tsconfig.json | 1 - x-pack/plugins/runtime_fields/public/types.ts | 7 +- .../roles/edit_role/edit_role_page.test.tsx | 6 +- .../roles/edit_role/edit_role_page.tsx | 2 +- x-pack/plugins/security_solution/kibana.json | 1 - .../common/hooks/eql/use_eql_preview.ts | 2 +- .../plugins/security_solution/tsconfig.json | 1 - .../schema/xpack_plugins.json | 13 - x-pack/plugins/timelines/kibana.json | 2 +- x-pack/plugins/timelines/tsconfig.json | 1 - .../translations/translations/fr-FR.json | 317 +++++++--- .../translations/translations/ja-JP.json | 205 ++++--- .../translations/translations/zh-CN.json | 205 ++++--- .../plugins/timelines_test/kibana.json | 2 +- x-pack/test/tsconfig.json | 1 - 156 files changed, 1874 insertions(+), 2311 deletions(-) rename {x-pack/plugins/data_enhanced => src/plugins/data}/.storybook/main.js (54%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/connected_search_session_indicator/connected_search_session_indicator.test.tsx (97%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/connected_search_session_indicator/connected_search_session_indicator.tsx (92%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/connected_search_session_indicator/index.ts (64%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/connected_search_session_indicator/search_session_tour.tsx (92%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/connected_search_session_indicator/search_session_view_state.ts (80%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/index.ts (53%) rename {x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name => src/plugins/data/public/search/session/session_indicator/search_session_indicator/components}/index.ts (52%) rename {x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components => src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name}/index.ts (52%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/components/search_session_name/search_session_name.tsx (83%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/custom_icons.tsx (91%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/index.tsx (82%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/search_session_indicator.scss (100%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/search_session_indicator.stories.tsx (90%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/search_session_indicator.test.tsx (93%) rename {x-pack/plugins/data_enhanced/public/search/ui => src/plugins/data/public/search/session/session_indicator}/search_session_indicator/search_session_indicator.tsx (75%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/__mocks__/index.tsx (68%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/application/index.tsx (67%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/application/render.tsx (85%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/delete_button.tsx (77%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/extend_button.tsx (79%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/get_action.tsx (87%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/index.tsx (56%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/inspect_button.scss (100%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/inspect_button.tsx (88%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/popover_actions.tsx (89%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/rename_button.tsx (80%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/actions/types.ts (65%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/index.tsx (83%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/main.test.tsx (83%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/main.tsx (72%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/status.test.tsx (94%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/status.tsx (78%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/table/app_filter.tsx (76%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/table/index.ts (53%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/table/status_filter.tsx (79%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/table/table.test.tsx (87%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/components/table/table.tsx (81%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/icons/extend_session.svg (100%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/index.ts (60%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/api.test.ts (95%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/api.ts (85%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/date_string.ts (77%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/documentation.ts (71%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/get_columns.test.tsx (89%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/get_columns.tsx (85%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/lib/get_expiration_status.ts (56%) rename {x-pack/plugins/data_enhanced/public/search => src/plugins/data/public/search/session}/sessions_mgmt/types.ts (84%) rename src/plugins/data/server/search/collectors/{ => search}/fetch.ts (100%) rename src/plugins/data/server/search/collectors/{ => search}/index.ts (100%) rename src/plugins/data/server/search/collectors/{ => search}/register.ts (100%) rename src/plugins/data/server/search/collectors/{ => search}/usage.ts (97%) rename {x-pack/plugins/data_enhanced/server/collectors => src/plugins/data/server/search/collectors/search_session}/fetch.test.ts (92%) rename {x-pack/plugins/data_enhanced/server/collectors => src/plugins/data/server/search/collectors/search_session}/fetch.ts (89%) rename {x-pack/plugins/data_enhanced/server/collectors => src/plugins/data/server/search/collectors/search_session}/index.ts (53%) rename {x-pack/plugins/data_enhanced/server/collectors => src/plugins/data/server/search/collectors/search_session}/register.ts (84%) rename {x-pack/plugins/data_enhanced/server => src/plugins/data/server/search}/routes/session.test.ts (94%) rename {x-pack/plugins/data_enhanced/server => src/plugins/data/server/search}/routes/session.ts (95%) rename {x-pack/plugins/data_enhanced/server => src/plugins/data/server/search}/saved_objects/index.ts (51%) rename {x-pack/plugins/data_enhanced/server => src/plugins/data/server/search}/saved_objects/search_session.ts (85%) rename {x-pack/plugins/data_enhanced/server => src/plugins/data/server/search}/saved_objects/search_session_migration.test.ts (97%) rename {x-pack/plugins/data_enhanced/server => src/plugins/data/server/search}/saved_objects/search_session_migration.ts (93%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/check_non_persisted_sessions.test.ts (96%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/check_non_persisted_sessions.ts (91%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/check_persisted_sessions.test.ts (87%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/check_persisted_sessions.ts (81%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/expire_persisted_sessions.ts (80%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/get_search_session_page.test.ts (94%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/get_search_session_page.ts (81%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/get_search_status.test.ts (92%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/get_search_status.ts (80%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/get_session_status.test.ts (85%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/get_session_status.ts (75%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/session_service.test.ts (98%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/setup_task.ts (88%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/update_session_status.test.ts (97%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/update_session_status.ts (90%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/utils.test.ts (75%) rename {x-pack/plugins/data_enhanced => src/plugins/data}/server/search/session/utils.ts (78%) delete mode 100644 x-pack/plugins/data_enhanced/README.md delete mode 100644 x-pack/plugins/data_enhanced/common/index.ts delete mode 100644 x-pack/plugins/data_enhanced/common/search/index.ts delete mode 100644 x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json delete mode 100644 x-pack/plugins/data_enhanced/config.ts delete mode 100644 x-pack/plugins/data_enhanced/jest.config.js delete mode 100644 x-pack/plugins/data_enhanced/kibana.json delete mode 100644 x-pack/plugins/data_enhanced/public/index.ts delete mode 100644 x-pack/plugins/data_enhanced/public/plugin.ts delete mode 100644 x-pack/plugins/data_enhanced/public/search/index.ts delete mode 100644 x-pack/plugins/data_enhanced/server/index.ts delete mode 100644 x-pack/plugins/data_enhanced/server/plugin.ts delete mode 100644 x-pack/plugins/data_enhanced/server/routes/index.ts delete mode 100644 x-pack/plugins/data_enhanced/server/search/index.ts delete mode 100644 x-pack/plugins/data_enhanced/server/search/session/index.ts delete mode 100644 x-pack/plugins/data_enhanced/server/search/session/session_service.ts delete mode 100644 x-pack/plugins/data_enhanced/server/search/session/types.ts delete mode 100644 x-pack/plugins/data_enhanced/server/type.ts delete mode 100644 x-pack/plugins/data_enhanced/tsconfig.json diff --git a/.buildkite/scripts/steps/storybooks/build_and_upload.js b/.buildkite/scripts/steps/storybooks/build_and_upload.js index 482640b8d9cc0..becb8f1bd871f 100644 --- a/.buildkite/scripts/steps/storybooks/build_and_upload.js +++ b/.buildkite/scripts/steps/storybooks/build_and_upload.js @@ -20,7 +20,7 @@ const STORYBOOKS = [ 'custom_integrations', 'dashboard_enhanced', 'dashboard', - 'data_enhanced', + 'data', 'embeddable', 'expression_error', 'expression_image', diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 215514d58f601..7f7c048717f02 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -79,7 +79,6 @@ /src/plugins/inspector/ @elastic/kibana-app-services /src/plugins/unified_search/ @elastic/kibana-app-services /x-pack/examples/ui_actions_enhanced_examples/ @elastic/kibana-app-services -/x-pack/plugins/data_enhanced/ @elastic/kibana-app-services /x-pack/plugins/embeddable_enhanced/ @elastic/kibana-app-services /x-pack/plugins/ui_actions_enhanced/ @elastic/kibana-app-services /x-pack/plugins/runtime_fields @elastic/kibana-app-services diff --git a/dev_docs/tutorials/data/search.mdx b/dev_docs/tutorials/data/search.mdx index 0787c44b632ec..ab5c3f29ea1be 100644 --- a/dev_docs/tutorials/data/search.mdx +++ b/dev_docs/tutorials/data/search.mdx @@ -259,7 +259,7 @@ export const myEnhancedSearchStrategyProvider = ( await ese.cancel(id, options, deps); }, extend: async (id, keepAlive, options, deps) => { - // async search results are not stored indefinitely. By default, they expire after 7 days (or as defined by xpack.data_enhanced.search.sessions.defaultExpiration setting in kibana.yml). + // async search results are not stored indefinitely. By default, they expire after 7 days (or as defined by data.search.sessions.defaultExpiration setting in kibana.yml). // call the extend method of the async strategy you are using or implement your own extend function. await ese.extend(id, options, deps); }, diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 90bf3d3c29b41..63e104c44b173 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -412,10 +412,6 @@ The plugin exposes the static DefaultEditorController class to consume. |Adds drilldown capabilities to dashboard. Owned by the Kibana App team. -|{kib-repo}blob/{branch}/x-pack/plugins/data_enhanced/README.md[dataEnhanced] -|The data_enhanced plugin is the x-pack counterpart to the src/plguins/data plugin. - - |{kib-repo}blob/{branch}/x-pack/plugins/data_visualizer/README.md[dataVisualizer] |The data_visualizer plugin enables you to explore the fields in your data. diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index dc16c080306ad..4c83bc19f1cda 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -104,8 +104,7 @@ pageLoadAssetSize: fieldFormats: 65209 kibanaReact: 74422 share: 71239 - uiActions: 35121 - dataEnhanced: 24980 + uiActions: 35121 embeddable: 87309 embeddableEnhanced: 22107 uiActionsEnhanced: 38494 diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index 7b569f8d02068..77e8e5d63bbdf 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -40,6 +40,13 @@ kibana_vars=( csp.report_to data.autocomplete.valueSuggestions.terminateAfter data.autocomplete.valueSuggestions.timeout + data.search.sessions.defaultExpiration + data.search.sessions.enabled + data.search.sessions.maxUpdateRetries + data.search.sessions.notTouchedInProgressTimeout + data.search.sessions.notTouchedTimeout + data.search.sessions.pageSize + data.search.sessions.trackingInterval unifiedSearch.autocomplete.valueSuggestions.terminateAfter unifiedSearch.autocomplete.valueSuggestions.timeout unifiedSearch.autocomplete.querySuggestions.enabled diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index 8075abcdcf79b..4167719d3bb31 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -17,7 +17,7 @@ export const storybookAliases = { custom_integrations: 'src/plugins/custom_integrations/storybook', dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/.storybook', dashboard: 'src/plugins/dashboard/.storybook', - data_enhanced: 'x-pack/plugins/data_enhanced/.storybook', + data: 'src/plugins/data/.storybook', discover: 'src/plugins/discover/.storybook', embeddable: 'src/plugins/embeddable/.storybook', expression_error: 'src/plugins/expression_error/.storybook', diff --git a/x-pack/plugins/data_enhanced/.storybook/main.js b/src/plugins/data/.storybook/main.js similarity index 54% rename from x-pack/plugins/data_enhanced/.storybook/main.js rename to src/plugins/data/.storybook/main.js index 86b48c32f103e..8dc3c5d1518f4 100644 --- a/x-pack/plugins/data_enhanced/.storybook/main.js +++ b/src/plugins/data/.storybook/main.js @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ module.exports = require('@kbn/storybook').defaultConfig; diff --git a/src/plugins/data/config.ts b/src/plugins/data/config.ts index c419683de9868..0ec794d9bd63c 100644 --- a/src/plugins/data/config.ts +++ b/src/plugins/data/config.ts @@ -8,21 +8,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; -export const configSchema = schema.object({ - search: schema.object({ - aggs: schema.object({ - shardDelay: schema.object({ - // Whether or not to register the shard_delay (which is only available in snapshot versions - // of Elasticsearch) agg type/expression function to make it available in the UI for either - // functional or manual testing - enabled: schema.boolean({ defaultValue: false }), - }), - }), - }), -}); - -export type ConfigSchema = TypeOf; - export const searchSessionsConfigSchema = schema.object({ /** * Turns the feature on \ off (incl. removing indicator and management screens) @@ -90,4 +75,20 @@ export const searchSessionsConfigSchema = schema.object({ }), }); +export const configSchema = schema.object({ + search: schema.object({ + aggs: schema.object({ + shardDelay: schema.object({ + // Whether or not to register the shard_delay (which is only available in snapshot versions + // of Elasticsearch) agg type/expression function to make it available in the UI for either + // functional or manual testing + enabled: schema.boolean({ defaultValue: false }), + }), + }), + sessions: searchSessionsConfigSchema, + }), +}); + +export type ConfigSchema = TypeOf; + export type SearchSessionsConfigSchema = TypeOf; diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index fa7453d4c5bda..9c428930bc9ab 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -3,7 +3,17 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["bfetch", "expressions", "uiActions", "share", "inspector", "fieldFormats", "dataViews"], + "requiredPlugins": [ + "bfetch", + "expressions", + "uiActions", + "share", + "inspector", + "fieldFormats", + "dataViews", + "screenshotMode", + "management" + ], "serviceFolders": ["search", "query", "ui"], "optionalPlugins": ["usageCollection", "taskManager", "security"], "extraPublicDirs": ["common"], diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts index 175d05870b0c6..0790df6a95df2 100644 --- a/src/plugins/data/public/plugin.ts +++ b/src/plugins/data/public/plugin.ts @@ -73,6 +73,7 @@ export class DataPublicPlugin usageCollection, inspector, fieldFormats, + management, }: DataSetupDependencies ): DataPublicPluginSetup { const startServices = createStartServicesGetter(core.getStartServices); @@ -84,6 +85,7 @@ export class DataPublicPlugin usageCollection, expressions, nowProvider: this.nowProvider, + management, }); const queryService = this.queryService.setup({ @@ -117,7 +119,7 @@ export class DataPublicPlugin public start( core: CoreStart, - { uiActions, fieldFormats, dataViews }: DataStartDependencies + { uiActions, fieldFormats, dataViews, screenshotMode }: DataStartDependencies ): DataPublicPluginStart { const { uiSettings, notifications, overlays } = core; setNotifications(notifications); @@ -131,7 +133,11 @@ export class DataPublicPlugin uiSettings, }); - const search = this.searchService.start(core, { fieldFormats, indexPatterns: dataViews }); + const search = this.searchService.start(core, { + fieldFormats, + indexPatterns: dataViews, + screenshotMode, + }); setSearchService(search); uiActions.addTriggerAction( diff --git a/src/plugins/data/public/search/search_service.test.ts b/src/plugins/data/public/search/search_service.test.ts index 8c1fba48c7b4b..d717d275f55cd 100644 --- a/src/plugins/data/public/search/search_service.test.ts +++ b/src/plugins/data/public/search/search_service.test.ts @@ -12,6 +12,8 @@ import { CoreSetup, CoreStart } from '@kbn/core/public'; import { SearchService, SearchServiceSetupDependencies } from './search_service'; import { bfetchPluginMock } from '@kbn/bfetch-plugin/public/mocks'; +import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; +import { screenshotModePluginMock } from '@kbn/screenshot-mode-plugin/public/mocks'; describe('Search service', () => { let searchService: SearchService; @@ -19,7 +21,7 @@ describe('Search service', () => { let mockCoreStart: MockedKeys; const initializerContext = coreMock.createPluginInitializerContext(); initializerContext.config.get = jest.fn().mockReturnValue({ - search: { aggs: { shardDelay: { enabled: false } } }, + search: { aggs: { shardDelay: { enabled: false } }, sessions: { enabled: true } }, }); beforeEach(() => { @@ -35,6 +37,7 @@ describe('Search service', () => { packageInfo: { version: '8' }, bfetch, expressions: { registerFunction: jest.fn(), registerType: jest.fn() }, + management: managementPluginMock.createSetupContract(), } as unknown as SearchServiceSetupDependencies); expect(setup).toHaveProperty('aggs'); expect(setup).toHaveProperty('usageCollector'); @@ -45,9 +48,18 @@ describe('Search service', () => { describe('start()', () => { it('exposes proper contract', async () => { + const bfetch = bfetchPluginMock.createSetupContract(); + searchService.setup(mockCoreSetup, { + packageInfo: { version: '8' }, + bfetch, + expressions: { registerFunction: jest.fn(), registerType: jest.fn() }, + management: managementPluginMock.createSetupContract(), + } as unknown as SearchServiceSetupDependencies); + const start = searchService.start(mockCoreStart, { fieldFormats: {}, indexPatterns: {}, + screenshotMode: screenshotModePluginMock.createStartContract(), } as any); expect(start).toHaveProperty('aggs'); expect(start).toHaveProperty('search'); diff --git a/src/plugins/data/public/search/search_service.ts b/src/plugins/data/public/search/search_service.ts index 52271426d28e1..767fcaf815927 100644 --- a/src/plugins/data/public/search/search_service.ts +++ b/src/plugins/data/public/search/search_service.ts @@ -7,62 +7,71 @@ */ import { - Plugin, CoreSetup, CoreStart, + Plugin, PluginInitializerContext, StartServicesAccessor, } from '@kbn/core/public'; import { BehaviorSubject } from 'rxjs'; +import React from 'react'; +import moment from 'moment'; import { BfetchPublicSetup } from '@kbn/bfetch-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { ExpressionsSetup } from '@kbn/expressions-plugin/public'; +import { toMountPoint } from '@kbn/kibana-react-plugin/public'; +import { Storage } from '@kbn/kibana-utils-plugin/public'; +import { ScreenshotModePluginStart } from '@kbn/screenshot-mode-plugin/public'; +import { ManagementSetup } from '@kbn/management-plugin/public'; import type { ISearchSetup, ISearchStart } from './types'; import { handleResponse } from './fetch'; import { - kibana, - kibanaContext, - ISearchGeneric, - SearchSourceDependencies, - SearchSourceService, - extendedBoundsFunction, - ipRangeFunction, - kibanaTimerangeFunction, - luceneFunction, - kqlFunction, - fieldFunction, - numericalRangeFunction, - rangeFunction, cidrFunction, dateRangeFunction, + esRawResponse, existsFilterFunction, + extendedBoundsFunction, + fieldFunction, geoBoundingBoxFunction, geoPointFunction, + ipRangeFunction, + ISearchGeneric, + kibana, + kibanaContext, + kibanaFilterFunction, + kibanaTimerangeFunction, + kqlFunction, + luceneFunction, + numericalRangeFunction, + phraseFilterFunction, queryFilterFunction, rangeFilterFunction, + rangeFunction, removeFilterFunction, + SearchSourceDependencies, + SearchSourceService, selectFilterFunction, - kibanaFilterFunction, - phraseFilterFunction, - esRawResponse, eqlRawResponse, } from '../../common/search'; import { AggsService, AggsStartDependencies } from './aggs'; import { IKibanaSearchResponse, IndexPatternsContract, SearchRequest } from '..'; import { ISearchInterceptor, SearchInterceptor } from './search_interceptor'; -import { SearchUsageCollector, createUsageCollector } from './collectors'; +import { createUsageCollector, SearchUsageCollector } from './collectors'; import { getEsaggs, getEsdsl, getEql } from './expressions'; import { ISessionsClient, ISessionService, SessionsClient, SessionService } from './session'; import { ConfigSchema } from '../../config'; import { - SHARD_DELAY_AGG_NAME, getShardDelayBucketAgg, + SHARD_DELAY_AGG_NAME, } from '../../common/search/aggs/buckets/shard_delay'; import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn'; import { DataPublicPluginStart, DataStartDependencies } from '../types'; import { NowProviderInternalContract } from '../now_provider'; import { getKibanaContext } from './expressions/kibana_context'; +import { createConnectedSearchSessionIndicator } from './session/session_indicator'; + +import { registerSearchSessionsMgmt } from './session/sessions_mgmt'; /** @internal */ export interface SearchServiceSetupDependencies { @@ -70,12 +79,14 @@ export interface SearchServiceSetupDependencies { expressions: ExpressionsSetup; usageCollection?: UsageCollectionSetup; nowProvider: NowProviderInternalContract; + management: ManagementSetup; } /** @internal */ export interface SearchServiceStartDependencies { fieldFormats: AggsStartDependencies['fieldFormats']; indexPatterns: IndexPatternsContract; + screenshotMode: ScreenshotModePluginStart; } export class SearchService implements Plugin { @@ -89,9 +100,16 @@ export class SearchService implements Plugin { constructor(private initializerContext: PluginInitializerContext) {} public setup( - { http, getStartServices, notifications, uiSettings, executionContext, theme }: CoreSetup, - { bfetch, expressions, usageCollection, nowProvider }: SearchServiceSetupDependencies + core: CoreSetup, + { + bfetch, + expressions, + usageCollection, + nowProvider, + management, + }: SearchServiceSetupDependencies ): ISearchSetup { + const { http, getStartServices, notifications, uiSettings, executionContext, theme } = core; this.usageCollector = createUsageCollector(getStartServices, usageCollection); this.sessionsClient = new SessionsClient({ http }); @@ -173,6 +191,21 @@ export class SearchService implements Plugin { expressions.registerFunction(aggShardDelay); } + const config = this.initializerContext.config.get(); + if (config.search.sessions.enabled) { + const sessionsConfig = config.search.sessions; + registerSearchSessionsMgmt( + core as CoreSetup, + { + searchUsageCollector: this.usageCollector!, + sessionsClient: this.sessionsClient, + management, + }, + sessionsConfig, + this.initializerContext.env.packageInfo.version + ); + } + return { aggs, usageCollector: this.usageCollector!, @@ -182,8 +215,8 @@ export class SearchService implements Plugin { } public start( - { http, theme, uiSettings }: CoreStart, - { fieldFormats, indexPatterns }: SearchServiceStartDependencies + { http, theme, uiSettings, chrome, application }: CoreStart, + { fieldFormats, indexPatterns, screenshotMode }: SearchServiceStartDependencies ): ISearchStart { const search = ((request, options = {}) => { return this.searchInterceptor.search(request, options); @@ -199,6 +232,28 @@ export class SearchService implements Plugin { handleResponse(request, response, theme), }; + const config = this.initializerContext.config.get(); + if (config.search.sessions.enabled) { + chrome.setBreadcrumbsAppendExtension({ + content: toMountPoint( + React.createElement( + createConnectedSearchSessionIndicator({ + sessionService: this.sessionService, + application, + basePath: http.basePath, + storage: new Storage(window.localStorage), + disableSaveAfterSessionCompletesTimeout: moment + .duration(config.search.sessions.notTouchedTimeout) + .asMilliseconds(), + usageCollector: this.usageCollector, + tourDisabled: screenshotMode.isScreenshotMode(), + }) + ), + { theme$: theme.theme$ } + ), + }); + } + return { aggs: this.aggsService.start({ fieldFormats, uiSettings, indexPatterns }), search, diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.test.tsx similarity index 97% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.test.tsx index 7c93d5cd78e68..d791cf51ddbe6 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.test.tsx @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React, { ReactNode } from 'react'; import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { render, waitFor, screen, act } from '@testing-library/react'; import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { dataPluginMock } from '../../../../mocks'; import { createConnectedSearchSessionIndicator } from './connected_search_session_indicator'; import { BehaviorSubject } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -19,12 +20,12 @@ import { SearchSessionState, SearchUsageCollector, TimefilterContract, -} from '@kbn/data-plugin/public'; +} from '../../../..'; import { coreMock } from '@kbn/core/public/mocks'; import { TOUR_RESTORE_STEP_KEY, TOUR_TAKING_TOO_LONG_STEP_KEY } from './search_session_tour'; import userEvent from '@testing-library/user-event'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; -import { createSearchUsageCollectorMock } from '@kbn/data-plugin/public/search/collectors/mocks'; +import { createSearchUsageCollectorMock } from '../../../collectors/mocks'; const coreStart = coreMock.createStart(); const application = coreStart.application; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.tsx b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.tsx similarity index 92% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.tsx rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.tsx index 23abbf3084073..727a188fc2c00 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.tsx +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React, { useCallback, useEffect, useState } from 'react'; @@ -10,12 +11,14 @@ import { debounce, distinctUntilChanged, mapTo, switchMap, tap } from 'rxjs/oper import { merge, of, timer } from 'rxjs'; import useObservable from 'react-use/lib/useObservable'; import { i18n } from '@kbn/i18n'; -import { ISessionService, SearchSessionState, SearchUsageCollector } from '@kbn/data-plugin/public'; import { RedirectAppLinks } from '@kbn/kibana-react-plugin/public'; -import { ApplicationStart, IBasePath } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; +import { ApplicationStart, IBasePath } from '@kbn/core/public'; import { SearchSessionIndicator, SearchSessionIndicatorRef } from '../search_session_indicator'; import { useSearchSessionTour } from './search_session_tour'; +import { SearchUsageCollector } from '../../../collectors'; +import { ISessionService } from '../../session_service'; +import { SearchSessionState } from '../../search_session_state'; export interface SearchSessionIndicatorDeps { sessionService: ISessionService; @@ -82,7 +85,7 @@ export const createConnectedSearchSessionIndicator = ({ if (disableSaveAfterSessionCompleteTimedOut) { saveDisabled = true; saveDisabledReasonText = i18n.translate( - 'xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage', + 'data.searchSessionIndicator.disabledDueToTimeoutMessage', { defaultMessage: 'Search session results expired.', } @@ -99,7 +102,7 @@ export const createConnectedSearchSessionIndicator = ({ if (!sessionService.hasAccess()) { managementDisabled = saveDisabled = true; managementDisabledReasonText = saveDisabledReasonText = i18n.translate( - 'xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage', + 'data.searchSessionIndicator.disabledDueToDisabledGloballyMessage', { defaultMessage: "You don't have permissions to manage search sessions", } diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/index.ts similarity index 64% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/index.ts index fec61f8115486..def7915b836c8 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export type { SearchSessionIndicatorDeps } from './connected_search_session_indicator'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_tour.tsx b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_tour.tsx similarity index 92% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_tour.tsx rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_tour.tsx index 2d9c29681a41c..2975ffb774b5c 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_tour.tsx +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_tour.tsx @@ -1,15 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { useCallback, useEffect } from 'react'; import { once } from 'lodash'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import { SearchSessionState, SearchUsageCollector } from '@kbn/data-plugin/public'; import { SearchSessionIndicatorRef } from '../search_session_indicator'; +import { SearchSessionState } from '../../search_session_state'; +import { SearchUsageCollector } from '../../../collectors'; const TOUR_TAKING_TOO_LONG_TIMEOUT = 10000; export const TOUR_TAKING_TOO_LONG_STEP_KEY = `data.searchSession.tour.takingTooLong`; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_view_state.ts b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_view_state.ts similarity index 80% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_view_state.ts rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_view_state.ts index 84884115093d6..2fec31333650b 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_view_state.ts +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_view_state.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export enum SearchSessionViewState { diff --git a/x-pack/plugins/data_enhanced/public/search/ui/index.ts b/src/plugins/data/public/search/session/session_indicator/index.ts similarity index 53% rename from x-pack/plugins/data_enhanced/public/search/ui/index.ts rename to src/plugins/data/public/search/session/session_indicator/index.ts index e8f83db6ed98c..c126347a07691 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export * from './connected_search_session_indicator'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/index.ts b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/index.ts similarity index 52% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/index.ts rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/index.ts index 9093e1a2535e2..d0e7457b882b0 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export * from './search_session_name'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/index.ts b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/index.ts similarity index 52% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/index.ts rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/index.ts index 9093e1a2535e2..d0e7457b882b0 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export * from './search_session_name'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/search_session_name.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/search_session_name.tsx similarity index 83% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/search_session_name.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/search_session_name.tsx index 4cb72dcbf4554..2473b844097bf 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/search_session_name.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/search_session_name.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React, { useEffect } from 'react'; @@ -45,7 +46,7 @@ export const SearchSessionName: React.FC = ({ name, edit autoFocus={true} iconType={'pencil'} color={'text'} - aria-label={i18n.translate('xpack.data.searchSessionName.editAriaLabelText', { + aria-label={i18n.translate('data.searchSessionName.editAriaLabelText', { defaultMessage: 'Edit search session name', })} data-test-subj={'searchSessionNameEdit'} @@ -56,14 +57,14 @@ export const SearchSessionName: React.FC = ({ name, edit { setNewName(e.target.value); }} - aria-label={i18n.translate('xpack.data.searchSessionName.ariaLabelText', { + aria-label={i18n.translate('data.searchSessionName.ariaLabelText', { defaultMessage: 'Search session name', })} data-test-subj={'searchSessionNameInput'} @@ -89,10 +90,7 @@ export const SearchSessionName: React.FC = ({ name, edit isLoading={isSaving} data-test-subj={'searchSessionNameSave'} > - + } /> diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/custom_icons.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/custom_icons.tsx similarity index 91% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/custom_icons.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/custom_icons.tsx index 94aa1d41abd38..18acd56d9a51b 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/custom_icons.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/custom_icons.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React from 'react'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/index.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/index.tsx similarity index 82% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/index.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/index.tsx index fe86ad2fb5cea..eb35ea58339e2 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/index.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/index.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiDelayRender, EuiLoadingSpinner } from '@elastic/eui'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.scss b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.scss similarity index 100% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.scss rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.scss diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.stories.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.stories.tsx similarity index 90% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.stories.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.stories.tsx index 654dfee17c5a2..ffb77a872ec75 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.stories.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.stories.tsx @@ -1,14 +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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { SearchSessionState } from '@kbn/data-plugin/public'; import { SearchSessionIndicator } from './search_session_indicator'; +import { SearchSessionState } from '../../search_session_state'; storiesOf('components/SearchSessionIndicator', module).add('default', () => { const [searchSessionName, setSearchSessionName] = React.useState('Discover session'); diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.test.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.test.tsx similarity index 93% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.test.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.test.tsx index 26563bfa02fa7..3fe0e1172487c 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.test.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.test.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React, { ReactNode } from 'react'; @@ -10,7 +11,7 @@ import { screen, render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { SearchSessionIndicator } from './search_session_indicator'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; -import { SearchSessionState } from '@kbn/data-plugin/public'; +import { SearchSessionState } from '../../../..'; function Container({ children }: { children?: ReactNode }) { return {children}; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.tsx similarity index 75% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.tsx index 540cb6b5bebd4..239a4ea4c2aa7 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React, { useCallback, useImperativeHandle } from 'react'; @@ -22,10 +23,10 @@ import { import moment from 'moment'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { SearchSessionState } from '@kbn/data-plugin/public'; import { CheckInEmptyCircle, PartialClock } from './custom_icons'; import './search_session_indicator.scss'; import { SearchSessionName } from './components'; +import { SearchSessionState } from '../../search_session_state'; export interface SearchSessionIndicatorProps { state: SearchSessionState; @@ -59,7 +60,7 @@ const CancelButton = ({ onCancel = () => {}, buttonProps = {} }: ActionButtonPro {...buttonProps} > @@ -79,7 +80,7 @@ const ContinueInBackgroundButton = ({ {...buttonProps} > @@ -103,7 +104,7 @@ const ViewAllSearchSessionsButton = ({ {...buttonProps} > @@ -124,7 +125,7 @@ const SaveButton = ({ {...buttonProps} > @@ -150,24 +151,22 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'text', iconType: PartialClock, - 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel', - { defaultMessage: 'Search session loading' } - ), - tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.loadingResultsIconTooltipText', - { defaultMessage: 'Search session loading' } - ), + 'aria-label': i18n.translate('data.searchSessionIndicator.loadingResultsIconAriaLabel', { + defaultMessage: 'Search session loading', + }), + tooltipText: i18n.translate('data.searchSessionIndicator.loadingResultsIconTooltipText', { + defaultMessage: 'Search session loading', + }), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.loadingResultsTitle', { + title: i18n.translate('data.searchSessionIndicator.loadingResultsTitle', { defaultMessage: 'Your search is taking a while...', }), - description: i18n.translate('xpack.data.searchSessionIndicator.loadingResultsDescription', { + description: i18n.translate('data.searchSessionIndicator.loadingResultsDescription', { defaultMessage: 'Save your session, continue your work, and return to completed results', }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.loadingResultsWhenText', { + i18n.translate('data.searchSessionIndicator.loadingResultsWhenText', { defaultMessage: 'Started {when}', values: { when: props.startedTime ? moment(props.startedTime).format(`L @ LTS`) : '', @@ -181,28 +180,22 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'text', iconType: 'check', - 'aria-label': i18n.translate('xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel', { + 'aria-label': i18n.translate('data.searchSessionIndicator.resultsLoadedIconAriaLabel', { + defaultMessage: 'Search session complete', + }), + tooltipText: i18n.translate('data.searchSessionIndicator.resultsLoadedIconTooltipText', { defaultMessage: 'Search session complete', }), - tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText', - { - defaultMessage: 'Search session complete', - } - ), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.resultsLoadedText', { + title: i18n.translate('data.searchSessionIndicator.resultsLoadedText', { defaultMessage: 'Search session complete', }), - description: i18n.translate( - 'xpack.data.searchSessionIndicator.resultsLoadedDescriptionText', - { - defaultMessage: 'Save your session and return to it later', - } - ), + description: i18n.translate('data.searchSessionIndicator.resultsLoadedDescriptionText', { + defaultMessage: 'Save your session and return to it later', + }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.resultsLoadedWhenText', { + i18n.translate('data.searchSessionIndicator.resultsLoadedWhenText', { defaultMessage: 'Completed {when}', values: { when: props.completedTime ? moment(props.completedTime).format(`L @ LTS`) : '', @@ -216,30 +209,30 @@ const searchSessionIndicatorViewStateToProps: { button: { iconType: EuiLoadingSpinner, 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel', + 'data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel', { defaultMessage: 'Saved session in progress', } ), tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText', + 'data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText', { defaultMessage: 'Saved session in progress', } ), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText', { + title: i18n.translate('data.searchSessionIndicator.loadingInTheBackgroundTitleText', { defaultMessage: 'Saved session in progress', }), description: i18n.translate( - 'xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText', + 'data.searchSessionIndicator.loadingInTheBackgroundDescriptionText', { defaultMessage: 'You can return to completed results from Management', } ), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText', { + i18n.translate('data.searchSessionIndicator.loadingInTheBackgroundWhenText', { defaultMessage: 'Started {when}', values: { when: props.startedTime ? moment(props.startedTime).format(`L @ LTS`) : '', @@ -254,33 +247,30 @@ const searchSessionIndicatorViewStateToProps: { color: 'success', iconType: 'checkInCircleFilled', 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel', + 'data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel', { defaultMessage: 'Saved session complete', } ), tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText', + 'data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText', { defaultMessage: 'Saved session complete', } ), }, popover: { - title: i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText', - { - defaultMessage: 'Search session saved', - } - ), + title: i18n.translate('data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText', { + defaultMessage: 'Search session saved', + }), description: i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText', + 'data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText', { defaultMessage: 'You can return to these results from Management', } ), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText', { + i18n.translate('data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText', { defaultMessage: 'Completed {when}', values: { when: props.completedTime ? moment(props.completedTime).format(`L @ LTS`) : '', @@ -293,26 +283,23 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'success', iconType: CheckInEmptyCircle, - 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel', - { - defaultMessage: 'Saved session restored', - } - ), - tooltipText: i18n.translate('xpack.data.searchSessionIndicator.restoredResultsTooltipText', { + 'aria-label': i18n.translate('data.searchSessionIndicator.restoredResultsIconAriaLabel', { + defaultMessage: 'Saved session restored', + }), + tooltipText: i18n.translate('data.searchSessionIndicator.restoredResultsTooltipText', { defaultMessage: 'Search session restored', }), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.restoredTitleText', { + title: i18n.translate('data.searchSessionIndicator.restoredTitleText', { defaultMessage: 'Search session restored', }), - description: i18n.translate('xpack.data.searchSessionIndicator.restoredDescriptionText', { + description: i18n.translate('data.searchSessionIndicator.restoredDescriptionText', { defaultMessage: 'You are viewing cached data from a specific time range. Changing the time range or filters will re-run the session', }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.restoredWhenText', { + i18n.translate('data.searchSessionIndicator.restoredWhenText', { defaultMessage: 'Completed {when}', values: { when: props.completedTime ? moment(props.completedTime).format(`L @ LTS`) : '', @@ -325,22 +312,22 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'danger', iconType: 'alert', - 'aria-label': i18n.translate('xpack.data.searchSessionIndicator.canceledIconAriaLabel', { + 'aria-label': i18n.translate('data.searchSessionIndicator.canceledIconAriaLabel', { defaultMessage: 'Search session stopped', }), - tooltipText: i18n.translate('xpack.data.searchSessionIndicator.canceledTooltipText', { + tooltipText: i18n.translate('data.searchSessionIndicator.canceledTooltipText', { defaultMessage: 'Search session stopped', }), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.canceledTitleText', { + title: i18n.translate('data.searchSessionIndicator.canceledTitleText', { defaultMessage: 'Search session stopped', }), - description: i18n.translate('xpack.data.searchSessionIndicator.canceledDescriptionText', { + description: i18n.translate('data.searchSessionIndicator.canceledDescriptionText', { defaultMessage: 'You are viewing incomplete data', }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.canceledWhenText', { + i18n.translate('data.searchSessionIndicator.canceledWhenText', { defaultMessage: 'Stopped {when}', values: { when: props.canceledTime ? moment(props.canceledTime).format(`L @ LTS`) : '', diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/__mocks__/index.tsx similarity index 68% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/__mocks__/index.tsx index 7c089c8db9634..3d3592df0bb67 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/__mocks__/index.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React, { ReactNode } from 'react'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/application/index.tsx similarity index 67% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/application/index.tsx index d2be863170a4b..b0a15ca405743 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/application/index.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { CoreSetup } from '@kbn/core/public'; @@ -11,24 +12,24 @@ import type { AppDependencies, IManagementSectionsPluginsSetup, IManagementSectionsPluginsStart, - SessionsConfigSchema, } from '..'; import { APP } from '..'; import { SearchSessionsMgmtAPI } from '../lib/api'; import { AsyncSearchIntroDocumentation } from '../lib/documentation'; import { renderApp } from './render'; +import { SearchSessionsConfigSchema } from '../../../../../config'; export class SearchSessionsMgmtApp { constructor( private coreSetup: CoreSetup, - private config: SessionsConfigSchema, + private setupDeps: IManagementSectionsPluginsSetup, + private config: SearchSessionsConfigSchema, private kibanaVersion: string, - private params: ManagementAppMountParams, - private pluginsSetup: IManagementSectionsPluginsSetup + private params: ManagementAppMountParams ) {} public async mountManagementSection() { - const { coreSetup, params, pluginsSetup } = this; + const { coreSetup, params, setupDeps } = this; const [coreStart, pluginsStart] = await coreSetup.getStartServices(); const { @@ -40,24 +41,21 @@ export class SearchSessionsMgmtApp { uiSettings, application, } = coreStart; - const { data, share } = pluginsStart; const pluginName = APP.getI18nName(); docTitle.change(pluginName); - params.setBreadcrumbs([{ text: pluginName }]); + this.params.setBreadcrumbs([{ text: pluginName }]); - const { sessionsClient } = data.search; - const api = new SearchSessionsMgmtAPI(sessionsClient, this.config, { + const api = new SearchSessionsMgmtAPI(setupDeps.sessionsClient, this.config, { notifications, - locators: share.url.locators, + locators: pluginsStart.share.url.locators, application, - usageCollector: pluginsSetup.data.search.usageCollector, + usageCollector: setupDeps.searchUsageCollector, }); const documentation = new AsyncSearchIntroDocumentation(docLinks); const dependencies: AppDependencies = { - plugins: pluginsSetup, config: this.config, documentation, core: coreStart, @@ -65,8 +63,9 @@ export class SearchSessionsMgmtApp { http, i18n, uiSettings, - share, + share: pluginsStart.share, kibanaVersion: this.kibanaVersion, + searchUsageCollector: setupDeps.searchUsageCollector, }; const { element } = params; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx b/src/plugins/data/public/search/session/sessions_mgmt/application/render.tsx similarity index 85% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/application/render.tsx index 563179064062b..87ceb6ee8a942 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/application/render.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import React from 'react'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/delete_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/delete_button.tsx similarity index 77% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/delete_button.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/delete_button.tsx index d612aada1084a..0581af4a872ff 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/delete_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/delete_button.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiConfirmModal } from '@elastic/eui'; @@ -26,16 +27,16 @@ const DeleteConfirm = (props: DeleteButtonProps & { onActionDismiss: OnActionDis const { name, id } = searchSession; const [isLoading, setIsLoading] = useState(false); - const title = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.title', { + const title = i18n.translate('data.mgmt.searchSessions.cancelModal.title', { defaultMessage: 'Delete search session', }); - const confirm = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.deleteButton', { + const confirm = i18n.translate('data.mgmt.searchSessions.cancelModal.deleteButton', { defaultMessage: 'Delete', }); - const cancel = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.cancelButton', { + const cancel = i18n.translate('data.mgmt.searchSessions.cancelModal.cancelButton', { defaultMessage: 'Cancel', }); - const message = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.message', { + const message = i18n.translate('data.mgmt.searchSessions.cancelModal.message', { defaultMessage: `Deleting the search session \'{name}\' deletes all cached results.`, values: { name, @@ -68,9 +69,7 @@ export const createDeleteActionDescriptor = ( core: CoreStart ): IClickActionDescriptor => ({ iconType: 'crossInACircleFilled', - label: ( - - ), + label: , onClick: async () => { const ref = core.overlays.openModal( toMountPoint( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/extend_button.tsx similarity index 79% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/extend_button.tsx index bb64fef09aba8..4b955e7bf93a3 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/extend_button.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiConfirmModal } from '@elastic/eui'; @@ -31,16 +32,16 @@ const ExtendConfirm = ({ ...props }: ExtendButtonProps & { onActionDismiss: OnAc const newExpiration = moment(expires).add(extendByDuration); - const title = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.title', { + const title = i18n.translate('data.mgmt.searchSessions.extendModal.title', { defaultMessage: 'Extend search session expiration', }); - const confirm = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.extendButton', { + const confirm = i18n.translate('data.mgmt.searchSessions.extendModal.extendButton', { defaultMessage: 'Extend expiration', }); - const extend = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.dontExtendButton', { + const extend = i18n.translate('data.mgmt.searchSessions.extendModal.dontExtendButton', { defaultMessage: 'Cancel', }); - const message = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.extendMessage', { + const message = i18n.translate('data.mgmt.searchSessions.extendModal.extendMessage', { defaultMessage: "The search session '{name}' expiration would be extended until {newExpires}.", values: { name, @@ -75,9 +76,7 @@ export const createExtendActionDescriptor = ( core: CoreStart ): IClickActionDescriptor => ({ iconType: extendSessionIcon, - label: ( - - ), + label: , onClick: async () => { const ref = core.overlays.openModal( toMountPoint( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/get_action.tsx similarity index 87% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/get_action.tsx index 4ab246b5ee403..33ea4013d605e 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/get_action.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { CoreStart } from '@kbn/core/public'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/index.tsx similarity index 56% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/index.tsx index cecd50125e90e..7b01e2fb7673f 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/index.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export { PopoverActionsMenu } from './popover_actions'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.scss similarity index 100% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.scss diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx similarity index 88% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx index 823ab99c0213f..4ba404e708662 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiFlyoutBody, EuiFlyoutHeader, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; @@ -58,7 +59,7 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => {

@@ -69,7 +70,7 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => {

@@ -90,7 +91,7 @@ export const createInspectActionDescriptor = ( iconType: 'document', label: ( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/popover_actions.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/popover_actions.tsx similarity index 89% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/popover_actions.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/popover_actions.tsx index 35661dce80da6..a335c481b1d3e 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/popover_actions.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/popover_actions.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { @@ -49,12 +50,12 @@ export const PopoverActionsMenu = ({ const renderPopoverButton = () => ( ({ iconType: 'pencil', - label: ( - - ), + label: , onClick: async () => { const ref = core.overlays.openModal( toMountPoint( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/types.ts similarity index 65% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/types.ts index c808f8469cccf..645cee6725c8f 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/types.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export type OnActionComplete = () => void; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/index.tsx similarity index 83% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/index.tsx index 2970c75e651d6..c9ba988e1330b 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/index.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiLinkProps, EuiText, EuiTextProps } from '@elastic/eui'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/main.test.tsx similarity index 83% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/main.test.tsx index fac9cda42eef2..183dc80883c57 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/main.test.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { MockedKeys } from '@kbn/utility-types/jest'; @@ -12,34 +13,30 @@ import moment from 'moment'; import React from 'react'; import { act } from 'react-dom/test-utils'; import { coreMock } from '@kbn/core/public/mocks'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '..'; +import { SearchUsageCollector, SessionsClient } from '../../..'; import { SearchSessionsMgmtAPI } from '../lib/api'; import { AsyncSearchIntroDocumentation } from '../lib/documentation'; import { LocaleWrapper } from '../__mocks__'; import { SearchSessionsMgmtMain } from './main'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { SearchSessionsConfigSchema } from '../../../../../config'; +import { createSearchUsageCollectorMock } from '../../../collectors/mocks'; let mockCoreSetup: MockedKeys; let mockCoreStart: MockedKeys; let mockShareStart: jest.Mocked; -let mockPluginsSetup: IManagementSectionsPluginsSetup; -let mockConfig: SessionsConfigSchema; +let mockConfig: SearchSessionsConfigSchema; let sessionsClient: SessionsClient; let api: SearchSessionsMgmtAPI; +let mockSearchUsageCollector: SearchUsageCollector; describe('Background Search Session Management Main', () => { beforeEach(() => { mockCoreSetup = coreMock.createSetup(); mockCoreStart = coreMock.createStart(); mockShareStart = sharePluginMock.createStartContract(); - mockPluginsSetup = { - data: dataPluginMock.createSetupContract(), - management: managementPluginMock.createSetupContract(), - }; + mockSearchUsageCollector = createSearchUsageCollectorMock(); mockConfig = { defaultExpiration: moment.duration('7d'), management: { @@ -80,13 +77,13 @@ describe('Background Search Session Management Main', () => { ); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/main.tsx similarity index 72% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/main.tsx index e065a20003dd9..424ec701f79ad 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/main.tsx @@ -1,19 +1,20 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { EuiButtonEmpty, EuiPageHeader, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import type { CoreStart, HttpStart } from '@kbn/core/public'; import React from 'react'; -import type { SessionsConfigSchema } from '..'; -import { IManagementSectionsPluginsSetup } from '..'; import type { SearchSessionsMgmtAPI } from '../lib/api'; import type { AsyncSearchIntroDocumentation } from '../lib/documentation'; import { SearchSessionsMgmtTable } from './table'; +import { SearchSessionsConfigSchema } from '../../../../../config'; +import { SearchUsageCollector } from '../../../collectors'; interface Props { documentation: AsyncSearchIntroDocumentation; @@ -21,9 +22,9 @@ interface Props { api: SearchSessionsMgmtAPI; http: HttpStart; timezone: string; - config: SessionsConfigSchema; - plugins: IManagementSectionsPluginsSetup; + config: SearchSessionsConfigSchema; kibanaVersion: string; + searchUsageCollector: SearchUsageCollector; } export function SearchSessionsMgmtMain({ documentation, ...tableProps }: Props) { @@ -32,13 +33,13 @@ export function SearchSessionsMgmtMain({ documentation, ...tableProps }: Props) } description={ } @@ -50,7 +51,7 @@ export function SearchSessionsMgmtMain({ documentation, ...tableProps }: Props) iconType="help" > , diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/status.test.tsx similarity index 94% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/status.test.tsx index 83f4494dff504..5cee810997393 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/status.test.tsx @@ -1,14 +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. + * 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 { EuiTextProps, EuiToolTipProps } from '@elastic/eui'; import { mount } from 'enzyme'; import React from 'react'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionStatus } from '../../../../../common'; import { UISession } from '../types'; import { LocaleWrapper } from '../__mocks__'; import { getStatusText, StatusIndicator } from './status'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/status.tsx similarity index 78% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/status.tsx index 577e89f2c761b..bb41ff05c1099 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/status.tsx @@ -1,14 +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. + * 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 { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { ReactElement } from 'react'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionStatus } from '../../../../../common'; import { dateString } from '../lib/date_string'; import { UISession } from '../types'; import { StatusDef as StatusAttributes, TableText } from '.'; @@ -17,23 +18,23 @@ import { StatusDef as StatusAttributes, TableText } from '.'; export const getStatusText = (statusType: string): string => { switch (statusType) { case SearchSessionStatus.IN_PROGRESS: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.inProgress', { + return i18n.translate('data.mgmt.searchSessions.status.label.inProgress', { defaultMessage: 'In progress', }); case SearchSessionStatus.EXPIRED: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.expired', { + return i18n.translate('data.mgmt.searchSessions.status.label.expired', { defaultMessage: 'Expired', }); case SearchSessionStatus.CANCELLED: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.cancelled', { + return i18n.translate('data.mgmt.searchSessions.status.label.cancelled', { defaultMessage: 'Cancelled', }); case SearchSessionStatus.COMPLETE: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.complete', { + return i18n.translate('data.mgmt.searchSessions.status.label.complete', { defaultMessage: 'Complete', }); case SearchSessionStatus.ERROR: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.error', { + return i18n.translate('data.mgmt.searchSessions.status.label.error', { defaultMessage: 'Error', }); default: @@ -60,7 +61,7 @@ const getStatusAttributes = ({ if (session.expires) { expireDate = dateString(session.expires!, timezone); } else { - expireDate = i18n.translate('xpack.data.mgmt.searchSessions.status.expireDateUnknown', { + expireDate = i18n.translate('data.mgmt.searchSessions.status.expireDateUnknown', { defaultMessage: 'unknown', }); } @@ -72,13 +73,10 @@ const getStatusAttributes = ({ textColor: 'default', icon: , label: {getStatusText(session.status)}, - toolTipContent: i18n.translate( - 'xpack.data.mgmt.searchSessions.status.message.createdOn', - { - defaultMessage: 'Expires on {expireDate}', - values: { expireDate }, - } - ), + toolTipContent: i18n.translate('data.mgmt.searchSessions.status.message.createdOn', { + defaultMessage: 'Expires on {expireDate}', + values: { expireDate }, + }), }; } catch (err) { // eslint-disable-next-line no-console @@ -88,13 +86,10 @@ const getStatusAttributes = ({ case SearchSessionStatus.EXPIRED: try { - const toolTipContent = i18n.translate( - 'xpack.data.mgmt.searchSessions.status.message.expiredOn', - { - defaultMessage: 'Expired on {expireDate}', - values: { expireDate }, - } - ); + const toolTipContent = i18n.translate('data.mgmt.searchSessions.status.message.expiredOn', { + defaultMessage: 'Expired on {expireDate}', + values: { expireDate }, + }); return { icon: , @@ -111,7 +106,7 @@ const getStatusAttributes = ({ return { icon: , label: {getStatusText(session.status)}, - toolTipContent: i18n.translate('xpack.data.mgmt.searchSessions.status.message.cancelled', { + toolTipContent: i18n.translate('data.mgmt.searchSessions.status.message.cancelled', { defaultMessage: 'Cancelled by user', }), }; @@ -121,7 +116,7 @@ const getStatusAttributes = ({ textColor: 'danger', icon: , label: {getStatusText(session.status)}, - toolTipContent: i18n.translate('xpack.data.mgmt.searchSessions.status.message.error', { + toolTipContent: i18n.translate('data.mgmt.searchSessions.status.message.error', { defaultMessage: 'Error: {error}', values: { error: (session as any).error || 'unknown' }, }), @@ -129,7 +124,7 @@ const getStatusAttributes = ({ case SearchSessionStatus.COMPLETE: try { - const toolTipContent = i18n.translate('xpack.data.mgmt.searchSessions.status.expiresOn', { + const toolTipContent = i18n.translate('data.mgmt.searchSessions.status.expiresOn', { defaultMessage: 'Expires on {expireDate}', values: { expireDate }, }); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/app_filter.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/app_filter.tsx similarity index 76% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/app_filter.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/app_filter.tsx index e0988fbf80acf..48cfda93e1f91 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/app_filter.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/app_filter.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { FieldValueOptionType, SearchFilterConfig } from '@elastic/eui'; @@ -12,7 +13,7 @@ import { UISession } from '../../types'; export const getAppFilter: (tableData: UISession[]) => SearchFilterConfig = (tableData) => ({ type: 'field_value_selection', - name: i18n.translate('xpack.data.mgmt.searchSessions.search.filterApp', { + name: i18n.translate('data.mgmt.searchSessions.search.filterApp', { defaultMessage: 'App', }), field: 'appId', diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/index.ts b/src/plugins/data/public/search/session/sessions_mgmt/components/table/index.ts similarity index 53% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/index.ts rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/index.ts index 361261ff65c87..84f0cfd24159d 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/index.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export { SearchSessionsMgmtTable } from './table'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/status_filter.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/status_filter.tsx similarity index 79% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/status_filter.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/status_filter.tsx index 33e085fbb646d..25fc7dc092ab8 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/status_filter.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/status_filter.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { FieldValueOptionType, SearchFilterConfig } from '@elastic/eui'; @@ -14,7 +15,7 @@ import { getStatusText } from '../status'; export const getStatusFilter: (tableData: UISession[]) => SearchFilterConfig = (tableData) => ({ type: 'field_value_selection', - name: i18n.translate('xpack.data.mgmt.searchSessions.search.filterStatus', { + name: i18n.translate('data.mgmt.searchSessions.search.filterStatus', { defaultMessage: 'Status', }), field: 'status', diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.test.tsx similarity index 87% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/table.test.tsx index 2023aed902c9f..1e8dd423a8bf9 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.test.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { MockedKeys } from '@kbn/utility-types/jest'; @@ -12,34 +13,29 @@ import { CoreSetup, CoreStart } from '@kbn/core/public'; import moment from 'moment'; import React from 'react'; import { coreMock } from '@kbn/core/public/mocks'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '../..'; +import { SearchUsageCollector, SessionsClient } from '../../../..'; +import { SearchSessionStatus } from '../../../../../../common'; import { SearchSessionsMgmtAPI } from '../../lib/api'; import { LocaleWrapper } from '../../__mocks__'; import { SearchSessionsMgmtTable } from './table'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { SearchSessionsConfigSchema } from '../../../../../../config'; +import { createSearchUsageCollectorMock } from '../../../../collectors/mocks'; let mockCoreSetup: MockedKeys; let mockCoreStart: CoreStart; let mockShareStart: jest.Mocked; -let mockPluginsSetup: IManagementSectionsPluginsSetup; -let mockConfig: SessionsConfigSchema; +let mockConfig: SearchSessionsConfigSchema; let sessionsClient: SessionsClient; let api: SearchSessionsMgmtAPI; +let mockSearchUsageCollector: SearchUsageCollector; describe('Background Search Session Management Table', () => { beforeEach(async () => { mockCoreSetup = coreMock.createSetup(); mockCoreStart = coreMock.createStart(); mockShareStart = sharePluginMock.createStartContract(); - mockPluginsSetup = { - data: dataPluginMock.createSetupContract(), - management: managementPluginMock.createSetupContract(), - }; mockConfig = { defaultExpiration: moment.duration('7d'), management: { @@ -49,6 +45,7 @@ describe('Background Search Session Management Table', () => { refreshTimeout: moment.duration(10, 'minutes'), }, } as any; + mockSearchUsageCollector = createSearchUsageCollectorMock(); sessionsClient = new SessionsClient({ http: mockCoreSetup.http }); api = new SearchSessionsMgmtAPI(sessionsClient, mockConfig, { @@ -91,11 +88,11 @@ describe('Background Search Session Management Table', () => { ); @@ -124,11 +121,11 @@ describe('Background Search Session Management Table', () => { ); @@ -168,11 +165,11 @@ describe('Background Search Session Management Table', () => { ); @@ -202,11 +199,11 @@ describe('Background Search Session Management Table', () => { ); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.tsx similarity index 81% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/table.tsx index 88ffb5ed2d749..b887d9af43f53 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiButton, EuiInMemoryTable, EuiSearchBarProps } from '@elastic/eui'; @@ -12,23 +13,24 @@ import moment from 'moment'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import useDebounce from 'react-use/lib/useDebounce'; import useInterval from 'react-use/lib/useInterval'; -import { SEARCH_SESSIONS_TABLE_ID } from '@kbn/data-plugin/common'; import { TableText } from '..'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '../..'; +import { SEARCH_SESSIONS_TABLE_ID } from '../../../../../../common'; import { SearchSessionsMgmtAPI } from '../../lib/api'; import { getColumns } from '../../lib/get_columns'; import { UISession } from '../../types'; import { OnActionComplete } from '../actions'; import { getAppFilter } from './app_filter'; import { getStatusFilter } from './status_filter'; +import { SearchUsageCollector } from '../../../../collectors'; +import { SearchSessionsConfigSchema } from '../../../../../../config'; interface Props { core: CoreStart; api: SearchSessionsMgmtAPI; timezone: string; - config: SessionsConfigSchema; - plugins: IManagementSectionsPluginsSetup; + config: SearchSessionsConfigSchema; kibanaVersion: string; + searchUsageCollector: SearchUsageCollector; } export function SearchSessionsMgmtTable({ @@ -36,8 +38,8 @@ export function SearchSessionsMgmtTable({ api, timezone, config, - plugins, kibanaVersion, + searchUsageCollector, ...props }: Props) { const [tableData, setTableData] = useState([]); @@ -80,8 +82,8 @@ export function SearchSessionsMgmtTable({ // initial data load useEffect(() => { doRefresh(); - plugins.data.search.usageCollector?.trackSessionsListLoaded(); - }, [doRefresh, plugins]); + searchUsageCollector.trackSessionsListLoaded(); + }, [doRefresh, searchUsageCollector]); useInterval(doRefresh, refreshInterval); @@ -104,7 +106,7 @@ export function SearchSessionsMgmtTable({ data-test-subj="sessionManagementRefreshBtn" > @@ -121,7 +123,15 @@ export function SearchSessionsMgmtTable({ 'data-test-subj': `searchSessionsRow`, 'data-test-search-session-id': `id-${searchSession.id}`, })} - columns={getColumns(core, plugins, api, config, timezone, onActionComplete, kibanaVersion)} + columns={getColumns( + core, + api, + config, + timezone, + onActionComplete, + kibanaVersion, + searchUsageCollector + )} items={tableData} pagination={pagination} search={search} diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/icons/extend_session.svg b/src/plugins/data/public/search/session/sessions_mgmt/icons/extend_session.svg similarity index 100% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/icons/extend_session.svg rename to src/plugins/data/public/search/session/sessions_mgmt/icons/extend_session.svg diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/index.ts b/src/plugins/data/public/search/session/sessions_mgmt/index.ts similarity index 60% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/index.ts rename to src/plugins/data/public/search/session/sessions_mgmt/index.ts index 35eb3cb4e36a4..7b95305f6e568 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/index.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/index.ts @@ -1,34 +1,33 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { i18n } from '@kbn/i18n'; import type { CoreStart, HttpStart, I18nStart, IUiSettingsClient } from '@kbn/core/public'; import { CoreSetup } from '@kbn/core/public'; -import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { ManagementSetup } from '@kbn/management-plugin/public'; import type { SharePluginStart } from '@kbn/share-plugin/public'; -import { SEARCH_SESSIONS_MANAGEMENT_ID } from '@kbn/data-plugin/public'; -import type { ConfigSchema } from '../../../config'; -import type { DataEnhancedStartDependencies } from '../../plugin'; +import type { ISessionsClient, SearchUsageCollector } from '../../..'; +import { SEARCH_SESSIONS_MANAGEMENT_ID } from '../constants'; import type { SearchSessionsMgmtAPI } from './lib/api'; import type { AsyncSearchIntroDocumentation } from './lib/documentation'; +import { SearchSessionsConfigSchema } from '../../../../config'; export interface IManagementSectionsPluginsSetup { - data: DataPublicPluginSetup; management: ManagementSetup; + searchUsageCollector: SearchUsageCollector; + sessionsClient: ISessionsClient; } export interface IManagementSectionsPluginsStart { - data: DataPublicPluginStart; share: SharePluginStart; } export interface AppDependencies { - plugins: IManagementSectionsPluginsSetup; share: SharePluginStart; uiSettings: IUiSettingsClient; documentation: AsyncSearchIntroDocumentation; @@ -36,33 +35,32 @@ export interface AppDependencies { api: SearchSessionsMgmtAPI; http: HttpStart; i18n: I18nStart; - config: SessionsConfigSchema; + config: SearchSessionsConfigSchema; kibanaVersion: string; + searchUsageCollector: SearchUsageCollector; } export const APP = { id: SEARCH_SESSIONS_MANAGEMENT_ID, getI18nName: (): string => - i18n.translate('xpack.data.mgmt.searchSessions.appTitle', { + i18n.translate('data.mgmt.searchSessions.appTitle', { defaultMessage: 'Search Sessions', }), }; -export type SessionsConfigSchema = ConfigSchema['search']['sessions']; - export function registerSearchSessionsMgmt( - coreSetup: CoreSetup, - config: SessionsConfigSchema, - kibanaVersion: string, - services: IManagementSectionsPluginsSetup + coreSetup: CoreSetup, + deps: IManagementSectionsPluginsSetup, + config: SearchSessionsConfigSchema, + kibanaVersion: string ) { - services.management.sections.section.kibana.registerApp({ + deps.management.sections.section.kibana.registerApp({ id: APP.id, title: APP.getI18nName(), order: 1.75, mount: async (params) => { const { SearchSessionsMgmtApp: MgmtApp } = await import('./application'); - const mgmtApp = new MgmtApp(coreSetup, config, kibanaVersion, params, services); + const mgmtApp = new MgmtApp(coreSetup, deps, config, kibanaVersion, params); return mgmtApp.mountManagementSection(); }, }); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.test.ts similarity index 95% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/api.test.ts index 69c0d165ac6c0..a1d95a83d1ccd 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import type { MockedKeys } from '@kbn/utility-types/jest'; @@ -11,17 +12,17 @@ import moment from 'moment'; import { coreMock } from '@kbn/core/public/mocks'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import type { SavedObjectsFindResponse } from '@kbn/core/server'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import type { SessionsConfigSchema } from '..'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SessionsClient } from '../../..'; +import { SearchSessionStatus } from '../../../../../common'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { SearchSessionsMgmtAPI } from './api'; +import { SearchSessionsConfigSchema } from '../../../../../config'; let mockCoreSetup: MockedKeys; let mockCoreStart: MockedKeys; let mockShareStart: jest.Mocked; -let mockConfig: SessionsConfigSchema; +let mockConfig: SearchSessionsConfigSchema; let sessionsClient: SessionsClient; describe('Search Sessions Management API', () => { diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.ts similarity index 85% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/api.ts index bb58efd01d957..9830cb436f7df 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { i18n } from '@kbn/i18n'; @@ -12,15 +13,16 @@ import { from, race, timer } from 'rxjs'; import { mapTo, tap } from 'rxjs/operators'; import type { SharePluginStart } from '@kbn/share-plugin/public'; import { SerializableRecord } from '@kbn/utility-types'; -import { ISessionsClient, SearchUsageCollector } from '@kbn/data-plugin/public'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; import { ACTION } from '../components/actions'; import { PersistedSearchSessionSavedObjectAttributes, UISearchSessionState, UISession, } from '../types'; -import { SessionsConfigSchema } from '..'; +import { ISessionsClient } from '../../sessions_client'; +import { SearchUsageCollector } from '../../../collectors'; +import { SearchSessionStatus } from '../../../../../common'; +import { SearchSessionsConfigSchema } from '../../../../../config'; type LocatorsStart = SharePluginStart['url']['locators']; @@ -73,7 +75,7 @@ function getUrlFromState(locators: LocatorsStart, locatorId: string, state: Seri // Helper: factory for a function to map server objects to UI objects const mapToUISession = - (locators: LocatorsStart, config: SessionsConfigSchema) => + (locators: LocatorsStart, config: SearchSessionsConfigSchema) => async ( savedObject: SavedObject ): Promise => { @@ -125,7 +127,7 @@ interface SearchSessionManagementDeps { export class SearchSessionsMgmtAPI { constructor( private sessionsClient: ISessionsClient, - private config: SessionsConfigSchema, + private config: SearchSessionsConfigSchema, private deps: SearchSessionManagementDeps ) {} @@ -147,7 +149,7 @@ export class SearchSessionsMgmtAPI { const timeout$ = timer(refreshTimeout.asMilliseconds()).pipe( tap(() => { this.deps.notifications.toasts.addDanger( - i18n.translate('xpack.data.mgmt.searchSessions.api.fetchTimeout', { + i18n.translate('data.mgmt.searchSessions.api.fetchTimeout', { defaultMessage: 'Fetching the Search Session info timed out after {timeout} seconds', values: { timeout: refreshTimeout.asSeconds() }, }) @@ -169,7 +171,7 @@ export class SearchSessionsMgmtAPI { // eslint-disable-next-line no-console console.error(err); this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.fetchError', { + title: i18n.translate('data.mgmt.searchSessions.api.fetchError', { defaultMessage: 'Failed to refresh the page!', }), }); @@ -194,13 +196,13 @@ export class SearchSessionsMgmtAPI { await this.sessionsClient.delete(id); this.deps.notifications.toasts.addSuccess({ - title: i18n.translate('xpack.data.mgmt.searchSessions.api.deleted', { + title: i18n.translate('data.mgmt.searchSessions.api.deleted', { defaultMessage: 'The search session was deleted.', }), }); } catch (err) { this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.deletedError', { + title: i18n.translate('data.mgmt.searchSessions.api.deletedError', { defaultMessage: 'Failed to delete the search session!', }), }); @@ -214,13 +216,13 @@ export class SearchSessionsMgmtAPI { await this.sessionsClient.extend(id, expires); this.deps.notifications.toasts.addSuccess({ - title: i18n.translate('xpack.data.mgmt.searchSessions.api.extended', { + title: i18n.translate('data.mgmt.searchSessions.api.extended', { defaultMessage: 'The search session was extended.', }), }); } catch (err) { this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.extendError', { + title: i18n.translate('data.mgmt.searchSessions.api.extendError', { defaultMessage: 'Failed to extend the search session!', }), }); @@ -233,13 +235,13 @@ export class SearchSessionsMgmtAPI { await this.sessionsClient.rename(id, newName); this.deps.notifications.toasts.addSuccess({ - title: i18n.translate('xpack.data.mgmt.searchSessions.api.rename', { + title: i18n.translate('data.mgmt.searchSessions.api.rename', { defaultMessage: 'The search session was renamed', }), }); } catch (err) { this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.renameError', { + title: i18n.translate('data.mgmt.searchSessions.api.renameError', { defaultMessage: 'Failed to rename the search session', }), }); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/date_string.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/date_string.ts similarity index 77% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/date_string.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/date_string.ts index 2bad2f7c3367e..89ffcb596b094 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/date_string.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/date_string.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import moment from 'moment'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/documentation.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/documentation.ts similarity index 71% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/documentation.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/documentation.ts index 03279199912c0..2af7fb5025cd9 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/documentation.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/documentation.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { DocLinksStart } from '@kbn/core/public'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.test.tsx similarity index 89% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.test.tsx index 35da6b995169a..5833ac516fa4b 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.test.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EuiTableFieldDataColumnType } from '@elastic/eui'; @@ -12,23 +13,22 @@ import { CoreSetup, CoreStart } from '@kbn/core/public'; import moment from 'moment'; import { ReactElement } from 'react'; import { coreMock } from '@kbn/core/public/mocks'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '..'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchUsageCollector, SessionsClient } from '../../..'; +import { SearchSessionStatus } from '../../../../../common'; import { OnActionComplete } from '../components'; import { UISession } from '../types'; import { SearchSessionsMgmtAPI } from './api'; import { getColumns } from './get_columns'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { SearchSessionsConfigSchema } from '../../../../../config'; +import { createSearchUsageCollectorMock } from '../../../collectors/mocks'; let mockCoreSetup: MockedKeys; let mockCoreStart: CoreStart; let mockShareStart: jest.Mocked; -let mockPluginsSetup: IManagementSectionsPluginsSetup; -let mockConfig: SessionsConfigSchema; +let mockSearchUsageCollector: SearchUsageCollector; +let mockConfig: SearchSessionsConfigSchema; let api: SearchSessionsMgmtAPI; let sessionsClient: SessionsClient; let handleAction: OnActionComplete; @@ -41,10 +41,6 @@ describe('Search Sessions Management table column factory', () => { mockCoreSetup = coreMock.createSetup(); mockCoreStart = coreMock.createStart(); mockShareStart = sharePluginMock.createStartContract(); - mockPluginsSetup = { - data: dataPluginMock.createSetupContract(), - management: managementPluginMock.createSetupContract(), - }; mockConfig = { defaultExpiration: moment.duration('7d'), management: { @@ -55,6 +51,7 @@ describe('Search Sessions Management table column factory', () => { }, } as any; sessionsClient = new SessionsClient({ http: mockCoreSetup.http }); + mockSearchUsageCollector = createSearchUsageCollectorMock(); api = new SearchSessionsMgmtAPI(sessionsClient, mockConfig, { locators: mockShareStart.url.locators, @@ -86,12 +83,12 @@ describe('Search Sessions Management table column factory', () => { test('returns columns', () => { const columns = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ); expect(columns).toMatchInlineSnapshot(` Array [ @@ -152,12 +149,12 @@ describe('Search Sessions Management table column factory', () => { test('rendering', () => { const [, nameColumn] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const name = mount(nameColumn.render!(mockSession.name, mockSession) as ReactElement); @@ -172,12 +169,12 @@ describe('Search Sessions Management table column factory', () => { beforeEach(() => { const [, nameColumn] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - currentKibanaVersion + currentKibanaVersion, + mockSearchUsageCollector ) as Array>; hasRenderedVersionWarning = (partialSession: Partial): boolean => { @@ -235,12 +232,12 @@ describe('Search Sessions Management table column factory', () => { test('renders', () => { const [, , numOfSearches] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const numOfSearchesLine = mount( @@ -255,12 +252,12 @@ describe('Search Sessions Management table column factory', () => { test('render in_progress', () => { const [, , , status] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const statusLine = mount(status.render!(mockSession.status, mockSession) as ReactElement); @@ -272,12 +269,12 @@ describe('Search Sessions Management table column factory', () => { test('error handling', () => { const [, , , status] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; mockSession.status = 'INVALID' as SearchSessionStatus; @@ -296,12 +293,12 @@ describe('Search Sessions Management table column factory', () => { const [, , , , createdDateCol] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const date = mount(createdDateCol.render!(mockSession.created, mockSession) as ReactElement); @@ -314,12 +311,12 @@ describe('Search Sessions Management table column factory', () => { const [, , , , createdDateCol] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const date = mount(createdDateCol.render!(mockSession.created, mockSession) as ReactElement); @@ -330,12 +327,12 @@ describe('Search Sessions Management table column factory', () => { test('error handling', () => { const [, , , , createdDateCol] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; mockSession.created = 'INVALID'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.tsx b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.tsx similarity index 85% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.tsx index d9a71639f8fe2..f6db378bb2942 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.tsx @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { @@ -21,15 +22,15 @@ import { CoreStart } from '@kbn/core/public'; import { capitalize } from 'lodash'; import React from 'react'; import { RedirectAppLinks } from '@kbn/kibana-react-plugin/public'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '..'; -import { TableText } from '../components'; -import { OnActionComplete, PopoverActionsMenu } from '../components'; +import { SearchSessionStatus } from '../../../../../common'; +import { OnActionComplete, PopoverActionsMenu, TableText } from '../components'; import { StatusIndicator } from '../components/status'; import { dateString } from './date_string'; import { SearchSessionsMgmtAPI } from './api'; import { getExpirationStatus } from './get_expiration_status'; import { UISession } from '../types'; +import { SearchUsageCollector } from '../../../collectors'; +import { SearchSessionsConfigSchema } from '../../../../../config'; // Helper function: translate an app string to EuiIcon-friendly string const appToIcon = (app: string) => { @@ -46,7 +47,7 @@ const appToIcon = (app: string) => { // Helper function: translate an app id to user friendly string const appToTooltip = (appId: string | undefined) => { if (appId === 'ml') { - return i18n.translate('xpack.data.mgmt.searchSessions.table.mlAppName', { + return i18n.translate('data.mgmt.searchSessions.table.mlAppName', { defaultMessage: 'Machine Learning', }); } @@ -58,19 +59,19 @@ function isSessionRestorable(status: SearchSessionStatus) { export const getColumns = ( core: CoreStart, - plugins: IManagementSectionsPluginsSetup, api: SearchSessionsMgmtAPI, - config: SessionsConfigSchema, + config: SearchSessionsConfigSchema, timezone: string, onActionComplete: OnActionComplete, - kibanaVersion: string + kibanaVersion: string, + searchUsageCollector: SearchUsageCollector ): Array> => { // Use a literal array of table column definitions to detail a UISession object return [ // App { field: 'appId', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerType', { + name: i18n.translate('data.mgmt.searchSessions.table.headerType', { defaultMessage: 'App', }), sortable: true, @@ -91,7 +92,7 @@ export const getColumns = ( // Name, links to app and displays the search session data { field: 'name', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerName', { + name: i18n.translate('data.mgmt.searchSessions.table.headerName', { defaultMessage: 'Name', }), sortable: true, @@ -100,8 +101,8 @@ export const getColumns = ( const isRestorable = isSessionRestorable(status); const href = isRestorable ? restoreUrl : reloadUrl; const trackAction = isRestorable - ? plugins.data.search.usageCollector?.trackSessionViewRestored - : plugins.data.search.usageCollector?.trackSessionReloaded; + ? searchUsageCollector.trackSessionViewRestored + : searchUsageCollector.trackSessionReloaded; const notRestorableWarning = isRestorable ? null : ( <> {' '} @@ -109,7 +110,7 @@ export const getColumns = ( type="alert" content={ } @@ -130,7 +131,7 @@ export const getColumns = ( iconProps={{ 'data-test-subj': 'versionIncompatibleWarningTestSubj' }} content={ } @@ -160,7 +161,7 @@ export const getColumns = ( // # Searches { field: 'numSearches', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.numSearches', { + name: i18n.translate('data.mgmt.searchSessions.table.numSearches', { defaultMessage: '# Searches', }), sortable: true, @@ -174,7 +175,7 @@ export const getColumns = ( // Session status { field: 'status', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerStatus', { + name: i18n.translate('data.mgmt.searchSessions.table.headerStatus', { defaultMessage: 'Status', }), sortable: true, @@ -186,7 +187,7 @@ export const getColumns = ( // Started date { field: 'created', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerStarted', { + name: i18n.translate('data.mgmt.searchSessions.table.headerStarted', { defaultMessage: 'Created', }), sortable: true, @@ -209,7 +210,7 @@ export const getColumns = ( // Expiration date { field: 'expires', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerExpiration', { + name: i18n.translate('data.mgmt.searchSessions.table.headerExpiration', { defaultMessage: 'Expiration', }), sortable: true, diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_expiration_status.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_expiration_status.ts similarity index 56% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_expiration_status.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/get_expiration_status.ts index a220b414ba659..52a1ba3b983d2 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_expiration_status.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_expiration_status.ts @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { i18n } from '@kbn/i18n'; import moment from 'moment'; -import { SessionsConfigSchema } from '..'; +import { SearchSessionsConfigSchema } from '../../../../../config'; -export const getExpirationStatus = (config: SessionsConfigSchema, expires: string | null) => { +export const getExpirationStatus = (config: SearchSessionsConfigSchema, expires: string | null) => { const tNow = moment.utc().valueOf(); const tFuture = moment.utc(expires).valueOf(); @@ -19,27 +20,27 @@ export const getExpirationStatus = (config: SessionsConfigSchema, expires: strin const expiresInDays = Math.floor(durationToExpire.asDays()); const sufficientDays = Math.ceil(moment.duration(config.management.expiresSoonWarning).asDays()); - let toolTipContent = i18n.translate('xpack.data.mgmt.searchSessions.status.expiresSoonInDays', { + let toolTipContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInDays', { defaultMessage: 'Expires in {numDays} days', values: { numDays: expiresInDays }, }); - let statusContent = i18n.translate( - 'xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip', - { defaultMessage: '{numDays} days', values: { numDays: expiresInDays } } - ); + let statusContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInDaysTooltip', { + defaultMessage: '{numDays} days', + values: { numDays: expiresInDays }, + }); if (expiresInDays === 0) { // switch to show expires in hours const expiresInHours = Math.floor(durationToExpire.asHours()); - toolTipContent = i18n.translate('xpack.data.mgmt.searchSessions.status.expiresSoonInHours', { + toolTipContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInHours', { defaultMessage: 'This session expires in {numHours} hours', values: { numHours: expiresInHours }, }); - statusContent = i18n.translate( - 'xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip', - { defaultMessage: '{numHours} hours', values: { numHours: expiresInHours } } - ); + statusContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInHoursTooltip', { + defaultMessage: '{numHours} hours', + values: { numHours: expiresInHours }, + }); } if (durationToExpire.valueOf() > 0 && expiresInDays <= sufficientDays) { diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts b/src/plugins/data/public/search/session/sessions_mgmt/types.ts similarity index 84% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts rename to src/plugins/data/public/search/session/sessions_mgmt/types.ts index c66290a968240..d21b4371099c7 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/types.ts @@ -1,11 +1,12 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../../common'; import { ACTION } from './components/actions'; export const DATE_STRING_FORMAT = 'D MMM, YYYY, HH:mm:ss'; diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index b596e02e7f2ac..69c2035b28e5c 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -15,6 +15,9 @@ import { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { UsageCollectionSetup, UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; import { Setup as InspectorSetup } from '@kbn/inspector-plugin/public'; +import { ScreenshotModePluginStart } from '@kbn/screenshot-mode-plugin/public'; +import { SharePluginStart } from '@kbn/share-plugin/public'; +import { ManagementSetup } from '@kbn/management-plugin/public'; import { DatatableUtilitiesService } from '../common'; import { createFiltersFromRangeSelectAction, createFiltersFromValueClickAction } from './actions'; import type { ISearchSetup, ISearchStart } from './search'; @@ -29,12 +32,15 @@ export interface DataSetupDependencies { inspector: InspectorSetup; usageCollection?: UsageCollectionSetup; fieldFormats: FieldFormatsSetup; + management: ManagementSetup; } export interface DataStartDependencies { uiActions: UiActionsStart; fieldFormats: FieldFormatsStart; dataViews: DataViewsPublicPluginStart; + screenshotMode: ScreenshotModePluginStart; + share: SharePluginStart; } /** diff --git a/src/plugins/data/server/config_deprecations.test.ts b/src/plugins/data/server/config_deprecations.test.ts index 7da937c840560..9c54c793f661a 100644 --- a/src/plugins/data/server/config_deprecations.test.ts +++ b/src/plugins/data/server/config_deprecations.test.ts @@ -11,12 +11,12 @@ import { cloneDeep } from 'lodash'; import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; import { configDeprecationsMock } from '@kbn/core/server/mocks'; -import { autocompleteConfigDeprecationProvider } from './config_deprecations'; +import { configDeprecationProvider } from './config_deprecations'; const deprecationContext = configDeprecationsMock.createContext(); const applyConfigDeprecations = (settings: Record = {}) => { - const deprecations = autocompleteConfigDeprecationProvider(configDeprecationFactory); + const deprecations = configDeprecationProvider(configDeprecationFactory); const deprecationMessages: string[] = []; const migrated = applyDeprecations( settings, @@ -37,40 +37,30 @@ const applyConfigDeprecations = (settings: Record = {}) => { describe('Config Deprecations', () => { it('does not report deprecations for default configuration', () => { - const defaultConfig = { data: { autocomplete: { valueSuggestions: {} } } }; + const defaultConfig = { data: { search: { sessions: {} } } }; const { messages, migrated } = applyConfigDeprecations(cloneDeep(defaultConfig)); expect(migrated).toEqual(defaultConfig); expect(messages).toHaveLength(0); }); - it('renames kibana.autocompleteTerminateAfter to data.autocomplete.valueSuggestions.terminateAfter', () => { + it('renames xpack.data_enhanced.search.sessions.* to data.search.sessions.*', () => { const config = { - kibana: { - autocompleteTerminateAfter: 123, + xpack: { + data_enhanced: { + search: { + sessions: { + enabled: false, + }, + }, + }, }, }; const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); - expect(migrated.kibana?.autocompleteTerminateAfter).not.toBeDefined(); - expect(migrated.data.autocomplete.valueSuggestions.terminateAfter).toEqual(123); + expect(migrated.xpack?.data_enhanced).not.toBeDefined(); + expect(migrated.data.search.sessions.enabled).toEqual(false); expect(messages).toMatchInlineSnapshot(` Array [ - "Setting \\"kibana.autocompleteTerminateAfter\\" has been replaced by \\"data.autocomplete.valueSuggestions.terminateAfter\\"", - ] - `); - }); - - it('renames kibana.autocompleteTimeout to data.autocomplete.valueSuggestions.timeout', () => { - const config = { - kibana: { - autocompleteTimeout: 123, - }, - }; - const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); - expect(migrated.kibana?.autocompleteTimeout).not.toBeDefined(); - expect(migrated.data.autocomplete.valueSuggestions.timeout).toEqual(123); - expect(messages).toMatchInlineSnapshot(` - Array [ - "Setting \\"kibana.autocompleteTimeout\\" has been replaced by \\"data.autocomplete.valueSuggestions.timeout\\"", + "Setting \\"xpack.data_enhanced.search.sessions\\" has been replaced by \\"data.search.sessions\\"", ] `); }); diff --git a/src/plugins/data/server/config_deprecations.ts b/src/plugins/data/server/config_deprecations.ts index 7f704dac1f431..dcc168f306e1e 100644 --- a/src/plugins/data/server/config_deprecations.ts +++ b/src/plugins/data/server/config_deprecations.ts @@ -8,15 +8,8 @@ import type { ConfigDeprecationProvider } from '@kbn/core/server'; -export const autocompleteConfigDeprecationProvider: ConfigDeprecationProvider = ({ - renameFromRoot, -}) => [ - renameFromRoot( - 'kibana.autocompleteTerminateAfter', - 'data.autocomplete.valueSuggestions.terminateAfter', - { level: 'warning' } - ), - renameFromRoot('kibana.autocompleteTimeout', 'data.autocomplete.valueSuggestions.timeout', { +export const configDeprecationProvider: ConfigDeprecationProvider = ({ renameFromRoot }) => [ + renameFromRoot('xpack.data_enhanced.search.sessions', 'data.search.sessions', { level: 'warning', }), ]; diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index b970221c43391..cac9f9c08209e 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -70,6 +70,7 @@ import { // tabify calcAutoIntervalLessThan, } from '../common'; +import { configDeprecationProvider } from './config_deprecations'; export type { ParsedInterval, @@ -122,6 +123,7 @@ export type { DataPluginSetup as PluginSetup, DataPluginStart as PluginStart }; export { DataServerPlugin as Plugin }; export const config: PluginConfigDescriptor = { + deprecations: configDeprecationProvider, exposeToBrowser: { search: true, }, diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index d1beb335dd35c..70fa72b1634cb 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -12,9 +12,14 @@ import { BfetchServerSetup } from '@kbn/bfetch-plugin/server'; import { PluginStart as DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import type { SecurityPluginSetup } from '@kbn/security-plugin/server'; import { ConfigSchema } from '../config'; +import type { ISearchSetup, ISearchStart } from './search'; import { DatatableUtilitiesService } from './datatable_utilities'; -import type { ISearchSetup, ISearchStart, SearchEnhancements } from './search'; import { SearchService } from './search/search_service'; import { QueryService } from './query/query_service'; import { ScriptsService } from './scripts'; @@ -22,10 +27,6 @@ import { KqlTelemetryService } from './kql_telemetry'; import { getUiSettings } from './ui_settings'; import { QuerySetup } from './query'; -interface DataEnhancements { - search: SearchEnhancements; -} - export interface DataPluginSetup { search: ISearchSetup; query: QuerySetup; @@ -33,10 +34,6 @@ export interface DataPluginSetup { * @deprecated - use "fieldFormats" plugin directly instead */ fieldFormats: FieldFormatsSetup; - /** - * @internal - */ - __enhance: (enhancements: DataEnhancements) => void; } export interface DataPluginStart { @@ -58,12 +55,15 @@ export interface DataPluginSetupDependencies { expressions: ExpressionsServerSetup; usageCollection?: UsageCollectionSetup; fieldFormats: FieldFormatsSetup; + taskManager?: TaskManagerSetupContract; + security?: SecurityPluginSetup; } export interface DataPluginStartDependencies { fieldFormats: FieldFormatsStart; logger: Logger; dataViews: DataViewsServerPluginStart; + taskManager?: TaskManagerStartContract; } export class DataServerPlugin @@ -90,7 +90,14 @@ export class DataServerPlugin public setup( core: CoreSetup, - { bfetch, expressions, usageCollection, fieldFormats }: DataPluginSetupDependencies + { + bfetch, + expressions, + usageCollection, + fieldFormats, + taskManager, + security, + }: DataPluginSetupDependencies ) { this.scriptsService.setup(core); const querySetup = this.queryService.setup(core); @@ -102,20 +109,26 @@ export class DataServerPlugin bfetch, expressions, usageCollection, + security, + taskManager, }); return { - __enhance: (enhancements: DataEnhancements) => { - searchSetup.__enhance(enhancements.search); - }, search: searchSetup, query: querySetup, fieldFormats, }; } - public start(core: CoreStart, { fieldFormats, dataViews }: DataPluginStartDependencies) { - const search = this.searchService.start(core, { fieldFormats, indexPatterns: dataViews }); + public start( + core: CoreStart, + { fieldFormats, dataViews, taskManager }: DataPluginStartDependencies + ) { + const search = this.searchService.start(core, { + fieldFormats, + indexPatterns: dataViews, + taskManager, + }); const datatableUtilities = new DatatableUtilitiesService( search.aggs, dataViews, diff --git a/src/plugins/data/server/search/collectors/fetch.ts b/src/plugins/data/server/search/collectors/search/fetch.ts similarity index 100% rename from src/plugins/data/server/search/collectors/fetch.ts rename to src/plugins/data/server/search/collectors/search/fetch.ts diff --git a/src/plugins/data/server/search/collectors/index.ts b/src/plugins/data/server/search/collectors/search/index.ts similarity index 100% rename from src/plugins/data/server/search/collectors/index.ts rename to src/plugins/data/server/search/collectors/search/index.ts diff --git a/src/plugins/data/server/search/collectors/register.ts b/src/plugins/data/server/search/collectors/search/register.ts similarity index 100% rename from src/plugins/data/server/search/collectors/register.ts rename to src/plugins/data/server/search/collectors/search/register.ts diff --git a/src/plugins/data/server/search/collectors/usage.ts b/src/plugins/data/server/search/collectors/search/usage.ts similarity index 97% rename from src/plugins/data/server/search/collectors/usage.ts rename to src/plugins/data/server/search/collectors/search/usage.ts index 5b1904737b9bc..c3e09257a4628 100644 --- a/src/plugins/data/server/search/collectors/usage.ts +++ b/src/plugins/data/server/search/collectors/search/usage.ts @@ -8,8 +8,8 @@ import { once, debounce } from 'lodash'; import type { CoreSetup, Logger } from '@kbn/core/server'; -import type { IEsSearchResponse, ISearchOptions } from '../../../common'; -import { isCompleteResponse } from '../../../common'; +import type { IEsSearchResponse, ISearchOptions } from '../../../../common'; +import { isCompleteResponse } from '../../../../common'; import { CollectedUsage } from './register'; const SAVED_OBJECT_ID = 'search-telemetry'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/fetch.test.ts b/src/plugins/data/server/search/collectors/search_session/fetch.test.ts similarity index 92% rename from x-pack/plugins/data_enhanced/server/collectors/fetch.test.ts rename to src/plugins/data/server/search/collectors/search_session/fetch.test.ts index 260577298e81b..1290b06b94ee0 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/fetch.test.ts +++ b/src/plugins/data/server/search/collectors/search_session/fetch.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { SavedObjectsErrorHelpers, Logger } from '@kbn/core/server'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/fetch.ts b/src/plugins/data/server/search/collectors/search_session/fetch.ts similarity index 89% rename from x-pack/plugins/data_enhanced/server/collectors/fetch.ts rename to src/plugins/data/server/search/collectors/search_session/fetch.ts index eb3b50b3a64e9..536ca4b168188 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/fetch.ts +++ b/src/plugins/data/server/search/collectors/search_session/fetch.ts @@ -1,14 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ + import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { Logger } from '@kbn/core/server'; import { CollectorFetchContext } from '@kbn/usage-collection-plugin/server'; -import { SEARCH_SESSION_TYPE } from '@kbn/data-plugin/common'; import { ReportedUsage } from './register'; +import { SEARCH_SESSION_TYPE } from '../../../../common'; interface SessionPersistedTermsBucket { key_as_string: 'false' | 'true'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/index.ts b/src/plugins/data/server/search/collectors/search_session/index.ts similarity index 53% rename from x-pack/plugins/data_enhanced/server/collectors/index.ts rename to src/plugins/data/server/search/collectors/search_session/index.ts index 4a82c76e96dee..c52a71b6c98f3 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/index.ts +++ b/src/plugins/data/server/search/collectors/search_session/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export { registerUsageCollector } from './register'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/register.ts b/src/plugins/data/server/search/collectors/search_session/register.ts similarity index 84% rename from x-pack/plugins/data_enhanced/server/collectors/register.ts rename to src/plugins/data/server/search/collectors/search_session/register.ts index 6b98627fce11f..c6ea85a2b53d3 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/register.ts +++ b/src/plugins/data/server/search/collectors/search_session/register.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { Logger } from '@kbn/core/server'; diff --git a/src/plugins/data/server/search/index.ts b/src/plugins/data/server/search/index.ts index b7087e95c0a2c..a61a74609cc6f 100644 --- a/src/plugins/data/server/search/index.ts +++ b/src/plugins/data/server/search/index.ts @@ -10,8 +10,8 @@ export * from './types'; export * from './strategies/es_search'; export * from './strategies/ese_search'; export * from './strategies/eql_search'; -export type { SearchUsage } from './collectors'; -export { usageProvider, searchUsageObserver } from './collectors'; +export type { SearchUsage } from './collectors/search'; +export { usageProvider, searchUsageObserver } from './collectors/search'; export * from './aggs'; export * from './session'; export * from './errors/no_search_id_in_session'; diff --git a/src/plugins/data/server/search/mocks.ts b/src/plugins/data/server/search/mocks.ts index 740be105703a7..31944922c7b44 100644 --- a/src/plugins/data/server/search/mocks.ts +++ b/src/plugins/data/server/search/mocks.ts @@ -16,7 +16,6 @@ export function createSearchSetupMock(): jest.Mocked { return { aggs: searchAggsSetupMock(), registerSearchStrategy: jest.fn(), - __enhance: jest.fn(), searchSource: searchSourceMock.createSetupContract(), }; } diff --git a/src/plugins/data/server/search/routes/index.ts b/src/plugins/data/server/search/routes/index.ts index 0a4f5467c8fa9..f118a3bb4b6c9 100644 --- a/src/plugins/data/server/search/routes/index.ts +++ b/src/plugins/data/server/search/routes/index.ts @@ -7,3 +7,4 @@ */ export * from './search'; +export * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/routes/session.test.ts b/src/plugins/data/server/search/routes/session.test.ts similarity index 94% rename from x-pack/plugins/data_enhanced/server/routes/session.test.ts rename to src/plugins/data/server/search/routes/session.test.ts index c6625a3491886..20dbac04a7674 100644 --- a/x-pack/plugins/data_enhanced/server/routes/session.test.ts +++ b/src/plugins/data/server/search/routes/session.test.ts @@ -1,16 +1,18 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import type { MockedKeys } from '@kbn/utility-types/jest'; import type { CoreSetup, Logger } from '@kbn/core/server'; import { coreMock, httpServerMock } from '@kbn/core/server/mocks'; -import type { PluginStart as DataPluginStart } from '@kbn/data-plugin/server'; -import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; +import type { PluginStart as DataPluginStart } from '../..'; +import { dataPluginMock } from '../../mocks'; + import { registerSessionRoutes } from './session'; enum PostHandlerIndex { diff --git a/x-pack/plugins/data_enhanced/server/routes/session.ts b/src/plugins/data/server/search/routes/session.ts similarity index 95% rename from x-pack/plugins/data_enhanced/server/routes/session.ts rename to src/plugins/data/server/search/routes/session.ts index a0eea258c4db5..6106a69df207a 100644 --- a/x-pack/plugins/data_enhanced/server/routes/session.ts +++ b/src/plugins/data/server/search/routes/session.ts @@ -1,18 +1,19 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { schema } from '@kbn/config-schema'; import { Logger } from '@kbn/core/server'; import { reportServerError } from '@kbn/kibana-utils-plugin/server'; -import { DataEnhancedPluginRouter } from '../type'; +import { DataPluginRouter } from '../types'; const STORE_SEARCH_SESSIONS_ROLE_TAG = `access:store_search_session`; -export function registerSessionRoutes(router: DataEnhancedPluginRouter, logger: Logger): void { +export function registerSessionRoutes(router: DataPluginRouter, logger: Logger): void { router.post( { path: '/internal/session', diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/index.ts b/src/plugins/data/server/search/saved_objects/index.ts similarity index 51% rename from x-pack/plugins/data_enhanced/server/saved_objects/index.ts rename to src/plugins/data/server/search/saved_objects/index.ts index 3736eb7e0394b..207cd6e64ea4a 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/index.ts +++ b/src/plugins/data/server/search/saved_objects/index.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export * from './search_session'; diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts b/src/plugins/data/server/search/saved_objects/search_session.ts similarity index 85% rename from x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts rename to src/plugins/data/server/search/saved_objects/search_session.ts index 68f37e1e2adac..c77c8379af365 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts +++ b/src/plugins/data/server/search/saved_objects/search_session.ts @@ -1,12 +1,13 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { SavedObjectsType } from '@kbn/core/server'; -import { SEARCH_SESSION_TYPE } from '@kbn/data-plugin/common'; +import { SEARCH_SESSION_TYPE } from '../../../common'; import { searchSessionSavedObjectMigrations } from './search_session_migration'; export const searchSessionSavedObjectType: SavedObjectsType = { diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts b/src/plugins/data/server/search/saved_objects/search_session_migration.test.ts similarity index 97% rename from x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts rename to src/plugins/data/server/search/saved_objects/search_session_migration.test.ts index a94b22de5b0ed..251d57e884ac1 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts +++ b/src/plugins/data/server/search/saved_objects/search_session_migration.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { @@ -12,7 +13,7 @@ import { SearchSessionSavedObjectAttributesPre$8$0$0, } from './search_session_migration'; import { SavedObject } from '@kbn/core/types'; -import { SEARCH_SESSION_TYPE, SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SEARCH_SESSION_TYPE, SearchSessionStatus } from '../../../common'; import { SavedObjectMigrationContext } from '@kbn/core/server'; describe('7.12.0 -> 7.13.0', () => { diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts b/src/plugins/data/server/search/saved_objects/search_session_migration.ts similarity index 93% rename from x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts rename to src/plugins/data/server/search/saved_objects/search_session_migration.ts index f2de5df91de95..314db0fb8b58f 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts +++ b/src/plugins/data/server/search/saved_objects/search_session_migration.ts @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { SavedObjectMigrationMap, SavedObjectUnsanitizedDoc } from '@kbn/core/server'; import { SearchSessionSavedObjectAttributes as SearchSessionSavedObjectAttributesLatest, SearchSessionStatus, -} from '@kbn/data-plugin/common'; +} from '../../../common'; /** * Search sessions were released in 7.12.0 diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts index 121de2e068e3c..663b28e733e29 100644 --- a/src/plugins/data/server/search/search_service.test.ts +++ b/src/plugins/data/server/search/search_service.test.ts @@ -22,7 +22,6 @@ import type { IEsSearchResponse, IScopedSearchClient, IScopedSearchSessionsClient, - ISearchSessionService, ISearchStart, ISearchStrategy, } from '.'; @@ -32,6 +31,16 @@ import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks'; import { createSearchSessionsClientMock } from './mocks'; import { ENHANCED_ES_SEARCH_STRATEGY } from '../../common'; +let mockSessionClient: jest.Mocked; +jest.mock('./session', () => { + class SearchSessionService { + asScopedProvider = () => (request: any) => mockSessionClient; + } + return { + SearchSessionService, + }; +}); + describe('Search service', () => { let plugin: SearchService; let mockCoreSetup: MockedKeys>; @@ -88,8 +97,7 @@ describe('Search service', () => { let searchPluginStart: ISearchStart>; let mockStrategy: any; let mockStrategyNoCancel: jest.Mocked; - let mockSessionService: ISearchSessionService; - let mockSessionClient: jest.Mocked; + const sessionId = '1234'; beforeEach(() => { @@ -104,9 +112,6 @@ describe('Search service', () => { }; mockSessionClient = createSearchSessionsClientMock(); - mockSessionService = { - asScopedProvider: () => (request: any) => mockSessionClient, - }; const pluginSetup = plugin.setup(mockCoreSetup, { bfetch: bfetchPluginMock.createSetupContract(), @@ -114,9 +119,6 @@ describe('Search service', () => { }); pluginSetup.registerSearchStrategy(ENHANCED_ES_SEARCH_STRATEGY, mockStrategy); pluginSetup.registerSearchStrategy('nocancel', mockStrategyNoCancel); - pluginSetup.__enhance({ - sessionService: mockSessionService, - }); searchPluginStart = plugin.start(mockCoreStart, { fieldFormats: createFieldFormatsStartMock(), diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index c59893cdead96..36479b3c5298c 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -26,58 +26,63 @@ import { FieldFormatsStart } from '@kbn/field-formats-plugin/server'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { KbnServerError } from '@kbn/kibana-utils-plugin/server'; import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import type { SecurityPluginSetup } from '@kbn/security-plugin/server'; +import type { + DataRequestHandlerContext, IScopedSearchClient, ISearchSetup, ISearchStart, ISearchStrategy, - SearchEnhancements, SearchStrategyDependencies, - DataRequestHandlerContext, } from './types'; import { AggsService } from './aggs'; import { IndexPatternsServiceStart } from '../data_views'; -import { registerSearchRoute } from './routes'; +import { registerSearchRoute, registerSessionRoutes } from './routes'; import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './strategies/es_search'; import { DataPluginStart, DataPluginStartDependencies } from '../plugin'; -import { registerUsageCollector } from './collectors/register'; -import { usageProvider } from './collectors/usage'; +import { usageProvider } from './collectors/search/usage'; +import { registerUsageCollector as registerSearchUsageCollector } from './collectors/search/register'; +import { registerUsageCollector as registerSearchSessionUsageCollector } from './collectors/search_session/register'; import { searchTelemetry } from '../saved_objects'; import { + cidrFunction, + dateRangeFunction, + ENHANCED_ES_SEARCH_STRATEGY, + EQL_SEARCH_STRATEGY, + esRawResponse, existsFilterFunction, + extendedBoundsFunction, fieldFunction, + geoBoundingBoxFunction, + geoPointFunction, IEsSearchRequest, IEsSearchResponse, IKibanaSearchRequest, IKibanaSearchResponse, - ISearchOptions, - cidrFunction, - dateRangeFunction, - extendedBoundsFunction, - geoBoundingBoxFunction, - geoPointFunction, ipRangeFunction, + ISearchOptions, kibana, kibanaContext, - kibanaTimerangeFunction, kibanaFilterFunction, + kibanaTimerangeFunction, kqlFunction, luceneFunction, numericalRangeFunction, + phraseFilterFunction, queryFilterFunction, rangeFilterFunction, - removeFilterFunction, selectFilterFunction, rangeFunction, + removeFilterFunction, SearchSourceDependencies, searchSourceRequiredUiSettings, SearchSourceService, - phraseFilterFunction, - esRawResponse, eqlRawResponse, - ENHANCED_ES_SEARCH_STRATEGY, - EQL_SEARCH_STRATEGY, SQL_SEARCH_STRATEGY, } from '../../common/search'; import { getEsaggs, getEsdsl, getEql } from './expressions'; @@ -87,7 +92,7 @@ import { } from '../../common/search/aggs/buckets/shard_delay'; import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn'; import { ConfigSchema } from '../../config'; -import { ISearchSessionService, SearchSessionService } from './session'; +import { SearchSessionService } from './session'; import { registerBsearchRoute } from './routes/bsearch'; import { getKibanaContext } from './expressions/kibana_context'; import { enhancedEsSearchStrategyProvider } from './strategies/ese_search'; @@ -95,6 +100,7 @@ import { eqlSearchStrategyProvider } from './strategies/eql_search'; import { NoSearchIdInSessionError } from './errors/no_search_id_in_session'; import { CachedUiSettingsClient } from './services'; import { sqlSearchStrategyProvider } from './strategies/sql_search'; +import { searchSessionSavedObjectType } from './saved_objects'; type StrategyMap = Record>; @@ -103,12 +109,15 @@ export interface SearchServiceSetupDependencies { bfetch: BfetchServerSetup; expressions: ExpressionsServerSetup; usageCollection?: UsageCollectionSetup; + taskManager?: TaskManagerSetupContract; + security?: SecurityPluginSetup; } /** @internal */ export interface SearchServiceStartDependencies { fieldFormats: FieldFormatsStart; indexPatterns: IndexPatternsServiceStart; + taskManager?: TaskManagerStartContract; } /** @internal */ @@ -121,7 +130,7 @@ export class SearchService implements Plugin { private readonly aggsService = new AggsService(); private readonly searchSourceService = new SearchSourceService(); private searchStrategies: StrategyMap = {}; - private sessionService: ISearchSessionService; + private sessionService: SearchSessionService; private asScoped!: ISearchStart['asScoped']; private searchAsInternalUser!: ISearchStrategy; @@ -129,17 +138,31 @@ export class SearchService implements Plugin { private initializerContext: PluginInitializerContext, private readonly logger: Logger ) { - this.sessionService = new SearchSessionService(); + this.sessionService = new SearchSessionService( + logger, + initializerContext.config.get(), + initializerContext.env.packageInfo.version + ); } public setup( core: CoreSetup, - { bfetch, expressions, usageCollection }: SearchServiceSetupDependencies + { bfetch, expressions, usageCollection, taskManager, security }: SearchServiceSetupDependencies ): ISearchSetup { + core.savedObjects.registerType(searchSessionSavedObjectType); const usage = usageCollection ? usageProvider(core) : undefined; const router = core.http.createRouter(); registerSearchRoute(router); + registerSessionRoutes(router, this.logger); + + if (taskManager) { + this.sessionService.setup(core, { taskManager, security }); + } else { + // this should never happen in real world, but + // taskManager and security are optional deps because they are in x-pack + this.logger.debug('Skipping sessionService setup because taskManager is not available'); + } core.http.registerRouteHandlerContext( 'search', @@ -188,7 +211,12 @@ export class SearchService implements Plugin { core.savedObjects.registerType(searchTelemetry); if (usageCollection) { - registerUsageCollector(usageCollection, core.savedObjects.getKibanaIndex()); + registerSearchUsageCollector(usageCollection, core.savedObjects.getKibanaIndex()); + registerSearchSessionUsageCollector( + usageCollection, + core.savedObjects.getKibanaIndex(), + this.logger + ); } expressions.registerFunction(getEsaggs({ getStartServices: core.getStartServices })); @@ -229,9 +257,6 @@ export class SearchService implements Plugin { }); return { - __enhance: (enhancements: SearchEnhancements) => { - this.sessionService = enhancements.sessionService; - }, aggs, registerSearchStrategy: this.registerSearchStrategy, usage, @@ -241,9 +266,14 @@ export class SearchService implements Plugin { public start( core: CoreStart, - { fieldFormats, indexPatterns }: SearchServiceStartDependencies + { fieldFormats, indexPatterns, taskManager }: SearchServiceStartDependencies ): ISearchStart { const { elasticsearch, savedObjects, uiSettings } = core; + + if (taskManager) { + this.sessionService.start(core, { taskManager }); + } + this.asScoped = this.asScopedProvider(core); return { aggs: this.aggsService.start({ diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.test.ts b/src/plugins/data/server/search/session/check_non_persisted_sessions.test.ts similarity index 96% rename from x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.test.ts rename to src/plugins/data/server/search/session/check_non_persisted_sessions.test.ts index d7e472f4b3245..edbef1938a82f 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.test.ts +++ b/src/plugins/data/server/search/session/check_non_persisted_sessions.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { checkNonPersistedSessions as checkNonPersistedSessions$ } from './check_non_persisted_sessions'; @@ -11,25 +12,28 @@ import { SearchSessionSavedObjectAttributes, ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY, -} from '@kbn/data-plugin/common'; +} from '../../../common'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchStatus } from './types'; +import { CheckSearchSessionsDeps, SearchStatus } from './types'; import moment from 'moment'; import { SavedObjectsBulkUpdateObject, SavedObjectsDeleteOptions, SavedObjectsClientContract, } from '@kbn/core/server'; +import { SearchSessionsConfigSchema } from '../../../config'; jest.useFakeTimers(); -const checkNonPersistedSessions = (deps: CheckSearchSessionsDeps, config: SearchSessionsConfig) => - checkNonPersistedSessions$(deps, config).toPromise(); +const checkNonPersistedSessions = ( + deps: CheckSearchSessionsDeps, + config: SearchSessionsConfigSchema +) => checkNonPersistedSessions$(deps, config).toPromise(); describe('checkNonPersistedSessions', () => { let mockClient: any; let savedObjectsClient: jest.Mocked; - const config: SearchSessionsConfig = { + const config: SearchSessionsConfigSchema = { enabled: true, pageSize: 5, notTouchedInProgressTimeout: moment.duration(1, 'm'), diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.ts b/src/plugins/data/server/search/session/check_non_persisted_sessions.ts similarity index 91% rename from x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.ts rename to src/plugins/data/server/search/session/check_non_persisted_sessions.ts index 20903d4508bb1..86f377db57d23 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.ts +++ b/src/plugins/data/server/search/session/check_non_persisted_sessions.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { SavedObjectsFindResult } from '@kbn/core/server'; @@ -16,17 +17,18 @@ import { SearchSessionSavedObjectAttributes, SearchSessionStatus, KueryNode, -} from '@kbn/data-plugin/common'; +} from '../../../common'; import { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchStatus } from './types'; +import { CheckSearchSessionsDeps, SearchStatus } from './types'; import { bulkUpdateSessions, getAllSessionsStatusUpdates } from './update_session_status'; +import { SearchSessionsConfigSchema } from '../../../config'; export const SEARCH_SESSIONS_CLEANUP_TASK_TYPE = 'search_sessions_cleanup'; export const SEARCH_SESSIONS_CLEANUP_TASK_ID = `data_enhanced_${SEARCH_SESSIONS_CLEANUP_TASK_TYPE}`; function isSessionStale( session: SavedObjectsFindResult, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const curTime = moment(); // Delete cancelled sessions immediately @@ -45,7 +47,7 @@ function isSessionStale( function checkNonPersistedSessionsPage( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filter: KueryNode, page: number ) { @@ -118,7 +120,7 @@ function checkNonPersistedSessionsPage( export function checkNonPersistedSessions( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const { logger } = deps; diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.test.ts b/src/plugins/data/server/search/session/check_persisted_sessions.test.ts similarity index 87% rename from x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.test.ts rename to src/plugins/data/server/search/session/check_persisted_sessions.test.ts index f27dba05d88e1..1e6de567a0d76 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.test.ts +++ b/src/plugins/data/server/search/session/check_persisted_sessions.test.ts @@ -1,20 +1,21 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { checkPersistedSessionsProgress } from './check_persisted_sessions'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { SearchSessionsConfig } from './types'; import moment from 'moment'; import { SavedObjectsClientContract } from '@kbn/core/server'; +import { SearchSessionsConfigSchema } from '../../../config'; describe('checkPersistedSessionsProgress', () => { let mockClient: any; let savedObjectsClient: jest.Mocked; - const config: SearchSessionsConfig = { + const config: SearchSessionsConfigSchema = { enabled: true, pageSize: 5, notTouchedInProgressTimeout: moment.duration(1, 'm'), diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.ts b/src/plugins/data/server/search/session/check_persisted_sessions.ts similarity index 81% rename from x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.ts rename to src/plugins/data/server/search/session/check_persisted_sessions.ts index 2f4cfaaa015c6..915d8af3fe80f 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.ts +++ b/src/plugins/data/server/search/session/check_persisted_sessions.ts @@ -1,28 +1,25 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EMPTY, Observable } from 'rxjs'; import { catchError, concatMap } from 'rxjs/operators'; -import { - nodeBuilder, - SEARCH_SESSION_TYPE, - SearchSessionStatus, - KueryNode, -} from '@kbn/data-plugin/common'; +import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus, KueryNode } from '../../../common'; import { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; +import { CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; import { bulkUpdateSessions, getAllSessionsStatusUpdates } from './update_session_status'; +import { SearchSessionsConfigSchema } from '../../../config'; export const SEARCH_SESSIONS_TASK_TYPE = 'search_sessions_monitor'; export const SEARCH_SESSIONS_TASK_ID = `data_enhanced_${SEARCH_SESSIONS_TASK_TYPE}`; function checkPersistedSessionsPage( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filter: KueryNode, page: number ): Observable { @@ -50,7 +47,7 @@ function checkPersistedSessionsPage( export function checkPersistedSessionsProgress( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const { logger } = deps; diff --git a/x-pack/plugins/data_enhanced/server/search/session/expire_persisted_sessions.ts b/src/plugins/data/server/search/session/expire_persisted_sessions.ts similarity index 80% rename from x-pack/plugins/data_enhanced/server/search/session/expire_persisted_sessions.ts rename to src/plugins/data/server/search/session/expire_persisted_sessions.ts index dfc77935d2275..77ae9d3f5a155 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/expire_persisted_sessions.ts +++ b/src/plugins/data/server/search/session/expire_persisted_sessions.ts @@ -1,28 +1,25 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EMPTY, Observable } from 'rxjs'; import { catchError, concatMap } from 'rxjs/operators'; -import { - nodeBuilder, - SEARCH_SESSION_TYPE, - SearchSessionStatus, - KueryNode, -} from '@kbn/data-plugin/common'; +import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus, KueryNode } from '../../../common'; import { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; +import { CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; import { bulkUpdateSessions, getAllSessionsStatusUpdates } from './update_session_status'; +import { SearchSessionsConfigSchema } from '../../../config'; export const SEARCH_SESSIONS_EXPIRE_TASK_TYPE = 'search_sessions_expire'; export const SEARCH_SESSIONS_EXPIRE_TASK_ID = `data_enhanced_${SEARCH_SESSIONS_EXPIRE_TASK_TYPE}`; function checkSessionExpirationPage( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filter: KueryNode, page: number ): Observable { @@ -46,7 +43,7 @@ function checkSessionExpirationPage( export function checkPersistedCompletedSessionExpiration( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const { logger } = deps; diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.test.ts b/src/plugins/data/server/search/session/get_search_session_page.test.ts similarity index 94% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.test.ts rename to src/plugins/data/server/search/session/get_search_session_page.test.ts index d78e0567eaec4..43a8f987dc8fc 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.test.ts +++ b/src/plugins/data/server/search/session/get_search_session_page.test.ts @@ -1,24 +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. + * 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 { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionStatus, ENHANCED_ES_SEARCH_STRATEGY } from '@kbn/data-plugin/common'; +import { ENHANCED_ES_SEARCH_STRATEGY, SearchSessionStatus } from '../../../common'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { SearchSessionsConfig, SearchStatus } from './types'; +import { SearchStatus } from './types'; import moment from 'moment'; import { SavedObjectsClientContract } from '@kbn/core/server'; import { of, Subject, throwError } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { SearchSessionsConfigSchema } from '../../../config'; + jest.useFakeTimers(); describe('checkSearchSessionsByPage', () => { const mockClient = {} as any; let savedObjectsClient: jest.Mocked; - const config: SearchSessionsConfig = { + const config: SearchSessionsConfigSchema = { enabled: true, pageSize: 5, management: {} as any, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.ts b/src/plugins/data/server/search/session/get_search_session_page.ts similarity index 81% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.ts rename to src/plugins/data/server/search/session/get_search_session_page.ts index f59883350898b..30dc72eaa6813 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.ts +++ b/src/plugins/data/server/search/session/get_search_session_page.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { SavedObjectsClientContract, Logger } from '@kbn/core/server'; @@ -12,8 +13,9 @@ import { SearchSessionSavedObjectAttributes, SEARCH_SESSION_TYPE, KueryNode, -} from '@kbn/data-plugin/common'; -import { CheckSearchSessionsDeps, CheckSearchSessionsFn, SearchSessionsConfig } from './types'; +} from '../../../common'; +import { CheckSearchSessionsDeps, CheckSearchSessionsFn } from './types'; +import { SearchSessionsConfigSchema } from '../../../config'; export interface GetSessionsDeps { savedObjectsClient: SavedObjectsClientContract; @@ -43,7 +45,7 @@ export function getSearchSessionsPage$( export const checkSearchSessionsByPage = ( checkFn: CheckSearchSessionsFn, deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filters: any, nextPage = 1 ): Observable => diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.test.ts b/src/plugins/data/server/search/session/get_search_status.test.ts similarity index 92% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_status.test.ts rename to src/plugins/data/server/search/session/get_search_status.test.ts index 9bb4537f331ab..20fcc6935b0d6 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.test.ts +++ b/src/plugins/data/server/search/session/get_search_status.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { SearchStatus } from './types'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts b/src/plugins/data/server/search/session/get_search_status.ts similarity index 80% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts rename to src/plugins/data/server/search/session/get_search_status.ts index 26a31fdbac20d..3ded923376b18 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts +++ b/src/plugins/data/server/search/session/get_search_status.ts @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { i18n } from '@kbn/i18n'; import type { TransportResult } from '@elastic/elasticsearch'; import { ElasticsearchClient } from '@kbn/core/server'; -import { SearchSessionRequestInfo } from '@kbn/data-plugin/common'; -import { AsyncSearchStatusResponse } from '@kbn/data-plugin/server'; +import { SearchSessionRequestInfo } from '../../../common'; +import { AsyncSearchStatusResponse } from '../..'; import { SearchStatus } from './types'; export async function getSearchStatus( @@ -30,7 +31,7 @@ export async function getSearchStatus( if ((response.is_partial && !response.is_running) || response.completion_status >= 400) { return { status: SearchStatus.ERROR, - error: i18n.translate('xpack.data.search.statusError', { + error: i18n.translate('data.search.statusError', { defaultMessage: `Search completed with a {errorCode} status`, values: { errorCode: response.completion_status }, }), @@ -49,7 +50,7 @@ export async function getSearchStatus( } catch (e) { return { status: SearchStatus.ERROR, - error: i18n.translate('xpack.data.search.statusThrow', { + error: i18n.translate('data.search.statusThrow', { defaultMessage: `Search status threw an error {message} ({errorCode}) status`, values: { message: e.message, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts b/src/plugins/data/server/search/session/get_session_status.test.ts similarity index 85% rename from x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts rename to src/plugins/data/server/search/session/get_session_status.test.ts index e15e494fdd6b9..db75e322edda5 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts +++ b/src/plugins/data/server/search/session/get_session_status.test.ts @@ -1,19 +1,21 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { SearchSessionsConfig, SearchStatus } from './types'; +import { SearchStatus } from './types'; import { getSessionStatus } from './get_session_status'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionStatus } from '../../../common'; import moment from 'moment'; +import { SearchSessionsConfigSchema } from '../../../config'; describe('getSessionStatus', () => { const mockConfig = { notTouchedInProgressTimeout: moment.duration(1, 'm'), - } as unknown as SearchSessionsConfig; + } as unknown as SearchSessionsConfigSchema; test("returns an in_progress status if there's nothing inside the session", () => { const session: any = { idMapping: {}, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts b/src/plugins/data/server/search/session/get_session_status.ts similarity index 75% rename from x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts rename to src/plugins/data/server/search/session/get_session_status.ts index d6a4670c5e396..4614ea92318e9 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts +++ b/src/plugins/data/server/search/session/get_session_status.ts @@ -1,17 +1,19 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 moment from 'moment'; -import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '@kbn/data-plugin/common'; -import { SearchSessionsConfig, SearchStatus } from './types'; +import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../common'; +import { SearchStatus } from './types'; +import { SearchSessionsConfigSchema } from '../../../config'; export function getSessionStatus( session: SearchSessionSavedObjectAttributes, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ): SearchSessionStatus { const searchStatuses = Object.values(session.idMapping); const curTime = moment(); diff --git a/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts b/src/plugins/data/server/search/session/session_service.test.ts similarity index 98% rename from x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts rename to src/plugins/data/server/search/session/session_service.test.ts index 0f7f4975082a6..9f780239ea023 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts +++ b/src/plugins/data/server/search/session/session_service.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { @@ -17,9 +18,9 @@ import moment from 'moment'; import { coreMock } from '@kbn/core/server/mocks'; import { ConfigSchema } from '../../../config'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { AuthenticatedUser } from '@kbn/security-plugin/common/model'; -import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus } from '@kbn/data-plugin/common'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { AuthenticatedUser } from '@kbn/security-plugin/common/model'; +import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus } from '../../../common'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; const MAX_UPDATE_RETRIES = 3; @@ -81,13 +82,14 @@ describe('SearchSessionService', () => { management: {} as any, }, }, - }; + } as unknown as ConfigSchema; const mockLogger: any = { debug: jest.fn(), warn: jest.fn(), error: jest.fn(), }; service = new SearchSessionService(mockLogger, config, '8.0.0'); + service.setup(coreMock.createSetup(), { taskManager: taskManagerMock.createSetup() }); const coreStart = coreMock.createStart(); mockTaskManager = taskManagerMock.createStart(); await flushPromises(); @@ -161,13 +163,14 @@ describe('SearchSessionService', () => { management: {} as any, }, }, - }; + } as unknown as ConfigSchema; const mockLogger: any = { debug: jest.fn(), warn: jest.fn(), error: jest.fn(), }; service = new SearchSessionService(mockLogger, config, '8.0.0'); + service.setup(coreMock.createSetup(), { taskManager: taskManagerMock.createSetup() }); const coreStart = coreMock.createStart(); mockTaskManager = taskManagerMock.createStart(); await flushPromises(); diff --git a/src/plugins/data/server/search/session/session_service.ts b/src/plugins/data/server/search/session/session_service.ts index a23b315e47211..02f12a972f8b5 100644 --- a/src/plugins/data/server/search/session/session_service.ts +++ b/src/plugins/data/server/search/session/session_service.ts @@ -6,47 +6,549 @@ * Side Public License, v 1. */ -import { ISearchSessionService } from './types'; +import { notFound } from '@hapi/boom'; +import { debounce } from 'lodash'; +import { nodeBuilder, fromKueryExpression } from '@kbn/es-query'; +import { + CoreSetup, + CoreStart, + KibanaRequest, + SavedObjectsClientContract, + Logger, + SavedObject, + SavedObjectsFindOptions, + SavedObjectsErrorHelpers, +} from '@kbn/core/server'; +import type { AuthenticatedUser, SecurityPluginSetup } from '@kbn/security-plugin/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import { + IKibanaSearchRequest, + ISearchOptions, + ENHANCED_ES_SEARCH_STRATEGY, + SEARCH_SESSION_TYPE, + SearchSessionRequestInfo, + SearchSessionSavedObjectAttributes, + SearchSessionStatus, +} from '../../../common'; +import { ISearchSessionService, NoSearchIdInSessionError } from '../..'; +import { createRequestHash } from './utils'; +import { ConfigSchema, SearchSessionsConfigSchema } from '../../../config'; +import { + registerSearchSessionsTask, + scheduleSearchSessionsTask, + unscheduleSearchSessionsTask, +} from './setup_task'; +import { SearchStatus } from './types'; +import { + checkPersistedSessionsProgress, + SEARCH_SESSIONS_TASK_ID, + SEARCH_SESSIONS_TASK_TYPE, +} from './check_persisted_sessions'; +import { + SEARCH_SESSIONS_CLEANUP_TASK_TYPE, + checkNonPersistedSessions, + SEARCH_SESSIONS_CLEANUP_TASK_ID, +} from './check_non_persisted_sessions'; +import { + SEARCH_SESSIONS_EXPIRE_TASK_TYPE, + SEARCH_SESSIONS_EXPIRE_TASK_ID, + checkPersistedCompletedSessionExpiration, +} from './expire_persisted_sessions'; -/** - * The OSS session service, which leaves most search session-related logic unimplemented. - * @see x-pack/plugins/data_enhanced/server/search/session/session_service.ts - * @internal - */ -export class SearchSessionService implements ISearchSessionService { - constructor() {} +export interface SearchSessionDependencies { + savedObjectsClient: SavedObjectsClientContract; +} +interface SetupDependencies { + taskManager: TaskManagerSetupContract; + security?: SecurityPluginSetup; +} - public asScopedProvider() { - return () => ({ - getId: () => { - throw new Error('getId not implemented in OSS search session service'); - }, - trackId: async () => {}, - getSearchIdMapping: async () => new Map(), - save: async () => { - throw new Error('save not implemented in OSS search session service'); - }, - get: async () => { - throw new Error('get not implemented in OSS search session service'); - }, - find: async () => { - throw new Error('find not implemented in OSS search session service'); - }, - update: async () => { - throw new Error('update not implemented in OSS search session service'); - }, - extend: async () => { - throw new Error('extend not implemented in OSS search session service'); - }, - cancel: async () => { - throw new Error('cancel not implemented in OSS search session service'); - }, - delete: async () => { - throw new Error('delete not implemented in OSS search session service'); - }, - getConfig: () => { - return null; +interface StartDependencies { + taskManager: TaskManagerStartContract; +} + +const DEBOUNCE_UPDATE_OR_CREATE_WAIT = 1000; +const DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT = 5000; + +interface UpdateOrCreateQueueEntry { + deps: SearchSessionDependencies; + user: AuthenticatedUser | null; + sessionId: string; + attributes: Partial; + resolve: () => void; + reject: (reason?: unknown) => void; +} + +function sleep(ms: number) { + return new Promise((r) => setTimeout(r, ms)); +} +export class SearchSessionService + implements ISearchSessionService +{ + private sessionConfig: SearchSessionsConfigSchema; + private readonly updateOrCreateBatchQueue: UpdateOrCreateQueueEntry[] = []; + private security?: SecurityPluginSetup; + private setupCompleted = false; + + constructor( + private readonly logger: Logger, + private readonly config: ConfigSchema, + private readonly version: string + ) { + this.sessionConfig = this.config.search.sessions; + } + + public setup(core: CoreSetup, deps: SetupDependencies) { + this.security = deps.security; + const taskDeps = { + config: this.config, + taskManager: deps.taskManager, + logger: this.logger, + }; + + registerSearchSessionsTask( + core, + taskDeps, + SEARCH_SESSIONS_TASK_TYPE, + 'persisted session progress', + checkPersistedSessionsProgress + ); + + registerSearchSessionsTask( + core, + taskDeps, + SEARCH_SESSIONS_CLEANUP_TASK_TYPE, + 'non persisted session cleanup', + checkNonPersistedSessions + ); + + registerSearchSessionsTask( + core, + taskDeps, + SEARCH_SESSIONS_EXPIRE_TASK_TYPE, + 'complete session expiration', + checkPersistedCompletedSessionExpiration + ); + + this.setupCompleted = true; + } + + public async start(core: CoreStart, deps: StartDependencies) { + if (!this.setupCompleted) + throw new Error('SearchSessionService setup() must be called before start()'); + + return this.setupMonitoring(core, deps); + } + + public stop() {} + + private setupMonitoring = async (core: CoreStart, deps: StartDependencies) => { + const taskDeps = { + config: this.config, + taskManager: deps.taskManager, + logger: this.logger, + }; + + if (this.sessionConfig.enabled) { + scheduleSearchSessionsTask( + taskDeps, + SEARCH_SESSIONS_TASK_ID, + SEARCH_SESSIONS_TASK_TYPE, + this.sessionConfig.trackingInterval + ); + + scheduleSearchSessionsTask( + taskDeps, + SEARCH_SESSIONS_CLEANUP_TASK_ID, + SEARCH_SESSIONS_CLEANUP_TASK_TYPE, + this.sessionConfig.cleanupInterval + ); + + scheduleSearchSessionsTask( + taskDeps, + SEARCH_SESSIONS_EXPIRE_TASK_ID, + SEARCH_SESSIONS_EXPIRE_TASK_TYPE, + this.sessionConfig.expireInterval + ); + } else { + unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_TASK_ID); + unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_CLEANUP_TASK_ID); + unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_EXPIRE_TASK_ID); + } + }; + + private processUpdateOrCreateBatchQueue = debounce( + () => { + const queue = [...this.updateOrCreateBatchQueue]; + if (queue.length === 0) return; + this.updateOrCreateBatchQueue.length = 0; + const batchedSessionAttributes = queue.reduce((res, next) => { + if (!res[next.sessionId]) { + res[next.sessionId] = next.attributes; + } else { + res[next.sessionId] = { + ...res[next.sessionId], + ...next.attributes, + idMapping: { + ...res[next.sessionId].idMapping, + ...next.attributes.idMapping, + }, + }; + } + return res; + }, {} as { [sessionId: string]: Partial }); + + Object.keys(batchedSessionAttributes).forEach((sessionId) => { + const thisSession = queue.filter((s) => s.sessionId === sessionId); + this.updateOrCreate( + thisSession[0].deps, + thisSession[0].user, + sessionId, + batchedSessionAttributes[sessionId] + ) + .then(() => { + thisSession.forEach((s) => s.resolve()); + }) + .catch((e) => { + thisSession.forEach((s) => s.reject(e)); + }); + }); + }, + DEBOUNCE_UPDATE_OR_CREATE_WAIT, + { maxWait: DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT } + ); + private scheduleUpdateOrCreate = ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial + ): Promise => { + return new Promise((resolve, reject) => { + this.updateOrCreateBatchQueue.push({ deps, user, sessionId, attributes, resolve, reject }); + // TODO: this would be better if we'd debounce per sessionId + this.processUpdateOrCreateBatchQueue(); + }); + }; + + private updateOrCreate = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial, + retry: number = 1 + ): Promise | undefined> => { + const retryOnConflict = async (e: any) => { + this.logger.debug(`Conflict error | ${sessionId}`); + // Randomize sleep to spread updates out in case of conflicts + await sleep(100 + Math.random() * 50); + return await this.updateOrCreate(deps, user, sessionId, attributes, retry + 1); + }; + + this.logger.debug(`updateOrCreate | ${sessionId} | ${retry}`); + try { + return (await this.update( + deps, + user, + sessionId, + attributes + )) as SavedObject; + } catch (e) { + if (SavedObjectsErrorHelpers.isNotFoundError(e)) { + try { + this.logger.debug(`Object not found | ${sessionId}`); + return await this.create(deps, user, sessionId, attributes); + } catch (createError) { + if ( + SavedObjectsErrorHelpers.isConflictError(createError) && + retry < this.sessionConfig.maxUpdateRetries + ) { + return await retryOnConflict(createError); + } else { + this.logger.error(createError); + } + } + } else if ( + SavedObjectsErrorHelpers.isConflictError(e) && + retry < this.sessionConfig.maxUpdateRetries + ) { + return await retryOnConflict(e); + } else { + this.logger.error(e); + } + } + + return undefined; + }; + + public save = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + { + name, + appId, + locatorId, + initialState = {}, + restoreState = {}, + }: Partial + ) => { + if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); + if (!name) throw new Error('Name is required'); + if (!appId) throw new Error('AppId is required'); + if (!locatorId) throw new Error('locatorId is required'); + + return this.updateOrCreate(deps, user, sessionId, { + name, + appId, + locatorId, + initialState, + restoreState, + persisted: true, + }); + }; + + private create = ( + { savedObjectsClient }: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial + ) => { + this.logger.debug(`create | ${sessionId}`); + + const realmType = user?.authentication_realm.type; + const realmName = user?.authentication_realm.name; + const username = user?.username; + + return savedObjectsClient.create( + SEARCH_SESSION_TYPE, + { + sessionId, + status: SearchSessionStatus.IN_PROGRESS, + expires: new Date( + Date.now() + this.sessionConfig.defaultExpiration.asMilliseconds() + ).toISOString(), + created: new Date().toISOString(), + touched: new Date().toISOString(), + idMapping: {}, + persisted: false, + version: this.version, + realmType, + realmName, + username, + ...attributes, }, + { id: sessionId } + ); + }; + + public get = async ( + { savedObjectsClient }: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) => { + this.logger.debug(`get | ${sessionId}`); + const session = await savedObjectsClient.get( + SEARCH_SESSION_TYPE, + sessionId + ); + this.throwOnUserConflict(user, session); + return session; + }; + + public find = ( + { savedObjectsClient }: SearchSessionDependencies, + user: AuthenticatedUser | null, + options: Omit + ) => { + const userFilters = + user === null + ? [] + : [ + nodeBuilder.is( + `${SEARCH_SESSION_TYPE}.attributes.realmType`, + `${user.authentication_realm.type}` + ), + nodeBuilder.is( + `${SEARCH_SESSION_TYPE}.attributes.realmName`, + `${user.authentication_realm.name}` + ), + nodeBuilder.is(`${SEARCH_SESSION_TYPE}.attributes.username`, `${user.username}`), + ]; + const filterKueryNode = + typeof options.filter === 'string' ? fromKueryExpression(options.filter) : options.filter; + const filter = nodeBuilder.and(userFilters.concat(filterKueryNode ?? [])); + return savedObjectsClient.find({ + ...options, + filter, + type: SEARCH_SESSION_TYPE, + }); + }; + + public update = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial + ) => { + this.logger.debug(`update | ${sessionId}`); + if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); + await this.get(deps, user, sessionId); // Verify correct user + return deps.savedObjectsClient.update( + SEARCH_SESSION_TYPE, + sessionId, + { + ...attributes, + touched: new Date().toISOString(), + } + ); + }; + + public async extend( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + expires: Date + ) { + this.logger.debug(`extend | ${sessionId}`); + return this.update(deps, user, sessionId, { expires: expires.toISOString() }); + } + + public cancel = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) => { + this.logger.debug(`delete | ${sessionId}`); + return this.update(deps, user, sessionId, { + status: SearchSessionStatus.CANCELLED, + }); + }; + + public delete = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) => { + if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); + this.logger.debug(`delete | ${sessionId}`); + await this.get(deps, user, sessionId); // Verify correct user + return deps.savedObjectsClient.delete(SEARCH_SESSION_TYPE, sessionId); + }; + + /** + * Tracks the given search request/search ID in the saved session. + * @internal + */ + public trackId = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + searchRequest: IKibanaSearchRequest, + searchId: string, + { sessionId, strategy = ENHANCED_ES_SEARCH_STRATEGY }: ISearchOptions + ) => { + if (!this.sessionConfig.enabled || !sessionId || !searchId) return; + this.logger.debug(`trackId | ${sessionId} | ${searchId}`); + + let idMapping: Record = {}; + + if (searchRequest.params) { + const requestHash = createRequestHash(searchRequest.params); + const searchInfo = { + id: searchId, + strategy, + status: SearchStatus.IN_PROGRESS, + }; + idMapping = { [requestHash]: searchInfo }; + } + + await this.scheduleUpdateOrCreate(deps, user, sessionId, { idMapping }); + }; + + public async getSearchIdMapping( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) { + const searchSession = await this.get(deps, user, sessionId); + const searchIdMapping = new Map(); + Object.values(searchSession.attributes.idMapping).forEach((requestInfo) => { + searchIdMapping.set(requestInfo.id, requestInfo.strategy); }); + return searchIdMapping; } + + /** + * Look up an existing search ID that matches the given request in the given session so that the + * request can continue rather than restart. + * @internal + */ + public getId = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + searchRequest: IKibanaSearchRequest, + { sessionId, isStored, isRestore }: ISearchOptions + ) => { + if (!this.sessionConfig.enabled) { + throw new Error('Search sessions are disabled'); + } else if (!sessionId) { + throw new Error('Session ID is required'); + } else if (!isStored) { + throw new Error('Cannot get search ID from a session that is not stored'); + } else if (!isRestore) { + throw new Error('Get search ID is only supported when restoring a session'); + } + + const session = await this.get(deps, user, sessionId); + const requestHash = createRequestHash(searchRequest.params); + if (!session.attributes.idMapping.hasOwnProperty(requestHash)) { + this.logger.error(`getId | ${sessionId} | ${requestHash} not found`); + throw new NoSearchIdInSessionError(); + } + this.logger.debug(`getId | ${sessionId} | ${requestHash}`); + + return session.attributes.idMapping[requestHash].id; + }; + + public asScopedProvider = ({ savedObjects }: CoreStart) => { + return (request: KibanaRequest) => { + const user = this.security?.authc.getCurrentUser(request) ?? null; + const savedObjectsClient = savedObjects.getScopedClient(request, { + includedHiddenTypes: [SEARCH_SESSION_TYPE], + }); + const deps = { savedObjectsClient }; + return { + getId: this.getId.bind(this, deps, user), + trackId: this.trackId.bind(this, deps, user), + getSearchIdMapping: this.getSearchIdMapping.bind(this, deps, user), + save: this.save.bind(this, deps, user), + get: this.get.bind(this, deps, user), + find: this.find.bind(this, deps, user), + update: this.update.bind(this, deps, user), + extend: this.extend.bind(this, deps, user), + cancel: this.cancel.bind(this, deps, user), + delete: this.delete.bind(this, deps, user), + getConfig: () => this.config.search.sessions, + }; + }; + }; + + private throwOnUserConflict = ( + user: AuthenticatedUser | null, + session?: SavedObject + ) => { + if (user === null || !session) return; + if ( + user.authentication_realm.type !== session.attributes.realmType || + user.authentication_realm.name !== session.attributes.realmName || + user.username !== session.attributes.username + ) { + this.logger.debug( + `User ${user.username} has no access to search session ${session.attributes.sessionId}` + ); + throw notFound(); + } + }; } diff --git a/x-pack/plugins/data_enhanced/server/search/session/setup_task.ts b/src/plugins/data/server/search/session/setup_task.ts similarity index 88% rename from x-pack/plugins/data_enhanced/server/search/session/setup_task.ts rename to src/plugins/data/server/search/session/setup_task.ts index a8d47d5babd57..5fe44b0901b79 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/setup_task.ts +++ b/src/plugins/data/server/search/session/setup_task.ts @@ -1,17 +1,17 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { Duration } from 'moment'; import { filter, takeUntil } from 'rxjs/operators'; import { BehaviorSubject } from 'rxjs'; -import { RunContext, TaskRunCreatorFunction } from '@kbn/task-manager-plugin/server'; +import type { RunContext, TaskRunCreatorFunction } from '@kbn/task-manager-plugin/server'; import { CoreSetup, SavedObjectsClient } from '@kbn/core/server'; -import { SEARCH_SESSION_TYPE } from '@kbn/data-plugin/common'; -import { DataEnhancedStartDependencies } from '../../type'; +import { SEARCH_SESSION_TYPE } from '../../../common'; import { SearchSessionTaskSetupDeps, SearchSessionTaskStartDeps, @@ -19,7 +19,7 @@ import { } from './types'; export function searchSessionTaskRunner( - core: CoreSetup, + core: CoreSetup, deps: SearchSessionTaskSetupDeps, title: string, checkFn: SearchSessionTaskFn @@ -68,7 +68,7 @@ export function searchSessionTaskRunner( } export function registerSearchSessionsTask( - core: CoreSetup, + core: CoreSetup, deps: SearchSessionTaskSetupDeps, taskType: string, title: string, diff --git a/src/plugins/data/server/search/session/types.ts b/src/plugins/data/server/search/session/types.ts index 76c4cff37cfa2..e564a8cef9e79 100644 --- a/src/plugins/data/server/search/session/types.ts +++ b/src/plugins/data/server/search/session/types.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { Observable } from 'rxjs'; import { CoreStart, KibanaRequest, @@ -13,9 +14,17 @@ import { SavedObjectsFindOptions, SavedObjectsFindResponse, SavedObjectsUpdateResponse, + ElasticsearchClient, + Logger, + SavedObjectsClientContract, } from '@kbn/core/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import { KueryNode, SearchSessionSavedObjectAttributes } from '../../../common'; import { IKibanaSearchRequest, ISearchOptions } from '../../../common/search'; -import { SearchSessionsConfigSchema } from '../../../config'; +import { SearchSessionsConfigSchema, ConfigSchema } from '../../../config'; export interface IScopedSearchSessionsClient { getId: (request: IKibanaSearchRequest, options: ISearchOptions) => Promise; @@ -38,3 +47,44 @@ export interface IScopedSearchSessionsClient { export interface ISearchSessionService { asScopedProvider: (core: CoreStart) => (request: KibanaRequest) => IScopedSearchSessionsClient; } + +export enum SearchStatus { + IN_PROGRESS = 'in_progress', + ERROR = 'error', + COMPLETE = 'complete', +} + +export interface CheckSearchSessionsDeps { + savedObjectsClient: SavedObjectsClientContract; + client: ElasticsearchClient; + logger: Logger; +} + +export interface SearchSessionTaskSetupDeps { + taskManager: TaskManagerSetupContract; + logger: Logger; + config: ConfigSchema; +} + +export interface SearchSessionTaskStartDeps { + taskManager: TaskManagerStartContract; + logger: Logger; + config: ConfigSchema; +} + +export type SearchSessionTaskFn = ( + deps: CheckSearchSessionsDeps, + config: SearchSessionsConfigSchema +) => Observable; + +export type SearchSessionsResponse = SavedObjectsFindResponse< + SearchSessionSavedObjectAttributes, + unknown +>; + +export type CheckSearchSessionsFn = ( + deps: CheckSearchSessionsDeps, + config: SearchSessionsConfigSchema, + filter: KueryNode, + page: number +) => Observable; diff --git a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.test.ts b/src/plugins/data/server/search/session/update_session_status.test.ts similarity index 97% rename from x-pack/plugins/data_enhanced/server/search/session/update_session_status.test.ts rename to src/plugins/data/server/search/session/update_session_status.test.ts index 03bdad773f647..38e8ec6cad150 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.test.ts +++ b/src/plugins/data/server/search/session/update_session_status.test.ts @@ -1,12 +1,13 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 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 { bulkUpdateSessions, updateSessionStatus } from './update_session_status'; -import { SearchSessionStatus, SearchSessionSavedObjectAttributes } from '@kbn/data-plugin/common'; +import { SearchSessionStatus, SearchSessionSavedObjectAttributes } from '../../../common'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import { SearchStatus } from './types'; import moment from 'moment'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.ts b/src/plugins/data/server/search/session/update_session_status.ts similarity index 90% rename from x-pack/plugins/data_enhanced/server/search/session/update_session_status.ts rename to src/plugins/data/server/search/session/update_session_status.ts index 2f6ef6ab3fc53..e8405eb5427b0 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.ts +++ b/src/plugins/data/server/search/session/update_session_status.ts @@ -1,29 +1,26 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { SavedObjectsFindResult, SavedObjectsUpdateResponse } from '@kbn/core/server'; +import { SearchSessionsConfigSchema } from '../../../config'; import { SearchSessionRequestInfo, SearchSessionSavedObjectAttributes, SearchSessionStatus, -} from '@kbn/data-plugin/common'; +} from '../../../common'; import { getSearchStatus } from './get_search_status'; import { getSessionStatus } from './get_session_status'; -import { - CheckSearchSessionsDeps, - SearchSessionsConfig, - SearchSessionsResponse, - SearchStatus, -} from './types'; +import { CheckSearchSessionsDeps, SearchSessionsResponse, SearchStatus } from './types'; import { isSearchSessionExpired } from './utils'; export async function updateSessionStatus( { logger, client }: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, session: SavedObjectsFindResult ) { let sessionUpdated = false; @@ -85,7 +82,7 @@ export async function updateSessionStatus( export async function getAllSessionsStatusUpdates( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, searchSessions: SearchSessionsResponse ) { const updatedSessions = new Array>(); diff --git a/x-pack/plugins/data_enhanced/server/search/session/utils.test.ts b/src/plugins/data/server/search/session/utils.test.ts similarity index 75% rename from x-pack/plugins/data_enhanced/server/search/session/utils.test.ts rename to src/plugins/data/server/search/session/utils.test.ts index 9e142bf25a56a..fea5510f860d7 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/utils.test.ts +++ b/src/plugins/data/server/search/session/utils.test.ts @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { createRequestHash } from './utils'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/utils.ts b/src/plugins/data/server/search/session/utils.ts similarity index 78% rename from x-pack/plugins/data_enhanced/server/search/session/utils.ts rename to src/plugins/data/server/search/session/utils.ts index f7f3c3c17505b..241f8cbbfd029 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/utils.ts +++ b/src/plugins/data/server/search/session/utils.ts @@ -1,15 +1,16 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { createHash } from 'crypto'; import stringify from 'json-stable-stringify'; import { SavedObjectsFindResult } from '@kbn/core/server'; import moment from 'moment'; -import { SearchSessionSavedObjectAttributes } from '@kbn/data-plugin/common'; +import { SearchSessionSavedObjectAttributes } from '../../../common'; /** * Generate the hash for this request so that, in the future, this hash can be used to look up diff --git a/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts index 02ebd10f7cb07..741174ac01613 100644 --- a/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts @@ -11,10 +11,10 @@ import { tap } from 'rxjs/operators'; import type { Logger, SharedGlobalConfig } from '@kbn/core/server'; import { getKbnServerError, KbnServerError } from '@kbn/kibana-utils-plugin/server'; import type { ISearchStrategy } from '../../types'; -import type { SearchUsage } from '../../collectors'; +import type { SearchUsage } from '../../collectors/search'; import { getDefaultSearchParams, getShardTimeout } from './request_utils'; import { shimHitsTotal, toKibanaSearchResponse } from './response_utils'; -import { searchUsageObserver } from '../../collectors/usage'; +import { searchUsageObserver } from '../../collectors/search/usage'; export const esSearchStrategyProvider = ( config$: Observable, @@ -30,7 +30,7 @@ export const esSearchStrategyProvider = ( */ search: (request, { abortSignal, ...options }, { esClient, uiSettingsClient }) => { // Only default index pattern type is supported here. - // See data_enhanced for other type support. + // See ese for other type support. if (request.indexType) { throw new KbnServerError(`Unsupported index pattern type ${request.indexType}`, 400); } diff --git a/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts index 11229e99526db..450407800e7af 100644 --- a/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts @@ -26,7 +26,7 @@ import { getIgnoreThrottled, } from './request_utils'; import { toAsyncKibanaSearchResponse } from './response_utils'; -import { SearchUsage, searchUsageObserver } from '../../collectors'; +import { SearchUsage, searchUsageObserver } from '../../collectors/search'; import { getDefaultSearchParams, getShardTimeout, diff --git a/src/plugins/data/server/search/types.ts b/src/plugins/data/server/search/types.ts index 70e04e97ea169..2d2a10300ee69 100644 --- a/src/plugins/data/server/search/types.ts +++ b/src/plugins/data/server/search/types.ts @@ -26,12 +26,8 @@ import { SearchSourceService, } from '../../common/search'; import { AggsSetup, AggsStart } from './aggs'; -import { SearchUsage } from './collectors'; -import type { IScopedSearchSessionsClient, ISearchSessionService } from './session'; - -export interface SearchEnhancements { - sessionService: ISearchSessionService; -} +import { SearchUsage } from './collectors/search'; +import type { IScopedSearchSessionsClient } from './session'; export interface SearchStrategyDependencies { savedObjectsClient: SavedObjectsClientContract; @@ -60,11 +56,6 @@ export interface ISearchSetup { */ usage?: SearchUsage; - /** - * @internal - */ - __enhance: (enhancements: SearchEnhancements) => void; - searchSource: ReturnType; } diff --git a/src/plugins/data/tsconfig.json b/src/plugins/data/tsconfig.json index b618a047f375d..8f391fc15e871 100644 --- a/src/plugins/data/tsconfig.json +++ b/src/plugins/data/tsconfig.json @@ -13,6 +13,7 @@ "config.ts", "common/**/*.json", "public/**/*.json", + "../../../typings/index.d.ts" ], "references": [ { "path": "../../core/tsconfig.json" }, @@ -24,6 +25,9 @@ { "path": "../kibana_utils/tsconfig.json" }, { "path": "../kibana_react/tsconfig.json" }, { "path": "../field_formats/tsconfig.json" }, - { "path": "../data_views/tsconfig.json" } + { "path": "../data_views/tsconfig.json" }, + { "path": "../screenshot_mode/tsconfig.json" }, + { "path": "../../../x-pack/plugins/task_manager/tsconfig.json" }, + { "path": "../../../x-pack/plugins/security/tsconfig.json" } ] } diff --git a/src/plugins/es_ui_shared/kibana.json b/src/plugins/es_ui_shared/kibana.json index 1a4ff33674f95..c7fd36e0c1467 100644 --- a/src/plugins/es_ui_shared/kibana.json +++ b/src/plugins/es_ui_shared/kibana.json @@ -14,5 +14,5 @@ "static/forms/components", "static/forms/helpers/field_validators/types" ], - "requiredBundles": ["data", "kibanaReact"] + "requiredBundles": ["dataViews", "kibanaReact"] } diff --git a/src/plugins/es_ui_shared/public/indices/constants/index.ts b/src/plugins/es_ui_shared/public/indices/constants/index.ts index f7858c94dcab9..01bd15bedc26a 100644 --- a/src/plugins/es_ui_shared/public/indices/constants/index.ts +++ b/src/plugins/es_ui_shared/public/indices/constants/index.ts @@ -6,11 +6,11 @@ * Side Public License, v 1. */ -import { indexPatterns } from '@kbn/data-plugin/public'; +import { ILLEGAL_CHARACTERS_VISIBLE } from '@kbn/data-views-plugin/public'; -export const INDEX_ILLEGAL_CHARACTERS_VISIBLE = [...indexPatterns.ILLEGAL_CHARACTERS_VISIBLE, '*']; +export const INDEX_ILLEGAL_CHARACTERS_VISIBLE = [...ILLEGAL_CHARACTERS_VISIBLE, '*']; // Insert the comma into the middle, so it doesn't look as if it has grammatical meaning when // these characters are rendered in the UI. -const insertionIndex = Math.floor(indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.length / 2); +const insertionIndex = Math.floor(ILLEGAL_CHARACTERS_VISIBLE.length / 2); INDEX_ILLEGAL_CHARACTERS_VISIBLE.splice(insertionIndex, 0, ','); diff --git a/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts b/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts index 52cd12b09a32e..3edb6b2c0090a 100644 --- a/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts +++ b/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { indexPatterns } from '@kbn/data-plugin/public'; +import { validateDataView } from '@kbn/data-views-plugin/public'; import { ValidationFunc } from '../../hook_form_lib'; import { containsChars } from '../../../validators/string'; import { ERROR_CODE } from './types'; @@ -34,7 +34,7 @@ export const indexPatternField = } // Validate illegal characters - const errors = indexPatterns.validate(value); + const errors = validateDataView(value); if (errors.ILLEGAL_CHARACTERS) { return { diff --git a/src/plugins/es_ui_shared/tsconfig.json b/src/plugins/es_ui_shared/tsconfig.json index 38e6cf78f8f60..90459058eec71 100644 --- a/src/plugins/es_ui_shared/tsconfig.json +++ b/src/plugins/es_ui_shared/tsconfig.json @@ -15,6 +15,6 @@ ], "references": [ { "path": "../../core/tsconfig.json" }, - { "path": "../data/tsconfig.json" } + { "path": "../data_views/tsconfig.json" } ] } diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index ca9a57bb4462a..308be959ba67a 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -215,6 +215,19 @@ } } }, + "search-session": { + "properties": { + "transientCount": { + "type": "long" + }, + "persistedCount": { + "type": "long" + }, + "totalCount": { + "type": "long" + } + } + }, "sample-data": { "properties": { "installed": { diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index c4c9d86a4df2f..32fc3be58d39c 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -91,6 +91,20 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'unifiedSearch.autocomplete.valueSuggestions.tiers (array)', 'unifiedSearch.autocomplete.valueSuggestions.timeout (duration)', 'data.search.aggs.shardDelay.enabled (boolean)', + 'data.search.sessions.cleanupInterval (duration)', + 'data.search.sessions.defaultExpiration (duration)', + 'data.search.sessions.enabled (boolean)', + 'data.search.sessions.expireInterval (duration)', + 'data.search.sessions.management.expiresSoonWarning (duration)', + 'data.search.sessions.management.maxSessions (number)', + 'data.search.sessions.management.refreshInterval (duration)', + 'data.search.sessions.management.refreshTimeout (duration)', + 'data.search.sessions.maxUpdateRetries (number)', + 'data.search.sessions.monitoringTaskTimeout (duration)', + 'data.search.sessions.notTouchedInProgressTimeout (duration)', + 'data.search.sessions.notTouchedTimeout (duration)', + 'data.search.sessions.pageSize (number)', + 'data.search.sessions.trackingInterval (duration)', 'enterpriseSearch.host (string)', 'home.disableWelcomeScreen (boolean)', 'map.emsFileApiUrl (string)', @@ -154,20 +168,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.cloud.id (string)', 'xpack.cloud.organization_url (string)', 'xpack.cloud.profile_url (string)', - 'xpack.data_enhanced.search.sessions.cleanupInterval (duration)', - 'xpack.data_enhanced.search.sessions.defaultExpiration (duration)', - 'xpack.data_enhanced.search.sessions.enabled (boolean)', - 'xpack.data_enhanced.search.sessions.expireInterval (duration)', - 'xpack.data_enhanced.search.sessions.management.expiresSoonWarning (duration)', - 'xpack.data_enhanced.search.sessions.management.maxSessions (number)', - 'xpack.data_enhanced.search.sessions.management.refreshInterval (duration)', - 'xpack.data_enhanced.search.sessions.management.refreshTimeout (duration)', - 'xpack.data_enhanced.search.sessions.maxUpdateRetries (number)', - 'xpack.data_enhanced.search.sessions.monitoringTaskTimeout (duration)', - 'xpack.data_enhanced.search.sessions.notTouchedInProgressTimeout (duration)', - 'xpack.data_enhanced.search.sessions.notTouchedTimeout (duration)', - 'xpack.data_enhanced.search.sessions.pageSize (number)', - 'xpack.data_enhanced.search.sessions.trackingInterval (duration)', 'xpack.discoverEnhanced.actions.exploreDataInChart.enabled (boolean)', 'xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled (boolean)', 'xpack.fleet.agents.enabled (boolean)', diff --git a/test/scripts/jenkins_storybook.sh b/test/scripts/jenkins_storybook.sh index e03494e13677d..a07a634d2dba2 100755 --- a/test/scripts/jenkins_storybook.sh +++ b/test/scripts/jenkins_storybook.sh @@ -10,7 +10,7 @@ yarn storybook --site ci_composite yarn storybook --site custom_integrations yarn storybook --site dashboard yarn storybook --site dashboard_enhanced -yarn storybook --site data_enhanced +yarn storybook --site data yarn storybook --site embeddable yarn storybook --site expression_error yarn storybook --site expression_image diff --git a/tsconfig.base.json b/tsconfig.base.json index ac35847201b7f..78023a603276a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -295,8 +295,6 @@ "@kbn/cross-cluster-replication-plugin/*": ["x-pack/plugins/cross_cluster_replication/*"], "@kbn/dashboard-enhanced-plugin": ["x-pack/plugins/dashboard_enhanced"], "@kbn/dashboard-enhanced-plugin/*": ["x-pack/plugins/dashboard_enhanced/*"], - "@kbn/data-enhanced-plugin": ["x-pack/plugins/data_enhanced"], - "@kbn/data-enhanced-plugin/*": ["x-pack/plugins/data_enhanced/*"], "@kbn/data-visualizer-plugin": ["x-pack/plugins/data_visualizer"], "@kbn/data-visualizer-plugin/*": ["x-pack/plugins/data_visualizer/*"], "@kbn/discover-enhanced-plugin": ["x-pack/plugins/discover_enhanced"], diff --git a/tsconfig.types.json b/tsconfig.types.json index 54a26b6aca404..0217a2cde12bb 100644 --- a/tsconfig.types.json +++ b/tsconfig.types.json @@ -7,17 +7,11 @@ "declaration": true, "emitDeclarationOnly": true, "declarationMap": true, + "rootDir": "./src" }, "include": [ "src/core/server/index.ts", "src/core/public/index.ts", - "src/plugins/data/server/index.ts", - "src/plugins/data/public/index.ts", - "src/plugins/embeddable/server/index.ts", - "src/plugins/embeddable/public/index.ts", - "src/plugins/expressions/server/index.ts", - "src/plugins/expressions/public/index.ts", - "src/plugins/ui_actions/public/index.ts", "typings" ] } diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index a632593f8b96b..b1464f5cfbe2e 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -14,7 +14,6 @@ "xpack.dashboard": "plugins/dashboard_enhanced", "xpack.discover": "plugins/discover_enhanced", "xpack.crossClusterReplication": "plugins/cross_cluster_replication", - "xpack.data": "plugins/data_enhanced", "xpack.embeddableEnhanced": "plugins/embeddable_enhanced", "xpack.endpoint": "plugins/endpoint", "xpack.enterpriseSearch": "plugins/enterprise_search", diff --git a/x-pack/plugins/actions/tsconfig.json b/x-pack/plugins/actions/tsconfig.json index aad127a6ca94c..6fced06e2057f 100644 --- a/x-pack/plugins/actions/tsconfig.json +++ b/x-pack/plugins/actions/tsconfig.json @@ -15,6 +15,7 @@ ], "references": [ { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../spaces/tsconfig.json" }, { "path": "../security/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, diff --git a/x-pack/plugins/data_enhanced/README.md b/x-pack/plugins/data_enhanced/README.md deleted file mode 100644 index fba484261fea2..0000000000000 --- a/x-pack/plugins/data_enhanced/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# data_enhanced - -The `data_enhanced` plugin is the x-pack counterpart to the `src/plguins/data` plugin. - -It exists to provide services, or parts of services, which -enhance existing functionality from `src/plugins/data`. - -Currently, the `data_enhanced` plugin doesn't return any APIs which you can -consume directly, however it is possible that you are indirectly relying on the -enhanced functionality that it provides via the `data` plugin from `src/`. - -Here is the functionality it adds: - -## Search Sessions - -Search sessions are handy when you want to enable a user to run something asynchronously (for example, a dashboard over a long period of time), and then quickly restore the results at a later time. The Search Service transparently fetches results from the .async-search index, instead of running each request again. diff --git a/x-pack/plugins/data_enhanced/common/index.ts b/x-pack/plugins/data_enhanced/common/index.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/data_enhanced/common/index.ts +++ /dev/null @@ -1,6 +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. - */ diff --git a/x-pack/plugins/data_enhanced/common/search/index.ts b/x-pack/plugins/data_enhanced/common/search/index.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/data_enhanced/common/search/index.ts +++ /dev/null @@ -1,6 +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. - */ diff --git a/x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json b/x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json deleted file mode 100644 index b79a396445e3d..0000000000000 --- a/x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "error": { - "root_cause": [ - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "parse_exception", - "reason": "failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]: [failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]]" - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - } - ], - "type": "search_phase_execution_exception", - "reason": "all shards failed", - "phase": "query", - "grouped": true, - "failed_shards": [ - { - "shard": 0, - "index": ".apm-agent-configuration", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".apm-custom-link", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".kibana-event-log-8.0.0-000001", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "parse_exception", - "reason": "failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]: [failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]]", - "caused_by": { - "type": "illegal_argument_exception", - "reason": "failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]", - "caused_by": { - "type": "date_time_parse_exception", - "reason": "Text '2021-01-19T12:2755.047Z' could not be parsed, unparsed text found at index 16" - } - } - } - }, - { - "shard": 0, - "index": ".kibana_1", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".kibana_task_manager_1", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".security-7", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - } - ] - }, - "status": 400 -} \ No newline at end of file diff --git a/x-pack/plugins/data_enhanced/config.ts b/x-pack/plugins/data_enhanced/config.ts deleted file mode 100644 index eb3ee0da41839..0000000000000 --- a/x-pack/plugins/data_enhanced/config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { schema, TypeOf } from '@kbn/config-schema'; -import { searchSessionsConfigSchema } from '@kbn/data-plugin/config'; - -export const configSchema = schema.object({ - search: schema.object({ - sessions: searchSessionsConfigSchema, - }), -}); - -export type ConfigSchema = TypeOf; diff --git a/x-pack/plugins/data_enhanced/jest.config.js b/x-pack/plugins/data_enhanced/jest.config.js deleted file mode 100644 index e48de352c2075..0000000000000 --- a/x-pack/plugins/data_enhanced/jest.config.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -module.exports = { - preset: '@kbn/test', - rootDir: '../../..', - roots: ['/x-pack/plugins/data_enhanced'], - coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/data_enhanced', - coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/x-pack/plugins/data_enhanced/{common,public,server}/**/*.{ts,tsx}', - ], -}; diff --git a/x-pack/plugins/data_enhanced/kibana.json b/x-pack/plugins/data_enhanced/kibana.json deleted file mode 100644 index d89e76013ebd4..0000000000000 --- a/x-pack/plugins/data_enhanced/kibana.json +++ /dev/null @@ -1,29 +0,0 @@ - -{ - "id": "dataEnhanced", - "version": "8.0.0", - "kibanaVersion": "kibana", - "owner": { - "name": "App Services", - "githubTeam": "kibana-app-services" - }, - "configPath": ["xpack", "data_enhanced"], - "requiredPlugins": [ - "bfetch", - "data", - "features", - "management", - "share", - "taskManager", - "screenshotMode" - ], - "optionalPlugins": ["kibanaUtils", "usageCollection", "security"], - "server": true, - "ui": true, - "requiredBundles": ["kibanaUtils", "kibanaReact"], - "owner": { - "name": "App Services", - "githubTeam": "kibana-app-services" - }, - "description": "Enhanced data plugin. (See src/plugins/data.) Enhances the main data plugin with a search session management UI. Includes a reusable search session indicator component to use in other applications. Exposes routes for managing search sessions. Includes a service that monitors, updates, and cleans up search session saved objects." -} diff --git a/x-pack/plugins/data_enhanced/public/index.ts b/x-pack/plugins/data_enhanced/public/index.ts deleted file mode 100644 index 7af1aff1b3106..0000000000000 --- a/x-pack/plugins/data_enhanced/public/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { PluginInitializerContext } from '@kbn/core/public'; -import { DataEnhancedPlugin, DataEnhancedSetup, DataEnhancedStart } from './plugin'; -import { ConfigSchema } from '../config'; - -export const plugin = (initializerContext: PluginInitializerContext) => - new DataEnhancedPlugin(initializerContext); - -export type { DataEnhancedSetup, DataEnhancedStart }; - -export { ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common'; diff --git a/x-pack/plugins/data_enhanced/public/plugin.ts b/x-pack/plugins/data_enhanced/public/plugin.ts deleted file mode 100644 index f1bb9d7b4b4b6..0000000000000 --- a/x-pack/plugins/data_enhanced/public/plugin.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import moment from 'moment'; -import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; -import { - DataPublicPluginSetup, - DataPublicPluginStart, - SearchUsageCollector, -} from '@kbn/data-plugin/public'; -import { BfetchPublicSetup } from '@kbn/bfetch-plugin/public'; -import { ManagementSetup } from '@kbn/management-plugin/public'; -import { SharePluginStart } from '@kbn/share-plugin/public'; - -import { toMountPoint } from '@kbn/kibana-react-plugin/public'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { ScreenshotModePluginStart } from '@kbn/screenshot-mode-plugin/public'; -import { registerSearchSessionsMgmt } from './search/sessions_mgmt'; -import { createConnectedSearchSessionIndicator } from './search'; -import { ConfigSchema } from '../config'; - -export interface DataEnhancedSetupDependencies { - bfetch: BfetchPublicSetup; - data: DataPublicPluginSetup; - management: ManagementSetup; -} -export interface DataEnhancedStartDependencies { - data: DataPublicPluginStart; - share: SharePluginStart; - screenshotMode: ScreenshotModePluginStart; -} - -export type DataEnhancedSetup = ReturnType; -export type DataEnhancedStart = ReturnType; - -export class DataEnhancedPlugin - implements Plugin -{ - private config!: ConfigSchema; - private readonly storage = new Storage(window.localStorage); - private usageCollector?: SearchUsageCollector; - - constructor(private initializerContext: PluginInitializerContext) {} - - public setup( - core: CoreSetup, - { bfetch, data, management }: DataEnhancedSetupDependencies - ) { - this.config = this.initializerContext.config.get(); - if (this.config.search.sessions.enabled) { - const sessionsConfig = this.config.search.sessions; - registerSearchSessionsMgmt( - core, - sessionsConfig, - this.initializerContext.env.packageInfo.version, - { data, management } - ); - } - - this.usageCollector = data.search.usageCollector; - } - - public start(core: CoreStart, plugins: DataEnhancedStartDependencies) { - if (this.config.search.sessions.enabled) { - core.chrome.setBreadcrumbsAppendExtension({ - content: toMountPoint( - React.createElement( - createConnectedSearchSessionIndicator({ - sessionService: plugins.data.search.session, - application: core.application, - basePath: core.http.basePath, - storage: this.storage, - disableSaveAfterSessionCompletesTimeout: moment - .duration(this.config.search.sessions.notTouchedTimeout) - .asMilliseconds(), - usageCollector: this.usageCollector, - tourDisabled: plugins.screenshotMode.isScreenshotMode(), - }) - ), - { theme$: core.theme.theme$ } - ), - }); - } - } - - public stop() {} -} diff --git a/x-pack/plugins/data_enhanced/public/search/index.ts b/x-pack/plugins/data_enhanced/public/search/index.ts deleted file mode 100644 index 84e70f41d6746..0000000000000 --- a/x-pack/plugins/data_enhanced/public/search/index.ts +++ /dev/null @@ -1,8 +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. - */ - -export * from './ui'; diff --git a/x-pack/plugins/data_enhanced/server/index.ts b/x-pack/plugins/data_enhanced/server/index.ts deleted file mode 100644 index a56f7216c4706..0000000000000 --- a/x-pack/plugins/data_enhanced/server/index.ts +++ /dev/null @@ -1,25 +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 { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server'; -import { EnhancedDataServerPlugin } from './plugin'; -import { configSchema, ConfigSchema } from '../config'; - -export const config: PluginConfigDescriptor = { - exposeToBrowser: { - search: true, - }, - schema: configSchema, -}; - -export function plugin(initializerContext: PluginInitializerContext) { - return new EnhancedDataServerPlugin(initializerContext); -} - -export { ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common'; - -export { EnhancedDataServerPlugin as Plugin }; diff --git a/x-pack/plugins/data_enhanced/server/plugin.ts b/x-pack/plugins/data_enhanced/server/plugin.ts deleted file mode 100644 index 007764ec95f0c..0000000000000 --- a/x-pack/plugins/data_enhanced/server/plugin.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from '@kbn/core/server'; -import { registerSessionRoutes } from './routes'; -import { searchSessionSavedObjectType } from './saved_objects'; -import type { - DataEnhancedRequestHandlerContext, - DataEnhancedSetupDependencies as SetupDependencies, - DataEnhancedStartDependencies as StartDependencies, -} from './type'; -import { ConfigSchema } from '../config'; -import { registerUsageCollector } from './collectors'; -import { SearchSessionService } from './search'; - -export class EnhancedDataServerPlugin - implements Plugin -{ - private readonly logger: Logger; - private sessionService!: SearchSessionService; - private config: ConfigSchema; - - constructor(private initializerContext: PluginInitializerContext) { - this.logger = initializerContext.logger.get('data_enhanced'); - this.config = this.initializerContext.config.get(); - } - - public setup(core: CoreSetup, deps: SetupDependencies) { - core.savedObjects.registerType(searchSessionSavedObjectType); - - this.sessionService = new SearchSessionService( - this.logger, - this.config, - this.initializerContext.env.packageInfo.version, - deps.security - ); - - deps.data.__enhance({ - search: { - sessionService: this.sessionService, - }, - }); - - const router = core.http.createRouter(); - registerSessionRoutes(router, this.logger); - - this.sessionService.setup(core, { - taskManager: deps.taskManager, - }); - - if (deps.usageCollection) { - registerUsageCollector(deps.usageCollection, core.savedObjects.getKibanaIndex(), this.logger); - } - } - - public start(core: CoreStart, { taskManager }: StartDependencies) { - this.sessionService.start(core, { - taskManager, - }); - } - - public stop() { - this.sessionService.stop(); - } -} - -export { EnhancedDataServerPlugin as Plugin }; diff --git a/x-pack/plugins/data_enhanced/server/routes/index.ts b/x-pack/plugins/data_enhanced/server/routes/index.ts deleted file mode 100644 index 0430d283667d0..0000000000000 --- a/x-pack/plugins/data_enhanced/server/routes/index.ts +++ /dev/null @@ -1,8 +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. - */ - -export * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/search/index.ts b/x-pack/plugins/data_enhanced/server/search/index.ts deleted file mode 100644 index 0430d283667d0..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/index.ts +++ /dev/null @@ -1,8 +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. - */ - -export * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/index.ts b/x-pack/plugins/data_enhanced/server/search/session/index.ts deleted file mode 100644 index 1e6841211bb66..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/session/index.ts +++ /dev/null @@ -1,8 +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. - */ - -export * from './session_service'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/session_service.ts b/x-pack/plugins/data_enhanced/server/search/session/session_service.ts deleted file mode 100644 index a22e559ecd142..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/session/session_service.ts +++ /dev/null @@ -1,548 +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 { notFound } from '@hapi/boom'; -import { debounce } from 'lodash'; -import { nodeBuilder, fromKueryExpression } from '@kbn/es-query'; -import { - CoreSetup, - CoreStart, - KibanaRequest, - SavedObjectsClientContract, - Logger, - SavedObject, - SavedObjectsFindOptions, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; -import { - IKibanaSearchRequest, - ISearchOptions, - ENHANCED_ES_SEARCH_STRATEGY, - SEARCH_SESSION_TYPE, -} from '@kbn/data-plugin/common'; -import { ISearchSessionService, NoSearchIdInSessionError } from '@kbn/data-plugin/server'; -import { AuthenticatedUser, SecurityPluginSetup } from '@kbn/security-plugin/server'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; -import { - SearchSessionRequestInfo, - SearchSessionSavedObjectAttributes, - SearchSessionStatus, -} from '@kbn/data-plugin/common'; -import { createRequestHash } from './utils'; -import { ConfigSchema } from '../../../config'; -import { - registerSearchSessionsTask, - scheduleSearchSessionsTask, - unscheduleSearchSessionsTask, -} from './setup_task'; -import { SearchSessionsConfig, SearchStatus } from './types'; -import { DataEnhancedStartDependencies } from '../../type'; -import { - checkPersistedSessionsProgress, - SEARCH_SESSIONS_TASK_ID, - SEARCH_SESSIONS_TASK_TYPE, -} from './check_persisted_sessions'; -import { - SEARCH_SESSIONS_CLEANUP_TASK_TYPE, - checkNonPersistedSessions, - SEARCH_SESSIONS_CLEANUP_TASK_ID, -} from './check_non_persisted_sessions'; -import { - SEARCH_SESSIONS_EXPIRE_TASK_TYPE, - SEARCH_SESSIONS_EXPIRE_TASK_ID, - checkPersistedCompletedSessionExpiration, -} from './expire_persisted_sessions'; - -export interface SearchSessionDependencies { - savedObjectsClient: SavedObjectsClientContract; -} -interface SetupDependencies { - taskManager: TaskManagerSetupContract; -} - -interface StartDependencies { - taskManager: TaskManagerStartContract; -} - -const DEBOUNCE_UPDATE_OR_CREATE_WAIT = 1000; -const DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT = 5000; - -interface UpdateOrCreateQueueEntry { - deps: SearchSessionDependencies; - user: AuthenticatedUser | null; - sessionId: string; - attributes: Partial; - resolve: () => void; - reject: (reason?: unknown) => void; -} - -function sleep(ms: number) { - return new Promise((r) => setTimeout(r, ms)); -} -export class SearchSessionService - implements ISearchSessionService -{ - private sessionConfig: SearchSessionsConfig; - private readonly updateOrCreateBatchQueue: UpdateOrCreateQueueEntry[] = []; - - constructor( - private readonly logger: Logger, - private readonly config: ConfigSchema, - private readonly version: string, - private readonly security?: SecurityPluginSetup - ) { - this.sessionConfig = this.config.search.sessions; - } - - public setup(core: CoreSetup, deps: SetupDependencies) { - const taskDeps = { - config: this.config, - taskManager: deps.taskManager, - logger: this.logger, - }; - - registerSearchSessionsTask( - core, - taskDeps, - SEARCH_SESSIONS_TASK_TYPE, - 'persisted session progress', - checkPersistedSessionsProgress - ); - - registerSearchSessionsTask( - core, - taskDeps, - SEARCH_SESSIONS_CLEANUP_TASK_TYPE, - 'non persisted session cleanup', - checkNonPersistedSessions - ); - - registerSearchSessionsTask( - core, - taskDeps, - SEARCH_SESSIONS_EXPIRE_TASK_TYPE, - 'complete session expiration', - checkPersistedCompletedSessionExpiration - ); - } - - public async start(core: CoreStart, deps: StartDependencies) { - return this.setupMonitoring(core, deps); - } - - public stop() {} - - private setupMonitoring = async (core: CoreStart, deps: StartDependencies) => { - const taskDeps = { - config: this.config, - taskManager: deps.taskManager, - logger: this.logger, - }; - - if (this.sessionConfig.enabled) { - scheduleSearchSessionsTask( - taskDeps, - SEARCH_SESSIONS_TASK_ID, - SEARCH_SESSIONS_TASK_TYPE, - this.sessionConfig.trackingInterval - ); - - scheduleSearchSessionsTask( - taskDeps, - SEARCH_SESSIONS_CLEANUP_TASK_ID, - SEARCH_SESSIONS_CLEANUP_TASK_TYPE, - this.sessionConfig.cleanupInterval - ); - - scheduleSearchSessionsTask( - taskDeps, - SEARCH_SESSIONS_EXPIRE_TASK_ID, - SEARCH_SESSIONS_EXPIRE_TASK_TYPE, - this.sessionConfig.expireInterval - ); - } else { - unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_TASK_ID); - unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_CLEANUP_TASK_ID); - unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_EXPIRE_TASK_ID); - } - }; - - private processUpdateOrCreateBatchQueue = debounce( - () => { - const queue = [...this.updateOrCreateBatchQueue]; - if (queue.length === 0) return; - this.updateOrCreateBatchQueue.length = 0; - const batchedSessionAttributes = queue.reduce((res, next) => { - if (!res[next.sessionId]) { - res[next.sessionId] = next.attributes; - } else { - res[next.sessionId] = { - ...res[next.sessionId], - ...next.attributes, - idMapping: { - ...res[next.sessionId].idMapping, - ...next.attributes.idMapping, - }, - }; - } - return res; - }, {} as { [sessionId: string]: Partial }); - - Object.keys(batchedSessionAttributes).forEach((sessionId) => { - const thisSession = queue.filter((s) => s.sessionId === sessionId); - this.updateOrCreate( - thisSession[0].deps, - thisSession[0].user, - sessionId, - batchedSessionAttributes[sessionId] - ) - .then(() => { - thisSession.forEach((s) => s.resolve()); - }) - .catch((e) => { - thisSession.forEach((s) => s.reject(e)); - }); - }); - }, - DEBOUNCE_UPDATE_OR_CREATE_WAIT, - { maxWait: DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT } - ); - private scheduleUpdateOrCreate = ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial - ): Promise => { - return new Promise((resolve, reject) => { - this.updateOrCreateBatchQueue.push({ deps, user, sessionId, attributes, resolve, reject }); - // TODO: this would be better if we'd debounce per sessionId - this.processUpdateOrCreateBatchQueue(); - }); - }; - - private updateOrCreate = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial, - retry: number = 1 - ): Promise | undefined> => { - const retryOnConflict = async (e: any) => { - this.logger.debug(`Conflict error | ${sessionId}`); - // Randomize sleep to spread updates out in case of conflicts - await sleep(100 + Math.random() * 50); - return await this.updateOrCreate(deps, user, sessionId, attributes, retry + 1); - }; - - this.logger.debug(`updateOrCreate | ${sessionId} | ${retry}`); - try { - return (await this.update( - deps, - user, - sessionId, - attributes - )) as SavedObject; - } catch (e) { - if (SavedObjectsErrorHelpers.isNotFoundError(e)) { - try { - this.logger.debug(`Object not found | ${sessionId}`); - return await this.create(deps, user, sessionId, attributes); - } catch (createError) { - if ( - SavedObjectsErrorHelpers.isConflictError(createError) && - retry < this.sessionConfig.maxUpdateRetries - ) { - return await retryOnConflict(createError); - } else { - this.logger.error(createError); - } - } - } else if ( - SavedObjectsErrorHelpers.isConflictError(e) && - retry < this.sessionConfig.maxUpdateRetries - ) { - return await retryOnConflict(e); - } else { - this.logger.error(e); - } - } - - return undefined; - }; - - public save = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - { - name, - appId, - locatorId, - initialState = {}, - restoreState = {}, - }: Partial - ) => { - if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); - if (!name) throw new Error('Name is required'); - if (!appId) throw new Error('AppId is required'); - if (!locatorId) throw new Error('locatorId is required'); - - return this.updateOrCreate(deps, user, sessionId, { - name, - appId, - locatorId, - initialState, - restoreState, - persisted: true, - }); - }; - - private create = ( - { savedObjectsClient }: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial - ) => { - this.logger.debug(`create | ${sessionId}`); - - const realmType = user?.authentication_realm.type; - const realmName = user?.authentication_realm.name; - const username = user?.username; - - return savedObjectsClient.create( - SEARCH_SESSION_TYPE, - { - sessionId, - status: SearchSessionStatus.IN_PROGRESS, - expires: new Date( - Date.now() + this.sessionConfig.defaultExpiration.asMilliseconds() - ).toISOString(), - created: new Date().toISOString(), - touched: new Date().toISOString(), - idMapping: {}, - persisted: false, - version: this.version, - realmType, - realmName, - username, - ...attributes, - }, - { id: sessionId } - ); - }; - - public get = async ( - { savedObjectsClient }: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) => { - this.logger.debug(`get | ${sessionId}`); - const session = await savedObjectsClient.get( - SEARCH_SESSION_TYPE, - sessionId - ); - this.throwOnUserConflict(user, session); - return session; - }; - - public find = ( - { savedObjectsClient }: SearchSessionDependencies, - user: AuthenticatedUser | null, - options: Omit - ) => { - const userFilters = - user === null - ? [] - : [ - nodeBuilder.is( - `${SEARCH_SESSION_TYPE}.attributes.realmType`, - `${user.authentication_realm.type}` - ), - nodeBuilder.is( - `${SEARCH_SESSION_TYPE}.attributes.realmName`, - `${user.authentication_realm.name}` - ), - nodeBuilder.is(`${SEARCH_SESSION_TYPE}.attributes.username`, `${user.username}`), - ]; - const filterKueryNode = - typeof options.filter === 'string' ? fromKueryExpression(options.filter) : options.filter; - const filter = nodeBuilder.and(userFilters.concat(filterKueryNode ?? [])); - return savedObjectsClient.find({ - ...options, - filter, - type: SEARCH_SESSION_TYPE, - }); - }; - - public update = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial - ) => { - this.logger.debug(`update | ${sessionId}`); - if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); - await this.get(deps, user, sessionId); // Verify correct user - return deps.savedObjectsClient.update( - SEARCH_SESSION_TYPE, - sessionId, - { - ...attributes, - touched: new Date().toISOString(), - } - ); - }; - - public async extend( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - expires: Date - ) { - this.logger.debug(`extend | ${sessionId}`); - return this.update(deps, user, sessionId, { expires: expires.toISOString() }); - } - - public cancel = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) => { - this.logger.debug(`delete | ${sessionId}`); - return this.update(deps, user, sessionId, { - status: SearchSessionStatus.CANCELLED, - }); - }; - - public delete = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) => { - if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); - this.logger.debug(`delete | ${sessionId}`); - await this.get(deps, user, sessionId); // Verify correct user - return deps.savedObjectsClient.delete(SEARCH_SESSION_TYPE, sessionId); - }; - - /** - * Tracks the given search request/search ID in the saved session. - * @internal - */ - public trackId = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - searchRequest: IKibanaSearchRequest, - searchId: string, - { sessionId, strategy = ENHANCED_ES_SEARCH_STRATEGY }: ISearchOptions - ) => { - if (!this.sessionConfig.enabled || !sessionId || !searchId) return; - this.logger.debug(`trackId | ${sessionId} | ${searchId}`); - - let idMapping: Record = {}; - - if (searchRequest.params) { - const requestHash = createRequestHash(searchRequest.params); - const searchInfo = { - id: searchId, - strategy, - status: SearchStatus.IN_PROGRESS, - }; - idMapping = { [requestHash]: searchInfo }; - } - - await this.scheduleUpdateOrCreate(deps, user, sessionId, { idMapping }); - }; - - public async getSearchIdMapping( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) { - const searchSession = await this.get(deps, user, sessionId); - const searchIdMapping = new Map(); - Object.values(searchSession.attributes.idMapping).forEach((requestInfo) => { - searchIdMapping.set(requestInfo.id, requestInfo.strategy); - }); - return searchIdMapping; - } - - /** - * Look up an existing search ID that matches the given request in the given session so that the - * request can continue rather than restart. - * @internal - */ - public getId = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - searchRequest: IKibanaSearchRequest, - { sessionId, isStored, isRestore }: ISearchOptions - ) => { - if (!this.sessionConfig.enabled) { - throw new Error('Search sessions are disabled'); - } else if (!sessionId) { - throw new Error('Session ID is required'); - } else if (!isStored) { - throw new Error('Cannot get search ID from a session that is not stored'); - } else if (!isRestore) { - throw new Error('Get search ID is only supported when restoring a session'); - } - - const session = await this.get(deps, user, sessionId); - const requestHash = createRequestHash(searchRequest.params); - if (!session.attributes.idMapping.hasOwnProperty(requestHash)) { - this.logger.error(`getId | ${sessionId} | ${requestHash} not found`); - throw new NoSearchIdInSessionError(); - } - this.logger.debug(`getId | ${sessionId} | ${requestHash}`); - - return session.attributes.idMapping[requestHash].id; - }; - - public asScopedProvider = ({ savedObjects }: CoreStart) => { - return (request: KibanaRequest) => { - const user = this.security?.authc.getCurrentUser(request) ?? null; - const savedObjectsClient = savedObjects.getScopedClient(request, { - includedHiddenTypes: [SEARCH_SESSION_TYPE], - }); - const deps = { savedObjectsClient }; - return { - getId: this.getId.bind(this, deps, user), - trackId: this.trackId.bind(this, deps, user), - getSearchIdMapping: this.getSearchIdMapping.bind(this, deps, user), - save: this.save.bind(this, deps, user), - get: this.get.bind(this, deps, user), - find: this.find.bind(this, deps, user), - update: this.update.bind(this, deps, user), - extend: this.extend.bind(this, deps, user), - cancel: this.cancel.bind(this, deps, user), - delete: this.delete.bind(this, deps, user), - getConfig: () => this.config.search.sessions, - }; - }; - }; - - private throwOnUserConflict = ( - user: AuthenticatedUser | null, - session?: SavedObject - ) => { - if (user === null || !session) return; - if ( - user.authentication_realm.type !== session.attributes.realmType || - user.authentication_realm.name !== session.attributes.realmName || - user.username !== session.attributes.username - ) { - this.logger.debug( - `User ${user.username} has no access to search session ${session.attributes.sessionId}` - ); - throw notFound(); - } - }; -} diff --git a/x-pack/plugins/data_enhanced/server/search/session/types.ts b/x-pack/plugins/data_enhanced/server/search/session/types.ts deleted file mode 100644 index 37e1cb2486154..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/session/types.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - ElasticsearchClient, - Logger, - SavedObjectsClientContract, - SavedObjectsFindResponse, -} from '@kbn/core/server'; -import { Observable } from 'rxjs'; -import { KueryNode, SearchSessionSavedObjectAttributes } from '@kbn/data-plugin/common'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; -import { ConfigSchema } from '../../../config'; - -export enum SearchStatus { - IN_PROGRESS = 'in_progress', - ERROR = 'error', - COMPLETE = 'complete', -} - -export type SearchSessionsConfig = ConfigSchema['search']['sessions']; - -export interface CheckSearchSessionsDeps { - savedObjectsClient: SavedObjectsClientContract; - client: ElasticsearchClient; - logger: Logger; -} - -export interface SearchSessionTaskSetupDeps { - taskManager: TaskManagerSetupContract; - logger: Logger; - config: ConfigSchema; -} - -export interface SearchSessionTaskStartDeps { - taskManager: TaskManagerStartContract; - logger: Logger; - config: ConfigSchema; -} - -export type SearchSessionTaskFn = ( - deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig -) => Observable; - -export type SearchSessionsResponse = SavedObjectsFindResponse< - SearchSessionSavedObjectAttributes, - unknown ->; - -export type CheckSearchSessionsFn = ( - deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, - filter: KueryNode, - page: number -) => Observable; diff --git a/x-pack/plugins/data_enhanced/server/type.ts b/x-pack/plugins/data_enhanced/server/type.ts deleted file mode 100644 index df465cdbb381d..0000000000000 --- a/x-pack/plugins/data_enhanced/server/type.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { IRouter } from '@kbn/core/server'; -import type { DataRequestHandlerContext } from '@kbn/data-plugin/server'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; -import { - PluginSetup as DataPluginSetup, - PluginStart as DataPluginStart, -} from '@kbn/data-plugin/server'; -import { SecurityPluginSetup } from '@kbn/security-plugin/server'; -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; - -/** - * @internal - */ -export type DataEnhancedRequestHandlerContext = DataRequestHandlerContext; - -/** - * @internal - */ -export type DataEnhancedPluginRouter = IRouter; - -export interface DataEnhancedSetupDependencies { - data: DataPluginSetup; - usageCollection?: UsageCollectionSetup; - taskManager: TaskManagerSetupContract; - security?: SecurityPluginSetup; -} - -export interface DataEnhancedStartDependencies { - data: DataPluginStart; - taskManager: TaskManagerStartContract; -} diff --git a/x-pack/plugins/data_enhanced/tsconfig.json b/x-pack/plugins/data_enhanced/tsconfig.json deleted file mode 100644 index 5627951c3d9eb..0000000000000 --- a/x-pack/plugins/data_enhanced/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true, - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*", - "config.ts", - "../../../typings/**/*", - "common/search/test_data/*.json" - ], - "references": [ - { "path": "../../../src/core/tsconfig.json" }, - { "path": "../../../src/plugins/bfetch/tsconfig.json" }, - { "path": "../../../src/plugins/data/tsconfig.json" }, - { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, - { "path": "../../../src/plugins/kibana_utils/tsconfig.json" }, - { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, - { "path": "../../../src/plugins/management/tsconfig.json" }, - { "path": "../../../src/plugins/screenshot_mode/tsconfig.json"}, - { "path": "../security/tsconfig.json" }, - { "path": "../task_manager/tsconfig.json" }, - - { "path": "../features/tsconfig.json" }, - ] -} diff --git a/x-pack/plugins/infra/kibana.json b/x-pack/plugins/infra/kibana.json index 2eec94187900f..d9d432fc702e4 100644 --- a/x-pack/plugins/infra/kibana.json +++ b/x-pack/plugins/infra/kibana.json @@ -9,7 +9,6 @@ "spaces", "embeddable", "data", - "dataEnhanced", "dataViews", "visTypeTimeseries", "alerting", diff --git a/x-pack/plugins/infra/public/types.ts b/x-pack/plugins/infra/public/types.ts index ab7df75592712..b5147f343ea5b 100644 --- a/x-pack/plugins/infra/public/types.ts +++ b/x-pack/plugins/infra/public/types.ts @@ -20,7 +20,6 @@ import type { TriggersAndActionsUIPublicPluginSetup, TriggersAndActionsUIPublicPluginStart, } from '@kbn/triggers-actions-ui-plugin/public'; -import type { DataEnhancedSetup, DataEnhancedStart } from '@kbn/data-enhanced-plugin/public'; import { MlPluginSetup, MlPluginStart } from '@kbn/ml-plugin/public'; import type { ObservabilityPublicSetup, @@ -52,7 +51,6 @@ export interface InfraClientStartExports { } export interface InfraClientSetupDeps { - dataEnhanced: DataEnhancedSetup; home?: HomePublicPluginSetup; observability: ObservabilityPublicSetup; triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; @@ -64,7 +62,6 @@ export interface InfraClientSetupDeps { export interface InfraClientStartDeps { data: DataPublicPluginStart; - dataEnhanced: DataEnhancedStart; dataViews: DataViewsPublicPluginStart; observability: ObservabilityPublicStart; spaces: SpacesPluginStart; diff --git a/x-pack/plugins/infra/tsconfig.json b/x-pack/plugins/infra/tsconfig.json index b508b8fb6da80..370644367b441 100644 --- a/x-pack/plugins/infra/tsconfig.json +++ b/x-pack/plugins/infra/tsconfig.json @@ -24,7 +24,6 @@ { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, { "path": "../../../src/plugins/vis_types/timeseries/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../alerting/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../license_management/tsconfig.json" }, diff --git a/x-pack/plugins/osquery/kibana.json b/x-pack/plugins/osquery/kibana.json index 619bcbeed14f4..1ea8468529b85 100644 --- a/x-pack/plugins/osquery/kibana.json +++ b/x-pack/plugins/osquery/kibana.json @@ -12,7 +12,6 @@ "requiredPlugins": [ "actions", "data", - "dataEnhanced", "discover", "features", "navigation", diff --git a/x-pack/plugins/osquery/tsconfig.json b/x-pack/plugins/osquery/tsconfig.json index 5c70e5ffbb944..4eac1baa43d79 100644 --- a/x-pack/plugins/osquery/tsconfig.json +++ b/x-pack/plugins/osquery/tsconfig.json @@ -24,7 +24,6 @@ // requiredPlugins from ./kibana.json { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/navigation/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../fleet/tsconfig.json" }, // optionalPlugins from ./kibana.json diff --git a/x-pack/plugins/runtime_fields/public/types.ts b/x-pack/plugins/runtime_fields/public/types.ts index 3cd8506c01b10..b39e5e2ee5e6d 100644 --- a/x-pack/plugins/runtime_fields/public/types.ts +++ b/x-pack/plugins/runtime_fields/public/types.ts @@ -5,8 +5,6 @@ * 2.0. */ -import { DataPublicPluginStart } from '@kbn/data-plugin/public'; - import { RUNTIME_FIELD_TYPES } from './constants'; import { OpenRuntimeFieldEditorProps } from './load_editor'; @@ -24,9 +22,8 @@ export interface PluginStart {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface SetupPlugins {} -export interface StartPlugins { - data: DataPublicPluginStart; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface StartPlugins {} export type RuntimeType = typeof RUNTIME_FIELD_TYPES[number]; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index ae64ad4655ba5..72612904f1c08 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import type { Capabilities } from '@kbn/core/public'; import { coreMock, scopedHistoryMock } from '@kbn/core/public/mocks'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { KibanaFeature } from '@kbn/features-plugin/public'; import type { Space } from '@kbn/spaces-plugin/public'; import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; @@ -139,7 +139,7 @@ function getProps({ const rolesAPIClient = rolesAPIClientMock.create(); rolesAPIClient.getRole.mockResolvedValue(role); - const dataViews = dataPluginMock.createStartContract().dataViews; + const dataViews = dataViewPluginMocks.createStartContract(); // `undefined` titles can technically happen via import/export or other manual manipulation dataViews.getTitles = jest.fn().mockResolvedValue(['foo*', 'bar*', undefined]); @@ -352,7 +352,7 @@ describe('', () => { }); it('can render if index patterns are not available', async () => { - const dataViews = dataPluginMock.createStartContract().dataViews; + const dataViews = dataViewPluginMocks.createStartContract(); dataViews.getTitles = jest.fn().mockRejectedValue({ response: { status: 403 } }); const wrapper = mountWithIntl( diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx index 1cda335ace204..cc9803063b860 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx @@ -31,7 +31,7 @@ import type { NotificationsStart, ScopedHistory, } from '@kbn/core/public'; -import type { DataViewsContract } from '@kbn/data-plugin/public'; +import type { DataViewsContract } from '@kbn/data-views-plugin/public'; import type { KibanaFeature } from '@kbn/features-plugin/common'; import type { FeaturesPluginStart } from '@kbn/features-plugin/public'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/security_solution/kibana.json b/x-pack/plugins/security_solution/kibana.json index af0bd12303119..0c72f5af846d7 100644 --- a/x-pack/plugins/security_solution/kibana.json +++ b/x-pack/plugins/security_solution/kibana.json @@ -13,7 +13,6 @@ "alerting", "cases", "data", - "dataEnhanced", "embeddable", "eventLog", "features", diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts index 4addd9048a565..20a9ccbefa900 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts @@ -17,9 +17,9 @@ import { isPartialResponse, EqlSearchStrategyRequest, EqlSearchStrategyResponse, + EQL_SEARCH_STRATEGY, } from '@kbn/data-plugin/common'; import { AbortError } from '@kbn/kibana-utils-plugin/common'; -import { EQL_SEARCH_STRATEGY } from '@kbn/data-enhanced-plugin/public'; import * as i18n from '../translations'; import { useKibana } from '../../lib/kibana'; import { formatInspect, getEqlAggsData } from './helpers'; diff --git a/x-pack/plugins/security_solution/tsconfig.json b/x-pack/plugins/security_solution/tsconfig.json index 95aaeffad7f71..cc1656ace3c65 100644 --- a/x-pack/plugins/security_solution/tsconfig.json +++ b/x-pack/plugins/security_solution/tsconfig.json @@ -32,7 +32,6 @@ { "path": "../actions/tsconfig.json" }, { "path": "../alerting/tsconfig.json" }, { "path": "../cases/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../encrypted_saved_objects/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../fleet/tsconfig.json" }, diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 0ac826d27ea7b..a361c5fef7a40 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -4557,19 +4557,6 @@ } } }, - "search-session": { - "properties": { - "transientCount": { - "type": "long" - }, - "persistedCount": { - "type": "long" - }, - "totalCount": { - "type": "long" - } - } - }, "discoverEnhanced": { "properties": { "exploreDataInChartActionEnabled": { diff --git a/x-pack/plugins/timelines/kibana.json b/x-pack/plugins/timelines/kibana.json index 11adf42b3a6b4..77a5dcc699bdc 100644 --- a/x-pack/plugins/timelines/kibana.json +++ b/x-pack/plugins/timelines/kibana.json @@ -10,6 +10,6 @@ "extraPublicDirs": ["common"], "server": true, "ui": true, - "requiredPlugins": ["alerting", "cases", "data", "dataEnhanced", "kibanaReact", "kibanaUtils"], + "requiredPlugins": ["alerting", "cases", "data", "kibanaReact", "kibanaUtils"], "optionalPlugins": ["security"] } diff --git a/x-pack/plugins/timelines/tsconfig.json b/x-pack/plugins/timelines/tsconfig.json index 9677c0e64dd88..3063c1acda545 100644 --- a/x-pack/plugins/timelines/tsconfig.json +++ b/x-pack/plugins/timelines/tsconfig.json @@ -20,7 +20,6 @@ { "path": "../../../src/core/tsconfig.json" }, { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/home/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../cases/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 84fee5016b778..8179a03244e50 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -2621,6 +2621,107 @@ "data.searchSessions.sessionService.sessionObjectFetchError": "Échec de récupération des informations de la session de recherche", "data.triggers.applyFilterDescription": "Lorsque le filtre Kibana est appliqué. Peut être un filtre simple ou un filtre de plage.", "data.triggers.applyFilterTitle": "Appliquer le filtre", + "data.mgmt.searchSessions.actionDelete": "Supprimer", + "data.mgmt.searchSessions.actionExtend": "Étendre", + "data.mgmt.searchSessions.actionRename": "Modifier le nom", + "data.mgmt.searchSessions.actions.tooltip.moreActions": "Plus d'actions", + "data.mgmt.searchSessions.api.deleted": "La session de recherche a été supprimée.", + "data.mgmt.searchSessions.api.deletedError": "Impossible de supprimer la session de recherche !", + "data.mgmt.searchSessions.api.extended": "La session de recherche a été étendue.", + "data.mgmt.searchSessions.api.extendError": "Impossible d'étendre la session de recherche !", + "data.mgmt.searchSessions.api.fetchError": "Impossible d'actualiser la page !", + "data.mgmt.searchSessions.api.fetchTimeout": "La récupération des informations de la session de recherche a expiré après {timeout} secondes", + "data.mgmt.searchSessions.api.rename": "La session de recherche a été renommée", + "data.mgmt.searchSessions.api.renameError": "Impossible de renommer la session de recherche", + "data.mgmt.searchSessions.appTitle": "Sessions de recherche", + "data.mgmt.searchSessions.ariaLabel.moreActions": "Plus d'actions", + "data.mgmt.searchSessions.cancelModal.cancelButton": "Annuler", + "data.mgmt.searchSessions.cancelModal.deleteButton": "Supprimer", + "data.mgmt.searchSessions.cancelModal.message": "La suppression de la session de recherche \"{name}\" supprime tous les résultats mis en cache.", + "data.mgmt.searchSessions.cancelModal.title": "Supprimer la session de recherche", + "data.mgmt.searchSessions.extendModal.dontExtendButton": "Annuler", + "data.mgmt.searchSessions.extendModal.extendButton": "Étendre l'expiration", + "data.mgmt.searchSessions.extendModal.extendMessage": "L'expiration de la session de recherche \"{name}\" sera étendue jusqu'à {newExpires}.", + "data.mgmt.searchSessions.extendModal.title": "Étendre l'expiration de la session de recherche", + "data.mgmt.searchSessions.flyoutTitle": "Inspecter", + "data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "Documentation", + "data.mgmt.searchSessions.main.sectionDescription": "Gérez vos sessions de recherche enregistrées.", + "data.mgmt.searchSessions.main.sectionTitle": "Sessions de recherche", + "data.mgmt.searchSessions.renameModal.cancelButton": "Annuler", + "data.mgmt.searchSessions.renameModal.renameButton": "Enregistrer", + "data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "Nom de la session de recherche", + "data.mgmt.searchSessions.renameModal.title": "Modifier le nom de la session de recherche", + "data.mgmt.searchSessions.search.filterApp": "Application", + "data.mgmt.searchSessions.search.filterStatus": "Statut", + "data.mgmt.searchSessions.search.tools.refresh": "Actualiser", + "data.mgmt.searchSessions.status.expireDateUnknown": "inconnu", + "data.mgmt.searchSessions.status.expiresOn": "Expire le {expireDate}", + "data.mgmt.searchSessions.status.expiresSoonInDays": "Expire dans {numDays} jours", + "data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} jours", + "data.mgmt.searchSessions.status.expiresSoonInHours": "Cette session expire dans {numHours} heures", + "data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} heures", + "data.mgmt.searchSessions.status.label.cancelled": "Annulé", + "data.mgmt.searchSessions.status.label.complete": "Terminé", + "data.mgmt.searchSessions.status.label.error": "Erreur", + "data.mgmt.searchSessions.status.label.expired": "Expiré", + "data.mgmt.searchSessions.status.label.inProgress": "En cours", + "data.mgmt.searchSessions.status.message.cancelled": "Annulé par l'utilisateur", + "data.mgmt.searchSessions.status.message.createdOn": "Expire le {expireDate}", + "data.mgmt.searchSessions.status.message.error": "Erreur : {error}", + "data.mgmt.searchSessions.status.message.expiredOn": "Expiré le {expireDate}", + "data.mgmt.searchSessions.table.headerExpiration": "Expiration", + "data.mgmt.searchSessions.table.headerName": "Nom", + "data.mgmt.searchSessions.table.headerStarted": "Créé", + "data.mgmt.searchSessions.table.headerStatus": "Statut", + "data.mgmt.searchSessions.table.headerType": "Application", + "data.mgmt.searchSessions.table.notRestorableWarning": "La session de recherche va être de nouveau exécutée. Vous pouvez ensuite l'enregistrer pour une utilisation ultérieure.", + "data.mgmt.searchSessions.table.numSearches": "# recherches", + "data.mgmt.searchSessions.table.versionIncompatibleWarning": "Cette session de recherche a été créée dans une instance Kibana exécutant une version différente. Il se peut qu'elle ne soit pas correctement restaurée.", + "data.mgmt.searchSessions.table.mlAppName": "Machine Learning", + "data.search.statusError": "Recherche terminée avec un statut {errorCode}", + "data.search.statusThrow": "Le statut de la recherche a généré un statut d'erreur {message} ({errorCode})", + "data.searchSessionIndicator.cancelButtonText": "Arrêter la session", + "data.searchSessionIndicator.canceledDescriptionText": "Vous visualisez des données incomplètes", + "data.searchSessionIndicator.canceledIconAriaLabel": "La session de recherche s'est arrêtée", + "data.searchSessionIndicator.canceledTitleText": "La session de recherche s'est arrêtée", + "data.searchSessionIndicator.canceledTooltipText": "La session de recherche s'est arrêtée", + "data.searchSessionIndicator.canceledWhenText": "Arrêtée {when}", + "data.searchSessionIndicator.continueInBackgroundButtonText": "Enregistrer la session", + "data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "Vous ne disposez pas d'autorisations pour gérer les sessions de recherche", + "data.searchSessionIndicator.disabledDueToTimeoutMessage": "Les résultats de la session de recherche ont expiré.", + "data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "Vous pouvez retourner aux résultats terminés à partir de la page Gestion", + "data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "Session enregistrée en cours", + "data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "Session enregistrée en cours", + "data.searchSessionIndicator.loadingInTheBackgroundTitleText": "Session enregistrée en cours", + "data.searchSessionIndicator.loadingInTheBackgroundWhenText": "Débuté {when}", + "data.searchSessionIndicator.loadingResultsDescription": "Enregistrer votre session, poursuivre votre travail et retourner aux résultats terminés", + "data.searchSessionIndicator.loadingResultsIconAriaLabel": "Chargement de la session de recherche", + "data.searchSessionIndicator.loadingResultsIconTooltipText": "Chargement de la session de recherche", + "data.searchSessionIndicator.loadingResultsTitle": "Votre recherche prend un certain temps…", + "data.searchSessionIndicator.loadingResultsWhenText": "Débuté {when}", + "data.searchSessionIndicator.restoredDescriptionText": "Vous affichez des données mises en cache d'une plage temporelle spécifique. La modification de la plage temporelle ou des filtres entraînera la réexécution de la session", + "data.searchSessionIndicator.restoredResultsIconAriaLabel": "Session enregistrée restaurée", + "data.searchSessionIndicator.restoredResultsTooltipText": "Session de recherche restaurée", + "data.searchSessionIndicator.restoredTitleText": "Session de recherche restaurée", + "data.searchSessionIndicator.restoredWhenText": "Terminé {when}", + "data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "Vous pouvez retourner à ces résultats à partir de la page de gestion", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "Session enregistrée terminée", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "Session enregistrée terminée", + "data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "Session de recherche enregistrée", + "data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "Terminé {when}", + "data.searchSessionIndicator.resultsLoadedDescriptionText": "Enregistrer votre session pour y revenir ultérieurement", + "data.searchSessionIndicator.resultsLoadedIconAriaLabel": "Session de recherche terminée", + "data.searchSessionIndicator.resultsLoadedIconTooltipText": "Session de recherche terminée", + "data.searchSessionIndicator.resultsLoadedText": "Session de recherche terminée", + "data.searchSessionIndicator.resultsLoadedWhenText": "Terminé {when}", + "data.searchSessionIndicator.saveButtonText": "Enregistrer la session", + "data.searchSessionIndicator.viewSearchSessionsLinkText": "Gérer les sessions", + "data.searchSessionName.ariaLabelText": "Nom de la session de recherche", + "data.searchSessionName.editAriaLabelText": "Modifier le nom de la session de recherche", + "data.searchSessionName.placeholderText": "Entrer un nom pour la session de recherche", + "data.searchSessionName.saveButtonText": "Enregistrer", + "data.sessions.management.flyoutText": "Configuration de cette session de recherche", + "data.sessions.management.flyoutTitle": "Inspecter la session de recherche", "dataViews.deprecations.scriptedFields.manualStepOneMessage": "Accédez à Gestion de la Suite > Kibana > Vues de données.", "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "Mettez à jour les vues de données {numberOfIndexPatternsWithScriptedFields} qui ont des champs scriptés pour qu’elles utilisent des champs d’exécution. Dans la plupart des cas, pour migrer des scripts existants, vous devrez remplacer \"return ;\" par \"emit();\". Vues de données avec au moins un champ scripté : {allTitles}", "dataViews.deprecations.scriptedFieldsMessage": "Vous avez {numberOfIndexPatternsWithScriptedFields} vues de données ({titlesPreview}...) qui utilisent des champs scriptés. Les champs scriptés sont déclassés et seront supprimés à l’avenir. Utilisez plutôt des champs d’exécution.", @@ -2633,6 +2734,121 @@ "dataViews.unableWriteLabel": "Impossible d’écrire la vue de données ! Actualisez la page pour obtenir la dernière version de cette vue de données.", "devTools.badge.betaLabel": "Bêta", "devTools.badge.betaTooltipText": "Cette fonctionnalité pourra considérablement changer dans les futures versions", + "unifiedSearch.search.unableToGetSavedQueryToastTitle": "Impossible de charger la requête enregistrée {savedQueryId}", + "unifiedSearch.noDataPopover.content": "Cette plage temporelle ne contient pas de données. Étendez ou ajustez la plage temporelle pour obtenir plus de champs et pouvoir créer des graphiques.", + "unifiedSearch.noDataPopover.dismissAction": "Ne plus afficher", + "unifiedSearch.noDataPopover.subtitle": "Conseil", + "unifiedSearch.noDataPopover.title": "Ensemble de données vide", + "unifiedSearch.query.queryBar.clearInputLabel": "Effacer l'entrée", + "unifiedSearch.query.queryBar.comboboxAriaLabel": "Rechercher et filtrer la page {pageType}", + "unifiedSearch.query.queryBar.kqlFullLanguageName": "Langage de requête Kibana", + "unifiedSearch.query.queryBar.kqlLanguageName": "KQL", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoDocLinkText": "documents", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoOptOutText": "Ne plus afficher", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoText": "Il semblerait que votre requête porte sur un champ imbriqué. Selon le résultat visé, il existe plusieurs façons de construire une syntaxe KQL pour des requêtes imbriquées. Apprenez-en plus avec notre {link}.", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoTitle": "Syntaxe de requête imbriquée KQL", + "unifiedSearch.query.queryBar.kqlOffLabel": "Désactivé", + "unifiedSearch.query.queryBar.kqlOnLabel": "Activé", + "unifiedSearch.query.queryBar.languageSwitcher.toText": "Passer au langage de requête Kibana pour la recherche", + "unifiedSearch.query.queryBar.luceneLanguageName": "Lucene", + "unifiedSearch.query.queryBar.searchInputAriaLabel": "Commencer à taper pour rechercher et filtrer la page {pageType}", + "unifiedSearch.query.queryBar.searchInputPlaceholder": "Recherche", + "unifiedSearch.query.queryBar.syntaxOptionsDescription": "{docsLink} (KQL) offre une syntaxe de requête simplifiée et la prise en charge des champs scriptés. KQL offre également une fonctionnalité de saisie semi-automatique. Si vous désactivez KQL, {nonKqlModeHelpText}.", + "unifiedSearch.query.queryBar.syntaxOptionsDescription.nonKqlModeHelpText": "Kibana utilise Lucene.", + "unifiedSearch.search.searchBar.savedQueryDescriptionLabelText": "Description", + "unifiedSearch.search.searchBar.savedQueryDescriptionText": "Enregistrez le texte et les filtres de la requête que vous souhaitez réutiliser.", + "unifiedSearch.search.searchBar.savedQueryForm.titleConflictText": "Ce nom est en conflit avec une requête enregistrée existante.", + "unifiedSearch.search.searchBar.savedQueryFormCancelButtonText": "Annuler", + "unifiedSearch.search.searchBar.savedQueryFormSaveButtonText": "Enregistrer", + "unifiedSearch.search.searchBar.savedQueryFormTitle": "Enregistrer la requête", + "unifiedSearch.search.searchBar.savedQueryIncludeFiltersLabelText": "Inclure les filtres", + "unifiedSearch.search.searchBar.savedQueryIncludeTimeFilterLabelText": "Inclure le filtre temporel", + "unifiedSearch.search.searchBar.savedQueryNameHelpText": "Un nom est requis. Le nom ne peut pas contenir d'espace vide au début ou à la fin. Le nom doit être unique.", + "unifiedSearch.search.searchBar.savedQueryNameLabelText": "Nom", + "unifiedSearch.search.searchBar.savedQueryNoSavedQueriesText": "Aucune requête enregistrée.", + "unifiedSearch.search.searchBar.savedQueryPopoverButtonText": "Voir les requêtes enregistrées", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonAriaLabel": "Effacer la requête enregistrée en cours", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonText": "Effacer", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionCancelButtonText": "Annuler", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionConfirmButtonText": "Supprimer", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionTitle": "Supprimer \"{savedQueryName}\" ?", + "unifiedSearch.search.searchBar.savedQueryPopoverDeleteButtonAriaLabel": "Supprimer la requête enregistrée {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonAriaLabel": "Enregistrer en tant que nouvelle requête enregistrée", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonText": "Enregistrer en tant que nouvelle", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonAriaLabel": "Enregistrer une nouvelle requête enregistrée", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonText": "Enregistrer la requête en cours", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonAriaLabel": "Enregistrer les modifications apportées à {title}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonText": "Enregistrer les modifications", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemButtonAriaLabel": "Bouton de requête enregistrée {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemDescriptionAriaLabel": "Description de {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemSelectedButtonAriaLabel": "Bouton de requête enregistrée {savedQueryName} sélectionné. Appuyez pour effacer les modifications.", + "unifiedSearch.search.searchBar.savedQueryPopoverTitleText": "Requêtes enregistrées", + "unifiedSearch.query.queryBar.syntaxOptionsTitle": "Options de syntaxe", + "unifiedSearch.filter.applyFilterActionTitle": "Appliquer le filtre à la vue en cours", + "unifiedSearch.filter.applyFilters.popupHeader": "Sélectionner les filtres à appliquer", + "unifiedSearch.filter.applyFiltersPopup.cancelButtonLabel": "Annuler", + "unifiedSearch.filter.applyFiltersPopup.saveButtonLabel": "Appliquer", + "unifiedSearch.filter.filterBar.addFilterButtonLabel": "Ajouter un filtre", + "unifiedSearch.filter.filterBar.deleteFilterButtonLabel": "Supprimer", + "unifiedSearch.filter.filterBar.disabledFilterPrefix": "Désactivé", + "unifiedSearch.filter.filterBar.disableFilterButtonLabel": "Désactiver temporairement", + "unifiedSearch.filter.filterBar.editFilterButtonLabel": "Modifier le filtre", + "unifiedSearch.filter.filterBar.enableFilterButtonLabel": "Réactiver", + "unifiedSearch.filter.filterBar.excludeFilterButtonLabel": "Exclure les résultats", + "unifiedSearch.filter.filterBar.filterItemBadgeAriaLabel": "Actions de filtrage", + "unifiedSearch.filter.filterBar.filterItemBadgeIconAriaLabel": "Supprimer {filter}", + "unifiedSearch.filter.filterBar.includeFilterButtonLabel": "Inclure les résultats", + "unifiedSearch.filter.filterBar.indexPatternSelectPlaceholder": "Sélectionner un modèle d'indexation", + "unifiedSearch.filter.filterBar.labelErrorInfo": "Modèle d'indexation {indexPattern} introuvable", + "unifiedSearch.filter.filterBar.labelErrorText": "Erreur", + "unifiedSearch.filter.filterBar.labelWarningInfo": "Le champ {fieldName} n'existe pas dans la vue en cours.", + "unifiedSearch.filter.filterBar.labelWarningText": "Avertissement", + "unifiedSearch.filter.filterBar.moreFilterActionsMessage": "Filtre : {innerText}. Sélectionner pour plus d’actions de filtrage.", + "unifiedSearch.filter.filterBar.negatedFilterPrefix": "NON ", + "unifiedSearch.filter.filterBar.pinFilterButtonLabel": "Épingler dans toutes les applications", + "unifiedSearch.filter.filterBar.pinnedFilterPrefix": "Épinglé", + "unifiedSearch.filter.filterBar.unpinFilterButtonLabel": "Désépingler", + "unifiedSearch.filter.filterEditor.cancelButtonLabel": "Annuler", + "unifiedSearch.filter.filterEditor.createCustomLabelInputLabel": "Étiquette personnalisée", + "unifiedSearch.filter.filterEditor.createCustomLabelSwitchLabel": "Créer une étiquette personnalisée ?", + "unifiedSearch.filter.filterEditor.doesNotExistOperatorOptionLabel": "n'existe pas", + "unifiedSearch.filter.filterEditor.editFilterPopupTitle": "Modifier le filtre", + "unifiedSearch.filter.filterEditor.editFilterValuesButtonLabel": "Modifier les valeurs du filtre", + "unifiedSearch.filter.filterEditor.editQueryDslButtonLabel": "Modifier en tant que Query DSL", + "unifiedSearch.filter.filterEditor.existsOperatorOptionLabel": "existe", + "unifiedSearch.filter.filterEditor.falseOptionLabel": "false", + "unifiedSearch.filter.filterEditor.fieldSelectLabel": "Champ", + "unifiedSearch.filter.filterEditor.fieldSelectPlaceholder": "Sélectionner d'abord un champ", + "unifiedSearch.filter.filterEditor.indexPatternSelectLabel": "Modèle d'indexation", + "unifiedSearch.filter.filterEditor.isBetweenOperatorOptionLabel": "est entre", + "unifiedSearch.filter.filterEditor.isNotBetweenOperatorOptionLabel": "n'est pas entre", + "unifiedSearch.filter.filterEditor.isNotOneOfOperatorOptionLabel": "n'est pas l'une des options suivantes", + "unifiedSearch.filter.filterEditor.isNotOperatorOptionLabel": "n'est pas", + "unifiedSearch.filter.filterEditor.isOneOfOperatorOptionLabel": "est l'une des options suivantes", + "unifiedSearch.filter.filterEditor.isOperatorOptionLabel": "est", + "unifiedSearch.filter.filterEditor.operatorSelectLabel": "Opérateur", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderSelect": "Sélectionner", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderWaiting": "En attente", + "unifiedSearch.filter.filterEditor.queryDslLabel": "Query DSL d'Elasticsearch", + "unifiedSearch.filter.filterEditor.rangeEndInputPlaceholder": "Fin de la plage", + "unifiedSearch.filter.filterEditor.rangeInputLabel": "Plage", + "unifiedSearch.filter.filterEditor.rangeStartInputPlaceholder": "Début de la plage", + "unifiedSearch.filter.filterEditor.saveButtonLabel": "Enregistrer", + "unifiedSearch.filter.filterEditor.trueOptionLabel": "vrai", + "unifiedSearch.filter.filterEditor.valueInputLabel": "Valeur", + "unifiedSearch.filter.filterEditor.valueInputPlaceholder": "Saisir une valeur", + "unifiedSearch.filter.filterEditor.valueSelectPlaceholder": "Sélectionner une valeur", + "unifiedSearch.filter.filterEditor.valuesSelectLabel": "Valeurs", + "unifiedSearch.filter.filterEditor.valuesSelectPlaceholder": "Sélectionner des valeurs", + "unifiedSearch.filter.options.changeAllFiltersButtonLabel": "Changer tous les filtres", + "unifiedSearch.filter.options.deleteAllFiltersButtonLabel": "Tout supprimer", + "unifiedSearch.filter.options.disableAllFiltersButtonLabel": "Tout désactiver", + "unifiedSearch.filter.options.enableAllFiltersButtonLabel": "Tout activer", + "unifiedSearch.filter.options.invertDisabledFiltersButtonLabel": "Inverser l’activation/désactivation", + "unifiedSearch.filter.options.invertNegatedFiltersButtonLabel": "Inverser l'inclusion", + "unifiedSearch.filter.options.pinAllFiltersButtonLabel": "Tout épingler", + "unifiedSearch.filter.options.unpinAllFiltersButtonLabel": "Tout désépingler", + "unifiedSearch.filter.searchBar.changeAllFiltersTitle": "Changer tous les filtres", "devTools.badge.readOnly.text": "Lecture seule", "devTools.badge.readOnly.tooltip": "Enregistrement impossible", "devTools.breadcrumb.homeLabel": "Outils de développement", @@ -10077,107 +10293,6 @@ "xpack.dashboard.drilldown.goToDashboard": "Accéder au tableau de bord", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "Créer une recherche", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "Gérer les recherches", - "xpack.data.mgmt.searchSessions.actionDelete": "Supprimer", - "xpack.data.mgmt.searchSessions.actionExtend": "Étendre", - "xpack.data.mgmt.searchSessions.actionRename": "Modifier le nom", - "xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "Plus d'actions", - "xpack.data.mgmt.searchSessions.api.deleted": "La session de recherche a été supprimée.", - "xpack.data.mgmt.searchSessions.api.deletedError": "Impossible de supprimer la session de recherche !", - "xpack.data.mgmt.searchSessions.api.extended": "La session de recherche a été étendue.", - "xpack.data.mgmt.searchSessions.api.extendError": "Impossible d'étendre la session de recherche !", - "xpack.data.mgmt.searchSessions.api.fetchError": "Impossible d'actualiser la page !", - "xpack.data.mgmt.searchSessions.api.fetchTimeout": "La récupération des informations de la session de recherche a expiré après {timeout} secondes", - "xpack.data.mgmt.searchSessions.api.rename": "La session de recherche a été renommée", - "xpack.data.mgmt.searchSessions.api.renameError": "Impossible de renommer la session de recherche", - "xpack.data.mgmt.searchSessions.appTitle": "Sessions de recherche", - "xpack.data.mgmt.searchSessions.ariaLabel.moreActions": "Plus d'actions", - "xpack.data.mgmt.searchSessions.cancelModal.cancelButton": "Annuler", - "xpack.data.mgmt.searchSessions.cancelModal.deleteButton": "Supprimer", - "xpack.data.mgmt.searchSessions.cancelModal.message": "La suppression de la session de recherche \"{name}\" supprime tous les résultats mis en cache.", - "xpack.data.mgmt.searchSessions.cancelModal.title": "Supprimer la session de recherche", - "xpack.data.mgmt.searchSessions.extendModal.dontExtendButton": "Annuler", - "xpack.data.mgmt.searchSessions.extendModal.extendButton": "Étendre l'expiration", - "xpack.data.mgmt.searchSessions.extendModal.extendMessage": "L'expiration de la session de recherche \"{name}\" sera étendue jusqu'à {newExpires}.", - "xpack.data.mgmt.searchSessions.extendModal.title": "Étendre l'expiration de la session de recherche", - "xpack.data.mgmt.searchSessions.flyoutTitle": "Inspecter", - "xpack.data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "Documentation", - "xpack.data.mgmt.searchSessions.main.sectionDescription": "Gérez vos sessions de recherche enregistrées.", - "xpack.data.mgmt.searchSessions.main.sectionTitle": "Sessions de recherche", - "xpack.data.mgmt.searchSessions.renameModal.cancelButton": "Annuler", - "xpack.data.mgmt.searchSessions.renameModal.renameButton": "Enregistrer", - "xpack.data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "Nom de la session de recherche", - "xpack.data.mgmt.searchSessions.renameModal.title": "Modifier le nom de la session de recherche", - "xpack.data.mgmt.searchSessions.search.filterApp": "Application", - "xpack.data.mgmt.searchSessions.search.filterStatus": "Statut", - "xpack.data.mgmt.searchSessions.search.tools.refresh": "Actualiser", - "xpack.data.mgmt.searchSessions.status.expireDateUnknown": "inconnu", - "xpack.data.mgmt.searchSessions.status.expiresOn": "Expire le {expireDate}", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDays": "Expire dans {numDays} jours", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} jours", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHours": "Cette session expire dans {numHours} heures", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} heures", - "xpack.data.mgmt.searchSessions.status.label.cancelled": "Annulé", - "xpack.data.mgmt.searchSessions.status.label.complete": "Terminé", - "xpack.data.mgmt.searchSessions.status.label.error": "Erreur", - "xpack.data.mgmt.searchSessions.status.label.expired": "Expiré", - "xpack.data.mgmt.searchSessions.status.label.inProgress": "En cours", - "xpack.data.mgmt.searchSessions.status.message.cancelled": "Annulé par l'utilisateur", - "xpack.data.mgmt.searchSessions.status.message.createdOn": "Expire le {expireDate}", - "xpack.data.mgmt.searchSessions.status.message.error": "Erreur : {error}", - "xpack.data.mgmt.searchSessions.status.message.expiredOn": "Expiré le {expireDate}", - "xpack.data.mgmt.searchSessions.table.headerExpiration": "Expiration", - "xpack.data.mgmt.searchSessions.table.headerName": "Nom", - "xpack.data.mgmt.searchSessions.table.headerStarted": "Créé", - "xpack.data.mgmt.searchSessions.table.headerStatus": "Statut", - "xpack.data.mgmt.searchSessions.table.headerType": "Application", - "xpack.data.mgmt.searchSessions.table.mlAppName": "Machine Learning", - "xpack.data.mgmt.searchSessions.table.notRestorableWarning": "La session de recherche va être de nouveau exécutée. Vous pouvez ensuite l'enregistrer pour une utilisation ultérieure.", - "xpack.data.mgmt.searchSessions.table.numSearches": "# recherches", - "xpack.data.mgmt.searchSessions.table.versionIncompatibleWarning": "Cette session de recherche a été créée dans une instance Kibana exécutant une version différente. Il se peut qu'elle ne soit pas correctement restaurée.", - "xpack.data.search.statusError": "Recherche terminée avec un statut {errorCode}", - "xpack.data.search.statusThrow": "Le statut de la recherche a généré un statut d'erreur {message} ({errorCode})", - "xpack.data.searchSessionIndicator.cancelButtonText": "Arrêter la session", - "xpack.data.searchSessionIndicator.canceledDescriptionText": "Vous visualisez des données incomplètes", - "xpack.data.searchSessionIndicator.canceledIconAriaLabel": "La session de recherche s'est arrêtée", - "xpack.data.searchSessionIndicator.canceledTitleText": "La session de recherche s'est arrêtée", - "xpack.data.searchSessionIndicator.canceledTooltipText": "La session de recherche s'est arrêtée", - "xpack.data.searchSessionIndicator.canceledWhenText": "Arrêtée {when}", - "xpack.data.searchSessionIndicator.continueInBackgroundButtonText": "Enregistrer la session", - "xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "Vous ne disposez pas d'autorisations pour gérer les sessions de recherche", - "xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage": "Les résultats de la session de recherche ont expiré.", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "Vous pouvez retourner aux résultats terminés à partir de la page Gestion", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "Session enregistrée en cours", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "Session enregistrée en cours", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText": "Session enregistrée en cours", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText": "Débuté {when}", - "xpack.data.searchSessionIndicator.loadingResultsDescription": "Enregistrer votre session, poursuivre votre travail et retourner aux résultats terminés", - "xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel": "Chargement de la session de recherche", - "xpack.data.searchSessionIndicator.loadingResultsIconTooltipText": "Chargement de la session de recherche", - "xpack.data.searchSessionIndicator.loadingResultsTitle": "Votre recherche prend un certain temps…", - "xpack.data.searchSessionIndicator.loadingResultsWhenText": "Débuté {when}", - "xpack.data.searchSessionIndicator.restoredDescriptionText": "Vous affichez des données mises en cache d'une plage temporelle spécifique. La modification de la plage temporelle ou des filtres entraînera la réexécution de la session", - "xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel": "Session enregistrée restaurée", - "xpack.data.searchSessionIndicator.restoredResultsTooltipText": "Session de recherche restaurée", - "xpack.data.searchSessionIndicator.restoredTitleText": "Session de recherche restaurée", - "xpack.data.searchSessionIndicator.restoredWhenText": "Terminé {when}", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "Vous pouvez retourner à ces résultats à partir de la page de gestion", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "Session enregistrée terminée", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "Session enregistrée terminée", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "Session de recherche enregistrée", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "Terminé {when}", - "xpack.data.searchSessionIndicator.resultsLoadedDescriptionText": "Enregistrer votre session pour y revenir ultérieurement", - "xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel": "Session de recherche terminée", - "xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText": "Session de recherche terminée", - "xpack.data.searchSessionIndicator.resultsLoadedText": "Session de recherche terminée", - "xpack.data.searchSessionIndicator.resultsLoadedWhenText": "Terminé {when}", - "xpack.data.searchSessionIndicator.saveButtonText": "Enregistrer la session", - "xpack.data.searchSessionIndicator.viewSearchSessionsLinkText": "Gérer les sessions", - "xpack.data.searchSessionName.ariaLabelText": "Nom de la session de recherche", - "xpack.data.searchSessionName.editAriaLabelText": "Modifier le nom de la session de recherche", - "xpack.data.searchSessionName.placeholderText": "Entrer un nom pour la session de recherche", - "xpack.data.searchSessionName.saveButtonText": "Enregistrer", - "xpack.data.sessions.management.flyoutText": "Configuration de cette session de recherche", - "xpack.data.sessions.management.flyoutTitle": "Inspecter la session de recherche", "xpack.dataVisualizer.addCombinedFieldsLabel": "Ajouter un champ combiné", "xpack.dataVisualizer.choroplethMap.topValuesCount": "Compte des valeurs les plus élevées pour {fieldName}", "xpack.dataVisualizer.chrome.help.appName": "Data Visualizer (Visualiseur de données)", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index a74c31404cedc..0a79aba689f57 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2719,6 +2719,110 @@ "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "ランタイムフィールドを使用するには、スクリプト化されたフィールドがある{numberOfIndexPatternsWithScriptedFields}データビューを更新します。ほとんどの場合、既存のスクリプトを移行するには、「return ;」から「emit();」に変更する必要があります。1つ以上のスクリプト化されたフィールドがあるデータビュー:{allTitles}", "dataViews.deprecations.scriptedFieldsMessage": "スクリプト化されたフィールドを使用する{numberOfIndexPatternsWithScriptedFields}データビュー({titlesPreview}...)があります。スクリプト化されたフィールドは廃止予定であり、今後は削除されます。ランタイムフィールドを使用してください。", "dataViews.deprecations.scriptedFieldsTitle": "スクリプト化されたフィールドを使用しているデータビューが見つかりました。", + "data.mgmt.searchSessions.actionDelete": "削除", + "data.mgmt.searchSessions.actionExtend": "延長", + "data.mgmt.searchSessions.actionRename": "名前を編集", + "data.mgmt.searchSessions.actions.tooltip.moreActions": "さらにアクションを表示", + "data.mgmt.searchSessions.api.deleted": "検索セッションが削除されました。", + "data.mgmt.searchSessions.api.deletedError": "検索セッションを削除できませんでした。", + "data.mgmt.searchSessions.api.extended": "検索セッションが延長されました。", + "data.mgmt.searchSessions.api.extendError": "検索セッションを延長できませんでした。", + "data.mgmt.searchSessions.api.fetchError": "ページを更新できませんでした。", + "data.mgmt.searchSessions.api.fetchTimeout": "{timeout}秒後に検索セッション情報の取得がタイムアウトしました", + "data.mgmt.searchSessions.api.rename": "検索セッション名が変更されました", + "data.mgmt.searchSessions.api.renameError": "検索セッション名を変更できませんでした", + "data.mgmt.searchSessions.appTitle": "検索セッション", + "data.mgmt.searchSessions.ariaLabel.moreActions": "さらにアクションを表示", + "data.mgmt.searchSessions.cancelModal.cancelButton": "キャンセル", + "data.mgmt.searchSessions.cancelModal.deleteButton": "削除", + "data.mgmt.searchSessions.cancelModal.message": "検索セッション'{name}'を削除すると、キャッシュに保存されているすべての結果が削除されます。", + "data.mgmt.searchSessions.cancelModal.title": "検索セッションの削除", + "data.mgmt.searchSessions.extendModal.dontExtendButton": "キャンセル", + "data.mgmt.searchSessions.extendModal.extendButton": "有効期限を延長", + "data.mgmt.searchSessions.extendModal.extendMessage": "検索セッション'{name}'の有効期限が{newExpires}まで延長されます。", + "data.mgmt.searchSessions.extendModal.title": "検索セッションの有効期限を延長", + "data.mgmt.searchSessions.flyoutTitle": "検査", + "data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "ドキュメント", + "data.mgmt.searchSessions.main.sectionDescription": "保存された検索セッションを管理します。", + "data.mgmt.searchSessions.main.sectionTitle": "検索セッション", + "data.mgmt.searchSessions.renameModal.cancelButton": "キャンセル", + "data.mgmt.searchSessions.renameModal.renameButton": "保存", + "data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "検索セッション名", + "data.mgmt.searchSessions.renameModal.title": "検索セッション名を編集", + "data.mgmt.searchSessions.search.filterApp": "アプリ", + "data.mgmt.searchSessions.search.filterStatus": "ステータス", + "data.mgmt.searchSessions.search.tools.refresh": "更新", + "data.mgmt.searchSessions.status.expireDateUnknown": "不明", + "data.mgmt.searchSessions.status.expiresOn": "有効期限:{expireDate}", + "data.mgmt.searchSessions.status.expiresSoonInDays": "{numDays}日後に期限切れ", + "data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays}日", + "data.mgmt.searchSessions.status.expiresSoonInHours": "このセッションは{numHours}時間後に期限切れになります", + "data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours}時間", + "data.mgmt.searchSessions.status.label.cancelled": "キャンセル済み", + "data.mgmt.searchSessions.status.label.complete": "完了", + "data.mgmt.searchSessions.status.label.error": "エラー", + "data.mgmt.searchSessions.status.label.expired": "期限切れ", + "data.mgmt.searchSessions.status.label.inProgress": "進行中", + "data.mgmt.searchSessions.status.message.cancelled": "ユーザーがキャンセル", + "data.mgmt.searchSessions.status.message.createdOn": "有効期限:{expireDate}", + "data.mgmt.searchSessions.status.message.error": "エラー:{error}", + "data.mgmt.searchSessions.status.message.expiredOn": "有効期限:{expireDate}", + "data.mgmt.searchSessions.table.headerExpiration": "有効期限", + "data.mgmt.searchSessions.table.headerName": "名前", + "data.mgmt.searchSessions.table.headerStarted": "作成済み", + "data.mgmt.searchSessions.table.headerStatus": "ステータス", + "data.mgmt.searchSessions.table.headerType": "アプリ", + "data.mgmt.searchSessions.table.notRestorableWarning": "検索セッションはもう一度実行されます。今後使用するために保存できます。", + "data.mgmt.searchSessions.table.numSearches": "# 検索", + "data.mgmt.searchSessions.table.versionIncompatibleWarning": "この検索は別のバージョンを実行しているKibanaインスタンスで作成されました。正常に復元されない可能性があります。", + "data.search.statusError": "検索は{errorCode}ステータスで完了しました", + "data.search.statusThrow": "検索ステータスはエラー{message}({errorCode})ステータスを返しました", + "data.searchSessionIndicator.cancelButtonText": "セッションの停止", + "data.searchSessionIndicator.canceledDescriptionText": "不完全なデータを表示しています。", + "data.searchSessionIndicator.canceledIconAriaLabel": "検索セッションが停止しました", + "data.searchSessionIndicator.canceledTitleText": "検索セッションが停止しました", + "data.searchSessionIndicator.canceledTooltipText": "検索セッションが停止しました", + "data.searchSessionIndicator.canceledWhenText": "停止:{when}", + "data.searchSessionIndicator.continueInBackgroundButtonText": "セッションの保存", + "data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "検索セッションを管理するアクセス権がありません", + "data.searchSessionIndicator.disabledDueToTimeoutMessage": "検索セッション結果が期限切れです。", + "data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "管理から完了した結果に戻ることができます。", + "data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "保存されたセッションを実行中です", + "data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "保存されたセッションを実行中です", + "data.searchSessionIndicator.loadingInTheBackgroundTitleText": "保存されたセッションを実行中です", + "data.searchSessionIndicator.loadingInTheBackgroundWhenText": "開始:{when}", + "data.searchSessionIndicator.loadingResultsDescription": "セッションを保存して作業を続け、完了した結果に戻ってください。", + "data.searchSessionIndicator.loadingResultsIconAriaLabel": "検索セッションを読み込んでいます", + "data.searchSessionIndicator.loadingResultsIconTooltipText": "検索セッションを読み込んでいます", + "data.searchSessionIndicator.loadingResultsTitle": "検索に少し時間がかかっています...", + "data.searchSessionIndicator.loadingResultsWhenText": "開始:{when}", + "data.searchSessionIndicator.restoredDescriptionText": "特定の時間範囲からキャッシュに保存されたデータを表示しています。時間範囲またはフィルターを変更すると、セッションが再実行されます。", + "data.searchSessionIndicator.restoredResultsIconAriaLabel": "保存されたセッションが復元されました", + "data.searchSessionIndicator.restoredResultsTooltipText": "検索セッションが復元されました", + "data.searchSessionIndicator.restoredTitleText": "検索セッションが復元されました", + "data.searchSessionIndicator.restoredWhenText": "完了:{when}", + "data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "管理からこれらの結果に戻ることができます。", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "保存されたセッションが完了しました", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "保存されたセッションが完了しました", + "data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "検索セッションが保存されました", + "data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "完了:{when}", + "data.searchSessionIndicator.resultsLoadedDescriptionText": "セッションを保存して、後から戻ります。", + "data.searchSessionIndicator.resultsLoadedIconAriaLabel": "検索セッションが完了しました", + "data.searchSessionIndicator.resultsLoadedIconTooltipText": "検索セッションが完了しました", + "data.searchSessionIndicator.resultsLoadedText": "検索セッションが完了しました", + "data.searchSessionIndicator.resultsLoadedWhenText": "完了:{when}", + "data.searchSessionIndicator.saveButtonText": "セッションの保存", + "data.searchSessionIndicator.viewSearchSessionsLinkText": "セッションの管理", + "data.searchSessionName.ariaLabelText": "検索セッション名", + "data.searchSessionName.editAriaLabelText": "検索セッション名を編集", + "data.searchSessionName.placeholderText": "検索セッションの名前を入力", + "data.searchSessionName.saveButtonText": "保存", + "data.sessions.management.flyoutText": "この検索セッションの構成", + "data.sessions.management.flyoutTitle": "検索セッションの検査", + "dataViews.deprecations.scriptedFields.manualStepOneMessage": "[スタック管理]>[Kibana]>[インデックスパターン]に移動します。", + "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "ランタイムフィールドを使用するには、スクリプト化されたフィールドがある{numberOfIndexPatternsWithScriptedFields}インデックスパターンを更新します。ほとんどの場合、既存のスクリプトを移行するには、「return ;」から「emit();」に変更する必要があります。1つ以上のスクリプト化されたフィールドがあるインデックスパターン:{allTitles}", + "dataViews.deprecations.scriptedFieldsMessage": "スクリプト化されたフィールドを使用する{numberOfIndexPatternsWithScriptedFields}インデックスパターン({titlesPreview}...)があります。スクリプト化されたフィールドは廃止予定であり、今後は削除されます。ランタイムフィールドを使用してください。", + "dataViews.deprecations.scriptedFieldsTitle": "スクリプト化されたフィールドを使用しているインデックスパターンが見つかりました", "dataViews.ensureDefaultIndexPattern.bannerLabel": "Kibanaでデータの可視化と閲覧を行うには、Elasticsearchからデータを取得するためのインデックスパターンの作成が必要です。", "dataViews.fetchFieldErrorTitle": "データビューのフィールド取得中にエラーが発生 {title}(ID:{id})", "dataViews.functions.dataViewLoad.help": "データビューを読み込みます", @@ -10189,107 +10293,6 @@ "xpack.dashboard.drilldown.goToDashboard": "ダッシュボードに移動", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "ドリルダウンを作成", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "ドリルダウンを管理", - "xpack.data.mgmt.searchSessions.actionDelete": "削除", - "xpack.data.mgmt.searchSessions.actionExtend": "延長", - "xpack.data.mgmt.searchSessions.actionRename": "名前を編集", - "xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "さらにアクションを表示", - "xpack.data.mgmt.searchSessions.api.deleted": "検索セッションが削除されました。", - "xpack.data.mgmt.searchSessions.api.deletedError": "検索セッションを削除できませんでした。", - "xpack.data.mgmt.searchSessions.api.extended": "検索セッションが延長されました。", - "xpack.data.mgmt.searchSessions.api.extendError": "検索セッションを延長できませんでした。", - "xpack.data.mgmt.searchSessions.api.fetchError": "ページを更新できませんでした。", - "xpack.data.mgmt.searchSessions.api.fetchTimeout": "{timeout}秒後に検索セッション情報の取得がタイムアウトしました", - "xpack.data.mgmt.searchSessions.api.rename": "検索セッション名が変更されました", - "xpack.data.mgmt.searchSessions.api.renameError": "検索セッション名を変更できませんでした", - "xpack.data.mgmt.searchSessions.appTitle": "検索セッション", - "xpack.data.mgmt.searchSessions.ariaLabel.moreActions": "さらにアクションを表示", - "xpack.data.mgmt.searchSessions.cancelModal.cancelButton": "キャンセル", - "xpack.data.mgmt.searchSessions.cancelModal.deleteButton": "削除", - "xpack.data.mgmt.searchSessions.cancelModal.message": "検索セッション'{name}'を削除すると、キャッシュに保存されているすべての結果が削除されます。", - "xpack.data.mgmt.searchSessions.cancelModal.title": "検索セッションの削除", - "xpack.data.mgmt.searchSessions.extendModal.dontExtendButton": "キャンセル", - "xpack.data.mgmt.searchSessions.extendModal.extendButton": "有効期限を延長", - "xpack.data.mgmt.searchSessions.extendModal.extendMessage": "検索セッション'{name}'の有効期限が{newExpires}まで延長されます。", - "xpack.data.mgmt.searchSessions.extendModal.title": "検索セッションの有効期限を延長", - "xpack.data.mgmt.searchSessions.flyoutTitle": "検査", - "xpack.data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "ドキュメント", - "xpack.data.mgmt.searchSessions.main.sectionDescription": "保存された検索セッションを管理します。", - "xpack.data.mgmt.searchSessions.main.sectionTitle": "検索セッション", - "xpack.data.mgmt.searchSessions.renameModal.cancelButton": "キャンセル", - "xpack.data.mgmt.searchSessions.renameModal.renameButton": "保存", - "xpack.data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "検索セッション名", - "xpack.data.mgmt.searchSessions.renameModal.title": "検索セッション名を編集", - "xpack.data.mgmt.searchSessions.search.filterApp": "アプリ", - "xpack.data.mgmt.searchSessions.search.filterStatus": "ステータス", - "xpack.data.mgmt.searchSessions.search.tools.refresh": "更新", - "xpack.data.mgmt.searchSessions.status.expireDateUnknown": "不明", - "xpack.data.mgmt.searchSessions.status.expiresOn": "有効期限:{expireDate}", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDays": "{numDays}日後に期限切れ", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays}日", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHours": "このセッションは{numHours}時間後に期限切れになります", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours}時間", - "xpack.data.mgmt.searchSessions.status.label.cancelled": "キャンセル済み", - "xpack.data.mgmt.searchSessions.status.label.complete": "完了", - "xpack.data.mgmt.searchSessions.status.label.error": "エラー", - "xpack.data.mgmt.searchSessions.status.label.expired": "期限切れ", - "xpack.data.mgmt.searchSessions.status.label.inProgress": "進行中", - "xpack.data.mgmt.searchSessions.status.message.cancelled": "ユーザーがキャンセル", - "xpack.data.mgmt.searchSessions.status.message.createdOn": "有効期限:{expireDate}", - "xpack.data.mgmt.searchSessions.status.message.error": "エラー:{error}", - "xpack.data.mgmt.searchSessions.status.message.expiredOn": "有効期限:{expireDate}", - "xpack.data.mgmt.searchSessions.table.headerExpiration": "有効期限", - "xpack.data.mgmt.searchSessions.table.headerName": "名前", - "xpack.data.mgmt.searchSessions.table.headerStarted": "作成済み", - "xpack.data.mgmt.searchSessions.table.headerStatus": "ステータス", - "xpack.data.mgmt.searchSessions.table.headerType": "アプリ", - "xpack.data.mgmt.searchSessions.table.mlAppName": "機械学習", - "xpack.data.mgmt.searchSessions.table.notRestorableWarning": "検索セッションはもう一度実行されます。今後使用するために保存できます。", - "xpack.data.mgmt.searchSessions.table.numSearches": "# 検索", - "xpack.data.mgmt.searchSessions.table.versionIncompatibleWarning": "この検索は別のバージョンを実行しているKibanaインスタンスで作成されました。正常に復元されない可能性があります。", - "xpack.data.search.statusError": "検索は{errorCode}ステータスで完了しました", - "xpack.data.search.statusThrow": "検索ステータスはエラー{message}({errorCode})ステータスを返しました", - "xpack.data.searchSessionIndicator.cancelButtonText": "セッションの停止", - "xpack.data.searchSessionIndicator.canceledDescriptionText": "不完全なデータを表示しています。", - "xpack.data.searchSessionIndicator.canceledIconAriaLabel": "検索セッションが停止しました", - "xpack.data.searchSessionIndicator.canceledTitleText": "検索セッションが停止しました", - "xpack.data.searchSessionIndicator.canceledTooltipText": "検索セッションが停止しました", - "xpack.data.searchSessionIndicator.canceledWhenText": "停止:{when}", - "xpack.data.searchSessionIndicator.continueInBackgroundButtonText": "セッションの保存", - "xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "検索セッションを管理するアクセス権がありません", - "xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage": "検索セッション結果が期限切れです。", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "管理から完了した結果に戻ることができます。", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "保存されたセッションを実行中です", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "保存されたセッションを実行中です", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText": "保存されたセッションを実行中です", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText": "開始:{when}", - "xpack.data.searchSessionIndicator.loadingResultsDescription": "セッションを保存して作業を続け、完了した結果に戻ってください。", - "xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel": "検索セッションを読み込んでいます", - "xpack.data.searchSessionIndicator.loadingResultsIconTooltipText": "検索セッションを読み込んでいます", - "xpack.data.searchSessionIndicator.loadingResultsTitle": "検索に少し時間がかかっています...", - "xpack.data.searchSessionIndicator.loadingResultsWhenText": "開始:{when}", - "xpack.data.searchSessionIndicator.restoredDescriptionText": "特定の時間範囲からキャッシュに保存されたデータを表示しています。時間範囲またはフィルターを変更すると、セッションが再実行されます。", - "xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel": "保存されたセッションが復元されました", - "xpack.data.searchSessionIndicator.restoredResultsTooltipText": "検索セッションが復元されました", - "xpack.data.searchSessionIndicator.restoredTitleText": "検索セッションが復元されました", - "xpack.data.searchSessionIndicator.restoredWhenText": "完了:{when}", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "管理からこれらの結果に戻ることができます。", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "保存されたセッションが完了しました", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "保存されたセッションが完了しました", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "検索セッションが保存されました", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "完了:{when}", - "xpack.data.searchSessionIndicator.resultsLoadedDescriptionText": "セッションを保存して、後から戻ります。", - "xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel": "検索セッションが完了しました", - "xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText": "検索セッションが完了しました", - "xpack.data.searchSessionIndicator.resultsLoadedText": "検索セッションが完了しました", - "xpack.data.searchSessionIndicator.resultsLoadedWhenText": "完了:{when}", - "xpack.data.searchSessionIndicator.saveButtonText": "セッションの保存", - "xpack.data.searchSessionIndicator.viewSearchSessionsLinkText": "セッションの管理", - "xpack.data.searchSessionName.ariaLabelText": "検索セッション名", - "xpack.data.searchSessionName.editAriaLabelText": "検索セッション名を編集", - "xpack.data.searchSessionName.placeholderText": "検索セッションの名前を入力", - "xpack.data.searchSessionName.saveButtonText": "保存", - "xpack.data.sessions.management.flyoutText": "この検索セッションの構成", - "xpack.data.sessions.management.flyoutTitle": "検索セッションの検査", "xpack.dataVisualizer.addCombinedFieldsLabel": "結合されたフィールドを追加", "xpack.dataVisualizer.choroplethMap.topValuesCount": "{fieldName}の上位の値件数", "xpack.dataVisualizer.chrome.help.appName": "データビジュアライザー", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 9f2a139a65c36..adb097d9936c8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2722,6 +2722,110 @@ "data.searchSessions.sessionService.sessionObjectFetchError": "无法提取搜索会话信息", "data.triggers.applyFilterDescription": "应用 kibana 筛选时。可能是单个值或范围筛选。", "data.triggers.applyFilterTitle": "应用筛选", + "data.mgmt.searchSessions.actionDelete": "删除", + "data.mgmt.searchSessions.actionExtend": "延长", + "data.mgmt.searchSessions.actionRename": "编辑名称", + "data.mgmt.searchSessions.actions.tooltip.moreActions": "更多操作", + "data.mgmt.searchSessions.api.deleted": "搜索会话已删除。", + "data.mgmt.searchSessions.api.deletedError": "无法删除搜索会话!", + "data.mgmt.searchSessions.api.extended": "搜索会话已延长。", + "data.mgmt.searchSessions.api.extendError": "无法延长搜索会话!", + "data.mgmt.searchSessions.api.fetchError": "无法刷新页面!", + "data.mgmt.searchSessions.api.fetchTimeout": "获取搜索会话信息在 {timeout} 秒后已超时", + "data.mgmt.searchSessions.api.rename": "搜索会话已重命名", + "data.mgmt.searchSessions.api.renameError": "无法重命名搜索会话", + "data.mgmt.searchSessions.appTitle": "搜索会话", + "data.mgmt.searchSessions.ariaLabel.moreActions": "更多操作", + "data.mgmt.searchSessions.cancelModal.cancelButton": "取消", + "data.mgmt.searchSessions.cancelModal.deleteButton": "删除", + "data.mgmt.searchSessions.cancelModal.message": "删除搜索会话“{name}”将会删除所有缓存的结果。", + "data.mgmt.searchSessions.cancelModal.title": "删除搜索会话", + "data.mgmt.searchSessions.extendModal.dontExtendButton": "取消", + "data.mgmt.searchSessions.extendModal.extendButton": "延长过期时间", + "data.mgmt.searchSessions.extendModal.extendMessage": "搜索会话“{name}”过期时间将延长至 {newExpires}。", + "data.mgmt.searchSessions.extendModal.title": "延长搜索会话过期时间", + "data.mgmt.searchSessions.flyoutTitle": "检查", + "data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "文档", + "data.mgmt.searchSessions.main.sectionDescription": "管理已保存搜索会话。", + "data.mgmt.searchSessions.main.sectionTitle": "搜索会话", + "data.mgmt.searchSessions.renameModal.cancelButton": "取消", + "data.mgmt.searchSessions.renameModal.renameButton": "保存", + "data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "搜索会话名称", + "data.mgmt.searchSessions.renameModal.title": "编辑搜索会话名称", + "data.mgmt.searchSessions.search.filterApp": "应用", + "data.mgmt.searchSessions.search.filterStatus": "状态", + "data.mgmt.searchSessions.search.tools.refresh": "刷新", + "data.mgmt.searchSessions.status.expireDateUnknown": "未知", + "data.mgmt.searchSessions.status.expiresOn": "于 {expireDate}过期", + "data.mgmt.searchSessions.status.expiresSoonInDays": "将于 {numDays} 天后过期", + "data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} 天", + "data.mgmt.searchSessions.status.expiresSoonInHours": "此会话将于 {numHours} 小时后过期", + "data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} 小时", + "data.mgmt.searchSessions.status.label.cancelled": "已取消", + "data.mgmt.searchSessions.status.label.complete": "已完成", + "data.mgmt.searchSessions.status.label.error": "错误", + "data.mgmt.searchSessions.status.label.expired": "已过期", + "data.mgmt.searchSessions.status.label.inProgress": "进行中", + "data.mgmt.searchSessions.status.message.cancelled": "用户已取消", + "data.mgmt.searchSessions.status.message.createdOn": "于 {expireDate}过期", + "data.mgmt.searchSessions.status.message.error": "错误:{error}", + "data.mgmt.searchSessions.status.message.expiredOn": "已于 {expireDate}过期", + "data.mgmt.searchSessions.table.headerExpiration": "到期", + "data.mgmt.searchSessions.table.headerName": "名称", + "data.mgmt.searchSessions.table.headerStarted": "创建时间", + "data.mgmt.searchSessions.table.headerStatus": "状态", + "data.mgmt.searchSessions.table.headerType": "应用", + "data.mgmt.searchSessions.table.notRestorableWarning": "搜索会话将重新执行。然后,您可以将其保存,供未来使用。", + "data.mgmt.searchSessions.table.numSearches": "搜索数", + "data.mgmt.searchSessions.table.versionIncompatibleWarning": "此搜索会话在运行不同版本的 Kibana 实例中已创建。其可能不会正确还原。", + "data.search.statusError": "搜索完成,状态为 {errorCode}", + "data.search.statusThrow": "搜索状态引发错误 {message} ({errorCode}) 状态", + "data.searchSessionIndicator.cancelButtonText": "停止会话", + "data.searchSessionIndicator.canceledDescriptionText": "您正查看不完整的数据", + "data.searchSessionIndicator.canceledIconAriaLabel": "搜索会话已停止", + "data.searchSessionIndicator.canceledTitleText": "搜索会话已停止", + "data.searchSessionIndicator.canceledTooltipText": "搜索会话已停止", + "data.searchSessionIndicator.canceledWhenText": "已于 {when} 停止", + "data.searchSessionIndicator.continueInBackgroundButtonText": "保存会话", + "data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "您无权管理搜索会话", + "data.searchSessionIndicator.disabledDueToTimeoutMessage": "搜索会话结果已过期。", + "data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "可以从“管理”中返回至完成的结果", + "data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "已保存会话正在进行中", + "data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "已保存会话正在进行中", + "data.searchSessionIndicator.loadingInTheBackgroundTitleText": "已保存会话正在进行中", + "data.searchSessionIndicator.loadingInTheBackgroundWhenText": "已于 {when} 启动", + "data.searchSessionIndicator.loadingResultsDescription": "保存您的会话,继续您的工作,然后返回到完成的结果", + "data.searchSessionIndicator.loadingResultsIconAriaLabel": "搜索会话正在加载", + "data.searchSessionIndicator.loadingResultsIconTooltipText": "搜索会话正在加载", + "data.searchSessionIndicator.loadingResultsTitle": "您的搜索将需要一些时间......", + "data.searchSessionIndicator.loadingResultsWhenText": "已于 {when} 启动", + "data.searchSessionIndicator.restoredDescriptionText": "您在查看特定时间范围的缓存数据。更改时间范围或筛选将会重新运行会话", + "data.searchSessionIndicator.restoredResultsIconAriaLabel": "已保存会话已还原", + "data.searchSessionIndicator.restoredResultsTooltipText": "搜索会话已还原", + "data.searchSessionIndicator.restoredTitleText": "搜索会话已还原", + "data.searchSessionIndicator.restoredWhenText": "已于 {when} 完成", + "data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "可以从“管理”中返回到这些结果", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "已保存会话已完成", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "已保存会话已完成", + "data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "搜索会话已保存", + "data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "已于 {when} 完成", + "data.searchSessionIndicator.resultsLoadedDescriptionText": "保存您的会话,之后可返回", + "data.searchSessionIndicator.resultsLoadedIconAriaLabel": "搜索会话已完成", + "data.searchSessionIndicator.resultsLoadedIconTooltipText": "搜索会话已完成", + "data.searchSessionIndicator.resultsLoadedText": "搜索会话已完成", + "data.searchSessionIndicator.resultsLoadedWhenText": "已于 {when} 完成", + "data.searchSessionIndicator.saveButtonText": "保存会话", + "data.searchSessionIndicator.viewSearchSessionsLinkText": "管理会话", + "data.searchSessionName.ariaLabelText": "搜索会话名称", + "data.searchSessionName.editAriaLabelText": "编辑搜索会话名称", + "data.searchSessionName.placeholderText": "为搜索会话输入名称", + "data.searchSessionName.saveButtonText": "保存", + "data.sessions.management.flyoutText": "此搜索会话的配置", + "data.sessions.management.flyoutTitle": "检查搜索会话", + "dataViews.deprecations.scriptedFields.manualStepOneMessage": "导航到“堆栈管理”>“Kibana”>“索引模式”。", + "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "更新 {numberOfIndexPatternsWithScriptedFields} 个具有脚本字段的索引模式以改为使用运行时字段。多数情况下,要迁移现有脚本,您需要将“return ;”更改为“emit();”。至少有一个脚本字段的索引模式:{allTitles}", + "dataViews.deprecations.scriptedFieldsMessage": "您具有 {numberOfIndexPatternsWithScriptedFields} 个使用脚本字段的索引模式 ({titlesPreview}...)。脚本字段已过时,将在未来移除。请改为使用运行时脚本。", + "dataViews.deprecations.scriptedFieldsTitle": "找到使用脚本字段的索引模式", "dataViews.deprecations.scriptedFields.manualStepOneMessage": "导航到“堆栈管理”>“Kibana”>“数据视图”。", "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "更新 {numberOfIndexPatternsWithScriptedFields} 个具有脚本字段的数据视图以改为使用运行时字段。多数情况下,要迁移现有脚本,您需要将“return ;”更改为“emit();”。至少有一个脚本字段的数据视图:{allTitles}", "dataViews.deprecations.scriptedFieldsMessage": "您具有 {numberOfIndexPatternsWithScriptedFields} 个使用脚本字段的数据视图 ({titlesPreview}...)。脚本字段已过时,将在未来移除。请改为使用运行时脚本。", @@ -10210,107 +10314,6 @@ "xpack.dashboard.drilldown.goToDashboard": "前往仪表板", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "创建向下钻取", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "管理向下钻取", - "xpack.data.mgmt.searchSessions.actionDelete": "删除", - "xpack.data.mgmt.searchSessions.actionExtend": "延长", - "xpack.data.mgmt.searchSessions.actionRename": "编辑名称", - "xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "更多操作", - "xpack.data.mgmt.searchSessions.api.deleted": "搜索会话已删除。", - "xpack.data.mgmt.searchSessions.api.deletedError": "无法删除搜索会话!", - "xpack.data.mgmt.searchSessions.api.extended": "搜索会话已延长。", - "xpack.data.mgmt.searchSessions.api.extendError": "无法延长搜索会话!", - "xpack.data.mgmt.searchSessions.api.fetchError": "无法刷新页面!", - "xpack.data.mgmt.searchSessions.api.fetchTimeout": "获取搜索会话信息在 {timeout} 秒后已超时", - "xpack.data.mgmt.searchSessions.api.rename": "搜索会话已重命名", - "xpack.data.mgmt.searchSessions.api.renameError": "无法重命名搜索会话", - "xpack.data.mgmt.searchSessions.appTitle": "搜索会话", - "xpack.data.mgmt.searchSessions.ariaLabel.moreActions": "更多操作", - "xpack.data.mgmt.searchSessions.cancelModal.cancelButton": "取消", - "xpack.data.mgmt.searchSessions.cancelModal.deleteButton": "删除", - "xpack.data.mgmt.searchSessions.cancelModal.message": "删除搜索会话“{name}”将会删除所有缓存的结果。", - "xpack.data.mgmt.searchSessions.cancelModal.title": "删除搜索会话", - "xpack.data.mgmt.searchSessions.extendModal.dontExtendButton": "取消", - "xpack.data.mgmt.searchSessions.extendModal.extendButton": "延长过期时间", - "xpack.data.mgmt.searchSessions.extendModal.extendMessage": "搜索会话“{name}”过期时间将延长至 {newExpires}。", - "xpack.data.mgmt.searchSessions.extendModal.title": "延长搜索会话过期时间", - "xpack.data.mgmt.searchSessions.flyoutTitle": "检查", - "xpack.data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "文档", - "xpack.data.mgmt.searchSessions.main.sectionDescription": "管理已保存搜索会话。", - "xpack.data.mgmt.searchSessions.main.sectionTitle": "搜索会话", - "xpack.data.mgmt.searchSessions.renameModal.cancelButton": "取消", - "xpack.data.mgmt.searchSessions.renameModal.renameButton": "保存", - "xpack.data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "搜索会话名称", - "xpack.data.mgmt.searchSessions.renameModal.title": "编辑搜索会话名称", - "xpack.data.mgmt.searchSessions.search.filterApp": "应用", - "xpack.data.mgmt.searchSessions.search.filterStatus": "状态", - "xpack.data.mgmt.searchSessions.search.tools.refresh": "刷新", - "xpack.data.mgmt.searchSessions.status.expireDateUnknown": "未知", - "xpack.data.mgmt.searchSessions.status.expiresOn": "于 {expireDate}过期", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDays": "将于 {numDays} 天后过期", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} 天", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHours": "此会话将于 {numHours} 小时后过期", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} 小时", - "xpack.data.mgmt.searchSessions.status.label.cancelled": "已取消", - "xpack.data.mgmt.searchSessions.status.label.complete": "已完成", - "xpack.data.mgmt.searchSessions.status.label.error": "错误", - "xpack.data.mgmt.searchSessions.status.label.expired": "已过期", - "xpack.data.mgmt.searchSessions.status.label.inProgress": "进行中", - "xpack.data.mgmt.searchSessions.status.message.cancelled": "用户已取消", - "xpack.data.mgmt.searchSessions.status.message.createdOn": "于 {expireDate}过期", - "xpack.data.mgmt.searchSessions.status.message.error": "错误:{error}", - "xpack.data.mgmt.searchSessions.status.message.expiredOn": "已于 {expireDate}过期", - "xpack.data.mgmt.searchSessions.table.headerExpiration": "到期", - "xpack.data.mgmt.searchSessions.table.headerName": "名称", - "xpack.data.mgmt.searchSessions.table.headerStarted": "创建时间", - "xpack.data.mgmt.searchSessions.table.headerStatus": "状态", - "xpack.data.mgmt.searchSessions.table.headerType": "应用", - "xpack.data.mgmt.searchSessions.table.mlAppName": "Machine Learning", - "xpack.data.mgmt.searchSessions.table.notRestorableWarning": "搜索会话将重新执行。然后,您可以将其保存,供未来使用。", - "xpack.data.mgmt.searchSessions.table.numSearches": "搜索数", - "xpack.data.mgmt.searchSessions.table.versionIncompatibleWarning": "此搜索会话在运行不同版本的 Kibana 实例中已创建。其可能不会正确还原。", - "xpack.data.search.statusError": "搜索完成,状态为 {errorCode}", - "xpack.data.search.statusThrow": "搜索状态引发错误 {message} ({errorCode}) 状态", - "xpack.data.searchSessionIndicator.cancelButtonText": "停止会话", - "xpack.data.searchSessionIndicator.canceledDescriptionText": "您正查看不完整的数据", - "xpack.data.searchSessionIndicator.canceledIconAriaLabel": "搜索会话已停止", - "xpack.data.searchSessionIndicator.canceledTitleText": "搜索会话已停止", - "xpack.data.searchSessionIndicator.canceledTooltipText": "搜索会话已停止", - "xpack.data.searchSessionIndicator.canceledWhenText": "已于 {when} 停止", - "xpack.data.searchSessionIndicator.continueInBackgroundButtonText": "保存会话", - "xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "您无权管理搜索会话", - "xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage": "搜索会话结果已过期。", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "可以从“管理”中返回至完成的结果", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "已保存会话正在进行中", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "已保存会话正在进行中", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText": "已保存会话正在进行中", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText": "已于 {when} 启动", - "xpack.data.searchSessionIndicator.loadingResultsDescription": "保存您的会话,继续您的工作,然后返回到完成的结果", - "xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel": "搜索会话正在加载", - "xpack.data.searchSessionIndicator.loadingResultsIconTooltipText": "搜索会话正在加载", - "xpack.data.searchSessionIndicator.loadingResultsTitle": "您的搜索将需要一些时间......", - "xpack.data.searchSessionIndicator.loadingResultsWhenText": "已于 {when} 启动", - "xpack.data.searchSessionIndicator.restoredDescriptionText": "您在查看特定时间范围的缓存数据。更改时间范围或筛选将会重新运行会话", - "xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel": "已保存会话已还原", - "xpack.data.searchSessionIndicator.restoredResultsTooltipText": "搜索会话已还原", - "xpack.data.searchSessionIndicator.restoredTitleText": "搜索会话已还原", - "xpack.data.searchSessionIndicator.restoredWhenText": "已于 {when} 完成", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "可以从“管理”中返回到这些结果", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "已保存会话已完成", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "已保存会话已完成", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "搜索会话已保存", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "已于 {when} 完成", - "xpack.data.searchSessionIndicator.resultsLoadedDescriptionText": "保存您的会话,之后可返回", - "xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel": "搜索会话已完成", - "xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText": "搜索会话已完成", - "xpack.data.searchSessionIndicator.resultsLoadedText": "搜索会话已完成", - "xpack.data.searchSessionIndicator.resultsLoadedWhenText": "已于 {when} 完成", - "xpack.data.searchSessionIndicator.saveButtonText": "保存会话", - "xpack.data.searchSessionIndicator.viewSearchSessionsLinkText": "管理会话", - "xpack.data.searchSessionName.ariaLabelText": "搜索会话名称", - "xpack.data.searchSessionName.editAriaLabelText": "编辑搜索会话名称", - "xpack.data.searchSessionName.placeholderText": "为搜索会话输入名称", - "xpack.data.searchSessionName.saveButtonText": "保存", - "xpack.data.sessions.management.flyoutText": "此搜索会话的配置", - "xpack.data.sessions.management.flyoutTitle": "检查搜索会话", "xpack.dataVisualizer.addCombinedFieldsLabel": "添加组合字段", "xpack.dataVisualizer.choroplethMap.topValuesCount": "{fieldName} 的排名最前值计数", "xpack.dataVisualizer.chrome.help.appName": "数据可视化工具", diff --git a/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json b/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json index f96e8b2bbcc23..1960c49839566 100644 --- a/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json +++ b/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json @@ -4,7 +4,7 @@ "version": "1.0.0", "kibanaVersion": "kibana", "configPath": ["xpack", "timelinesTest"], - "requiredPlugins": ["timelines", "data", "dataEnhanced"], + "requiredPlugins": ["timelines", "data"], "requiredBundles": ["kibanaReact"], "server": false, "ui": true diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index d6bdf8cfaa6fd..8c6a1cb88c0ba 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -58,7 +58,6 @@ { "path": "../plugins/global_search/tsconfig.json" }, { "path": "../plugins/global_search_providers/tsconfig.json" }, { "path": "../plugins/features/tsconfig.json" }, - { "path": "../plugins/data_enhanced/tsconfig.json" }, { "path": "../plugins/drilldowns/url_drilldown/tsconfig.json" }, { "path": "../plugins/embeddable_enhanced/tsconfig.json" }, { "path": "../plugins/encrypted_saved_objects/tsconfig.json" }, From 61364dc93f446aa55a0cdc6fdf63c38ad26ad907 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 29 Apr 2022 17:00:58 +0200 Subject: [PATCH 19/89] Current state help popover (#130009) --- .../editor_frame/frame_layout.scss | 2 +- .../dimension_panel/dimension_editor.scss | 8 +- .../dimension_panel/dimension_editor.tsx | 52 ++++++- .../indexpattern_datasource/help_popover.tsx | 42 ++++++ .../calculations/moving_average.tsx | 29 +--- .../operations/definitions/date_histogram.tsx | 140 ++++++++---------- .../operations/definitions/index.ts | 8 + .../translations/translations/fr-FR.json | 2 - .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - 10 files changed, 169 insertions(+), 118 deletions(-) diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/frame_layout.scss b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/frame_layout.scss index b49c77bb8b419..cab1a78294a86 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/frame_layout.scss +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/frame_layout.scss @@ -96,7 +96,7 @@ a tilemap in an iframe: https://github.com/elastic/kibana/issues/16457 */ .lnsFrameLayout__sidebar--right { flex-basis: 25%; background-color: lightOrDarkTheme($euiColorLightestShade, $euiColorInk); - min-width: $lnsPanelMinWidth + $euiSizeXL; + min-width: $lnsPanelMinWidth + 70; max-width: $euiFormMaxWidth + $euiSizeXXL; max-height: 100%; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.scss b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.scss index d4c91f80317fd..99286ad34b380 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.scss +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.scss @@ -37,13 +37,7 @@ .lnsIndexPatternDimensionEditor__columns { column-count: 2; - column-gap: $euiSizeXL; -} - -// overrides the .euiListGroupItem display flex. -// The parent container has a column-count property that only works properly with block elements. -.lnsIndexPatternDimensionEditor__operation { - display: block; + column-gap: $euiSizeM; } .lnsIndexPatternDimensionEditor__operation .euiListGroupItem__label { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx index 2c03ad902ce81..790873fdc74b2 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx @@ -6,7 +6,7 @@ */ import './dimension_editor.scss'; -import React, { useState, useMemo, useCallback } from 'react'; +import React, { useState, useMemo, useCallback, useRef, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiListGroup, @@ -16,6 +16,7 @@ import { EuiToolTip, EuiText, } from '@elastic/eui'; +import ReactDOM from 'react-dom'; import type { IndexPatternDimensionEditorProps } from './dimension_panel'; import type { OperationSupportMatrix } from './operation_support'; import type { GenericIndexPatternColumn } from '../indexpattern'; @@ -58,6 +59,7 @@ import type { TemporaryState } from './dimensions_editor_helpers'; import { FieldInput } from './field_input'; import { NameInput } from '../../shared_components'; import { ParamEditorProps } from '../operations/definitions'; +import { WrappingHelpPopover } from '../help_popover'; const operationPanels = getOperationDisplay(); @@ -228,6 +230,15 @@ export function DimensionEditor(props: DimensionEditorProps) { const [filterByOpenInitially, setFilterByOpenInitally] = useState(false); const [timeShiftedFocused, setTimeShiftFocused] = useState(false); + const helpPopoverContainer = useRef(null); + useEffect(() => { + return () => { + if (helpPopoverContainer.current) { + ReactDOM.unmountComponentAtNode(helpPopoverContainer.current); + document.body.removeChild(helpPopoverContainer.current); + } + }; + }, []); // Operations are compatible if they match inputs. They are always compatible in // the empty state. Field-based operations are not compatible with field-less operations. @@ -309,6 +320,45 @@ export function DimensionEditor(props: DimensionEditorProps) { compatibleWithCurrentField ? '' : ' incompatible' }`, [`aria-pressed`]: isActive, + extraAction: operationDefinitionMap[operationType].helpComponent + ? { + color: 'primary', + onClick: (e) => { + if (!helpPopoverContainer.current) { + const container = document.createElement('div'); + helpPopoverContainer.current = container; + document.body.appendChild(container); + const HelpComponent = operationDefinitionMap[operationType].helpComponent!; + const element = ( + { + if (helpPopoverContainer.current) { + ReactDOM.unmountComponentAtNode(helpPopoverContainer.current); + document.body.removeChild(helpPopoverContainer.current); + helpPopoverContainer.current = null; + } + }} + > + + + ); + ReactDOM.render(element, helpPopoverContainer.current); + } else { + ReactDOM.unmountComponentAtNode(helpPopoverContainer.current); + document.body.removeChild(helpPopoverContainer.current); + helpPopoverContainer.current = null; + } + }, + iconType: 'documentation', + iconSize: 's', + 'aria-label': i18n.translate('xpack.lens.indexPattern.helpLabel', { + defaultMessage: 'Function help', + }), + } + : undefined, onClick() { if ( ['none', 'fullReference', 'managedReference'].includes( diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/help_popover.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/help_popover.tsx index 88fb96b58cd21..a1bbc7ccd55f1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/help_popover.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/help_popover.tsx @@ -12,6 +12,8 @@ import { EuiLinkButtonProps, EuiPopover, EuiPopoverProps, + EuiWrappingPopover, + EuiWrappingPopoverProps, EuiPopoverTitle, EuiText, } from '@elastic/eui'; @@ -75,3 +77,43 @@ export const HelpPopover = ({ ); }; + +export const WrappingHelpPopover = ({ + anchorPosition, + button, + children, + closePopover, + isOpen, + title, +}: { + anchorPosition?: EuiWrappingPopoverProps['anchorPosition']; + button: EuiWrappingPopoverProps['button']; + children: ReactNode; + closePopover: EuiWrappingPopoverProps['closePopover']; + isOpen: EuiWrappingPopoverProps['isOpen']; + title?: string; +}) => { + useEffect(() => { + if (isOpen) { + trackUiEvent('open_help_popover'); + } + }, [isOpen]); + return ( + + {title && {title}} + + + {children} + + + ); +}; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx index aa68c8409ad80..cf96bcd11b788 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx @@ -28,7 +28,6 @@ import { combineErrorMessages, } from '../helpers'; import { adjustTimeScaleOnOtherColumnChange } from '../../time_scale_utils'; -import { HelpPopover, HelpPopoverButton } from '../../../help_popover'; import type { OperationDefinition, ParamEditorProps } from '..'; import { getDisallowedPreviousShiftMessage } from '../../../time_shift_utils'; @@ -129,7 +128,10 @@ export const movingAverageOperation: OperationDefinition< getDisallowedPreviousShiftMessage(layer, columnId), ]); }, - getHelpMessage: () => , + helpComponent: () => , + helpComponentTitle: i18n.translate('xpack.lens.indexPattern.movingAverage.titleHelp', { + defaultMessage: 'How moving average works', + }), getDisabledStatus(indexPattern, layer, layerType) { const opName = i18n.translate('xpack.lens.indexPattern.movingAverage', { defaultMessage: 'Moving average', @@ -217,27 +219,8 @@ function MovingAverageParamEditor({ } const MovingAveragePopup = () => { - const [isPopoverOpen, setIsPopoverOpen] = useState(false); return ( - { - setIsPopoverOpen(!isPopoverOpen); - }} - > - {i18n.translate('xpack.lens.indexPattern.movingAverage.helpText', { - defaultMessage: 'How it works', - })} - - } - closePopover={() => setIsPopoverOpen(false)} - isOpen={isPopoverOpen} - title={i18n.translate('xpack.lens.indexPattern.movingAverage.titleHelp', { - defaultMessage: 'How moving average works', - })} - > + <>

{ defaultMessage="The first moving average value starts at the second item." />

-
+ ); }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx index f96e584326340..56b82dc03101c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useCallback, useState } from 'react'; +import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -25,7 +25,6 @@ import { } from '@elastic/eui'; import { AggFunctionsMapping, - DataPublicPluginStart, IndexPatternAggRestrictions, search, UI_SETTINGS, @@ -36,7 +35,6 @@ import { updateColumnParam } from '../layer_helpers'; import { OperationDefinition, ParamEditorProps } from '.'; import { FieldBasedIndexPatternColumn } from './column_types'; import { getInvalidFieldMessage, getSafeName } from './helpers'; -import { HelpPopover, HelpPopoverButton } from '../../help_popover'; import { IndexPatternLayer } from '../../types'; import { TooltipWrapper } from '../../../shared_components'; @@ -96,7 +94,6 @@ export const dateHistogramOperation: OperationDefinition< ) || []), getMultipleDateHistogramsErrorMessage(layer, columnId) || '', ].filter(Boolean), - getHelpMessage: (props) => , getPossibleOperationForField: ({ aggregationRestrictions, aggregatable, type }) => { if ( (type === 'date' || type === 'date_range') && @@ -467,6 +464,65 @@ export const dateHistogramOperation: OperationDefinition< ); }, + helpComponentTitle: i18n.translate('xpack.lens.indexPattern.dateHistogram.titleHelp', { + defaultMessage: 'How auto date histogram works', + }), + helpComponent() { + const infiniteBound = i18n.translate('xpack.lens.indexPattern.dateHistogram.moreThanYear', { + defaultMessage: 'More than a year', + }); + const upToLabel = i18n.translate('xpack.lens.indexPattern.dateHistogram.upTo', { + defaultMessage: 'Up to', + }); + + return ( + <> +

+ {i18n.translate('xpack.lens.indexPattern.dateHistogram.autoBasicExplanation', { + defaultMessage: 'The auto date histogram splits a data field into buckets by interval.', + })} +

+ +

+ {UI_SETTINGS.HISTOGRAM_MAX_BARS}, + targetBarSetting: {UI_SETTINGS.HISTOGRAM_BAR_TARGET}, + }} + /> +

+ +

+ {i18n.translate('xpack.lens.indexPattern.dateHistogram.autoAdvancedExplanation', { + defaultMessage: 'The interval follows this logic:', + })} +

+ + ({ + bound: typeof bound === 'number' ? infiniteBound : `${upToLabel} ${boundLabel}`, + interval: intervalLabel, + }))} + columns={[ + { + field: 'bound', + name: i18n.translate('xpack.lens.indexPattern.dateHistogram.autoBoundHeader', { + defaultMessage: 'Target interval measured', + }), + }, + { + field: 'interval', + name: i18n.translate('xpack.lens.indexPattern.dateHistogram.autoIntervalHeader', { + defaultMessage: 'Interval used', + }), + }, + ]} + /> + + ); + }, }; function parseInterval(currentInterval: string) { @@ -491,79 +547,3 @@ function restrictedInterval(aggregationRestrictions?: Partial { - const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const infiniteBound = i18n.translate('xpack.lens.indexPattern.dateHistogram.moreThanYear', { - defaultMessage: 'More than a year', - }); - const upToLabel = i18n.translate('xpack.lens.indexPattern.dateHistogram.upTo', { - defaultMessage: 'Up to', - }); - - return ( - { - setIsPopoverOpen(!isPopoverOpen); - }} - > - {i18n.translate('xpack.lens.indexPattern.dateHistogram.autoHelpText', { - defaultMessage: 'How it works', - })} - - } - closePopover={() => setIsPopoverOpen(false)} - isOpen={isPopoverOpen} - title={i18n.translate('xpack.lens.indexPattern.dateHistogram.titleHelp', { - defaultMessage: 'How auto date histogram works', - })} - > -

- {i18n.translate('xpack.lens.indexPattern.dateHistogram.autoBasicExplanation', { - defaultMessage: 'The auto date histogram splits a data field into buckets by interval.', - })} -

- -

- {UI_SETTINGS.HISTOGRAM_MAX_BARS}, - targetBarSetting: {UI_SETTINGS.HISTOGRAM_BAR_TARGET}, - }} - /> -

- -

- {i18n.translate('xpack.lens.indexPattern.dateHistogram.autoAdvancedExplanation', { - defaultMessage: 'The interval follows this logic:', - })} -

- - ({ - bound: typeof bound === 'number' ? infiniteBound : `${upToLabel} ${boundLabel}`, - interval: intervalLabel, - }))} - columns={[ - { - field: 'bound', - name: i18n.translate('xpack.lens.indexPattern.dateHistogram.autoBoundHeader', { - defaultMessage: 'Target interval measured', - }), - }, - { - field: 'interval', - name: i18n.translate('xpack.lens.indexPattern.dateHistogram.autoIntervalHeader', { - defaultMessage: 'Interval used', - }), - }, - ]} - /> -
- ); -}; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts index e62bab6bd808b..36039a058908b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts @@ -364,6 +364,14 @@ interface BaseOperationDefinitionProps * are not pass the transferable checks */ getNonTransferableFields?: (column: C, indexPattern: IndexPattern) => string[]; + /** + * Component rendered as inline help + */ + helpComponent?: React.ComponentType<{}>; + /** + * Title for the help component + */ + helpComponentTitle?: string; } interface BaseBuildColumnArgs { diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 8179a03244e50..bbe07a375e42d 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -440,7 +440,6 @@ "xpack.lens.indexPattern.dateHistogram.autoAdvancedExplanation": "L'intervalle suit cette logique :", "xpack.lens.indexPattern.dateHistogram.autoBasicExplanation": "L'histogramme des dates automatique divise un champ de données en groupes par intervalle.", "xpack.lens.indexPattern.dateHistogram.autoBoundHeader": "Intervalle cible mesuré", - "xpack.lens.indexPattern.dateHistogram.autoHelpText": "Fonctionnement", "xpack.lens.indexPattern.dateHistogram.autoInterval": "Personnaliser l'intervalle de temps", "xpack.lens.indexPattern.dateHistogram.autoIntervalHeader": "Intervalle utilisé", "xpack.lens.indexPattern.dateHistogram.autoLongerExplanation": "Pour choisir l'intervalle, Lens divise la plage temporelle spécifiée par le paramètre {targetBarSetting}. Lens calcule le meilleur intervalle pour vos données. Par exemple 30m, 1h et 12. Le nombre maximal de barres est défini par la valeur {maxBarSetting}.", @@ -573,7 +572,6 @@ "xpack.lens.indexPattern.moving_average.signature": "indicateur : nombre, [window] : nombre", "xpack.lens.indexPattern.movingAverage": "Moyenne mobile", "xpack.lens.indexPattern.movingAverage.basicExplanation": "La moyenne mobile fait glisser une fenêtre sur les données et affiche la valeur moyenne. La moyenne mobile est prise en charge uniquement par les histogrammes des dates.", - "xpack.lens.indexPattern.movingAverage.helpText": "Fonctionnement", "xpack.lens.indexPattern.movingAverage.limitations": "La première valeur de moyenne mobile commence au deuxième élément.", "xpack.lens.indexPattern.movingAverage.longerExplanation": "Pour calculer la moyenne mobile, Lens utilise la moyenne de la fenêtre et applique une politique d'omission pour les blancs. Pour les valeurs manquantes, le groupe est ignoré, et le calcul est effectué sur la valeur suivante.", "xpack.lens.indexPattern.movingAverage.tableExplanation": "Par exemple, avec les données [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], vous pouvez calculer une moyenne mobile simple avec une taille de fenêtre de 5 :", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 0a79aba689f57..44cb5fcef981a 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -442,7 +442,6 @@ "xpack.lens.indexPattern.dateHistogram.autoAdvancedExplanation": "間隔は次のロジックに従います。", "xpack.lens.indexPattern.dateHistogram.autoBasicExplanation": "自動日付ヒストグラムは、間隔でデータフィールドをバケットに分割します。", "xpack.lens.indexPattern.dateHistogram.autoBoundHeader": "対象間隔の測定", - "xpack.lens.indexPattern.dateHistogram.autoHelpText": "仕組み", "xpack.lens.indexPattern.dateHistogram.autoInterval": "時間範囲のカスタマイズ", "xpack.lens.indexPattern.dateHistogram.autoIntervalHeader": "使用される間隔", "xpack.lens.indexPattern.dateHistogram.autoLongerExplanation": "間隔を選択するには、Lensは指定された時間範囲を{targetBarSetting}設定で除算します。Lensはデータに最適な間隔を計算します。たとえば、30分、1時間、12です。棒の最大数は{maxBarSetting}値で設定します。", @@ -575,7 +574,6 @@ "xpack.lens.indexPattern.moving_average.signature": "メトリック:数値、[window]:数値", "xpack.lens.indexPattern.movingAverage": "移動平均", "xpack.lens.indexPattern.movingAverage.basicExplanation": "移動平均はデータ全体でウィンドウをスライドし、平均値を表示します。移動平均は日付ヒストグラムでのみサポートされています。", - "xpack.lens.indexPattern.movingAverage.helpText": "仕組み", "xpack.lens.indexPattern.movingAverage.limitations": "最初の移動平均値は2番目の項目から開始します。", "xpack.lens.indexPattern.movingAverage.longerExplanation": "移動平均を計算するには、Lensはウィンドウの平均値を使用し、ギャップのスキップポリシーを適用します。 見つからない値がある場合、バケットがスキップされます。次の値に対して計算が実行されます。", "xpack.lens.indexPattern.movingAverage.tableExplanation": "たとえば、データ[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]がある場合、ウィンドウサイズ5でシンプルな移動平均を計算できます。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index adb097d9936c8..7101b5b874b78 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -447,7 +447,6 @@ "xpack.lens.indexPattern.dateHistogram.autoAdvancedExplanation": "时间间隔遵循以下逻辑:", "xpack.lens.indexPattern.dateHistogram.autoBasicExplanation": "自动日期直方图按时间间隔将数据字段拆分为桶。", "xpack.lens.indexPattern.dateHistogram.autoBoundHeader": "已度量目标时间间隔", - "xpack.lens.indexPattern.dateHistogram.autoHelpText": "运作方式", "xpack.lens.indexPattern.dateHistogram.autoInterval": "定制时间间隔", "xpack.lens.indexPattern.dateHistogram.autoIntervalHeader": "已用时间间隔", "xpack.lens.indexPattern.dateHistogram.autoLongerExplanation": "要选择时间间隔,Lens 按 {targetBarSetting} 设置分割指定的时间范围。Lens 为您的数据计算最佳时间间隔。例如 30m、1h 和 12。最大条形数由 {maxBarSetting} 值设置。", @@ -580,7 +579,6 @@ "xpack.lens.indexPattern.moving_average.signature": "指标:数字,[window]:数字", "xpack.lens.indexPattern.movingAverage": "移动平均值", "xpack.lens.indexPattern.movingAverage.basicExplanation": "移动平均值在数据上滑动时间窗并显示平均值。仅日期直方图支持移动平均值。", - "xpack.lens.indexPattern.movingAverage.helpText": "运作方式", "xpack.lens.indexPattern.movingAverage.limitations": "第一个移动平均值开始于第二项。", "xpack.lens.indexPattern.movingAverage.longerExplanation": "要计算移动平均值,Lens 使用时间窗的平均值,并为缺口应用跳过策略。 对于缺失值,将跳过桶,计算将基于下一个值执行。", "xpack.lens.indexPattern.movingAverage.tableExplanation": "例如,如果数据为 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],则可以使用时间窗大小 5 计算简单移动平均值:", From ab795cca6bf0bf205254a6f2be05cd0ca143aed7 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Fri, 29 Apr 2022 17:02:22 +0200 Subject: [PATCH 20/89] fixes flakiness (#131236) --- .../cases/attach_alert_to_case.spec.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/cases/attach_alert_to_case.spec.ts b/x-pack/plugins/security_solution/cypress/integration/cases/attach_alert_to_case.spec.ts index daf73d2db69d6..cac79b2114dd7 100644 --- a/x-pack/plugins/security_solution/cypress/integration/cases/attach_alert_to_case.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/cases/attach_alert_to_case.spec.ts @@ -10,10 +10,9 @@ import { ROLES } from '../../../common/test'; import { expandFirstAlertActions } from '../../tasks/alerts'; import { createCustomRuleEnabled } from '../../tasks/api_calls/rules'; -import { cleanKibana } from '../../tasks/common'; +import { cleanKibana, waitForPageToBeLoaded } from '../../tasks/common'; import { waitForAlertsToPopulate } from '../../tasks/create_new_rule'; import { login, visit, waitForPageWithoutDateRange } from '../../tasks/login'; -import { refreshPage } from '../../tasks/security_header'; import { ALERTS_URL } from '../../urls/navigation'; import { ATTACH_ALERT_TO_CASE_BUTTON, TIMELINE_CONTEXT_MENU_BTN } from '../../screens/alerts'; @@ -27,19 +26,17 @@ describe('Alerts timeline', () => { before(() => { // First we login as a privileged user to create alerts. cleanKibana(); - login(ROLES.platform_engineer); - visit(ALERTS_URL); + login(); createCustomRuleEnabled(getNewRule()); - refreshPage(); + visit(ALERTS_URL); waitForAlertsToPopulate(); - - // Then we login as read-only user to test. - login(ROLES.reader); }); context('Privileges: read only', () => { beforeEach(() => { + login(ROLES.reader); loadDetectionsPage(ROLES.reader); + waitForPageToBeLoaded(); }); it('should not allow user with read only privileges to attach alerts to cases', () => { @@ -50,7 +47,9 @@ describe('Alerts timeline', () => { context('Privileges: can crud', () => { beforeEach(() => { + login(ROLES.platform_engineer); loadDetectionsPage(ROLES.platform_engineer); + waitForPageToBeLoaded(); }); it('should allow a user with crud privileges to attach alerts to cases', () => { From a2acfe51172c8c45defcab50f3ca7bad6f0c2915 Mon Sep 17 00:00:00 2001 From: Max Kovalev Date: Fri, 29 Apr 2022 18:27:07 +0300 Subject: [PATCH 21/89] [Maps] allow feature editing for document layers with "applyGlobalTime", "applyGlobalQuery", and joins (#124803) * #124061 - feature editing updated logic for documents layer * 124061 - updates for disabling joins * 124061 - refactoring; Excluding filtering from when enabling editing mode * 124061 - fixes for failed tests * 124061 - fixed test for JoinEditor * 124061 - global time checkbox message fix * 124071 - updated snapshot for JoinEditor * 124061 - excluded applyGlobalQuery/applyGlobalTime from es_source in case of editing layer active * 124061 - refactoring * 124061 - fix for test * 124061 - refactoring; Added message for disabled filter * 124061 - replacing variables * 124061 - fixed test; refactoring * 124061 - refactoring; fixed tests * 124061 - refactoring; fixed tests * 124061 - refactoring; removed reuse isFeatureEditorOpenForLayer * 124061 - fixed tests * 124061 - removed isFeatureEditorOpenForLayer property * 124061 - buildVectorRequestMeta updates * 124061 - fixes for CI checks * 124061 - refactoring * 124061 - fixed test * 124061 - refactoring; fixed conflict * 124061 - syncDataLLayer called inside updateEditLayer * 124061 - reverting changes for Join editor * 124061 - removing unused isFeatureEditorOpenForLayer * 124061 - updating snap Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/maps/import-geospatial-data.asciidoc | 6 ----- .../data_request_descriptor_types.ts | 1 + .../public/actions/data_request_actions.ts | 3 +++ .../maps/public/actions/map_actions.ts | 4 ++- .../layers/__fixtures__/mock_sync_context.ts | 2 ++ .../layers/build_vector_request_meta.ts | 4 ++- .../layers/heatmap_layer/heatmap_layer.ts | 3 ++- .../blended_vector_layer.ts | 3 ++- .../layers/vector_layer/bounds_data.ts | 9 ++++++- .../geojson_vector_layer.tsx | 3 ++- .../mvt_vector_layer/mvt_source_data.test.ts | 7 +++++ .../mvt_vector_layer/mvt_vector_layer.tsx | 3 ++- .../layers/vector_layer/vector_layer.tsx | 16 +++++++++--- .../es_geo_grid_source.test.ts | 1 + .../es_search_source/es_search_source.test.ts | 1 + .../classes/sources/es_source/es_source.ts | 16 +++++++++--- .../sources/vector_source/vector_source.tsx | 1 + .../public/classes/util/can_skip_fetch.ts | 4 +++ .../components/global_filter_checkbox.tsx | 26 +++++++++++++------ .../components/global_time_checkbox.tsx | 26 +++++++++++++------ .../filter_editor/filter_editor.tsx | 13 ++++++++++ .../edit_layer_panel/filter_editor/index.ts | 6 +++-- .../join_editor/join_editor.tsx | 1 + .../__snapshots__/toc_entry.test.tsx.snap | 5 ---- .../layer_toc/toc_entry/index.ts | 2 +- .../layer_toc/toc_entry/toc_entry.test.tsx | 2 +- .../layer_toc/toc_entry/toc_entry.tsx | 7 +++-- .../toc_entry_actions_popover.test.tsx | 5 +--- .../toc_entry_actions_popover.tsx | 7 ++--- 29 files changed, 130 insertions(+), 57 deletions(-) diff --git a/docs/maps/import-geospatial-data.asciidoc b/docs/maps/import-geospatial-data.asciidoc index f58077fa38f92..8ee54e5dba638 100644 --- a/docs/maps/import-geospatial-data.asciidoc +++ b/docs/maps/import-geospatial-data.asciidoc @@ -96,12 +96,6 @@ To open an existing index for drawing: . Click *Add layer*. -. Set *Scaling* to *Limit results to 10,000*. - -. In **Filtering**: -** Clear the *Apply global search to layer data* checkbox. -** If your data view contains a default time field, clear the *Apply global time to layer data* checkbox. - . Click *Save & close*. . In the legend, click the layer name and select *Edit features*. 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 f3132d145c7a2..a560114d71b4f 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 @@ -41,6 +41,7 @@ export type VectorSourceRequestMeta = DataFilters & { sourceQuery?: Query; sourceMeta: object | null; isForceRefresh: boolean; + isFeatureEditorOpenForLayer: boolean; }; export type VectorJoinSourceRequestMeta = Omit; diff --git a/x-pack/plugins/maps/public/actions/data_request_actions.ts b/x-pack/plugins/maps/public/actions/data_request_actions.ts index 5788c9360fdf2..d2cb416dcbe20 100644 --- a/x-pack/plugins/maps/public/actions/data_request_actions.ts +++ b/x-pack/plugins/maps/public/actions/data_request_actions.ts @@ -24,6 +24,7 @@ import { getDataRequestDescriptor, getLayerById, getLayerList, + getEditState, } from '../selectors/map_selectors'; import { cancelRequest, @@ -67,6 +68,7 @@ export type DataRequestContext = { dataFilters: DataFilters; forceRefreshDueToDrawing: boolean; // Boolean signaling data request triggered by a user updating layer features via drawing tools. When true, layer will re-load regardless of "source.applyForceRefresh" flag. isForceRefresh: boolean; // Boolean signaling data request triggered by auto-refresh timer or user clicking refresh button. When true, layer will re-load only when "source.applyForceRefresh" flag is set to true. + isFeatureEditorOpenForLayer: boolean; // Boolean signaling that feature editor menu is open for a layer. When true, layer will ignore all global and layer filtering so drawn features are displayed and not filtered out. }; export function clearDataRequests(layer: ILayer) { @@ -145,6 +147,7 @@ function getDataRequestContext( dispatch(registerCancelCallback(requestToken, callback)), forceRefreshDueToDrawing, isForceRefresh, + isFeatureEditorOpenForLayer: getEditState(getState())?.layerId === layerId, }; } diff --git a/x-pack/plugins/maps/public/actions/map_actions.ts b/x-pack/plugins/maps/public/actions/map_actions.ts index 8a16d036393ad..e8585560238fd 100644 --- a/x-pack/plugins/maps/public/actions/map_actions.ts +++ b/x-pack/plugins/maps/public/actions/map_actions.ts @@ -58,6 +58,7 @@ import { autoFitToBounds, syncDataForAllLayers, syncDataForLayerDueToDrawing, + syncDataForLayerId, } from './data_request_actions'; import { addLayer, addLayerWithoutDataSync } from './layer_actions'; import { MapSettings } from '../reducers/map'; @@ -394,7 +395,7 @@ export function setEditLayerToSelectedLayer() { } export function updateEditLayer(layerId: string | null) { - return (dispatch: Dispatch) => { + return (dispatch: ThunkDispatch) => { if (layerId !== null) { dispatch({ type: SET_OPEN_TOOLTIPS, openTooltips: [] }); } @@ -406,6 +407,7 @@ export function updateEditLayer(layerId: string | null) { type: UPDATE_EDIT_STATE, editState: layerId ? { layerId } : undefined, }); + dispatch(syncDataForLayerId(layerId, false)); }; } diff --git a/x-pack/plugins/maps/public/classes/layers/__fixtures__/mock_sync_context.ts b/x-pack/plugins/maps/public/classes/layers/__fixtures__/mock_sync_context.ts index b81ba6c854629..4d1f23599f48d 100644 --- a/x-pack/plugins/maps/public/classes/layers/__fixtures__/mock_sync_context.ts +++ b/x-pack/plugins/maps/public/classes/layers/__fixtures__/mock_sync_context.ts @@ -20,6 +20,7 @@ export class MockSyncContext implements DataRequestContext { updateSourceData: (newData: unknown) => void; forceRefreshDueToDrawing: boolean; isForceRefresh: boolean; + isFeatureEditorOpenForLayer: boolean; constructor({ dataFilters }: { dataFilters: Partial }) { const mapFilters: DataFilters = { @@ -44,5 +45,6 @@ export class MockSyncContext implements DataRequestContext { this.updateSourceData = sinon.spy(); this.forceRefreshDueToDrawing = false; this.isForceRefresh = false; + this.isFeatureEditorOpenForLayer = false; } } diff --git a/x-pack/plugins/maps/public/classes/layers/build_vector_request_meta.ts b/x-pack/plugins/maps/public/classes/layers/build_vector_request_meta.ts index 52dd93033020d..e8d74003c6790 100644 --- a/x-pack/plugins/maps/public/classes/layers/build_vector_request_meta.ts +++ b/x-pack/plugins/maps/public/classes/layers/build_vector_request_meta.ts @@ -16,7 +16,8 @@ export function buildVectorRequestMeta( fieldNames: string[], dataFilters: DataFilters, sourceQuery: Query | null | undefined, - isForceRefresh: boolean + isForceRefresh: boolean, + isFeatureEditorOpenForLayer: boolean ): VectorSourceRequestMeta { return { ...dataFilters, @@ -28,5 +29,6 @@ export function buildVectorRequestMeta( sourceMeta: source.getSyncMeta(), applyForceRefresh: source.isESSource() ? source.getApplyForceRefresh() : false, isForceRefresh, + isFeatureEditorOpenForLayer, }; } diff --git a/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.ts b/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.ts index 66aef6d38803f..899db80884bc8 100644 --- a/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.ts +++ b/x-pack/plugins/maps/public/classes/layers/heatmap_layer/heatmap_layer.ts @@ -89,7 +89,8 @@ export class HeatmapLayer extends AbstractLayer { this.getSource().getFieldNames(), syncContext.dataFilters, this.getQuery(), - syncContext.isForceRefresh + syncContext.isForceRefresh, + syncContext.isFeatureEditorOpenForLayer ), source: this.getSource() as IMvtVectorSource, syncContext, diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/blended_vector_layer/blended_vector_layer.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/blended_vector_layer/blended_vector_layer.ts index e46c670b677ba..b1fddcca5d5f2 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/blended_vector_layer/blended_vector_layer.ts +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/blended_vector_layer/blended_vector_layer.ts @@ -298,7 +298,8 @@ export class BlendedVectorLayer extends GeoJsonVectorLayer implements IVectorLay syncContext.isForceRefresh, syncContext.dataFilters, this.getSource(), - this.getCurrentStyle() + this.getCurrentStyle(), + syncContext.isFeatureEditorOpenForLayer ); const source = this.getSource(); 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 29ecf1635d626..7136c9d0c2235 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 @@ -22,7 +22,13 @@ export async function syncBoundsData({ source: IVectorSource; sourceQuery: Query | null; }): Promise { - const { startLoading, stopLoading, registerCancelCallback, dataFilters } = syncContext; + const { + startLoading, + stopLoading, + registerCancelCallback, + dataFilters, + isFeatureEditorOpenForLayer, + } = syncContext; const requestToken = Symbol(`${SOURCE_BOUNDS_DATA_REQUEST_ID}-${layerId}`); @@ -37,6 +43,7 @@ export async function syncBoundsData({ joinKeyFilter: dataFilters.joinKeyFilter, applyGlobalQuery: source.getApplyGlobalQuery(), applyGlobalTime: source.getApplyGlobalTime(), + isFeatureEditorOpenForLayer, }; let bounds = null; 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 c6f9a282d0fa4..bc7ba78c84d98 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 @@ -237,7 +237,8 @@ export class GeoJsonVectorLayer extends AbstractVectorLayer { syncContext.isForceRefresh, syncContext.dataFilters, source, - style + style, + syncContext.isFeatureEditorOpenForLayer ), syncContext, source, diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.test.ts b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.test.ts index 4b45adc8848bd..ccc73f94aac57 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_source_data.test.ts @@ -59,6 +59,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }, source: mockSource, syncContext, @@ -90,6 +91,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; await syncMvtSourceData({ @@ -131,6 +133,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; await syncMvtSourceData({ @@ -169,6 +172,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; await syncMvtSourceData({ @@ -215,6 +219,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; await syncMvtSourceData({ @@ -253,6 +258,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; await syncMvtSourceData({ @@ -291,6 +297,7 @@ describe('syncMvtSourceData', () => { fieldNames: [], sourceMeta: {}, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; await syncMvtSourceData({ 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 a7a190c1c5b56..a7ec941fceca3 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 @@ -232,7 +232,8 @@ export class MvtVectorLayer extends AbstractVectorLayer { syncContext.isForceRefresh, syncContext.dataFilters, this.getSource(), - this.getCurrentStyle() + this.getCurrentStyle(), + syncContext.isFeatureEditorOpenForLayer ), source: this.getSource() as IMvtVectorSource, syncContext, 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 1b178d204f6e2..aee4312713b7d 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 @@ -366,7 +366,8 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { isForceRefresh: boolean, dataFilters: DataFilters, source: IVectorSource, - style: IVectorStyle + style: IVectorStyle, + isFeatureEditorOpenForLayer: boolean ): Promise { const fieldNames = [ ...source.getFieldNames(), @@ -378,7 +379,14 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { if (timesliceMaskFieldName) { fieldNames.push(timesliceMaskFieldName); } - return buildVectorRequestMeta(source, fieldNames, dataFilters, this.getQuery(), isForceRefresh); + return buildVectorRequestMeta( + source, + fieldNames, + dataFilters, + this.getQuery(), + isForceRefresh, + isFeatureEditorOpenForLayer + ); } async _syncSourceStyleMeta( @@ -542,6 +550,7 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { registerCancelCallback, dataFilters, isForceRefresh, + isFeatureEditorOpenForLayer, }: { join: InnerJoin } & DataRequestContext): Promise { const joinSource = join.getRightJoinSource(); const sourceDataId = join.getSourceDataRequestId(); @@ -552,7 +561,8 @@ export class AbstractVectorLayer extends AbstractLayer implements IVectorLayer { joinSource.getFieldNames(), dataFilters, joinSource.getWhereQuery(), - isForceRefresh + isForceRefresh, + isFeatureEditorOpenForLayer ) as VectorJoinSourceRequestMeta; const prevDataRequest = this.getDataRequest(sourceDataId); diff --git a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts index bcbc50c7e0090..7110473b11261 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/es_geo_grid_source.test.ts @@ -178,6 +178,7 @@ describe('ESGeoGridSource', () => { sourceMeta: null, zoom: 0, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; describe('getGeoJsonWithMeta', () => { 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 54071848f9a40..2df2e119df30c 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 @@ -106,6 +106,7 @@ describe('ESSearchSource', () => { applyGlobalTime: true, applyForceRefresh: true, isForceRefresh: false, + isFeatureEditorOpenForLayer: false, }; it('Should only include required props', async () => { 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 c0eef8ba1ca22..944bf0ee3e0b1 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 @@ -230,7 +230,17 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource allFilters.push(extentFilter); } - if (searchFilters.applyGlobalTime && (await this.isTimeAware())) { + + let isFeatureEditorOpenForLayer = false; + if ('isFeatureEditorOpenForLayer' in searchFilters) { + isFeatureEditorOpenForLayer = searchFilters.isFeatureEditorOpenForLayer; + } + + if ( + searchFilters.applyGlobalTime && + (await this.isTimeAware()) && + !isFeatureEditorOpenForLayer + ) { const timeRange = searchFilters.timeslice ? { from: new Date(searchFilters.timeslice.from).toISOString(), @@ -250,11 +260,11 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource searchSource.setField('index', indexPattern); searchSource.setField('size', limit); searchSource.setField('filter', allFilters); - if (searchFilters.applyGlobalQuery) { + if (searchFilters.applyGlobalQuery && !isFeatureEditorOpenForLayer) { searchSource.setField('query', searchFilters.query); } - if (searchFilters.sourceQuery) { + if (searchFilters.sourceQuery && !isFeatureEditorOpenForLayer) { const layerSearchSource = searchService.searchSource.createEmpty(); layerSearchSource.setField('index', indexPattern); 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 79830068628e5..43a2a00ca59e1 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; + isFeatureEditorOpenForLayer: boolean; joinKeyFilter?: Filter; } diff --git a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts index 69a5c73ba2933..71d4730880b96 100644 --- a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts +++ b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts @@ -86,6 +86,10 @@ export async function canSkipSourceUpdate({ return false; } + if (prevMeta.isFeatureEditorOpenForLayer !== nextRequestMeta.isFeatureEditorOpenForLayer) { + return false; + } + let updateDueToApplyGlobalTime = false; let updateDueToTime = false; let updateDueToTimeslice = false; diff --git a/x-pack/plugins/maps/public/components/global_filter_checkbox.tsx b/x-pack/plugins/maps/public/components/global_filter_checkbox.tsx index 96805e0c6b5ec..502cc1973d329 100644 --- a/x-pack/plugins/maps/public/components/global_filter_checkbox.tsx +++ b/x-pack/plugins/maps/public/components/global_filter_checkbox.tsx @@ -13,27 +13,37 @@ interface Props { applyGlobalQuery: boolean; label: string; setApplyGlobalQuery: (applyGlobalQuery: boolean) => void; + isFeatureEditorOpenForLayer?: boolean; } -export function GlobalFilterCheckbox({ applyGlobalQuery, label, setApplyGlobalQuery }: Props) { +export function GlobalFilterCheckbox({ + applyGlobalQuery, + label, + setApplyGlobalQuery, + isFeatureEditorOpenForLayer, +}: Props) { const onApplyGlobalQueryChange = (event: EuiSwitchEvent) => { setApplyGlobalQuery(event.target.checked); }; + const tooltipMessage = isFeatureEditorOpenForLayer + ? i18n.translate('xpack.maps.filterEditor.isGlobalSearchNotApplied', { + defaultMessage: 'Global search is not applied to the layer while editing features', + }) + : i18n.translate('xpack.maps.filterEditor.applyGlobalFilterHelp', { + defaultMessage: 'When enabled, results narrowed by global search', + }); + return ( - + diff --git a/x-pack/plugins/maps/public/components/global_time_checkbox.tsx b/x-pack/plugins/maps/public/components/global_time_checkbox.tsx index 70d6859b8b02a..4db771c1edbaf 100644 --- a/x-pack/plugins/maps/public/components/global_time_checkbox.tsx +++ b/x-pack/plugins/maps/public/components/global_time_checkbox.tsx @@ -12,27 +12,37 @@ interface Props { applyGlobalTime: boolean; label: string; setApplyGlobalTime: (applyGlobalTime: boolean) => void; + isFeatureEditorOpenForLayer?: boolean; } -export function GlobalTimeCheckbox({ applyGlobalTime, label, setApplyGlobalTime }: Props) { +export function GlobalTimeCheckbox({ + applyGlobalTime, + label, + setApplyGlobalTime, + isFeatureEditorOpenForLayer, +}: Props) { const onApplyGlobalTimeChange = (event: EuiSwitchEvent) => { setApplyGlobalTime(event.target.checked); }; + const tooltipMessage = isFeatureEditorOpenForLayer + ? i18n.translate('xpack.maps.filterEditor.isGlobalTimeNotApplied', { + defaultMessage: 'Global time is not applied to the layer while editing features', + }) + : i18n.translate('xpack.maps.filterEditor.applyGlobalTimeHelp', { + defaultMessage: 'When enabled, results narrowed by global time', + }); + return ( - + diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/filter_editor.tsx b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/filter_editor.tsx index afb18aa582a3c..9e3edeb1fc255 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/filter_editor.tsx +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/filter_editor.tsx @@ -35,6 +35,7 @@ export interface Props { layer: ILayer; setLayerQuery: (id: string, query: Query) => void; updateSourceProp: (layerId: string, propName: string, value: unknown) => void; + isFeatureEditorOpenForLayer: boolean; } interface State { @@ -157,6 +158,15 @@ export class FilterEditor extends Component { } _renderQuery() { + if (this.props.isFeatureEditorOpenForLayer) { + return ( + + ); + } + const query = this.props.layer.getQuery(); if (!query || !query.query) { return ( @@ -199,6 +209,7 @@ export class FilterEditor extends Component { onClick={this._toggle} data-test-subj="mapLayerPanelOpenFilterEditorButton" iconType={openButtonIcon} + disabled={this.props.isFeatureEditorOpenForLayer} > {openButtonLabel} @@ -213,6 +224,7 @@ export class FilterEditor extends Component { })} applyGlobalTime={this.props.layer.getSource().getApplyGlobalTime()} setApplyGlobalTime={this._onApplyGlobalTimeChange} + isFeatureEditorOpenForLayer={this.props.isFeatureEditorOpenForLayer} /> ) : null; @@ -244,6 +256,7 @@ export class FilterEditor extends Component { })} applyGlobalQuery={this.props.layer.getSource().getApplyGlobalQuery()} setApplyGlobalQuery={this._onApplyGlobalQueryChange} + isFeatureEditorOpenForLayer={this.props.isFeatureEditorOpenForLayer} /> {globalTimeCheckbox} diff --git a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/index.ts b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/index.ts index 7c3db15f10236..51b19e7b05c96 100644 --- a/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/index.ts +++ b/x-pack/plugins/maps/public/connected_components/edit_layer_panel/filter_editor/index.ts @@ -10,13 +10,15 @@ import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; import type { Query } from '@kbn/data-plugin/public'; import { FilterEditor } from './filter_editor'; -import { getSelectedLayer } from '../../../selectors/map_selectors'; +import { getEditState, getSelectedLayer } from '../../../selectors/map_selectors'; import { setLayerQuery, updateSourceProp } from '../../../actions'; import { MapStoreState } from '../../../reducers/store'; function mapStateToProps(state: MapStoreState) { + const layer = getSelectedLayer(state)!; return { - layer: getSelectedLayer(state)!, + layer, + isFeatureEditorOpenForLayer: getEditState(state)?.layerId === layer.getId(), }; } 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 cfa46ecf32b32..2865e2d8099d1 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 @@ -79,6 +79,7 @@ export function JoinEditor({ joins, layer, onChange, leftJoinFields, layerDispla function renderContent() { const disabledReason = layer.getJoinsDisabledReason(); + return disabledReason ? ( {disabledReason} ) : ( diff --git a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap index 5beaf12029d2f..cec85cb0e1cd6 100644 --- a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap +++ b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap @@ -11,7 +11,6 @@ exports[`TOCEntry is rendered 1`] = ` > {}, showTOCDetails: () => {}, - editModeActiveForLayer: false, + isFeatureEditorOpenForLayer: false, cancelEditing: () => {}, }; diff --git a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry.tsx b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry.tsx index aeba28cf033bd..65431432d8c6d 100644 --- a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry.tsx +++ b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry.tsx @@ -31,7 +31,7 @@ export interface ReduxStateProps { hasDirtyStateSelector: boolean; isLegendDetailsOpen: boolean; isEditButtonDisabled: boolean; - editModeActiveForLayer: boolean; + isFeatureEditorOpenForLayer: boolean; } export interface ReduxDispatchProps { @@ -282,7 +282,6 @@ export class TOCEntry extends Component { openLayerSettings={this._openLayerPanelWithCheck} isEditButtonDisabled={this.props.isEditButtonDisabled} supportsFitToBounds={this.state.supportsFitToBounds} - editModeActiveForLayer={this.props.editModeActiveForLayer} /> {this._renderQuickActions()} @@ -317,7 +316,7 @@ export class TOCEntry extends Component { 'mapTocEntry-isSelected': this.props.layer.isPreviewLayer() || (this.props.selectedLayer && this.props.selectedLayer.getId() === this.props.layer.getId()), - 'mapTocEntry-isInEditingMode': this.props.editModeActiveForLayer, + 'mapTocEntry-isInEditingMode': this.props.isFeatureEditorOpenForLayer, }); return ( @@ -334,7 +333,7 @@ export class TOCEntry extends Component { {this._renderCancelModal()} - {this.props.editModeActiveForLayer && ( + {this.props.isFeatureEditorOpenForLayer && (
diff --git a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx index ae62b75400769..cb2697663766a 100644 --- a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx +++ b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.test.tsx @@ -48,7 +48,6 @@ const defaultProps = { enableShapeEditing: () => {}, enablePointEditing: () => {}, openLayerSettings: () => {}, - editModeActiveForLayer: false, numLayers: 2, showThisLayerOnly: () => {}, }; @@ -105,9 +104,7 @@ describe('TOCEntryActionsPopover', () => { }); test('should disable Edit features when edit mode active for layer', async () => { - const component = shallow( - - ); + const component = shallow(); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); diff --git a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx index 3f3b7558409f8..5e33931a8943e 100644 --- a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx +++ b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx @@ -36,7 +36,6 @@ export interface Props { showThisLayerOnly: (layerId: string) => void; supportsFitToBounds: boolean; toggleVisible: (layerId: string) => void; - editModeActiveForLayer: boolean; numLayers: number; } @@ -90,9 +89,7 @@ export class TOCEntryActionsPopover extends Component { } if ( - (source as ESSearchSource).getApplyGlobalQuery() || (source as ESSearchSource).getSyncMeta().scalingType === SCALING_TYPES.CLUSTERS || - (await vectorLayer.isFilteredByGlobalTime()) || vectorLayer.isPreviewLayer() || !vectorLayer.isVisible() || vectorLayer.hasJoins() @@ -194,9 +191,9 @@ export class TOCEntryActionsPopover extends Component { ? null : i18n.translate('xpack.maps.layerTocActions.editFeaturesTooltip.disabledMessage', { defaultMessage: - 'Edit features only supported for document layers without clustering, term joins, time filtering, or global search.', + 'Edit features is only supported for layers without clustering and term joins', }), - disabled: !this.state.isFeatureEditingEnabled || this.props.editModeActiveForLayer, + disabled: !this.state.isFeatureEditingEnabled, onClick: async () => { this._closePopover(); const supportedShapeTypes = await ( From 4b5c85dc78e2867ef16b7acd8615db4f5d2bd845 Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Fri, 29 Apr 2022 17:35:58 +0200 Subject: [PATCH 22/89] =?UTF-8?q?[Actions=20Triggers=20UI]=20Register=20in?= =?UTF-8?q?itial=20alerts=20table=20configuration=20reg=E2=80=A6=20(#13088?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Xavier Mouligneau Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../register_alerts_table_configuration.tsx | 23 +++++++++++++++++++ x-pack/plugins/observability/public/plugin.ts | 8 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx diff --git a/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx b/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx new file mode 100644 index 0000000000000..1999fe82e3a6d --- /dev/null +++ b/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { AlertsTableConfigurationRegistryContract } from '@kbn/triggers-actions-ui-plugin/public'; + +import { observabilityFeatureId } from '../../common'; +import { columns as alertO11yColumns } from '../pages/alerts/containers/alerts_table_t_grid/alerts_table_t_grid'; + +const registerAlertsTableConfiguration = (registry: AlertsTableConfigurationRegistryContract) => { + if (registry.has(observabilityFeatureId)) { + return; + } + registry.register({ + id: observabilityFeatureId, + columns: alertO11yColumns, + }); +}; + +export { registerAlertsTableConfiguration }; diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index a19c5dfa0c3ce..cb8dcaf2dd7e4 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -32,6 +32,7 @@ import { TriggersAndActionsUIPublicPluginStart, } from '@kbn/triggers-actions-ui-plugin/public'; import { KibanaFeature } from '@kbn/features-plugin/common'; + import { ConfigSchema } from '.'; import { observabilityAppId, observabilityFeatureId, casesPath } from '../common'; import { createLazyObservabilityPageTemplate } from './components/shared'; @@ -144,6 +145,12 @@ export class Plugin const { renderApp } = await import('./application'); // Get start services const [coreStart, pluginsStart, { navigation }] = await coreSetup.getStartServices(); + // Register alerts metadata + const { registerAlertsTableConfiguration } = await import( + './config/register_alerts_table_configuration' + ); + const { alertsTableConfigurationRegistry } = pluginsStart.triggersActionsUi; + registerAlertsTableConfiguration(alertsTableConfigurationRegistry); // The `/api/features` endpoint requires the "Global All" Kibana privilege. Users with a // subset of this privilege are not authorized to access this endpoint and will receive a 404 // error that causes the Alerting view to fail to load. @@ -268,7 +275,6 @@ export class Plugin public start(coreStart: CoreStart, pluginsStart: ObservabilityPublicPluginsStart) { const { application } = coreStart; - const config = this.initializerContext.config.get(); updateGlobalNavigation({ From 78ed6deed4750b149dc4a3cddf12cd1380239f19 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Fri, 29 Apr 2022 11:46:40 -0400 Subject: [PATCH 23/89] synthetics - adjust default monitor values (#131025) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../synthetics/common/constants/index.ts | 1 - .../common/constants/monitor_defaults.ts | 167 ++++++++++++++++++ .../monitor_management/monitor_types.ts | 10 ++ .../fleet_package/common/default_values.ts | 25 --- .../fleet_package/common/normalizers.ts | 16 +- .../contexts/browser_context.tsx | 35 +--- .../contexts/browser_context_advanced.tsx | 16 +- .../fleet_package/contexts/http_context.tsx | 14 +- .../contexts/http_context_advanced.tsx | 21 +-- .../fleet_package/contexts/icmp_context.tsx | 11 +- .../fleet_package/contexts/index.ts | 29 --- .../contexts/policy_config_context.tsx | 2 +- .../fleet_package/contexts/tcp_context.tsx | 13 +- .../contexts/tcp_context_advanced.tsx | 10 +- .../contexts/tls_fields_context.tsx | 4 +- .../fleet_package/hooks/use_policy.ts | 28 +-- .../synthetics_policy_create_extension.tsx | 32 +--- .../fleet_package/tls/default_values.ts | 17 -- .../edit_monitor_config.tsx | 2 +- .../monitor_config/monitor_config.tsx | 5 +- .../formatters/convert_to_data_stream.ts | 2 +- 21 files changed, 220 insertions(+), 240 deletions(-) create mode 100644 x-pack/plugins/synthetics/common/constants/monitor_defaults.ts delete mode 100644 x-pack/plugins/synthetics/public/components/fleet_package/common/default_values.ts delete mode 100644 x-pack/plugins/synthetics/public/components/fleet_package/tls/default_values.ts diff --git a/x-pack/plugins/synthetics/common/constants/index.ts b/x-pack/plugins/synthetics/common/constants/index.ts index c7649d73b8af3..b85cfb0a0d9b6 100644 --- a/x-pack/plugins/synthetics/common/constants/index.ts +++ b/x-pack/plugins/synthetics/common/constants/index.ts @@ -13,4 +13,3 @@ export * from './settings_defaults'; export { QUERY } from './query'; export * from './ui'; export * from './rest_api'; -export const DEFAULT_NAMESPACE_STRING = 'default'; diff --git a/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts new file mode 100644 index 0000000000000..e7f79fc2086a2 --- /dev/null +++ b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts @@ -0,0 +1,167 @@ +/* + * Copyright 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 { + BrowserAdvancedFields, + BrowserSimpleFields, + CommonFields, + DataStream, + HTTPAdvancedFields, + HTTPMethod, + HTTPSimpleFields, + ICMPSimpleFields, + Mode, + MonitorDefaults, + ResponseBodyIndexPolicy, + ScheduleUnit, + ScreenshotOption, + TCPAdvancedFields, + TCPSimpleFields, + TLSFields, + TLSVersion, + VerificationMode, +} from '../runtime_types/monitor_management'; +import { ConfigKey } from './monitor_management'; + +export const DEFAULT_NAMESPACE_STRING = 'default'; + +export const DEFAULT_COMMON_FIELDS: CommonFields = { + [ConfigKey.MONITOR_TYPE]: DataStream.HTTP, + [ConfigKey.ENABLED]: true, + [ConfigKey.SCHEDULE]: { + number: '3', + unit: ScheduleUnit.MINUTES, + }, + [ConfigKey.APM_SERVICE_NAME]: '', + [ConfigKey.TAGS]: [], + [ConfigKey.TIMEOUT]: '16', + [ConfigKey.NAME]: '', + [ConfigKey.LOCATIONS]: [], + [ConfigKey.NAMESPACE]: DEFAULT_NAMESPACE_STRING, +}; + +export const DEFAULT_BROWSER_ADVANCED_FIELDS: BrowserAdvancedFields = { + [ConfigKey.SCREENSHOTS]: ScreenshotOption.ON, + [ConfigKey.SYNTHETICS_ARGS]: [], + [ConfigKey.JOURNEY_FILTERS_MATCH]: '', + [ConfigKey.JOURNEY_FILTERS_TAGS]: [], + [ConfigKey.IGNORE_HTTPS_ERRORS]: false, + [ConfigKey.IS_THROTTLING_ENABLED]: true, + [ConfigKey.DOWNLOAD_SPEED]: '5', + [ConfigKey.UPLOAD_SPEED]: '3', + [ConfigKey.LATENCY]: '20', + [ConfigKey.THROTTLING_CONFIG]: '5d/3u/20l', +}; + +export const DEFAULT_BROWSER_SIMPLE_FIELDS: BrowserSimpleFields = { + ...DEFAULT_COMMON_FIELDS, + [ConfigKey.SCHEDULE]: { + unit: ScheduleUnit.MINUTES, + number: '10', + }, + [ConfigKey.METADATA]: { + script_source: { + is_generated_script: false, + file_name: '', + }, + is_zip_url_tls_enabled: false, + }, + [ConfigKey.MONITOR_TYPE]: DataStream.BROWSER, + [ConfigKey.SOURCE_INLINE]: '', + [ConfigKey.SOURCE_ZIP_URL]: '', + [ConfigKey.SOURCE_ZIP_USERNAME]: '', + [ConfigKey.SOURCE_ZIP_PASSWORD]: '', + [ConfigKey.SOURCE_ZIP_FOLDER]: '', + [ConfigKey.SOURCE_ZIP_PROXY_URL]: '', + [ConfigKey.PARAMS]: '', + [ConfigKey.ZIP_URL_TLS_CERTIFICATE_AUTHORITIES]: undefined, + [ConfigKey.ZIP_URL_TLS_CERTIFICATE]: undefined, + [ConfigKey.ZIP_URL_TLS_KEY]: undefined, + [ConfigKey.ZIP_URL_TLS_KEY_PASSPHRASE]: undefined, + [ConfigKey.ZIP_URL_TLS_VERIFICATION_MODE]: undefined, + [ConfigKey.ZIP_URL_TLS_VERSION]: undefined, + [ConfigKey.URLS]: undefined, + [ConfigKey.PORT]: undefined, +}; + +export const DEFAULT_HTTP_SIMPLE_FIELDS: HTTPSimpleFields = { + ...DEFAULT_COMMON_FIELDS, + [ConfigKey.METADATA]: { + is_tls_enabled: false, + }, + [ConfigKey.URLS]: '', + [ConfigKey.MAX_REDIRECTS]: '0', + [ConfigKey.MONITOR_TYPE]: DataStream.HTTP, +}; + +export const DEFAULT_HTTP_ADVANCED_FIELDS: HTTPAdvancedFields = { + [ConfigKey.PASSWORD]: '', + [ConfigKey.PROXY_URL]: '', + [ConfigKey.RESPONSE_BODY_CHECK_NEGATIVE]: [], + [ConfigKey.RESPONSE_BODY_CHECK_POSITIVE]: [], + [ConfigKey.RESPONSE_BODY_INDEX]: ResponseBodyIndexPolicy.ON_ERROR, + [ConfigKey.RESPONSE_HEADERS_CHECK]: {}, + [ConfigKey.RESPONSE_HEADERS_INDEX]: true, + [ConfigKey.RESPONSE_STATUS_CHECK]: [], + [ConfigKey.REQUEST_BODY_CHECK]: { + value: '', + type: Mode.PLAINTEXT, + }, + [ConfigKey.REQUEST_HEADERS_CHECK]: {}, + [ConfigKey.REQUEST_METHOD_CHECK]: HTTPMethod.GET, + [ConfigKey.USERNAME]: '', +}; + +export const DEFAULT_ICMP_SIMPLE_FIELDS: ICMPSimpleFields = { + ...DEFAULT_COMMON_FIELDS, + [ConfigKey.HOSTS]: '', + [ConfigKey.MONITOR_TYPE]: DataStream.ICMP, + [ConfigKey.WAIT]: '1', +}; + +export const DEFAULT_TCP_SIMPLE_FIELDS: TCPSimpleFields = { + ...DEFAULT_COMMON_FIELDS, + [ConfigKey.METADATA]: { + is_tls_enabled: false, + }, + [ConfigKey.HOSTS]: '', + [ConfigKey.MONITOR_TYPE]: DataStream.TCP, +}; + +export const DEFAULT_TCP_ADVANCED_FIELDS: TCPAdvancedFields = { + [ConfigKey.PROXY_URL]: '', + [ConfigKey.PROXY_USE_LOCAL_RESOLVER]: false, + [ConfigKey.RESPONSE_RECEIVE_CHECK]: '', + [ConfigKey.REQUEST_SEND_CHECK]: '', +}; + +export const DEFAULT_TLS_FIELDS: TLSFields = { + [ConfigKey.TLS_CERTIFICATE_AUTHORITIES]: '', + [ConfigKey.TLS_CERTIFICATE]: '', + [ConfigKey.TLS_KEY]: '', + [ConfigKey.TLS_KEY_PASSPHRASE]: '', + [ConfigKey.TLS_VERIFICATION_MODE]: VerificationMode.FULL, + [ConfigKey.TLS_VERSION]: [TLSVersion.ONE_ONE, TLSVersion.ONE_TWO, TLSVersion.ONE_THREE], +}; + +export const DEFAULT_FIELDS: MonitorDefaults = { + [DataStream.HTTP]: { + ...DEFAULT_HTTP_SIMPLE_FIELDS, + ...DEFAULT_HTTP_ADVANCED_FIELDS, + ...DEFAULT_TLS_FIELDS, + }, + [DataStream.TCP]: { + ...DEFAULT_TCP_SIMPLE_FIELDS, + ...DEFAULT_TCP_ADVANCED_FIELDS, + ...DEFAULT_TLS_FIELDS, + }, + [DataStream.ICMP]: DEFAULT_ICMP_SIMPLE_FIELDS, + [DataStream.BROWSER]: { + ...DEFAULT_BROWSER_SIMPLE_FIELDS, + ...DEFAULT_BROWSER_ADVANCED_FIELDS, + ...DEFAULT_TLS_FIELDS, + }, +}; diff --git a/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts index c093705e858d8..0e96b8b9de6e2 100644 --- a/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts +++ b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts @@ -10,6 +10,7 @@ import { secretKeys } from '../../constants/monitor_management'; import { ConfigKey } from './config_key'; import { MonitorServiceLocationsCodec, ServiceLocationErrors } from './locations'; import { + DataStream, DataStreamCodec, ModeCodec, ResponseBodyIndexPolicyCodec, @@ -308,6 +309,15 @@ export type EncryptedSyntheticsMonitorWithId = t.TypeOf< typeof EncryptedSyntheticsMonitorWithIdCodec >; +export const MonitorDefaultsCodec = t.interface({ + [DataStream.HTTP]: HTTPFieldsCodec, + [DataStream.TCP]: TCPFieldsCodec, + [DataStream.ICMP]: ICMPSimpleFieldsCodec, + [DataStream.BROWSER]: BrowserFieldsCodec, +}); + +export type MonitorDefaults = t.TypeOf; + export const MonitorManagementListResultCodec = t.type({ monitors: t.array( t.interface({ diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/default_values.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/default_values.ts deleted file mode 100644 index 54c6969833cf1..0000000000000 --- a/x-pack/plugins/synthetics/public/components/fleet_package/common/default_values.ts +++ /dev/null @@ -1,25 +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 { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants'; -import { CommonFields, ConfigKey, ScheduleUnit, DataStream } from '../types'; - -export const defaultValues: CommonFields = { - [ConfigKey.MONITOR_TYPE]: DataStream.HTTP, - [ConfigKey.LOCATIONS]: [], - [ConfigKey.ENABLED]: true, - [ConfigKey.SCHEDULE]: { - number: '3', - unit: ScheduleUnit.MINUTES, - }, - [ConfigKey.APM_SERVICE_NAME]: '', - [ConfigKey.TAGS]: [], - [ConfigKey.TIMEOUT]: '16', - [ConfigKey.NAME]: '', - [ConfigKey.LOCATIONS]: [], - [ConfigKey.NAMESPACE]: DEFAULT_NAMESPACE_STRING, -}; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts b/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts index 8f1b7ad230d9c..3cb312488868c 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts +++ b/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts @@ -7,9 +7,11 @@ import { NewPackagePolicyInput } from '@kbn/fleet-plugin/common'; import { CommonFields, ConfigKey, DataStream } from '../types'; -import { defaultValues as commonDefaultValues } from './default_values'; -import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants'; -import { defaultConfig } from '../contexts'; +import { + DEFAULT_COMMON_FIELDS, + DEFAULT_NAMESPACE_STRING, + DEFAULT_FIELDS, +} from '../../../../common/constants/monitor_defaults'; // TO DO: create a standard input format that all fields resolve to export type Normalizer = (fields: NewPackagePolicyInput['vars']) => unknown; @@ -46,15 +48,15 @@ export function getCronNormalizer(key: string, defaultValues: Fields): N } export const getCommonNormalizer = (key: ConfigKey) => { - return getNormalizer(key, commonDefaultValues); + return getNormalizer(key, DEFAULT_COMMON_FIELDS); }; export const getCommonjsonToJavascriptNormalizer = (key: ConfigKey) => { - return getJsonToJavascriptNormalizer(key, commonDefaultValues); + return getJsonToJavascriptNormalizer(key, DEFAULT_COMMON_FIELDS); }; export const getCommonCronToSecondsNormalizer = (key: ConfigKey) => { - return getCronNormalizer(key, commonDefaultValues); + return getCronNormalizer(key, DEFAULT_COMMON_FIELDS); }; export const commonNormalizers: CommonNormalizerMap = { @@ -76,7 +78,7 @@ export const commonNormalizers: CommonNormalizerMap = { number, }; } else { - return defaultConfig[type][ConfigKey.SCHEDULE]; + return DEFAULT_FIELDS[type][ConfigKey.SCHEDULE]; } }, [ConfigKey.APM_SERVICE_NAME]: getCommonNormalizer(ConfigKey.APM_SERVICE_NAME), diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx index f7b67488e4bcc..aecd9091c3276 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx @@ -6,8 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { BrowserSimpleFields, ConfigKey, DataStream, ScheduleUnit } from '../types'; -import { defaultValues as commonDefaultValues } from '../common/default_values'; +import { BrowserSimpleFields } from '../types'; +import { DEFAULT_BROWSER_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; interface BrowserSimpleFieldsContext { setFields: React.Dispatch>; @@ -20,36 +20,7 @@ interface BrowserSimpleFieldsContextProvider { defaultValues?: BrowserSimpleFields; } -export const initialValues: BrowserSimpleFields = { - ...commonDefaultValues, - [ConfigKey.SCHEDULE]: { - unit: ScheduleUnit.MINUTES, - number: '10', - }, - [ConfigKey.METADATA]: { - script_source: { - is_generated_script: false, - file_name: '', - }, - is_zip_url_tls_enabled: false, - }, - [ConfigKey.MONITOR_TYPE]: DataStream.BROWSER, - [ConfigKey.SOURCE_ZIP_URL]: '', - [ConfigKey.SOURCE_ZIP_USERNAME]: '', - [ConfigKey.SOURCE_ZIP_PASSWORD]: '', - [ConfigKey.SOURCE_ZIP_FOLDER]: '', - [ConfigKey.SOURCE_ZIP_PROXY_URL]: '', - [ConfigKey.SOURCE_INLINE]: '', - [ConfigKey.PARAMS]: '', - [ConfigKey.ZIP_URL_TLS_CERTIFICATE_AUTHORITIES]: undefined, - [ConfigKey.ZIP_URL_TLS_CERTIFICATE]: undefined, - [ConfigKey.ZIP_URL_TLS_KEY]: undefined, - [ConfigKey.ZIP_URL_TLS_KEY_PASSPHRASE]: undefined, - [ConfigKey.ZIP_URL_TLS_VERIFICATION_MODE]: undefined, - [ConfigKey.ZIP_URL_TLS_VERSION]: undefined, - [ConfigKey.URLS]: undefined, - [ConfigKey.PORT]: undefined, -}; +export const initialValues: BrowserSimpleFields = DEFAULT_BROWSER_SIMPLE_FIELDS; const defaultContext: BrowserSimpleFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx index 3ddd7953a6310..114491d890394 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx @@ -6,7 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { BrowserAdvancedFields, ConfigKey, ScreenshotOption } from '../types'; +import { BrowserAdvancedFields } from '../types'; +import { DEFAULT_BROWSER_ADVANCED_FIELDS } from '../../../../common/constants/monitor_defaults'; interface BrowserAdvancedFieldsContext { setFields: React.Dispatch>; @@ -19,18 +20,7 @@ interface BrowserAdvancedFieldsContextProvider { defaultValues?: BrowserAdvancedFields; } -export const initialValues: BrowserAdvancedFields = { - [ConfigKey.SCREENSHOTS]: ScreenshotOption.ON, - [ConfigKey.SYNTHETICS_ARGS]: [], - [ConfigKey.JOURNEY_FILTERS_MATCH]: '', - [ConfigKey.JOURNEY_FILTERS_TAGS]: [], - [ConfigKey.IGNORE_HTTPS_ERRORS]: false, - [ConfigKey.IS_THROTTLING_ENABLED]: true, - [ConfigKey.DOWNLOAD_SPEED]: '5', - [ConfigKey.UPLOAD_SPEED]: '3', - [ConfigKey.LATENCY]: '20', - [ConfigKey.THROTTLING_CONFIG]: '5d/3u/20l', -}; +export const initialValues: BrowserAdvancedFields = DEFAULT_BROWSER_ADVANCED_FIELDS; const defaultContext: BrowserAdvancedFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx index a4a0c7bb16aa8..092c938b63f7e 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx @@ -6,8 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { HTTPSimpleFields, ConfigKey, DataStream } from '../types'; -import { defaultValues as commonDefaultValues } from '../common/default_values'; +import { HTTPSimpleFields } from '../types'; +import { DEFAULT_HTTP_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; interface HTTPSimpleFieldsContext { setFields: React.Dispatch>; @@ -20,15 +20,7 @@ interface HTTPSimpleFieldsContextProvider { defaultValues?: HTTPSimpleFields; } -export const initialValues: HTTPSimpleFields = { - ...commonDefaultValues, - [ConfigKey.METADATA]: { - is_tls_enabled: false, - }, - [ConfigKey.URLS]: '', - [ConfigKey.MAX_REDIRECTS]: '0', - [ConfigKey.MONITOR_TYPE]: DataStream.HTTP, -}; +export const initialValues: HTTPSimpleFields = DEFAULT_HTTP_SIMPLE_FIELDS; const defaultContext: HTTPSimpleFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx index 4d64bd3cf1ad4..19355d38b9486 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx @@ -6,7 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { HTTPAdvancedFields, ConfigKey, Mode, ResponseBodyIndexPolicy, HTTPMethod } from '../types'; +import { HTTPAdvancedFields } from '../types'; +import { DEFAULT_HTTP_ADVANCED_FIELDS } from '../../../../common/constants/monitor_defaults'; interface HTTPAdvancedFieldsContext { setFields: React.Dispatch>; @@ -19,23 +20,7 @@ interface HTTPAdvancedFieldsContextProvider { defaultValues?: HTTPAdvancedFields; } -export const initialValues: HTTPAdvancedFields = { - [ConfigKey.PASSWORD]: '', - [ConfigKey.PROXY_URL]: '', - [ConfigKey.RESPONSE_BODY_CHECK_NEGATIVE]: [], - [ConfigKey.RESPONSE_BODY_CHECK_POSITIVE]: [], - [ConfigKey.RESPONSE_BODY_INDEX]: ResponseBodyIndexPolicy.ON_ERROR, - [ConfigKey.RESPONSE_HEADERS_CHECK]: {}, - [ConfigKey.RESPONSE_HEADERS_INDEX]: true, - [ConfigKey.RESPONSE_STATUS_CHECK]: [], - [ConfigKey.REQUEST_BODY_CHECK]: { - value: '', - type: Mode.PLAINTEXT, - }, - [ConfigKey.REQUEST_HEADERS_CHECK]: {}, - [ConfigKey.REQUEST_METHOD_CHECK]: HTTPMethod.GET, - [ConfigKey.USERNAME]: '', -}; +export const initialValues: HTTPAdvancedFields = DEFAULT_HTTP_ADVANCED_FIELDS; export const defaultContext: HTTPAdvancedFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx index f0547e621afc4..39409e4ed76a5 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx @@ -6,8 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { ICMPSimpleFields, ConfigKey, DataStream } from '../types'; -import { defaultValues as commonDefaultValues } from '../common/default_values'; +import { ICMPSimpleFields } from '../types'; +import { DEFAULT_ICMP_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; interface ICMPSimpleFieldsContext { setFields: React.Dispatch>; @@ -20,12 +20,7 @@ interface ICMPSimpleFieldsContextProvider { defaultValues?: ICMPSimpleFields; } -export const initialValues: ICMPSimpleFields = { - ...commonDefaultValues, - [ConfigKey.HOSTS]: '', - [ConfigKey.MONITOR_TYPE]: DataStream.ICMP, - [ConfigKey.WAIT]: '1', -}; +export const initialValues: ICMPSimpleFields = DEFAULT_ICMP_SIMPLE_FIELDS; const defaultContext: ICMPSimpleFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts index 3f392c42983b6..a80e295e8bc40 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts @@ -4,16 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { DataStream, PolicyConfig } from '../types'; -import { initialValues as defaultHTTPSimpleFields } from './http_context'; -import { initialValues as defaultHTTPAdvancedFields } from './http_context_advanced'; -import { initialValues as defaultTCPSimpleFields } from './tcp_context'; -import { initialValues as defaultICMPSimpleFields } from './icmp_context'; -import { initialValues as defaultTCPAdvancedFields } from './tcp_context_advanced'; -import { initialValues as defaultBrowserSimpleFields } from './browser_context'; -import { initialValues as defaultBrowserAdvancedFields } from './browser_context_advanced'; -import { initialValues as defaultTLSFields } from './tls_fields_context'; - export type { IPolicyConfigContextProvider } from './policy_config_context'; export { PolicyConfigContext, @@ -74,22 +64,3 @@ export { HTTPContextProvider } from './http_provider'; export { TCPContextProvider } from './tcp_provider'; export { BrowserContextProvider } from './browser_provider'; export { SyntheticsProviders } from './synthetics_context_providers'; - -export const defaultConfig: PolicyConfig = { - [DataStream.HTTP]: { - ...defaultHTTPSimpleFields, - ...defaultHTTPAdvancedFields, - ...defaultTLSFields, - }, - [DataStream.TCP]: { - ...defaultTCPSimpleFields, - ...defaultTCPAdvancedFields, - ...defaultTLSFields, - }, - [DataStream.ICMP]: defaultICMPSimpleFields, - [DataStream.BROWSER]: { - ...defaultBrowserSimpleFields, - ...defaultBrowserAdvancedFields, - ...defaultTLSFields, - }, -}; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx index 5d47b4e9d0984..a9d5df172d83c 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx @@ -6,7 +6,7 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants'; +import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants/monitor_defaults'; import { ScheduleUnit, MonitorServiceLocations, diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx index 38a15c3e39453..ca6788f380118 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx @@ -6,8 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { TCPSimpleFields, ConfigKey, DataStream } from '../types'; -import { defaultValues as commonDefaultValues } from '../common/default_values'; +import { TCPSimpleFields } from '../types'; +import { DEFAULT_TCP_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; interface TCPSimpleFieldsContext { setFields: React.Dispatch>; @@ -20,14 +20,7 @@ interface TCPSimpleFieldsContextProvider { defaultValues?: TCPSimpleFields; } -export const initialValues: TCPSimpleFields = { - ...commonDefaultValues, - [ConfigKey.METADATA]: { - is_tls_enabled: false, - }, - [ConfigKey.HOSTS]: '', - [ConfigKey.MONITOR_TYPE]: DataStream.TCP, -}; +export const initialValues: TCPSimpleFields = DEFAULT_TCP_SIMPLE_FIELDS; const defaultContext: TCPSimpleFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx index 7fe29f7648841..0a26cb83d9aa0 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx @@ -6,7 +6,8 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { TCPAdvancedFields, ConfigKey } from '../types'; +import { TCPAdvancedFields } from '../types'; +import { DEFAULT_TCP_ADVANCED_FIELDS } from '../../../../common/constants/monitor_defaults'; interface TCPAdvancedFieldsContext { setFields: React.Dispatch>; @@ -19,12 +20,7 @@ interface TCPAdvancedFieldsContextProvider { defaultValues?: TCPAdvancedFields; } -export const initialValues: TCPAdvancedFields = { - [ConfigKey.PROXY_URL]: '', - [ConfigKey.PROXY_USE_LOCAL_RESOLVER]: false, - [ConfigKey.RESPONSE_RECEIVE_CHECK]: '', - [ConfigKey.REQUEST_SEND_CHECK]: '', -}; +export const initialValues: TCPAdvancedFields = DEFAULT_TCP_ADVANCED_FIELDS; const defaultContext: TCPAdvancedFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx index a76655a235c4f..7ed41694000b9 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { TLSFields } from '../types'; -import { defaultValues as tlsDefaultValues } from '../tls/default_values'; +import { DEFAULT_TLS_FIELDS } from '../../../../common/constants/monitor_defaults'; interface TLSFieldsContext { setFields: React.Dispatch>; @@ -20,7 +20,7 @@ interface TLSFieldsContextProvider { defaultValues?: TLSFields; } -export const initialValues: TLSFields = tlsDefaultValues; +export const initialValues: TLSFields = DEFAULT_TLS_FIELDS; const defaultContext: TLSFieldsContext = { setFields: (_fields: React.SetStateAction) => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts b/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts index 2fc33de1bab39..8cef83a925515 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts +++ b/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts @@ -25,34 +25,10 @@ import { useTLSFieldsContext, useBrowserSimpleFieldsContext, useBrowserAdvancedFieldsContext, - defaultHTTPAdvancedFields, - defaultHTTPSimpleFields, - defaultICMPSimpleFields, - defaultTCPSimpleFields, - defaultTCPAdvancedFields, - defaultBrowserSimpleFields, - defaultBrowserAdvancedFields, - defaultTLSFields, } from '../contexts'; +import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; -export const defaultConfig: PolicyConfig = { - [DataStream.HTTP]: { - ...defaultHTTPSimpleFields, - ...defaultHTTPAdvancedFields, - ...defaultTLSFields, - }, - [DataStream.TCP]: { - ...defaultTCPSimpleFields, - ...defaultTCPAdvancedFields, - ...defaultTLSFields, - }, - [DataStream.ICMP]: defaultICMPSimpleFields, - [DataStream.BROWSER]: { - ...defaultBrowserSimpleFields, - ...defaultBrowserAdvancedFields, - ...defaultTLSFields, - }, -}; +export const defaultConfig: PolicyConfig = DEFAULT_FIELDS; export const usePolicy = (fleetPolicyName: string = '') => { const { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx index e93cc20e4d2ad..ae035550a979d 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx +++ b/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx @@ -10,40 +10,14 @@ import { PackagePolicyCreateExtensionComponentProps } from '@kbn/fleet-plugin/pu import { useTrackPageview } from '@kbn/observability-plugin/public'; import { DataStream } from './types'; import { PolicyConfig } from './types'; -import { - usePolicyConfigContext, - defaultHTTPSimpleFields, - defaultHTTPAdvancedFields, - defaultTCPSimpleFields, - defaultTCPAdvancedFields, - defaultICMPSimpleFields, - defaultBrowserSimpleFields, - defaultBrowserAdvancedFields, - defaultTLSFields, -} from './contexts'; +import { usePolicyConfigContext } from './contexts'; +import { DEFAULT_FIELDS } from '../../../common/constants/monitor_defaults'; import { CustomFields } from './custom_fields'; import { useUpdatePolicy } from './hooks/use_update_policy'; import { usePolicy } from './hooks/use_policy'; import { validate } from './validation'; -export const defaultConfig: PolicyConfig = { - [DataStream.HTTP]: { - ...defaultHTTPSimpleFields, - ...defaultHTTPAdvancedFields, - ...defaultTLSFields, - }, - [DataStream.TCP]: { - ...defaultTCPSimpleFields, - ...defaultTCPAdvancedFields, - ...defaultTLSFields, - }, - [DataStream.ICMP]: defaultICMPSimpleFields, - [DataStream.BROWSER]: { - ...defaultBrowserSimpleFields, - ...defaultBrowserAdvancedFields, - ...defaultTLSFields, - }, -}; +export const defaultConfig: PolicyConfig = DEFAULT_FIELDS; /** * Exports Synthetics-specific package policy instructions diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tls/default_values.ts b/x-pack/plugins/synthetics/public/components/fleet_package/tls/default_values.ts deleted file mode 100644 index 18f291ce20f35..0000000000000 --- a/x-pack/plugins/synthetics/public/components/fleet_package/tls/default_values.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { TLSFields, ConfigKey, VerificationMode, TLSVersion } from '../types'; - -export const defaultValues: TLSFields = { - [ConfigKey.TLS_CERTIFICATE_AUTHORITIES]: '', - [ConfigKey.TLS_CERTIFICATE]: '', - [ConfigKey.TLS_KEY]: '', - [ConfigKey.TLS_KEY_PASSPHRASE]: '', - [ConfigKey.TLS_VERIFICATION_MODE]: VerificationMode.FULL, - [ConfigKey.TLS_VERSION]: [TLSVersion.ONE_ONE, TLSVersion.ONE_TWO, TLSVersion.ONE_THREE], -}; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx index 28e0bb105e29a..6c8056c246071 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx @@ -18,7 +18,7 @@ import { import { SyntheticsProviders } from '../fleet_package/contexts'; import { PolicyConfig } from '../fleet_package/types'; import { MonitorConfig } from './monitor_config/monitor_config'; -import { DEFAULT_NAMESPACE_STRING } from '../../../common/constants'; +import { DEFAULT_NAMESPACE_STRING } from '../../../common/constants/monitor_defaults'; interface Props { monitor: MonitorFields; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx index 8b62b7cde145f..f151d31e3fd98 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx +++ b/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx @@ -17,7 +17,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { v4 as uuidv4 } from 'uuid'; -import { defaultConfig, usePolicyConfigContext } from '../../fleet_package/contexts'; +import { usePolicyConfigContext } from '../../fleet_package/contexts'; import { usePolicy } from '../../fleet_package/hooks/use_policy'; import { validate } from '../validation'; @@ -26,6 +26,7 @@ import { useFormatMonitor } from '../hooks/use_format_monitor'; import { MonitorFields } from './monitor_fields'; import { TestNowMode, TestRun } from '../test_now_mode/test_now_mode'; import { MonitorFields as MonitorFieldsType } from '../../../../common/runtime_types'; +import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; export const MonitorConfig = ({ isEdit = false }: { isEdit: boolean }) => { const { monitorType } = usePolicyConfigContext(); @@ -41,7 +42,7 @@ export const MonitorConfig = ({ isEdit = false }: { isEdit: boolean }) => { monitorType, validate, config: policyConfig[monitorType], - defaultConfig: defaultConfig[monitorType], + defaultConfig: DEFAULT_FIELDS[monitorType], }); const [hasBeenSubmitted, setHasBeenSubmitted] = useState(false); diff --git a/x-pack/plugins/synthetics/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 index 7d518b189afef..52ae921c78643 100644 --- a/x-pack/plugins/synthetics/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 @@ -5,7 +5,7 @@ * 2.0. */ -import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants'; +import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants/monitor_defaults'; import { DataStream, MonitorFields } from '../../../../common/runtime_types'; interface DataStreamConfig { From f476109d57002189693cca9a6a0eb038c2c08585 Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Fri, 29 Apr 2022 17:50:56 +0200 Subject: [PATCH 24/89] Fix double registry bug (#131239) --- .../register_alerts_table_configuration.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx b/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx index 1771654780fea..3a1bcee1eed51 100644 --- a/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx +++ b/x-pack/plugins/security_solution/public/common/lib/triggers_actions_ui/register_alerts_table_configuration.tsx @@ -17,6 +17,9 @@ const registerAlertsTableConfiguration = ( registry: AlertsTableConfigurationRegistryContract, storage: Storage ) => { + if (registry.has(APP_ID)) { + return; + } const timelineStorage = getTimelinesInStorageByIds(storage, [TimelineId.detectionsPage]); const alertColumns = timelineStorage?.[TimelineId.detectionsPage]?.columns ?? columns; registry.register({ From 7c8e144dd1a901e26d59e678d7d09af60bfa2084 Mon Sep 17 00:00:00 2001 From: Yuliia Naumenko Date: Fri, 29 Apr 2022 10:00:28 -0700 Subject: [PATCH 25/89] [Security Solution] Migrated Users search strategy to fields API (#130213) * [Security Solution] Migrated Users search strategy to fields API * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * fixed tests * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * fixed tests * fixed tests * merge fix * fixed tests * fixed tests * fixed tests * fixed tests * fixed tests Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../users/authentications/index.ts | 2 +- .../security_solution/users/common/index.ts | 2 +- .../factory/users/all/__mocks__/index.ts | 16 +- .../all/__snapshots__/index.test.ts.snap | 4 +- .../query.all_users.dsl.test.ts.snap | 13 +- .../factory/users/all/index.ts | 2 +- .../factory/users/all/query.all_users.dsl.ts | 16 +- .../users/authentications/__mocks__/index.ts | 1690 ++--------------- .../users/authentications/dsl/query.dsl.ts | 36 +- .../users/authentications/helpers.test.ts | 17 +- .../factory/users/authentications/helpers.ts | 115 +- .../factory/users/authentications/index.tsx | 6 +- .../factory/users/details/__mocks__/index.ts | 6 - 13 files changed, 236 insertions(+), 1689 deletions(-) diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/authentications/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/authentications/index.ts index c412c96204138..be60776e683f4 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/authentications/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/authentications/index.ts @@ -59,7 +59,7 @@ export interface LastSourceHost { } export interface AuthenticationHit extends Hit { - _source: { + fields: { '@timestamp': string; lastSuccess?: LastSourceHost; lastFailure?: LastSourceHost; diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/common/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/common/index.ts index 9b9d3028594d3..9f3a2e94e7e13 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/common/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/users/common/index.ts @@ -67,7 +67,7 @@ export interface AllUsersAggEsItem { export interface UsersDomainHitsItem { hits: { hits: Array<{ - _source: { user: { domain: Maybe } }; + fields: { user: { domain: Maybe } }; }>; }; } diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts index bc31f64fcc626..346c8845751ce 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts @@ -13,12 +13,6 @@ import { UsersFields } from '../../../../../../../common/search_strategy/securit export const mockOptions: UsersRequestOptions = { defaultIndex: ['test_indices*'], - docValueFields: [ - { - field: '@timestamp', - format: 'date_time', - }, - ], factoryQueryType: UsersQueries.users, filterQuery: '{"bool":{"must":[],"filter":[{"match_all":{}},{"match_phrase":{"user.name":{"query":"test_user"}}}],"should":[],"must_not":[]}}', @@ -78,10 +72,12 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'endgame-00001', _id: 'inT0934BjUd1_U2597Vf', _score: null, - _source: { - user: { - domain: 'ENDPOINT-W-8-03', - }, + fields: { + 'user.name': ['jose52'], + '@timestamp': ['2022-04-13T17:16:34.540Z'], + 'user.id': ['17'], + 'user.email': ['jose52@barrett.com'], + 'user.domain': ['ENDPOINT-W-8-03'], }, sort: [1644837532000], }, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/index.test.ts.snap b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/index.test.ts.snap index b52d0b1fc1cfd..6383808293a9d 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/index.test.ts.snap +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/index.test.ts.snap @@ -3,7 +3,9 @@ exports[`allHosts search strategy parse should parse data correctly 1`] = ` Array [ Object { - "domain": "ENDPOINT-W-8-03", + "domain": Array [ + "ENDPOINT-W-8-03", + ], "lastSeen": "2022-02-14T11:18:52.000Z", "name": "vagrant", }, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/query.all_users.dsl.test.ts.snap b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/query.all_users.dsl.test.ts.snap index 99f85724d2f5c..2b661fe355a13 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/query.all_users.dsl.test.ts.snap +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__snapshots__/query.all_users.dsl.test.ts.snap @@ -4,6 +4,7 @@ exports[`buildUsersQuery build query from options correctly 1`] = ` Object { "allow_no_indices": true, "body": Object { + "_source": false, "aggregations": Object { "user_count": Object { "cardinality": Object { @@ -14,11 +15,7 @@ Object { "aggs": Object { "domain": Object { "top_hits": Object { - "_source": Object { - "includes": Array [ - "user.domain", - ], - }, + "_source": false, "size": 1, "sort": Array [ Object { @@ -44,10 +41,12 @@ Object { }, }, }, - "docvalue_fields": Array [ + "fields": Array [ + "user.name", + "user.domain", Object { "field": "@timestamp", - "format": "date_time", + "format": "strict_date_optional_time", }, ], "query": Object { diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts index b8babe0b19845..9c62e55cc0bb1 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts @@ -50,7 +50,7 @@ export const allUsers: SecuritySolutionFactory = { (bucket: AllUsersAggEsItem) => ({ name: bucket.key, lastSeen: getOr(null, `lastSeen.value_as_string`, bucket), - domain: getOr(null, `domain.hits.hits[0]._source.user.domain`, bucket), + domain: getOr(null, `domain.hits.hits[0].fields['user.domain']`, bucket), }), {} ); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/query.all_users.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/query.all_users.dsl.ts index 82df1d2d97246..d7f8f7e50abe1 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/query.all_users.dsl.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/query.all_users.dsl.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { isEmpty } from 'lodash/fp'; import type { ISearchRequestParams } from '@kbn/data-plugin/common'; import { Direction } from '../../../../../../common/search_strategy'; import { createQueryFilterClauses } from '../../../../../utils/build_query'; @@ -18,7 +17,6 @@ import { assertUnreachable } from '../../../../../../common/utility_types'; export const buildUsersQuery = ({ defaultIndex, - docValueFields, filterQuery, pagination: { querySize }, sort, @@ -43,7 +41,6 @@ export const buildUsersQuery = ({ ignore_unavailable: true, track_total_hits: false, body: { - ...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}), aggregations: { user_count: { cardinality: { field: 'user.name' } }, user_data: { @@ -60,15 +57,22 @@ export const buildUsersQuery = ({ }, }, ], - _source: { - includes: ['user.domain'], - }, + _source: false, }, }, }, }, }, query: { bool: { filter } }, + _source: false, + fields: [ + 'user.name', + 'user.domain', + { + field: '@timestamp', + format: 'strict_date_optional_time', + }, + ], size: 0, }, }; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/__mocks__/index.ts index 487f4537cd50d..028ee4e4ba1b9 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/__mocks__/index.ts @@ -26,408 +26,6 @@ export const mockOptions: UserAuthenticationsRequestOptions = { 'winlogbeat-*', ], stackByField: AuthStackByField.userName, - docValueFields: [ - { - field: '@timestamp', - format: 'date_time', - }, - { - field: 'event.created', - format: 'date_time', - }, - { - field: 'event.end', - format: 'date_time', - }, - { - field: 'event.ingested', - format: 'date_time', - }, - { - field: 'event.start', - format: 'date_time', - }, - { - field: 'file.accessed', - format: 'date_time', - }, - { - field: 'file.created', - format: 'date_time', - }, - { - field: 'file.ctime', - format: 'date_time', - }, - { - field: 'file.mtime', - format: 'date_time', - }, - { - field: 'package.installed', - format: 'date_time', - }, - { - field: 'process.parent.start', - format: 'date_time', - }, - { - field: 'process.start', - format: 'date_time', - }, - { - field: 'system.audit.host.boottime', - format: 'date_time', - }, - { - field: 'system.audit.package.installtime', - format: 'date_time', - }, - { - field: 'system.audit.user.password.last_changed', - format: 'date_time', - }, - { - field: 'tls.client.not_after', - format: 'date_time', - }, - { - field: 'tls.client.not_before', - format: 'date_time', - }, - { - field: 'tls.server.not_after', - format: 'date_time', - }, - { - field: 'tls.server.not_before', - format: 'date_time', - }, - { - field: 'aws.cloudtrail.user_identity.session_context.creation_date', - format: 'date_time', - }, - { - field: 'azure.auditlogs.properties.activity_datetime', - format: 'date_time', - }, - { - field: 'azure.enqueued_time', - format: 'date_time', - }, - { - field: 'azure.signinlogs.properties.created_at', - format: 'date_time', - }, - { - field: 'cef.extensions.agentReceiptTime', - format: 'date_time', - }, - { - field: 'cef.extensions.deviceCustomDate1', - format: 'date_time', - }, - { - field: 'cef.extensions.deviceCustomDate2', - format: 'date_time', - }, - { - field: 'cef.extensions.deviceReceiptTime', - format: 'date_time', - }, - { - field: 'cef.extensions.endTime', - format: 'date_time', - }, - { - field: 'cef.extensions.fileCreateTime', - format: 'date_time', - }, - { - field: 'cef.extensions.fileModificationTime', - format: 'date_time', - }, - { - field: 'cef.extensions.flexDate1', - format: 'date_time', - }, - { - field: 'cef.extensions.managerReceiptTime', - format: 'date_time', - }, - { - field: 'cef.extensions.oldFileCreateTime', - format: 'date_time', - }, - { - field: 'cef.extensions.oldFileModificationTime', - format: 'date_time', - }, - { - field: 'cef.extensions.startTime', - format: 'date_time', - }, - { - field: 'checkpoint.subs_exp', - format: 'date_time', - }, - { - field: 'crowdstrike.event.EndTimestamp', - format: 'date_time', - }, - { - field: 'crowdstrike.event.IncidentEndTime', - format: 'date_time', - }, - { - field: 'crowdstrike.event.IncidentStartTime', - format: 'date_time', - }, - { - field: 'crowdstrike.event.ProcessEndTime', - format: 'date_time', - }, - { - field: 'crowdstrike.event.ProcessStartTime', - format: 'date_time', - }, - { - field: 'crowdstrike.event.StartTimestamp', - format: 'date_time', - }, - { - field: 'crowdstrike.event.Timestamp', - format: 'date_time', - }, - { - field: 'crowdstrike.event.UTCTimestamp', - format: 'date_time', - }, - { - field: 'crowdstrike.metadata.eventCreationTime', - format: 'date_time', - }, - { - field: 'gsuite.admin.email.log_search_filter.end_date', - format: 'date_time', - }, - { - field: 'gsuite.admin.email.log_search_filter.start_date', - format: 'date_time', - }, - { - field: 'gsuite.admin.user.birthdate', - format: 'date_time', - }, - { - field: 'kafka.block_timestamp', - format: 'date_time', - }, - { - field: 'microsoft.defender_atp.lastUpdateTime', - format: 'date_time', - }, - { - field: 'microsoft.defender_atp.resolvedTime', - format: 'date_time', - }, - { - field: 'misp.campaign.first_seen', - format: 'date_time', - }, - { - field: 'misp.campaign.last_seen', - format: 'date_time', - }, - { - field: 'misp.intrusion_set.first_seen', - format: 'date_time', - }, - { - field: 'misp.intrusion_set.last_seen', - format: 'date_time', - }, - { - field: 'misp.observed_data.first_observed', - format: 'date_time', - }, - { - field: 'misp.observed_data.last_observed', - format: 'date_time', - }, - { - field: 'misp.report.published', - format: 'date_time', - }, - { - field: 'misp.threat_indicator.valid_from', - format: 'date_time', - }, - { - field: 'misp.threat_indicator.valid_until', - format: 'date_time', - }, - { - field: 'netflow.collection_time_milliseconds', - format: 'date_time', - }, - { - field: 'netflow.exporter.timestamp', - format: 'date_time', - }, - { - field: 'netflow.flow_end_microseconds', - format: 'date_time', - }, - { - field: 'netflow.flow_end_milliseconds', - format: 'date_time', - }, - { - field: 'netflow.flow_end_nanoseconds', - format: 'date_time', - }, - { - field: 'netflow.flow_end_seconds', - format: 'date_time', - }, - { - field: 'netflow.flow_start_microseconds', - format: 'date_time', - }, - { - field: 'netflow.flow_start_milliseconds', - format: 'date_time', - }, - { - field: 'netflow.flow_start_nanoseconds', - format: 'date_time', - }, - { - field: 'netflow.flow_start_seconds', - format: 'date_time', - }, - { - field: 'netflow.max_export_seconds', - format: 'date_time', - }, - { - field: 'netflow.max_flow_end_microseconds', - format: 'date_time', - }, - { - field: 'netflow.max_flow_end_milliseconds', - format: 'date_time', - }, - { - field: 'netflow.max_flow_end_nanoseconds', - format: 'date_time', - }, - { - field: 'netflow.max_flow_end_seconds', - format: 'date_time', - }, - { - field: 'netflow.min_export_seconds', - format: 'date_time', - }, - { - field: 'netflow.min_flow_start_microseconds', - format: 'date_time', - }, - { - field: 'netflow.min_flow_start_milliseconds', - format: 'date_time', - }, - { - field: 'netflow.min_flow_start_nanoseconds', - format: 'date_time', - }, - { - field: 'netflow.min_flow_start_seconds', - format: 'date_time', - }, - { - field: 'netflow.monitoring_interval_end_milli_seconds', - format: 'date_time', - }, - { - field: 'netflow.monitoring_interval_start_milli_seconds', - format: 'date_time', - }, - { - field: 'netflow.observation_time_microseconds', - format: 'date_time', - }, - { - field: 'netflow.observation_time_milliseconds', - format: 'date_time', - }, - { - field: 'netflow.observation_time_nanoseconds', - format: 'date_time', - }, - { - field: 'netflow.observation_time_seconds', - format: 'date_time', - }, - { - field: 'netflow.system_init_time_milliseconds', - format: 'date_time', - }, - { - field: 'rsa.internal.lc_ctime', - format: 'date_time', - }, - { - field: 'rsa.internal.time', - format: 'date_time', - }, - { - field: 'rsa.time.effective_time', - format: 'date_time', - }, - { - field: 'rsa.time.endtime', - format: 'date_time', - }, - { - field: 'rsa.time.event_queue_time', - format: 'date_time', - }, - { - field: 'rsa.time.event_time', - format: 'date_time', - }, - { - field: 'rsa.time.expire_time', - format: 'date_time', - }, - { - field: 'rsa.time.recorded_time', - format: 'date_time', - }, - { - field: 'rsa.time.stamp', - format: 'date_time', - }, - { - field: 'rsa.time.starttime', - format: 'date_time', - }, - { - field: 'sophos.xg.date', - format: 'date_time', - }, - { - field: 'sophos.xg.eventtime', - format: 'date_time', - }, - { - field: 'sophos.xg.start_time', - format: 'date_time', - }, - ], factoryQueryType: UsersQueries.authentications, filterQuery: '{"bool":{"must":[],"filter":[{"match_all":{}}],"should":[],"must_not":[]}}', pagination: { @@ -481,106 +79,10 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'winlogbeat-8.0.0-2020.09.02-000001', _id: 'zqY7WXQBA6bGZw2uLeKI', _score: null, - _source: { - process: { - name: 'services.exe', - pid: 564, - executable: 'C:\\Windows\\System32\\services.exe', - }, - agent: { - build_date: '2020-07-16 09:16:27 +0000 UTC ', - name: 'siem-windows', - commit: '4dcbde39492bdc3843034bba8db811c68cb44b97 ', - id: '05e1bff7-d7a8-416a-8554-aa10288fa07d', - type: 'winlogbeat', - ephemeral_id: '655abd6c-6c33-435d-a2eb-79b2a01e6d61', - version: '8.0.0', - user: { name: 'inside_winlogbeat_user' }, - }, - winlog: { - computer_name: 'siem-windows', - process: { pid: 576, thread: { id: 880 } }, - keywords: ['Audit Success'], - logon: { id: '0x3e7', type: 'Service' }, - channel: 'Security', - event_data: { - LogonGuid: '{00000000-0000-0000-0000-000000000000}', - TargetOutboundDomainName: '-', - VirtualAccount: '%%1843', - LogonType: '5', - IpPort: '-', - TransmittedServices: '-', - SubjectLogonId: '0x3e7', - LmPackageName: '-', - TargetOutboundUserName: '-', - KeyLength: '0', - TargetLogonId: '0x3e7', - RestrictedAdminMode: '-', - SubjectUserName: 'SIEM-WINDOWS$', - TargetLinkedLogonId: '0x0', - ElevatedToken: '%%1842', - SubjectDomainName: 'WORKGROUP', - IpAddress: '-', - ImpersonationLevel: '%%1833', - TargetUserName: 'SYSTEM', - LogonProcessName: 'Advapi ', - TargetDomainName: 'NT AUTHORITY', - SubjectUserSid: 'S-1-5-18', - TargetUserSid: 'S-1-5-18', - AuthenticationPackageName: 'Negotiate', - }, - opcode: 'Info', - version: 2, - record_id: 57818, - task: 'Logon', - event_id: 4624, - provider_guid: '{54849625-5478-4994-a5ba-3e3b0328c30d}', - activity_id: '{d2485217-6bac-0000-8fbb-3f7e2571d601}', - api: 'wineventlog', - provider_name: 'Microsoft-Windows-Security-Auditing', - }, - log: { level: 'information' }, - source: { domain: '-' }, - message: - 'An account was successfully logged on.\n\nSubject:\n\tSecurity ID:\t\tS-1-5-18\n\tAccount Name:\t\tSIEM-WINDOWS$\n\tAccount Domain:\t\tWORKGROUP\n\tLogon ID:\t\t0x3E7\n\nLogon Information:\n\tLogon Type:\t\t5\n\tRestricted Admin Mode:\t-\n\tVirtual Account:\t\tNo\n\tElevated Token:\t\tYes\n\nImpersonation Level:\t\tImpersonation\n\nNew Logon:\n\tSecurity ID:\t\tS-1-5-18\n\tAccount Name:\t\tSYSTEM\n\tAccount Domain:\t\tNT AUTHORITY\n\tLogon ID:\t\t0x3E7\n\tLinked Logon ID:\t\t0x0\n\tNetwork Account Name:\t-\n\tNetwork Account Domain:\t-\n\tLogon GUID:\t\t{00000000-0000-0000-0000-000000000000}\n\nProcess Information:\n\tProcess ID:\t\t0x234\n\tProcess Name:\t\tC:\\Windows\\System32\\services.exe\n\nNetwork Information:\n\tWorkstation Name:\t-\n\tSource Network Address:\t-\n\tSource Port:\t\t-\n\nDetailed Authentication Information:\n\tLogon Process:\t\tAdvapi \n\tAuthentication Package:\tNegotiate\n\tTransited Services:\t-\n\tPackage Name (NTLM only):\t-\n\tKey Length:\t\t0\n\nThis event is generated when a logon session is created. It is generated on the computer that was accessed.\n\nThe subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.\n\nThe logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network).\n\nThe New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on.\n\nThe network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.\n\nThe impersonation level field indicates the extent to which a process in the logon session can impersonate.\n\nThe authentication information fields provide detailed information about this specific logon request.\n\t- Logon GUID is a unique identifier that can be used to correlate this event with a KDC event.\n\t- Transited services indicate which intermediate services have participated in this logon request.\n\t- Package name indicates which sub-protocol was used among the NTLM protocols.\n\t- Key length indicates the length of the generated session key. This will be 0 if no session key was requested.', - cloud: { - availability_zone: 'us-central1-c', - instance: { name: 'siem-windows', id: '9156726559029788564' }, - provider: 'gcp', - machine: { type: 'g1-small' }, - project: { id: 'elastic-siem' }, - }, - '@timestamp': '2020-09-04T13:08:02.532Z', - related: { user: ['SYSTEM', 'SIEM-WINDOWS$'] }, - ecs: { version: '1.5.0' }, - host: { - hostname: 'siem-windows', - os: { - build: '17763.1397', - kernel: '10.0.17763.1397 (WinBuild.160101.0800)', - name: 'Windows Server 2019 Datacenter', - family: 'windows', - version: '10.0', - platform: 'windows', - }, - ip: ['fe80::ecf5:decc:3ec3:767e', '10.200.0.15'], - name: 'siem-windows', - id: 'ce1d3c9b-a815-4643-9641-ada0f2c00609', - mac: ['42:01:0a:c8:00:0f'], - architecture: 'x86_64', - }, - event: { - code: 4624, - provider: 'Microsoft-Windows-Security-Auditing', - created: '2020-09-04T13:08:03.638Z', - kind: 'event', - module: 'security', - action: 'logged-in', - category: 'authentication', - type: 'start', - outcome: 'success', - }, - user: { domain: 'NT AUTHORITY', name: 'SYSTEM', id: 'S-1-5-18' }, + fields: { + '@timestamp': ['2020-09-04T13:08:02.532Z'], + 'host.id': ['ce1d3c9b-a815-4643-9641-ada0f2c00609'], + 'host.name': ['siem-windows'], }, sort: [1599224882532], }, @@ -607,76 +109,11 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: '.ds-logs-system.auth-default-000001', _id: '9_sfWXQBc39KFIJbIsDh', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - type: 'filebeat', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 20764 }, - log: { file: { path: '/var/log/auth.log' }, offset: 552463 }, - source: { - geo: { - continent_name: 'Europe', - region_iso_code: 'DE-BE', - city_name: 'Berlin', - country_iso_code: 'DE', - region_name: 'Land Berlin', - location: { lon: 13.3512, lat: 52.5727 }, - }, - as: { number: 6805, organization: { name: 'Telefonica Germany' } }, - port: 57457, - ip: '77.183.42.188', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T11:49:21.000Z', - system: { - auth: { - ssh: { - method: 'publickey', - signature: 'RSA SHA256:vv64JNLzKZWYA9vonnGWuW7zxWhyZrL/BFxyIGbISx8', - event: 'Accepted', - }, - }, - }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_success', - category: 'authentication', - dataset: 'system.auth', - outcome: 'success', - }, - user: { name: 'tsg' }, + fields: { + 'source.ip': ['77.183.42.188'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T11:49:21.000Z'], }, sort: [1599220161000], }, @@ -699,67 +136,11 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: '.ds-logs-system.auth-default-000001', _id: 'ZfxZWXQBc39KFIJbLN5U', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - type: 'filebeat', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 22913 }, - log: { file: { path: '/var/log/auth.log' }, offset: 562910 }, - source: { - geo: { - continent_name: 'Asia', - region_iso_code: 'KR-28', - city_name: 'Incheon', - country_iso_code: 'KR', - region_name: 'Incheon', - location: { lon: 126.7288, lat: 37.4562 }, - }, - as: { number: 4766, organization: { name: 'Korea Telecom' } }, - ip: '59.15.3.197', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T13:40:46.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_failure', - category: 'authentication', - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'admin' }, + fields: { + 'source.ip': ['59.15.3.197'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T13:40:46.000Z'], }, sort: [1599226846000], }, @@ -786,47 +167,10 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'M_xLWXQBc39KFIJbY7Cb', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 20671 }, - log: { file: { path: '/var/log/auth.log' }, offset: 1028103 }, - source: { - geo: { - continent_name: 'North America', - region_iso_code: 'US-NY', - city_name: 'New York', - country_iso_code: 'US', - region_name: 'New York', - location: { lon: -74, lat: 40.7157 }, - }, - ip: '64.227.88.245', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T13:25:43.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['64.227.88.245'], user: ['user'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T13:25:47.034172Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'user' }, + fields: { + 'source.ip': ['64.227.88.245'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T13:25:43.000Z'], }, sort: [1599225943000], }, @@ -853,47 +197,10 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'nPxKWXQBc39KFIJb7q4w', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - type: 'filebeat', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 20665 }, - log: { file: { path: '/var/log/auth.log' }, offset: 1027372 }, - source: { - geo: { - continent_name: 'North America', - region_iso_code: 'US-NY', - city_name: 'New York', - country_iso_code: 'US', - region_name: 'New York', - location: { lon: -74, lat: 40.7157 }, - }, - ip: '64.227.88.245', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T13:25:07.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['64.227.88.245'], user: ['ubuntu'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T13:25:16.974606Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'ubuntu' }, + fields: { + 'source.ip': ['64.227.88.245'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T13:25:07.000Z'], }, sort: [1599225907000], }, @@ -920,67 +227,11 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: '.ds-logs-system.auth-default-000001', _id: 'mPsfWXQBc39KFIJbI8HI', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - type: 'filebeat', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 21506 }, - log: { file: { path: '/var/log/auth.log' }, offset: 556761 }, - source: { - geo: { - continent_name: 'Asia', - region_iso_code: 'IN-DL', - city_name: 'New Delhi', - country_iso_code: 'IN', - region_name: 'National Capital Territory of Delhi', - location: { lon: 77.2245, lat: 28.6358 }, - }, - as: { number: 10029, organization: { name: 'SHYAM SPECTRA PVT LTD' } }, - ip: '180.151.228.166', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T12:26:36.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_failure', - category: 'authentication', - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'odoo' }, + fields: { + 'source.ip': ['180.151.228.166'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T12:26:36.000Z'], }, sort: [1599222396000], }, @@ -1007,48 +258,10 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'aaToWHQBA6bGZw2uR-St', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 20475 }, - log: { file: { path: '/var/log/auth.log' }, offset: 1019218 }, - source: { - geo: { - continent_name: 'Europe', - region_iso_code: 'SE-AB', - city_name: 'Stockholm', - country_iso_code: 'SE', - region_name: 'Stockholm', - location: { lon: 17.7833, lat: 59.25 }, - }, - as: { number: 8473, organization: { name: 'Bahnhof AB' } }, - ip: '178.174.148.58', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T11:37:22.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['178.174.148.58'], user: ['pi'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T11:37:31.797423Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'pi' }, + fields: { + 'source.ip': ['178.174.148.58'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T11:37:22.000Z'], }, sort: [1599219442000], }, @@ -1075,48 +288,10 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'VaP_V3QBA6bGZw2upUbg', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 19849 }, - log: { file: { path: '/var/log/auth.log' }, offset: 981036 }, - source: { - geo: { - continent_name: 'Europe', - country_iso_code: 'HR', - location: { lon: 15.5, lat: 45.1667 }, - }, - as: { - number: 42864, - organization: { name: 'Giganet Internet Szolgaltato Kft' }, - }, - ip: '45.95.168.157', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T07:23:22.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['45.95.168.157'], user: ['demo'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T07:23:26.046346Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'demo' }, + fields: { + 'source.ip': ['45.95.168.157'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T07:23:22.000Z'], }, sort: [1599204202000], }, @@ -1143,72 +318,11 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: '.ds-logs-system.auth-default-000001', _id: 'PqYfWXQBA6bGZw2uIhVU', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - type: 'filebeat', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 20396 }, - log: { file: { path: '/var/log/auth.log' }, offset: 550795 }, - source: { - geo: { - continent_name: 'Asia', - region_iso_code: 'CN-BJ', - city_name: 'Beijing', - country_iso_code: 'CN', - region_name: 'Beijing', - location: { lon: 116.3889, lat: 39.9288 }, - }, - as: { - number: 45090, - organization: { - name: 'Shenzhen Tencent Computer Systems Company Limited', - }, - }, - ip: '123.206.30.76', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T11:20:26.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_failure', - category: 'authentication', - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'git' }, + fields: { + 'source.ip': ['123.206.30.76'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T11:20:26.000Z'], }, sort: [1599218426000], }, @@ -1235,48 +349,10 @@ export const mockSearchStrategyResponse: IEsSearchResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'iMABWHQBB-gskclyitP-', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 19870 }, - log: { file: { path: '/var/log/auth.log' }, offset: 984133 }, - source: { - geo: { - continent_name: 'Europe', - country_iso_code: 'HR', - location: { lon: 15.5, lat: 45.1667 }, - }, - as: { - number: 42864, - organization: { name: 'Giganet Internet Szolgaltato Kft' }, - }, - ip: '45.95.168.157', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T07:25:28.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['45.95.168.157'], user: ['webadmin'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T07:25:30.236651Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'webadmin' }, + fields: { + 'source.ip': ['45.95.168.157'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T07:25:28.000Z'], }, sort: [1599204328000], }, @@ -1331,106 +407,10 @@ export const formattedSearchStrategyResponse = { _index: 'winlogbeat-8.0.0-2020.09.02-000001', _id: 'zqY7WXQBA6bGZw2uLeKI', _score: null, - _source: { - process: { - name: 'services.exe', - pid: 564, - executable: 'C:\\Windows\\System32\\services.exe', - }, - agent: { - build_date: '2020-07-16 09:16:27 +0000 UTC ', - name: 'siem-windows', - commit: '4dcbde39492bdc3843034bba8db811c68cb44b97 ', - id: '05e1bff7-d7a8-416a-8554-aa10288fa07d', - type: 'winlogbeat', - ephemeral_id: '655abd6c-6c33-435d-a2eb-79b2a01e6d61', - version: '8.0.0', - user: { name: 'inside_winlogbeat_user' }, - }, - winlog: { - computer_name: 'siem-windows', - process: { pid: 576, thread: { id: 880 } }, - keywords: ['Audit Success'], - logon: { id: '0x3e7', type: 'Service' }, - channel: 'Security', - event_data: { - LogonGuid: '{00000000-0000-0000-0000-000000000000}', - TargetOutboundDomainName: '-', - VirtualAccount: '%%1843', - LogonType: '5', - IpPort: '-', - TransmittedServices: '-', - SubjectLogonId: '0x3e7', - LmPackageName: '-', - TargetOutboundUserName: '-', - KeyLength: '0', - TargetLogonId: '0x3e7', - RestrictedAdminMode: '-', - SubjectUserName: 'SIEM-WINDOWS$', - TargetLinkedLogonId: '0x0', - ElevatedToken: '%%1842', - SubjectDomainName: 'WORKGROUP', - IpAddress: '-', - ImpersonationLevel: '%%1833', - TargetUserName: 'SYSTEM', - LogonProcessName: 'Advapi ', - TargetDomainName: 'NT AUTHORITY', - SubjectUserSid: 'S-1-5-18', - TargetUserSid: 'S-1-5-18', - AuthenticationPackageName: 'Negotiate', - }, - opcode: 'Info', - version: 2, - record_id: 57818, - task: 'Logon', - event_id: 4624, - provider_guid: '{54849625-5478-4994-a5ba-3e3b0328c30d}', - activity_id: '{d2485217-6bac-0000-8fbb-3f7e2571d601}', - api: 'wineventlog', - provider_name: 'Microsoft-Windows-Security-Auditing', - }, - log: { level: 'information' }, - source: { domain: '-' }, - message: - 'An account was successfully logged on.\n\nSubject:\n\tSecurity ID:\t\tS-1-5-18\n\tAccount Name:\t\tSIEM-WINDOWS$\n\tAccount Domain:\t\tWORKGROUP\n\tLogon ID:\t\t0x3E7\n\nLogon Information:\n\tLogon Type:\t\t5\n\tRestricted Admin Mode:\t-\n\tVirtual Account:\t\tNo\n\tElevated Token:\t\tYes\n\nImpersonation Level:\t\tImpersonation\n\nNew Logon:\n\tSecurity ID:\t\tS-1-5-18\n\tAccount Name:\t\tSYSTEM\n\tAccount Domain:\t\tNT AUTHORITY\n\tLogon ID:\t\t0x3E7\n\tLinked Logon ID:\t\t0x0\n\tNetwork Account Name:\t-\n\tNetwork Account Domain:\t-\n\tLogon GUID:\t\t{00000000-0000-0000-0000-000000000000}\n\nProcess Information:\n\tProcess ID:\t\t0x234\n\tProcess Name:\t\tC:\\Windows\\System32\\services.exe\n\nNetwork Information:\n\tWorkstation Name:\t-\n\tSource Network Address:\t-\n\tSource Port:\t\t-\n\nDetailed Authentication Information:\n\tLogon Process:\t\tAdvapi \n\tAuthentication Package:\tNegotiate\n\tTransited Services:\t-\n\tPackage Name (NTLM only):\t-\n\tKey Length:\t\t0\n\nThis event is generated when a logon session is created. It is generated on the computer that was accessed.\n\nThe subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.\n\nThe logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network).\n\nThe New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on.\n\nThe network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.\n\nThe impersonation level field indicates the extent to which a process in the logon session can impersonate.\n\nThe authentication information fields provide detailed information about this specific logon request.\n\t- Logon GUID is a unique identifier that can be used to correlate this event with a KDC event.\n\t- Transited services indicate which intermediate services have participated in this logon request.\n\t- Package name indicates which sub-protocol was used among the NTLM protocols.\n\t- Key length indicates the length of the generated session key. This will be 0 if no session key was requested.', - cloud: { - availability_zone: 'us-central1-c', - instance: { name: 'siem-windows', id: '9156726559029788564' }, - provider: 'gcp', - machine: { type: 'g1-small' }, - project: { id: 'elastic-siem' }, - }, - '@timestamp': '2020-09-04T13:08:02.532Z', - related: { user: ['SYSTEM', 'SIEM-WINDOWS$'] }, - ecs: { version: '1.5.0' }, - host: { - hostname: 'siem-windows', - os: { - build: '17763.1397', - kernel: '10.0.17763.1397 (WinBuild.160101.0800)', - name: 'Windows Server 2019 Datacenter', - family: 'windows', - version: '10.0', - platform: 'windows', - }, - ip: ['fe80::ecf5:decc:3ec3:767e', '10.200.0.15'], - name: 'siem-windows', - id: 'ce1d3c9b-a815-4643-9641-ada0f2c00609', - mac: ['42:01:0a:c8:00:0f'], - architecture: 'x86_64', - }, - event: { - code: 4624, - provider: 'Microsoft-Windows-Security-Auditing', - created: '2020-09-04T13:08:03.638Z', - kind: 'event', - module: 'security', - action: 'logged-in', - category: 'authentication', - type: 'start', - outcome: 'success', - }, - user: { domain: 'NT AUTHORITY', name: 'SYSTEM', id: 'S-1-5-18' }, + fields: { + 'host.id': ['ce1d3c9b-a815-4643-9641-ada0f2c00609'], + 'host.name': ['siem-windows'], + '@timestamp': ['2020-09-04T13:08:02.532Z'], }, sort: [1599224882532], }, @@ -1457,76 +437,11 @@ export const formattedSearchStrategyResponse = { _index: '.ds-logs-system.auth-default-000001', _id: '9_sfWXQBc39KFIJbIsDh', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - type: 'filebeat', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 20764 }, - log: { file: { path: '/var/log/auth.log' }, offset: 552463 }, - source: { - geo: { - continent_name: 'Europe', - region_iso_code: 'DE-BE', - city_name: 'Berlin', - country_iso_code: 'DE', - region_name: 'Land Berlin', - location: { lon: 13.3512, lat: 52.5727 }, - }, - as: { number: 6805, organization: { name: 'Telefonica Germany' } }, - port: 57457, - ip: '77.183.42.188', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T11:49:21.000Z', - system: { - auth: { - ssh: { - method: 'publickey', - signature: 'RSA SHA256:vv64JNLzKZWYA9vonnGWuW7zxWhyZrL/BFxyIGbISx8', - event: 'Accepted', - }, - }, - }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_success', - category: 'authentication', - dataset: 'system.auth', - outcome: 'success', - }, - user: { name: 'tsg' }, + fields: { + 'source.ip': ['77.183.42.188'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T11:49:21.000Z'], }, sort: [1599220161000], }, @@ -1549,67 +464,11 @@ export const formattedSearchStrategyResponse = { _index: '.ds-logs-system.auth-default-000001', _id: 'ZfxZWXQBc39KFIJbLN5U', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - type: 'filebeat', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 22913 }, - log: { file: { path: '/var/log/auth.log' }, offset: 562910 }, - source: { - geo: { - continent_name: 'Asia', - region_iso_code: 'KR-28', - city_name: 'Incheon', - country_iso_code: 'KR', - region_name: 'Incheon', - location: { lon: 126.7288, lat: 37.4562 }, - }, - as: { number: 4766, organization: { name: 'Korea Telecom' } }, - ip: '59.15.3.197', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T13:40:46.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_failure', - category: 'authentication', - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'admin' }, + fields: { + 'source.ip': ['59.15.3.197'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T13:40:46.000Z'], }, sort: [1599226846000], }, @@ -1636,47 +495,10 @@ export const formattedSearchStrategyResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'M_xLWXQBc39KFIJbY7Cb', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 20671 }, - log: { file: { path: '/var/log/auth.log' }, offset: 1028103 }, - source: { - geo: { - continent_name: 'North America', - region_iso_code: 'US-NY', - city_name: 'New York', - country_iso_code: 'US', - region_name: 'New York', - location: { lon: -74, lat: 40.7157 }, - }, - ip: '64.227.88.245', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T13:25:43.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['64.227.88.245'], user: ['user'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T13:25:47.034172Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'user' }, + fields: { + 'source.ip': ['64.227.88.245'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T13:25:43.000Z'], }, sort: [1599225943000], }, @@ -1703,47 +525,10 @@ export const formattedSearchStrategyResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'nPxKWXQBc39KFIJb7q4w', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - type: 'filebeat', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 20665 }, - log: { file: { path: '/var/log/auth.log' }, offset: 1027372 }, - source: { - geo: { - continent_name: 'North America', - region_iso_code: 'US-NY', - city_name: 'New York', - country_iso_code: 'US', - region_name: 'New York', - location: { lon: -74, lat: 40.7157 }, - }, - ip: '64.227.88.245', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T13:25:07.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['64.227.88.245'], user: ['ubuntu'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T13:25:16.974606Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'ubuntu' }, + fields: { + 'source.ip': ['64.227.88.245'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T13:25:07.000Z'], }, sort: [1599225907000], }, @@ -1770,67 +555,11 @@ export const formattedSearchStrategyResponse = { _index: '.ds-logs-system.auth-default-000001', _id: 'mPsfWXQBc39KFIJbI8HI', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - type: 'filebeat', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 21506 }, - log: { file: { path: '/var/log/auth.log' }, offset: 556761 }, - source: { - geo: { - continent_name: 'Asia', - region_iso_code: 'IN-DL', - city_name: 'New Delhi', - country_iso_code: 'IN', - region_name: 'National Capital Territory of Delhi', - location: { lon: 77.2245, lat: 28.6358 }, - }, - as: { number: 10029, organization: { name: 'SHYAM SPECTRA PVT LTD' } }, - ip: '180.151.228.166', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T12:26:36.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_failure', - category: 'authentication', - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'odoo' }, + fields: { + 'source.ip': ['180.151.228.166'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T12:26:36.000Z'], }, sort: [1599222396000], }, @@ -1857,48 +586,10 @@ export const formattedSearchStrategyResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'aaToWHQBA6bGZw2uR-St', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 20475 }, - log: { file: { path: '/var/log/auth.log' }, offset: 1019218 }, - source: { - geo: { - continent_name: 'Europe', - region_iso_code: 'SE-AB', - city_name: 'Stockholm', - country_iso_code: 'SE', - region_name: 'Stockholm', - location: { lon: 17.7833, lat: 59.25 }, - }, - as: { number: 8473, organization: { name: 'Bahnhof AB' } }, - ip: '178.174.148.58', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T11:37:22.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['178.174.148.58'], user: ['pi'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T11:37:31.797423Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'pi' }, + fields: { + 'source.ip': ['178.174.148.58'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T11:37:22.000Z'], }, sort: [1599219442000], }, @@ -1925,48 +616,10 @@ export const formattedSearchStrategyResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'VaP_V3QBA6bGZw2upUbg', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 19849 }, - log: { file: { path: '/var/log/auth.log' }, offset: 981036 }, - source: { - geo: { - continent_name: 'Europe', - country_iso_code: 'HR', - location: { lon: 15.5, lat: 45.1667 }, - }, - as: { - number: 42864, - organization: { name: 'Giganet Internet Szolgaltato Kft' }, - }, - ip: '45.95.168.157', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T07:23:22.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['45.95.168.157'], user: ['demo'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T07:23:26.046346Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'demo' }, + fields: { + 'source.ip': ['45.95.168.157'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T07:23:22.000Z'], }, sort: [1599204202000], }, @@ -1993,72 +646,11 @@ export const formattedSearchStrategyResponse = { _index: '.ds-logs-system.auth-default-000001', _id: 'PqYfWXQBA6bGZw2uIhVU', _score: null, - _source: { - agent: { - hostname: 'siem-kibana', - name: 'siem-kibana', - id: 'aa3d9dc7-fef1-4c2f-a68d-25785d624e35', - ephemeral_id: 'e503bd85-11c7-4bc9-ae7d-70be1d919fb7', - type: 'filebeat', - version: '7.9.1', - }, - process: { name: 'sshd', pid: 20396 }, - log: { file: { path: '/var/log/auth.log' }, offset: 550795 }, - source: { - geo: { - continent_name: 'Asia', - region_iso_code: 'CN-BJ', - city_name: 'Beijing', - country_iso_code: 'CN', - region_name: 'Beijing', - location: { lon: 116.3889, lat: 39.9288 }, - }, - as: { - number: 45090, - organization: { - name: 'Shenzhen Tencent Computer Systems Company Limited', - }, - }, - ip: '123.206.30.76', - }, - cloud: { - availability_zone: 'us-east1-b', - instance: { name: 'siem-kibana', id: '5412578377715150143' }, - provider: 'gcp', - machine: { type: 'n1-standard-2' }, - project: { id: 'elastic-beats' }, - }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T11:20:26.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - data_stream: { namespace: 'default', type: 'logs', dataset: 'system.auth' }, - host: { - hostname: 'siem-kibana', - os: { - kernel: '4.9.0-8-amd64', - codename: 'stretch', - name: 'Debian GNU/Linux', - family: 'debian', - version: '9 (stretch)', - platform: 'debian', - }, - containerized: false, - ip: ['10.142.0.7', 'fe80::4001:aff:fe8e:7'], - name: 'siem-kibana', - id: 'aa7ca589f1b8220002f2fc61c64cfbf1', - mac: ['42:01:0a:8e:00:07'], - architecture: 'x86_64', - }, - event: { - timezone: '+00:00', - action: 'ssh_login', - type: 'authentication_failure', - category: 'authentication', - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'git' }, + fields: { + 'source.ip': ['123.206.30.76'], + 'host.id': ['aa7ca589f1b8220002f2fc61c64cfbf1'], + 'host.name': ['siem-kibana'], + '@timestamp': ['2020-09-04T11:20:26.000Z'], }, sort: [1599218426000], }, @@ -2085,48 +677,10 @@ export const formattedSearchStrategyResponse = { _index: 'filebeat-8.0.0-2020.09.02-000001', _id: 'iMABWHQBB-gskclyitP-', _score: null, - _source: { - agent: { - name: 'bastion00.siem.estc.dev', - id: 'f9a321c1-ec27-49fa-aacf-6a50ef6d836f', - type: 'filebeat', - ephemeral_id: '734ee3da-1a4f-4bc9-b400-e0cf0e5eeebc', - version: '8.0.0', - }, - process: { name: 'sshd', pid: 19870 }, - log: { file: { path: '/var/log/auth.log' }, offset: 984133 }, - source: { - geo: { - continent_name: 'Europe', - country_iso_code: 'HR', - location: { lon: 15.5, lat: 45.1667 }, - }, - as: { - number: 42864, - organization: { name: 'Giganet Internet Szolgaltato Kft' }, - }, - ip: '45.95.168.157', - }, - fileset: { name: 'auth' }, - input: { type: 'log' }, - '@timestamp': '2020-09-04T07:25:28.000Z', - system: { auth: { ssh: { event: 'Invalid' } } }, - ecs: { version: '1.5.0' }, - related: { ip: ['45.95.168.157'], user: ['webadmin'] }, - service: { type: 'system' }, - host: { hostname: 'bastion00', name: 'bastion00.siem.estc.dev' }, - event: { - ingested: '2020-09-04T07:25:30.236651Z', - timezone: '+00:00', - kind: 'event', - module: 'system', - action: 'ssh_login', - type: ['authentication_failure', 'info'], - category: ['authentication'], - dataset: 'system.auth', - outcome: 'failure', - }, - user: { name: 'webadmin' }, + fields: { + 'source.ip': ['45.95.168.157'], + 'host.name': ['bastion00.siem.estc.dev'], + '@timestamp': ['2020-09-04T07:25:28.000Z'], }, sort: [1599204328000], }, @@ -2163,7 +717,6 @@ export const formattedSearchStrategyResponse = { ], ignore_unavailable: true, body: { - docvalue_fields: mockOptions.docValueFields, aggregations: { stack_by_count: { cardinality: { field: 'user.name' } }, stack_by: { @@ -2179,7 +732,7 @@ export const formattedSearchStrategyResponse = { lastFailure: { top_hits: { size: 1, - _source: [], + _source: false, sort: [{ '@timestamp': { order: 'desc' } }], }, }, @@ -2191,7 +744,7 @@ export const formattedSearchStrategyResponse = { lastSuccess: { top_hits: { size: 1, - _source: [], + _source: false, sort: [{ '@timestamp': { order: 'desc' } }], }, }, @@ -2218,6 +771,16 @@ export const formattedSearchStrategyResponse = { }, }, size: 0, + _source: false, + fields: [ + 'source.ip', + 'host.id', + 'host.name', + { + field: '@timestamp', + format: 'strict_date_optional_time', + }, + ], }, track_total_hits: false, }, @@ -2238,7 +801,7 @@ export const formattedSearchStrategyResponse = { host: { id: ['ce1d3c9b-a815-4643-9641-ada0f2c00609'], name: ['siem-windows'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { @@ -2252,13 +815,13 @@ export const formattedSearchStrategyResponse = { host: { id: ['aa7ca589f1b8220002f2fc61c64cfbf1'], name: ['siem-kibana'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 23, successes: 0, - _id: 'admin+23', + _id: 'ZfxZWXQBc39KFIJbLN5U', stackedValue: ['admin'], lastFailure: { timestamp: ['2020-09-04T13:40:46.000Z'], @@ -2266,13 +829,13 @@ export const formattedSearchStrategyResponse = { host: { id: ['aa7ca589f1b8220002f2fc61c64cfbf1'], name: ['siem-kibana'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 21, successes: 0, - _id: 'user+21', + _id: 'M_xLWXQBc39KFIJbY7Cb', stackedValue: ['user'], lastFailure: { timestamp: ['2020-09-04T13:25:43.000Z'], @@ -2280,13 +843,13 @@ export const formattedSearchStrategyResponse = { host: { name: ['bastion00.siem.estc.dev'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 18, successes: 0, - _id: 'ubuntu+18', + _id: 'nPxKWXQBc39KFIJb7q4w', stackedValue: ['ubuntu'], lastFailure: { timestamp: ['2020-09-04T13:25:07.000Z'], @@ -2294,13 +857,13 @@ export const formattedSearchStrategyResponse = { host: { name: ['bastion00.siem.estc.dev'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 17, successes: 0, - _id: 'odoo+17', + _id: 'mPsfWXQBc39KFIJbI8HI', stackedValue: ['odoo'], lastFailure: { timestamp: ['2020-09-04T12:26:36.000Z'], @@ -2308,13 +871,13 @@ export const formattedSearchStrategyResponse = { host: { id: ['aa7ca589f1b8220002f2fc61c64cfbf1'], name: ['siem-kibana'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 17, successes: 0, - _id: 'pi+17', + _id: 'aaToWHQBA6bGZw2uR-St', stackedValue: ['pi'], lastFailure: { timestamp: ['2020-09-04T11:37:22.000Z'], @@ -2322,13 +885,13 @@ export const formattedSearchStrategyResponse = { host: { name: ['bastion00.siem.estc.dev'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 14, successes: 0, - _id: 'demo+14', + _id: 'VaP_V3QBA6bGZw2upUbg', stackedValue: ['demo'], lastFailure: { timestamp: ['2020-09-04T07:23:22.000Z'], @@ -2336,13 +899,13 @@ export const formattedSearchStrategyResponse = { host: { name: ['bastion00.siem.estc.dev'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 13, successes: 0, - _id: 'git+13', + _id: 'PqYfWXQBA6bGZw2uIhVU', stackedValue: ['git'], lastFailure: { timestamp: ['2020-09-04T11:20:26.000Z'], @@ -2350,13 +913,13 @@ export const formattedSearchStrategyResponse = { host: { id: ['aa7ca589f1b8220002f2fc61c64cfbf1'], name: ['siem-kibana'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, { node: { failures: 13, successes: 0, - _id: 'webadmin+13', + _id: 'iMABWHQBB-gskclyitP-', stackedValue: ['webadmin'], lastFailure: { timestamp: ['2020-09-04T07:25:28.000Z'], @@ -2364,7 +927,7 @@ export const formattedSearchStrategyResponse = { host: { name: ['bastion00.siem.estc.dev'] }, }, }, - cursor: { value: '', tiebreaker: null }, + cursor: { value: undefined, tiebreaker: null }, }, ], totalCount: 188, @@ -2385,7 +948,6 @@ export const expectedDsl = { ], ignore_unavailable: true, body: { - docvalue_fields: mockOptions.docValueFields, aggregations: { stack_by_count: { cardinality: { field: 'user.name' } }, stack_by: { @@ -2399,7 +961,7 @@ export const expectedDsl = { filter: { term: { 'event.outcome': 'failure' } }, aggs: { lastFailure: { - top_hits: { size: 1, _source: [], sort: [{ '@timestamp': { order: 'desc' } }] }, + top_hits: { size: 1, _source: false, sort: [{ '@timestamp': { order: 'desc' } }] }, }, }, }, @@ -2407,7 +969,7 @@ export const expectedDsl = { filter: { term: { 'event.outcome': 'success' } }, aggs: { lastSuccess: { - top_hits: { size: 1, _source: [], sort: [{ '@timestamp': { order: 'desc' } }] }, + top_hits: { size: 1, _source: false, sort: [{ '@timestamp': { order: 'desc' } }] }, }, }, }, @@ -2431,6 +993,16 @@ export const expectedDsl = { ], }, }, + _source: false, + fields: [ + 'source.ip', + 'host.id', + 'host.name', + { + field: '@timestamp', + format: 'strict_date_optional_time', + }, + ], size: 0, }, track_total_hits: false, @@ -2441,7 +1013,7 @@ export const mockHit: AuthenticationHit = { _type: 'type-123', _id: 'id-123', _score: 10, - _source: { + fields: { '@timestamp': 'time-1', }, cursor: 'cursor-1', diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/dsl/query.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/dsl/query.dsl.ts index e018716d4c216..3c32ae3f85944 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/dsl/query.dsl.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/dsl/query.dsl.ts @@ -5,26 +5,10 @@ * 2.0. */ -import { isEmpty } from 'lodash/fp'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { UserAuthenticationsRequestOptions } from '../../../../../../../common/search_strategy/security_solution/users/authentications'; -import { sourceFieldsMap, hostFieldsMap } from '../../../../../../../common/ecs/ecs_fields'; - import { createQueryFilterClauses } from '../../../../../../utils/build_query'; -import { reduceFields } from '../../../../../../utils/build_query/reduce_fields'; - import { authenticationsFields } from '../helpers'; -import { extendMap } from '../../../../../../../common/ecs/ecs_fields/extend_map'; - -export const auditdFieldsMap: Readonly> = { - latest: '@timestamp', - 'lastSuccess.timestamp': 'lastSuccess.@timestamp', - 'lastFailure.timestamp': 'lastFailure.@timestamp', - ...{ ...extendMap('lastSuccess', sourceFieldsMap) }, - ...{ ...extendMap('lastSuccess', hostFieldsMap) }, - ...{ ...extendMap('lastFailure', sourceFieldsMap) }, - ...{ ...extendMap('lastFailure', hostFieldsMap) }, -}; export const buildQuery = ({ filterQuery, @@ -32,13 +16,7 @@ export const buildQuery = ({ timerange: { from, to }, pagination: { querySize }, defaultIndex, - docValueFields, }: UserAuthenticationsRequestOptions) => { - const esFields = reduceFields(authenticationsFields, { - ...hostFieldsMap, - ...sourceFieldsMap, - }) as string[]; - const filter = [ ...createQueryFilterClauses(filterQuery), { term: { 'event.category': 'authentication' } }, @@ -52,13 +30,13 @@ export const buildQuery = ({ }, }, ]; + const queryFields = authenticationsFields.filter((field) => field !== 'timestamp'); const dslQuery = { allow_no_indices: true, index: defaultIndex, ignore_unavailable: true, body: { - ...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}), aggregations: { stack_by_count: { cardinality: { @@ -85,7 +63,7 @@ export const buildQuery = ({ lastFailure: { top_hits: { size: 1, - _source: esFields, + _source: false, sort: [{ '@timestamp': { order: 'desc' as const } }], }, }, @@ -101,7 +79,7 @@ export const buildQuery = ({ lastSuccess: { top_hits: { size: 1, - _source: esFields, + _source: false, sort: [{ '@timestamp': { order: 'desc' as const } }], }, }, @@ -116,6 +94,14 @@ export const buildQuery = ({ }, }, size: 0, + _source: false, + fields: [ + ...queryFields, + { + field: '@timestamp', + format: 'strict_date_optional_time', + }, + ], }, track_total_hits: false, }; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.test.ts index 1e745ffcbf2ed..a8eea076ae1be 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.test.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.test.ts @@ -6,15 +6,12 @@ */ import { AuthenticationsEdges } from '../../../../../../common/search_strategy'; -import { auditdFieldsMap } from './dsl/query.dsl'; - import { formatAuthenticationData } from './helpers'; import { mockHit } from './__mocks__'; describe('#formatAuthenticationsData', () => { test('it formats a authentication with an empty set', () => { - const fields: readonly string[] = ['']; - const data = formatAuthenticationData(fields, mockHit, auditdFieldsMap); + const data = formatAuthenticationData(mockHit); const expected: AuthenticationsEdges = { cursor: { tiebreaker: null, @@ -32,8 +29,7 @@ describe('#formatAuthenticationsData', () => { }); test('it formats a authentications with a source ip correctly', () => { - const fields: readonly string[] = ['lastSuccess.source.ip']; - const data = formatAuthenticationData(fields, mockHit, auditdFieldsMap); + const data = formatAuthenticationData(mockHit); const expected: AuthenticationsEdges = { cursor: { tiebreaker: null, @@ -51,8 +47,7 @@ describe('#formatAuthenticationsData', () => { }); test('it formats a authentications with a host name only', () => { - const fields: readonly string[] = ['lastSuccess.host.name']; - const data = formatAuthenticationData(fields, mockHit, auditdFieldsMap); + const data = formatAuthenticationData(mockHit); const expected: AuthenticationsEdges = { cursor: { tiebreaker: null, @@ -70,8 +65,7 @@ describe('#formatAuthenticationsData', () => { }); test('it formats a authentications with a host id only', () => { - const fields: readonly string[] = ['lastSuccess.host.id']; - const data = formatAuthenticationData(fields, mockHit, auditdFieldsMap); + const data = formatAuthenticationData(mockHit); const expected: AuthenticationsEdges = { cursor: { tiebreaker: null, @@ -89,8 +83,7 @@ describe('#formatAuthenticationsData', () => { }); test('it formats a authentications with a host name and id correctly', () => { - const fields: readonly string[] = ['lastSuccess.host.name', 'lastSuccess.host.id']; - const data = formatAuthenticationData(fields, mockHit, auditdFieldsMap); + const data = formatAuthenticationData(mockHit); const expected: AuthenticationsEdges = { cursor: { tiebreaker: null, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.ts index 43baa4aadea14..46c0a83a3b572 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/helpers.ts @@ -7,8 +7,8 @@ import { get, getOr, isEmpty } from 'lodash/fp'; import { set } from '@elastic/safer-lodash-set/fp'; -import { mergeFieldsWithHit } from '../../../../../utils/build_query'; import { toObjectArrayOfStrings } from '../../../../../../common/utils/to_array'; +import { sourceFieldsMap, hostFieldsMap } from '../../../../../../common/ecs/ecs_fields'; import { AuthenticationsEdges, AuthenticationHit, @@ -17,78 +17,79 @@ import { StrategyResponseType, } from '../../../../../../common/search_strategy/security_solution'; -export const authenticationsFields = [ - '_id', - 'failures', - 'successes', - 'stackedValue', - 'lastSuccess.timestamp', - 'lastSuccess.source.ip', - 'lastSuccess.host.id', - 'lastSuccess.host.name', - 'lastFailure.timestamp', - 'lastFailure.source.ip', - 'lastFailure.host.id', - 'lastFailure.host.name', -]; +export const authenticationsFields = ['timestamp', 'source.ip', 'host.id', 'host.name']; +export const authenticationsFieldsMap: Readonly> = { + latest: '@timestamp', + lastSuccess: { + timestamp: '@timestamp', + ...sourceFieldsMap, + ...hostFieldsMap, + }, + lastFailure: { + timestamp: '@timestamp', + ...sourceFieldsMap, + ...hostFieldsMap, + }, +}; -export const formatAuthenticationData = ( - fields: readonly string[] = authenticationsFields, - hit: AuthenticationHit, - fieldMap: Readonly> -): AuthenticationsEdges => - fields.reduce( - (flattenedFields, fieldName) => { - if (hit.cursor) { - flattenedFields.cursor.value = hit.cursor; - } - flattenedFields.node = { - ...flattenedFields.node, - ...{ - _id: hit._id, - stackedValue: [hit.stackedValue], - failures: hit.failures, - successes: hit.successes, - }, - }; - const mergedResult = mergeFieldsWithHit(fieldName, flattenedFields, fieldMap, hit); - const fieldPath = `node.${fieldName}`; - const fieldValue = get(fieldPath, mergedResult); +export const formatAuthenticationData = (hit: AuthenticationHit): AuthenticationsEdges => { + let flattenedFields = { + node: { + _id: hit._id, + stackedValue: [hit.stackedValue], + failures: hit.failures, + successes: hit.successes, + }, + cursor: { + value: hit.cursor, + tiebreaker: null, + }, + }; + + const lastSuccessFields = getAuthenticationFields(authenticationsFields, hit, 'lastSuccess'); + if (Object.keys(lastSuccessFields).length > 0) { + flattenedFields = set('node.lastSuccess', lastSuccessFields, flattenedFields); + } + + const lastFailureFields = getAuthenticationFields(authenticationsFields, hit, 'lastFailure'); + if (Object.keys(lastFailureFields).length > 0) { + flattenedFields = set('node.lastFailure', lastFailureFields, flattenedFields); + } + + return flattenedFields; +}; + +const getAuthenticationFields = (fields: string[], hit: AuthenticationHit, parentField: string) => { + return fields.reduce((flattenedFields, fieldName) => { + const fieldPath = `${fieldName}`; + const esField = get(`${parentField}['${fieldName}']`, authenticationsFieldsMap); + + if (!isEmpty(esField)) { + const fieldValue = get(`${parentField}['${esField}']`, hit.fields); if (!isEmpty(fieldValue)) { return set( fieldPath, toObjectArrayOfStrings(fieldValue).map(({ str }) => str), - mergedResult + flattenedFields ); - } else { - return mergedResult; } - }, - { - node: { - failures: 0, - successes: 0, - _id: '', - stackedValue: [''], - }, - cursor: { - value: '', - tiebreaker: null, - }, } - ); + + return flattenedFields; + }, {}); +}; export const getHits = (response: StrategyResponseType) => getOr([], 'aggregations.stack_by.buckets', response.rawResponse).map( (bucket: AuthenticationBucket) => ({ _id: getOr( `${bucket.key}+${bucket.doc_count}`, - 'failures.lastFailure.hits.hits[0].id', + 'failures.lastFailure.hits.hits[0]._id', bucket ), - _source: { - lastSuccess: getOr(null, 'successes.lastSuccess.hits.hits[0]._source', bucket), - lastFailure: getOr(null, 'failures.lastFailure.hits.hits[0]._source', bucket), + fields: { + lastSuccess: getOr(null, 'successes.lastSuccess.hits.hits[0].fields', bucket), + lastFailure: getOr(null, 'failures.lastFailure.hits.hits[0].fields', bucket), }, stackedValue: bucket.key, failures: bucket.failures.doc_count, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/index.tsx b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/index.tsx index 5bb62f685ce4b..f2483b78dc3ef 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/index.tsx +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/authentications/index.tsx @@ -20,9 +20,9 @@ import { UsersQueries } from '../../../../../../common/search_strategy/security_ import { inspectStringifyObject } from '../../../../../utils/build_query'; import { SecuritySolutionFactory } from '../../types'; -import { auditdFieldsMap, buildQuery as buildAuthenticationQuery } from './dsl/query.dsl'; +import { buildQuery as buildAuthenticationQuery } from './dsl/query.dsl'; -import { authenticationsFields, formatAuthenticationData, getHits } from './helpers'; +import { formatAuthenticationData, getHits } from './helpers'; export const authentications: SecuritySolutionFactory = { buildDsl: (options: UserAuthenticationsRequestOptions) => { @@ -42,7 +42,7 @@ export const authentications: SecuritySolutionFactory - formatAuthenticationData(authenticationsFields, hit, auditdFieldsMap) + formatAuthenticationData(hit) ); const edges = authenticationEdges.splice(cursorStart, querySize - cursorStart); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/details/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/details/__mocks__/index.ts index 33760eec4556e..5b54ffaf8dff8 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/details/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/details/__mocks__/index.ts @@ -12,12 +12,6 @@ import { UserDetailsRequestOptions } from '../../../../../../../common/search_st export const mockOptions: UserDetailsRequestOptions = { defaultIndex: ['test_indices*'], - docValueFields: [ - { - field: '@timestamp', - format: 'date_time', - }, - ], factoryQueryType: UsersQueries.details, filterQuery: '{"bool":{"must":[],"filter":[{"match_all":{}},{"match_phrase":{"user.name":{"query":"test_user"}}}],"should":[],"must_not":[]}}', From 71e926b2026c46137d7f4f05f5d41d1ab13618fb Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Fri, 29 Apr 2022 20:31:04 +0200 Subject: [PATCH 26/89] [Discover] Fix "shows top-level object keys" flaky test (#131241) --- test/functional/apps/discover/_field_data.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/apps/discover/_field_data.ts b/test/functional/apps/discover/_field_data.ts index 28f147eeab55f..d13baf9948171 100644 --- a/test/functional/apps/discover/_field_data.ts +++ b/test/functional/apps/discover/_field_data.ts @@ -89,10 +89,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); await retry.try(async function tryingForTime() { expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent'); - }); - const field = await PageObjects.discover.getDocTableIndex(1); - expect(field).to.contain('og:description'); + const field = await PageObjects.discover.getDocTableIndex(1); + expect(field).to.contain('og:description'); + }); const marks = await PageObjects.discover.getMarks(); expect(marks.length).to.be(0); From d3a750eb15dfdcfcf8395ca8eb545031aaf9c527 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Fri, 29 Apr 2022 12:10:25 -0700 Subject: [PATCH 27/89] Add match_only_text and wildcard types to default fields (#131262) --- .../template/default_settings.test.ts | 15 +++++++++++++++ .../elasticsearch/template/default_settings.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts index 1ade871b27ef6..df1c87105bcf2 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts @@ -36,6 +36,18 @@ describe('buildDefaultSettings', () => { name: 'field2Boolean', type: 'boolean', }, + { + name: 'field3Text', + type: 'text', + }, + { + name: 'field4MatchOnlyText', + type: 'match_only_text', + }, + { + name: 'field5Wildcard', + type: 'wildcard', + }, ], }); @@ -49,6 +61,9 @@ describe('buildDefaultSettings', () => { "query": Object { "default_field": Array [ "field1Keyword", + "field3Text", + "field4MatchOnlyText", + "field5Wildcard", ], }, }, diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts index 7f8e8e8544109..5accf7b120f9e 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts @@ -8,7 +8,7 @@ import { appContextService } from '../../../app_context'; import type { Field, Fields } from '../../fields/field'; -const QUERY_DEFAULT_FIELD_TYPES = ['keyword', 'text']; +const QUERY_DEFAULT_FIELD_TYPES = ['keyword', 'text', 'match_only_text', 'wildcard']; const QUERY_DEFAULT_FIELD_LIMIT = 1024; const flattenFieldsToNameAndType = ( From b66ffe5346409d49c9a543f82cec3c9695a9f93a Mon Sep 17 00:00:00 2001 From: Shahzad Date: Fri, 29 Apr 2022 22:44:13 +0200 Subject: [PATCH 28/89] [Synthetics] Setup directory structure and new app (#131054) --- .../collectors/application_usage/schema.ts | 1 + src/plugins/telemetry/schema/oss_plugins.json | 131 +++++++++++++ .../synthetics/common/constants/plugin.ts | 3 + .../public/apps/synthetics/render_app.tsx | 26 +++ .../{lib/lib.ts => apps/synthetics_app.tsx} | 7 +- .../public/icons/heartbeat_white.svg | 11 -- x-pack/plugins/synthetics/public/index.ts | 2 +- .../uptime_page_template.test.tsx.snap | 0 .../app}/render_app.tsx | 4 +- .../app}/uptime_app.tsx | 2 +- .../app}/uptime_overview_fetcher.ts | 0 .../app}/uptime_page_template.test.tsx | 2 +- .../app}/uptime_page_template.tsx | 4 +- .../app}/use_no_data_config.ts | 2 +- .../__snapshots__/cert_monitors.test.tsx.snap | 0 .../__snapshots__/cert_search.test.tsx.snap | 0 .../__snapshots__/cert_status.test.tsx.snap | 0 .../certificates/cert_monitors.test.tsx | 0 .../components/certificates/cert_monitors.tsx | 2 +- .../certificates/cert_refresh_btn.tsx | 0 .../certificates/cert_search.test.tsx | 0 .../components/certificates/cert_search.tsx | 0 .../certificates/cert_status.test.tsx | 0 .../components/certificates/cert_status.tsx | 4 +- .../certificates/certificate_title.tsx | 0 .../certificates/certificates_list.test.tsx | 0 .../certificates/certificates_list.tsx | 2 +- .../certificates/fingerprint_col.test.tsx | 0 .../certificates/fingerprint_col.tsx | 2 +- .../components/certificates/index.ts | 0 .../components/certificates/translations.ts | 0 .../certificates/use_cert_search.ts | 4 +- .../__snapshots__/location_link.test.tsx.snap | 0 .../monitor_page_link.test.tsx.snap | 0 .../__snapshots__/monitor_tags.test.tsx.snap | 0 .../alerts/uptime_edit_alert_flyout.tsx | 0 .../chart_empty_state.test.tsx.snap | 0 .../__snapshots__/chart_wrapper.test.tsx.snap | 0 .../__snapshots__/donut_chart.test.tsx.snap | 0 .../donut_chart_legend_row.test.tsx.snap | 0 .../monitor_bar_series.test.tsx.snap | 0 .../common/charts/annotation_tooltip.tsx | 0 .../common/charts/chart_empty_state.test.tsx | 0 .../common/charts/chart_empty_state.tsx | 0 .../common/charts/chart_wrapper.test.tsx | 0 .../charts/chart_wrapper/chart_wrapper.tsx | 0 .../common/charts/chart_wrapper/index.ts | 0 .../common/charts/donut_chart.test.tsx | 0 .../components/common/charts/donut_chart.tsx | 0 .../common/charts/donut_chart_legend.test.tsx | 0 .../common/charts/donut_chart_legend.tsx | 0 .../charts/donut_chart_legend_row.test.tsx | 0 .../common/charts/donut_chart_legend_row.tsx | 0 .../common/charts/duration_chart.tsx | 2 +- .../common/charts/duration_charts.test.tsx | 2 +- .../common/charts/duration_line_bar_list.tsx | 0 .../charts/duration_line_series_list.tsx | 2 +- .../common/charts/get_tick_format.test.ts | 0 .../common/charts/get_tick_format.ts | 0 .../components/common/charts/index.ts | 0 .../common/charts/monitor_bar_series.test.tsx | 2 +- .../common/charts/monitor_bar_series.tsx | 2 +- .../common/charts/ping_histogram.test.tsx | 0 .../common/charts/ping_histogram.tsx | 2 +- .../components/common/charts/utils.test.ts | 0 .../components/common/charts/utils.ts | 0 .../components/common/header/action_menu.tsx | 0 .../header/action_menu_content.test.tsx | 0 .../common/header/action_menu_content.tsx | 2 +- .../common/header/inspector_header_link.tsx | 2 +- .../common/header/manage_monitors_btn.tsx | 4 +- .../common/header/page_tabs.test.tsx | 0 .../components/common/header/page_tabs.tsx | 2 +- .../components/common/higher_order/index.ts | 0 .../higher_order/responsive_wrapper.test.tsx | 0 .../higher_order/responsive_wrapper.tsx | 0 .../components/common/location_link.test.tsx | 0 .../components/common/location_link.tsx | 0 .../common/monitor_page_link.test.tsx | 0 .../components/common/monitor_page_link.tsx | 0 .../components/common/monitor_tags.test.tsx | 0 .../components/common/monitor_tags.tsx | 6 +- .../common/react_router_helpers/index.ts | 0 .../react_router_helpers/link_events.test.ts | 0 .../react_router_helpers/link_events.ts | 0 .../link_for_eui.test.tsx | 0 .../react_router_helpers/link_for_eui.tsx | 0 .../components/common/step_detail_link.tsx | 0 .../components/common/translations.ts | 0 .../common/uptime_date_picker.test.tsx | 0 .../components/common/uptime_date_picker.tsx | 2 +- .../browser/advanced_fields.test.tsx | 0 .../fleet_package/browser/advanced_fields.tsx | 0 .../fleet_package/browser/formatters.ts | 0 .../fleet_package/browser/normalizers.test.ts | 0 .../fleet_package/browser/normalizers.ts | 0 .../browser/script_recorder_fields.test.tsx | 0 .../browser/script_recorder_fields.tsx | 0 .../fleet_package/browser/simple_fields.tsx | 0 .../browser/source_field.test.tsx | 2 +- .../fleet_package/browser/source_field.tsx | 0 .../browser/throttling_fields.test.tsx | 0 .../browser/throttling_fields.tsx | 0 .../fleet_package/browser/uploader.tsx | 0 .../browser/zip_url_tls_fields.test.tsx | 0 .../browser/zip_url_tls_fields.tsx | 0 .../components/fleet_package/code_editor.tsx | 0 .../fleet_package/combo_box.test.tsx | 0 .../components/fleet_package/combo_box.tsx | 0 .../fleet_package/common/common_fields.tsx | 0 .../common/described_form_group_with_wrap.tsx | 0 .../fleet_package/common/enabled.tsx | 0 .../fleet_package/common/formatters.test.ts | 0 .../fleet_package/common/formatters.ts | 0 .../fleet_package/common/normalizers.test.ts | 0 .../fleet_package/common/normalizers.ts | 2 +- .../common/simple_fields_wrapper.tsx | 0 .../fleet_package/common/tls_options.tsx | 0 .../contexts/browser_context.tsx | 2 +- .../contexts/browser_context_advanced.tsx | 2 +- .../contexts/browser_provider.tsx | 0 .../fleet_package/contexts/http_context.tsx | 2 +- .../contexts/http_context_advanced.tsx | 2 +- .../fleet_package/contexts/http_provider.tsx | 0 .../fleet_package/contexts/icmp_context.tsx | 2 +- .../fleet_package/contexts/index.ts | 0 .../contexts/policy_config_context.tsx | 4 +- .../contexts/synthetics_context_providers.tsx | 0 .../fleet_package/contexts/tcp_context.tsx | 2 +- .../contexts/tcp_context_advanced.tsx | 2 +- .../fleet_package/contexts/tcp_provider.tsx | 0 .../contexts/tls_fields_context.tsx | 2 +- .../fleet_package/custom_fields.test.tsx | 0 .../fleet_package/custom_fields.tsx | 0 .../fleet_package/header_field.test.tsx | 0 .../components/fleet_package/header_field.tsx | 0 .../fleet_package/helpers/context_helpers.ts | 0 .../fleet_package/helpers/formatters.ts | 0 .../fleet_package/helpers/normalizers.ts | 0 .../fleet_package/hooks/use_policy.ts | 2 +- .../hooks/use_update_policy.test.tsx | 0 .../fleet_package/hooks/use_update_policy.ts | 0 .../http/advanced_fields.test.tsx | 0 .../fleet_package/http/advanced_fields.tsx | 0 .../fleet_package/http/formatters.ts | 0 .../fleet_package/http/normalizers.ts | 0 .../fleet_package/http/simple_fields.tsx | 0 .../icmp/advanced_fields.test.tsx | 0 .../fleet_package/icmp/advanced_fields.tsx | 0 .../fleet_package/icmp/formatters.ts | 0 .../fleet_package/icmp/normalizers.ts | 0 .../fleet_package/icmp/simple_fields.tsx | 0 .../components/fleet_package/index.tsx | 0 .../index_response_body_field.test.tsx | 0 .../index_response_body_field.tsx | 0 .../fleet_package/key_value_field.test.tsx | 0 .../fleet_package/key_value_field.tsx | 0 ...azy_synthetics_custom_assets_extension.tsx | 0 ...azy_synthetics_policy_create_extension.tsx | 0 .../lazy_synthetics_policy_edit_extension.tsx | 0 .../fleet_package/optional_label.tsx | 0 .../fleet_package/request_body_field.test.tsx | 0 .../fleet_package/request_body_field.tsx | 0 .../fleet_package/schedule_field.test.tsx | 0 .../fleet_package/schedule_field.tsx | 0 .../synthetics_custom_assets_extension.tsx | 4 +- .../synthetics_policy_create_extension.tsx | 2 +- ...s_policy_create_extension_wrapper.test.tsx | 0 ...hetics_policy_create_extension_wrapper.tsx | 0 .../synthetics_policy_edit_extension.tsx | 0 ...ics_policy_edit_extension_wrapper.test.tsx | 0 ...nthetics_policy_edit_extension_wrapper.tsx | 0 .../tcp/advanced_fields.test.tsx | 0 .../fleet_package/tcp/advanced_fields.tsx | 0 .../fleet_package/tcp/formatters.ts | 0 .../fleet_package/tcp/normalizers.ts | 0 .../fleet_package/tcp/simple_fields.tsx | 0 .../fleet_package/tls/formatters.ts | 0 .../fleet_package/tls/normalizers.ts | 0 .../fleet_package/tls_fields.test.tsx | 0 .../components/fleet_package/tls_fields.tsx | 0 .../components/fleet_package/types.tsx | 6 +- .../fleet_package/validation.test.ts | 2 +- .../components/fleet_package/validation.tsx | 0 .../monitor_charts.test.tsx.snap | 0 .../components/monitor/index.ts | 0 .../confirm_delete.test.tsx.snap | 0 .../ml_integerations.test.tsx.snap | 0 .../monitor/ml/confirm_alert_delete.tsx | 0 .../monitor/ml/confirm_delete.test.tsx | 0 .../components/monitor/ml/confirm_delete.tsx | 0 .../components/monitor/ml/index.ts | 0 .../monitor/ml/license_info.test.tsx | 0 .../components/monitor/ml/license_info.tsx | 0 .../components/monitor/ml/manage_ml_job.tsx | 2 +- .../components/monitor/ml/ml_flyout.test.tsx | 2 +- .../components/monitor/ml/ml_flyout.tsx | 0 .../monitor/ml/ml_flyout_container.tsx | 2 +- .../components/monitor/ml/ml_integeration.tsx | 2 +- .../monitor/ml/ml_integerations.test.tsx | 0 .../monitor/ml/ml_job_link.test.tsx | 0 .../components/monitor/ml/ml_job_link.tsx | 2 +- .../monitor/ml/ml_manage_job.test.tsx | 0 .../components/monitor/ml/translations.tsx | 0 .../monitor/ml/use_anomaly_alert.ts | 0 .../monitor/monitor_charts.test.tsx | 0 .../components/monitor/monitor_charts.tsx | 0 .../monitor/monitor_duration/index.ts | 0 .../monitor_duration/monitor_duration.tsx | 2 +- .../monitor_duration_container.tsx | 4 +- .../components/monitor/monitor_title.test.tsx | 2 +- .../components/monitor/monitor_title.tsx | 2 +- .../monitor/ping_histogram/index.ts | 0 .../ping_histogram_container.tsx | 0 .../__snapshots__/expanded_row.test.tsx.snap | 0 .../__snapshots__/ping_headers.test.tsx.snap | 0 .../ping_list/columns/expand_row.test.tsx | 4 +- .../monitor/ping_list/columns/expand_row.tsx | 2 +- .../monitor/ping_list/columns/failed_step.tsx | 2 +- .../monitor/ping_list/columns/ping_error.tsx | 2 +- .../monitor/ping_list/columns/ping_status.tsx | 4 +- .../ping_list/columns/ping_timestamp/index.ts | 0 .../no_image_available.test.tsx | 0 .../ping_timestamp/no_image_available.tsx | 0 .../ping_timestamp/no_image_display.test.tsx | 0 .../ping_timestamp/no_image_display.tsx | 0 .../ping_timestamp/ping_timestamp.test.tsx | 0 .../columns/ping_timestamp/ping_timestamp.tsx | 2 +- .../step_image_caption.test.tsx | 0 .../ping_timestamp/step_image_caption.tsx | 2 +- .../step_image_popover.test.tsx | 0 .../ping_timestamp/step_image_popover.tsx | 2 +- .../columns/ping_timestamp/translations.ts | 0 .../ping_list/columns/response_code.tsx | 0 .../monitor/ping_list/doc_link_body.test.tsx | 0 .../monitor/ping_list/doc_link_body.tsx | 0 .../monitor/ping_list/expanded_row.test.tsx | 2 +- .../monitor/ping_list/expanded_row.tsx | 2 +- .../components/monitor/ping_list/headers.tsx | 2 +- .../components/monitor/ping_list/index.tsx | 0 .../monitor/ping_list/location_name.tsx | 0 .../monitor/ping_list/ping_headers.test.tsx | 0 .../monitor/ping_list/ping_list.test.tsx | 2 +- .../monitor/ping_list/ping_list.tsx | 0 .../monitor/ping_list/ping_list_header.tsx | 0 .../monitor/ping_list/ping_list_table.tsx | 4 +- .../monitor/ping_list/ping_redirects.tsx | 2 +- .../monitor/ping_list/response_code.test.tsx | 0 .../monitor/ping_list/translations.ts | 0 .../components/monitor/ping_list/use_pings.ts | 4 +- .../monitor_status.bar.test.tsx.snap | 0 .../ssl_certificate.test.tsx.snap | 0 .../status_by_location.test.tsx.snap | 0 .../__snapshots__/tag_label.test.tsx.snap | 0 .../availability_reporting.test.tsx | 0 .../availability_reporting.tsx | 0 .../availability_reporting/index.ts | 0 .../location_status_tags.test.tsx | 2 +- .../location_status_tags.tsx | 4 +- .../availability_reporting/tag_label.test.tsx | 0 .../availability_reporting/tag_label.tsx | 2 +- .../monitor/status_details/index.ts | 0 .../location_availability.test.tsx | 2 +- .../location_availability.tsx | 2 +- .../monitor_status.bar.test.tsx | 2 +- .../status_details/ssl_certificate.test.tsx | 4 +- .../status_details/status_bar/index.ts | 0 .../status_bar/monitor_redirects.tsx | 2 +- .../status_bar/ssl_certificate.tsx | 4 +- .../status_bar/status_bar.test.ts | 0 .../status_details/status_bar/status_bar.tsx | 2 +- .../status_bar/status_by_location.tsx | 2 +- .../status_bar/use_status_bar.ts | 4 +- .../status_by_location.test.tsx | 2 +- .../monitor/status_details/status_details.tsx | 2 +- .../status_details_container.tsx | 2 +- .../monitor/status_details/translations.ts | 0 .../step_detail/step_detail_container.tsx | 0 .../synthetics/step_detail/step_page_nav.tsx | 0 .../step_detail/step_page_title.tsx | 0 .../step_detail/use_monitor_breadcrumb.tsx | 2 +- .../use_monitor_breadcrumbs.test.tsx | 4 +- .../use_step_waterfall_metrics.test.tsx | 0 .../step_detail/use_step_waterfall_metrics.ts | 0 .../waterfall/data_formatting.test.ts | 0 .../step_detail/waterfall/data_formatting.ts | 2 +- .../synthetics/step_detail/waterfall/types.ts | 2 +- .../waterfall_chart_container.test.tsx | 0 .../waterfall/waterfall_chart_container.tsx | 2 +- .../waterfall_chart_wrapper.test.tsx | 0 .../waterfall/waterfall_chart_wrapper.tsx | 2 +- .../waterfall/waterfall_filter.test.tsx | 0 .../waterfall/waterfall_filter.tsx | 0 .../waterfall/waterfall_flyout.test.tsx | 0 .../waterfall/waterfall_flyout.tsx | 0 .../waterfall/waterfall_sidebar_item.test.tsx | 0 .../waterfall/waterfall_sidebar_item.tsx | 0 .../monitor/synthetics/translations.ts | 0 .../monitor/synthetics/waterfall/README.md | 0 .../waterfall/components/constants.ts | 0 .../waterfall/components/legend.tsx | 0 .../components/middle_truncated_text.test.tsx | 0 .../components/middle_truncated_text.tsx | 0 .../network_requests_total.test.tsx | 0 .../components/network_requests_total.tsx | 0 .../waterfall/components/sidebar.tsx | 0 .../synthetics/waterfall/components/styles.ts | 0 .../waterfall/components/translations.ts | 0 .../components/use_bar_charts.test.tsx | 0 .../waterfall/components/use_bar_charts.ts | 0 .../waterfall/components/use_flyout.test.tsx | 0 .../waterfall/components/use_flyout.ts | 0 .../waterfall/components/waterfall.test.tsx | 0 .../components/waterfall_bar_chart.tsx | 0 .../waterfall/components/waterfall_chart.tsx | 0 .../components/waterfall_chart_fixed_axis.tsx | 0 .../components/waterfall_flyout_table.tsx | 0 .../components/waterfall_marker_icon.test.tsx | 0 .../components/waterfall_marker_icon.tsx | 0 .../waterfall_marker_test_helper.tsx | 2 +- .../waterfall_marker_trend.test.tsx | 2 +- .../components/waterfall_marker_trend.tsx | 0 .../components/waterfall_markers.tsx | 0 .../waterfall_tooltip_content.test.tsx | 0 .../components/waterfall_tooltip_content.tsx | 0 .../waterfall/context/waterfall_chart.tsx | 2 +- .../monitor/synthetics/waterfall/index.tsx | 0 .../monitor/synthetics/waterfall/types.ts | 0 .../action_bar/action_bar.test.tsx | 2 +- .../action_bar/action_bar.tsx | 4 +- .../action_bar/action_bar_errors.test.tsx | 2 +- .../action_bar/action_bar_portal.tsx | 0 .../monitor_management/add_monitor_btn.tsx | 2 +- .../monitor_management/content/index.ts | 0 .../edit_monitor_config.tsx | 4 +- .../hooks/use_enablement.ts | 0 .../hooks/use_format_monitor.ts | 4 +- .../hooks/use_inline_errors.test.tsx | 2 +- .../hooks/use_inline_errors.ts | 6 +- .../hooks/use_inline_errors_count.test.tsx | 2 +- .../hooks/use_inline_errors_count.ts | 2 +- .../hooks/use_invalid_monitors.tsx | 4 +- .../hooks/use_locations.test.tsx | 2 +- .../monitor_management/hooks/use_locations.ts | 0 .../hooks/use_run_once_errors.ts | 2 +- .../hooks/use_service_allowed.ts | 0 .../monitor_management/loader/loader.test.tsx | 0 .../monitor_management/loader/loader.tsx | 0 .../monitor_management/mocks/index.ts | 0 .../monitor_management/mocks/locations.ts | 0 .../monitor_config/locations.test.tsx | 0 .../monitor_config/locations.tsx | 2 +- .../monitor_advanced_fields.tsx | 4 +- .../monitor_config/monitor_config.test.tsx | 0 .../monitor_config/monitor_config.tsx | 4 +- .../monitor_config/monitor_fields.test.tsx | 2 +- .../monitor_config/monitor_fields.tsx | 2 +- .../monitor_config/monitor_name_location.tsx | 4 +- .../monitor_config/use_monitor_name.test.tsx | 0 .../monitor_config/use_monitor_name.ts | 2 +- .../monitor_list/actions.test.tsx | 0 .../monitor_list/actions.tsx | 2 +- .../monitor_list/all_monitors.tsx | 2 +- .../monitor_list/delete_monitor.test.tsx | 0 .../monitor_list/delete_monitor.tsx | 0 .../monitor_list/enablement_empty_state.tsx | 0 .../monitor_list/inline_error.test.tsx | 0 .../monitor_list/inline_error.tsx | 2 +- .../monitor_list/invalid_monitors.tsx | 2 +- .../monitor_list/list_tabs.test.tsx | 0 .../monitor_list/list_tabs.tsx | 2 +- .../monitor_list/monitor_async_error.test.tsx | 2 +- .../monitor_list/monitor_async_error.tsx | 0 .../monitor_list/monitor_enabled.test.tsx | 2 +- .../monitor_list/monitor_enabled.tsx | 2 +- .../monitor_list/monitor_list.test.tsx | 2 +- .../monitor_list/monitor_list.tsx | 2 +- .../monitor_list/monitor_list_container.tsx | 2 +- .../monitor_list/monitor_locations.tsx | 2 +- .../monitor_list/stderr_logs_popover.tsx | 0 .../monitor_management/monitor_list/tags.tsx | 0 .../monitor_management/show_sync_errors.tsx | 2 +- .../browser/browser_test_results.test.tsx | 0 .../browser/browser_test_results.tsx | 0 .../use_browser_run_once_monitors.test.tsx | 0 .../browser/use_browser_run_once_monitors.ts | 4 +- .../simple/simple_test_results.test.tsx | 2 +- .../simple/simple_test_results.tsx | 2 +- .../simple/use_simple_run_once_monitors.ts | 4 +- .../test_now_mode/test_now_mode.test.tsx | 2 +- .../test_now_mode/test_now_mode.tsx | 6 +- .../test_now_mode/test_result_header.test.tsx | 0 .../test_now_mode/test_result_header.tsx | 2 +- .../test_now_mode/test_run_results.tsx | 2 +- .../test_now_mode/use_tick_tick.ts | 0 .../monitor_management/validation.test.ts | 2 +- .../monitor_management/validation.ts | 4 +- .../snapshot_heading.test.tsx.snap | 0 .../alerts/alert_expression_popover.tsx | 0 .../alerts/alert_field_number.test.tsx | 0 .../overview/alerts/alert_field_number.tsx | 0 .../alerts/alert_query_bar/query_bar.tsx | 0 .../components/overview/alerts/alert_tls.tsx | 0 .../alert_monitor_status.tsx | 4 +- .../alerts/alerts_containers/alert_tls.tsx | 0 .../alerts/alerts_containers/index.ts | 0 .../toggle_alert_flyout_button.tsx | 0 .../uptime_alerts_flyout_wrapper.tsx | 0 .../alerts/alerts_containers/use_snap_shot.ts | 0 .../alerts/anomaly_alert/anomaly_alert.tsx | 0 .../alerts/anomaly_alert/select_severity.tsx | 0 .../alerts/anomaly_alert/translations.ts | 0 .../components/overview/alerts/index.ts | 0 .../down_number_select.test.tsx.snap | 0 .../time_expression_select.test.tsx.snap | 0 .../availability_expression_select.tsx | 0 .../down_number_select.test.tsx | 0 .../down_number_select.tsx | 0 .../filters_expression_select.test.tsx | 0 .../filters_expression_select.tsx | 2 +- .../alerts/monitor_expressions/index.ts | 0 .../status_expression_select.tsx | 0 .../time_expression_select.test.tsx | 0 .../time_expression_select.tsx | 0 .../time_unit_selectable.tsx | 0 .../monitor_expressions/translations.ts | 0 .../add_filter_btn.test.tsx | 0 .../monitor_status_alert/add_filter_btn.tsx | 0 .../alert_monitor_status.test.tsx | 0 .../alert_monitor_status.tsx | 2 +- .../old_alert_call_out.tsx | 0 .../old_alert_callout.test.tsx | 0 .../settings_message_expression_popover.tsx | 0 .../toggle_alert_flyout_button.test.tsx | 0 .../alerts/toggle_alert_flyout_button.tsx | 4 +- .../overview/alerts/translations.ts | 0 .../alerts/uptime_alerts_flyout_wrapper.tsx | 0 .../empty_state/empty_state_error.tsx | 0 .../empty_state/empty_state_loading.tsx | 0 .../overview/empty_state/use_has_data.tsx | 0 .../filter_group/filter_group.test.tsx | 0 .../overview/filter_group/filter_group.tsx | 2 +- .../filter_group/selected_filters.tsx | 0 .../overview/filter_group/translations.tsx | 0 .../components/overview/index.ts | 0 .../filter_status_button.test.tsx.snap | 0 .../__snapshots__/status_filter.test.tsx.snap | 0 .../columns/cert_status_column.tsx | 4 +- .../columns/define_connectors.test.tsx | 0 .../columns/define_connectors.tsx | 2 +- .../columns/enable_alert.test.tsx | 4 +- .../monitor_list/columns/enable_alert.tsx | 4 +- .../monitor_list/columns/monitor_name_col.tsx | 2 +- .../columns/monitor_status_column.test.tsx | 4 +- .../columns/monitor_status_column.tsx | 4 +- .../progress/browser_monitor_progress.tsx | 4 +- .../columns/progress/monitor_progress.tsx | 2 +- .../progress/simple_monitor_progress.tsx | 4 +- .../columns/progress/use_updated_monitor.ts | 0 .../columns/status_badge.test.tsx | 0 .../monitor_list/columns/status_badge.tsx | 4 +- .../monitor_list/columns/test_now_col.tsx | 0 .../monitor_list/columns/translations.ts | 0 .../filter_status_button.test.tsx | 0 .../monitor_list/filter_status_button.tsx | 0 .../components/overview/monitor_list/index.ts | 0 .../monitor_list/monitor_list.test.tsx | 2 +- .../overview/monitor_list/monitor_list.tsx | 4 +- .../monitor_list/monitor_list_container.tsx | 0 .../integration_group.test.tsx.snap | 0 .../integration_link.test.tsx.snap | 0 .../monitor_list_drawer.test.tsx.snap | 0 .../most_recent_error.test.tsx.snap | 0 .../actions_popover/actions_popover.tsx | 2 +- .../actions_popover_container.tsx | 0 .../actions_popover/integration_group.tsx | 2 +- .../actions_popover/integration_link.tsx | 0 .../monitor_list_drawer/data.json | 0 .../monitor_list_drawer/enabled_alerts.tsx | 0 .../monitor_list/monitor_list_drawer/index.ts | 0 .../integration_group.test.tsx | 2 +- .../integration_link.test.tsx | 0 .../list_drawer_container.tsx | 2 +- .../monitor_list_drawer.test.tsx | 2 +- .../monitor_list_drawer.tsx | 2 +- .../monitor_status_list.test.tsx | 2 +- .../monitor_status_list.tsx | 4 +- .../monitor_status_row.test.tsx | 0 .../monitor_status_row.tsx | 2 +- .../monitor_list_drawer/monitor_url.tsx | 0 .../most_recent_error.test.tsx | 2 +- .../monitor_list_drawer/most_recent_error.tsx | 2 +- .../monitor_list_drawer/most_recent_run.tsx | 2 +- .../monitor_list/monitor_list_header.tsx | 0 .../monitor_list_page_size_select.test.tsx | 0 .../monitor_list_page_size_select.tsx | 0 .../monitor_list/no_items_meesage.test.tsx | 0 .../monitor_list/no_items_message.tsx | 0 .../monitor_list/overview_page_link.tsx | 0 .../monitor_list/parse_timestamp.test.ts | 0 .../overview/monitor_list/parse_timestamp.ts | 0 .../monitor_list/status_filter.test.tsx | 0 .../overview/monitor_list/status_filter.tsx | 0 .../overview/monitor_list/translations.ts | 0 .../monitor_list/troubleshoot_popover.tsx | 0 .../components/overview/monitor_list/types.ts | 0 .../monitor_list/use_monitor_histogram.ts | 6 +- .../overview/query_bar/query_bar.tsx | 0 .../overview/query_bar/translations.ts | 0 .../overview/query_bar/use_query_bar.test.tsx | 0 .../overview/query_bar/use_query_bar.ts | 2 +- .../__snapshots__/snapshot.test.tsx.snap | 0 .../components/overview/snapshot/index.ts | 0 .../overview/snapshot/snapshot.test.tsx | 2 +- .../components/overview/snapshot/snapshot.tsx | 0 .../overview/snapshot/snapshot_heading.tsx | 0 .../overview/snapshot/use_snap_shot.ts | 0 .../overview/snapshot_heading.test.tsx | 0 .../components/overview/status_panel.tsx | 0 .../overview/synthetics_callout.test.tsx | 0 .../overview/synthetics_callout.tsx | 0 .../certificate_form.test.tsx.snap | 0 .../__snapshots__/indices_form.test.tsx.snap | 0 .../settings/add_connector_flyout.tsx | 0 .../settings/alert_defaults_form.tsx | 0 .../settings/certificate_form.test.tsx | 0 .../components/settings/certificate_form.tsx | 4 +- .../components/settings/default_email.tsx | 4 +- .../components/settings/indices_form.test.tsx | 0 .../components/settings/indices_form.tsx | 2 +- .../components/settings/settings_actions.tsx | 0 .../settings/settings_bottom_bar.tsx | 0 .../components/settings/translations.ts | 0 .../components/settings/types.ts | 0 .../settings/use_settings_errors.ts | 0 .../synthetics/check_steps/stderr_logs.tsx | 4 +- .../synthetics/check_steps/step_duration.tsx | 2 +- .../step_expanded_row/screenshot_link.tsx | 2 +- .../step_expanded_row/step_screenshots.tsx | 4 +- .../check_steps/step_field_trend.test.tsx | 2 +- .../check_steps/step_field_trend.tsx | 2 +- .../synthetics/check_steps/step_image.tsx | 2 +- .../check_steps/steps_list.test.tsx | 2 +- .../synthetics/check_steps/steps_list.tsx | 2 +- .../synthetics/check_steps/use_check_steps.ts | 0 .../check_steps/use_expanded_row.test.tsx | 4 +- .../check_steps/use_expanded_row.tsx | 2 +- .../check_steps/use_std_error_logs.ts | 2 +- .../synthetics/code_block_accordion.tsx | 0 .../synthetics/console_event.test.tsx | 0 .../components/synthetics/console_event.tsx | 2 +- .../console_output_event_list.test.tsx | 2 +- .../synthetics/console_output_event_list.tsx | 2 +- .../synthetics/empty_journey.test.tsx | 0 .../components/synthetics/empty_journey.tsx | 0 .../synthetics/executed_step.test.tsx | 2 +- .../components/synthetics/executed_step.tsx | 2 +- .../synthetics/status_badge.test.tsx | 0 .../components/synthetics/status_badge.tsx | 2 +- .../step_screenshot_display.test.tsx | 0 .../synthetics/step_screenshot_display.tsx | 2 +- .../components/synthetics/translations.ts | 0 .../{ => legacy_uptime}/contexts/index.ts | 0 .../contexts/uptime_data_view_context.tsx | 0 .../contexts/uptime_refresh_context.tsx | 0 .../contexts/uptime_settings_context.tsx | 4 +- .../uptime_startup_plugins_context.tsx | 2 +- .../contexts/uptime_theme_context.tsx | 2 +- .../use_url_params.test.tsx.snap | 0 .../public/{ => legacy_uptime}/hooks/index.ts | 0 .../hooks/update_kuery_string.ts | 2 +- .../hooks/use_breadcrumbs.test.tsx | 2 +- .../hooks/use_breadcrumbs.ts | 2 +- .../hooks/use_breakpoints.test.ts | 0 .../hooks/use_breakpoints.ts | 0 .../hooks/use_cert_status.ts | 2 +- .../hooks/use_chart_theme.ts | 0 .../hooks/use_composite_image.test.tsx | 2 +- .../hooks/use_composite_image.ts | 2 +- .../hooks/use_filter_update.test.ts | 0 .../hooks/use_filter_update.ts | 0 .../{ => legacy_uptime}/hooks/use_init_app.ts | 0 .../hooks/use_mapping_check.test.ts | 0 .../hooks/use_mapping_check.ts | 2 +- .../{ => legacy_uptime}/hooks/use_monitor.ts | 0 .../hooks/use_overview_filter_check.test.tsx | 0 .../hooks/use_overview_filter_check.ts | 0 .../hooks/use_search_text.ts | 0 .../hooks/use_selected_filters.test.tsx | 0 .../hooks/use_selected_filters.ts | 2 +- .../hooks/use_telemetry.ts | 2 +- .../hooks/use_url_params.test.tsx | 0 .../hooks/use_url_params.ts | 0 .../lib/__mocks__/screenshot_ref.mock.ts | 2 +- .../lib/__mocks__/uptime_plugin_start_mock.ts | 0 .../lib/__mocks__/uptime_store.mock.ts | 4 +- .../lib/__mocks__/use_composite_image.mock.ts | 2 +- .../lib/__mocks__/ut_router_history.mock.ts | 0 .../framework/capabilities_adapter.ts | 0 .../lib/alert_types/alert_messages.tsx | 0 .../lib/alert_types/common.ts | 0 .../lib/alert_types/duration_anomaly.tsx | 6 +- .../lib/alert_types/index.ts | 2 +- .../lazy_wrapper/duration_anomaly.tsx | 2 +- .../lazy_wrapper/monitor_status.tsx | 2 +- .../alert_types/lazy_wrapper/tls_alert.tsx | 2 +- .../lazy_wrapper/validate_monitor_status.ts | 2 +- .../lib/alert_types/monitor_status.test.ts | 0 .../lib/alert_types/monitor_status.tsx | 6 +- .../lib/alert_types/tls.tsx | 6 +- .../lib/alert_types/tls_legacy.tsx | 4 +- .../{ => legacy_uptime}/lib/formatting.ts | 0 .../lib/helper/charts/get_chart_date_label.ts | 2 +- .../helper/charts/get_label_format.test.ts | 0 .../lib/helper/charts/get_label_format.ts | 2 +- .../lib/helper/charts/index.ts | 0 .../charts/is_within_current_date.test.ts | 0 .../helper/charts/is_within_current_date.ts | 0 .../helper/compose_screenshot_images.test.ts | 2 +- .../lib/helper/compose_screenshot_images.ts | 2 +- .../lib/helper/convert_measurements.test.ts | 0 .../lib/helper/convert_measurements.ts | 0 .../lib/helper/enzyme_helpers.tsx | 0 .../lib/helper/get_title.ts | 0 .../lib/helper/helper_with_redux.tsx | 0 .../{ => legacy_uptime}/lib/helper/index.ts | 0 .../add_base_path.ts | 0 .../observability_integration/build_href.ts | 2 +- .../get_apm_href.test.ts | 2 +- .../observability_integration/get_apm_href.ts | 2 +- .../get_infra_href.test.ts | 2 +- .../get_infra_href.ts | 2 +- .../get_logging_href.test.ts | 2 +- .../get_logging_href.ts | 2 +- .../helper/observability_integration/index.ts | 0 .../lib/helper/parse_search.test.ts | 0 .../lib/helper/parse_search.ts | 0 .../lib/helper/rtl_helpers.tsx | 2 +- .../lib/helper/series_has_down_values.test.ts | 0 .../lib/helper/series_has_down_values.ts | 2 +- .../lib/helper/spy_use_fetcher.ts | 0 .../lib/helper/stringify_url_params.test.ts | 0 .../lib/helper/stringify_url_params.ts | 2 +- .../lib/helper/test_helpers.ts | 0 .../get_supported_url_params.test.ts.snap | 0 .../get_supported_url_params.test.ts | 2 +- .../url_params/get_supported_url_params.ts | 2 +- .../lib/helper/url_params/index.ts | 0 .../url_params/parse_absolute_date.test.ts | 0 .../helper/url_params/parse_absolute_date.ts | 0 .../helper/url_params/parse_is_paused.test.ts | 0 .../lib/helper/url_params/parse_is_paused.ts | 0 .../helper/url_params/parse_url_int.test.ts | 0 .../lib/helper/url_params/parse_url_int.ts | 0 .../public/{ => legacy_uptime}/lib/index.ts | 0 .../{badge.ts => legacy_uptime/lib/lib.ts} | 2 +- .../pages/certificates.test.tsx | 0 .../pages/certificates.tsx | 0 .../public/{ => legacy_uptime}/pages/index.ts | 0 .../pages/mapping_error.tsx | 0 .../pages/monitor.test.tsx | 0 .../{ => legacy_uptime}/pages/monitor.tsx | 0 .../action_bar_portal_node.tsx | 0 .../pages/monitor_management/add_monitor.tsx | 2 +- .../pages/monitor_management/bottom_bar.tsx | 0 .../pages/monitor_management/content.ts | 0 .../pages/monitor_management/edit_monitor.tsx | 4 +- .../monitor_management/monitor_management.tsx | 2 +- .../service_allowed_wrapper.test.tsx | 0 .../service_allowed_wrapper.tsx | 0 .../use_monitor_management_breadcrumbs.tsx | 4 +- .../pages/not_found.test.tsx | 0 .../{ => legacy_uptime}/pages/not_found.tsx | 0 .../pages/overview.test.tsx | 0 .../{ => legacy_uptime}/pages/overview.tsx | 0 .../pages/settings.test.tsx | 0 .../{ => legacy_uptime}/pages/settings.tsx | 4 +- .../pages/synthetics/checks_navigation.tsx | 2 +- .../pages/synthetics/step_detail_page.tsx | 2 +- .../synthetics/synthetics_checks.test.tsx | 2 +- .../pages/synthetics/synthetics_checks.tsx | 0 .../{ => legacy_uptime}/pages/translations.ts | 0 .../public/{ => legacy_uptime}/routes.tsx | 4 +- .../state/actions/alerts.ts | 0 .../state/actions/dynamic_settings.ts | 2 +- .../state/actions/index.ts | 0 .../state/actions/index_status.ts | 2 +- .../state/actions/journey.ts | 2 +- .../state/actions/ml_anomaly.ts | 0 .../state/actions/monitor.ts | 4 +- .../state/actions/monitor_duration.ts | 2 +- .../state/actions/monitor_list.ts | 5 +- .../state/actions/monitor_management.ts | 4 +- .../state/actions/monitor_status.ts | 2 +- .../state/actions/network_events.ts | 2 +- .../{ => legacy_uptime}/state/actions/ping.ts | 2 +- .../state/actions/selected_filters.ts | 0 .../state/actions/snapshot.ts | 2 +- .../state/actions/types.ts | 0 .../{ => legacy_uptime}/state/actions/ui.ts | 0 .../state/actions/utils.ts | 0 .../state/alerts/alerts.ts | 0 .../api/__snapshots__/snapshot.test.ts.snap | 0 .../state/api/alert_actions.test.ts | 0 .../state/api/alert_actions.ts | 8 +- .../{ => legacy_uptime}/state/api/alerts.ts | 10 +- .../state/api/dynamic_settings.ts | 4 +- .../{ => legacy_uptime}/state/api/index.ts | 0 .../state/api/index_status.ts | 4 +- .../{ => legacy_uptime}/state/api/journey.ts | 6 +- .../state/api/ml_anomaly.ts | 4 +- .../{ => legacy_uptime}/state/api/monitor.ts | 4 +- .../state/api/monitor_duration.ts | 2 +- .../state/api/monitor_list.ts | 4 +- .../state/api/monitor_management.ts | 6 +- .../state/api/monitor_status.ts | 4 +- .../state/api/network_events.ts | 4 +- .../{ => legacy_uptime}/state/api/ping.ts | 4 +- .../state/api/snapshot.test.ts | 2 +- .../{ => legacy_uptime}/state/api/snapshot.ts | 4 +- .../{ => legacy_uptime}/state/api/types.ts | 0 .../{ => legacy_uptime}/state/api/utils.ts | 0 .../state/certificates/certificates.ts | 0 .../state/effects/alerts.ts | 0 .../state/effects/dynamic_settings.ts | 2 +- .../state/effects/fetch_effect.test.ts | 2 +- .../state/effects/fetch_effect.ts | 0 .../state/effects/index.ts | 0 .../state/effects/index_status.ts | 0 .../state/effects/journey.test.ts | 0 .../state/effects/journey.ts | 2 +- .../state/effects/ml_anomaly.ts | 0 .../state/effects/monitor.ts | 0 .../state/effects/monitor_duration.ts | 0 .../state/effects/monitor_list.ts | 0 .../state/effects/monitor_management.ts | 0 .../state/effects/monitor_status.ts | 0 .../state/effects/network_events.ts | 2 +- .../{ => legacy_uptime}/state/effects/ping.ts | 0 .../state/effects/synthetic_journey_blocks.ts | 2 +- .../state/effects/test_now_runs.ts | 0 .../public/{ => legacy_uptime}/state/index.ts | 0 .../state/kibana_service.ts | 0 .../state/reducers/dynamic_settings.ts | 2 +- .../state/reducers/index.ts | 0 .../state/reducers/index_status.ts | 2 +- .../state/reducers/journey.ts | 2 +- .../state/reducers/ml_anomaly.ts | 0 .../state/reducers/monitor.ts | 2 +- .../state/reducers/monitor_duration.ts | 2 +- .../state/reducers/monitor_list.ts | 2 +- .../state/reducers/monitor_management.ts | 4 +- .../state/reducers/monitor_status.test.ts | 0 .../state/reducers/monitor_status.ts | 2 +- .../state/reducers/network_events.ts | 2 +- .../state/reducers/ping.ts | 2 +- .../state/reducers/ping_list.ts | 2 +- .../state/reducers/selected_filters.test.ts | 0 .../state/reducers/selected_filters.ts | 0 .../state/reducers/synthetics.test.ts | 0 .../state/reducers/synthetics.ts | 2 +- .../state/reducers/test_now_runs.ts | 2 +- .../state/reducers/types.ts | 0 .../state/reducers/ui.test.ts | 0 .../{ => legacy_uptime}/state/reducers/ui.ts | 0 .../state/reducers/utils.ts | 0 .../state/selectors/index.test.ts | 0 .../state/selectors/index.ts | 0 .../synthetics/public/{apps => }/plugin.ts | 66 ++++--- .../plugins/synthetics/server/kibana.index.ts | 6 +- x-pack/plugins/synthetics/tsconfig.json | 2 +- .../schema/xpack_plugins.json | 184 +++++++++--------- .../feature_controls/uptime_security.ts | 3 +- 773 files changed, 681 insertions(+), 500 deletions(-) create mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/render_app.tsx rename x-pack/plugins/synthetics/public/{lib/lib.ts => apps/synthetics_app.tsx} (71%) delete mode 100644 x-pack/plugins/synthetics/public/icons/heartbeat_white.svg rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/__snapshots__/uptime_page_template.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/render_app.tsx (95%) rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/uptime_app.tsx (98%) rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/uptime_overview_fetcher.ts (100%) rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/uptime_page_template.test.tsx (96%) rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/uptime_page_template.tsx (95%) rename x-pack/plugins/synthetics/public/{apps => legacy_uptime/app}/use_no_data_config.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/__snapshots__/cert_monitors.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/__snapshots__/cert_search.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/__snapshots__/cert_status.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_monitors.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_monitors.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_refresh_btn.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_search.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_search.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_status.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/cert_status.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/certificate_title.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/certificates_list.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/certificates_list.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/fingerprint_col.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/fingerprint_col.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/certificates/use_cert_search.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/__snapshots__/location_link.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/__snapshots__/monitor_page_link.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/__snapshots__/monitor_tags.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/alerts/uptime_edit_alert_flyout.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/__snapshots__/donut_chart.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/annotation_tooltip.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/chart_empty_state.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/chart_empty_state.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/chart_wrapper.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/chart_wrapper/chart_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/chart_wrapper/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/donut_chart.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/donut_chart.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/donut_chart_legend.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/donut_chart_legend.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/donut_chart_legend_row.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/donut_chart_legend_row.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/duration_chart.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/duration_charts.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/duration_line_bar_list.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/duration_line_series_list.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/get_tick_format.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/get_tick_format.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/monitor_bar_series.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/monitor_bar_series.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/ping_histogram.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/ping_histogram.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/utils.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/charts/utils.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/action_menu.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/action_menu_content.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/action_menu_content.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/inspector_header_link.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/manage_monitors_btn.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/page_tabs.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/header/page_tabs.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/higher_order/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/higher_order/responsive_wrapper.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/higher_order/responsive_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/location_link.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/location_link.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/monitor_page_link.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/monitor_page_link.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/monitor_tags.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/monitor_tags.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/react_router_helpers/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/react_router_helpers/link_events.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/react_router_helpers/link_events.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/react_router_helpers/link_for_eui.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/react_router_helpers/link_for_eui.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/step_detail_link.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/uptime_date_picker.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/common/uptime_date_picker.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/advanced_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/advanced_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/normalizers.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/normalizers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/script_recorder_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/script_recorder_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/simple_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/source_field.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/source_field.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/throttling_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/throttling_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/uploader.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/zip_url_tls_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/browser/zip_url_tls_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/code_editor.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/combo_box.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/combo_box.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/common_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/described_form_group_with_wrap.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/enabled.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/formatters.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/normalizers.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/normalizers.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/simple_fields_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/common/tls_options.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/browser_context.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/browser_context_advanced.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/browser_provider.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/http_context.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/http_context_advanced.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/http_provider.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/icmp_context.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/policy_config_context.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/synthetics_context_providers.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/tcp_context.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/tcp_context_advanced.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/tcp_provider.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/contexts/tls_fields_context.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/custom_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/custom_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/header_field.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/header_field.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/helpers/context_helpers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/helpers/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/helpers/normalizers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/hooks/use_policy.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/hooks/use_update_policy.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/hooks/use_update_policy.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/http/advanced_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/http/advanced_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/http/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/http/normalizers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/http/simple_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/icmp/advanced_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/icmp/advanced_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/icmp/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/icmp/normalizers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/icmp/simple_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/index.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/index_response_body_field.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/index_response_body_field.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/key_value_field.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/key_value_field.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/lazy_synthetics_policy_create_extension.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/optional_label.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/request_body_field.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/request_body_field.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/schedule_field.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/schedule_field.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_custom_assets_extension.tsx (90%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_policy_create_extension.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_policy_edit_extension.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tcp/advanced_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tcp/advanced_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tcp/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tcp/normalizers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tcp/simple_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tls/formatters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tls/normalizers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tls_fields.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/tls_fields.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/types.tsx (85%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/validation.test.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/fleet_package/validation.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/__snapshots__/monitor_charts.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/confirm_alert_delete.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/confirm_delete.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/confirm_delete.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/license_info.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/license_info.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/manage_ml_job.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_flyout.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_flyout.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_flyout_container.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_integeration.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_integerations.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_job_link.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_job_link.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/ml_manage_job.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/translations.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ml/use_anomaly_alert.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_charts.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_charts.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_duration/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_duration/monitor_duration.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_duration/monitor_duration_container.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_title.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/monitor_title.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_histogram/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_histogram/ping_histogram_container.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/expand_row.test.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/expand_row.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/failed_step.tsx (88%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_error.tsx (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_status.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/ping_timestamp/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/columns/response_code.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/doc_link_body.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/doc_link_body.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/expanded_row.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/expanded_row.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/headers.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/index.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/location_name.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/ping_headers.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/ping_list.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/ping_list.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/ping_list_header.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/ping_list_table.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/ping_redirects.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/response_code.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/ping_list/use_pings.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/availability_reporting.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/location_status_tags.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/tag_label.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/availability_reporting/tag_label.tsx (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/location_availability/location_availability.test.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/location_availability/location_availability.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/monitor_status.bar.test.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/ssl_certificate.test.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/monitor_redirects.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/ssl_certificate.tsx (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/status_bar.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/status_bar.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/status_by_location.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_bar/use_status_bar.ts (90%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_by_location.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_details.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/status_details_container.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/status_details/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/step_detail_container.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/step_page_nav.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/step_page_title.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/types.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/README.md (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/constants.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/legend.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/network_requests_total.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/sidebar.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/styles.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/use_bar_charts.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/use_flyout.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/index.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor/synthetics/waterfall/types.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/action_bar/action_bar.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/action_bar/action_bar.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/action_bar/action_bar_errors.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/action_bar/action_bar_portal.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/add_monitor_btn.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/content/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/edit_monitor_config.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_enablement.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_format_monitor.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_inline_errors.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_inline_errors.ts (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_inline_errors_count.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_inline_errors_count.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_invalid_monitors.tsx (90%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_locations.test.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_locations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_run_once_errors.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/hooks/use_service_allowed.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/loader/loader.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/loader/loader.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/mocks/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/mocks/locations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/locations.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/locations.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/monitor_advanced_fields.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/monitor_config.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/monitor_config.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/monitor_fields.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/monitor_fields.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/monitor_name_location.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/use_monitor_name.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_config/use_monitor_name.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/actions.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/actions.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/all_monitors.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/delete_monitor.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/delete_monitor.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/enablement_empty_state.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/inline_error.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/inline_error.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/invalid_monitors.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/list_tabs.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/list_tabs.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_async_error.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_async_error.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_enabled.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_enabled.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_list.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_list.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_list_container.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/monitor_locations.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/stderr_logs_popover.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/monitor_list/tags.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/show_sync_errors.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/browser/browser_test_results.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/simple/simple_test_results.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/test_now_mode.test.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/test_now_mode.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/test_result_header.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/test_result_header.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/test_run_results.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/test_now_mode/use_tick_tick.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/validation.test.ts (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/monitor_management/validation.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/__snapshots__/snapshot_heading.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alert_expression_popover.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alert_field_number.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alert_field_number.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alert_query_bar/query_bar.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alert_tls.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alerts_containers/alert_monitor_status.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alerts_containers/alert_tls.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alerts_containers/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/alerts_containers/use_snap_shot.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/anomaly_alert/anomaly_alert.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/anomaly_alert/select_severity.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/anomaly_alert/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/availability_expression_select.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/down_number_select.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/down_number_select.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/filters_expression_select.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/status_expression_select.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/time_expression_select.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_expressions/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/settings_message_expression_popover.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/toggle_alert_flyout_button.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/toggle_alert_flyout_button.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/empty_state/empty_state_error.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/empty_state/empty_state_loading.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/empty_state/use_has_data.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/filter_group/filter_group.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/filter_group/filter_group.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/filter_group/selected_filters.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/filter_group/translations.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/cert_status_column.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/define_connectors.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/define_connectors.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/enable_alert.test.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/enable_alert.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/monitor_name_col.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/monitor_status_column.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/monitor_status_column.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/progress/monitor_progress.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/progress/use_updated_monitor.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/status_badge.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/status_badge.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/test_now_col.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/columns/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/filter_status_button.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/filter_status_button.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list.test.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_container.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/data.json (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_header.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_page_size_select.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/monitor_list_page_size_select.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/no_items_meesage.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/no_items_message.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/overview_page_link.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/parse_timestamp.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/parse_timestamp.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/status_filter.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/status_filter.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/troubleshoot_popover.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/types.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/monitor_list/use_monitor_histogram.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/query_bar/query_bar.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/query_bar/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/query_bar/use_query_bar.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/query_bar/use_query_bar.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot/snapshot.test.tsx (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot/snapshot.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot/snapshot_heading.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot/use_snap_shot.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/snapshot_heading.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/status_panel.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/synthetics_callout.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/overview/synthetics_callout.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/__snapshots__/certificate_form.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/__snapshots__/indices_form.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/add_connector_flyout.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/alert_defaults_form.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/certificate_form.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/certificate_form.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/default_email.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/indices_form.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/indices_form.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/settings_actions.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/settings_bottom_bar.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/types.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/settings/use_settings_errors.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/stderr_logs.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/step_duration.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/step_field_trend.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/step_field_trend.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/step_image.tsx (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/steps_list.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/steps_list.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/use_check_steps.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/use_expanded_row.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/use_expanded_row.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/check_steps/use_std_error_logs.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/code_block_accordion.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/console_event.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/console_event.tsx (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/console_output_event_list.test.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/console_output_event_list.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/empty_journey.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/empty_journey.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/executed_step.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/executed_step.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/status_badge.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/status_badge.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/step_screenshot_display.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/step_screenshot_display.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/components/synthetics/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/contexts/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/contexts/uptime_data_view_context.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/contexts/uptime_refresh_context.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/contexts/uptime_settings_context.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/contexts/uptime_startup_plugins_context.tsx (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/contexts/uptime_theme_context.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/__snapshots__/use_url_params.test.tsx.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/update_kuery_string.ts (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_breadcrumbs.test.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_breadcrumbs.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_breakpoints.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_breakpoints.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_cert_status.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_chart_theme.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_composite_image.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_composite_image.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_filter_update.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_filter_update.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_init_app.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_mapping_check.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_mapping_check.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_monitor.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_overview_filter_check.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_overview_filter_check.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_search_text.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_selected_filters.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_selected_filters.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_telemetry.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_url_params.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/hooks/use_url_params.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/__mocks__/screenshot_ref.mock.ts (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/__mocks__/uptime_plugin_start_mock.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/__mocks__/uptime_store.mock.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/__mocks__/use_composite_image.mock.ts (86%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/__mocks__/ut_router_history.mock.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/adapters/framework/capabilities_adapter.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/alert_messages.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/common.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/duration_anomaly.tsx (86%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/index.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/lazy_wrapper/duration_anomaly.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/lazy_wrapper/monitor_status.tsx (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/lazy_wrapper/tls_alert.tsx (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/lazy_wrapper/validate_monitor_status.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/monitor_status.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/monitor_status.tsx (89%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/tls.tsx (85%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/alert_types/tls_legacy.tsx (88%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/formatting.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/charts/get_chart_date_label.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/charts/get_label_format.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/charts/get_label_format.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/charts/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/charts/is_within_current_date.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/charts/is_within_current_date.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/compose_screenshot_images.test.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/compose_screenshot_images.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/convert_measurements.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/convert_measurements.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/enzyme_helpers.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/get_title.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/helper_with_redux.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/add_base_path.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/build_href.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/get_apm_href.test.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/get_apm_href.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/get_infra_href.test.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/get_infra_href.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/get_logging_href.test.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/get_logging_href.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/observability_integration/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/parse_search.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/parse_search.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/rtl_helpers.tsx (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/series_has_down_values.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/series_has_down_values.ts (85%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/spy_use_fetcher.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/stringify_url_params.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/stringify_url_params.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/test_helpers.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/get_supported_url_params.test.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/get_supported_url_params.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/parse_absolute_date.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/parse_absolute_date.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/parse_is_paused.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/parse_is_paused.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/parse_url_int.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/helper/url_params/parse_url_int.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/lib/index.ts (100%) rename x-pack/plugins/synthetics/public/{badge.ts => legacy_uptime/lib/lib.ts} (83%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/certificates.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/certificates.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/mapping_error.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/action_bar_portal_node.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/add_monitor.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/bottom_bar.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/content.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/edit_monitor.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/monitor_management.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/service_allowed_wrapper.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/service_allowed_wrapper.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/monitor_management/use_monitor_management_breadcrumbs.tsx (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/not_found.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/not_found.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/overview.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/overview.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/settings.test.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/settings.tsx (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/synthetics/checks_navigation.tsx (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/synthetics/step_detail_page.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/synthetics/synthetics_checks.test.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/synthetics/synthetics_checks.tsx (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/pages/translations.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/routes.tsx (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/alerts.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/dynamic_settings.ts (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/index_status.ts (84%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/journey.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/ml_anomaly.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/monitor.ts (89%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/monitor_duration.ts (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/monitor_list.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/monitor_management.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/monitor_status.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/network_events.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/ping.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/selected_filters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/snapshot.ts (88%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/types.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/ui.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/actions/utils.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/alerts/alerts.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/__snapshots__/snapshot.test.ts.snap (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/alert_actions.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/alert_actions.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/alerts.ts (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/dynamic_settings.ts (89%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/index_status.ts (85%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/journey.ts (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/ml_anomaly.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/monitor.ts (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/monitor_duration.ts (91%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/monitor_list.ts (85%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/monitor_management.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/monitor_status.ts (84%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/network_events.ts (89%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/ping.ts (90%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/snapshot.test.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/snapshot.ts (85%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/types.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/api/utils.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/certificates/certificates.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/alerts.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/dynamic_settings.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/fetch_effect.test.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/fetch_effect.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/index_status.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/journey.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/journey.ts (93%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/ml_anomaly.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/monitor.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/monitor_duration.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/monitor_list.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/monitor_management.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/monitor_status.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/network_events.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/ping.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/synthetic_journey_blocks.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/effects/test_now_runs.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/kibana_service.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/dynamic_settings.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/index.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/index_status.ts (92%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/journey.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/ml_anomaly.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/monitor.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/monitor_duration.ts (95%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/monitor_list.ts (97%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/monitor_management.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/monitor_status.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/monitor_status.ts (96%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/network_events.ts (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/ping.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/ping_list.ts (94%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/selected_filters.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/selected_filters.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/synthetics.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/synthetics.ts (99%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/test_now_runs.ts (98%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/types.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/ui.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/ui.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/reducers/utils.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/selectors/index.test.ts (100%) rename x-pack/plugins/synthetics/public/{ => legacy_uptime}/state/selectors/index.ts (100%) rename x-pack/plugins/synthetics/public/{apps => }/plugin.ts (83%) diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index b99a65accd072..4683565b1134c 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -166,5 +166,6 @@ export const applicationUsageSchema = { siem: commonSchema, space_selector: commonSchema, uptime: commonSchema, + synthetics: commonSchema, ux: commonSchema, }; diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 308be959ba67a..59d7ba693156d 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -5891,6 +5891,137 @@ } } }, + "synthetics": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "ux": { "properties": { "appId": { diff --git a/x-pack/plugins/synthetics/common/constants/plugin.ts b/x-pack/plugins/synthetics/common/constants/plugin.ts index 619e68b93109c..c0a6ed02477f5 100644 --- a/x-pack/plugins/synthetics/common/constants/plugin.ts +++ b/x-pack/plugins/synthetics/common/constants/plugin.ts @@ -21,4 +21,7 @@ export const PLUGIN = { TITLE: i18n.translate('xpack.synthetics.uptimeFeatureCatalogueTitle', { defaultMessage: 'Uptime', }), + SYNTHETICS: i18n.translate('xpack.synthetics.syntheticsFeatureCatalogueTitle', { + defaultMessage: 'Synthetics', + }), }; diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/render_app.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/render_app.tsx new file mode 100644 index 0000000000000..c4b05ea7a2e0c --- /dev/null +++ b/x-pack/plugins/synthetics/public/apps/synthetics/render_app.tsx @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { AppMountParameters, CoreStart } from '@kbn/core/public'; +import { ClientPluginsSetup, ClientPluginsStart } from '../../plugin'; +import { SyntheticsApp } from '../synthetics_app'; + +export function renderApp( + core: CoreStart, + plugins: ClientPluginsSetup, + startPlugins: ClientPluginsStart, + appMountParameters: AppMountParameters, + isDev: boolean +) { + ReactDOM.render(, appMountParameters.element); + + return () => { + ReactDOM.unmountComponentAtNode(appMountParameters.element); + }; +} diff --git a/x-pack/plugins/synthetics/public/lib/lib.ts b/x-pack/plugins/synthetics/public/apps/synthetics_app.tsx similarity index 71% rename from x-pack/plugins/synthetics/public/lib/lib.ts rename to x-pack/plugins/synthetics/public/apps/synthetics_app.tsx index 80be43e97b82b..92531041157a7 100644 --- a/x-pack/plugins/synthetics/public/lib/lib.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics_app.tsx @@ -4,7 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import React from 'react'; -import { UMBadge } from '../badge'; - -export type UMUpdateBadge = (badge: UMBadge) => void; +export const SyntheticsApp = () => { + return
Synthetics App
; +}; diff --git a/x-pack/plugins/synthetics/public/icons/heartbeat_white.svg b/x-pack/plugins/synthetics/public/icons/heartbeat_white.svg deleted file mode 100644 index 866206f32f5a1..0000000000000 --- a/x-pack/plugins/synthetics/public/icons/heartbeat_white.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - \ No newline at end of file diff --git a/x-pack/plugins/synthetics/public/index.ts b/x-pack/plugins/synthetics/public/index.ts index 86170e9bc863a..cc0ad290e6f0a 100644 --- a/x-pack/plugins/synthetics/public/index.ts +++ b/x-pack/plugins/synthetics/public/index.ts @@ -6,7 +6,7 @@ */ import { PluginInitializerContext } from '@kbn/core/public'; -import { UptimePlugin } from './apps/plugin'; +import { UptimePlugin } from './plugin'; export const plugin = (initializerContext: PluginInitializerContext) => new UptimePlugin(initializerContext); diff --git a/x-pack/plugins/synthetics/public/apps/__snapshots__/uptime_page_template.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/app/__snapshots__/uptime_page_template.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/apps/__snapshots__/uptime_page_template.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/app/__snapshots__/uptime_page_template.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/apps/render_app.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/app/render_app.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/apps/render_app.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/app/render_app.tsx index 36ac093f23d0a..efb35813201ae 100644 --- a/x-pack/plugins/synthetics/public/apps/render_app.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/render_app.tsx @@ -14,9 +14,9 @@ import { DEFAULT_DARK_MODE, DEFAULT_TIMEPICKER_QUICK_RANGES, INTEGRATED_SOLUTIONS, -} from '../../common/constants'; +} from '../../../common/constants'; import { UptimeApp, UptimeAppProps } from './uptime_app'; -import { ClientPluginsSetup, ClientPluginsStart } from './plugin'; +import { ClientPluginsSetup, ClientPluginsStart } from '../../plugin'; export function renderApp( core: CoreStart, diff --git a/x-pack/plugins/synthetics/public/apps/uptime_app.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_app.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/apps/uptime_app.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_app.tsx index 9887fa81393bc..8d694bfe81aed 100644 --- a/x-pack/plugins/synthetics/public/apps/uptime_app.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_app.tsx @@ -18,7 +18,7 @@ import { } from '@kbn/kibana-react-plugin/public'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { InspectorContextProvider } from '@kbn/observability-plugin/public'; -import { ClientPluginsSetup, ClientPluginsStart } from './plugin'; +import { ClientPluginsSetup, ClientPluginsStart } from '../../plugin'; import { UMUpdateBadge } from '../lib/lib'; import { UptimeRefreshContextProvider, diff --git a/x-pack/plugins/synthetics/public/apps/uptime_overview_fetcher.ts b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_overview_fetcher.ts similarity index 100% rename from x-pack/plugins/synthetics/public/apps/uptime_overview_fetcher.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_overview_fetcher.ts diff --git a/x-pack/plugins/synthetics/public/apps/uptime_page_template.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/apps/uptime_page_template.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx index 26a40074c7530..38105052f352e 100644 --- a/x-pack/plugins/synthetics/public/apps/uptime_page_template.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import 'jest-styled-components'; import { render } from '../lib/helper/rtl_helpers'; import { UptimePageTemplateComponent } from './uptime_page_template'; -import { OVERVIEW_ROUTE } from '../../common/constants'; +import { OVERVIEW_ROUTE } from '../../../common/constants'; import { useBreakpoints } from '../hooks/use_breakpoints'; jest.mock('../hooks/use_breakpoints', () => { diff --git a/x-pack/plugins/synthetics/public/apps/uptime_page_template.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/apps/uptime_page_template.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx index e359916de1d22..08ebd5f06a69b 100644 --- a/x-pack/plugins/synthetics/public/apps/uptime_page_template.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx @@ -10,8 +10,8 @@ import styled from 'styled-components'; import { EuiPageHeaderProps, EuiPageTemplateProps } from '@elastic/eui'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useInspectorContext } from '@kbn/observability-plugin/public'; -import { CERTIFICATES_ROUTE, OVERVIEW_ROUTE } from '../../common/constants'; -import { ClientPluginsStart } from './plugin'; +import { CERTIFICATES_ROUTE, OVERVIEW_ROUTE } from '../../../common/constants'; +import { ClientPluginsStart } from '../../plugin'; import { useNoDataConfig } from './use_no_data_config'; import { EmptyStateLoading } from '../components/overview/empty_state/empty_state_loading'; import { EmptyStateError } from '../components/overview/empty_state/empty_state_error'; diff --git a/x-pack/plugins/synthetics/public/apps/use_no_data_config.ts b/x-pack/plugins/synthetics/public/legacy_uptime/app/use_no_data_config.ts similarity index 97% rename from x-pack/plugins/synthetics/public/apps/use_no_data_config.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/app/use_no_data_config.ts index 8898e42548748..c485c498e6fa7 100644 --- a/x-pack/plugins/synthetics/public/apps/use_no_data_config.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/use_no_data_config.ts @@ -10,7 +10,7 @@ import { useContext } from 'react'; import { useSelector } from 'react-redux'; import { KibanaPageTemplateProps, useKibana } from '@kbn/kibana-react-plugin/public'; import { UptimeSettingsContext } from '../contexts'; -import { ClientPluginsStart } from './plugin'; +import { ClientPluginsStart } from '../../plugin'; import { indexStatusSelector } from '../state/selectors'; export function useNoDataConfig(): KibanaPageTemplateProps['noDataConfig'] { diff --git a/x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_monitors.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/__snapshots__/cert_monitors.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_monitors.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/__snapshots__/cert_monitors.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_search.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/__snapshots__/cert_search.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_search.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/__snapshots__/cert_search.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_status.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/__snapshots__/cert_status.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/__snapshots__/cert_status.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/__snapshots__/cert_status.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_monitors.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_monitors.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/cert_monitors.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_monitors.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_monitors.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_monitors.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/certificates/cert_monitors.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_monitors.tsx index 30b8b572c783f..0688aae060fba 100644 --- a/x-pack/plugins/synthetics/public/components/certificates/cert_monitors.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_monitors.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiToolTip } from '@elastic/eui'; -import { CertMonitor } from '../../../common/runtime_types'; +import { CertMonitor } from '../../../../common/runtime_types'; import { MonitorPageLink } from '../common/monitor_page_link'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_refresh_btn.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_refresh_btn.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/cert_refresh_btn.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_refresh_btn.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_search.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_search.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/cert_search.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_search.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_search.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_search.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/cert_search.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_search.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_status.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_status.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/cert_status.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_status.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/cert_status.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_status.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/certificates/cert_status.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_status.tsx index 7ade37b33d622..ec11fc240d6a1 100644 --- a/x-pack/plugins/synthetics/public/components/certificates/cert_status.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/cert_status.tsx @@ -11,10 +11,10 @@ import styled from 'styled-components'; import { EuiHealth, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { useSelector } from 'react-redux'; -import { Cert } from '../../../common/runtime_types'; +import { Cert } from '../../../../common/runtime_types'; import { useCertStatus } from '../../hooks'; import * as labels from './translations'; -import { CERT_STATUS } from '../../../common/constants'; +import { CERT_STATUS } from '../../../../common/constants'; import { selectDynamicSettings } from '../../state/selectors'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/certificates/certificate_title.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificate_title.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/certificate_title.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificate_title.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/certificates_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificates_list.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/certificates_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificates_list.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/certificates_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificates_list.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/certificates/certificates_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificates_list.tsx index 44d314b52356f..381ee9cd5b792 100644 --- a/x-pack/plugins/synthetics/public/components/certificates/certificates_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/certificates_list.tsx @@ -11,7 +11,7 @@ import { Direction, EuiBasicTable } from '@elastic/eui'; import { CertStatus } from './cert_status'; import { CertMonitors } from './cert_monitors'; import * as labels from './translations'; -import { Cert, CertMonitor, CertResult } from '../../../common/runtime_types'; +import { Cert, CertMonitor, CertResult } from '../../../../common/runtime_types'; import { FingerprintCol } from './fingerprint_col'; import { LOADING_CERTIFICATES, NO_CERTS_AVAILABLE } from './translations'; diff --git a/x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/fingerprint_col.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/fingerprint_col.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/fingerprint_col.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/fingerprint_col.tsx index fa29c0b7d1e43..dac9f239eb104 100644 --- a/x-pack/plugins/synthetics/public/components/certificates/fingerprint_col.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/fingerprint_col.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiButtonEmpty, EuiButtonIcon, EuiCopy, EuiToolTip } from '@elastic/eui'; import styled from 'styled-components'; -import { Cert } from '../../../common/runtime_types'; +import { Cert } from '../../../../common/runtime_types'; import { COPY_FINGERPRINT } from './translations'; const EmptyButton = styled(EuiButtonEmpty)` diff --git a/x-pack/plugins/synthetics/public/components/certificates/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/index.ts diff --git a/x-pack/plugins/synthetics/public/components/certificates/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/certificates/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/certificates/use_cert_search.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/use_cert_search.ts similarity index 91% rename from x-pack/plugins/synthetics/public/components/certificates/use_cert_search.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/use_cert_search.ts index 47facebe4401f..4a13a7fc68d15 100644 --- a/x-pack/plugins/synthetics/public/components/certificates/use_cert_search.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/certificates/use_cert_search.ts @@ -9,7 +9,7 @@ import { useSelector } from 'react-redux'; import { useContext } from 'react'; import { createEsParams, useEsSearch } from '@kbn/observability-plugin/public'; -import { CertResult, GetCertsParams, Ping } from '../../../common/runtime_types'; +import { CertResult, GetCertsParams, Ping } from '../../../../common/runtime_types'; import { selectDynamicSettings } from '../../state/selectors'; import { @@ -20,7 +20,7 @@ import { DEFAULT_TO, getCertsRequestBody, processCertsResult, -} from '../../../common/requests/get_certs_request_body'; +} from '../../../../common/requests/get_certs_request_body'; import { UptimeRefreshContext } from '../../contexts'; export const useCertSearch = ({ diff --git a/x-pack/plugins/synthetics/public/components/common/__snapshots__/location_link.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/__snapshots__/location_link.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/__snapshots__/location_link.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/__snapshots__/location_link.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_page_link.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/__snapshots__/monitor_page_link.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_page_link.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/__snapshots__/monitor_page_link.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_tags.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/__snapshots__/monitor_tags.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/__snapshots__/monitor_tags.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/__snapshots__/monitor_tags.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/alerts/uptime_edit_alert_flyout.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/alerts/uptime_edit_alert_flyout.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/alerts/uptime_edit_alert_flyout.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/alerts/uptime_edit_alert_flyout.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/chart_empty_state.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/chart_wrapper.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart_legend_row.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/monitor_bar_series.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/common/charts/annotation_tooltip.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/annotation_tooltip.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/annotation_tooltip.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/annotation_tooltip.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_empty_state.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_empty_state.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_empty_state.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/chart_empty_state.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_empty_state.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_wrapper.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/chart_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_wrapper/chart_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/chart_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_wrapper/chart_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_wrapper/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/chart_wrapper/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/chart_wrapper/index.ts diff --git a/x-pack/plugins/synthetics/public/components/common/charts/donut_chart.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/donut_chart.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/donut_chart.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/donut_chart.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend_row.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend_row.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend_row.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/donut_chart_legend_row.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/donut_chart_legend_row.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/duration_chart.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_chart.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/common/charts/duration_chart.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_chart.tsx index 2d82fbf1368b8..eb591fd538d98 100644 --- a/x-pack/plugins/synthetics/public/components/common/charts/duration_chart.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_chart.tsx @@ -20,7 +20,7 @@ import { } from '@elastic/charts'; import { useSelector } from 'react-redux'; import { getChartDateLabel } from '../../../lib/helper'; -import { LocationDurationLine } from '../../../../common/types'; +import { LocationDurationLine } from '../../../../../common/types'; import { DurationLineSeriesList } from './duration_line_series_list'; import { ChartWrapper } from './chart_wrapper'; import { useUrlParams } from '../../../hooks'; diff --git a/x-pack/plugins/synthetics/public/components/common/charts/duration_charts.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_charts.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/common/charts/duration_charts.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_charts.test.tsx index fee4143df11f9..fc24e723528c9 100644 --- a/x-pack/plugins/synthetics/public/components/common/charts/duration_charts.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_charts.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import DateMath from '@kbn/datemath'; import { DurationChartComponent } from './duration_chart'; -import { MonitorDurationResult } from '../../../../common/types'; +import { MonitorDurationResult } from '../../../../../common/types'; import { render } from '../../../lib/helper/rtl_helpers'; describe('MonitorCharts component', () => { diff --git a/x-pack/plugins/synthetics/public/components/common/charts/duration_line_bar_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_line_bar_list.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/duration_line_bar_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_line_bar_list.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/duration_line_series_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_line_series_list.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/common/charts/duration_line_series_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_line_series_list.tsx index bc744be163223..3f8c2abb9fc2c 100644 --- a/x-pack/plugins/synthetics/public/components/common/charts/duration_line_series_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/duration_line_series_list.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { LineSeries, CurveType, Fit, ScaleType } from '@elastic/charts'; -import { LocationDurationLine } from '../../../../common/types'; +import { LocationDurationLine } from '../../../../../common/types'; import { microToMilli, microToSec } from '../../../lib/formatting'; import { MS_LABEL, SEC_LABEL } from '../translations'; diff --git a/x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/get_tick_format.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/get_tick_format.test.ts diff --git a/x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/get_tick_format.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/get_tick_format.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/get_tick_format.ts diff --git a/x-pack/plugins/synthetics/public/components/common/charts/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/index.ts diff --git a/x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/monitor_bar_series.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/monitor_bar_series.test.tsx index 792b357b3baba..e8a2afbd8af23 100644 --- a/x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/monitor_bar_series.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { MonitorBarSeries, MonitorBarSeriesProps } from './monitor_bar_series'; import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../lib'; -import { HistogramPoint } from '../../../../common/runtime_types'; +import { HistogramPoint } from '../../../../../common/runtime_types'; describe('MonitorBarSeries component', () => { let props: MonitorBarSeriesProps; diff --git a/x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/monitor_bar_series.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/monitor_bar_series.tsx index 6bb52a025154f..35b2b830d91bd 100644 --- a/x-pack/plugins/synthetics/public/components/common/charts/monitor_bar_series.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/monitor_bar_series.tsx @@ -22,7 +22,7 @@ import React, { useContext } from 'react'; import moment from 'moment'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiText, EuiToolTip } from '@elastic/eui'; -import { HistogramPoint } from '../../../../common/runtime_types'; +import { HistogramPoint } from '../../../../../common/runtime_types'; import { getChartDateLabel, seriesHasDownValues } from '../../../lib/helper'; import { useUrlParams } from '../../../hooks'; import { UptimeThemeContext } from '../../../contexts'; diff --git a/x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/ping_histogram.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/ping_histogram.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/ping_histogram.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/ping_histogram.tsx index 95b5791bced8a..c3f9f5086ec9b 100644 --- a/x-pack/plugins/synthetics/public/components/common/charts/ping_histogram.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/ping_histogram.tsx @@ -28,7 +28,7 @@ import { createExploratoryViewUrl } from '@kbn/observability-plugin/public'; import { getChartDateLabel } from '../../../lib/helper'; import { ChartWrapper } from './chart_wrapper'; import { UptimeThemeContext } from '../../../contexts'; -import { HistogramResult } from '../../../../common/runtime_types'; +import { HistogramResult } from '../../../../../common/runtime_types'; import { useMonitorId, useUrlParams } from '../../../hooks'; import { ChartEmptyState } from './chart_empty_state'; import { getDateRangeFromChartElement } from './utils'; diff --git a/x-pack/plugins/synthetics/public/components/common/charts/utils.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/utils.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/utils.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/utils.test.ts diff --git a/x-pack/plugins/synthetics/public/components/common/charts/utils.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/utils.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/charts/utils.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/utils.ts diff --git a/x-pack/plugins/synthetics/public/components/common/header/action_menu.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/header/action_menu.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/header/action_menu_content.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu_content.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/header/action_menu_content.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu_content.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/header/action_menu_content.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu_content.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/common/header/action_menu_content.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu_content.tsx index 311c76c87a845..1fb150bd9e70e 100644 --- a/x-pack/plugins/synthetics/public/components/common/header/action_menu_content.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/action_menu_content.tsx @@ -16,7 +16,7 @@ import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; import { useGetUrlParams } from '../../../hooks'; import { ToggleAlertFlyoutButton } from '../../overview/alerts/alerts_containers'; -import { MONITOR_ROUTE, SETTINGS_ROUTE } from '../../../../common/constants'; +import { MONITOR_ROUTE, SETTINGS_ROUTE } from '../../../../../common/constants'; import { stringifyUrlParams } from '../../../lib/helper/stringify_url_params'; import { InspectorHeaderLink } from './inspector_header_link'; import { monitorStatusSelector } from '../../../state/selectors'; diff --git a/x-pack/plugins/synthetics/public/components/common/header/inspector_header_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/inspector_header_link.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/common/header/inspector_header_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/inspector_header_link.tsx index aa3e53be500cd..a7c8c3790a50c 100644 --- a/x-pack/plugins/synthetics/public/components/common/header/inspector_header_link.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/inspector_header_link.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { enableInspectEsQueries, useInspectorContext } from '@kbn/observability-plugin/public'; -import { ClientPluginsStart } from '../../../apps/plugin'; +import { ClientPluginsStart } from '../../../../plugin'; import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; export function InspectorHeaderLink() { diff --git a/x-pack/plugins/synthetics/public/components/common/header/manage_monitors_btn.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/manage_monitors_btn.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/common/header/manage_monitors_btn.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/manage_monitors_btn.tsx index 0e7215c0f5a03..2d0ac2654b71f 100644 --- a/x-pack/plugins/synthetics/public/components/common/header/manage_monitors_btn.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/manage_monitors_btn.tsx @@ -13,9 +13,9 @@ import { useHistory } from 'react-router-dom'; import useLocalStorage from 'react-use/lib/useLocalStorage'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { MONITOR_MANAGEMENT_ROUTE } from '../../../../common/constants'; +import { MONITOR_MANAGEMENT_ROUTE } from '../../../../../common/constants'; import { PUBLIC_BETA_DESCRIPTION } from '../../../pages/monitor_management/service_allowed_wrapper'; -import { ClientPluginsSetup } from '../../../apps/plugin'; +import { ClientPluginsSetup } from '../../../../plugin'; import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; export const ManageMonitorsBtn = () => { diff --git a/x-pack/plugins/synthetics/public/components/common/header/page_tabs.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/page_tabs.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/header/page_tabs.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/page_tabs.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/header/page_tabs.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/page_tabs.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/common/header/page_tabs.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/page_tabs.tsx index 1210dbb0f2290..9711a9d7acb9e 100644 --- a/x-pack/plugins/synthetics/public/components/common/header/page_tabs.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/header/page_tabs.tsx @@ -10,7 +10,7 @@ import React, { useEffect, useState } from 'react'; import { EuiTabs, EuiTab } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useHistory, useRouteMatch } from 'react-router-dom'; -import { CERTIFICATES_ROUTE, OVERVIEW_ROUTE } from '../../../../common/constants'; +import { CERTIFICATES_ROUTE, OVERVIEW_ROUTE } from '../../../../../common/constants'; import { useGetUrlParams } from '../../../hooks'; import { stringifyUrlParams } from '../../../lib/helper/stringify_url_params'; diff --git a/x-pack/plugins/synthetics/public/components/common/higher_order/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/higher_order/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/higher_order/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/higher_order/index.ts diff --git a/x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/higher_order/responsive_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/higher_order/responsive_wrapper.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/higher_order/responsive_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/higher_order/responsive_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/higher_order/responsive_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/location_link.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/location_link.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/location_link.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/location_link.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/location_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/location_link.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/location_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/location_link.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/monitor_page_link.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_page_link.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/monitor_page_link.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_page_link.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/monitor_page_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_page_link.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/monitor_page_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_page_link.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/monitor_tags.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_tags.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/monitor_tags.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_tags.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/monitor_tags.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_tags.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/common/monitor_tags.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_tags.tsx index e8e8a61e7b303..14e185e3e9318 100644 --- a/x-pack/plugins/synthetics/public/components/common/monitor_tags.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/monitor_tags.tsx @@ -10,13 +10,13 @@ import { EuiBadge, EuiBadgeGroup, EuiLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useHistory } from 'react-router-dom'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { Ping } from '../../../common/runtime_types/ping'; -import { MonitorSummary } from '../../../common/runtime_types/monitor'; +import { Ping } from '../../../../common/runtime_types/ping'; +import { MonitorSummary } from '../../../../common/runtime_types/monitor'; import { useFilterUpdate } from '../../hooks/use_filter_update'; import { useGetUrlParams } from '../../hooks'; import { parseCurrentFilters } from '../overview/monitor_list/columns/monitor_name_col'; import { EXPAND_TAGS_LABEL } from '../overview/monitor_list/columns/translations'; -import { OVERVIEW_ROUTE } from '../../../common/constants'; +import { OVERVIEW_ROUTE } from '../../../../common/constants'; interface Props { ping?: Ping | null; diff --git a/x-pack/plugins/synthetics/public/components/common/react_router_helpers/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/react_router_helpers/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/index.ts diff --git a/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_events.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_events.test.ts diff --git a/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_events.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_events.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_events.ts diff --git a/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_for_eui.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_for_eui.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_for_eui.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/react_router_helpers/link_for_eui.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/react_router_helpers/link_for_eui.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/step_detail_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/step_detail_link.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/step_detail_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/step_detail_link.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/common/uptime_date_picker.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/uptime_date_picker.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/common/uptime_date_picker.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/uptime_date_picker.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/common/uptime_date_picker.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/uptime_date_picker.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/common/uptime_date_picker.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/common/uptime_date_picker.tsx index f509f9b53114b..ff01b9cb352ee 100644 --- a/x-pack/plugins/synthetics/public/components/common/uptime_date_picker.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/uptime_date_picker.tsx @@ -8,7 +8,7 @@ import React, { useContext, useEffect } from 'react'; import { EuiSuperDatePicker } from '@elastic/eui'; import { useUrlParams } from '../../hooks'; -import { CLIENT_DEFAULTS } from '../../../common/constants'; +import { CLIENT_DEFAULTS } from '../../../../common/constants'; import { UptimeRefreshContext, UptimeSettingsContext, diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/advanced_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/advanced_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.test.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/script_recorder_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/script_recorder_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/script_recorder_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/script_recorder_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/script_recorder_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/simple_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/simple_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/simple_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/simple_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/source_field.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/source_field.test.tsx index ae5db0662dd85..97001df29a69e 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/source_field.test.tsx @@ -8,7 +8,7 @@ import 'jest-canvas-mock'; import React from 'react'; import { fireEvent, screen, waitFor } from '@testing-library/react'; -import { ConfigKey } from '../../../../common/runtime_types'; +import { ConfigKey } from '../../../../../common/runtime_types'; import { render } from '../../../lib/helper/rtl_helpers'; import { IPolicyConfigContextProvider } from '../contexts/policy_config_context'; import { SourceField, defaultValues } from './source_field'; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/source_field.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/source_field.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/source_field.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/throttling_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/throttling_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/throttling_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/throttling_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/throttling_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/uploader.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/uploader.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/uploader.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/uploader.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/zip_url_tls_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/zip_url_tls_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/zip_url_tls_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/browser/zip_url_tls_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/zip_url_tls_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/code_editor.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/code_editor.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/code_editor.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/code_editor.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/combo_box.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/combo_box.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/combo_box.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/combo_box.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/combo_box.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/combo_box.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/combo_box.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/combo_box.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/common_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/common_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/common_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/common_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/described_form_group_with_wrap.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/described_form_group_with_wrap.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/described_form_group_with_wrap.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/described_form_group_with_wrap.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/enabled.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/enabled.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/enabled.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/enabled.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/formatters.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/formatters.test.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.test.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts similarity index 98% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts index 3cb312488868c..0119b415faed8 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/common/normalizers.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts @@ -11,7 +11,7 @@ import { DEFAULT_COMMON_FIELDS, DEFAULT_NAMESPACE_STRING, DEFAULT_FIELDS, -} from '../../../../common/constants/monitor_defaults'; +} from '../../../../../common/constants/monitor_defaults'; // TO DO: create a standard input format that all fields resolve to export type Normalizer = (fields: NewPackagePolicyInput['vars']) => unknown; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/simple_fields_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/simple_fields_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/simple_fields_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/simple_fields_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/common/tls_options.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/tls_options.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/common/tls_options.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/tls_options.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_context.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_context.tsx index aecd9091c3276..e89e4dcd1d5bd 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_context.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { BrowserSimpleFields } from '../types'; -import { DEFAULT_BROWSER_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_BROWSER_SIMPLE_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface BrowserSimpleFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_context_advanced.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_context_advanced.tsx index 114491d890394..d81e1dc631ee2 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_context_advanced.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_context_advanced.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { BrowserAdvancedFields } from '../types'; -import { DEFAULT_BROWSER_ADVANCED_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_BROWSER_ADVANCED_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface BrowserAdvancedFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_provider.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_provider.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/browser_provider.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/browser_provider.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_context.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_context.tsx index 092c938b63f7e..d45dfc01f0de6 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_context.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { HTTPSimpleFields } from '../types'; -import { DEFAULT_HTTP_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_HTTP_SIMPLE_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface HTTPSimpleFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_context_advanced.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_context_advanced.tsx index 19355d38b9486..549f314bc3d3a 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_context_advanced.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_context_advanced.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { HTTPAdvancedFields } from '../types'; -import { DEFAULT_HTTP_ADVANCED_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_HTTP_ADVANCED_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface HTTPAdvancedFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_provider.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_provider.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/http_provider.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/http_provider.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/icmp_context.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/icmp_context.tsx index 39409e4ed76a5..4e7667650ff10 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/icmp_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/icmp_context.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { ICMPSimpleFields } from '../types'; -import { DEFAULT_ICMP_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_ICMP_SIMPLE_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface ICMPSimpleFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/index.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx index a9d5df172d83c..49f83d9577661 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/policy_config_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/policy_config_context.tsx @@ -6,13 +6,13 @@ */ import React, { createContext, useContext, useMemo, useState } from 'react'; -import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_NAMESPACE_STRING } from '../../../../../common/constants/monitor_defaults'; import { ScheduleUnit, MonitorServiceLocations, ThrottlingOptions, DEFAULT_THROTTLING, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; import { DataStream } from '../types'; interface IPolicyConfigContext { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/synthetics_context_providers.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/synthetics_context_providers.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/synthetics_context_providers.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/synthetics_context_providers.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_context.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_context.tsx index ca6788f380118..9b3e1052100e9 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_context.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { TCPSimpleFields } from '../types'; -import { DEFAULT_TCP_SIMPLE_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_TCP_SIMPLE_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface TCPSimpleFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_context_advanced.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_context_advanced.tsx index 0a26cb83d9aa0..8d1174ed96bc6 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_context_advanced.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_context_advanced.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { TCPAdvancedFields } from '../types'; -import { DEFAULT_TCP_ADVANCED_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_TCP_ADVANCED_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface TCPAdvancedFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_provider.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_provider.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/tcp_provider.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tcp_provider.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tls_fields_context.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tls_fields_context.tsx index 7ed41694000b9..14ec64bf640b7 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/contexts/tls_fields_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/contexts/tls_fields_context.tsx @@ -7,7 +7,7 @@ import React, { createContext, useContext, useMemo, useState } from 'react'; import { TLSFields } from '../types'; -import { DEFAULT_TLS_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_TLS_FIELDS } from '../../../../../common/constants/monitor_defaults'; interface TLSFieldsContext { setFields: React.Dispatch>; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/custom_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/custom_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/custom_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/custom_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/custom_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/header_field.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/header_field.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/header_field.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/header_field.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/header_field.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/header_field.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/header_field.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/header_field.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/helpers/context_helpers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/helpers/context_helpers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/helpers/context_helpers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/helpers/context_helpers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/helpers/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/helpers/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/helpers/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/helpers/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/helpers/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/helpers/normalizers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/helpers/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/helpers/normalizers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_policy.ts similarity index 97% rename from x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_policy.ts index 8cef83a925515..9f43cbb238a79 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_policy.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_policy.ts @@ -26,7 +26,7 @@ import { useBrowserSimpleFieldsContext, useBrowserAdvancedFieldsContext, } from '../contexts'; -import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { DEFAULT_FIELDS } from '../../../../../common/constants/monitor_defaults'; export const defaultConfig: PolicyConfig = DEFAULT_FIELDS; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/hooks/use_update_policy.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/hooks/use_update_policy.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/advanced_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/http/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/advanced_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/http/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/http/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/http/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/normalizers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/http/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/normalizers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/http/simple_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/simple_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/http/simple_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/simple_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/advanced_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/icmp/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/advanced_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/icmp/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/icmp/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/icmp/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/normalizers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/icmp/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/normalizers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/icmp/simple_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/simple_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/icmp/simple_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/icmp/simple_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/index.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/index.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/index.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/index.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/index_response_body_field.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/index_response_body_field.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/index_response_body_field.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/index_response_body_field.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/index_response_body_field.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/key_value_field.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/key_value_field.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/key_value_field.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/key_value_field.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/key_value_field.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/lazy_synthetics_custom_assets_extension.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/lazy_synthetics_policy_create_extension.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/lazy_synthetics_policy_create_extension.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/optional_label.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/optional_label.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/optional_label.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/optional_label.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/request_body_field.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/request_body_field.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/request_body_field.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/request_body_field.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/request_body_field.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/schedule_field.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/schedule_field.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/schedule_field.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/schedule_field.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/schedule_field.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_custom_assets_extension.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_custom_assets_extension.tsx similarity index 90% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_custom_assets_extension.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_custom_assets_extension.tsx index c21acee549986..64d1be74e71fd 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_custom_assets_extension.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_custom_assets_extension.tsx @@ -14,8 +14,8 @@ import { CustomAssetsAccordion, } from '@kbn/fleet-plugin/public'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { ClientPluginsStart } from '../../apps/plugin'; -import { PLUGIN } from '../../../common/constants/plugin'; +import { ClientPluginsStart } from '../../../plugin'; +import { PLUGIN } from '../../../../common/constants/plugin'; export const SyntheticsCustomAssetsExtension: PackageAssetsComponent = () => { const { http } = useKibana().services; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension.tsx index ae035550a979d..6247619f6a3b6 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension.tsx @@ -11,7 +11,7 @@ import { useTrackPageview } from '@kbn/observability-plugin/public'; import { DataStream } from './types'; import { PolicyConfig } from './types'; import { usePolicyConfigContext } from './contexts'; -import { DEFAULT_FIELDS } from '../../../common/constants/monitor_defaults'; +import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; import { CustomFields } from './custom_fields'; import { useUpdatePolicy } from './hooks/use_update_policy'; import { usePolicy } from './hooks/use_policy'; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/advanced_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/advanced_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/advanced_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tcp/advanced_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/advanced_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tcp/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tcp/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tcp/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/normalizers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tcp/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/normalizers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tcp/simple_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/simple_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tcp/simple_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/simple_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tls/formatters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls/formatters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tls/formatters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls/formatters.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tls/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls/normalizers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tls/normalizers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls/normalizers.ts diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls_fields.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls_fields.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls_fields.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/tls_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tls_fields.tsx diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/types.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/types.tsx similarity index 85% rename from x-pack/plugins/synthetics/public/components/fleet_package/types.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/types.tsx index d3df3a1926887..0a5de311c5cb3 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/types.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/types.tsx @@ -16,9 +16,9 @@ import { ThrottlingConfigKey, ThrottlingSuffix, ThrottlingSuffixType, -} from '../../../common/runtime_types'; -export * from '../../../common/runtime_types/monitor_management'; -export * from '../../../common/types/monitor_validation'; +} from '../../../../common/runtime_types'; +export * from '../../../../common/runtime_types/monitor_management'; +export * from '../../../../common/types/monitor_validation'; export interface PolicyConfig { [DataStream.HTTP]: HTTPFields; diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/validation.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/validation.test.ts similarity index 98% rename from x-pack/plugins/synthetics/public/components/fleet_package/validation.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/validation.test.ts index 3495b163b9845..b2cca04b44d1b 100644 --- a/x-pack/plugins/synthetics/public/components/fleet_package/validation.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/validation.test.ts @@ -12,7 +12,7 @@ import { BrowserFields, MonitorFields, ScheduleUnit, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { validate } from './validation'; describe('[Monitor Management] validation', () => { diff --git a/x-pack/plugins/synthetics/public/components/fleet_package/validation.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/validation.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/fleet_package/validation.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/validation.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/__snapshots__/monitor_charts.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/__snapshots__/monitor_charts.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/__snapshots__/monitor_charts.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/__snapshots__/monitor_charts.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/__snapshots__/confirm_delete.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/__snapshots__/ml_integerations.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/confirm_alert_delete.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/confirm_alert_delete.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/confirm_alert_delete.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/confirm_alert_delete.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/confirm_delete.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/confirm_delete.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/confirm_delete.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/confirm_delete.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/confirm_delete.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/license_info.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/license_info.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/license_info.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/license_info.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/license_info.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/license_info.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/license_info.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/license_info.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/manage_ml_job.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/manage_ml_job.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ml/manage_ml_job.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/manage_ml_job.tsx index 435eb7e4f9001..f6b8198a24699 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ml/manage_ml_job.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/manage_ml_job.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useContext, useState } from 'react'; import { EuiButton, EuiContextMenu, EuiIcon, EuiPopover } from '@elastic/eui'; import { useSelector, useDispatch } from 'react-redux'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; +import { CLIENT_ALERT_TYPES } from '../../../../../common/constants/alerts'; import { canDeleteMLJobSelector, hasMLJobSelector, diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout.test.tsx index 8669bc180f42f..6a0bda2c5fb04 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { MLFlyoutView } from './ml_flyout'; import { UptimeSettingsContext } from '../../../contexts'; -import { CLIENT_DEFAULTS } from '../../../../common/constants'; +import { CLIENT_DEFAULTS } from '../../../../../common/constants'; import * as redux from 'react-redux'; import { render, forNearestButton } from '../../../lib/helper/rtl_helpers'; import * as labels from './translations'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout_container.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout_container.tsx index 482e3f70b3180..49eaef7b176ac 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_flyout_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_flyout_container.tsx @@ -31,7 +31,7 @@ import { useGetUrlParams } from '../../../hooks'; import { getDynamicSettings } from '../../../state/actions/dynamic_settings'; import { useMonitorId } from '../../../hooks'; import { kibanaService } from '../../../state/kibana_service'; -import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; +import { CLIENT_ALERT_TYPES } from '../../../../../common/constants/alerts'; interface Props { onClose: () => void; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_integeration.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_integeration.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_integeration.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_integeration.tsx index 6396f99e4d62c..675554906694b 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_integeration.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_integeration.tsx @@ -22,7 +22,7 @@ import { UptimeRefreshContext } from '../../../contexts'; import * as labels from './translations'; import { ManageMLJobComponent } from './manage_ml_job'; import { useMonitorId } from '../../../hooks'; -import { getMLJobId } from '../../../../common/lib'; +import { getMLJobId } from '../../../../../common/lib'; export const MLIntegrationComponent = () => { const [isMlFlyoutOpen, setIsMlFlyoutOpen] = useState(false); diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_integerations.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_integerations.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_integerations.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_integerations.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_job_link.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_job_link.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_job_link.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_job_link.tsx index e14f37f617aac..2e9d771e11150 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_job_link.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_job_link.tsx @@ -9,7 +9,7 @@ import React from 'react'; import url from 'url'; import { EuiButtonEmpty } from '@elastic/eui'; import rison, { RisonValue } from 'rison-node'; -import { getMLJobId } from '../../../../common/lib'; +import { getMLJobId } from '../../../../../common/lib'; interface Props { monitorId: string; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/ml_manage_job.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_manage_job.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/ml_manage_job.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/ml_manage_job.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/translations.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/translations.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/translations.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/translations.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ml/use_anomaly_alert.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/use_anomaly_alert.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ml/use_anomaly_alert.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ml/use_anomaly_alert.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_charts.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_charts.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_charts.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_charts.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_charts.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_charts.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_charts.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_charts.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_duration/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/monitor_duration.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/monitor_duration.tsx index 6d8615226f79b..822a476f5225a 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/monitor_duration.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; -import { LocationDurationLine } from '../../../../common/types'; +import { LocationDurationLine } from '../../../../../common/types'; import { MLIntegrationComponent } from '../ml/ml_integeration'; import { AnomalyRecords } from '../../../state/actions'; import { DurationChartComponent } from '../../common/charts'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/monitor_duration_container.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/monitor_duration_container.tsx index 8b88c8d59a47c..63f95fd966544 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/monitor_duration/monitor_duration_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_duration/monitor_duration_container.tsx @@ -23,8 +23,8 @@ import { } from '../../../state/selectors'; import { UptimeRefreshContext } from '../../../contexts'; import { MonitorDurationComponent } from './monitor_duration'; -import { MonitorIdParam } from '../../../../common/types'; -import { getMLJobId } from '../../../../common/lib'; +import { MonitorIdParam } from '../../../../../common/types'; +import { getMLJobId } from '../../../../../common/lib'; import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; export const MonitorDuration: React.FC = ({ monitorId }) => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_title.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_title.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_title.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_title.test.tsx index 726ad235f7f49..f9e3572ead511 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/monitor_title.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_title.test.tsx @@ -10,7 +10,7 @@ import moment from 'moment'; import { screen } from '@testing-library/react'; import { render } from '../../lib/helper/rtl_helpers'; import * as reactRouterDom from 'react-router-dom'; -import { Ping } from '../../../common/runtime_types'; +import { Ping } from '../../../../common/runtime_types'; import { MonitorPageTitle, MonitorPageTitleContent } from './monitor_title'; jest.mock('react-router-dom', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/monitor_title.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_title.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/monitor_title.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_title.tsx index 0d77179cd99ee..ce343ac1f6bd7 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/monitor_title.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/monitor_title.tsx @@ -12,7 +12,7 @@ import { useSelector } from 'react-redux'; import { useMonitorId } from '../../hooks'; import { monitorStatusSelector } from '../../state/selectors'; import { EnableMonitorAlert } from '../overview/monitor_list/columns/enable_alert'; -import { Ping } from '../../../common/runtime_types/ping'; +import { Ping } from '../../../../common/runtime_types/ping'; import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; const isAutogeneratedId = (id: string) => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_histogram/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_histogram/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_histogram/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_histogram/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_histogram/ping_histogram_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_histogram/ping_histogram_container.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_histogram/ping_histogram_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_histogram/ping_histogram_container.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/__snapshots__/expanded_row.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/__snapshots__/ping_headers.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/expand_row.test.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/expand_row.test.tsx index e3ac1f2e17125..06b43744a2ac2 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/expand_row.test.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { screen } from '@testing-library/react'; -import { makePing } from '../../../../../common/runtime_types'; +import { makePing } from '../../../../../../common/runtime_types'; import { render } from '../../../../lib/helper/rtl_helpers'; import { ExpandRowColumn } from './expand_row'; -import { Ping } from '../../../../../common/runtime_types/ping'; +import { Ping } from '../../../../../../common/runtime_types/ping'; describe('ExpandRowColumn', () => { const defaultPing = makePing({ diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/expand_row.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/expand_row.tsx index 1c18668741292..3e5104357463f 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/expand_row.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/expand_row.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonIcon } from '@elastic/eui'; -import { Ping } from '../../../../../common/runtime_types/ping'; +import { Ping } from '../../../../../../common/runtime_types/ping'; import { PingListExpandedRowComponent } from '../expanded_row'; export const toggleDetails = ( diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/failed_step.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/failed_step.tsx similarity index 88% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/failed_step.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/failed_step.tsx index 38f51a2bafebb..da3b93bd0e09d 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/failed_step.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/failed_step.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { FailedStepsApiResponse } from '../../../../../common/runtime_types/ping/synthetics'; +import { FailedStepsApiResponse } from '../../../../../../common/runtime_types/ping/synthetics'; interface Props { checkGroup?: string; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_error.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_error.tsx similarity index 91% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_error.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_error.tsx index db7dc46fc9043..beb29b4201438 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_error.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_error.tsx @@ -7,7 +7,7 @@ import React from 'react'; import styled from 'styled-components'; -import { Ping } from '../../../../../common/runtime_types/ping'; +import { Ping } from '../../../../../../common/runtime_types/ping'; const StyledSpan = styled.span` display: -webkit-box; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_status.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_status.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_status.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_status.tsx index 6c33018126983..6d46803da22fd 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_status.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_status.tsx @@ -9,8 +9,8 @@ import React, { useContext } from 'react'; import { i18n } from '@kbn/i18n'; import moment from 'moment'; import { EuiBadge, EuiSpacer, EuiText } from '@elastic/eui'; -import { Ping } from '../../../../../common/runtime_types/ping'; -import { MONITOR_TYPES, STATUS } from '../../../../../common/constants'; +import { Ping } from '../../../../../../common/runtime_types/ping'; +import { MONITOR_TYPES, STATUS } from '../../../../../../common/constants'; import { UptimeThemeContext } from '../../../../contexts'; import { STATUS_COMPLETE_LABEL, diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_available.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_available.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_display.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/no_image_display.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx index 4083df8c98a1a..3bc443426d523 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx @@ -16,7 +16,7 @@ import { isScreenshotRef, ScreenshotImageBlob, ScreenshotRefImageData, -} from '../../../../../../common/runtime_types'; +} from '../../../../../../../common/runtime_types'; import { getJourneyScreenshot } from '../../../../../state/api/journey'; import { UptimeSettingsContext } from '../../../../../contexts'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx index eb0d8c30ae53d..1003b51319136 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx @@ -9,7 +9,7 @@ import React, { MouseEvent, useEffect } from 'react'; import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiText, useEuiTheme } from '@elastic/eui'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; -import { ScreenshotRefImageData } from '../../../../../../common/runtime_types'; +import { ScreenshotRefImageData } from '../../../../../../../common/runtime_types'; import { useBreakpoints } from '../../../../../hooks'; import { nextAriaLabel, prevAriaLabel } from './translations'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx index 73c43da98bfc4..1d97e3e4e248a 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx @@ -8,7 +8,7 @@ import { EuiImage, EuiLoadingSpinner, EuiPopover } from '@elastic/eui'; import React from 'react'; import styled from 'styled-components'; -import { ScreenshotRefImageData } from '../../../../../../common/runtime_types/ping/synthetics'; +import { ScreenshotRefImageData } from '../../../../../../../common/runtime_types/ping/synthetics'; import { fullSizeImageAlt } from './translations'; import { useCompositeImage } from '../../../../../hooks/use_composite_image'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/ping_timestamp/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/response_code.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/response_code.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/columns/response_code.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/columns/response_code.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/doc_link_body.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/doc_link_body.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/doc_link_body.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/doc_link_body.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/doc_link_body.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/expanded_row.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/expanded_row.test.tsx index f87501a79e964..d65536bf75c4a 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/expanded_row.test.tsx @@ -8,7 +8,7 @@ import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import React from 'react'; import { PingListExpandedRowComponent } from './expanded_row'; -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; import { DocLinkForBody } from './doc_link_body'; describe('PingListExpandedRow', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/expanded_row.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/expanded_row.tsx index 3e14136ac3533..0d27d7cbb92b9 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/expanded_row.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/expanded_row.tsx @@ -18,7 +18,7 @@ import { } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Ping, HttpResponseBody } from '../../../../common/runtime_types'; +import { Ping, HttpResponseBody } from '../../../../../common/runtime_types'; import { DocLinkForBody } from './doc_link_body'; import { PingRedirects } from './ping_redirects'; import { PingHeaders } from './headers'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/headers.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/headers.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/headers.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/headers.tsx index edc8119dd59d3..bff0e91f2cd05 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/headers.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/headers.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiAccordion, EuiDescriptionList, EuiSpacer, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { PingHeaders as HeadersProp } from '../../../../common/runtime_types'; +import { PingHeaders as HeadersProp } from '../../../../../common/runtime_types'; interface Props { headers: HeadersProp; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/index.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/index.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/index.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/index.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/location_name.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/location_name.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/location_name.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/location_name.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_headers.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_headers.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_headers.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_headers.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list.test.tsx index bfcf359ac0525..ddb33e4dd5fea 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { formatDuration, PingList } from './ping_list'; -import { Ping, PingsResponse } from '../../../../common/runtime_types'; +import { Ping, PingsResponse } from '../../../../../common/runtime_types'; import { ExpandedRowMap } from '../../overview/monitor_list/types'; import { rowShouldExpand, toggleDetails } from './columns/expand_row'; import * as pingListHook from './use_pings'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_header.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list_header.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_header.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list_header.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_table.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list_table.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_table.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list_table.tsx index da464b7e1a083..1dbda32925161 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_list_table.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_list_table.tsx @@ -12,11 +12,11 @@ import moment from 'moment'; import { useHistory } from 'react-router-dom'; import { useDispatch } from 'react-redux'; import * as I18LABELS from './translations'; -import { FailedStepsApiResponse, Ping } from '../../../../common/runtime_types'; +import { FailedStepsApiResponse, Ping } from '../../../../../common/runtime_types'; import { PingStatusColumn } from './columns/ping_status'; import { ERROR_LABEL, LOCATION_LABEL, RES_CODE_LABEL, TIMESTAMP_LABEL } from './translations'; import { LocationName } from './location_name'; -import { MONITOR_TYPES } from '../../../../common/constants'; +import { MONITOR_TYPES } from '../../../../../common/constants'; import { PingTimestamp } from './columns/ping_timestamp'; import { getShortTimeStamp } from '../../overview/monitor_list/columns/monitor_status_column'; import { PingErrorCol } from './columns/ping_error'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_redirects.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_redirects.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_redirects.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_redirects.tsx index 37e5961305a60..365a52e8f54fe 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/ping_redirects.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/ping_redirects.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; import { EuiListGroup, EuiListGroupItemProps, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui'; -import { Ping } from '../../../../common/runtime_types/ping'; +import { Ping } from '../../../../../common/runtime_types/ping'; const ListGroup = styled(EuiListGroup)` &&& { diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/response_code.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/response_code.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/response_code.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/response_code.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/ping_list/use_pings.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/use_pings.ts similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor/ping_list/use_pings.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/use_pings.ts index 94669b4aeb8e8..6306e8357018c 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/ping_list/use_pings.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/ping_list/use_pings.ts @@ -9,13 +9,13 @@ import { useDispatch, useSelector } from 'react-redux'; import { useCallback, useContext, useEffect } from 'react'; import { useFetcher } from '@kbn/observability-plugin/public'; import { selectPingList } from '../../../state/selectors'; -import { GetPingsParams, Ping } from '../../../../common/runtime_types/ping'; +import { GetPingsParams, Ping } from '../../../../../common/runtime_types/ping'; import { getPings as getPingsAction } from '../../../state/actions'; import { useGetUrlParams, useMonitorId } from '../../../hooks'; import { UptimeRefreshContext, UptimeSettingsContext } from '../../../contexts'; import { fetchJourneysFailedSteps } from '../../../state/api/journey'; import { useSelectedFilters } from '../../../hooks/use_selected_filters'; -import { MONITOR_TYPES } from '../../../../common/constants'; +import { MONITOR_TYPES } from '../../../../../common/constants'; interface Props { pageSize: number; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/__snapshots__/monitor_status.bar.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/__snapshots__/ssl_certificate.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/__snapshots__/status_by_location.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/__snapshots__/tag_label.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/availability_reporting.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/availability_reporting.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/availability_reporting.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/availability_reporting.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx index e43df25779ab9..48862695b2089 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/location_status_tags.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { MonitorLocation } from '../../../../../common/runtime_types/monitor'; +import { MonitorLocation } from '../../../../../../common/runtime_types/monitor'; import { LocationStatusTags } from '.'; import { mockMoment } from '../../../../lib/helper/test_helpers'; import { render } from '../../../../lib/helper/rtl_helpers'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/location_status_tags.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/location_status_tags.tsx index 53be56d16b9fe..b50b84235dad7 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/location_status_tags.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/location_status_tags.tsx @@ -9,8 +9,8 @@ import React, { useContext } from 'react'; import moment from 'moment'; import styled from 'styled-components'; import { UptimeThemeContext } from '../../../../contexts'; -import { MonitorLocation } from '../../../../../common/runtime_types'; -import { SHORT_TIMESPAN_LOCALE, SHORT_TS_LOCALE } from '../../../../../common/constants'; +import { MonitorLocation } from '../../../../../../common/runtime_types'; +import { SHORT_TIMESPAN_LOCALE, SHORT_TS_LOCALE } from '../../../../../../common/constants'; import { AvailabilityReporting } from '..'; import { getShortTimeStamp } from '../../../overview/monitor_list/columns/monitor_status_column'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/tag_label.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/tag_label.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/tag_label.tsx similarity index 92% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/tag_label.tsx index 6bf73b9609e58..8b920848cdc53 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/availability_reporting/tag_label.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/availability_reporting/tag_label.tsx @@ -9,7 +9,7 @@ import React from 'react'; import styled from 'styled-components'; import { EuiBadge } from '@elastic/eui'; import { StatusTag } from './location_status_tags'; -import { STATUS } from '../../../../../common/constants'; +import { STATUS } from '../../../../../../common/constants'; const BadgeItem = styled.div` white-space: nowrap; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/location_availability/location_availability.test.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/location_availability/location_availability.test.tsx index 855b8ef0c9767..a09e3530d5081 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/location_availability/location_availability.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { screen } from '@testing-library/react'; import { render } from '../../../../lib/helper/rtl_helpers'; import { LocationAvailability } from './location_availability'; -import { MonitorLocations } from '../../../../../common/runtime_types'; +import { MonitorLocations } from '../../../../../../common/runtime_types'; // Note For shallow test, we need absolute time strings describe('LocationAvailability component', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/location_availability/location_availability.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/location_availability/location_availability.tsx index c851369d63e9e..f7634c77eb017 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/location_availability/location_availability.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/location_availability/location_availability.tsx @@ -9,7 +9,7 @@ import React from 'react'; import styled from 'styled-components'; import { EuiFlexGroup, EuiFlexItem, EuiErrorBoundary, EuiTitle } from '@elastic/eui'; import { LocationStatusTags } from '../availability_reporting'; -import { MonitorLocations } from '../../../../../common/runtime_types'; +import { MonitorLocations } from '../../../../../../common/runtime_types'; import { MonitoringFrom } from '../translations'; const EuiFlexItemTags = styled(EuiFlexItem)` diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/monitor_status.bar.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/monitor_status.bar.test.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/monitor_status.bar.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/monitor_status.bar.test.tsx index af3c47b9caf30..640d207fbb138 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/monitor_status.bar.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/monitor_status.bar.test.tsx @@ -8,7 +8,7 @@ import moment from 'moment'; import React from 'react'; import { MonitorStatusBar } from './status_bar'; -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; import * as redux from 'react-redux'; import { renderWithRouter } from '../../../lib'; import { createMemoryHistory } from 'history'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/ssl_certificate.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/ssl_certificate.test.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/ssl_certificate.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/ssl_certificate.test.tsx index 03ce292e63621..3951ced34c0f9 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/ssl_certificate.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/ssl_certificate.test.tsx @@ -8,11 +8,11 @@ import React from 'react'; import moment from 'moment'; import { EuiIcon } from '@elastic/eui'; -import { Tls } from '../../../../common/runtime_types'; +import { Tls } from '../../../../../common/runtime_types'; import { MonitorSSLCertificate } from './status_bar'; import * as redux from 'react-redux'; import { mountWithRouter, renderWithRouter, shallowWithRouter } from '../../../lib'; -import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../common/constants'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../common/constants'; describe('SSL Certificate component', () => { let monitorTls: Tls; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/monitor_redirects.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/monitor_redirects.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/monitor_redirects.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/monitor_redirects.tsx index f59f01e6aef33..2f1dba51bb933 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/monitor_redirects.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/monitor_redirects.tsx @@ -9,7 +9,7 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiPopover } from '@elastic/eui'; import styled from 'styled-components'; -import { Ping } from '../../../../../common/runtime_types'; +import { Ping } from '../../../../../../common/runtime_types'; import { PingRedirects } from '../../ping_list/ping_redirects'; import { MonListDescription, MonListTitle } from './status_bar'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/ssl_certificate.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/ssl_certificate.tsx similarity index 91% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/ssl_certificate.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/ssl_certificate.tsx index 13be917075aca..5d421cbd4a448 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/ssl_certificate.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/ssl_certificate.tsx @@ -9,8 +9,8 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { Tls, X509Expiry } from '../../../../../common/runtime_types'; -import { CERTIFICATES_ROUTE } from '../../../../../common/constants'; +import { Tls, X509Expiry } from '../../../../../../common/runtime_types'; +import { CERTIFICATES_ROUTE } from '../../../../../../common/constants'; import { MonListDescription, MonListTitle } from './status_bar'; import { CertStatusColumn } from '../../../overview/monitor_list/columns/cert_status_column'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.test.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx index 9746a6c676ab5..7ca855bc0a697 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_bar.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_bar.tsx @@ -22,7 +22,7 @@ import { StatusByLocations } from './status_by_location'; import { useStatusBar } from './use_status_bar'; import { MonitorIDLabel, OverallAvailability } from '../translations'; import { TAGS_LABEL, URL_LABEL } from '../../../common/translations'; -import { MonitorLocations } from '../../../../../common/runtime_types/monitor'; +import { MonitorLocations } from '../../../../../../common/runtime_types/monitor'; import { formatAvailabilityValue } from '../availability_reporting/availability_reporting'; import { MonitorRedirects } from './monitor_redirects'; import { MonitorTags } from '../../../common/monitor_tags'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_by_location.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_by_location.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_by_location.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_by_location.tsx index 60cd231a401c0..3296e784d621a 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/status_by_location.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/status_by_location.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiTitle } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { MonitorLocation } from '../../../../../common/runtime_types'; +import { MonitorLocation } from '../../../../../../common/runtime_types'; interface StatusByLocationsProps { locations: MonitorLocation[]; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/use_status_bar.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/use_status_bar.ts similarity index 90% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/use_status_bar.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/use_status_bar.ts index 058227d1db1eb..57de00af67081 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_bar/use_status_bar.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_bar/use_status_bar.ts @@ -12,8 +12,8 @@ import { useGetUrlParams, useMonitorId } from '../../../../hooks'; import { monitorLocationsSelector, monitorStatusSelector } from '../../../../state/selectors'; import { AppState } from '../../../../state'; import { getMonitorStatusAction } from '../../../../state/actions'; -import { Ping } from '../../../../../common/runtime_types/ping'; -import { MonitorLocations } from '../../../../../common/runtime_types/monitor'; +import { Ping } from '../../../../../../common/runtime_types/ping'; +import { MonitorLocations } from '../../../../../../common/runtime_types/monitor'; interface MonitorStatusBarProps { monitorId: string; diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_by_location.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_by_location.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_by_location.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_by_location.test.tsx index 9b58b0deb8ecc..0b3b08cba8343 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_by_location.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_by_location.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { renderWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; -import { MonitorLocation } from '../../../../common/runtime_types'; +import { MonitorLocation } from '../../../../../common/runtime_types'; import { StatusByLocations } from '.'; describe('StatusByLocation component', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_details.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_details.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_details.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_details.tsx index 5b20e83f0ec85..0c9c347fc8c80 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_details.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_details.tsx @@ -10,7 +10,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import styled from 'styled-components'; import { LocationAvailability } from './location_availability/location_availability'; import { UptimeRefreshContext } from '../../../contexts'; -import { MonitorLocations } from '../../../../common/runtime_types'; +import { MonitorLocations } from '../../../../../common/runtime_types'; import { MonitorStatusBar } from './status_bar'; interface MonitorStatusDetailsProps { diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_details_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_details_container.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/status_details_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_details_container.tsx index 1fb138da9e84b..7affbde63ba02 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/status_details/status_details_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/status_details_container.tsx @@ -13,7 +13,7 @@ import { getMonitorLocationsAction } from '../../../state/actions/monitor'; import { MonitorStatusDetailsComponent } from '.'; import { UptimeRefreshContext } from '../../../contexts'; import { AppState } from '../../../state'; -import { MonitorIdParam } from '../../../../common/types'; +import { MonitorIdParam } from '../../../../../common/types'; export const MonitorStatusDetails: React.FC = ({ monitorId }) => { const { lastRefresh } = useContext(UptimeRefreshContext); diff --git a/x-pack/plugins/synthetics/public/components/monitor/status_details/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/status_details/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/status_details/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_detail_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/step_detail_container.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_detail_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/step_detail_container.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_nav.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/step_page_nav.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_nav.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/step_page_nav.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_title.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/step_page_title.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/step_page_title.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/step_page_title.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx index 0d7b5894799c7..013516bb754bf 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_monitor_breadcrumb.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useBreadcrumbs } from '../../../../hooks/use_breadcrumbs'; import { JourneyState } from '../../../../state/reducers/journey'; -import { PLUGIN } from '../../../../../common/constants/plugin'; +import { PLUGIN } from '../../../../../../common/constants/plugin'; import { getShortTimeStamp } from '../../../overview/monitor_list/columns/monitor_status_column'; interface ActiveStep { diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx index a46fad2733bb2..2ae975803b524 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_monitor_breadcrumbs.test.tsx @@ -11,8 +11,8 @@ import { Route } from 'react-router-dom'; import { of } from 'rxjs'; import { render } from '../../../../lib/helper/rtl_helpers'; import { useMonitorBreadcrumb } from './use_monitor_breadcrumb'; -import { OVERVIEW_ROUTE } from '../../../../../common/constants'; -import { Ping } from '../../../../../common/runtime_types/ping'; +import { OVERVIEW_ROUTE } from '../../../../../../common/constants'; +import { Ping } from '../../../../../../common/runtime_types/ping'; import { JourneyState } from '../../../../state/reducers/journey'; import { chromeServiceMock, uiSettingsServiceMock } from '@kbn/core/public/mocks'; diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/data_formatting.test.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts similarity index 99% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts index fa3db4d01fe9b..7323668dc3d52 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/data_formatting.ts @@ -23,7 +23,7 @@ import { LegendItems, } from './types'; import { WaterfallData, WaterfallMetadata } from '../../waterfall'; -import { NetworkEvent } from '../../../../../../common/runtime_types'; +import { NetworkEvent } from '../../../../../../../common/runtime_types'; export const extractItems = (data: NetworkEvent[]): NetworkItems => { // NOTE: This happens client side as the "payload" property is mapped diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/types.ts similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/types.ts index 19ae847ee3adb..c396bec47e0e6 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/types.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/types.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { NetworkEvent } from '../../../../../../common/runtime_types'; +import { NetworkEvent } from '../../../../../../../common/runtime_types'; export enum Timings { Blocked = 'blocked', diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx index b31af8e31d33a..95c42d505fbf2 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_container.tsx @@ -15,7 +15,7 @@ import { networkEventsSelector } from '../../../../../state/selectors'; import { WaterfallChartWrapper } from './waterfall_chart_wrapper'; import { extractItems } from './data_formatting'; import { useStepWaterfallMetrics } from '../use_step_waterfall_metrics'; -import { JourneyStep } from '../../../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../../../common/runtime_types'; export const NO_DATA_TEXT = i18n.translate( 'xpack.synthetics.synthetics.stepDetail.waterfallNoData', diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx index 4b50f86e6ee3b..0849832107aeb 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.tsx @@ -15,7 +15,7 @@ import { WaterfallFilter } from './waterfall_filter'; import { WaterfallFlyout } from './waterfall_flyout'; import { WaterfallSidebarItem } from './waterfall_sidebar_item'; import { MarkerItems } from '../../waterfall/context/waterfall_chart'; -import { JourneyStep } from '../../../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../../../common/runtime_types'; export const renderLegendItem: RenderItem = (item) => { return ( diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_filter.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_flyout.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/README.md b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/README.md similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/README.md rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/README.md diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/constants.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/constants.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/constants.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/constants.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/legend.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/legend.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/legend.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/legend.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/middle_truncated_text.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/network_requests_total.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/network_requests_total.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/network_requests_total.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/network_requests_total.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/sidebar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/sidebar.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/sidebar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/sidebar.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/styles.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/styles.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/styles.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/styles.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_bar_charts.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_bar_charts.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_bar_charts.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_bar_charts.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_flyout.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_flyout.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/use_flyout.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/use_flyout.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_chart.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_chart_fixed_axis.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_flyout_table.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_icon.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx index 696e6d4fa022f..691a74361d074 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_test_helper.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { UptimeStartupPluginsContext } from '../../../../../contexts'; import { WaterfallContext } from '../context/waterfall_chart'; -import { JourneyStep } from '../../../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../../../common/runtime_types'; const EmbeddableMock = ({ title, diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx index b797cf1f3b63e..aeca7940ef773 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { render } from '../../../../../lib/helper/rtl_helpers'; import { WaterfallMarkerTrend } from './waterfall_marker_trend'; import moment from 'moment'; -import { JourneyStep } from '../../../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../../../common/runtime_types'; import { TestWrapper } from './waterfall_marker_test_helper'; describe('', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_marker_trend.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_tooltip_content.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx index d495b7432bce7..fd38fbbfb6bb6 100644 --- a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/context/waterfall_chart.tsx @@ -9,7 +9,7 @@ import React, { createContext, useContext, Context } from 'react'; import { WaterfallData, WaterfallDataEntry, WaterfallMetadata } from '../types'; import { OnSidebarClick, OnElementClick, OnProjectionClick } from '../components/use_flyout'; import { SidebarItems } from '../../step_detail/waterfall/types'; -import { JourneyStep } from '../../../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../../../common/runtime_types'; export type MarkerItems = Array<{ id: diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/index.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/index.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/index.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/index.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/types.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor/synthetics/waterfall/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor/synthetics/waterfall/types.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar.test.tsx index 64b7984b00b40..e903f4d23424b 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar.test.tsx @@ -15,7 +15,7 @@ import { HTTPFields, ScheduleUnit, SyntheticsMonitor, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; import { ActionBar } from './action_bar'; describe('', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar.tsx index a3eec01438876..3bd6be5eb9750 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar.tsx @@ -21,11 +21,11 @@ import { useSelector } from 'react-redux'; import { FETCH_STATUS, useFetcher } from '@kbn/observability-plugin/public'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; -import { MONITOR_MANAGEMENT_ROUTE } from '../../../../common/constants'; +import { MONITOR_MANAGEMENT_ROUTE } from '../../../../../common/constants'; import { UptimeSettingsContext } from '../../../contexts'; import { setMonitor } from '../../../state/api'; -import { SyntheticsMonitor } from '../../../../common/runtime_types'; +import { SyntheticsMonitor } from '../../../../../common/runtime_types'; import { TestRun } from '../test_now_mode/test_now_mode'; import { monitorManagementListSelector } from '../../../state/selectors'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_errors.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar_errors.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_errors.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar_errors.test.tsx index b92357f3ecc14..bb40077dab78d 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_errors.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar_errors.test.tsx @@ -15,7 +15,7 @@ import { HTTPFields, ScheduleUnit, SyntheticsMonitor, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; import { spyOnUseFetcher } from '../../../lib/helper/spy_use_fetcher'; import * as kibana from '../../../state/kibana_service'; import { ActionBar } from './action_bar'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_portal.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar_portal.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/action_bar/action_bar_portal.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/action_bar/action_bar_portal.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/add_monitor_btn.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/add_monitor_btn.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/monitor_management/add_monitor_btn.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/add_monitor_btn.tsx index 3532659f04af2..90bec2d28f988 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/add_monitor_btn.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/add_monitor_btn.tsx @@ -11,7 +11,7 @@ import { EuiButton, EuiFlexItem, EuiFlexGroup, EuiToolTip, EuiSwitch } from '@el import { useHistory } from 'react-router-dom'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { kibanaService } from '../../state/kibana_service'; -import { MONITOR_ADD_ROUTE } from '../../../common/constants'; +import { MONITOR_ADD_ROUTE } from '../../../../common/constants'; import { useEnablement } from './hooks/use_enablement'; import { useSyntheticsServiceAllowed } from './hooks/use_service_allowed'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/content/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/content/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/content/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/content/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/edit_monitor_config.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/edit_monitor_config.tsx index 6c8056c246071..245f058c48d94 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/edit_monitor_config.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/edit_monitor_config.tsx @@ -14,11 +14,11 @@ import { DataStream, ScheduleUnit, ThrottlingOptions, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { SyntheticsProviders } from '../fleet_package/contexts'; import { PolicyConfig } from '../fleet_package/types'; import { MonitorConfig } from './monitor_config/monitor_config'; -import { DEFAULT_NAMESPACE_STRING } from '../../../common/constants/monitor_defaults'; +import { DEFAULT_NAMESPACE_STRING } from '../../../../common/constants/monitor_defaults'; interface Props { monitor: MonitorFields; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_enablement.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_enablement.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_enablement.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_enablement.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_format_monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_format_monitor.ts similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_format_monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_format_monitor.ts index 49d467d7b8799..5d600a10daf39 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_format_monitor.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_format_monitor.ts @@ -6,8 +6,8 @@ */ import { useEffect, useRef, useState } from 'react'; -import { ConfigKey, DataStream, MonitorFields } from '../../../../common/runtime_types'; -import { Validation } from '../../../../common/types'; +import { ConfigKey, DataStream, MonitorFields } from '../../../../../common/runtime_types'; +import { Validation } from '../../../../../common/types'; interface Props { monitorType: DataStream; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors.test.tsx index fe20dc3ea6c9d..ebc9b55556d40 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors.test.tsx @@ -8,7 +8,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { MockRedux } from '../../../lib/helper/rtl_helpers'; import { useInlineErrors } from './use_inline_errors'; -import { DEFAULT_THROTTLING } from '../../../../common/runtime_types'; +import { DEFAULT_THROTTLING } from '../../../../../common/runtime_types'; import * as obsvPlugin from '@kbn/observability-plugin/public/hooks/use_es_search'; function mockNow(date: string | number | Date) { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors.ts similarity index 92% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors.ts index adc07853a93cd..9970622ca416b 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors.ts @@ -10,11 +10,11 @@ import moment from 'moment'; import { useMemo } from 'react'; import { useEsSearch } from '@kbn/observability-plugin/public'; import { monitorManagementListSelector } from '../../../state/selectors'; -import { Ping } from '../../../../common/runtime_types'; -import { EXCLUDE_RUN_ONCE_FILTER } from '../../../../common/constants/client_defaults'; +import { Ping } from '../../../../../common/runtime_types'; +import { EXCLUDE_RUN_ONCE_FILTER } from '../../../../../common/constants/client_defaults'; import { useUptimeRefreshContext } from '../../../contexts/uptime_refresh_context'; import { useInlineErrorsCount } from './use_inline_errors_count'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../../common/constants'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants'; const sortFieldMap: Record = { ['name.keyword']: 'monitor.name', diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors_count.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors_count.test.tsx index 7ad0d58488e99..b1dbb41880e65 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors_count.test.tsx @@ -9,7 +9,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { MockRedux } from '../../../lib/helper/rtl_helpers'; import { useInlineErrorsCount } from './use_inline_errors_count'; import * as obsvPlugin from '@kbn/observability-plugin/public/hooks/use_es_search'; -import { DEFAULT_THROTTLING } from '../../../../common/runtime_types'; +import { DEFAULT_THROTTLING } from '../../../../../common/runtime_types'; function mockNow(date: string | number | Date) { const fakeNow = new Date(date).getTime(); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors_count.ts similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors_count.ts index 64b37d371cac5..dc69346e6c9a5 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_inline_errors_count.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_inline_errors_count.ts @@ -11,7 +11,7 @@ import { useEsSearch } from '@kbn/observability-plugin/public'; import { monitorManagementListSelector } from '../../../state/selectors'; import { useUptimeRefreshContext } from '../../../contexts/uptime_refresh_context'; import { getInlineErrorFilters } from './use_inline_errors'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../../common/constants'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants'; export function useInlineErrorsCount() { const monitorList = useSelector(monitorManagementListSelector); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_invalid_monitors.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_invalid_monitors.tsx similarity index 90% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_invalid_monitors.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_invalid_monitors.tsx index cf63e7c4cd9e6..38e45e9a839d3 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_invalid_monitors.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_invalid_monitors.tsx @@ -8,8 +8,8 @@ import moment from 'moment'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useFetcher } from '@kbn/observability-plugin/public'; -import { Ping, SyntheticsMonitor } from '../../../../common/runtime_types'; -import { syntheticsMonitorType } from '../../../../common/types/saved_objects'; +import { Ping, SyntheticsMonitor } from '../../../../../common/runtime_types'; +import { syntheticsMonitorType } from '../../../../../common/types/saved_objects'; export const useInvalidMonitors = (errorSummaries?: Ping[]) => { const { savedObjects } = useKibana().services; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_locations.test.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_locations.test.tsx index 46b8981b74a0f..020dea1209dff 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_locations.test.tsx @@ -14,7 +14,7 @@ import { useLocations } from './use_locations'; import * as reactRedux from 'react-redux'; import { getServiceLocations } from '../../../state/actions'; -import { DEFAULT_THROTTLING } from '../../../../common/runtime_types'; +import { DEFAULT_THROTTLING } from '../../../../../common/runtime_types'; describe('useExpViewTimeRange', function () { const dispatch = jest.fn(); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_locations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_locations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/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/legacy_uptime/components/monitor_management/hooks/use_run_once_errors.ts similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_run_once_errors.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_run_once_errors.ts index 204096f7e0181..916ca8c00b972 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_run_once_errors.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_run_once_errors.ts @@ -7,7 +7,7 @@ import { useEffect, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { Locations, ServiceLocationErrors } from '../../../../common/runtime_types'; +import { Locations, ServiceLocationErrors } from '../../../../../common/runtime_types'; export function useRunOnceErrors({ testRunId, diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_service_allowed.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_service_allowed.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/hooks/use_service_allowed.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_service_allowed.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/loader/loader.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/loader/loader.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/loader/loader.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/loader/loader.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/loader/loader.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/mocks/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/mocks/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/mocks/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/mocks/index.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/mocks/locations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/mocks/locations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/mocks/locations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/mocks/locations.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/locations.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/locations.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/locations.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/locations.tsx index fff6e11890f11..029503196b6a3 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/locations.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/locations.tsx @@ -10,7 +10,7 @@ import { useSelector } from 'react-redux'; import { i18n } from '@kbn/i18n'; import { EuiCheckboxGroup, EuiFormRow } from '@elastic/eui'; import { monitorManagementListSelector } from '../../../state/selectors'; -import { MonitorServiceLocations } from '../../../../common/runtime_types'; +import { MonitorServiceLocations } from '../../../../../common/runtime_types'; interface Props { selectedLocations: MonitorServiceLocations; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_advanced_fields.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_advanced_fields.tsx index 086efe36ff113..c4b57f66c227d 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_advanced_fields.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_advanced_fields.tsx @@ -8,8 +8,8 @@ import { EuiFieldText, EuiFormRow, EuiLink, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import React, { memo } from 'react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { ConfigKey } from '../../../../common/runtime_types'; -import type { Validation } from '../../../../common/types'; +import { ConfigKey } from '../../../../../common/runtime_types'; +import type { Validation } from '../../../../../common/types'; import { DescribedFormGroupWithWrap } from '../../fleet_package/common/described_form_group_with_wrap'; import { usePolicyConfigContext } from '../../fleet_package/contexts'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_config.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_config.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_config.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_config.tsx index f151d31e3fd98..3e85c932bf700 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_config.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_config.tsx @@ -25,8 +25,8 @@ import { ActionBarPortal } from '../action_bar/action_bar_portal'; import { useFormatMonitor } from '../hooks/use_format_monitor'; import { MonitorFields } from './monitor_fields'; import { TestNowMode, TestRun } from '../test_now_mode/test_now_mode'; -import { MonitorFields as MonitorFieldsType } from '../../../../common/runtime_types'; -import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; +import { MonitorFields as MonitorFieldsType } from '../../../../../common/runtime_types'; +import { DEFAULT_FIELDS } from '../../../../../common/constants/monitor_defaults'; export const MonitorConfig = ({ isEdit = false }: { isEdit: boolean }) => { const { monitorType } = usePolicyConfigContext(); diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_fields.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_fields.test.tsx index 7320410ae52eb..b4e97ba724393 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_fields.test.tsx @@ -9,7 +9,7 @@ import { fireEvent } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; -import { ConfigKey, DataStream, HTTPFields } from '../../../../common/runtime_types'; +import { ConfigKey, DataStream, HTTPFields } from '../../../../../common/runtime_types'; import { render } from '../../../lib/helper/rtl_helpers'; import { BrowserContextProvider, diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_fields.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_fields.tsx index 655bb5cecac85..eb109dd5d1063 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_fields.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_fields.tsx @@ -7,7 +7,7 @@ import React, { useMemo, useState } from 'react'; import { EuiForm } from '@elastic/eui'; -import { ConfigKey, DataStream } from '../../../../common/runtime_types'; +import { ConfigKey, DataStream } from '../../../../../common/runtime_types'; import { usePolicyConfigContext } from '../../fleet_package/contexts'; import { CustomFields } from '../../fleet_package/custom_fields'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_name_location.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_name_location.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_name_location.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_name_location.tsx index e49a9b3e04833..0f7206f65992f 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/monitor_name_location.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/monitor_name_location.tsx @@ -9,8 +9,8 @@ import React, { useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiFormRow, EuiFieldText } from '@elastic/eui'; -import { ConfigKey } from '../../../../common/runtime_types'; -import { Validation } from '../../../../common/types'; +import { ConfigKey } from '../../../../../common/runtime_types'; +import { Validation } from '../../../../../common/types'; import { usePolicyConfigContext } from '../../fleet_package/contexts'; import { ServiceLocations } from './locations'; import { useMonitorName } from './use_monitor_name'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/use_monitor_name.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/use_monitor_name.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/use_monitor_name.ts similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/use_monitor_name.ts index 200a9599b405e..c72c266bb6939 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_config/use_monitor_name.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_config/use_monitor_name.ts @@ -8,7 +8,7 @@ import { useEffect, useState } from 'react'; import { useFetcher } from '@kbn/observability-plugin/public'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { syntheticsMonitorType } from '../../../../common/types/saved_objects'; +import { syntheticsMonitorType } from '../../../../../common/types/saved_objects'; import { useMonitorId } from '../../../hooks'; interface AggsResponse { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/actions.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/actions.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/actions.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/actions.tsx index c290e58dc6225..a6fa489be89ca 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/actions.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/actions.tsx @@ -12,7 +12,7 @@ import moment from 'moment'; import { UptimeSettingsContext } from '../../../contexts'; import { DeleteMonitor } from './delete_monitor'; import { InlineError } from './inline_error'; -import { MonitorManagementListResult, Ping } from '../../../../common/runtime_types'; +import { MonitorManagementListResult, Ping } from '../../../../../common/runtime_types'; interface Props { id: string; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/all_monitors.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/all_monitors.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/all_monitors.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/all_monitors.tsx index 550d3b487a4ae..ac6fab66bbb1e 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/all_monitors.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/all_monitors.tsx @@ -10,7 +10,7 @@ import { useSelector } from 'react-redux'; import { MonitorManagementList, MonitorManagementListPageState } from './monitor_list'; import { monitorManagementListSelector } from '../../../state/selectors'; import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management'; -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; interface Props { pageState: MonitorManagementListPageState; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/delete_monitor.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/delete_monitor.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/delete_monitor.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/delete_monitor.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/delete_monitor.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/enablement_empty_state.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/enablement_empty_state.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/enablement_empty_state.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/enablement_empty_state.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/inline_error.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/inline_error.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/inline_error.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/inline_error.tsx index d9f47802e6c28..7ba74def660c9 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/inline_error.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/inline_error.tsx @@ -8,7 +8,7 @@ import React, { useState } from 'react'; import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; import { StdErrorPopover } from './stderr_logs_popover'; export const InlineError = ({ errorSummary }: { errorSummary: Ping }) => { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/invalid_monitors.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/invalid_monitors.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/invalid_monitors.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/invalid_monitors.tsx index 342b9c6547b1b..5dea7b7ee06fd 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/invalid_monitors.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/invalid_monitors.tsx @@ -13,7 +13,7 @@ import { MonitorManagementListResult, Ping, DEFAULT_THROTTLING, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; interface Props { loading: boolean; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/list_tabs.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/list_tabs.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/list_tabs.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/list_tabs.tsx index 15012751af3e5..e2da72effa560 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/list_tabs.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/list_tabs.tsx @@ -18,7 +18,7 @@ import React, { useState, Fragment, useEffect } from 'react'; import { useHistory, useParams } from 'react-router-dom'; import { useUptimeRefreshContext } from '../../../contexts/uptime_refresh_context'; import { MonitorManagementListPageState } from './monitor_list'; -import { ConfigKey } from '../../../../common/runtime_types'; +import { ConfigKey } from '../../../../../common/runtime_types'; export const MonitorListTabs = ({ invalidTotal, diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_async_error.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_async_error.test.tsx index da89876cc9b0b..2592aabf9eb09 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_async_error.test.tsx @@ -7,7 +7,7 @@ import { screen } from '@testing-library/react'; import React from 'react'; -import { DEFAULT_THROTTLING } from '../../../../common/runtime_types'; +import { DEFAULT_THROTTLING } from '../../../../../common/runtime_types'; import { render } from '../../../lib/helper/rtl_helpers'; import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management'; import { MonitorAsyncError } from './monitor_async_error'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_async_error.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_async_error.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_async_error.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_enabled.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_enabled.test.tsx index d7e04f0e6140f..9d30d985f09d9 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_enabled.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { ConfigKey, DataStream, SyntheticsMonitor } from '../../../../common/runtime_types'; +import { ConfigKey, DataStream, SyntheticsMonitor } from '../../../../../common/runtime_types'; import { render } from '../../../lib/helper/rtl_helpers'; import { FETCH_STATUS } from '@kbn/observability-plugin/public'; import { spyOnUseFetcher } from '../../../lib/helper/spy_use_fetcher'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_enabled.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_enabled.tsx index 6bbad58767b20..4b00f96077548 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_enabled.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_enabled.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect, useState } from 'react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { FETCH_STATUS, useFetcher } from '@kbn/observability-plugin/public'; -import { ConfigKey, EncryptedSyntheticsMonitor } from '../../../../common/runtime_types'; +import { ConfigKey, EncryptedSyntheticsMonitor } from '../../../../../common/runtime_types'; import { setMonitor } from '../../../state/api'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.test.tsx index a641f7a76f3a7..5c13b34366d59 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.test.tsx @@ -14,7 +14,7 @@ import { HTTPFields, ScheduleUnit, DEFAULT_THROTTLING, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; import { render } from '../../../lib/helper/rtl_helpers'; import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management'; import { MonitorManagementList, MonitorManagementListPageState } from './monitor_list'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx index 6dade5a1e4186..37a23bdcff83b 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx @@ -25,7 +25,7 @@ import { ServiceLocations, EncryptedSyntheticsMonitorWithId, TCPSimpleFields, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; import { UptimeSettingsContext } from '../../../contexts'; import { useBreakpoints } from '../../../hooks'; import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx index 92b61cf1d744d..7191cd71b0a36 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_list_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx @@ -9,7 +9,7 @@ import React, { useEffect, useReducer, useCallback, Reducer } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; import { useTrackPageview } from '@kbn/observability-plugin/public'; -import { ConfigKey } from '../../../../common/runtime_types'; +import { ConfigKey } from '../../../../../common/runtime_types'; import { getMonitors } from '../../../state/actions'; import { monitorManagementListSelector } from '../../../state/selectors'; import { MonitorManagementListPageState } from './monitor_list'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_locations.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_locations.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_locations.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_locations.tsx index 940e6260d864c..5f9ad96bca464 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/monitor_locations.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_locations.tsx @@ -7,7 +7,7 @@ import React, { useState } from 'react'; import { EuiBadge, EuiBadgeGroup } from '@elastic/eui'; -import { ServiceLocations, ServiceLocation } from '../../../../common/runtime_types'; +import { ServiceLocations, ServiceLocation } from '../../../../../common/runtime_types'; import { EXPAND_LOCATIONS_LABEL } from '../../overview/monitor_list/columns/translations'; import { useLocations } from '../hooks/use_locations'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/stderr_logs_popover.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/stderr_logs_popover.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/stderr_logs_popover.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/stderr_logs_popover.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/tags.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/tags.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/monitor_list/tags.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/tags.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/show_sync_errors.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/show_sync_errors.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/show_sync_errors.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/show_sync_errors.tsx index 0ce1fdd0d768e..0fde06c764c08 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/show_sync_errors.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/show_sync_errors.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { toMountPoint } from '@kbn/kibana-react-plugin/public'; import { kibanaService } from '../../state/kibana_service'; -import { ServiceLocationErrors, ServiceLocations } from '../../../common/runtime_types'; +import { ServiceLocationErrors, ServiceLocations } from '../../../../common/runtime_types'; export const showSyncErrors = (errors: ServiceLocationErrors, locations: ServiceLocations) => { Object.values(errors).forEach((location) => { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/browser/browser_test_results.test.tsx 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/legacy_uptime/components/monitor_management/test_now_mode/browser/browser_test_results.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/browser_test_results.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/browser/browser_test_results.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.test.tsx 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/legacy_uptime/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts index 68f96b5d7b487..034fad5b9a8d0 100644 --- 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/legacy_uptime/components/monitor_management/test_now_mode/browser/use_browser_run_once_monitors.ts @@ -6,11 +6,11 @@ */ import { useEffect, useState, useRef } from 'react'; import { createEsParams, useEsSearch, useFetcher } from '@kbn/observability-plugin/public'; -import { JourneyStep } from '../../../../../common/runtime_types'; +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'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../../../../common/constants'; export interface CheckGroupResult { checkGroupId: string; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx index 6ef4daf9fbdf3..c0bab63b1c11d 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/simple_test_results.test.tsx @@ -11,7 +11,7 @@ import { render } from '../../../../lib/helper/rtl_helpers'; import { SimpleTestResults } from './simple_test_results'; import { kibanaService } from '../../../../state/kibana_service'; import * as runOnceHooks from './use_simple_run_once_monitors'; -import { Ping } from '../../../../../common/runtime_types'; +import { Ping } from '../../../../../../common/runtime_types'; describe('SimpleTestResults', function () { const onDone = jest.fn(); 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/legacy_uptime/components/monitor_management/test_now_mode/simple/simple_test_results.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/simple_test_results.tsx index b1ac899a8951e..580c936272b59 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/simple_test_results.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/simple_test_results.tsx @@ -6,7 +6,7 @@ */ import React, { useEffect, useState } from 'react'; import { useSimpleRunOnceMonitors } from './use_simple_run_once_monitors'; -import { Ping } from '../../../../../common/runtime_types'; +import { Ping } from '../../../../../../common/runtime_types'; import { PingListTable } from '../../../monitor/ping_list/ping_list_table'; import { TestResultHeader } from '../test_result_header'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts similarity index 94% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts index 3ca3691aef22c..f0282aaad47a2 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/simple/use_simple_run_once_monitors.ts @@ -7,9 +7,9 @@ import { useMemo, useRef } from 'react'; import { createEsParams, useEsSearch } from '@kbn/observability-plugin/public'; -import { Ping } from '../../../../../common/runtime_types'; +import { Ping } from '../../../../../../common/runtime_types'; import { useTickTick } from '../use_tick_tick'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../../../common/constants'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../../../../common/constants'; export const useSimpleRunOnceMonitors = ({ configId, diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_now_mode.test.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_now_mode.test.tsx index da06b41d16530..b040f7a27da33 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_now_mode.test.tsx @@ -10,7 +10,7 @@ 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 { Locations, MonitorFields } from '../../../../common/runtime_types'; +import { Locations, MonitorFields } from '../../../../../common/runtime_types'; import * as runOnceErrorHooks from '../hooks/use_run_once_errors'; describe('TestNowMode', function () { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_now_mode.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_now_mode.tsx index e89298c9aa46b..25a2f7d02a5fe 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_now_mode.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_now_mode.tsx @@ -18,7 +18,11 @@ import { import { useFetcher } from '@kbn/observability-plugin/public'; import { useRunOnceErrors } from '../hooks/use_run_once_errors'; import { TestRunResult } from './test_run_results'; -import { Locations, MonitorFields, ServiceLocationErrors } from '../../../../common/runtime_types'; +import { + Locations, + MonitorFields, + ServiceLocationErrors, +} from '../../../../../common/runtime_types'; import { runOnceMonitor } from '../../../state/api'; import { kibanaService } from '../../../state/kibana_service'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_result_header.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_result_header.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_result_header.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_result_header.tsx index 62c1971d87ed1..4cd4df567882d 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_result_header.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_result_header.tsx @@ -17,7 +17,7 @@ import { import { i18n } from '@kbn/i18n'; import * as React from 'react'; import { formatDuration } from '../../monitor/ping_list/ping_list'; -import { JourneyStep, Ping } from '../../../../common/runtime_types'; +import { JourneyStep, Ping } from '../../../../../common/runtime_types'; import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_run_results.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_run_results.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_run_results.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_run_results.tsx index b1a6d0aba8cfc..6e9ef292ad6b2 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/test_run_results.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/test_run_results.tsx @@ -6,7 +6,7 @@ */ import * as React from 'react'; -import { SyntheticsMonitor } from '../../../../common/runtime_types'; +import { SyntheticsMonitor } from '../../../../../common/runtime_types'; import { BrowserTestRunResult } from './browser/browser_test_results'; import { SimpleTestResults } from './simple/simple_test_results'; diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/use_tick_tick.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/use_tick_tick.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/monitor_management/test_now_mode/use_tick_tick.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/test_now_mode/use_tick_tick.ts diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/validation.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/validation.test.ts similarity index 99% rename from x-pack/plugins/synthetics/public/components/monitor_management/validation.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/validation.test.ts index 6fa57eb5cd964..ce7c08a45dbaf 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/validation.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/validation.test.ts @@ -13,7 +13,7 @@ import { MonitorFields, ScheduleUnit, ServiceLocations, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { validate, validateCommon } from './validation'; describe('[Monitor Management] validation', () => { diff --git a/x-pack/plugins/synthetics/public/components/monitor_management/validation.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/validation.ts similarity index 98% rename from x-pack/plugins/synthetics/public/components/monitor_management/validation.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/validation.ts index 78b0b8ba82b68..0975d00b38098 100644 --- a/x-pack/plugins/synthetics/public/components/monitor_management/validation.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/validation.ts @@ -11,8 +11,8 @@ import { ScheduleUnit, MonitorFields, isServiceLocationInvalid, -} from '../../../common/runtime_types'; -import { Validation } from '../../../common/types'; +} from '../../../../common/runtime_types'; +import { Validation } from '../../../../common/types'; export const digitsOnly = /^[0-9]*$/g; export const includesValidPort = /[^\:]+:[0-9]{1,5}$/g; diff --git a/x-pack/plugins/synthetics/public/components/overview/__snapshots__/snapshot_heading.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/__snapshots__/snapshot_heading.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/__snapshots__/snapshot_heading.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/__snapshots__/snapshot_heading.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alert_expression_popover.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_expression_popover.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alert_expression_popover.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_expression_popover.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_field_number.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_field_number.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_field_number.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alert_field_number.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_field_number.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alert_query_bar/query_bar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_query_bar/query_bar.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alert_query_bar/query_bar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_query_bar/query_bar.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alert_tls.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_tls.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alert_tls.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alert_tls.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx index 09b116c5bbc45..54a8010e30a1c 100644 --- a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_monitor_status.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_monitor_status.tsx @@ -14,10 +14,10 @@ import { setSearchTextAction } from '../../../../state/actions'; import { AtomicStatusCheckParamsType, GetMonitorAvailabilityParamsType, -} from '../../../../../common/runtime_types'; +} from '../../../../../../common/runtime_types'; import { useSnapShotCount } from './use_snap_shot'; -import { FILTER_FIELDS } from '../../../../../common/constants'; +import { FILTER_FIELDS } from '../../../../../../common/constants'; const { TYPE, TAGS, LOCATION, PORT } = FILTER_FIELDS; diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_tls.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_tls.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/alert_tls.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/alert_tls.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/uptime_alerts_flyout_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/use_snap_shot.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/use_snap_shot.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/alerts_containers/use_snap_shot.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/alerts_containers/use_snap_shot.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/anomaly_alert/anomaly_alert.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/anomaly_alert.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/anomaly_alert/anomaly_alert.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/select_severity.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/anomaly_alert/select_severity.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/select_severity.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/anomaly_alert/select_severity.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/anomaly_alert/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/anomaly_alert/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/anomaly_alert/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/__snapshots__/down_number_select.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/__snapshots__/time_expression_select.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/availability_expression_select.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/availability_expression_select.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/availability_expression_select.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/availability_expression_select.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/down_number_select.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/down_number_select.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/down_number_select.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/down_number_select.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/down_number_select.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/filters_expression_select.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/filters_expression_select.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/filters_expression_select.tsx index 3720179838899..12b28352a503e 100644 --- a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/filters_expression_select.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/filters_expression_select.tsx @@ -11,7 +11,7 @@ import { FieldValueSuggestions } from '@kbn/observability-plugin/public'; import { filterLabels } from '../../filter_group/translations'; import { alertFilterLabels, filterAriaLabels } from './translations'; import { useUptimeDataView } from '../../../../contexts/uptime_data_view_context'; -import { FILTER_FIELDS } from '../../../../../common/constants'; +import { FILTER_FIELDS } from '../../../../../../common/constants'; import { useGetUrlParams } from '../../../../hooks'; export interface FilterExpressionsSelectProps { diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/status_expression_select.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/status_expression_select.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/status_expression_select.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/status_expression_select.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/time_expression_select.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/time_expression_select.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_expression_select.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/time_expression_select.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/time_unit_selectable.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_expressions/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_expressions/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/add_filter_btn.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/add_filter_btn.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/alert_monitor_status.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx index 1fa06458e3a8b..80958e3bdd767 100644 --- a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/alert_monitor_status.tsx @@ -14,7 +14,7 @@ import { OldAlertCallOut } from './old_alert_call_out'; import { AvailabilityExpressionSelect } from '../monitor_expressions/availability_expression_select'; import { AlertQueryBar } from '../alert_query_bar/query_bar'; import { useGetUrlParams } from '../../../../hooks'; -import { FILTER_FIELDS } from '../../../../../common/constants'; +import { FILTER_FIELDS } from '../../../../../../common/constants'; export interface AlertMonitorStatusProps { ruleParams: { [key: string]: any }; diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/old_alert_call_out.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/monitor_status_alert/old_alert_callout.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/settings_message_expression_popover.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/settings_message_expression_popover.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/settings_message_expression_popover.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/settings_message_expression_popover.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/toggle_alert_flyout_button.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/toggle_alert_flyout_button.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/toggle_alert_flyout_button.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/toggle_alert_flyout_button.tsx index 894c3df70a405..86b745c7d227f 100644 --- a/x-pack/plugins/synthetics/public/components/overview/alerts/toggle_alert_flyout_button.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/toggle_alert_flyout_button.tsx @@ -17,8 +17,8 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; -import { ClientPluginsStart } from '../../../apps/plugin'; +import { CLIENT_ALERT_TYPES } from '../../../../../common/constants/alerts'; +import { ClientPluginsStart } from '../../../../plugin'; import { ToggleFlyoutTranslations } from './translations'; import { ToggleAlertFlyoutButtonProps } from './alerts_containers'; diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/alerts/uptime_alerts_flyout_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_error.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/empty_state/empty_state_error.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_error.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/empty_state/empty_state_error.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_loading.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/empty_state/empty_state_loading.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/empty_state/empty_state_loading.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/empty_state/empty_state_loading.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/empty_state/use_has_data.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/empty_state/use_has_data.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/empty_state/use_has_data.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/empty_state/use_has_data.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/filter_group.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/filter_group.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/filter_group.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/filter_group.tsx index 8a0ac4cbe81b1..16ab92a6862c2 100644 --- a/x-pack/plugins/synthetics/public/components/overview/filter_group/filter_group.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/filter_group.tsx @@ -15,7 +15,7 @@ import { useSelectedFilters } from '../../../hooks/use_selected_filters'; import { SelectedFilters } from './selected_filters'; import { useUptimeDataView } from '../../../contexts/uptime_data_view_context'; import { useGetUrlParams } from '../../../hooks'; -import { EXCLUDE_RUN_ONCE_FILTER } from '../../../../common/constants/client_defaults'; +import { EXCLUDE_RUN_ONCE_FILTER } from '../../../../../common/constants/client_defaults'; const Container = styled(EuiFilterGroup)` margin-bottom: 10px; diff --git a/x-pack/plugins/synthetics/public/components/overview/filter_group/selected_filters.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/selected_filters.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/filter_group/selected_filters.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/selected_filters.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/filter_group/translations.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/translations.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/filter_group/translations.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/filter_group/translations.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/__snapshots__/filter_status_button.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/__snapshots__/status_filter.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/cert_status_column.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/cert_status_column.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/cert_status_column.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/cert_status_column.tsx index 790342b593398..5d24b7d969984 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/cert_status_column.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/cert_status_column.tsx @@ -9,10 +9,10 @@ import React from 'react'; import moment from 'moment'; import styled from 'styled-components'; import { EuiIcon, EuiText, EuiToolTip } from '@elastic/eui'; -import { X509Expiry } from '../../../../../common/runtime_types'; +import { X509Expiry } from '../../../../../../common/runtime_types'; import { useCertStatus } from '../../../../hooks'; import { EXPIRED, EXPIRES, EXPIRES_SOON } from '../../../certificates/translations'; -import { CERT_STATUS } from '../../../../../common/constants'; +import { CERT_STATUS } from '../../../../../../common/constants'; interface Props { expiry: X509Expiry; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx index f5ac702d5060b..5bb676178d9a7 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/define_connectors.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/define_connectors.tsx @@ -9,7 +9,7 @@ import React, { useState } from 'react'; import { EuiSwitch, EuiPopover, EuiText, EuiFormRow } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { ReactRouterEuiLink } from '../../../common/react_router_helpers'; -import { SETTINGS_ROUTE } from '../../../../../common/constants'; +import { SETTINGS_ROUTE } from '../../../../../../common/constants'; import { ENABLE_STATUS_ALERT } from './translations'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.test.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.test.tsx index c5dff902cfb14..416dd8e963e9b 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.test.tsx @@ -9,8 +9,8 @@ import React from 'react'; import { EnableMonitorAlert } from './enable_alert'; import { fireEvent } from '@testing-library/dom'; -import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../common/constants'; -import { makePing } from '../../../../../common/runtime_types/ping'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../../common/constants'; +import { makePing } from '../../../../../../common/runtime_types/ping'; import { render } from '../../../../lib/helper/rtl_helpers'; import { DISABLE_STATUS_ALERT, ENABLE_STATUS_ALERT } from './translations'; import { mockState } from '../../../../lib/__mocks__/uptime_store.mock'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx index 3bc23592c4e64..b52aacd5abb6e 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/enable_alert.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/enable_alert.tsx @@ -18,10 +18,10 @@ import { isAlertDeletedSelector, newAlertSelector, } from '../../../../state/alerts/alerts'; -import { MONITOR_ROUTE } from '../../../../../common/constants'; +import { MONITOR_ROUTE } from '../../../../../../common/constants'; import { DefineAlertConnectors } from './define_connectors'; import { DISABLE_STATUS_ALERT, ENABLE_STATUS_ALERT } from './translations'; -import { Ping } from '../../../../../common/runtime_types/ping'; +import { Ping } from '../../../../../../common/runtime_types/ping'; interface Props { monitorId: string; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_name_col.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_name_col.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_name_col.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_name_col.tsx index 130ccbd7081c3..00590f46b51f1 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_name_col.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_name_col.tsx @@ -11,7 +11,7 @@ import { EuiButtonEmpty, EuiText } from '@elastic/eui'; import { MonitorPageLink } from '../../../common/monitor_page_link'; import { useGetUrlParams } from '../../../../hooks'; import { stringifyUrlParams } from '../../../../lib/helper/stringify_url_params'; -import { MonitorSummary } from '../../../../../common/runtime_types/monitor'; +import { MonitorSummary } from '../../../../../../common/runtime_types/monitor'; import { useFilterUpdate } from '../../../../hooks/use_filter_update'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_status_column.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_status_column.test.tsx index a6c837ca13a7f..a69ebb3d349fd 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_status_column.test.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { getLocationStatus, MonitorListStatusColumn } from './monitor_status_column'; -import { Ping } from '../../../../../common/runtime_types'; -import { STATUS } from '../../../../../common/constants'; +import { Ping } from '../../../../../../common/runtime_types'; +import { STATUS } from '../../../../../../common/constants'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { mockDate, mockMoment } from '../../../../lib/helper/test_helpers'; import { render } from '../../../../lib/helper/rtl_helpers'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_status_column.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_status_column.tsx index 6fb3a463ebf77..7f64c1199c2b0 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -23,13 +23,13 @@ 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 { DataStream, Ping, PingError } from '../../../../../../common/runtime_types'; import { STATUS, SHORT_TIMESPAN_LOCALE, UNNAMED_LOCATION, SHORT_TS_LOCALE, -} from '../../../../../common/constants'; +} from '../../../../../../common/constants'; import { STATUS_DOWN_LABEL, STATUS_UP_LABEL } from '../../../common/translations'; import { MonitorProgress } from './progress/monitor_progress'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx index b92916bd7b72b..0692af54b9bf4 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/browser_monitor_progress.tsx @@ -7,8 +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 { 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, diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/monitor_progress.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/monitor_progress.tsx index b03d278f09d45..ebc28310930ad 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/monitor_progress.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/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, SyntheticsMonitorSchedule } from '../../../../../../common/runtime_types'; +import { DataStream, SyntheticsMonitorSchedule } from '../../../../../../../common/runtime_types'; import { useUpdatedMonitor } from './use_updated_monitor'; import { refreshedMonitorSelector } from '../../../../../state/reducers/monitor_list'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx similarity index 92% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx index f93bcadd58519..bbc96eeda397b 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/simple_monitor_progress.tsx @@ -7,8 +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 { 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'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/use_updated_monitor.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/progress/use_updated_monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/progress/use_updated_monitor.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/status_badge.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/status_badge.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/status_badge.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/status_badge.tsx index fe2c7730275db..0328242ffc036 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/status_badge.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/status_badge.tsx @@ -7,10 +7,10 @@ import { EuiBadge, EuiToolTip } from '@elastic/eui'; import React, { useContext, useState } from 'react'; -import { STATUS } from '../../../../../common/constants'; +import { STATUS } from '../../../../../../common/constants'; import { getHealthMessage } from './monitor_status_column'; import { UptimeThemeContext } from '../../../../contexts'; -import { PingError } from '../../../../../common/runtime_types'; +import { PingError } from '../../../../../../common/runtime_types'; import { getInlineErrorLabel } from '../../../monitor_management/monitor_list/inline_error'; import { StdErrorPopover } from '../../../monitor_management/monitor_list/stderr_logs_popover'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/test_now_col.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/test_now_col.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/test_now_col.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/test_now_col.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/columns/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/columns/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/filter_status_button.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/filter_status_button.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/filter_status_button.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/filter_status_button.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/filter_status_button.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list.test.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list.test.tsx index 495facf9c2cc8..d0026b1c5f0ba 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list.test.tsx @@ -14,7 +14,7 @@ import { makePing, Ping, MonitorSummary, -} from '../../../../common/runtime_types'; +} from '../../../../../common/runtime_types'; import { MonitorListComponent } from './monitor_list'; import moment from 'moment'; import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list.tsx index bf33bc52ffb68..c5a38067965c3 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list.tsx @@ -18,8 +18,8 @@ import { getBreakpoint, } from '@elastic/eui'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; -import { X509Expiry } from '../../../../common/runtime_types'; -import { MonitorSummary } from '../../../../common/runtime_types'; +import { X509Expiry } from '../../../../../common/runtime_types'; +import { MonitorSummary } from '../../../../../common/runtime_types'; import { MonitorListStatusColumn } from './columns/monitor_status_column'; import { ExpandedRowMap } from './types'; import { MonitorBarSeries } from '../../common/charts'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_container.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_container.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_group.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/integration_link.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/monitor_list_drawer.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/__snapshots__/most_recent_error.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx index eee1c461fb1cb..9a8b660cb41bb 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { EuiPopover, EuiButton } from '@elastic/eui'; import { IntegrationGroup } from './integration_group'; -import { MonitorSummary } from '../../../../../../common/runtime_types'; +import { MonitorSummary } from '../../../../../../../common/runtime_types'; import { toggleIntegrationsPopover, PopoverState } from '../../../../../state/actions'; export interface ActionsPopoverProps { diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover_container.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx index 97d1e8da61a7f..51d24978026e4 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_group.tsx @@ -19,7 +19,7 @@ import { getLoggingIpHref, getLoggingKubernetesHref, } from '../../../../../lib/helper'; -import { MonitorSummary } from '../../../../../../common/runtime_types'; +import { MonitorSummary } from '../../../../../../../common/runtime_types'; import { UptimeSettingsContext } from '../../../../../contexts'; interface IntegrationGroupProps { diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/actions_popover/integration_link.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/data.json b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/data.json similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/data.json rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/data.json diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx index 5f50285063541..ee58d2f78d31a 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/integration_group.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { MonitorSummary, makePing } from '../../../../../common/runtime_types'; +import { MonitorSummary, makePing } from '../../../../../../common/runtime_types'; import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { IntegrationGroup, extractSummaryValues } from './actions_popover/integration_group'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/integration_link.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx index 2b97f53f21356..a0708712c8cd3 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/list_drawer_container.tsx @@ -12,7 +12,7 @@ import { monitorDetailsLoadingSelector, monitorDetailsSelector } from '../../../ import { getMonitorDetailsAction } from '../../../../state/actions/monitor'; import { MonitorListDrawerComponent } from './monitor_list_drawer'; import { useGetUrlParams } from '../../../../hooks'; -import { MonitorSummary } from '../../../../../common/runtime_types'; +import { MonitorSummary } from '../../../../../../common/runtime_types'; import { alertsSelector } from '../../../../state/alerts/alerts'; import { UptimeRefreshContext } from '../../../../contexts'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx index 240697af470b0..78a70d14fa271 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { MonitorListDrawerComponent } from './monitor_list_drawer'; -import { MonitorDetails, MonitorSummary, makePing } from '../../../../../common/runtime_types'; +import { MonitorDetails, MonitorSummary, makePing } from '../../../../../../common/runtime_types'; import { shallowWithRouter } from '../../../../lib'; describe('MonitorListDrawer component', () => { diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx index 092614b870bda..81648bee153cd 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx @@ -11,7 +11,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { Rule } from '@kbn/triggers-actions-ui-plugin/public'; import { MostRecentError } from './most_recent_error'; import { MonitorStatusList } from './monitor_status_list'; -import { MonitorDetails, MonitorSummary } from '../../../../../common/runtime_types'; +import { MonitorDetails, MonitorSummary } from '../../../../../../common/runtime_types'; import { ActionsPopover } from './actions_popover/actions_popover_container'; import { EnabledAlerts } from './enabled_alerts'; import { MonitorUrl } from './monitor_url'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx index ad9347ab84763..f1a9d1b2629a6 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { MonitorStatusList } from './monitor_status_list'; -import { Ping } from '../../../../../common/runtime_types'; +import { Ping } from '../../../../../../common/runtime_types'; import { mockMoment } from '../../../../lib/helper/test_helpers'; import { render } from '../../../../lib/helper/rtl_helpers'; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx index 1207798a34023..753ae0b1390db 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx @@ -10,8 +10,8 @@ import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { LocationLink } from '../../../common/location_link'; import { MonitorStatusRow } from './monitor_status_row'; -import { Ping } from '../../../../../common/runtime_types'; -import { STATUS, UNNAMED_LOCATION } from '../../../../../common/constants'; +import { Ping } from '../../../../../../common/runtime_types'; +import { STATUS, UNNAMED_LOCATION } from '../../../../../../common/constants'; interface MonitorStatusListProps { /** diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx index 4bfe079e73a3f..7804b9bc94b5e 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiBadge, EuiSpacer } from '@elastic/eui'; -import { UNNAMED_LOCATION, STATUS } from '../../../../../common/constants'; +import { UNNAMED_LOCATION, STATUS } from '../../../../../../common/constants'; import { getHealthMessage } from '../columns/monitor_status_column'; interface MonitorStatusRowProps { diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx index 111a8a18ccad5..e3b36645ba7f3 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_error.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import moment from 'moment'; import { BrowserRouter as Router } from 'react-router-dom'; import { MostRecentError } from './most_recent_error'; -import { MonitorDetails, PingError } from '../../../../../common/runtime_types'; +import { MonitorDetails, PingError } from '../../../../../../common/runtime_types'; describe('MostRecentError component', () => { let monitorDetails: MonitorDetails; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx index 0b7c270c1b636..00484b8c40070 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx @@ -16,7 +16,7 @@ import { i18n } from '@kbn/i18n'; import { MonitorPageLink } from '../../../common/monitor_page_link'; import { useGetUrlParams } from '../../../../hooks'; import { stringifyUrlParams } from '../../../../lib/helper/stringify_url_params'; -import { PingError } from '../../../../../common/runtime_types'; +import { PingError } from '../../../../../../common/runtime_types'; interface MostRecentErrorProps { /** diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx index 32fff166a228e..06bb51c959404 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx @@ -14,7 +14,7 @@ import { } from '@elastic/eui'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; -import { MonitorSummary } from '../../../../../common/runtime_types'; +import { MonitorSummary } from '../../../../../../common/runtime_types'; interface Props { summary: MonitorSummary; diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_header.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_header.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_header.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_header.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_page_size_select.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_page_size_select.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_page_size_select.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/monitor_list_page_size_select.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/monitor_list_page_size_select.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_meesage.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/no_items_meesage.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_meesage.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/no_items_meesage.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_message.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/no_items_message.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/no_items_message.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/no_items_message.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/overview_page_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/overview_page_link.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/overview_page_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/overview_page_link.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/parse_timestamp.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/parse_timestamp.test.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/parse_timestamp.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/parse_timestamp.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/parse_timestamp.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/status_filter.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/status_filter.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/status_filter.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/status_filter.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/status_filter.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/troubleshoot_popover.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/troubleshoot_popover.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/troubleshoot_popover.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/troubleshoot_popover.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/types.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/types.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/monitor_list/use_monitor_histogram.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/use_monitor_histogram.ts similarity index 94% rename from x-pack/plugins/synthetics/public/components/overview/monitor_list/use_monitor_histogram.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/use_monitor_histogram.ts index 8a6fb5a174856..1a9b7b73732af 100644 --- a/x-pack/plugins/synthetics/public/components/overview/monitor_list/use_monitor_histogram.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/monitor_list/use_monitor_histogram.ts @@ -13,12 +13,12 @@ import { Histogram, HistogramPoint, MonitorSummary, -} from '../../../../common/runtime_types/monitor'; +} from '../../../../../common/runtime_types/monitor'; import { useGetUrlParams } from '../../../hooks'; import { UptimeRefreshContext } from '../../../contexts'; import { esKuerySelector } from '../../../state/selectors'; -import { getHistogramInterval } from '../../../../common/lib/get_histogram_interval'; -import { Ping } from '../../../../common/runtime_types'; +import { getHistogramInterval } from '../../../../../common/lib/get_histogram_interval'; +import { Ping } from '../../../../../common/runtime_types'; export const useMonitorHistogram = ({ items }: { items: MonitorSummary[] }) => { const { dateRangeStart, dateRangeEnd, statusFilter } = useGetUrlParams(); diff --git a/x-pack/plugins/synthetics/public/components/overview/query_bar/query_bar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/query_bar.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/query_bar/query_bar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/query_bar.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/query_bar/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/query_bar/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/use_query_bar.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/use_query_bar.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/use_query_bar.ts similarity index 98% rename from x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/use_query_bar.ts index 30658081183d5..75351e5872f35 100644 --- a/x-pack/plugins/synthetics/public/components/overview/query_bar/use_query_bar.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/query_bar/use_query_bar.ts @@ -17,7 +17,7 @@ import { useUrlParams, } from '../../../hooks'; import { setEsKueryString } from '../../../state/actions'; -import { UptimePluginServices } from '../../../apps/plugin'; +import { UptimePluginServices } from '../../../../plugin'; export enum SyntaxType { text = 'text', diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/__snapshots__/snapshot.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/snapshot/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/index.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot.test.tsx similarity index 91% rename from x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot.test.tsx index 3cea8199544d4..322db8908cca7 100644 --- a/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { SnapshotComponent } from './snapshot'; -import { Snapshot } from '../../../../common/runtime_types/snapshot'; +import { Snapshot } from '../../../../../common/runtime_types/snapshot'; import * as hook from './use_snap_shot'; describe('Snapshot component', () => { diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot_heading.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot_heading.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/snapshot/snapshot_heading.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/snapshot_heading.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot/use_snap_shot.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/use_snap_shot.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/snapshot/use_snap_shot.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot/use_snap_shot.ts diff --git a/x-pack/plugins/synthetics/public/components/overview/snapshot_heading.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot_heading.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/snapshot_heading.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/snapshot_heading.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/status_panel.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/status_panel.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/status_panel.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/status_panel.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/synthetics_callout.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/synthetics_callout.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/synthetics_callout.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/synthetics_callout.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/overview/synthetics_callout.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/overview/synthetics_callout.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/overview/synthetics_callout.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/overview/synthetics_callout.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/__snapshots__/certificate_form.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/__snapshots__/certificate_form.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/__snapshots__/certificate_form.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/__snapshots__/certificate_form.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/settings/__snapshots__/indices_form.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/__snapshots__/indices_form.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/__snapshots__/indices_form.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/__snapshots__/indices_form.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/components/settings/add_connector_flyout.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/add_connector_flyout.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/add_connector_flyout.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/add_connector_flyout.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/alert_defaults_form.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/alert_defaults_form.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/alert_defaults_form.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/alert_defaults_form.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/certificate_form.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/certificate_form.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/certificate_form.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/certificate_form.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/certificate_form.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/certificate_form.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/settings/certificate_form.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/certificate_form.tsx index 2deecc8809074..dc44a7074c33f 100644 --- a/x-pack/plugins/synthetics/public/components/settings/certificate_form.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/certificate_form.tsx @@ -18,8 +18,8 @@ import { EuiFlexGroup, EuiFlexItem, } from '@elastic/eui'; -import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants'; -import { DefaultEmail, DynamicSettings } from '../../../common/runtime_types'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../common/constants'; +import { DefaultEmail, DynamicSettings } from '../../../../common/runtime_types'; import { SettingsFormProps } from '../../pages/settings'; import { certificateFormTranslations } from './translations'; diff --git a/x-pack/plugins/synthetics/public/components/settings/default_email.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/default_email.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/settings/default_email.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/default_email.tsx index 5a777fa644f82..5ba6278664c61 100644 --- a/x-pack/plugins/synthetics/public/components/settings/default_email.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/default_email.tsx @@ -12,8 +12,8 @@ import { EuiDescribedFormGroup } from '@elastic/eui'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { OnFieldChangeType } from './certificate_form'; import { connectorsSelector } from '../../state/alerts/alerts'; -import { DefaultEmail as DefaultEmailType } from '../../../common/runtime_types'; -import { UptimePluginServices } from '../../apps/plugin'; +import { DefaultEmail as DefaultEmailType } from '../../../../common/runtime_types'; +import { UptimePluginServices } from '../../../plugin'; import { SettingsPageFieldErrors } from '../../pages/settings'; export function DefaultEmail({ diff --git a/x-pack/plugins/synthetics/public/components/settings/indices_form.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/indices_form.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/indices_form.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/indices_form.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/indices_form.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/indices_form.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/settings/indices_form.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/indices_form.tsx index f11626f231eae..4fe2917fbd357 100644 --- a/x-pack/plugins/synthetics/public/components/settings/indices_form.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/indices_form.tsx @@ -15,7 +15,7 @@ import { EuiTitle, EuiSpacer, } from '@elastic/eui'; -import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../common/constants'; import { SettingsFormProps } from '../../pages/settings'; export const IndicesForm: React.FC = ({ diff --git a/x-pack/plugins/synthetics/public/components/settings/settings_actions.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/settings_actions.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/settings_actions.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/settings_actions.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/settings_bottom_bar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/settings_bottom_bar.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/settings_bottom_bar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/settings_bottom_bar.tsx diff --git a/x-pack/plugins/synthetics/public/components/settings/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/translations.ts diff --git a/x-pack/plugins/synthetics/public/components/settings/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/types.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/types.ts diff --git a/x-pack/plugins/synthetics/public/components/settings/use_settings_errors.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/settings/use_settings_errors.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/settings/use_settings_errors.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/settings/use_settings_errors.ts diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/stderr_logs.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/stderr_logs.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/stderr_logs.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/stderr_logs.tsx index 6192ee3866913..d127b67efc8e6 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/stderr_logs.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/stderr_logs.tsx @@ -26,9 +26,9 @@ import { useSelector } from 'react-redux'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useFetcher } from '@kbn/observability-plugin/public'; import { useStdErrorLogs } from './use_std_error_logs'; -import { ClientPluginsStart } from '../../../apps/plugin'; +import { ClientPluginsStart } from '../../../../plugin'; import { selectDynamicSettings } from '../../../state/selectors'; -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; export const StdErrorLogs = ({ configId, diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_duration.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_duration.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_duration.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_duration.tsx index 92a4ab24433f8..f0e05c2072782 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_duration.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_duration.tsx @@ -11,7 +11,7 @@ import * as React from 'react'; import { EuiButtonEmpty, EuiPopover, EuiText } from '@elastic/eui'; import { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; -import { JourneyStep } from '../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../common/runtime_types'; import { StepFieldTrend } from './step_field_trend'; import { microToSec } from '../../../lib/formatting'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx index d4d2536e47851..2ef6c7718f7bc 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_expanded_row/screenshot_link.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { ReactRouterEuiLink } from '../../../common/react_router_helpers'; -import { Ping } from '../../../../../common/runtime_types/ping/ping'; +import { Ping } from '../../../../../../common/runtime_types/ping/ping'; const LabelLink = euiStyled.div` margin-bottom: ${(props) => props.theme.eui.paddingSizes.xs}; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx index 0277a47804fc6..d0db4a99a495e 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_expanded_row/step_screenshots.tsx @@ -12,8 +12,8 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { useFetcher } from '@kbn/observability-plugin/public'; import { StepScreenshotDisplay } from '../../step_screenshot_display'; -import { JourneyStep } from '../../../../../common/runtime_types/ping/synthetics'; -import { Ping } from '../../../../../common/runtime_types/ping/ping'; +import { JourneyStep } from '../../../../../../common/runtime_types/ping/synthetics'; +import { Ping } from '../../../../../../common/runtime_types/ping/ping'; import { fetchLastSuccessfulCheck } from '../../../../state/api/journey'; import { ScreenshotLink } from './screenshot_link'; import { getShortTimeStamp } from '../../../overview/monitor_list/columns/monitor_status_column'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_field_trend.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_field_trend.test.tsx index 165208c032705..741d00fcc072d 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_field_trend.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { getLast48Intervals, StepFieldTrend } from './step_field_trend'; import { render } from '../../../lib/helper/rtl_helpers'; -import { JourneyStep } from '../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../common/runtime_types'; const step: JourneyStep = { _id: 'docID', diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_field_trend.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_field_trend.tsx index cd1b9df222e58..e03656ed562dc 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_field_trend.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_field_trend.tsx @@ -13,7 +13,7 @@ import { useSelector } from 'react-redux'; import { AllSeries, createExploratoryViewUrl } from '@kbn/observability-plugin/public'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { JourneyStep } from '../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../common/runtime_types'; import { useUptimeStartPlugins } from '../../../contexts/uptime_startup_plugins_context'; import { selectDynamicSettings } from '../../../state/selectors'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_image.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_image.tsx similarity index 92% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_image.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_image.tsx index 06410e79a22a2..f1280cfe368b1 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/step_image.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/step_image.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; -import { JourneyStep } from '../../../../common/runtime_types/ping/synthetics'; +import { JourneyStep } from '../../../../../common/runtime_types/ping/synthetics'; import { PingTimestamp } from '../../monitor/ping_list/columns/ping_timestamp'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/steps_list.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/steps_list.test.tsx index 61535833822da..1a792dfa9f8d3 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/steps_list.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { JourneyStep } from '../../../../common/runtime_types/ping'; +import { JourneyStep } from '../../../../../common/runtime_types/ping'; import { StepsList } from './steps_list'; import { render, forDesktopOnly, forMobileOnly } from '../../../lib/helper/rtl_helpers'; import { VIEW_PERFORMANCE } from '../../monitor/synthetics/translations'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/steps_list.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/steps_list.tsx index 957c25225a614..d02b7ac0e51da 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/steps_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/steps_list.tsx @@ -17,7 +17,7 @@ import { import { i18n } from '@kbn/i18n'; import React, { MouseEvent, useState } from 'react'; import styled from 'styled-components'; -import { JourneyStep } from '../../../../common/runtime_types'; +import { JourneyStep } from '../../../../../common/runtime_types'; import { STATUS_LABEL } from '../../monitor/ping_list/translations'; import { COLLAPSE_LABEL, EXPAND_LABEL, STEP_NAME_LABEL } from '../translations'; import { StatusBadge } from '../status_badge'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_check_steps.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_check_steps.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_check_steps.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_check_steps.ts diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_expanded_row.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_expanded_row.test.tsx index c16522804eed6..6d1dc3f80fe60 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_expanded_row.test.tsx @@ -13,8 +13,8 @@ import { createMemoryHistory } from 'history'; import { EuiButtonIcon } from '@elastic/eui'; import { getExpandedStepCallback, useExpandedRow } from './use_expanded_row'; import { render } from '../../../lib/helper/rtl_helpers'; -import { JourneyStep } from '../../../../common/runtime_types'; -import { SYNTHETIC_CHECK_STEPS_ROUTE } from '../../../../common/constants'; +import { JourneyStep } from '../../../../../common/runtime_types'; +import { SYNTHETIC_CHECK_STEPS_ROUTE } from '../../../../../common/constants'; import { COLLAPSE_LABEL, EXPAND_LABEL } from '../translations'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_expanded_row.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_expanded_row.tsx index 1b3a641033dd7..51fe965c55fbc 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_expanded_row.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_expanded_row.tsx @@ -8,7 +8,7 @@ import React, { useEffect, useState, useCallback } from 'react'; import { useParams } from 'react-router-dom'; import { ExecutedStep } from '../executed_step'; -import { JourneyStep } from '../../../../common/runtime_types/ping'; +import { JourneyStep } from '../../../../../common/runtime_types/ping'; interface HookProps { loading: boolean; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_std_error_logs.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_std_error_logs.ts similarity index 96% rename from x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_std_error_logs.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_std_error_logs.ts index 11dfdcdcc434e..d6abd2445a9a7 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/check_steps/use_std_error_logs.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/check_steps/use_std_error_logs.ts @@ -8,7 +8,7 @@ import { useSelector } from 'react-redux'; import { createEsParams, useEsSearch } from '@kbn/observability-plugin/public'; import { selectDynamicSettings } from '../../../state/selectors'; -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; export const useStdErrorLogs = ({ configId, diff --git a/x-pack/plugins/synthetics/public/components/synthetics/code_block_accordion.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/code_block_accordion.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/code_block_accordion.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/code_block_accordion.tsx diff --git a/x-pack/plugins/synthetics/public/components/synthetics/console_event.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_event.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/console_event.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_event.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/synthetics/console_event.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_event.tsx similarity index 93% rename from x-pack/plugins/synthetics/public/components/synthetics/console_event.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_event.tsx index a9cde922e8926..aeceef2477e28 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/console_event.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_event.tsx @@ -8,7 +8,7 @@ import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; import React, { useContext, FC } from 'react'; import { UptimeThemeContext } from '../../contexts'; -import { JourneyStep } from '../../../common/runtime_types/ping'; +import { JourneyStep } from '../../../../common/runtime_types/ping'; interface Props { event: JourneyStep; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_output_event_list.test.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_output_event_list.test.tsx index d35e526208ae9..9e63ff070c752 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_output_event_list.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { JourneyStep } from '../../../common/runtime_types/ping/synthetics'; +import { JourneyStep } from '../../../../common/runtime_types/ping/synthetics'; import { render } from '../../lib/helper/rtl_helpers'; import { ConsoleOutputEventList } from './console_output_event_list'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_output_event_list.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_output_event_list.tsx index 4bf33663d920a..1019532e0a610 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/console_output_event_list.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/console_output_event_list.tsx @@ -9,7 +9,7 @@ import { EuiCodeBlock, EuiSpacer, EuiTitle } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import React, { FC } from 'react'; import { ConsoleEvent } from './console_event'; -import { JourneyStep } from '../../../common/runtime_types/ping'; +import { JourneyStep } from '../../../../common/runtime_types/ping'; import { JourneyState } from '../../state/reducers/journey'; interface Props { diff --git a/x-pack/plugins/synthetics/public/components/synthetics/empty_journey.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/empty_journey.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/empty_journey.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/empty_journey.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/synthetics/empty_journey.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/empty_journey.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/empty_journey.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/empty_journey.tsx diff --git a/x-pack/plugins/synthetics/public/components/synthetics/executed_step.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/executed_step.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/executed_step.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/executed_step.test.tsx index 81d506bd05413..8231fc5808506 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/executed_step.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/executed_step.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ExecutedStep } from './executed_step'; import { render } from '../../lib/helper/rtl_helpers'; -import { JourneyStep } from '../../../common/runtime_types/ping'; +import { JourneyStep } from '../../../../common/runtime_types/ping'; describe('ExecutedStep', () => { let step: JourneyStep; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/executed_step.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/executed_step.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/components/synthetics/executed_step.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/executed_step.tsx index f3021894ec5ff..063dd9db0eae3 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/executed_step.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/executed_step.tsx @@ -10,7 +10,7 @@ import React, { FC } from 'react'; import { i18n } from '@kbn/i18n'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { CodeBlockAccordion } from './code_block_accordion'; -import { JourneyStep } from '../../../common/runtime_types/ping'; +import { JourneyStep } from '../../../../common/runtime_types/ping'; import { StepScreenshots } from './check_steps/step_expanded_row/step_screenshots'; const CODE_BLOCK_OVERFLOW_HEIGHT = 360; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/status_badge.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/status_badge.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/status_badge.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/status_badge.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/synthetics/status_badge.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/status_badge.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/components/synthetics/status_badge.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/status_badge.tsx index be9eb6178deae..4eba0f4b6a288 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/status_badge.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/status_badge.tsx @@ -8,7 +8,7 @@ import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useContext, FC } from 'react'; -import { UptimeAppColors } from '../../apps/uptime_app'; +import { UptimeAppColors } from '../../app/uptime_app'; import { UptimeThemeContext } from '../../contexts'; interface StatusBadgeProps { diff --git a/x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/step_screenshot_display.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/step_screenshot_display.test.tsx diff --git a/x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/step_screenshot_display.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/step_screenshot_display.tsx index bc3cda6cd93bc..b5a82eac7bad1 100644 --- a/x-pack/plugins/synthetics/public/components/synthetics/step_screenshot_display.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/step_screenshot_display.tsx @@ -22,7 +22,7 @@ import { useFetcher } from '@kbn/observability-plugin/public'; import { isScreenshotRef as isAScreenshotRef, ScreenshotRefImageData, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { UptimeRefreshContext, UptimeSettingsContext, UptimeThemeContext } from '../../contexts'; import { getJourneyScreenshot } from '../../state/api/journey'; import { useCompositeImage } from '../../hooks'; diff --git a/x-pack/plugins/synthetics/public/components/synthetics/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/components/synthetics/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/components/synthetics/translations.ts diff --git a/x-pack/plugins/synthetics/public/contexts/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/contexts/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/contexts/index.ts diff --git a/x-pack/plugins/synthetics/public/contexts/uptime_data_view_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_data_view_context.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/contexts/uptime_data_view_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_data_view_context.tsx diff --git a/x-pack/plugins/synthetics/public/contexts/uptime_refresh_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_refresh_context.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/contexts/uptime_refresh_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_refresh_context.tsx diff --git a/x-pack/plugins/synthetics/public/contexts/uptime_settings_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_settings_context.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/contexts/uptime_settings_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_settings_context.tsx index 4fda00db57bd7..d192f7327879c 100644 --- a/x-pack/plugins/synthetics/public/contexts/uptime_settings_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_settings_context.tsx @@ -6,8 +6,8 @@ */ import React, { createContext, useContext, useMemo } from 'react'; -import { UptimeAppProps } from '../apps/uptime_app'; -import { CLIENT_DEFAULTS, CONTEXT_DEFAULTS } from '../../common/constants'; +import { UptimeAppProps } from '../app/uptime_app'; +import { CLIENT_DEFAULTS, CONTEXT_DEFAULTS } from '../../../common/constants'; import { CommonlyUsedRange } from '../components/common/uptime_date_picker'; import { useGetUrlParams } from '../hooks'; diff --git a/x-pack/plugins/synthetics/public/contexts/uptime_startup_plugins_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_startup_plugins_context.tsx similarity index 92% rename from x-pack/plugins/synthetics/public/contexts/uptime_startup_plugins_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_startup_plugins_context.tsx index 8fbc8ae749c81..76754a52a3dfb 100644 --- a/x-pack/plugins/synthetics/public/contexts/uptime_startup_plugins_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_startup_plugins_context.tsx @@ -6,7 +6,7 @@ */ import React, { createContext, useContext } from 'react'; -import { ClientPluginsStart } from '../apps/plugin'; +import { ClientPluginsStart } from '../../plugin'; export const UptimeStartupPluginsContext = createContext>({}); diff --git a/x-pack/plugins/synthetics/public/contexts/uptime_theme_context.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_theme_context.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/contexts/uptime_theme_context.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_theme_context.tsx index 2d25cf6e84e1b..b37856b03e87e 100644 --- a/x-pack/plugins/synthetics/public/contexts/uptime_theme_context.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/contexts/uptime_theme_context.tsx @@ -9,7 +9,7 @@ import { euiLightVars, euiDarkVars } from '@kbn/ui-theme'; import React, { createContext, useMemo } from 'react'; import { EUI_CHARTS_THEME_DARK, EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme'; import { DARK_THEME, LIGHT_THEME, PartialTheme, Theme } from '@elastic/charts'; -import { UptimeAppColors } from '../apps/uptime_app'; +import { UptimeAppColors } from '../app/uptime_app'; export interface UptimeThemeContextValues { colors: UptimeAppColors; diff --git a/x-pack/plugins/synthetics/public/hooks/__snapshots__/use_url_params.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/__snapshots__/use_url_params.test.tsx.snap similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/__snapshots__/use_url_params.test.tsx.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/__snapshots__/use_url_params.test.tsx.snap diff --git a/x-pack/plugins/synthetics/public/hooks/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/index.ts diff --git a/x-pack/plugins/synthetics/public/hooks/update_kuery_string.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/update_kuery_string.ts similarity index 99% rename from x-pack/plugins/synthetics/public/hooks/update_kuery_string.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/update_kuery_string.ts index a8884279f49ba..007dfd12427f3 100644 --- a/x-pack/plugins/synthetics/public/hooks/update_kuery_string.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/update_kuery_string.ts @@ -7,7 +7,7 @@ import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; import { DataView } from '@kbn/data-views-plugin/public'; -import { combineFiltersAndUserSearch, stringifyKueries } from '../../common/lib'; +import { combineFiltersAndUserSearch, stringifyKueries } from '../../../common/lib'; const getKueryString = (urlFilters: string, excludedFilters?: string): string => { let kueryString = ''; diff --git a/x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breadcrumbs.test.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breadcrumbs.test.tsx index e5b1a28ba72c6..35b5a1aa0994c 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breadcrumbs.test.tsx @@ -9,7 +9,7 @@ import { ChromeBreadcrumb } from '@kbn/core/public'; import React from 'react'; import { Route } from 'react-router-dom'; import { mountWithRouter } from '../lib'; -import { OVERVIEW_ROUTE } from '../../common/constants'; +import { OVERVIEW_ROUTE } from '../../../common/constants'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { UptimeUrlParams, getSupportedUrlParams, MountWithReduxProvider } from '../lib/helper'; import { makeBaseBreadcrumb, useBreadcrumbs } from './use_breadcrumbs'; diff --git a/x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breadcrumbs.ts similarity index 97% rename from x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breadcrumbs.ts index cac62a79d92bf..26e9d2d0fd285 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_breadcrumbs.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breadcrumbs.ts @@ -13,7 +13,7 @@ import { useKibana } from '@kbn/kibana-react-plugin/public'; import { UptimeUrlParams } from '../lib/helper'; import { stringifyUrlParams } from '../lib/helper/stringify_url_params'; import { useUrlParams } from '.'; -import { PLUGIN } from '../../common/constants/plugin'; +import { PLUGIN } from '../../../common/constants/plugin'; const EMPTY_QUERY = '?'; diff --git a/x-pack/plugins/synthetics/public/hooks/use_breakpoints.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breakpoints.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_breakpoints.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breakpoints.test.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_breakpoints.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breakpoints.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_breakpoints.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_breakpoints.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_cert_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_cert_status.ts similarity index 95% rename from x-pack/plugins/synthetics/public/hooks/use_cert_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_cert_status.ts index d82948632543b..934d72b71de6e 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_cert_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_cert_status.ts @@ -8,7 +8,7 @@ import moment from 'moment'; import { useSelector } from 'react-redux'; import { selectDynamicSettings } from '../state/selectors'; -import { CERT_STATUS } from '../../common/constants'; +import { CERT_STATUS } from '../../../common/constants'; export const useCertStatus = (expiryDate?: string, issueDate?: string) => { const dss = useSelector(selectDynamicSettings); diff --git a/x-pack/plugins/synthetics/public/hooks/use_chart_theme.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_chart_theme.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_chart_theme.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_chart_theme.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_composite_image.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_composite_image.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/hooks/use_composite_image.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_composite_image.test.tsx index 9e2cb1e498b73..50fc366f50dbe 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_composite_image.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_composite_image.test.tsx @@ -7,7 +7,7 @@ import * as redux from 'react-redux'; import { renderHook } from '@testing-library/react-hooks'; -import { ScreenshotRefImageData } from '../../common/runtime_types'; +import { ScreenshotRefImageData } from '../../../common/runtime_types'; import { ScreenshotBlockCache } from '../state/reducers/synthetics'; import { shouldCompose, useCompositeImage } from './use_composite_image'; import * as compose from '../lib/helper/compose_screenshot_images'; diff --git a/x-pack/plugins/synthetics/public/hooks/use_composite_image.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_composite_image.ts similarity index 97% rename from x-pack/plugins/synthetics/public/hooks/use_composite_image.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_composite_image.ts index 3af1e798d43e1..ca783bdd290c4 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_composite_image.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_composite_image.ts @@ -8,7 +8,7 @@ import { useDispatch, useSelector } from 'react-redux'; import React from 'react'; import { composeScreenshotRef } from '../lib/helper/compose_screenshot_images'; -import { ScreenshotRefImageData } from '../../common/runtime_types/ping/synthetics'; +import { ScreenshotRefImageData } from '../../../common/runtime_types/ping/synthetics'; import { fetchBlocksAction, isPendingBlock, diff --git a/x-pack/plugins/synthetics/public/hooks/use_filter_update.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_filter_update.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_filter_update.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_filter_update.test.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_filter_update.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_filter_update.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_filter_update.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_filter_update.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_init_app.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_init_app.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_init_app.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_init_app.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_mapping_check.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_mapping_check.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_mapping_check.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_mapping_check.test.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_mapping_check.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_mapping_check.ts similarity index 94% rename from x-pack/plugins/synthetics/public/hooks/use_mapping_check.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_mapping_check.ts index d8a7e0fac4065..dfda2900c7904 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_mapping_check.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_mapping_check.ts @@ -7,7 +7,7 @@ import { useEffect } from 'react'; import { useHistory } from 'react-router-dom'; -import { MAPPING_ERROR_ROUTE } from '../../common/constants'; +import { MAPPING_ERROR_ROUTE } from '../../../common/constants'; interface EsBadRequestError { body?: { diff --git a/x-pack/plugins/synthetics/public/hooks/use_monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_monitor.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_monitor.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_overview_filter_check.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_overview_filter_check.test.tsx diff --git a/x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_overview_filter_check.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_overview_filter_check.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_overview_filter_check.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_search_text.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_search_text.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_search_text.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_search_text.ts diff --git a/x-pack/plugins/synthetics/public/hooks/use_selected_filters.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_selected_filters.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_selected_filters.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_selected_filters.test.tsx diff --git a/x-pack/plugins/synthetics/public/hooks/use_selected_filters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_selected_filters.ts similarity index 97% rename from x-pack/plugins/synthetics/public/hooks/use_selected_filters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_selected_filters.ts index b10760aa85ed3..03904a2d67421 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_selected_filters.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_selected_filters.ts @@ -9,7 +9,7 @@ import { useMemo } from 'react'; import { useRouteMatch } from 'react-router-dom'; import { useGetUrlParams } from './use_url_params'; import { filterLabels } from '../components/overview/filter_group/translations'; -import { FILTER_FIELDS, MONITOR_ROUTE } from '../../common/constants'; +import { FILTER_FIELDS, MONITOR_ROUTE } from '../../../common/constants'; import { parseFiltersMap } from './use_filter_update'; type FilterType = string[]; diff --git a/x-pack/plugins/synthetics/public/hooks/use_telemetry.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_telemetry.ts similarity index 96% rename from x-pack/plugins/synthetics/public/hooks/use_telemetry.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_telemetry.ts index d6e1a3ae28516..78062bb1ff7eb 100644 --- a/x-pack/plugins/synthetics/public/hooks/use_telemetry.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_telemetry.ts @@ -8,7 +8,7 @@ import { useEffect } from 'react'; import { useGetUrlParams } from './use_url_params'; import { apiService } from '../state/api/utils'; -import { API_URLS } from '../../common/constants'; +import { API_URLS } from '../../../common/constants'; export enum UptimePage { Overview = 'Overview', diff --git a/x-pack/plugins/synthetics/public/hooks/use_url_params.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_url_params.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_url_params.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_url_params.test.tsx diff --git a/x-pack/plugins/synthetics/public/hooks/use_url_params.ts b/x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_url_params.ts similarity index 100% rename from x-pack/plugins/synthetics/public/hooks/use_url_params.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/hooks/use_url_params.ts diff --git a/x-pack/plugins/synthetics/public/lib/__mocks__/screenshot_ref.mock.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/screenshot_ref.mock.ts similarity index 93% rename from x-pack/plugins/synthetics/public/lib/__mocks__/screenshot_ref.mock.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/screenshot_ref.mock.ts index a95aa77371b23..c812a9c67b38d 100644 --- a/x-pack/plugins/synthetics/public/lib/__mocks__/screenshot_ref.mock.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/screenshot_ref.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ScreenshotRefImageData } from '../../../common/runtime_types'; +import { ScreenshotRefImageData } from '../../../../common/runtime_types'; export const mockRef: ScreenshotRefImageData = { maxSteps: 1, diff --git a/x-pack/plugins/synthetics/public/lib/__mocks__/uptime_plugin_start_mock.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/uptime_plugin_start_mock.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/__mocks__/uptime_plugin_start_mock.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/uptime_plugin_start_mock.ts diff --git a/x-pack/plugins/synthetics/public/lib/__mocks__/uptime_store.mock.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/uptime_store.mock.ts similarity index 94% rename from x-pack/plugins/synthetics/public/lib/__mocks__/uptime_store.mock.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/uptime_store.mock.ts index 01a11fd809fe8..18a8885b1dcdb 100644 --- a/x-pack/plugins/synthetics/public/lib/__mocks__/uptime_store.mock.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/uptime_store.mock.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants'; -import { DEFAULT_THROTTLING } from '../../../common/runtime_types'; +import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../common/constants'; +import { DEFAULT_THROTTLING } from '../../../../common/runtime_types'; import { AppState } from '../../state'; /** diff --git a/x-pack/plugins/synthetics/public/lib/__mocks__/use_composite_image.mock.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/use_composite_image.mock.ts similarity index 86% rename from x-pack/plugins/synthetics/public/lib/__mocks__/use_composite_image.mock.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/use_composite_image.mock.ts index c4ab83ae6ee5d..64bc0776b8207 100644 --- a/x-pack/plugins/synthetics/public/lib/__mocks__/use_composite_image.mock.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/use_composite_image.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ScreenshotRefImageData } from '../../../common/runtime_types/ping/synthetics'; +import { ScreenshotRefImageData } from '../../../../common/runtime_types/ping/synthetics'; import * as composeScreenshotImages from '../../hooks/use_composite_image'; jest diff --git a/x-pack/plugins/synthetics/public/lib/__mocks__/ut_router_history.mock.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/ut_router_history.mock.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/__mocks__/ut_router_history.mock.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/__mocks__/ut_router_history.mock.ts diff --git a/x-pack/plugins/synthetics/public/lib/adapters/framework/capabilities_adapter.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/adapters/framework/capabilities_adapter.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/adapters/framework/capabilities_adapter.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/adapters/framework/capabilities_adapter.ts diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/alert_messages.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/alert_messages.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/lib/alert_types/alert_messages.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/alert_messages.tsx diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/common.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/common.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/alert_types/common.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/common.ts diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/duration_anomaly.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/duration_anomaly.tsx similarity index 86% rename from x-pack/plugins/synthetics/public/lib/alert_types/duration_anomaly.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/duration_anomaly.tsx index 79b2b28652497..c866ca4c76956 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/duration_anomaly.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/duration_anomaly.tsx @@ -12,9 +12,9 @@ import { ALERT_END, ALERT_STATUS, ALERT_STATUS_ACTIVE, ALERT_REASON } from '@kbn import { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public'; import { AlertTypeInitializer } from '.'; -import { getMonitorRouteFromMonitorId } from '../../../common/utils/get_monitor_url'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; -import { DurationAnomalyTranslations } from '../../../common/translations'; +import { getMonitorRouteFromMonitorId } from '../../../../common/utils/get_monitor_url'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; +import { DurationAnomalyTranslations } from '../../../../common/translations'; const { defaultActionMessage, description } = DurationAnomalyTranslations; const DurationAnomalyAlert = React.lazy(() => import('./lazy_wrapper/duration_anomaly')); diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/index.ts similarity index 95% rename from x-pack/plugins/synthetics/public/lib/alert_types/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/index.ts index 7217e0a083e6b..a4eef4c4b19b2 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/index.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/index.ts @@ -11,7 +11,7 @@ import { RuleTypeModel } from '@kbn/triggers-actions-ui-plugin/public'; import { initMonitorStatusAlertType } from './monitor_status'; import { initTlsAlertType } from './tls'; import { initTlsLegacyAlertType } from './tls_legacy'; -import { ClientPluginsStart } from '../../apps/plugin'; +import { ClientPluginsStart } from '../../../plugin'; import { initDurationAnomalyAlertType } from './duration_anomaly'; export type AlertTypeInitializer = (dependenies: { diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx index bb1f84a45114d..44c10f615543e 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/duration_anomaly.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/duration_anomaly.tsx @@ -11,7 +11,7 @@ import { CoreStart } from '@kbn/core/public'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { store } from '../../../state'; import { AnomalyAlertComponent } from '../../../components/overview/alerts/anomaly_alert/anomaly_alert'; -import { ClientPluginsStart } from '../../../apps/plugin'; +import { ClientPluginsStart } from '../../../../plugin'; import { kibanaService } from '../../../state/kibana_service'; interface Props { diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx similarity index 95% rename from x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx index 10aa71fa533e3..dd41ab29ed080 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/monitor_status.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/monitor_status.tsx @@ -10,7 +10,7 @@ import { Provider as ReduxProvider } from 'react-redux'; import { CoreStart } from '@kbn/core/public'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { store } from '../../../state'; -import { ClientPluginsStart } from '../../../apps/plugin'; +import { ClientPluginsStart } from '../../../../plugin'; import { kibanaService } from '../../../state/kibana_service'; import { AlertMonitorStatus } from '../../../components/overview/alerts/alerts_containers/alert_monitor_status'; import { UptimeDataViewContextProvider } from '../../../contexts/uptime_data_view_context'; diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/tls_alert.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx similarity index 94% rename from x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/tls_alert.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx index f4136a079c8b0..2d1b8c9898475 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/tls_alert.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/tls_alert.tsx @@ -10,7 +10,7 @@ import { Provider as ReduxProvider } from 'react-redux'; import { CoreStart } from '@kbn/core/public'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { store } from '../../../state'; -import { ClientPluginsStart } from '../../../apps/plugin'; +import { ClientPluginsStart } from '../../../../plugin'; import { AlertTls } from '../../../components/overview/alerts/alerts_containers/alert_tls'; import { kibanaService } from '../../../state/kibana_service'; diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/validate_monitor_status.ts similarity index 97% rename from x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/validate_monitor_status.ts index 881afb0d8eb52..68e88fdd8bf86 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/lazy_wrapper/validate_monitor_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/lazy_wrapper/validate_monitor_status.ts @@ -12,7 +12,7 @@ import { AtomicStatusCheckParamsType, MonitorAvailabilityType, StatusCheckParamsType, -} from '../../../../common/runtime_types/alerts'; +} from '../../../../../common/runtime_types/alerts'; export function validateMonitorStatusParams(ruleParams: any): ValidationResult { const errors: Record = {}; diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/monitor_status.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/monitor_status.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/monitor_status.tsx similarity index 89% rename from x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/monitor_status.tsx index 99d8e22f11cdb..0361e6408e43b 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/monitor_status.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/monitor_status.tsx @@ -19,9 +19,9 @@ import { import { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public'; import { ValidationResult } from '@kbn/triggers-actions-ui-plugin/public'; import { AlertTypeInitializer } from '.'; -import { getMonitorRouteFromMonitorId } from '../../../common/utils/get_monitor_url'; -import { MonitorStatusTranslations } from '../../../common/translations'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; +import { getMonitorRouteFromMonitorId } from '../../../../common/utils/get_monitor_url'; +import { MonitorStatusTranslations } from '../../../../common/translations'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; const { defaultActionMessage, description } = MonitorStatusTranslations; diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/tls.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/tls.tsx similarity index 85% rename from x-pack/plugins/synthetics/public/lib/alert_types/tls.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/tls.tsx index 1ecfaefaa1797..2c1238028ccf5 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/tls.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/tls.tsx @@ -8,11 +8,11 @@ import React from 'react'; import { ALERT_REASON } from '@kbn/rule-data-utils'; import { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; -import { TlsTranslations } from '../../../common/translations'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; +import { TlsTranslations } from '../../../../common/translations'; import { AlertTypeInitializer } from '.'; -import { CERTIFICATES_ROUTE } from '../../../common/constants/ui'; +import { CERTIFICATES_ROUTE } from '../../../../common/constants/ui'; const { defaultActionMessage, description } = TlsTranslations; const TLSAlert = React.lazy(() => import('./lazy_wrapper/tls_alert')); diff --git a/x-pack/plugins/synthetics/public/lib/alert_types/tls_legacy.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/tls_legacy.tsx similarity index 88% rename from x-pack/plugins/synthetics/public/lib/alert_types/tls_legacy.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/tls_legacy.tsx index cce2e3d011bfa..221bfaeb3375c 100644 --- a/x-pack/plugins/synthetics/public/lib/alert_types/tls_legacy.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/alert_types/tls_legacy.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { RuleTypeModel } from '@kbn/triggers-actions-ui-plugin/public'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; -import { TlsTranslationsLegacy } from '../../../common/translations'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; +import { TlsTranslationsLegacy } from '../../../../common/translations'; import { AlertTypeInitializer } from '.'; const { defaultActionMessage, description } = TlsTranslationsLegacy; diff --git a/x-pack/plugins/synthetics/public/lib/formatting.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/formatting.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/formatting.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/formatting.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/charts/get_chart_date_label.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_chart_date_label.ts similarity index 95% rename from x-pack/plugins/synthetics/public/lib/helper/charts/get_chart_date_label.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_chart_date_label.ts index 4852e6ceade11..f7b8d315577f9 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/charts/get_chart_date_label.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_chart_date_label.ts @@ -7,7 +7,7 @@ import { isWithinCurrentDate } from './is_within_current_date'; import { getLabelFormat } from './get_label_format'; -import { CHART_FORMAT_LIMITS } from '../../../../common/constants'; +import { CHART_FORMAT_LIMITS } from '../../../../../common/constants'; /** * Generates an appropriate date formatting string intended for the y-axis diff --git a/x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_label_format.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_label_format.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_label_format.ts similarity index 95% rename from x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_label_format.ts index 3444e05b59127..298786cebaeb8 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/charts/get_label_format.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/get_label_format.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { CHART_FORMAT_LIMITS } from '../../../../common/constants'; +import { CHART_FORMAT_LIMITS } from '../../../../../common/constants'; const { EIGHT_MINUTES, FOUR_YEARS, THIRTY_SIX_HOURS, THREE_WEEKS, SIX_MONTHS, NINE_DAYS } = CHART_FORMAT_LIMITS; diff --git a/x-pack/plugins/synthetics/public/lib/helper/charts/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/charts/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/index.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/is_within_current_date.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/is_within_current_date.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/is_within_current_date.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/charts/is_within_current_date.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/charts/is_within_current_date.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/compose_screenshot_images.test.ts similarity index 96% rename from x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/compose_screenshot_images.test.ts index 0bf809d4e7a40..c749433bb84e0 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/compose_screenshot_images.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ScreenshotRefImageData } from '../../../common/runtime_types/ping/synthetics'; +import { ScreenshotRefImageData } from '../../../../common/runtime_types/ping/synthetics'; import { composeScreenshotRef } from './compose_screenshot_images'; describe('composeScreenshotRef', () => { diff --git a/x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/compose_screenshot_images.ts similarity index 97% rename from x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/compose_screenshot_images.ts index 60cd248c1487a..86c7a001b95ab 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/compose_screenshot_images.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/compose_screenshot_images.ts @@ -8,7 +8,7 @@ import { isScreenshotBlockDoc, ScreenshotRefImageData, -} from '../../../common/runtime_types/ping/synthetics'; +} from '../../../../common/runtime_types/ping/synthetics'; import { ScreenshotBlockCache } from '../../state/reducers/synthetics'; /** diff --git a/x-pack/plugins/synthetics/public/lib/helper/convert_measurements.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/convert_measurements.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/convert_measurements.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/convert_measurements.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/convert_measurements.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/convert_measurements.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/convert_measurements.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/convert_measurements.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/enzyme_helpers.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/enzyme_helpers.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/enzyme_helpers.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/enzyme_helpers.tsx diff --git a/x-pack/plugins/synthetics/public/lib/helper/get_title.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/get_title.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/get_title.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/get_title.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/helper_with_redux.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/helper_with_redux.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/helper_with_redux.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/helper_with_redux.tsx diff --git a/x-pack/plugins/synthetics/public/lib/helper/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/index.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/add_base_path.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/add_base_path.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/add_base_path.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/add_base_path.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/build_href.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/build_href.ts similarity index 95% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/build_href.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/build_href.ts index 491219bae5152..93e08b92fbafc 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/build_href.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/build_href.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Ping } from '../../../../common/runtime_types'; +import { Ping } from '../../../../../common/runtime_types'; /** * Builds URLs to the designated features by extracting values from the provided diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_apm_href.test.ts similarity index 96% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_apm_href.test.ts index db946fb246964..146fc498b3dcc 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_apm_href.test.ts @@ -6,7 +6,7 @@ */ import { getLegacyApmHref } from './get_apm_href'; -import { MonitorSummary, makePing } from '../../../../common/runtime_types'; +import { MonitorSummary, makePing } from '../../../../../common/runtime_types'; describe('getLegacyApmHref', () => { let summary: MonitorSummary; diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_apm_href.ts similarity index 91% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_apm_href.ts index fc5785ceecba1..f05f1ccb2de4f 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_apm_href.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_apm_href.ts @@ -6,7 +6,7 @@ */ import { addBasePath } from './add_base_path'; -import { MonitorSummary } from '../../../../common/runtime_types'; +import { MonitorSummary } from '../../../../../common/runtime_types'; export const getLegacyApmHref = ( summary: MonitorSummary, diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_infra_href.test.ts similarity index 98% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_infra_href.test.ts index 9a7cc6e7940ed..970ac86f3777d 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_infra_href.test.ts @@ -6,7 +6,7 @@ */ import { getInfraContainerHref, getInfraKubernetesHref, getInfraIpHref } from './get_infra_href'; -import { MonitorSummary, makePing, Ping } from '../../../../common/runtime_types'; +import { MonitorSummary, makePing, Ping } from '../../../../../common/runtime_types'; describe('getInfraHref', () => { let summary: MonitorSummary; diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_infra_href.ts similarity index 96% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_infra_href.ts index 1603ef9cf170a..e1cf922983d21 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_infra_href.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_infra_href.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MonitorSummary, Ping } from '../../../../common/runtime_types'; +import { MonitorSummary, Ping } from '../../../../../common/runtime_types'; import { addBasePath } from './add_base_path'; import { buildHref } from './build_href'; diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_logging_href.test.ts similarity index 98% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_logging_href.test.ts index 3c778400fae71..791d19a7949c2 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_logging_href.test.ts @@ -10,7 +10,7 @@ import { getLoggingKubernetesHref, getLoggingIpHref, } from './get_logging_href'; -import { MonitorSummary, makePing } from '../../../../common/runtime_types'; +import { MonitorSummary, makePing } from '../../../../../common/runtime_types'; describe('getLoggingHref', () => { let summary: MonitorSummary; diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_logging_href.ts similarity index 96% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_logging_href.ts index a3e6108b7efe8..947c50f1f0320 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/get_logging_href.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/get_logging_href.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MonitorSummary, Ping } from '../../../../common/runtime_types'; +import { MonitorSummary, Ping } from '../../../../../common/runtime_types'; import { addBasePath } from './add_base_path'; import { buildHref } from './build_href'; diff --git a/x-pack/plugins/synthetics/public/lib/helper/observability_integration/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/observability_integration/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/observability_integration/index.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/parse_search.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/parse_search.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/parse_search.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/parse_search.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/parse_search.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/parse_search.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/parse_search.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/parse_search.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/rtl_helpers.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/rtl_helpers.tsx similarity index 99% rename from x-pack/plugins/synthetics/public/lib/helper/rtl_helpers.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/rtl_helpers.tsx index 913f5e249c688..db55ee3805ef1 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/rtl_helpers.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/rtl_helpers.tsx @@ -31,7 +31,7 @@ import { mockState } from '../__mocks__/uptime_store.mock'; import { MountWithReduxProvider } from './helper_with_redux'; import { AppState } from '../../state'; import { stringifyUrlParams } from './stringify_url_params'; -import { ClientPluginsStart } from '../../apps/plugin'; +import { ClientPluginsStart } from '../../../plugin'; import { UptimeRefreshContextProvider, UptimeStartupPluginsContextProvider } from '../../contexts'; import { kibanaService } from '../../state/kibana_service'; diff --git a/x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/series_has_down_values.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/series_has_down_values.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/series_has_down_values.ts similarity index 85% rename from x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/series_has_down_values.ts index 7090da1430bc5..d5ff1fc4e0715 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/series_has_down_values.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/series_has_down_values.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { HistogramPoint } from '../../../common/runtime_types'; +import { HistogramPoint } from '../../../../common/runtime_types'; export const seriesHasDownValues = (series: HistogramPoint[] | null): boolean => { return series ? series.some((point) => !!point.down) : false; diff --git a/x-pack/plugins/synthetics/public/lib/helper/spy_use_fetcher.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/spy_use_fetcher.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/spy_use_fetcher.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/spy_use_fetcher.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/stringify_url_params.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/stringify_url_params.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/stringify_url_params.ts similarity index 96% rename from x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/stringify_url_params.ts index edfa8e62d6137..2bb5f9a3c13e3 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/stringify_url_params.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/stringify_url_params.ts @@ -7,7 +7,7 @@ import { stringify } from 'query-string'; import { UptimeUrlParams } from './url_params'; -import { CLIENT_DEFAULTS } from '../../../common/constants'; +import { CLIENT_DEFAULTS } from '../../../../common/constants'; const { AUTOREFRESH_INTERVAL, diff --git a/x-pack/plugins/synthetics/public/lib/helper/test_helpers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/test_helpers.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/test_helpers.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/test_helpers.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/__snapshots__/get_supported_url_params.test.ts.snap diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/get_supported_url_params.test.ts similarity index 97% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/get_supported_url_params.test.ts index 4771d864e0bf8..14b1ce22f9bee 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/get_supported_url_params.test.ts @@ -7,7 +7,7 @@ import DateMath from '@kbn/datemath'; import { getSupportedUrlParams } from './get_supported_url_params'; -import { CLIENT_DEFAULTS } from '../../../../common/constants'; +import { CLIENT_DEFAULTS } from '../../../../../common/constants'; describe('getSupportedUrlParams', () => { let dateMathSpy: any; diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/get_supported_url_params.ts similarity index 97% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/get_supported_url_params.ts index 727f18b39c764..703b2257ee176 100644 --- a/x-pack/plugins/synthetics/public/lib/helper/url_params/get_supported_url_params.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/get_supported_url_params.ts @@ -7,7 +7,7 @@ import { parseIsPaused } from './parse_is_paused'; import { parseUrlInt } from './parse_url_int'; -import { CLIENT_DEFAULTS } from '../../../../common/constants'; +import { CLIENT_DEFAULTS } from '../../../../../common/constants'; import { parseAbsoluteDate } from './parse_absolute_date'; export interface UptimeUrlParams { diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/index.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_absolute_date.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_absolute_date.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_absolute_date.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/parse_absolute_date.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_absolute_date.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_is_paused.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_is_paused.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_is_paused.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/parse_is_paused.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_is_paused.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_url_int.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_url_int.test.ts diff --git a/x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_url_int.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/helper/url_params/parse_url_int.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/helper/url_params/parse_url_int.ts diff --git a/x-pack/plugins/synthetics/public/lib/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/lib/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/index.ts diff --git a/x-pack/plugins/synthetics/public/badge.ts b/x-pack/plugins/synthetics/public/legacy_uptime/lib/lib.ts similarity index 83% rename from x-pack/plugins/synthetics/public/badge.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/lib/lib.ts index a42eaa58a7943..a846cdeb99fb6 100644 --- a/x-pack/plugins/synthetics/public/badge.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/lib/lib.ts @@ -6,4 +6,4 @@ */ import { ChromeBadge } from '@kbn/core/public'; -export type UMBadge = ChromeBadge | undefined; +export type UMUpdateBadge = (badge?: ChromeBadge) => void; diff --git a/x-pack/plugins/synthetics/public/pages/certificates.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/certificates.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/certificates.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/certificates.test.tsx diff --git a/x-pack/plugins/synthetics/public/pages/certificates.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/certificates.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/certificates.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/certificates.tsx diff --git a/x-pack/plugins/synthetics/public/pages/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/pages/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/pages/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/index.ts diff --git a/x-pack/plugins/synthetics/public/pages/mapping_error.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/mapping_error.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/mapping_error.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/mapping_error.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor.test.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/action_bar_portal_node.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/action_bar_portal_node.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor_management/action_bar_portal_node.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/action_bar_portal_node.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/add_monitor.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/add_monitor.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/pages/monitor_management/add_monitor.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/add_monitor.tsx index 40283f1331086..5979c7ed4767a 100644 --- a/x-pack/plugins/synthetics/public/pages/monitor_management/add_monitor.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/add_monitor.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { useTrackPageview } from '@kbn/observability-plugin/public'; -import { ScheduleUnit } from '../../../common/runtime_types'; +import { ScheduleUnit } from '../../../../common/runtime_types'; import { SyntheticsProviders } from '../../components/fleet_package/contexts'; import { Loader } from '../../components/monitor_management/loader/loader'; import { MonitorConfig } from '../../components/monitor_management/monitor_config/monitor_config'; diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/bottom_bar.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/bottom_bar.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor_management/bottom_bar.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/bottom_bar.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/content.ts b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/content.ts similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor_management/content.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/content.ts diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/edit_monitor.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/edit_monitor.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/pages/monitor_management/edit_monitor.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/edit_monitor.tsx index 5c8c85d7c616d..cb92de595d378 100644 --- a/x-pack/plugins/synthetics/public/pages/monitor_management/edit_monitor.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/edit_monitor.tsx @@ -8,11 +8,11 @@ import React from 'react'; import { useParams } from 'react-router-dom'; import { useTrackPageview, FETCH_STATUS, useFetcher } from '@kbn/observability-plugin/public'; -import { MonitorFields } from '../../../common/runtime_types'; +import { MonitorFields } from '../../../../common/runtime_types'; import { EditMonitorConfig } from '../../components/monitor_management/edit_monitor_config'; import { Loader } from '../../components/monitor_management/loader/loader'; import { getMonitor } from '../../state/api'; -import { DecryptedSyntheticsMonitorSavedObject } from '../../../common/types'; +import { DecryptedSyntheticsMonitorSavedObject } from '../../../../common/types'; import { useLocations } from '../../components/monitor_management/hooks/use_locations'; import { useMonitorManagementBreadcrumbs } from './use_monitor_management_breadcrumbs'; import { diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/monitor_management.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/pages/monitor_management/monitor_management.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx index 52453e66d858a..97013b9905187 100644 --- a/x-pack/plugins/synthetics/public/pages/monitor_management/monitor_management.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { useDispatch, useSelector } from 'react-redux'; import { EuiCallOut, EuiButton, EuiSpacer, EuiLink } from '@elastic/eui'; import { useTrackPageview } from '@kbn/observability-plugin/public'; -import { ConfigKey } from '../../../common/runtime_types'; +import { ConfigKey } from '../../../../common/runtime_types'; import { getMonitors } from '../../state/actions'; import { monitorManagementListSelector } from '../../state/selectors'; import { useMonitorManagementBreadcrumbs } from './use_monitor_management_breadcrumbs'; diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.test.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/monitor_management/service_allowed_wrapper.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.tsx diff --git a/x-pack/plugins/synthetics/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/use_monitor_management_breadcrumbs.tsx similarity index 92% rename from x-pack/plugins/synthetics/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/use_monitor_management_breadcrumbs.tsx index 03d07a122c730..2c7a4fe7a8259 100644 --- a/x-pack/plugins/synthetics/public/pages/monitor_management/use_monitor_management_breadcrumbs.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/use_monitor_management_breadcrumbs.tsx @@ -7,8 +7,8 @@ import { i18n } from '@kbn/i18n'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; -import { MONITOR_MANAGEMENT_ROUTE } from '../../../common/constants'; -import { PLUGIN } from '../../../common/constants/plugin'; +import { MONITOR_MANAGEMENT_ROUTE } from '../../../../common/constants'; +import { PLUGIN } from '../../../../common/constants/plugin'; export const useMonitorManagementBreadcrumbs = ({ isAddMonitor, diff --git a/x-pack/plugins/synthetics/public/pages/not_found.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/not_found.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/not_found.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/not_found.test.tsx diff --git a/x-pack/plugins/synthetics/public/pages/not_found.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/not_found.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/not_found.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/not_found.tsx diff --git a/x-pack/plugins/synthetics/public/pages/overview.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/overview.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/overview.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/overview.test.tsx diff --git a/x-pack/plugins/synthetics/public/pages/overview.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/overview.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/overview.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/overview.tsx diff --git a/x-pack/plugins/synthetics/public/pages/settings.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/settings.test.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/settings.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/settings.test.tsx diff --git a/x-pack/plugins/synthetics/public/pages/settings.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/settings.tsx similarity index 97% rename from x-pack/plugins/synthetics/public/pages/settings.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/settings.tsx index a12b615bb703d..6726a10ab8747 100644 --- a/x-pack/plugins/synthetics/public/pages/settings.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/settings.tsx @@ -11,7 +11,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { selectDynamicSettings } from '../state/selectors'; import { getDynamicSettings, setDynamicSettings } from '../state/actions/dynamic_settings'; -import { DynamicSettings } from '../../common/runtime_types'; +import { DynamicSettings } from '../../../common/runtime_types'; import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; import { IndicesForm } from '../components/settings/indices_form'; import { @@ -23,7 +23,7 @@ import * as Translations from './translations'; import { VALUE_MUST_BE_GREATER_THAN_ZERO, VALUE_MUST_BE_AN_INTEGER, -} from '../../common/translations'; +} from '../../../common/translations'; import { AlertDefaultsForm } from '../components/settings/alert_defaults_form'; import { SettingsActionBarPortal } from '../components/settings/settings_bottom_bar'; import { useSettingsErrors } from '../components/settings/use_settings_errors'; diff --git a/x-pack/plugins/synthetics/public/pages/synthetics/checks_navigation.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx similarity index 96% rename from x-pack/plugins/synthetics/public/pages/synthetics/checks_navigation.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx index 6dcef302506e4..ee33191c3799e 100644 --- a/x-pack/plugins/synthetics/public/pages/synthetics/checks_navigation.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx @@ -10,7 +10,7 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui import { FormattedMessage } from '@kbn/i18n-react'; import { useHistory } from 'react-router-dom'; import moment from 'moment'; -import { SyntheticsJourneyApiResponse } from '../../../common/runtime_types/ping'; +import { SyntheticsJourneyApiResponse } from '../../../../common/runtime_types/ping'; import { getShortTimeStamp } from '../../components/overview/monitor_list/columns/monitor_status_column'; import { useBreakpoints } from '../../hooks/use_breakpoints'; diff --git a/x-pack/plugins/synthetics/public/pages/synthetics/step_detail_page.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/step_detail_page.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/pages/synthetics/step_detail_page.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/step_detail_page.tsx index 2ded527f7bb57..7caa521e434f4 100644 --- a/x-pack/plugins/synthetics/public/pages/synthetics/step_detail_page.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/step_detail_page.tsx @@ -14,7 +14,7 @@ import { useInitApp } from '../../hooks/use_init_app'; import { StepDetailContainer } from '../../components/monitor/synthetics/step_detail/step_detail_container'; import { journeySelector } from '../../state/selectors'; import { JourneyState } from '../../state/reducers/journey'; -import { JourneyStep } from '../../../common/runtime_types/ping/synthetics'; +import { JourneyStep } from '../../../../common/runtime_types/ping/synthetics'; import { StepPageNavigation } from '../../components/monitor/synthetics/step_detail/step_page_nav'; import { StepPageTitleContent } from '../../components/monitor/synthetics/step_detail/step_page_title'; import { getJourneySteps } from '../../state/actions/journey'; diff --git a/x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/synthetics_checks.test.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.test.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/synthetics_checks.test.tsx index 290cdd453bd3c..312c10886c572 100644 --- a/x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.test.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/synthetics_checks.test.tsx @@ -14,7 +14,7 @@ import { } from './synthetics_checks'; import { fetchJourneySteps } from '../../state/api/journey'; import { createMemoryHistory } from 'history'; -import { SYNTHETIC_CHECK_STEPS_ROUTE } from '../../../common/constants'; +import { SYNTHETIC_CHECK_STEPS_ROUTE } from '../../../../common/constants'; jest.mock('../../state/api/journey', () => ({ fetchJourneySteps: jest.fn(), diff --git a/x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/synthetics_checks.tsx similarity index 100% rename from x-pack/plugins/synthetics/public/pages/synthetics/synthetics_checks.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/synthetics_checks.tsx diff --git a/x-pack/plugins/synthetics/public/pages/translations.ts b/x-pack/plugins/synthetics/public/legacy_uptime/pages/translations.ts similarity index 100% rename from x-pack/plugins/synthetics/public/pages/translations.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/pages/translations.ts diff --git a/x-pack/plugins/synthetics/public/routes.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/routes.tsx similarity index 98% rename from x-pack/plugins/synthetics/public/routes.tsx rename to x-pack/plugins/synthetics/public/legacy_uptime/routes.tsx index 0c43b99467f3b..1b8706ad4cb00 100644 --- a/x-pack/plugins/synthetics/public/routes.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/routes.tsx @@ -23,7 +23,7 @@ import { SETTINGS_ROUTE, STEP_DETAIL_ROUTE, SYNTHETIC_CHECK_STEPS_ROUTE, -} from '../common/constants'; +} from '../../common/constants'; import { MappingErrorPage, MonitorPage, @@ -53,7 +53,7 @@ import { StepDetailPageHeader, StepDetailPageRightSideItem, } from './pages/synthetics/step_detail_page'; -import { UptimePageTemplateComponent } from './apps/uptime_page_template'; +import { UptimePageTemplateComponent } from './app/uptime_page_template'; import { apiService } from './state/api/utils'; import { AddMonitorBtn } from './components/monitor_management/add_monitor_btn'; import { SettingsBottomBar } from './components/settings/settings_bottom_bar'; diff --git a/x-pack/plugins/synthetics/public/state/actions/alerts.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/alerts.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/alerts.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/alerts.ts diff --git a/x-pack/plugins/synthetics/public/state/actions/dynamic_settings.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/dynamic_settings.ts similarity index 92% rename from x-pack/plugins/synthetics/public/state/actions/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/dynamic_settings.ts index 7b7939688010f..6be8cc4547559 100644 --- a/x-pack/plugins/synthetics/public/state/actions/dynamic_settings.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/dynamic_settings.ts @@ -6,7 +6,7 @@ */ import { createAction } from 'redux-actions'; -import { DynamicSettings } from '../../../common/runtime_types'; +import { DynamicSettings } from '../../../../common/runtime_types'; export const getDynamicSettings = createAction('GET_DYNAMIC_SETTINGS'); export const getDynamicSettingsSuccess = createAction( diff --git a/x-pack/plugins/synthetics/public/state/actions/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/index.ts diff --git a/x-pack/plugins/synthetics/public/state/actions/index_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/index_status.ts similarity index 84% rename from x-pack/plugins/synthetics/public/state/actions/index_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/index_status.ts index 306565c1f507f..2de91a82c6762 100644 --- a/x-pack/plugins/synthetics/public/state/actions/index_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/index_status.ts @@ -6,6 +6,6 @@ */ import { createAsyncAction } from './utils'; -import { StatesIndexStatus } from '../../../common/runtime_types'; +import { StatesIndexStatus } from '../../../../common/runtime_types'; export const indexStatusAction = createAsyncAction('GET INDEX STATUS'); diff --git a/x-pack/plugins/synthetics/public/state/actions/journey.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/journey.ts similarity index 91% rename from x-pack/plugins/synthetics/public/state/actions/journey.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/journey.ts index bc03c443331c1..c9833ee25f95d 100644 --- a/x-pack/plugins/synthetics/public/state/actions/journey.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/journey.ts @@ -6,7 +6,7 @@ */ import { createAction } from 'redux-actions'; -import { SyntheticsJourneyApiResponse } from '../../../common/runtime_types'; +import { SyntheticsJourneyApiResponse } from '../../../../common/runtime_types'; export interface FetchJourneyStepsParams { checkGroup: string; diff --git a/x-pack/plugins/synthetics/public/state/actions/ml_anomaly.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ml_anomaly.ts diff --git a/x-pack/plugins/synthetics/public/state/actions/monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor.ts similarity index 89% rename from x-pack/plugins/synthetics/public/state/actions/monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor.ts index f9dcd4bd57538..5fd74737d96a7 100644 --- a/x-pack/plugins/synthetics/public/state/actions/monitor.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor.ts @@ -7,8 +7,8 @@ import { createAction } from 'redux-actions'; import { MonitorDetailsActionPayload } from './types'; -import { PingError } from '../../../common/runtime_types'; -import { MonitorLocations } from '../../../common/runtime_types'; +import { PingError } from '../../../../common/runtime_types'; +import { MonitorLocations } from '../../../../common/runtime_types'; import { QueryParams } from './types'; import { createAsyncAction } from './utils'; diff --git a/x-pack/plugins/synthetics/public/state/actions/monitor_duration.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_duration.ts similarity index 92% rename from x-pack/plugins/synthetics/public/state/actions/monitor_duration.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_duration.ts index 1dd88c663cec5..52583e79f9ec3 100644 --- a/x-pack/plugins/synthetics/public/state/actions/monitor_duration.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_duration.ts @@ -8,7 +8,7 @@ import { createAction } from 'redux-actions'; import { IHttpFetchError } from '@kbn/core/public'; import { QueryParams } from './types'; -import { MonitorDurationResult } from '../../../common/types'; +import { MonitorDurationResult } from '../../../../common/types'; type MonitorQueryParams = QueryParams & { monitorId: string }; diff --git a/x-pack/plugins/synthetics/public/state/actions/monitor_list.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_list.ts similarity index 91% rename from x-pack/plugins/synthetics/public/state/actions/monitor_list.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_list.ts index b86853dcfbefe..c123ca95a5acd 100644 --- a/x-pack/plugins/synthetics/public/state/actions/monitor_list.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_list.ts @@ -6,7 +6,10 @@ */ import { createAction } from 'redux-actions'; -import { FetchMonitorStatesQueryArgs, MonitorSummariesResult } from '../../../common/runtime_types'; +import { + FetchMonitorStatesQueryArgs, + MonitorSummariesResult, +} from '../../../../common/runtime_types'; import { createAsyncAction } from './utils'; import { TestNowResponse } from '../api'; diff --git a/x-pack/plugins/synthetics/public/state/actions/monitor_management.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_management.ts similarity index 94% rename from x-pack/plugins/synthetics/public/state/actions/monitor_management.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_management.ts index 278f8fe9a4b99..79bec6f3e1b65 100644 --- a/x-pack/plugins/synthetics/public/state/actions/monitor_management.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_management.ts @@ -11,9 +11,9 @@ import { ServiceLocations, ThrottlingOptions, FetchMonitorManagementListQueryArgs, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { createAsyncAction } from './utils'; -import { SyntheticsServiceAllowed } from '../../../common/types'; +import { SyntheticsServiceAllowed } from '../../../../common/types'; export const getMonitors = createAction( 'GET_MONITOR_MANAGEMENT_LIST' diff --git a/x-pack/plugins/synthetics/public/state/actions/monitor_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_status.ts similarity index 91% rename from x-pack/plugins/synthetics/public/state/actions/monitor_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_status.ts index 3928cd539a5c0..e9fcf67a7b678 100644 --- a/x-pack/plugins/synthetics/public/state/actions/monitor_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/monitor_status.ts @@ -7,7 +7,7 @@ import { createAction } from 'redux-actions'; import { QueryParams } from './types'; -import { Ping } from '../../../common/runtime_types'; +import { Ping } from '../../../../common/runtime_types'; export const getMonitorStatusAction = createAction('GET_MONITOR_STATUS'); export const getMonitorStatusActionSuccess = createAction('GET_MONITOR_STATUS_SUCCESS'); diff --git a/x-pack/plugins/synthetics/public/state/actions/network_events.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/network_events.ts similarity index 91% rename from x-pack/plugins/synthetics/public/state/actions/network_events.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/network_events.ts index f078888d6eae8..1467289abe1e8 100644 --- a/x-pack/plugins/synthetics/public/state/actions/network_events.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/network_events.ts @@ -6,7 +6,7 @@ */ import { createAction } from 'redux-actions'; -import { SyntheticsNetworkEventsApiResponse } from '../../../common/runtime_types'; +import { SyntheticsNetworkEventsApiResponse } from '../../../../common/runtime_types'; export interface FetchNetworkEventsParams { checkGroup: string; diff --git a/x-pack/plugins/synthetics/public/state/actions/ping.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ping.ts similarity index 95% rename from x-pack/plugins/synthetics/public/state/actions/ping.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ping.ts index 6b997ba184b0b..73be085a86e03 100644 --- a/x-pack/plugins/synthetics/public/state/actions/ping.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ping.ts @@ -11,7 +11,7 @@ import { HistogramResult, PingsResponse, GetPingsParams, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { createAsyncAction } from './utils'; export const clearPings = createAction('CLEAR PINGS'); diff --git a/x-pack/plugins/synthetics/public/state/actions/selected_filters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/selected_filters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/selected_filters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/selected_filters.ts diff --git a/x-pack/plugins/synthetics/public/state/actions/snapshot.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/snapshot.ts similarity index 88% rename from x-pack/plugins/synthetics/public/state/actions/snapshot.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/snapshot.ts index b1ff299600943..a495c917223a2 100644 --- a/x-pack/plugins/synthetics/public/state/actions/snapshot.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/snapshot.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Snapshot } from '../../../common/runtime_types'; +import { Snapshot } from '../../../../common/runtime_types'; import { createAsyncAction } from './utils'; import { SnapShotQueryParams } from '../api'; diff --git a/x-pack/plugins/synthetics/public/state/actions/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/types.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/types.ts diff --git a/x-pack/plugins/synthetics/public/state/actions/ui.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ui.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/ui.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/ui.ts diff --git a/x-pack/plugins/synthetics/public/state/actions/utils.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/actions/utils.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/actions/utils.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/actions/utils.ts diff --git a/x-pack/plugins/synthetics/public/state/alerts/alerts.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/alerts/alerts.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/alerts/alerts.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/alerts/alerts.ts diff --git a/x-pack/plugins/synthetics/public/state/api/__snapshots__/snapshot.test.ts.snap b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/__snapshots__/snapshot.test.ts.snap similarity index 100% rename from x-pack/plugins/synthetics/public/state/api/__snapshots__/snapshot.test.ts.snap rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/__snapshots__/snapshot.test.ts.snap diff --git a/x-pack/plugins/synthetics/public/state/api/alert_actions.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/alert_actions.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/api/alert_actions.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/alert_actions.test.ts diff --git a/x-pack/plugins/synthetics/public/state/api/alert_actions.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/alert_actions.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/api/alert_actions.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/alert_actions.ts index 2a76239ce183a..eabfe42691e8d 100644 --- a/x-pack/plugins/synthetics/public/state/api/alert_actions.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/alert_actions.ts @@ -18,11 +18,11 @@ import { // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '@kbn/actions-plugin/server'; import { NewAlertParams } from './alerts'; -import { ACTION_GROUP_DEFINITIONS } from '../../../common/constants/alerts'; -import { MonitorStatusTranslations } from '../../../common/translations'; +import { ACTION_GROUP_DEFINITIONS } from '../../../../common/constants/alerts'; +import { MonitorStatusTranslations } from '../../../../common/translations'; import { ActionTypeId } from '../../components/settings/types'; -import { Ping } from '../../../common/runtime_types/ping'; -import { DefaultEmail } from '../../../common/runtime_types'; +import { Ping } from '../../../../common/runtime_types/ping'; +import { DefaultEmail } from '../../../../common/runtime_types'; export const SLACK_ACTION_ID: ActionTypeId = '.slack'; export const PAGER_DUTY_ACTION_ID: ActionTypeId = '.pagerduty'; diff --git a/x-pack/plugins/synthetics/public/state/api/alerts.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/alerts.ts similarity index 93% rename from x-pack/plugins/synthetics/public/state/api/alerts.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/alerts.ts index 1b97422cc67a5..2d5d47578a57b 100644 --- a/x-pack/plugins/synthetics/public/state/api/alerts.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/alerts.ts @@ -7,17 +7,17 @@ import type { ActionType, AsApiContract, Rule } from '@kbn/triggers-actions-ui-plugin/public'; import { RuleTypeParams } from '@kbn/alerting-plugin/common'; -import { CLIENT_ALERT_TYPES } from '../../../common/constants/alerts'; +import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; import { apiService } from './utils'; import { ActionConnector } from '../alerts/alerts'; import { AlertsResult, MonitorIdParam } from '../actions/types'; -import { API_URLS } from '../../../common/constants'; -import { AtomicStatusCheckParams } from '../../../common/runtime_types/alerts'; +import { API_URLS } from '../../../../common/constants'; +import { AtomicStatusCheckParams } from '../../../../common/runtime_types/alerts'; import { populateAlertActions, RuleAction } from './alert_actions'; -import { Ping } from '../../../common/runtime_types/ping'; -import { DefaultEmail } from '../../../common/runtime_types'; +import { Ping } from '../../../../common/runtime_types/ping'; +import { DefaultEmail } from '../../../../common/runtime_types'; const UPTIME_AUTO_ALERT = 'UPTIME_AUTO'; diff --git a/x-pack/plugins/synthetics/public/state/api/dynamic_settings.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/dynamic_settings.ts similarity index 89% rename from x-pack/plugins/synthetics/public/state/api/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/dynamic_settings.ts index a7bacfbba3462..e3c14adf1de74 100644 --- a/x-pack/plugins/synthetics/public/state/api/dynamic_settings.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/dynamic_settings.ts @@ -10,9 +10,9 @@ import { DynamicSettings, DynamicSettingsSaveResponse, DynamicSettingsSaveType, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; const apiPath = API_URLS.DYNAMIC_SETTINGS; diff --git a/x-pack/plugins/synthetics/public/state/api/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/api/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/index.ts diff --git a/x-pack/plugins/synthetics/public/state/api/index_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/index_status.ts similarity index 85% rename from x-pack/plugins/synthetics/public/state/api/index_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/index_status.ts index c6d8f96403eeb..857915deb9023 100644 --- a/x-pack/plugins/synthetics/public/state/api/index_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/index_status.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { API_URLS } from '../../../common/constants'; -import { StatesIndexStatus, StatesIndexStatusType } from '../../../common/runtime_types'; +import { API_URLS } from '../../../../common/constants'; +import { StatesIndexStatus, StatesIndexStatusType } from '../../../../common/runtime_types'; import { apiService } from './utils'; export const fetchIndexStatus = async (): Promise => { diff --git a/x-pack/plugins/synthetics/public/state/api/journey.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/journey.ts similarity index 92% rename from x-pack/plugins/synthetics/public/state/api/journey.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/journey.ts index 958ef5e474fee..64a156eb26ed5 100644 --- a/x-pack/plugins/synthetics/public/state/api/journey.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/journey.ts @@ -7,7 +7,7 @@ import { apiService } from './utils'; import { FetchJourneyStepsParams } from '../actions/journey'; -import { Ping, PingType } from '../../../common/runtime_types/ping/ping'; +import { Ping, PingType } from '../../../../common/runtime_types/ping/ping'; import { FailedStepsApiResponse, FailedStepsApiResponseType, @@ -16,8 +16,8 @@ import { ScreenshotRefImageData, SyntheticsJourneyApiResponse, SyntheticsJourneyApiResponseType, -} from '../../../common/runtime_types/ping/synthetics'; -import { API_URLS } from '../../../common/constants'; +} from '../../../../common/runtime_types/ping/synthetics'; +import { API_URLS } from '../../../../common/constants'; export async function fetchScreenshotBlockSet(params: string[]): Promise { return apiService.post(API_URLS.JOURNEY_SCREENSHOT_BLOCKS, { diff --git a/x-pack/plugins/synthetics/public/state/api/ml_anomaly.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/ml_anomaly.ts similarity index 95% rename from x-pack/plugins/synthetics/public/state/api/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/ml_anomaly.ts index e7655f37d3f01..18ce74d9823bb 100644 --- a/x-pack/plugins/synthetics/public/state/api/ml_anomaly.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/ml_anomaly.ts @@ -14,14 +14,14 @@ import { import { extractErrorMessage } from '@kbn/ml-plugin/common'; import { apiService } from './utils'; import { AnomalyRecords, AnomalyRecordsParams } from '../actions'; -import { API_URLS, ML_MODULE_ID } from '../../../common/constants'; +import { API_URLS, ML_MODULE_ID } from '../../../../common/constants'; import { CreateMLJobSuccess, DeleteJobResults, HeartbeatIndicesParam, MonitorIdParam, } from '../actions/types'; -import { getJobPrefix, getMLJobId } from '../../../common/lib/ml'; +import { getJobPrefix, getMLJobId } from '../../../../common/lib/ml'; export const getMLCapabilities = async (): Promise => { return await apiService.get(API_URLS.ML_CAPABILITIES); diff --git a/x-pack/plugins/synthetics/public/state/api/monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor.ts similarity index 92% rename from x-pack/plugins/synthetics/public/state/api/monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor.ts index ef04b38f37469..5dfb200444134 100644 --- a/x-pack/plugins/synthetics/public/state/api/monitor.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor.ts @@ -6,10 +6,10 @@ */ import { BaseParams } from './types'; -import { MonitorDetailsType, MonitorLocationsType } from '../../../common/runtime_types'; +import { MonitorDetailsType, MonitorLocationsType } from '../../../../common/runtime_types'; import { QueryParams } from '../actions/types'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; interface ApiRequest { monitorId: string; diff --git a/x-pack/plugins/synthetics/public/state/api/monitor_duration.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_duration.ts similarity index 91% rename from x-pack/plugins/synthetics/public/state/api/monitor_duration.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_duration.ts index c8010e18d0868..3fc046170757c 100644 --- a/x-pack/plugins/synthetics/public/state/api/monitor_duration.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_duration.ts @@ -7,7 +7,7 @@ import { BaseParams } from './types'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; export const fetchMonitorDuration = async ({ monitorId, dateStart, dateEnd }: BaseParams) => { const queryParams = { diff --git a/x-pack/plugins/synthetics/public/state/api/monitor_list.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_list.ts similarity index 85% rename from x-pack/plugins/synthetics/public/state/api/monitor_list.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_list.ts index 860a46d3e3abc..e328132abe465 100644 --- a/x-pack/plugins/synthetics/public/state/api/monitor_list.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_list.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; import { apiService } from './utils'; import { FetchMonitorStatesQueryArgs, MonitorSummariesResult, MonitorSummariesResultType, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; export const fetchMonitorList = async ( params: FetchMonitorStatesQueryArgs diff --git a/x-pack/plugins/synthetics/public/state/api/monitor_management.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_management.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/api/monitor_management.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_management.ts index a776d33b8147b..c38fff649048b 100644 --- a/x-pack/plugins/synthetics/public/state/api/monitor_management.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_management.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; import { FetchMonitorManagementListQueryArgs, MonitorManagementListResultCodec, @@ -20,11 +20,11 @@ import { ThrottlingOptions, Locations, SyntheticsMonitorSchedule, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { DecryptedSyntheticsMonitorSavedObject, SyntheticsServiceAllowed, -} from '../../../common/types'; +} from '../../../../common/types'; import { apiService } from './utils'; export const setMonitor = async ({ diff --git a/x-pack/plugins/synthetics/public/state/api/monitor_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_status.ts similarity index 84% rename from x-pack/plugins/synthetics/public/state/api/monitor_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_status.ts index 9c4e7e3eaf5d3..10534c18b7d38 100644 --- a/x-pack/plugins/synthetics/public/state/api/monitor_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/monitor_status.ts @@ -6,8 +6,8 @@ */ import { QueryParams } from '../actions/types'; -import { Ping } from '../../../common/runtime_types'; -import { API_URLS } from '../../../common/constants'; +import { Ping } from '../../../../common/runtime_types'; +import { API_URLS } from '../../../../common/constants'; import { apiService } from './utils'; export const fetchMonitorStatus = async ({ diff --git a/x-pack/plugins/synthetics/public/state/api/network_events.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/network_events.ts similarity index 89% rename from x-pack/plugins/synthetics/public/state/api/network_events.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/network_events.ts index d9b3d518444a3..82dcd572ad624 100644 --- a/x-pack/plugins/synthetics/public/state/api/network_events.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/network_events.ts @@ -10,8 +10,8 @@ import { FetchNetworkEventsParams } from '../actions/network_events'; import { SyntheticsNetworkEventsApiResponse, SyntheticsNetworkEventsApiResponseType, -} from '../../../common/runtime_types'; -import { API_URLS } from '../../../common/constants'; +} from '../../../../common/runtime_types'; +import { API_URLS } from '../../../../common/constants'; export async function fetchNetworkEvents( params: FetchNetworkEventsParams diff --git a/x-pack/plugins/synthetics/public/state/api/ping.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/ping.ts similarity index 90% rename from x-pack/plugins/synthetics/public/state/api/ping.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/ping.ts index e4fc5cc620b55..969102a8d77c6 100644 --- a/x-pack/plugins/synthetics/public/state/api/ping.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/ping.ts @@ -12,9 +12,9 @@ import { GetPingsParams, GetPingHistogramParams, HistogramResult, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; export const fetchPings: APIFn = async ({ dateRange: { from, to }, diff --git a/x-pack/plugins/synthetics/public/state/api/snapshot.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/snapshot.test.ts similarity index 97% rename from x-pack/plugins/synthetics/public/state/api/snapshot.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/snapshot.test.ts index 20a0a0d7a477c..97578deeb6fb7 100644 --- a/x-pack/plugins/synthetics/public/state/api/snapshot.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/snapshot.test.ts @@ -8,7 +8,7 @@ import { HttpFetchError } from '@kbn/core/public'; import { fetchSnapshotCount } from './snapshot'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; describe('snapshot API', () => { let fetchMock: jest.SpyInstance>; diff --git a/x-pack/plugins/synthetics/public/state/api/snapshot.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/snapshot.ts similarity index 85% rename from x-pack/plugins/synthetics/public/state/api/snapshot.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/snapshot.ts index d8f38128e3202..7734a0cec79b2 100644 --- a/x-pack/plugins/synthetics/public/state/api/snapshot.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/snapshot.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { SnapshotType, Snapshot } from '../../../common/runtime_types'; +import { SnapshotType, Snapshot } from '../../../../common/runtime_types'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants'; +import { API_URLS } from '../../../../common/constants'; export interface SnapShotQueryParams { dateRangeStart: string; diff --git a/x-pack/plugins/synthetics/public/state/api/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/types.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/api/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/types.ts diff --git a/x-pack/plugins/synthetics/public/state/api/utils.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/api/utils.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/api/utils.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/api/utils.ts diff --git a/x-pack/plugins/synthetics/public/state/certificates/certificates.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/certificates/certificates.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/certificates/certificates.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/certificates/certificates.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/alerts.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/alerts.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/alerts.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/alerts.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/dynamic_settings.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/dynamic_settings.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/effects/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/dynamic_settings.ts index 04cdb13f5612c..1200633976c6f 100644 --- a/x-pack/plugins/synthetics/public/state/effects/dynamic_settings.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/dynamic_settings.ts @@ -21,7 +21,7 @@ import { getDynamicSettings as getDynamicSettingsAPI, setDynamicSettings as setDynamicSettingsAPI, } from '../api'; -import { DynamicSettings } from '../../../common/runtime_types'; +import { DynamicSettings } from '../../../../common/runtime_types'; import { kibanaService } from '../kibana_service'; export function* fetchDynamicSettingsEffect() { diff --git a/x-pack/plugins/synthetics/public/state/effects/fetch_effect.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/fetch_effect.test.ts similarity index 97% rename from x-pack/plugins/synthetics/public/state/effects/fetch_effect.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/fetch_effect.test.ts index 5216260714cc8..4a19cfae58f6a 100644 --- a/x-pack/plugins/synthetics/public/state/effects/fetch_effect.test.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/fetch_effect.test.ts @@ -9,7 +9,7 @@ import { call, put } from 'redux-saga/effects'; import { fetchEffectFactory } from './fetch_effect'; import { indexStatusAction } from '../actions'; import { HttpFetchError } from '@kbn/core/public'; -import { StatesIndexStatus } from '../../../common/runtime_types'; +import { StatesIndexStatus } from '../../../../common/runtime_types'; import { fetchIndexStatus } from '../api'; describe('fetch saga effect factory', () => { diff --git a/x-pack/plugins/synthetics/public/state/effects/fetch_effect.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/fetch_effect.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/fetch_effect.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/fetch_effect.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/index.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/index_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/index_status.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/index_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/index_status.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/journey.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/journey.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/journey.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/journey.test.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/journey.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/journey.ts similarity index 93% rename from x-pack/plugins/synthetics/public/state/effects/journey.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/journey.ts index f7c1e23742e69..14d3ce91a32de 100644 --- a/x-pack/plugins/synthetics/public/state/effects/journey.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/journey.ts @@ -14,7 +14,7 @@ import { FetchJourneyStepsParams, } from '../actions/journey'; import { fetchJourneySteps } from '../api/journey'; -import type { SyntheticsJourneyApiResponse } from '../../../common/runtime_types'; +import type { SyntheticsJourneyApiResponse } from '../../../../common/runtime_types'; const inFlightStepRequests: Record = {}; diff --git a/x-pack/plugins/synthetics/public/state/effects/ml_anomaly.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/ml_anomaly.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/monitor_duration.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_duration.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/monitor_duration.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_duration.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/monitor_list.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_list.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/monitor_list.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_list.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/monitor_management.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_management.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/monitor_management.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_management.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/monitor_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_status.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/monitor_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_status.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/network_events.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/network_events.ts similarity index 98% rename from x-pack/plugins/synthetics/public/state/effects/network_events.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/network_events.ts index 75ea3d4467eb4..8c74e753c162c 100644 --- a/x-pack/plugins/synthetics/public/state/effects/network_events.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/network_events.ts @@ -14,7 +14,7 @@ import { FetchNetworkEventsParams, } from '../actions/network_events'; import { fetchNetworkEvents } from '../api/network_events'; -import type { SyntheticsNetworkEventsApiResponse } from '../../../common/runtime_types'; +import type { SyntheticsNetworkEventsApiResponse } from '../../../../common/runtime_types'; export function* fetchNetworkEventsEffect() { yield takeLatest( diff --git a/x-pack/plugins/synthetics/public/state/effects/ping.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/ping.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/ping.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/ping.ts diff --git a/x-pack/plugins/synthetics/public/state/effects/synthetic_journey_blocks.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/synthetic_journey_blocks.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/effects/synthetic_journey_blocks.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/synthetic_journey_blocks.ts index 829048747ddf7..6ffbeb6978f75 100644 --- a/x-pack/plugins/synthetics/public/state/effects/synthetic_journey_blocks.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/synthetic_journey_blocks.ts @@ -7,7 +7,7 @@ import { Action } from 'redux-actions'; import { call, fork, put, select, takeEvery, throttle } from 'redux-saga/effects'; -import { ScreenshotBlockDoc } from '../../../common/runtime_types/ping/synthetics'; +import { ScreenshotBlockDoc } from '../../../../common/runtime_types/ping/synthetics'; import { fetchScreenshotBlockSet } from '../api/journey'; import { fetchBlocksAction, diff --git a/x-pack/plugins/synthetics/public/state/effects/test_now_runs.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/test_now_runs.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/effects/test_now_runs.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/effects/test_now_runs.ts diff --git a/x-pack/plugins/synthetics/public/state/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/index.ts diff --git a/x-pack/plugins/synthetics/public/state/kibana_service.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/kibana_service.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/kibana_service.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/kibana_service.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/dynamic_settings.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/dynamic_settings.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/reducers/dynamic_settings.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/dynamic_settings.ts index 93f30c77f5536..d7c20b8edf7a3 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/dynamic_settings.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/dynamic_settings.ts @@ -14,7 +14,7 @@ import { setDynamicSettingsSuccess, setDynamicSettingsFail, } from '../actions/dynamic_settings'; -import { DynamicSettings } from '../../../common/runtime_types'; +import { DynamicSettings } from '../../../../common/runtime_types'; export interface DynamicSettingsState { settings?: DynamicSettings; diff --git a/x-pack/plugins/synthetics/public/state/reducers/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/index.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/index_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/index_status.ts similarity index 92% rename from x-pack/plugins/synthetics/public/state/reducers/index_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/index_status.ts index 7c3aecd98f706..29ea59cabb9e5 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/index_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/index_status.ts @@ -9,7 +9,7 @@ import { handleActions } from 'redux-actions'; import { indexStatusAction } from '../actions'; import { asyncInitState, handleAsyncAction } from './utils'; import { AsyncInitState } from './types'; -import { StatesIndexStatus } from '../../../common/runtime_types'; +import { StatesIndexStatus } from '../../../../common/runtime_types'; export interface IndexStatusState { indexStatus: AsyncInitState; diff --git a/x-pack/plugins/synthetics/public/state/reducers/journey.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/journey.ts similarity index 98% rename from x-pack/plugins/synthetics/public/state/reducers/journey.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/journey.ts index 98bbd93a24e0c..ae781b5839593 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/journey.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/journey.ts @@ -6,7 +6,7 @@ */ import { handleActions, Action } from 'redux-actions'; -import { JourneyStep, SyntheticsJourneyApiResponse } from '../../../common/runtime_types'; +import { JourneyStep, SyntheticsJourneyApiResponse } from '../../../../common/runtime_types'; import { pruneJourneyState } from '../actions/journey'; import { FetchJourneyStepsParams, diff --git a/x-pack/plugins/synthetics/public/state/reducers/ml_anomaly.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ml_anomaly.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/ml_anomaly.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ml_anomaly.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/monitor.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/reducers/monitor.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor.ts index 3c5be59ea9dda..23f2aac045b29 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/monitor.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor.ts @@ -13,7 +13,7 @@ import { getMonitorLocationsActionSuccess, getMonitorLocationsActionFail, } from '../actions/monitor'; -import { MonitorLocations } from '../../../common/runtime_types'; +import { MonitorLocations } from '../../../../common/runtime_types'; type MonitorLocationsList = Map; diff --git a/x-pack/plugins/synthetics/public/state/reducers/monitor_duration.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_duration.ts similarity index 95% rename from x-pack/plugins/synthetics/public/state/reducers/monitor_duration.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_duration.ts index 51eae6049b309..71fa50b75f5d6 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/monitor_duration.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_duration.ts @@ -11,7 +11,7 @@ import { getMonitorDurationActionSuccess, getMonitorDurationActionFail, } from '../actions'; -import { MonitorDurationResult } from '../../../common/types'; +import { MonitorDurationResult } from '../../../../common/types'; export interface MonitorDuration { durationLines: MonitorDurationResult | null; diff --git a/x-pack/plugins/synthetics/public/state/reducers/monitor_list.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_list.ts similarity index 97% rename from x-pack/plugins/synthetics/public/state/reducers/monitor_list.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_list.ts index 3630842cb9f8f..6e325a699a114 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/monitor_list.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_list.ts @@ -15,7 +15,7 @@ import { clearRefreshedMonitorId, setUpdatingMonitorId, } from '../actions'; -import { MonitorSummariesResult } from '../../../common/runtime_types'; +import { MonitorSummariesResult } from '../../../../common/runtime_types'; import { AppState } from '..'; import { TestNowResponse } from '../api'; diff --git a/x-pack/plugins/synthetics/public/state/reducers/monitor_management.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_management.ts similarity index 98% rename from x-pack/plugins/synthetics/public/state/reducers/monitor_management.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_management.ts index d60de74c1f54c..18c247a655275 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/monitor_management.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_management.ts @@ -31,8 +31,8 @@ import { ServiceLocations, ThrottlingOptions, DEFAULT_THROTTLING, -} from '../../../common/runtime_types'; -import { SyntheticsServiceAllowed } from '../../../common/types'; +} from '../../../../common/runtime_types'; +import { SyntheticsServiceAllowed } from '../../../../common/types'; export interface MonitorManagementList { error: Record<'monitorList' | 'serviceLocations' | 'enablement', Error | null>; diff --git a/x-pack/plugins/synthetics/public/state/reducers/monitor_status.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_status.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/monitor_status.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_status.test.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/monitor_status.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_status.ts similarity index 96% rename from x-pack/plugins/synthetics/public/state/reducers/monitor_status.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_status.ts index b27de0d944a8e..cd32a410503a3 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/monitor_status.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/monitor_status.ts @@ -11,7 +11,7 @@ import { getMonitorStatusActionSuccess, getMonitorStatusActionFail, } from '../actions'; -import { Ping } from '../../../common/runtime_types'; +import { Ping } from '../../../../common/runtime_types'; import { QueryParams } from '../actions/types'; export interface MonitorStatusState { diff --git a/x-pack/plugins/synthetics/public/state/reducers/network_events.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/network_events.ts similarity index 99% rename from x-pack/plugins/synthetics/public/state/reducers/network_events.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/network_events.ts index e58a8f75c7fa3..0abe4aeb2c7be 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/network_events.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/network_events.ts @@ -6,7 +6,7 @@ */ import { handleActions, Action } from 'redux-actions'; -import { NetworkEvent, SyntheticsNetworkEventsApiResponse } from '../../../common/runtime_types'; +import { NetworkEvent, SyntheticsNetworkEventsApiResponse } from '../../../../common/runtime_types'; import { FetchNetworkEventsParams, FetchNetworkEventsFailPayload, diff --git a/x-pack/plugins/synthetics/public/state/reducers/ping.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ping.ts similarity index 94% rename from x-pack/plugins/synthetics/public/state/reducers/ping.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ping.ts index a91734d77b4ab..f156a5596a84e 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/ping.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ping.ts @@ -7,7 +7,7 @@ import { handleActions, Action } from 'redux-actions'; import { getPingHistogram } from '../actions'; -import { HistogramResult } from '../../../common/runtime_types'; +import { HistogramResult } from '../../../../common/runtime_types'; export interface PingState { pingHistogram: HistogramResult | null; diff --git a/x-pack/plugins/synthetics/public/state/reducers/ping_list.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ping_list.ts similarity index 94% rename from x-pack/plugins/synthetics/public/state/reducers/ping_list.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ping_list.ts index 09d9347cedd3b..4403c2484dedb 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/ping_list.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ping_list.ts @@ -6,7 +6,7 @@ */ import { handleActions, Action } from 'redux-actions'; -import { PingsResponse } from '../../../common/runtime_types'; +import { PingsResponse } from '../../../../common/runtime_types'; import { clearPings, getPings, getPingsSuccess, getPingsFail } from '../actions'; export interface PingListState { diff --git a/x-pack/plugins/synthetics/public/state/reducers/selected_filters.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/selected_filters.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/selected_filters.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/selected_filters.test.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/selected_filters.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/selected_filters.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/selected_filters.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/selected_filters.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/synthetics.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/synthetics.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/synthetics.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/synthetics.test.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/synthetics.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/synthetics.ts similarity index 99% rename from x-pack/plugins/synthetics/public/state/reducers/synthetics.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/synthetics.ts index 1e97c3972444b..2a0cf7188a9e8 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/synthetics.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/synthetics.ts @@ -9,7 +9,7 @@ import { createAction, handleActions, Action } from 'redux-actions'; import { isScreenshotBlockDoc, ScreenshotBlockDoc, -} from '../../../common/runtime_types/ping/synthetics'; +} from '../../../../common/runtime_types/ping/synthetics'; export interface PendingBlock { status: 'pending' | 'loading'; diff --git a/x-pack/plugins/synthetics/public/state/reducers/test_now_runs.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/test_now_runs.ts similarity index 98% rename from x-pack/plugins/synthetics/public/state/reducers/test_now_runs.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/test_now_runs.ts index d081039e4d901..ffe49ff017259 100644 --- a/x-pack/plugins/synthetics/public/state/reducers/test_now_runs.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/test_now_runs.ts @@ -13,7 +13,7 @@ import { ScheduleUnit, ServiceLocationErrors, SyntheticsMonitorSchedule, -} from '../../../common/runtime_types'; +} from '../../../../common/runtime_types'; import { clearTestNowMonitorAction, testNowMonitorAction } from '../actions'; import { TestNowResponse } from '../api'; import { AppState } from '..'; diff --git a/x-pack/plugins/synthetics/public/state/reducers/types.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/types.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/types.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/types.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/ui.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ui.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/ui.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ui.test.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/ui.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ui.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/ui.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/ui.ts diff --git a/x-pack/plugins/synthetics/public/state/reducers/utils.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/utils.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/reducers/utils.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/reducers/utils.ts diff --git a/x-pack/plugins/synthetics/public/state/selectors/index.test.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/selectors/index.test.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/selectors/index.test.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/selectors/index.test.ts diff --git a/x-pack/plugins/synthetics/public/state/selectors/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/selectors/index.ts similarity index 100% rename from x-pack/plugins/synthetics/public/state/selectors/index.ts rename to x-pack/plugins/synthetics/public/legacy_uptime/state/selectors/index.ts diff --git a/x-pack/plugins/synthetics/public/apps/plugin.ts b/x-pack/plugins/synthetics/public/plugin.ts similarity index 83% rename from x-pack/plugins/synthetics/public/apps/plugin.ts rename to x-pack/plugins/synthetics/public/plugin.ts index 7f1a773376688..88238b1bfbf37 100644 --- a/x-pack/plugins/synthetics/public/apps/plugin.ts +++ b/x-pack/plugins/synthetics/public/plugin.ts @@ -39,14 +39,17 @@ import { Start as InspectorPluginStart } from '@kbn/inspector-plugin/public'; import { CasesUiStart } from '@kbn/cases-plugin/public'; import { CloudSetup } from '@kbn/cloud-plugin/public'; import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; -import { PLUGIN } from '../../common/constants/plugin'; +import { PLUGIN } from '../common/constants/plugin'; import { LazySyntheticsPolicyCreateExtension, LazySyntheticsPolicyEditExtension, -} from '../components/fleet_package'; -import { LazySyntheticsCustomAssetsExtension } from '../components/fleet_package/lazy_synthetics_custom_assets_extension'; -import { uptimeOverviewNavigatorParams } from './locators/overview'; -import { alertTypeInitializers, legacyAlertTypeInitializers } from '../lib/alert_types'; +} from './legacy_uptime/components/fleet_package'; +import { LazySyntheticsCustomAssetsExtension } from './legacy_uptime/components/fleet_package/lazy_synthetics_custom_assets_extension'; +import { uptimeOverviewNavigatorParams } from './apps/locators/overview'; +import { + alertTypeInitializers, + legacyAlertTypeInitializers, +} from './legacy_uptime/lib/alert_types'; export interface ClientPluginsSetup { home?: HomePublicPluginSetup; @@ -100,7 +103,7 @@ export class UptimePlugin } const getUptimeDataHelper = async () => { const [coreStart] = await core.getStartServices(); - const { UptimeDataHelper } = await import('./uptime_overview_fetcher'); + const { UptimeDataHelper } = await import('./legacy_uptime/app/uptime_overview_fetcher'); return UptimeDataHelper(coreStart); }; @@ -186,27 +189,29 @@ export class UptimePlugin }); }); + const appKeywords = [ + 'Synthetics', + 'pings', + 'checks', + 'availability', + 'response duration', + 'response time', + 'outside in', + 'reachability', + 'reachable', + 'digital', + 'performance', + 'web performance', + 'web perf', + ]; + core.application.register({ id: PLUGIN.ID, euiIconType: 'logoObservability', order: 8400, title: PLUGIN.TITLE, category: DEFAULT_APP_CATEGORIES.observability, - keywords: [ - 'Synthetics', - 'pings', - 'checks', - 'availability', - 'response duration', - 'response time', - 'outside in', - 'reachability', - 'reachable', - 'digital', - 'performance', - 'web performance', - 'web perf', - ], + keywords: appKeywords, deepLinks: [ { id: 'Down monitors', title: 'Down monitors', path: '/?statusFilter=down' }, { id: 'Certificates', title: 'TLS Certificates', path: '/certificates' }, @@ -215,7 +220,24 @@ export class UptimePlugin mount: async (params: AppMountParameters) => { const [coreStart, corePlugins] = await core.getStartServices(); - const { renderApp } = await import('./render_app'); + const { renderApp } = await import('./legacy_uptime/app/render_app'); + return renderApp(coreStart, plugins, corePlugins, params, this.initContext.env.mode.dev); + }, + }); + + // Register the Synthetics UI plugin + core.application.register({ + id: 'synthetics', + euiIconType: 'logoObservability', + order: 8400, + title: PLUGIN.SYNTHETICS, + category: DEFAULT_APP_CATEGORIES.observability, + keywords: appKeywords, + deepLinks: [], + mount: async (params: AppMountParameters) => { + const [coreStart, corePlugins] = await core.getStartServices(); + + const { renderApp } = await import('./apps/synthetics/render_app'); return renderApp(coreStart, plugins, corePlugins, params, this.initContext.env.mode.dev); }, }); diff --git a/x-pack/plugins/synthetics/server/kibana.index.ts b/x-pack/plugins/synthetics/server/kibana.index.ts index 2791640115469..14ac9edd5ff2f 100644 --- a/x-pack/plugins/synthetics/server/kibana.index.ts +++ b/x-pack/plugins/synthetics/server/kibana.index.ts @@ -44,7 +44,7 @@ export const initServerWithKibana = ( name: PLUGIN.NAME, order: 1000, category: DEFAULT_APP_CATEGORIES.observability, - app: ['uptime', 'kibana'], + app: ['uptime', 'kibana', 'synthetics'], catalogue: ['uptime'], management: { insightsAndAlerting: ['triggersActions'], @@ -52,7 +52,7 @@ export const initServerWithKibana = ( alerting: UPTIME_RULE_TYPES, privileges: { all: { - app: ['uptime', 'kibana'], + app: ['uptime', 'kibana', 'synthetics'], catalogue: ['uptime'], api: ['uptime-read', 'uptime-write', 'lists-all'], savedObject: { @@ -73,7 +73,7 @@ export const initServerWithKibana = ( ui: ['save', 'configureSettings', 'show', 'alerting:save'], }, read: { - app: ['uptime', 'kibana'], + app: ['uptime', 'kibana', 'synthetics'], catalogue: ['uptime'], api: ['uptime-read', 'lists-read'], savedObject: { diff --git a/x-pack/plugins/synthetics/tsconfig.json b/x-pack/plugins/synthetics/tsconfig.json index 17088fe6f1fd9..023c98c66a4a5 100644 --- a/x-pack/plugins/synthetics/tsconfig.json +++ b/x-pack/plugins/synthetics/tsconfig.json @@ -10,7 +10,7 @@ "common/**/*", "scripts/**/*", "public/**/*", - "public/components/monitor/status_details/location_map/embeddables/low_poly_layer.json", + "public/legacy_uptime/components/monitor/status_details/location_map/embeddables/low_poly_layer.json", "server/**/*", "server/lib/requests/__fixtures__/monitor_charts_mock.json", "../../../typings/**/*" diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index a361c5fef7a40..aac8d2e40f650 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -12812,98 +12812,6 @@ } } }, - "task_manager": { - "properties": { - "ephemeral_tasks_enabled": { - "type": "boolean" - }, - "ephemeral_request_capacity": { - "type": "short" - }, - "ephemeral_stats": { - "properties": { - "status": { - "type": "keyword" - }, - "queued_tasks": { - "properties": { - "p50": { - "type": "long" - }, - "p90": { - "type": "long" - }, - "p95": { - "type": "long" - }, - "p99": { - "type": "long" - } - } - }, - "load": { - "properties": { - "p50": { - "type": "long" - }, - "p90": { - "type": "long" - }, - "p95": { - "type": "long" - }, - "p99": { - "type": "long" - } - } - }, - "executions_per_cycle": { - "properties": { - "p50": { - "type": "long" - }, - "p90": { - "type": "long" - }, - "p95": { - "type": "long" - }, - "p99": { - "type": "long" - } - } - } - } - }, - "task_type_exclusion": { - "type": "array", - "items": { - "type": "keyword" - } - }, - "failed_tasks": { - "type": "long" - } - } - }, - "upgrade-assistant-telemetry": { - "properties": { - "features": { - "properties": { - "deprecation_logging": { - "properties": { - "enabled": { - "type": "boolean", - "_meta": { - "description": "Whether user has enabled Elasticsearch deprecation logging" - } - } - } - } - } - } - } - }, "uptime": { "properties": { "last_24_hours": { @@ -13044,6 +12952,98 @@ } } } + }, + "task_manager": { + "properties": { + "ephemeral_tasks_enabled": { + "type": "boolean" + }, + "ephemeral_request_capacity": { + "type": "short" + }, + "ephemeral_stats": { + "properties": { + "status": { + "type": "keyword" + }, + "queued_tasks": { + "properties": { + "p50": { + "type": "long" + }, + "p90": { + "type": "long" + }, + "p95": { + "type": "long" + }, + "p99": { + "type": "long" + } + } + }, + "load": { + "properties": { + "p50": { + "type": "long" + }, + "p90": { + "type": "long" + }, + "p95": { + "type": "long" + }, + "p99": { + "type": "long" + } + } + }, + "executions_per_cycle": { + "properties": { + "p50": { + "type": "long" + }, + "p90": { + "type": "long" + }, + "p95": { + "type": "long" + }, + "p99": { + "type": "long" + } + } + } + } + }, + "task_type_exclusion": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "failed_tasks": { + "type": "long" + } + } + }, + "upgrade-assistant-telemetry": { + "properties": { + "features": { + "properties": { + "deprecation_logging": { + "properties": { + "enabled": { + "type": "boolean", + "_meta": { + "description": "Whether user has enabled Elasticsearch deprecation logging" + } + } + } + } + } + } + } } } } diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts index 4d4acbe6242ba..b90337c3648b2 100644 --- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts +++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts @@ -71,6 +71,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'Overview', 'Alerts', 'Uptime', + 'Synthetics', 'Stack Management', ]); }); @@ -123,7 +124,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('shows uptime navlink', async () => { const navLinks = (await appsMenu.readLinks()).map((link) => link.text); - expect(navLinks).to.eql(['Overview', 'Alerts', 'Uptime', 'Stack Management']); + expect(navLinks).to.eql(['Overview', 'Alerts', 'Uptime', 'Synthetics', 'Stack Management']); }); it('can navigate to Uptime app', async () => { From 578364c76712e7997b860b9e7fa6c80a6a443aac Mon Sep 17 00:00:00 2001 From: Paul Tavares <56442535+paul-tavares@users.noreply.github.com> Date: Fri, 29 Apr 2022 17:19:03 -0400 Subject: [PATCH 29/89] [Security Solution][Endpoint] Fix error while checking `agent.version` compatibility for host Isolation that causes Security Solution app to crash (#131272) * Only parse version for Endpoint Alerts * isVersionSupported(): catch exceptions, log it and return false if version checking fails --- .../service/host_isolation/utils.test.ts | 3 +++ .../endpoint/service/host_isolation/utils.ts | 16 ++++++++++++++-- .../host_isolation/use_host_isolation_action.tsx | 14 +++++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.test.ts b/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.test.ts index 8b72fe5deb8f6..48928fb435fec 100644 --- a/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.test.ts +++ b/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.test.ts @@ -8,6 +8,7 @@ import { isVersionSupported, isOsSupported, isIsolationSupported } from './utils'; describe('Host Isolation utils isVersionSupported', () => { + // NOTE: the `7.15.0.8295.0` and the text current versions are invalid. test.each` currentVersion | minVersionRequired | expected ${'8.14.0'} | ${'7.13.0'} | ${true} @@ -22,6 +23,8 @@ describe('Host Isolation utils isVersionSupported', () => { ${'7.14.0-alpha'} | ${'7.14.0'} | ${true} ${'8.0.0-SNAPSHOT'} | ${'7.14.0'} | ${true} ${'8.0.0'} | ${'7.14.0'} | ${true} + ${'7.15.0.8295.0'} | ${'7.14.0'} | ${false} + ${'NOT_SEMVER'} | ${'7.14.0'} | ${false} `( 'should validate that version $a is compatible($expected) to $b', ({ currentVersion, minVersionRequired, expected }) => { diff --git a/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.ts b/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.ts index d012ddfda15ba..0e9404f250786 100644 --- a/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.ts +++ b/x-pack/plugins/security_solution/common/endpoint/service/host_isolation/utils.ts @@ -26,8 +26,20 @@ export const isVersionSupported = ({ currentVersion: string; minVersionRequired?: string; }) => { - const parsedCurrentVersion = parseSemver(currentVersion); - return semverLte(minVersionRequired, parsedCurrentVersion); + // `parseSemver()` will throw if the version provided is not a valid semver value. + // If that happens, then just return false from this function + try { + const parsedCurrentVersion = parseSemver(currentVersion); + return semverLte(minVersionRequired, parsedCurrentVersion); + } catch (e) { + // If running in the browser, log to console + if (window && window.console) { + window.console.warn( + `SecuritySolution: isVersionSupported(): Unable to determine if current version [${currentVersion}] meets minimum version [${minVersionRequired}]. Error: ${e.message}` + ); + } + return false; + } }; export const isOsSupported = ({ diff --git a/x-pack/plugins/security_solution/public/detections/components/host_isolation/use_host_isolation_action.tsx b/x-pack/plugins/security_solution/public/detections/components/host_isolation/use_host_isolation_action.tsx index 57d81d48fca05..62debf400a387 100644 --- a/x-pack/plugins/security_solution/public/detections/components/host_isolation/use_host_isolation_action.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/host_isolation/use_host_isolation_action.tsx @@ -56,11 +56,15 @@ export const useHostIsolationAction = ({ agentId, }); - const isolationSupported = isIsolationSupported({ - osName: hostOsFamily, - version: agentVersion, - capabilities, - }); + const isolationSupported = useMemo(() => { + return isEndpointAlert + ? isIsolationSupported({ + osName: hostOsFamily, + version: agentVersion, + capabilities, + }) + : false; + }, [agentVersion, capabilities, hostOsFamily, isEndpointAlert]); const isIsolationAllowed = useUserPrivileges().endpointPrivileges.canIsolateHost; From 7cc364a2f1ecf8f45938bdbab9ecc46f691f3397 Mon Sep 17 00:00:00 2001 From: Candace Park <56409205+parkiino@users.noreply.github.com> Date: Sat, 30 Apr 2022 01:40:06 -0400 Subject: [PATCH 30/89] [Security Solution][Admin][Endpoint Generator] Endpoint generator uses correct merge to preserve array values (#131273) --- .../endpoint/data_loaders/index_endpoint_hosts.ts | 14 +++++++------- .../common/endpoint/data_loaders/utils.ts | 12 ++++++++++++ .../common/endpoint/index_data.ts | 4 ++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts index 7d9d08021fe54..2f304351dc435 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts @@ -6,7 +6,7 @@ */ import { Client } from '@elastic/elasticsearch'; -import { cloneDeep, merge } from 'lodash'; +import { cloneDeep } from 'lodash'; import { AxiosResponse } from 'axios'; import uuid from 'uuid'; // eslint-disable-next-line import/no-extraneous-dependencies @@ -35,7 +35,7 @@ import { indexFleetEndpointPolicy, } from './index_fleet_endpoint_policy'; import { metadataCurrentIndexPattern } from '../constants'; -import { EndpointDataLoadingError, wrapErrorAndRejectPromise } from './utils'; +import { EndpointDataLoadingError, mergeAndAppendArrays, wrapErrorAndRejectPromise } from './utils'; export interface IndexedHostsResponse extends IndexedFleetAgentResponse, @@ -141,7 +141,7 @@ export async function indexEndpointHostDocs({ epmEndpointPackage.version ); - merge(response, createdPolicies); + mergeAndAppendArrays(response, createdPolicies); // eslint-disable-next-line require-atomic-updates realPolicies[appliedPolicyId] = createdPolicies.integrationPolicies[0]; @@ -160,7 +160,7 @@ export async function indexEndpointHostDocs({ ); enrolledAgent = indexedAgentResponse.agents[0]; - merge(response, indexedAgentResponse); + mergeAndAppendArrays(response, indexedAgentResponse); } // Update the Host metadata record with the ID of the "real" policy along with the enrolled agent id hostMetadata = { @@ -317,9 +317,9 @@ export const deleteIndexedEndpointHosts = async ( .catch(wrapErrorAndRejectPromise); } - merge(response, await deleteIndexedFleetAgents(esClient, indexedData)); - merge(response, await deleteIndexedEndpointAndFleetActions(esClient, indexedData)); - merge(response, await deleteIndexedFleetEndpointPolicies(kbnClient, indexedData)); + mergeAndAppendArrays(response, await deleteIndexedFleetAgents(esClient, indexedData)); + mergeAndAppendArrays(response, await deleteIndexedEndpointAndFleetActions(esClient, indexedData)); + mergeAndAppendArrays(response, await deleteIndexedFleetEndpointPolicies(kbnClient, indexedData)); return response; }; diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/utils.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/utils.ts index 80a7699e51cf8..fcba3a522a522 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/utils.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/utils.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { mergeWith } from 'lodash'; + export class EndpointDataLoadingError extends Error { constructor(message: string, public meta?: unknown) { super(message); @@ -18,3 +20,13 @@ export const wrapErrorIfNeeded = (error: Error): EndpointDataLoadingError => // Use it in Promise's `.catch()` as `.catch(wrapErrorAndRejectPromise)` export const wrapErrorAndRejectPromise = (error: Error) => Promise.reject(wrapErrorIfNeeded(error)); + +export const mergeAndAppendArrays = (destinationObj: T, srcObj: S): T => { + const customizer = (objValue: T[keyof T], srcValue: S[keyof S]) => { + if (Array.isArray(objValue)) { + return objValue.concat(srcValue); + } + }; + + return mergeWith(destinationObj, srcObj, customizer); +}; diff --git a/x-pack/plugins/security_solution/common/endpoint/index_data.ts b/x-pack/plugins/security_solution/common/endpoint/index_data.ts index a783c523f07b0..e063f9695e7ed 100644 --- a/x-pack/plugins/security_solution/common/endpoint/index_data.ts +++ b/x-pack/plugins/security_solution/common/endpoint/index_data.ts @@ -10,7 +10,6 @@ import seedrandom from 'seedrandom'; // eslint-disable-next-line import/no-extraneous-dependencies import { KbnClient } from '@kbn/test'; import { AxiosResponse } from 'axios'; -import { merge } from 'lodash'; import { CreatePackagePolicyResponse, EPM_API_ROUTES, @@ -26,6 +25,7 @@ import { import { enableFleetServerIfNecessary } from './data_loaders/index_fleet_server'; import { indexAlerts } from './data_loaders/index_alerts'; import { setupFleetForEndpoint } from './data_loaders/setup_fleet_for_endpoint'; +import { mergeAndAppendArrays } from './data_loaders/utils'; export type IndexedHostsAndAlertsResponse = IndexedHostsResponse; @@ -105,7 +105,7 @@ export async function indexHostsAndAlerts( generator, }); - merge(response, indexedHosts); + mergeAndAppendArrays(response, indexedHosts); await indexAlerts({ client, From 0716332459c3760bd7f8d57e8b25f4b4108862db Mon Sep 17 00:00:00 2001 From: CohenIdo <90558359+CohenIdo@users.noreply.github.com> Date: Sun, 1 May 2022 18:07:44 +0300 Subject: [PATCH 31/89] [Cloud Security]Update package name (#131137) --- .../common/constants.ts | 20 +++++++++---------- .../api/use_cis_kubernetes_integration.tsx | 4 ++-- .../create_transforms_indices.ts | 10 +++++----- .../benchmark_score_transform.ts | 8 ++++---- .../latest_findings_transform.ts | 4 ++-- .../fleet_integration.test.ts | 4 ++-- .../fleet_integration/fleet_integration.ts | 4 ++-- .../server/plugin.test.ts | 4 ++-- .../cloud_security_posture/server/plugin.ts | 8 ++++---- .../server/routes/benchmarks/benchmarks.ts | 7 +++++-- .../compliance_dashboard.ts | 4 ++-- .../routes/compliance_dashboard/get_trends.ts | 4 ++-- .../update_rules_configuration.ts | 4 ++-- 13 files changed, 43 insertions(+), 42 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index cbb283d73137b..a64a2604609ff 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -11,19 +11,17 @@ export const BENCHMARKS_ROUTE_PATH = '/internal/cloud_security_posture/benchmark export const UPDATE_RULES_CONFIG_ROUTE_PATH = '/internal/cloud_security_posture/update_rules_config'; -export const CSP_FINDINGS_INDEX_NAME = 'findings'; -export const CIS_KUBERNETES_PACKAGE_NAME = 'cis_kubernetes_benchmark'; -export const FINDINGS_DATA_STREAM_NAME = - // Currently 'cis_kubernetes_benchmark.findings', To be refactored to 'cloud_security_posture.findings' - CIS_KUBERNETES_PACKAGE_NAME + '.' + CSP_FINDINGS_INDEX_NAME; -export const LATEST_FINDINGS_INDEX_NAME = 'cloud_security_posture.findings_latest'; -export const BENCHMARK_SCORE_INDEX_NAME = 'cloud_security_posture.scores'; +export const CLOUD_SECURITY_POSTURE_PACKAGE_NAME = 'cloud_security_posture'; -export const AGENT_LOGS_INDEX_PATTERN = '.logs-cis_kubernetes_benchmark.metadata*'; +export const AGENT_LOGS_INDEX_PATTERN = '.logs-cloud_security_posture.metadata*'; export const CSP_LATEST_FINDINGS_DATA_VIEW = 'logs-cloud_security_posture.findings_latest-*'; -export const FINDINGS_INDEX_PATTERN = 'logs-' + FINDINGS_DATA_STREAM_NAME + '-default*'; -export const LATEST_FINDINGS_INDEX_PATTERN = 'logs-' + LATEST_FINDINGS_INDEX_NAME + '-default'; -export const BENCHMARK_SCORE_INDEX_PATTERN = 'logs-' + BENCHMARK_SCORE_INDEX_NAME + '-default'; +export const FINDINGS_INDEX_PATTERN = 'logs-cloud_security_posture.findings-default*'; + +export const LATEST_FINDINGS_INDEX_NAME = 'cloud_security_posture.findings_latest'; +export const LATEST_FINDINGS_INDEX_DEFAULT_NS = 'logs-' + LATEST_FINDINGS_INDEX_NAME + '-default'; + +export const BENCHMARK_SCORE_INDEX_NAME = 'cloud_security_posture.scores'; +export const BENCHMARK_SCORE_INDEX_DEFAULT_NS = 'logs-' + BENCHMARK_SCORE_INDEX_NAME + '-default'; export const RULE_PASSED = `passed`; export const RULE_FAILED = `failed`; diff --git a/x-pack/plugins/cloud_security_posture/public/common/api/use_cis_kubernetes_integration.tsx b/x-pack/plugins/cloud_security_posture/public/common/api/use_cis_kubernetes_integration.tsx index 0a9f2c2134a6e..5660080cb0a43 100644 --- a/x-pack/plugins/cloud_security_posture/public/common/api/use_cis_kubernetes_integration.tsx +++ b/x-pack/plugins/cloud_security_posture/public/common/api/use_cis_kubernetes_integration.tsx @@ -11,7 +11,7 @@ import { type GetInfoResponse, type DefaultPackagesInstallationError, } from '@kbn/fleet-plugin/common'; -import { CIS_KUBERNETES_PACKAGE_NAME } from '../../../common/constants'; +import { CLOUD_SECURITY_POSTURE_PACKAGE_NAME } from '../../../common/constants'; import { useKibana } from '../hooks/use_kibana'; /** @@ -21,7 +21,7 @@ export const useCisKubernetesIntegration = () => { const { http } = useKibana().services; return useQuery(['integrations'], () => - http.get(epmRouteService.getInfoPath(CIS_KUBERNETES_PACKAGE_NAME), { + http.get(epmRouteService.getInfoPath(CLOUD_SECURITY_POSTURE_PACKAGE_NAME), { query: { experimental: true }, }) ); diff --git a/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts b/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts index c30bf09a60e0f..32d53b0a89695 100644 --- a/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts +++ b/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts @@ -10,9 +10,9 @@ import type { ElasticsearchClient, Logger } from '@kbn/core/server'; import { benchmarkScoreMapping } from './benchmark_score_mapping'; import { latestFindingsMapping } from './latest_findings_mapping'; import { - LATEST_FINDINGS_INDEX_PATTERN, + LATEST_FINDINGS_INDEX_DEFAULT_NS, LATEST_FINDINGS_INDEX_NAME, - BENCHMARK_SCORE_INDEX_PATTERN, + BENCHMARK_SCORE_INDEX_DEFAULT_NS, BENCHMARK_SCORE_INDEX_NAME, } from '../../common/constants'; @@ -25,14 +25,14 @@ export const initializeCspTransformsIndices = async ( createIndexIfNotExists( esClient, LATEST_FINDINGS_INDEX_NAME, - LATEST_FINDINGS_INDEX_PATTERN, + LATEST_FINDINGS_INDEX_DEFAULT_NS, latestFindingsMapping, logger ), createIndexIfNotExists( esClient, BENCHMARK_SCORE_INDEX_NAME, - BENCHMARK_SCORE_INDEX_PATTERN, + BENCHMARK_SCORE_INDEX_DEFAULT_NS, benchmarkScoreMapping, logger ), @@ -65,7 +65,7 @@ export const createIndexIfNotExists = async ( } } catch (err) { const error = transformError(err); - logger.error(`Failed to create ${LATEST_FINDINGS_INDEX_PATTERN}`); + logger.error(`Failed to create ${LATEST_FINDINGS_INDEX_DEFAULT_NS}`); logger.error(error.message); } }; diff --git a/x-pack/plugins/cloud_security_posture/server/create_transforms/benchmark_score_transform.ts b/x-pack/plugins/cloud_security_posture/server/create_transforms/benchmark_score_transform.ts index 8837fea0fa183..19528d42f09af 100644 --- a/x-pack/plugins/cloud_security_posture/server/create_transforms/benchmark_score_transform.ts +++ b/x-pack/plugins/cloud_security_posture/server/create_transforms/benchmark_score_transform.ts @@ -7,18 +7,18 @@ import type { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; import { - LATEST_FINDINGS_INDEX_PATTERN, - BENCHMARK_SCORE_INDEX_PATTERN, + LATEST_FINDINGS_INDEX_DEFAULT_NS, + BENCHMARK_SCORE_INDEX_DEFAULT_NS, } from '../../common/constants'; export const benchmarkScoreTransform: TransformPutTransformRequest = { transform_id: 'cloud_security_posture.score-default-0.0.1', description: 'Calculate latest findings score', source: { - index: LATEST_FINDINGS_INDEX_PATTERN, + index: LATEST_FINDINGS_INDEX_DEFAULT_NS, }, dest: { - index: BENCHMARK_SCORE_INDEX_PATTERN, + index: BENCHMARK_SCORE_INDEX_DEFAULT_NS, }, frequency: '30m', sync: { diff --git a/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_findings_transform.ts b/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_findings_transform.ts index fc042149f3193..fb8027a7675d2 100644 --- a/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_findings_transform.ts +++ b/x-pack/plugins/cloud_security_posture/server/create_transforms/latest_findings_transform.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; -import { FINDINGS_INDEX_PATTERN, LATEST_FINDINGS_INDEX_PATTERN } from '../../common/constants'; +import { FINDINGS_INDEX_PATTERN, LATEST_FINDINGS_INDEX_DEFAULT_NS } from '../../common/constants'; export const latestFindingsTransform: TransformPutTransformRequest = { transform_id: 'cloud_security_posture.findings_latest-default-0.0.1', @@ -14,7 +14,7 @@ export const latestFindingsTransform: TransformPutTransformRequest = { index: FINDINGS_INDEX_PATTERN, }, dest: { - index: LATEST_FINDINGS_INDEX_PATTERN, + index: LATEST_FINDINGS_INDEX_DEFAULT_NS, }, frequency: '5m', sync: { diff --git a/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.test.ts b/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.test.ts index 8872c359fc770..69e13ab8c5065 100644 --- a/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.test.ts +++ b/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.test.ts @@ -8,7 +8,7 @@ import { loggingSystemMock, savedObjectsClientMock } from '@kbn/core/server/mocks'; import { SavedObjectsClientContract, SavedObjectsFindResponse } from '@kbn/core/server'; import { createPackagePolicyMock } from '@kbn/fleet-plugin/common/mocks'; -import { CIS_KUBERNETES_PACKAGE_NAME } from '../../common/constants'; +import { CLOUD_SECURITY_POSTURE_PACKAGE_NAME } from '../../common/constants'; import { onPackagePolicyPostCreateCallback } from './fleet_integration'; describe('create CSP rules with post package create callback', () => { @@ -40,7 +40,7 @@ describe('create CSP rules with post package create callback', () => { }); it('should create stateful rules based on rule template', async () => { const mockPackagePolicy = createPackagePolicyMock(); - mockPackagePolicy.package!.name = CIS_KUBERNETES_PACKAGE_NAME; + mockPackagePolicy.package!.name = CLOUD_SECURITY_POSTURE_PACKAGE_NAME; mockSoClient.find.mockResolvedValueOnce({ saved_objects: [ { diff --git a/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.ts b/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.ts index 4693a3e55337b..da45a53256bde 100644 --- a/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.ts +++ b/x-pack/plugins/cloud_security_posture/server/fleet_integration/fleet_integration.ts @@ -17,7 +17,7 @@ import { cloudSecurityPostureRuleTemplateSavedObjectType, CloudSecurityPostureRuleTemplateSchema, } from '../../common/schemas/csp_rule_template'; -import { CIS_KUBERNETES_PACKAGE_NAME } from '../../common/constants'; +import { CLOUD_SECURITY_POSTURE_PACKAGE_NAME } from '../../common/constants'; import { CspRuleSchema, cspRuleAssetSavedObjectType } from '../../common/schemas/csp_rule'; type ArrayElement = ArrayType extends ReadonlyArray< @@ -29,7 +29,7 @@ type ArrayElement = ArrayType extends Read const isCspPackagePolicy = ( packagePolicy: T ): boolean => { - return packagePolicy.package?.name === CIS_KUBERNETES_PACKAGE_NAME; + return packagePolicy.package?.name === CLOUD_SECURITY_POSTURE_PACKAGE_NAME; }; /** diff --git a/x-pack/plugins/cloud_security_posture/server/plugin.test.ts b/x-pack/plugins/cloud_security_posture/server/plugin.test.ts index 79ff710fd5c2c..43dc550a677a9 100644 --- a/x-pack/plugins/cloud_security_posture/server/plugin.test.ts +++ b/x-pack/plugins/cloud_security_posture/server/plugin.test.ts @@ -24,7 +24,7 @@ import { FleetStartContract, PostPackagePolicyPostCreateCallback, } from '@kbn/fleet-plugin/server'; -import { CIS_KUBERNETES_PACKAGE_NAME } from '../common/constants'; +import { CLOUD_SECURITY_POSTURE_PACKAGE_NAME } from '../common/constants'; import Chance from 'chance'; import type { AwaitedProperties } from '@kbn/utility-types'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; @@ -131,7 +131,7 @@ describe('Cloud Security Posture Plugin', () => { ); const packageMock = createPackagePolicyMock(); - packageMock.package!.name = CIS_KUBERNETES_PACKAGE_NAME; + packageMock.package!.name = CLOUD_SECURITY_POSTURE_PACKAGE_NAME; const packagePolicyPostCreateCallbacks: PostPackagePolicyPostCreateCallback[] = []; fleetMock.registerExternalCallback.mockImplementation((...args) => { diff --git a/x-pack/plugins/cloud_security_posture/server/plugin.ts b/x-pack/plugins/cloud_security_posture/server/plugin.ts index 5647a9adcd0cc..d9fdea9488036 100755 --- a/x-pack/plugins/cloud_security_posture/server/plugin.ts +++ b/x-pack/plugins/cloud_security_posture/server/plugin.ts @@ -33,7 +33,7 @@ import { onPackagePolicyPostCreateCallback, onPackagePolicyDeleteCallback, } from './fleet_integration/fleet_integration'; -import { CIS_KUBERNETES_PACKAGE_NAME } from '../common/constants'; +import { CLOUD_SECURITY_POSTURE_PACKAGE_NAME } from '../common/constants'; export interface CspAppContext { logger: Logger; @@ -84,7 +84,7 @@ export class CspPlugin plugins.fleet.fleetSetupCompleted().then(async () => { const packageInfo = await plugins.fleet.packageService.asInternalUser.getInstallation( - CIS_KUBERNETES_PACKAGE_NAME + CLOUD_SECURITY_POSTURE_PACKAGE_NAME ); // If package is installed we want to make sure all needed assets are installed @@ -100,7 +100,7 @@ export class CspPlugin context: RequestHandlerContext, _: KibanaRequest ): Promise => { - if (packagePolicy.package?.name === CIS_KUBERNETES_PACKAGE_NAME) { + if (packagePolicy.package?.name === CLOUD_SECURITY_POSTURE_PACKAGE_NAME) { await this.initialize(core); const soClient = (await context.core).savedObjects.client; await onPackagePolicyPostCreateCallback(this.logger, packagePolicy, soClient); @@ -114,7 +114,7 @@ export class CspPlugin 'postPackagePolicyDelete', async (deletedPackagePolicies: DeepReadonly) => { for (const deletedPackagePolicy of deletedPackagePolicies) { - if (deletedPackagePolicy.package?.name === CIS_KUBERNETES_PACKAGE_NAME) { + if (deletedPackagePolicy.package?.name === CLOUD_SECURITY_POSTURE_PACKAGE_NAME) { await onPackagePolicyDeleteCallback( this.logger, deletedPackagePolicy, diff --git a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.ts b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.ts index 2112701f42d4a..a2cb7d06f1f58 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/benchmarks.ts @@ -19,7 +19,10 @@ import type { AgentPolicy, ListResult, } from '@kbn/fleet-plugin/common'; -import { BENCHMARKS_ROUTE_PATH, CIS_KUBERNETES_PACKAGE_NAME } from '../../../common/constants'; +import { + BENCHMARKS_ROUTE_PATH, + CLOUD_SECURITY_POSTURE_PACKAGE_NAME, +} from '../../../common/constants'; import { BENCHMARK_PACKAGE_POLICY_PREFIX, benchmarksInputSchema, @@ -165,7 +168,7 @@ export const defineGetBenchmarksRoute = (router: CspRouter, cspContext: CspAppCo const packagePolicies = await getPackagePolicies( soClient, packagePolicyService, - CIS_KUBERNETES_PACKAGE_NAME, + CLOUD_SECURITY_POSTURE_PACKAGE_NAME, query ); diff --git a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/compliance_dashboard.ts b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/compliance_dashboard.ts index 9fdea8e97938f..1a95737df0ad9 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/compliance_dashboard.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/compliance_dashboard.ts @@ -8,7 +8,7 @@ import { transformError } from '@kbn/securitysolution-es-utils'; import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; import type { ComplianceDashboardData } from '../../../common/types'; -import { LATEST_FINDINGS_INDEX_PATTERN, STATS_ROUTE_PATH } from '../../../common/constants'; +import { LATEST_FINDINGS_INDEX_DEFAULT_NS, STATS_ROUTE_PATH } from '../../../common/constants'; import { CspAppContext } from '../../plugin'; import { getGroupedFindingsEvaluation } from './get_grouped_findings_evaluation'; import { ClusterWithoutTrend, getClusters } from './get_clusters'; @@ -47,7 +47,7 @@ export const defineGetComplianceDashboardRoute = ( const esClient = (await context.core).elasticsearch.client.asCurrentUser; const { id: pitId } = await esClient.openPointInTime({ - index: LATEST_FINDINGS_INDEX_PATTERN, + index: LATEST_FINDINGS_INDEX_DEFAULT_NS, keep_alive: '30s', }); diff --git a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts index eba14cb8215c2..08d8cd3553fe2 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/compliance_dashboard/get_trends.ts @@ -6,7 +6,7 @@ */ import { ElasticsearchClient } from '@kbn/core/server'; -import { BENCHMARK_SCORE_INDEX_PATTERN } from '../../../common/constants'; +import { BENCHMARK_SCORE_INDEX_DEFAULT_NS } from '../../../common/constants'; import { Stats } from '../../../common/types'; import { calculatePostureScore } from './get_stats'; @@ -26,7 +26,7 @@ export interface ScoreTrendDoc { } export const getTrendsQuery = () => ({ - index: BENCHMARK_SCORE_INDEX_PATTERN, + index: BENCHMARK_SCORE_INDEX_DEFAULT_NS, size: 5, sort: '@timestamp:desc', }); diff --git a/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts b/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts index 7b9e63f8bd69e..ae43443f1571b 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts @@ -22,7 +22,7 @@ import { CspAppContext } from '../../plugin'; import { CspRulesConfigSchema } from '../../../common/schemas/csp_configuration'; import { CspRuleSchema, cspRuleAssetSavedObjectType } from '../../../common/schemas/csp_rule'; import { UPDATE_RULES_CONFIG_ROUTE_PATH } from '../../../common/constants'; -import { CIS_KUBERNETES_PACKAGE_NAME } from '../../../common/constants'; +import { CLOUD_SECURITY_POSTURE_PACKAGE_NAME } from '../../../common/constants'; import { CspRouter } from '../../types'; export const getPackagePolicy = async ( @@ -36,7 +36,7 @@ export const getPackagePolicy = async ( if (!packagePolicies || !packagePolicies[0].version) { throw new Error(`package policy Id '${packagePolicyId}' is not exist`); } - if (packagePolicies[0].package?.name !== CIS_KUBERNETES_PACKAGE_NAME) { + if (packagePolicies[0].package?.name !== CLOUD_SECURITY_POSTURE_PACKAGE_NAME) { // TODO: improve this validator to support any future CSP package throw new Error(`Package Policy Id '${packagePolicyId}' is not CSP package`); } From 19ab0f1f033f58b7c4ecc354a890bc5e85924aa3 Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Mon, 2 May 2022 10:08:59 +0200 Subject: [PATCH 32/89] Use new cases app icon (#131244) --- .../cases/public/components/case_view/does_not_exist.tsx | 2 +- x-pack/plugins/cases/public/components/no_privileges/index.tsx | 2 +- x-pack/plugins/cases/public/plugin.ts | 2 +- x-pack/plugins/cases/server/saved_object_types/cases.ts | 2 +- x-pack/plugins/observability/public/pages/cases/empty_page.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/cases/public/components/case_view/does_not_exist.tsx b/x-pack/plugins/cases/public/components/case_view/does_not_exist.tsx index 0073d2a491b74..7060265d26e0f 100644 --- a/x-pack/plugins/cases/public/components/case_view/does_not_exist.tsx +++ b/x-pack/plugins/cases/public/components/case_view/does_not_exist.tsx @@ -21,7 +21,7 @@ export const DoesNotExist = React.memo(({ caseId }: Props) => { return ( {i18n.DOES_NOT_EXIST_TITLE}
} titleSize="xs" body={

{i18n.DOES_NOT_EXIST_DESCRIPTION(caseId)}

} diff --git a/x-pack/plugins/cases/public/components/no_privileges/index.tsx b/x-pack/plugins/cases/public/components/no_privileges/index.tsx index 58d2aa36df583..2e5a4ef48839f 100644 --- a/x-pack/plugins/cases/public/components/no_privileges/index.tsx +++ b/x-pack/plugins/cases/public/components/no_privileges/index.tsx @@ -21,7 +21,7 @@ export const NoPrivilegesPage = React.memo(({ pageName }: NoPrivilegesPageProps) return ( {i18n.NO_PRIVILEGES_TITLE}} titleSize="xs" body={

{i18n.NO_PRIVILEGES_MSG(pageName)}

} diff --git a/x-pack/plugins/cases/public/plugin.ts b/x-pack/plugins/cases/public/plugin.ts index 3b124f920e889..559d670eeab68 100644 --- a/x-pack/plugins/cases/public/plugin.ts +++ b/x-pack/plugins/cases/public/plugin.ts @@ -47,7 +47,7 @@ export class CasesUiPlugin id: APP_ID, title: APP_TITLE, description: APP_DESC, - icon: 'watchesApp', + icon: 'casesApp', path: APP_PATH, showOnHomePage: false, category: 'admin', diff --git a/x-pack/plugins/cases/server/saved_object_types/cases.ts b/x-pack/plugins/cases/server/saved_object_types/cases.ts index e1df2366247ec..ea68fc24f60ca 100644 --- a/x-pack/plugins/cases/server/saved_object_types/cases.ts +++ b/x-pack/plugins/cases/server/saved_object_types/cases.ts @@ -158,7 +158,7 @@ export const createCaseSavedObjectType = ( management: { importableAndExportable: true, defaultSearchField: 'title', - icon: 'folderExclamation', + icon: 'casesApp', getTitle: (savedObject: SavedObject) => savedObject.attributes.title, onExport: async ( context: SavedObjectsExportTransformContext, diff --git a/x-pack/plugins/observability/public/pages/cases/empty_page.tsx b/x-pack/plugins/observability/public/pages/cases/empty_page.tsx index faeafa6b4730f..5f8be8483c9d3 100644 --- a/x-pack/plugins/observability/public/pages/cases/empty_page.tsx +++ b/x-pack/plugins/observability/public/pages/cases/empty_page.tsx @@ -103,7 +103,7 @@ const EmptyPageComponent = React.memo(({ actions, message, title return ( {title}} body={message &&

{message}

} actions={{renderActions}} From e98ee4a1fefcddc9c2910661e864952ee7f551b3 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 2 May 2022 11:12:27 +0200 Subject: [PATCH 33/89] [Synthetics] Fix throttling config formatter (#131158) Co-authored-by: Abdul Zahid Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../synthetics_service/formatters/browser.ts | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/browser.ts b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/browser.ts index 616d764c50abb..876827e453adf 100644 --- a/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/browser.ts +++ b/x-pack/plugins/synthetics/server/lib/synthetics_service/formatters/browser.ts @@ -10,6 +10,21 @@ import { BrowserFields, ConfigKey } from '../../../../common/runtime_types/monit export type BrowserFormatMap = Record; +const throttlingFormatter: Formatter = (fields) => { + if (!fields[ConfigKey.IS_THROTTLING_ENABLED]) return false; + + const getThrottlingValue = (v: string | undefined, suffix: 'd' | 'u' | 'l') => + v !== '' && v !== undefined ? `${v}${suffix}` : null; + + return [ + getThrottlingValue(fields[ConfigKey.DOWNLOAD_SPEED], 'd'), + getThrottlingValue(fields[ConfigKey.UPLOAD_SPEED], 'u'), + getThrottlingValue(fields[ConfigKey.LATENCY], 'l'), + ] + .filter((v) => v !== null) + .join('/'); +}; + export const browserFormatters: BrowserFormatMap = { [ConfigKey.METADATA]: (fields) => objectFormatter(fields[ConfigKey.METADATA]), [ConfigKey.URLS]: null, @@ -31,12 +46,7 @@ export const browserFormatters: BrowserFormatMap = { [ConfigKey.ZIP_URL_TLS_KEY_PASSPHRASE]: null, [ConfigKey.ZIP_URL_TLS_VERIFICATION_MODE]: null, [ConfigKey.IS_THROTTLING_ENABLED]: null, - [ConfigKey.THROTTLING_CONFIG]: (fields) => { - if (fields[ConfigKey.IS_THROTTLING_ENABLED] === false) { - return false; - } - return fields[ConfigKey.THROTTLING_CONFIG] ?? false; - }, + [ConfigKey.THROTTLING_CONFIG]: (fields) => throttlingFormatter(fields), [ConfigKey.DOWNLOAD_SPEED]: null, [ConfigKey.UPLOAD_SPEED]: null, [ConfigKey.LATENCY]: null, From 2ee62c42bcf085db31fa1eda39557b76d7779722 Mon Sep 17 00:00:00 2001 From: Milton Hultgren Date: Mon, 2 May 2022 11:40:12 +0200 Subject: [PATCH 34/89] [Stack Monitoring] Use server.publicBaseUrl in Alert links (#131154) * [Stack Monitoring] Use server.publicBaseUrl in Alert links (#127126) * Use empty string as fallback value Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/monitoring/server/alerts/base_rule.ts | 3 ++- x-pack/plugins/monitoring/server/static_globals.ts | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/monitoring/server/alerts/base_rule.ts b/x-pack/plugins/monitoring/server/alerts/base_rule.ts index 9c9d993e0a340..1888265c124f6 100644 --- a/x-pack/plugins/monitoring/server/alerts/base_rule.ts +++ b/x-pack/plugins/monitoring/server/alerts/base_rule.ts @@ -344,6 +344,7 @@ export class BaseRule { if (ccs) { globalState.push(`ccs:${ccs}`); } - return `${Globals.app.url}/app/monitoring#/${link}?_g=(${globalState.toString()})`; + + return `${Globals.app.url ?? ''}/app/monitoring#/${link}?_g=(${globalState.toString()})`; } } diff --git a/x-pack/plugins/monitoring/server/static_globals.ts b/x-pack/plugins/monitoring/server/static_globals.ts index e601dd0c55155..429ec8693a3e7 100644 --- a/x-pack/plugins/monitoring/server/static_globals.ts +++ b/x-pack/plugins/monitoring/server/static_globals.ts @@ -6,7 +6,6 @@ */ import { CoreSetup, ElasticsearchClient, Logger, PluginInitializerContext } from '@kbn/core/server'; -import url from 'url'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { MonitoringConfig } from './config'; import { PluginsSetup } from './types'; @@ -32,7 +31,7 @@ export type EndpointTypes = export type ClientParams = estypes.SearchRequest | undefined; interface IAppGlobals { - url: string; + url?: string; isCloud: boolean; config: MonitoringConfig; getLogger: GetLogger; @@ -79,11 +78,8 @@ export class Globals { return body; }); - const { protocol, hostname, port } = coreSetup.http.getServerInfo(); - const pathname = coreSetup.http.basePath.serverBasePath; - Globals._app = { - url: url.format({ protocol, hostname, port, pathname }), + url: coreSetup.http.basePath.publicBaseUrl, isCloud: setupPlugins.cloud?.isCloudEnabled || false, config, getLogger, From abd615a15f8c92518c4fc5e9bf2a1ccfa3016f07 Mon Sep 17 00:00:00 2001 From: Katerina Patticha Date: Mon, 2 May 2022 11:41:09 +0200 Subject: [PATCH 35/89] [APM] Replace environment dropdown with SuggestionsSelect * Extend /suggestions api to accept range query * Add new endpoint /suggestions_with_terms * Use suggestionSelect for environment filter * Clean up route * UI tweaks for the EuiComboBox * Make suggestion endpoint for service enrvironment explicit - follow same naming convention for fields and values * Fix deps * Replace query_string with wildcard query * Rename field to fieldName * Introduce new enpoint has not defined environment * Show Not defined option in environment filter * get environment label for anomaly timeseries * Fix types * Select environment if there is only one available * Fix tests * move getPreferredServiceAnomalyTimeseries * Remove redirect and get environment list from context * Remove endpoint for not defined option * Suggestions route fallbacks to use terms aggregation when service name is set * Set default ranges (now-24h) * Get environment list from context * Fix types * State should be handled by consuming component * Use searchAggregatedTransactions * Make ranges required for /suggestion endpoint - the client set a default 24h-now if no URL is set * Clean up files by separating the helper * Fix debounce handler - remove unused initial state * Add option to run APM cypress tests in the flaky test runner * Clean up environment context - context will be responsible only for returning environment(s) info - removing additional info not related to the context * Rename event handlers * Consuming component sets ranges for the suggestions select * Immediately resolve the promise with empty response in case searchValue is empty * Fix tests * Get serviceName from useApmParams * Fix type * Initialize time ranges inside the components * Remove redundant optimization * Fix eslint import errors --- .../apm/common/environment_filter_values.ts | 9 +- .../service_inventory.spec.ts | 41 ++++-- .../service_overview/service_overview.spec.ts | 13 +- .../apm/public/components/alerting/fields.tsx | 47 ++++--- .../form_row_suggestions_select.tsx | 12 +- .../service_page/service_page.tsx | 2 +- .../filters_section.tsx | 6 +- .../shared/environment_filter/index.tsx | 83 ++---------- .../shared/environment_select/index.tsx | 124 ++++++++++++++++++ .../shared/suggestions_select/index.tsx | 30 +++-- .../suggestions_select.stories.tsx | 6 +- .../environments_context.tsx | 4 +- .../public/hooks/use_environments_fetcher.tsx | 23 +--- .../routes/suggestions/get_suggestions.ts | 26 +++- .../get_suggestions_with_terms_aggregation.ts | 75 +++++++++++ .../apm/server/routes/suggestions/route.ts | 47 +++++-- .../translations/translations/fr-FR.json | 2 - .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 2 - .../tests/suggestions/suggestions.spec.ts | 14 +- .../apm/correlations/latency_correlations.ts | 1 - 21 files changed, 381 insertions(+), 188 deletions(-) create mode 100644 x-pack/plugins/apm/public/components/shared/environment_select/index.tsx create mode 100644 x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts diff --git a/x-pack/plugins/apm/common/environment_filter_values.ts b/x-pack/plugins/apm/common/environment_filter_values.ts index ddd1ffd9b8d45..df53b08fcf56f 100644 --- a/x-pack/plugins/apm/common/environment_filter_values.ts +++ b/x-pack/plugins/apm/common/environment_filter_values.ts @@ -33,13 +33,6 @@ export function getEnvironmentLabel(environment: string) { return environment; } -// #TODO Once we replace the select dropdown we can remove it -// EuiSelect > EuiSelectOption accepts text attribute -export const ENVIRONMENT_ALL_SELECT_OPTION = { - value: ENVIRONMENT_ALL_VALUE, - text: getEnvironmentLabel(ENVIRONMENT_ALL_VALUE), -}; - export const ENVIRONMENT_ALL = { value: ENVIRONMENT_ALL_VALUE, label: getEnvironmentLabel(ENVIRONMENT_ALL_VALUE), @@ -47,7 +40,7 @@ export const ENVIRONMENT_ALL = { export const ENVIRONMENT_NOT_DEFINED = { value: ENVIRONMENT_NOT_DEFINED_VALUE, - text: getEnvironmentLabel(ENVIRONMENT_NOT_DEFINED_VALUE), + label: getEnvironmentLabel(ENVIRONMENT_NOT_DEFINED_VALUE), }; export function getEnvironmentEsField(environment: string) { diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts index 0dab9c6f2440f..216a9c87d6db8 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts @@ -20,7 +20,7 @@ const serviceInventoryHref = url.format({ query: timeRange, }); -const apiRequestsToIntercept = [ +const mainApiRequestsToIntercept = [ { endpoint: '/internal/apm/services?*', aliasName: 'servicesRequest', @@ -31,7 +31,14 @@ const apiRequestsToIntercept = [ }, ]; -const aliasNames = apiRequestsToIntercept.map( +const secondaryApiRequestsToIntercept = [ + { + endpoint: 'internal/apm/suggestions?*', + aliasName: 'suggestionsRequest', + }, +]; + +const mainAliasNames = mainApiRequestsToIntercept.map( ({ aliasName }) => `@${aliasName}` ); @@ -77,43 +84,51 @@ describe('When navigating to the service inventory', () => { describe.skip('Calls APIs', () => { beforeEach(() => { - apiRequestsToIntercept.map(({ endpoint, aliasName }) => { - cy.intercept('GET', endpoint).as(aliasName); - }); + [...mainApiRequestsToIntercept, ...secondaryApiRequestsToIntercept].map( + ({ endpoint, aliasName }) => { + cy.intercept('GET', endpoint).as(aliasName); + } + ); cy.loginAsReadOnlyUser(); cy.visit(serviceInventoryHref); }); it('with the correct environment when changing the environment', () => { - cy.wait(aliasNames); + cy.wait(mainAliasNames); + cy.get('[data-test-subj="environmentFilter"]').type('pro'); + + cy.expectAPIsToHaveBeenCalledWith({ + apisIntercepted: ['@suggestionsRequest'], + value: 'fieldValue=pro', + }); - cy.get('[data-test-subj="environmentFilter"]').select('production'); + cy.contains('button', 'production').click(); cy.expectAPIsToHaveBeenCalledWith({ - apisIntercepted: aliasNames, + apisIntercepted: mainAliasNames, value: 'environment=production', }); }); it('when clicking the refresh button', () => { - cy.wait(aliasNames); + cy.wait(mainAliasNames); cy.contains('Refresh').click(); - cy.wait(aliasNames); + cy.wait(mainAliasNames); }); it('when selecting a different time range and clicking the update button', () => { - cy.wait(aliasNames); + cy.wait(mainAliasNames); cy.selectAbsoluteTimeRange( moment(timeRange.rangeFrom).subtract(5, 'm').toISOString(), moment(timeRange.rangeTo).subtract(5, 'm').toISOString() ); cy.contains('Update').click(); - cy.wait(aliasNames); + cy.wait(mainAliasNames); cy.contains('Refresh').click(); - cy.wait(aliasNames); + cy.wait(mainAliasNames); }); }); }); diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_overview/service_overview.spec.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_overview/service_overview.spec.ts index 48fe14b44c793..edb1b8a82f6dd 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_overview/service_overview.spec.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_overview/service_overview.spec.ts @@ -216,7 +216,18 @@ describe('Service Overview', () => { it('with the correct environment when changing the environment', () => { cy.wait(aliasNames, { requestTimeout: 10000 }); - cy.get('[data-test-subj="environmentFilter"]').select('production'); + cy.intercept('GET', 'internal/apm/suggestions?*').as( + 'suggestionsRequest' + ); + + cy.get('[data-test-subj="environmentFilter"]').type('pro').click(); + + cy.expectAPIsToHaveBeenCalledWith({ + apisIntercepted: ['@suggestionsRequest'], + value: 'fieldValue=pro', + }); + + cy.contains('button', 'production').click(); cy.expectAPIsToHaveBeenCalledWith({ apisIntercepted: aliasNames, diff --git a/x-pack/plugins/apm/public/components/alerting/fields.tsx b/x-pack/plugins/apm/public/components/alerting/fields.tsx index 9ea3c5aa2a6bd..07373bdba9a21 100644 --- a/x-pack/plugins/apm/public/components/alerting/fields.tsx +++ b/x-pack/plugins/apm/public/components/alerting/fields.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import moment from 'moment'; import { EuiFieldNumber } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; @@ -38,16 +38,21 @@ export function ServiceField({ })} > ); @@ -68,16 +73,21 @@ export function EnvironmentField({ })} > ); @@ -96,12 +106,15 @@ export function TransactionTypeField({ return ( ); diff --git a/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/form_row_suggestions_select.tsx b/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/form_row_suggestions_select.tsx index 5fa3a46b00901..2fb481b26be2e 100644 --- a/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/form_row_suggestions_select.tsx +++ b/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/form_row_suggestions_select.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import moment from 'moment'; import { EuiDescribedFormGroup, EuiFormRow } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; @@ -13,7 +13,7 @@ import { ENVIRONMENT_ALL } from '../../../../../../../common/environment_filter_ interface Props { title: string; - field: string; + fieldName: string; description: string; fieldLabel: string; value?: string; @@ -24,7 +24,7 @@ interface Props { export function FormRowSuggestionsSelect({ title, - field, + fieldName, description, fieldLabel, value, @@ -40,9 +40,9 @@ export function FormRowSuggestionsSelect({ > diff --git a/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/service_page.tsx b/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/service_page.tsx index 1ede5cd5405c7..50872375027dc 100644 --- a/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/service_page.tsx +++ b/x-pack/plugins/apm/public/components/app/settings/agent_configurations/agent_configuration_create_edit/service_page/service_page.tsx @@ -97,7 +97,7 @@ export function ServicePage({ newConfig, setNewConfig, onClickNext }: Props) { 'xpack.apm.agentConfig.servicePage.service.fieldLabel', { defaultMessage: 'Service name' } )} - field={SERVICE_NAME} + fieldName={SERVICE_NAME} value={newConfig.service.name} onChange={(name) => { setNewConfig((prev) => ({ diff --git a/x-pack/plugins/apm/public/components/app/settings/custom_link/create_edit_custom_link_flyout/filters_section.tsx b/x-pack/plugins/apm/public/components/app/settings/custom_link/create_edit_custom_link_flyout/filters_section.tsx index 3b1438b4dddb0..60f6003ceeeb4 100644 --- a/x-pack/plugins/apm/public/components/app/settings/custom_link/create_edit_custom_link_flyout/filters_section.tsx +++ b/x-pack/plugins/apm/public/components/app/settings/custom_link/create_edit_custom_link_flyout/filters_section.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import moment from 'moment'; import { EuiButtonEmpty, EuiFlexGroup, @@ -119,7 +119,7 @@ export function FiltersSection({ diff --git a/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx b/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx index 9a3d677b3f078..80217273c62d3 100644 --- a/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/environment_filter/index.tsx @@ -5,18 +5,11 @@ * 2.0. */ -import { EuiSelect } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; import { History } from 'history'; import React from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import { - ENVIRONMENT_ALL_SELECT_OPTION, - ENVIRONMENT_NOT_DEFINED, -} from '../../../../common/environment_filter_values'; import { fromQuery, toQuery } from '../links/url_helpers'; -import { FETCH_STATUS } from '../../../hooks/use_fetcher'; -import { Environment } from '../../../../common/environment_rt'; +import { EnvironmentSelect } from '../environment_select'; import { useEnvironmentsContext } from '../../../context/environments_context/use_environments_context'; function updateEnvironmentUrl( @@ -34,77 +27,19 @@ function updateEnvironmentUrl( }); } -const SEPARATOR_OPTION = { - text: `- ${i18n.translate( - 'xpack.apm.filter.environment.selectEnvironmentLabel', - { defaultMessage: 'Select environment' } - )} -`, - disabled: true, -}; - -function getOptions(environments: string[]) { - const environmentOptions = environments - .filter((env) => env !== ENVIRONMENT_NOT_DEFINED.value) - .map((environment) => ({ - value: environment, - text: environment, - })); - - return [ - ENVIRONMENT_ALL_SELECT_OPTION, - ...(environments.includes(ENVIRONMENT_NOT_DEFINED.value) - ? [ENVIRONMENT_NOT_DEFINED] - : []), - ...(environmentOptions.length > 0 ? [SEPARATOR_OPTION] : []), - ...environmentOptions, - ]; -} - export function ApmEnvironmentFilter() { - const { status, environments, environment } = useEnvironmentsContext(); - - return ( - - ); -} - -export function EnvironmentFilter({ - environment, - environments, - status, -}: { - environment: Environment; - environments: Environment[]; - status: FETCH_STATUS; -}) { + const { environment, environments, status } = useEnvironmentsContext(); const history = useHistory(); const location = useLocation(); - // Set the min-width so we don't see as much collapsing of the select during - // the loading state. 200px is what is looks like if "production" is - // the contents. - const minWidth = 200; - - const options = getOptions(environments); - return ( - { - updateEnvironmentUrl(history, location, event.target.value); - }} - isLoading={status === FETCH_STATUS.LOADING} - style={{ minWidth }} - data-test-subj="environmentFilter" + + updateEnvironmentUrl(history, location, changeValue) + } /> ); } diff --git a/x-pack/plugins/apm/public/components/shared/environment_select/index.tsx b/x-pack/plugins/apm/public/components/shared/environment_select/index.tsx new file mode 100644 index 0000000000000..f954d6d693171 --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/environment_select/index.tsx @@ -0,0 +1,124 @@ +/* + * Copyright 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 { isEmpty } from 'lodash'; +import { i18n } from '@kbn/i18n'; +import React, { useMemo, useState } from 'react'; +import { debounce } from 'lodash'; +import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; +import { + getEnvironmentLabel, + ENVIRONMENT_NOT_DEFINED, + ENVIRONMENT_ALL, +} from '../../../../common/environment_filter_values'; +import { SERVICE_ENVIRONMENT } from '../../../../common/elasticsearch_fieldnames'; +import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; +import { useTimeRange } from '../../../hooks/use_time_range'; +import { useApmParams } from '../../../hooks/use_apm_params'; +import { Environment } from '../../../../common/environment_rt'; + +function getEnvironmentOptions(environments: Environment[]) { + const environmentOptions = environments + .filter((env) => env !== ENVIRONMENT_NOT_DEFINED.value) + .map((environment) => ({ + value: environment, + label: environment, + })); + + return [ + ENVIRONMENT_ALL, + ...(environments.includes(ENVIRONMENT_NOT_DEFINED.value) + ? [ENVIRONMENT_NOT_DEFINED] + : []), + ...environmentOptions, + ]; +} + +export function EnvironmentSelect({ + environment, + availableEnvironments, + status, + onChange, +}: { + environment: Environment; + availableEnvironments: Environment[]; + status: FETCH_STATUS; + onChange: (value: string) => void; +}) { + const [searchValue, setSearchValue] = useState(''); + const { + path: { serviceName }, + query: { rangeFrom, rangeTo }, + } = useApmParams('/services/{serviceName}/*'); + + const { start, end } = useTimeRange({ rangeFrom, rangeTo }); + + const selectedOptions: Array> = [ + { + value: environment, + label: getEnvironmentLabel(environment), + }, + ]; + + const onSelect = (changedOptions: Array>) => { + if (changedOptions.length === 1 && changedOptions[0].value) { + onChange(changedOptions[0].value); + } + }; + + const { data, status: searchStatus } = useFetcher( + (callApmApi) => { + return isEmpty(searchValue) + ? Promise.resolve({ terms: [] }) + : callApmApi('GET /internal/apm/suggestions', { + params: { + query: { + fieldName: SERVICE_ENVIRONMENT, + fieldValue: searchValue, + serviceName, + start, + end, + }, + }, + }); + }, + [searchValue, start, end, serviceName] + ); + const terms = data?.terms ?? []; + + const options: Array> = [ + ...(searchValue === '' + ? getEnvironmentOptions(availableEnvironments) + : terms.map((name) => { + return { label: name, value: name }; + })), + ]; + + const onSearch = useMemo(() => debounce(setSearchValue, 300), []); + + return ( + onSelect(changedOptions)} + onSearchChange={onSearch} + isLoading={ + status === FETCH_STATUS.LOADING || searchStatus === FETCH_STATUS.LOADING + } + /> + ); +} diff --git a/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx b/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx index 8b8907af4bc21..66c8980bf00c6 100644 --- a/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx @@ -11,27 +11,33 @@ import React, { useCallback, useState } from 'react'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; interface SuggestionsSelectProps { - allOption?: EuiComboBoxOptionOption; + customOptions?: Array>; customOptionText?: string; defaultValue?: string; - field: string; + fieldName: string; + start: string; + end: string; onChange: (value?: string) => void; isClearable?: boolean; isInvalid?: boolean; placeholder: string; dataTestSubj?: string; + prepend?: string; } export function SuggestionsSelect({ - allOption, + customOptions, customOptionText, defaultValue, - field, + fieldName, + start, + end, onChange, placeholder, isInvalid, dataTestSubj, isClearable = true, + prepend, }: SuggestionsSelectProps) { let defaultOption: EuiComboBoxOptionOption | undefined; @@ -48,11 +54,16 @@ export function SuggestionsSelect({ (callApmApi) => { return callApmApi('GET /internal/apm/suggestions', { params: { - query: { field, string: searchValue }, + query: { + fieldName, + fieldValue: searchValue, + start, + end, + }, }, }); }, - [field, searchValue], + [fieldName, searchValue, start, end], { preservePreviousData: false } ); @@ -85,11 +96,7 @@ export function SuggestionsSelect({ const terms = data?.terms ?? []; const options: Array> = [ - ...(allOption && - (searchValue === '' || - searchValue.toLowerCase() === allOption.label.toLowerCase()) - ? [allOption] - : []), + ...(customOptions ? customOptions : []), ...terms.map((name) => { return { label: name, value: name }; }), @@ -111,6 +118,7 @@ export function SuggestionsSelect({ style={{ minWidth: '256px' }} onCreateOption={handleCreateOption} data-test-subj={dataTestSubj} + prepend={prepend} /> ); } diff --git a/x-pack/plugins/apm/public/components/shared/suggestions_select/suggestions_select.stories.tsx b/x-pack/plugins/apm/public/components/shared/suggestions_select/suggestions_select.stories.tsx index 742ea46cee539..58de938a70e34 100644 --- a/x-pack/plugins/apm/public/components/shared/suggestions_select/suggestions_select.stories.tsx +++ b/x-pack/plugins/apm/public/components/shared/suggestions_select/suggestions_select.stories.tsx @@ -60,11 +60,13 @@ export const Example: Story = ({ }) => { return ( {}} placeholder={placeholder} + start={'2022-04-13T10:29:28.541Z'} + end={'2021-04-13T10:29:28.541Z'} /> ); }; diff --git a/x-pack/plugins/apm/public/context/environments_context/environments_context.tsx b/x-pack/plugins/apm/public/context/environments_context/environments_context.tsx index 6350dd3f0a7e8..41ae58ba04825 100644 --- a/x-pack/plugins/apm/public/context/environments_context/environments_context.tsx +++ b/x-pack/plugins/apm/public/context/environments_context/environments_context.tsx @@ -8,9 +8,9 @@ import React from 'react'; import { ENVIRONMENT_ALL } from '../../../common/environment_filter_values'; import { Environment } from '../../../common/environment_rt'; import { useApmParams } from '../../hooks/use_apm_params'; -import { useEnvironmentsFetcher } from '../../hooks/use_environments_fetcher'; import { FETCH_STATUS } from '../../hooks/use_fetcher'; import { useTimeRange } from '../../hooks/use_time_range'; +import { useEnvironmentsFetcher } from '../../hooks/use_environments_fetcher'; export const EnvironmentsContext = React.createContext<{ environment: Environment; @@ -48,9 +48,9 @@ export function EnvironmentsContextProvider({ return ( {children} diff --git a/x-pack/plugins/apm/public/hooks/use_environments_fetcher.tsx b/x-pack/plugins/apm/public/hooks/use_environments_fetcher.tsx index edd1b59be144e..50ad012e1aa02 100644 --- a/x-pack/plugins/apm/public/hooks/use_environments_fetcher.tsx +++ b/x-pack/plugins/apm/public/hooks/use_environments_fetcher.tsx @@ -5,23 +5,7 @@ * 2.0. */ -import { useMemo } from 'react'; import { useFetcher } from './use_fetcher'; -import { - ENVIRONMENT_ALL, - ENVIRONMENT_NOT_DEFINED, -} from '../../common/environment_filter_values'; - -function getEnvironmentOptions(environments: string[]) { - const environmentOptions = environments - .filter((env) => env !== ENVIRONMENT_NOT_DEFINED.value) - .map((environment) => ({ - value: environment, - text: environment, - })); - - return [ENVIRONMENT_ALL, ...environmentOptions]; -} const INITIAL_DATA = { environments: [] }; @@ -51,10 +35,5 @@ export function useEnvironmentsFetcher({ [start, end, serviceName] ); - const environmentOptions = useMemo( - () => getEnvironmentOptions(data.environments), - [data?.environments] - ); - - return { environments: data.environments, status, environmentOptions }; + return { environments: data.environments, status }; } diff --git a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts index 624bf2bb4c018..f65a843ed95d0 100644 --- a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts +++ b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts @@ -4,23 +4,26 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import { ProcessorEvent } from '../../../common/processor_event'; import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; import { Setup } from '../../lib/helpers/setup_request'; export async function getSuggestions({ - field, + fieldName, + fieldValue, searchAggregatedTransactions, setup, size, - string, + start, + end, }: { - field: string; + fieldName: string; + fieldValue: string; searchAggregatedTransactions: boolean; setup: Setup; size: number; - string: string; + start: number; + end: number; }) { const { apmEventClient } = setup; @@ -34,9 +37,18 @@ export async function getSuggestions({ }, body: { case_insensitive: true, - field, + field: fieldName, size, - string, + string: fieldValue, + index_filter: { + range: { + ['@timestamp']: { + gte: start, + lte: end, + format: 'epoch_millis', + }, + }, + }, }, }); diff --git a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts new file mode 100644 index 0000000000000..268bc4151efdd --- /dev/null +++ b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { rangeQuery, termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; +import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; +import { Setup } from '../../lib/helpers/setup_request'; + +export async function getSuggestionsWithTermsAggregation({ + fieldName, + fieldValue, + searchAggregatedTransactions, + serviceName, + setup, + size, + start, + end, +}: { + fieldName: string; + fieldValue: string; + searchAggregatedTransactions: boolean; + serviceName: string; + setup: Setup; + size: number; + start: number; + end: number; +}) { + const { apmEventClient } = setup; + + const response = await apmEventClient.search( + 'get_suggestions_with_terms_aggregation', + { + apm: { + events: [ + getProcessorEventForTransactions(searchAggregatedTransactions), + ProcessorEvent.error, + ProcessorEvent.metric, + ], + }, + body: { + timeout: '1500ms', + size: 0, + query: { + bool: { + filter: [ + ...termQuery(SERVICE_NAME, serviceName), + ...rangeQuery(start, end), + { + wildcard: { + [fieldName]: `*${fieldValue}*`, + }, + }, + ], + }, + }, + aggs: { + items: { + terms: { field: fieldName, size }, + }, + }, + }, + } + ); + + return { + terms: + response.aggregations?.items.buckets.map( + (bucket) => bucket.key as string + ) ?? [], + }; +} diff --git a/x-pack/plugins/apm/server/routes/suggestions/route.ts b/x-pack/plugins/apm/server/routes/suggestions/route.ts index b49204cd86fc6..68f94634a5ded 100644 --- a/x-pack/plugins/apm/server/routes/suggestions/route.ts +++ b/x-pack/plugins/apm/server/routes/suggestions/route.ts @@ -8,20 +8,29 @@ import * as t from 'io-ts'; import { maxSuggestions } from '@kbn/observability-plugin/common'; import { getSuggestions } from './get_suggestions'; +import { getSuggestionsWithTermsAggregation } from './get_suggestions_with_terms_aggregation'; import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; import { setupRequest } from '../../lib/helpers/setup_request'; import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { rangeRt } from '../default_api_types'; const suggestionsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/suggestions', - params: t.partial({ - query: t.type({ field: t.string, string: t.string }), + params: t.type({ + query: t.intersection([ + t.type({ + fieldName: t.string, + fieldValue: t.string, + }), + rangeRt, + t.partial({ serviceName: t.string }), + ]), }), options: { tags: ['access:apm'] }, handler: async (resources): Promise<{ terms: string[] }> => { const setup = await setupRequest(resources); const { context, params } = resources; - const { field, string } = params.query; + const { fieldName, fieldValue, serviceName, start, end } = params.query; const searchAggregatedTransactions = await getSearchAggregatedTransactions({ apmEventClient: setup.apmEventClient, config: setup.config, @@ -31,16 +40,32 @@ const suggestionsRoute = createApmServerRoute({ const size = await coreContext.uiSettings.client.get( maxSuggestions ); - const suggestions = await getSuggestions({ - field, - searchAggregatedTransactions, - setup, - size, - string, - }); + + const suggestions = serviceName + ? await getSuggestionsWithTermsAggregation({ + fieldName, + fieldValue, + searchAggregatedTransactions, + serviceName, + setup, + size, + start, + end, + }) + : await getSuggestions({ + fieldName, + fieldValue, + searchAggregatedTransactions, + setup, + size, + start, + end, + }); return suggestions; }, }); -export const suggestionsRouteRepository = suggestionsRoute; +export const suggestionsRouteRepository = { + ...suggestionsRoute, +}; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index bbe07a375e42d..a5df7f232217d 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -7493,7 +7493,6 @@ "xpack.apm.filter.environment.allLabel": "Tous", "xpack.apm.filter.environment.label": "Environnement", "xpack.apm.filter.environment.notDefinedLabel": "Non défini", - "xpack.apm.filter.environment.selectEnvironmentLabel": "Sélectionner l'environnement", "xpack.apm.fleet_integration.settings.advancedOptionsLavel": "Options avancées", "xpack.apm.fleet_integration.settings.agentAuthorization.anonymousAllowAgentHelpText": "Noms d'agents autorisés pour l'accès anonyme.", "xpack.apm.fleet_integration.settings.agentAuthorization.anonymousAllowAgentLabel": "Agents autorisés", @@ -7720,7 +7719,6 @@ "xpack.apm.propertiesTable.tabs.metadataLabel": "Métadonnées", "xpack.apm.propertiesTable.tabs.timelineLabel": "Chronologie", "xpack.apm.searchInput.filter": "Filtrer…", - "xpack.apm.selectCustomOptionText": "Ajouter \\{searchValue\\} en tant que nouvelle option", "xpack.apm.selectPlaceholder": "Sélectionner une option :", "xpack.apm.serviceDependencies.breakdownChartTitle": "Temps consacré par dépendance", "xpack.apm.serviceDetails.dependenciesTabLabel": "Dépendances", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 44cb5fcef981a..ce64e7d5ffda3 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7481,7 +7481,6 @@ "xpack.apm.filter.environment.allLabel": "すべて", "xpack.apm.filter.environment.label": "環境", "xpack.apm.filter.environment.notDefinedLabel": "未定義", - "xpack.apm.filter.environment.selectEnvironmentLabel": "環境を選択", "xpack.apm.fleet_integration.settings.advancedOptionsLavel": "高度なオプション", "xpack.apm.fleet_integration.settings.agentAuthorization.anonymousAllowAgentHelpText": "匿名アクセスの許可されたエージェント名。", "xpack.apm.fleet_integration.settings.agentAuthorization.anonymousAllowAgentLabel": "許可されたエージェント", @@ -7706,7 +7705,6 @@ "xpack.apm.propertiesTable.tabs.metadataLabel": "メタデータ", "xpack.apm.propertiesTable.tabs.timelineLabel": "Timeline", "xpack.apm.searchInput.filter": "フィルター...", - "xpack.apm.selectCustomOptionText": "\\{searchValue\\}を新しいオプションとして追加", "xpack.apm.selectPlaceholder": "オプションを選択:", "xpack.apm.serviceDependencies.breakdownChartTitle": "依存関係にかかった時間", "xpack.apm.serviceDetails.dependenciesTabLabel": "依存関係", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 7101b5b874b78..224ddc34cc13c 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7498,7 +7498,6 @@ "xpack.apm.filter.environment.allLabel": "全部", "xpack.apm.filter.environment.label": "环境", "xpack.apm.filter.environment.notDefinedLabel": "未定义", - "xpack.apm.filter.environment.selectEnvironmentLabel": "选择环境", "xpack.apm.fleet_integration.settings.advancedOptionsLavel": "高级选项", "xpack.apm.fleet_integration.settings.agentAuthorization.anonymousAllowAgentHelpText": "允许进行匿名访问的代理名称。", "xpack.apm.fleet_integration.settings.agentAuthorization.anonymousAllowAgentLabel": "允许的代理", @@ -7725,7 +7724,6 @@ "xpack.apm.propertiesTable.tabs.metadataLabel": "元数据", "xpack.apm.propertiesTable.tabs.timelineLabel": "时间线", "xpack.apm.searchInput.filter": "筛选...", - "xpack.apm.selectCustomOptionText": "将 \\{searchValue\\} 添加为新选项", "xpack.apm.selectPlaceholder": "选择选项:", "xpack.apm.serviceDependencies.breakdownChartTitle": "依赖项花费的时间", "xpack.apm.serviceDetails.dependenciesTabLabel": "依赖项", diff --git a/x-pack/test/apm_api_integration/tests/suggestions/suggestions.spec.ts b/x-pack/test/apm_api_integration/tests/suggestions/suggestions.spec.ts index 74bdc860bfba3..692cd1c0cf7f1 100644 --- a/x-pack/test/apm_api_integration/tests/suggestions/suggestions.spec.ts +++ b/x-pack/test/apm_api_integration/tests/suggestions/suggestions.spec.ts @@ -9,12 +9,14 @@ import { SERVICE_NAME, TRANSACTION_TYPE, } from '@kbn/apm-plugin/common/elasticsearch_fieldnames'; +import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; import { FtrProviderContext } from '../../common/ftr_provider_context'; export default function suggestionsTests({ getService }: FtrProviderContext) { const registry = getService('registry'); const apmApiClient = getService('apmApiClient'); const archiveName = 'apm_8.0.0'; + const { start, end } = archives_metadata[archiveName]; registry.when( 'suggestions when data is loaded', @@ -25,7 +27,7 @@ export default function suggestionsTests({ getService }: FtrProviderContext) { it('returns all environments', async () => { const { body } = await apmApiClient.readUser({ endpoint: 'GET /internal/apm/suggestions', - params: { query: { field: SERVICE_ENVIRONMENT, string: '' } }, + params: { query: { fieldName: SERVICE_ENVIRONMENT, fieldValue: '', start, end } }, }); expectSnapshot(body).toMatchInline(` @@ -43,7 +45,7 @@ export default function suggestionsTests({ getService }: FtrProviderContext) { it('returns items matching the string parameter', async () => { const { body } = await apmApiClient.readUser({ endpoint: 'GET /internal/apm/suggestions', - params: { query: { field: SERVICE_ENVIRONMENT, string: 'pr' } }, + params: { query: { fieldName: SERVICE_ENVIRONMENT, fieldValue: 'pr', start, end } }, }); expectSnapshot(body).toMatchInline(` @@ -62,7 +64,7 @@ export default function suggestionsTests({ getService }: FtrProviderContext) { it('returns all services', async () => { const { body } = await apmApiClient.readUser({ endpoint: 'GET /internal/apm/suggestions', - params: { query: { field: SERVICE_NAME, string: '' } }, + params: { query: { fieldName: SERVICE_NAME, fieldValue: '', start, end } }, }); expectSnapshot(body).toMatchInline(` @@ -86,7 +88,7 @@ export default function suggestionsTests({ getService }: FtrProviderContext) { it('returns items matching the string parameter', async () => { const { body } = await apmApiClient.readUser({ endpoint: 'GET /internal/apm/suggestions', - params: { query: { field: SERVICE_NAME, string: 'aud' } }, + params: { query: { fieldName: SERVICE_NAME, fieldValue: 'aud', start, end } }, }); expectSnapshot(body).toMatchInline(` @@ -105,7 +107,7 @@ export default function suggestionsTests({ getService }: FtrProviderContext) { it('returns all transaction types', async () => { const { body } = await apmApiClient.readUser({ endpoint: 'GET /internal/apm/suggestions', - params: { query: { field: TRANSACTION_TYPE, string: '' } }, + params: { query: { fieldName: TRANSACTION_TYPE, fieldValue: '', start, end } }, }); expectSnapshot(body).toMatchInline(` @@ -125,7 +127,7 @@ export default function suggestionsTests({ getService }: FtrProviderContext) { it('returns items matching the string parameter', async () => { const { body } = await apmApiClient.readUser({ endpoint: 'GET /internal/apm/suggestions', - params: { query: { field: TRANSACTION_TYPE, string: 'w' } }, + params: { query: { fieldName: TRANSACTION_TYPE, fieldValue: 'w', start, end } }, }); expectSnapshot(body).toMatchInline(` diff --git a/x-pack/test/functional/apps/apm/correlations/latency_correlations.ts b/x-pack/test/functional/apps/apm/correlations/latency_correlations.ts index 22b553d006303..5cba074eedbec 100644 --- a/x-pack/test/functional/apps/apm/correlations/latency_correlations.ts +++ b/x-pack/test/functional/apps/apm/correlations/latency_correlations.ts @@ -70,7 +70,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await retry.try(async () => { const apmMainContainerText = await testSubjects.getVisibleTextAll('apmMainContainer'); const apmMainContainerTextItems = apmMainContainerText[0].split('\n'); - expect(apmMainContainerTextItems).to.not.contain('No services found'); expect(apmMainContainerTextItems).to.contain('opbeans-go'); From 8ace5e47555d4b01a9853c430f7adb4539d2925c Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 2 May 2022 11:58:29 +0200 Subject: [PATCH 36/89] wait for vis update before asserting chart (#131304) --- test/functional/apps/visualize/_tsvb_chart.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/functional/apps/visualize/_tsvb_chart.ts b/test/functional/apps/visualize/_tsvb_chart.ts index ec3852b309d3f..d462a89108c09 100644 --- a/test/functional/apps/visualize/_tsvb_chart.ts +++ b/test/functional/apps/visualize/_tsvb_chart.ts @@ -111,6 +111,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.selectAggType('derivative', 1); await visualBuilder.setFieldForAggregation('Max of machine.ram', 1); + await visChart.waitForVisualizationRenderingStabilized(); const value = await visualBuilder.getMetricValue(); expect(value).to.eql('0'); @@ -197,6 +198,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.selectAggType('derivative', 1); await visualBuilder.setFieldForAggregation('Max of machine.ram', 1); + await visChart.waitForVisualizationRenderingStabilized(); const value = await visualBuilder.getGaugeCount(); expect(value).to.eql('0'); @@ -226,6 +228,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.clickSeriesOption(); await visualBuilder.changeDataFormatter('number'); + await visChart.waitForVisualizationRenderingStabilized(); const gaugeLabel = await visualBuilder.getGaugeLabel(); const gaugeCount = await visualBuilder.getGaugeCount(); @@ -239,6 +242,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.clickPanelOptions('gauge'); await visualBuilder.setMetricsDataTimerangeMode('Last value'); + await visChart.waitForVisualizationRenderingStabilized(); const gaugeLabel = await visualBuilder.getGaugeLabel(); const gaugeCount = await visualBuilder.getGaugeCount(); @@ -351,6 +355,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.selectAggType('derivative', 1); await visualBuilder.setFieldForAggregation('Max of machine.ram', 1); + await visChart.waitForVisualizationRenderingStabilized(); const value = await visualBuilder.getTopNCount(); expect(value).to.eql('0'); @@ -579,6 +584,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ]; await visualBuilder.clickSeriesOption(); await visualBuilder.changeDataFormatter('number'); + await visChart.waitForVisualizationRenderingStabilized(); const legendItems = await visualBuilder.getLegendItemsContent(); expect(legendItems).to.eql(expectedLegendItems); @@ -615,6 +621,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.clickTopN(); await visualBuilder.checkTopNTabIsPresent(); + await visChart.waitForVisualizationRenderingStabilized(); const topNLabel = await visualBuilder.getTopNLabel(); const topNCount = await visualBuilder.getTopNCount(); @@ -626,6 +633,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visualBuilder.clickGauge(); await visualBuilder.checkGaugeTabIsPresent(); + await visChart.waitForVisualizationRenderingStabilized(); const gaugeLabel = await visualBuilder.getGaugeLabel(); const gaugeCount = await visualBuilder.getGaugeCount(); From c2a13af54beb4b9f0b2ce1530f9e329863f92e5a Mon Sep 17 00:00:00 2001 From: CohenIdo <90558359+CohenIdo@users.noreply.github.com> Date: Mon, 2 May 2022 14:04:46 +0300 Subject: [PATCH 37/89] [Cloud_security] update constants usages (#131305) --- x-pack/plugins/cloud_security_posture/common/constants.ts | 1 - .../server/create_indices/create_transforms_indices.ts | 6 +++--- .../routes/configuration/update_rules_configuration.ts | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index a64a2604609ff..a351e6f271c71 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -13,7 +13,6 @@ export const UPDATE_RULES_CONFIG_ROUTE_PATH = export const CLOUD_SECURITY_POSTURE_PACKAGE_NAME = 'cloud_security_posture'; -export const AGENT_LOGS_INDEX_PATTERN = '.logs-cloud_security_posture.metadata*'; export const CSP_LATEST_FINDINGS_DATA_VIEW = 'logs-cloud_security_posture.findings_latest-*'; export const FINDINGS_INDEX_PATTERN = 'logs-cloud_security_posture.findings-default*'; diff --git a/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts b/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts index 32d53b0a89695..4ee09119c15e4 100644 --- a/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts +++ b/x-pack/plugins/cloud_security_posture/server/create_indices/create_transforms_indices.ts @@ -41,7 +41,7 @@ export const initializeCspTransformsIndices = async ( export const createIndexIfNotExists = async ( esClient: ElasticsearchClient, - indexName: string, + indexTemplateName: string, indexPattern: string, mappings: MappingTypeMapping, logger: Logger @@ -53,7 +53,7 @@ export const createIndexIfNotExists = async ( if (!isLatestIndexExists) { await esClient.indices.putIndexTemplate({ - name: indexName, + name: indexTemplateName, index_patterns: indexPattern, template: { mappings }, priority: 500, @@ -65,7 +65,7 @@ export const createIndexIfNotExists = async ( } } catch (err) { const error = transformError(err); - logger.error(`Failed to create ${LATEST_FINDINGS_INDEX_DEFAULT_NS}`); + logger.error(`Failed to create the index template: ${indexTemplateName}`); logger.error(error.message); } }; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts b/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts index ae43443f1571b..e9b9401d1373b 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/configuration/update_rules_configuration.ts @@ -37,8 +37,9 @@ export const getPackagePolicy = async ( throw new Error(`package policy Id '${packagePolicyId}' is not exist`); } if (packagePolicies[0].package?.name !== CLOUD_SECURITY_POSTURE_PACKAGE_NAME) { - // TODO: improve this validator to support any future CSP package - throw new Error(`Package Policy Id '${packagePolicyId}' is not CSP package`); + throw new Error( + `Package Policy Id '${packagePolicyId}' is not of type cloud security posture package` + ); } return packagePolicies![0]; From 4f89914f0e31463d0279426acc60823704163a1d Mon Sep 17 00:00:00 2001 From: Cristina Amico Date: Mon, 2 May 2022 14:10:40 +0200 Subject: [PATCH 38/89] [Fleet] Move the agents list bulk actions from the table to a new button (#131133) * [Fleet] Move the agents list bulk actions from the table to a new button * Clean up types and add divider * Split up agent list page component * Add test for bulk actions Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../components/agents_selection_status.tsx | 134 +++++++++++++++++ .../components/bulk_actions.test.tsx | 89 ++++++++++++ .../components/bulk_actions.tsx | 109 +++----------- .../components/empty_prompt.tsx | 44 ++++++ .../components/search_and_filter_bar.tsx | 27 +++- .../components/table_header.tsx | 16 +-- .../components/table_row_actions.tsx | 95 ++++++++++++ .../agent_list_page/components/types.tsx | 8 ++ .../sections/agents/agent_list_page/index.tsx | 135 ++---------------- .../agent_reassign_policy_modal/index.tsx | 1 + .../components/agent_unenroll_modal/index.tsx | 1 + .../components/agent_upgrade_modal/index.tsx | 1 + x-pack/plugins/fleet/public/mocks.ts | 6 + 13 files changed, 439 insertions(+), 227 deletions(-) create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agents_selection_status.tsx create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/empty_prompt.tsx create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_row_actions.tsx create mode 100644 x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/types.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agents_selection_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agents_selection_status.tsx new file mode 100644 index 0000000000000..57728f275ccb5 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agents_selection_status.tsx @@ -0,0 +1,134 @@ +/* + * Copyright 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 styled from 'styled-components'; +import { EuiFlexGroup, EuiFlexItem, EuiText, EuiButtonEmpty } from '@elastic/eui'; +import { FormattedMessage, FormattedNumber } from '@kbn/i18n-react'; + +import { SO_SEARCH_LIMIT } from '../../../../constants'; +import type { Agent } from '../../../../types'; + +import type { SelectionMode } from './types'; + +const Divider = styled.div` + width: 0; + height: ${(props) => props.theme.eui.euiSizeL}; + border-left: ${(props) => props.theme.eui.euiBorderThin}; +`; + +const FlexItem = styled(EuiFlexItem)` + height: ${(props) => props.theme.eui.euiSizeL}; +`; + +const Button = styled(EuiButtonEmpty)` + .euiButtonEmpty__text { + font-size: ${(props) => props.theme.eui.euiFontSizeXS}; + } +`; + +export const AgentsSelectionStatus: React.FunctionComponent<{ + totalAgents: number; + selectableAgents: number; + selectionMode: SelectionMode; + setSelectionMode: (mode: SelectionMode) => void; + selectedAgents: Agent[]; + setSelectedAgents: (agents: Agent[]) => void; +}> = ({ + totalAgents, + selectableAgents, + selectionMode, + setSelectionMode, + selectedAgents, + setSelectedAgents, +}) => { + const showSelectEverything = + selectionMode === 'manual' && + selectedAgents.length === selectableAgents && + selectableAgents < totalAgents; + + return ( + <> + + + + {totalAgents > SO_SEARCH_LIMIT ? ( + , + total: , + }} + /> + ) : ( + + )} + + + {(selectionMode === 'manual' && selectedAgents.length) || + (selectionMode === 'query' && totalAgents > 0) ? ( + <> + + + + + + + + + {showSelectEverything ? ( + <> + + + + + + + + ) : null} + + + + + + + + ) : ( + + )} + + + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx new file mode 100644 index 0000000000000..9ddf8608fc015 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { ThemeProvider } from 'styled-components'; + +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; + +import { coreMock } from '@kbn/core/public/mocks'; +import { registerTestBed } from '@kbn/test-jest-helpers'; + +import type { Agent } from '../../../../types'; + +import { FleetStatusProvider, ConfigContext, KibanaVersionContext } from '../../../../../../hooks'; + +import { getMockTheme } from '../../../../../../mocks'; + +import { AgentBulkActions } from './bulk_actions'; +import type { Props } from './bulk_actions'; + +const mockTheme = getMockTheme({ + eui: { + euiSize: '10px', + }, +}); + +const TestComponent = (props: Props) => ( + + + + + + + + + + + +); + +describe('AgentBulkActions', () => { + it('should show no Actions button when no agent is selected', async () => { + const selectedAgents: Agent[] = []; + const props: Props = { + totalAgents: 10, + totalInactiveAgents: 2, + selectionMode: 'manual', + currentQuery: '', + selectedAgents, + refreshAgents: () => undefined, + }; + const testBed = registerTestBed(TestComponent)(props); + const { exists } = testBed; + + expect(exists('agentBulkActionsButton')).toBe(false); + }); + + it('should show an Actions button when at least an agent is selected', async () => { + const selectedAgents: Agent[] = [ + { + id: 'Agent1', + status: 'online', + packages: ['system'], + type: 'PERMANENT', + active: true, + enrolled_at: `${Date.now()}`, + user_provided_metadata: {}, + local_metadata: {}, + }, + ]; + const props: Props = { + totalAgents: 10, + totalInactiveAgents: 2, + selectionMode: 'manual', + currentQuery: '', + selectedAgents, + refreshAgents: () => undefined, + }; + const testBed = registerTestBed(TestComponent)(props); + const { exists } = testBed; + + expect(exists('agentBulkActionsButton')).not.toBeNull(); + }); +}); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx index 6fd34f0239996..a2515b51814ee 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx @@ -10,16 +10,14 @@ import styled from 'styled-components'; import { EuiFlexGroup, EuiFlexItem, - EuiText, EuiPopover, EuiContextMenu, - EuiButtonEmpty, + EuiButton, EuiIcon, EuiPortal, } from '@elastic/eui'; -import { FormattedMessage, FormattedNumber } from '@kbn/i18n-react'; +import { FormattedMessage } from '@kbn/i18n-react'; -import { SO_SEARCH_LIMIT } from '../../../../constants'; import type { Agent } from '../../../../types'; import { AgentReassignAgentPolicyModal, @@ -28,43 +26,26 @@ import { } from '../../components'; import { useKibanaVersion } from '../../../../hooks'; -const Divider = styled.div` - width: 0; - height: ${(props) => props.theme.eui.euiSizeL}; - border-left: ${(props) => props.theme.eui.euiBorderThin}; -`; +import type { SelectionMode } from './types'; const FlexItem = styled(EuiFlexItem)` height: ${(props) => props.theme.eui.euiSizeL}; `; - -const Button = styled(EuiButtonEmpty)` - .euiButtonEmpty__text { - font-size: ${(props) => props.theme.eui.euiFontSizeXS}; - } -`; - -export type SelectionMode = 'manual' | 'query'; - -export const AgentBulkActions: React.FunctionComponent<{ +export interface Props { totalAgents: number; totalInactiveAgents: number; - selectableAgents: number; selectionMode: SelectionMode; - setSelectionMode: (mode: SelectionMode) => void; currentQuery: string; selectedAgents: Agent[]; - setSelectedAgents: (agents: Agent[]) => void; refreshAgents: () => void; -}> = ({ +} + +export const AgentBulkActions: React.FunctionComponent = ({ totalAgents, totalInactiveAgents, - selectableAgents, selectionMode, - setSelectionMode, currentQuery, selectedAgents, - setSelectedAgents, refreshAgents, }) => { const kibanaVersion = useKibanaVersion(); @@ -92,6 +73,7 @@ export const AgentBulkActions: React.FunctionComponent<{ name: ( ), @@ -106,6 +88,7 @@ export const AgentBulkActions: React.FunctionComponent<{ name: ( ), @@ -120,6 +103,7 @@ export const AgentBulkActions: React.FunctionComponent<{ name: ( ), @@ -130,29 +114,10 @@ export const AgentBulkActions: React.FunctionComponent<{ setIsUpgradeModalOpen(true); }, }, - { - name: ( - - ), - icon: , - onClick: () => { - closeMenu(); - setSelectionMode('manual'); - setSelectedAgents([]); - }, - }, ], }, ]; - const showSelectEverything = - selectionMode === 'manual' && - selectedAgents.length === selectableAgents && - selectableAgents < totalAgents; - const totalActiveAgents = totalAgents - totalInactiveAgents; const agentCount = selectionMode === 'manual' ? selectedAgents.length : totalActiveAgents; const agents = selectionMode === 'manual' ? selectedAgents : currentQuery; @@ -196,51 +161,25 @@ export const AgentBulkActions: React.FunctionComponent<{ )} - - - {totalAgents > SO_SEARCH_LIMIT ? ( - , - total: , - }} - /> - ) : ( - - )} - - {(selectionMode === 'manual' && selectedAgents.length) || (selectionMode === 'query' && totalAgents > 0) ? ( <> - - - - + } isOpen={isMenuOpen} closePopover={closeMenu} @@ -250,22 +189,6 @@ export const AgentBulkActions: React.FunctionComponent<{ - {showSelectEverything ? ( - - - - ) : null} ) : ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/empty_prompt.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/empty_prompt.tsx new file mode 100644 index 0000000000000..256ab2a0bacd1 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/empty_prompt.tsx @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +export const EmptyPrompt: React.FunctionComponent<{ + hasFleetAllPrivileges: boolean; + setEnrollmentFlyoutState: ( + value: React.SetStateAction<{ + isOpen: boolean; + selectedPolicyId?: string | undefined; + }> + ) => void; +}> = ({ hasFleetAllPrivileges, setEnrollmentFlyoutState }) => { + return ( + + + + } + actions={ + hasFleetAllPrivileges ? ( + setEnrollmentFlyoutState({ isOpen: true })} + > + + + ) : null + } + /> + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx index 8965ae9bbc44f..a511c2dc9f3da 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx @@ -19,10 +19,13 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import type { AgentPolicy } from '../../../../types'; +import type { Agent, AgentPolicy } from '../../../../types'; import { AgentEnrollmentFlyout, SearchBar } from '../../../../components'; import { AGENTS_INDEX } from '../../../../constants'; +import { AgentBulkActions } from './bulk_actions'; +import type { SelectionMode } from './types'; + const statusFilters = [ { status: 'healthy', @@ -67,6 +70,12 @@ export const SearchAndFilterBar: React.FunctionComponent<{ onSelectedStatusChange: (selectedStatus: string[]) => void; showUpgradeable: boolean; onShowUpgradeableChange: (showUpgradeable: boolean) => void; + totalAgents: number; + totalInactiveAgents: number; + selectionMode: SelectionMode; + currentQuery: string; + selectedAgents: Agent[]; + refreshAgents: () => void; }> = ({ agentPolicies, draftKuery, @@ -78,6 +87,12 @@ export const SearchAndFilterBar: React.FunctionComponent<{ onSelectedStatusChange, showUpgradeable, onShowUpgradeableChange, + totalAgents, + totalInactiveAgents, + selectionMode, + currentQuery, + selectedAgents, + refreshAgents, }) => { const [isEnrollmentFlyoutOpen, setIsEnrollmentFlyoutOpen] = useState(false); @@ -230,6 +245,16 @@ export const SearchAndFilterBar: React.FunctionComponent<{ + + +
diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx index ff809d360e744..4e2f058596cf0 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx @@ -11,51 +11,41 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import type { Agent, SimplifiedAgentStatus } from '../../../../types'; import { AgentStatusBar } from './status_bar'; -import { AgentBulkActions } from './bulk_actions'; +import { AgentsSelectionStatus } from './agents_selection_status'; import {} from '@elastic/eui'; import { AgentStatusBadges } from './status_badges'; - -export type SelectionMode = 'manual' | 'query'; +import type { SelectionMode } from './types'; export const AgentTableHeader: React.FunctionComponent<{ agentStatus?: { [k in SimplifiedAgentStatus]: number }; showInactive: boolean; totalAgents: number; - totalInactiveAgents: number; selectableAgents: number; selectionMode: SelectionMode; setSelectionMode: (mode: SelectionMode) => void; - currentQuery: string; selectedAgents: Agent[]; setSelectedAgents: (agents: Agent[]) => void; - refreshAgents: () => void; }> = ({ agentStatus, totalAgents, - totalInactiveAgents, selectableAgents, selectionMode, setSelectionMode, - currentQuery, selectedAgents, setSelectedAgents, - refreshAgents, showInactive, }) => { return ( <> - diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_row_actions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_row_actions.tsx new file mode 100644 index 0000000000000..be620f0044cd1 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_row_actions.tsx @@ -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 React, { useState } from 'react'; +import { EuiContextMenuItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +import type { Agent, AgentPolicy } from '../../../../types'; +import { useAuthz, useLink, useKibanaVersion } from '../../../../hooks'; +import { ContextMenuActions } from '../../../../components'; +import { isAgentUpgradeable } from '../../../../services'; + +export const TableRowActions: React.FunctionComponent<{ + agent: Agent; + agentPolicy?: AgentPolicy; + onReassignClick: () => void; + onUnenrollClick: () => void; + onUpgradeClick: () => void; +}> = ({ agent, agentPolicy, onReassignClick, onUnenrollClick, onUpgradeClick }) => { + const { getHref } = useLink(); + const hasFleetAllPrivileges = useAuthz().fleet.all; + + const isUnenrolling = agent.status === 'unenrolling'; + const kibanaVersion = useKibanaVersion(); + const [isMenuOpen, setIsMenuOpen] = useState(false); + const menuItems = [ + + + , + ]; + + if (agentPolicy?.is_managed === false) { + menuItems.push( + { + onReassignClick(); + }} + disabled={!agent.active} + key="reassignPolicy" + > + + , + { + onUnenrollClick(); + }} + > + {isUnenrolling ? ( + + ) : ( + + )} + , + { + onUpgradeClick(); + }} + > + + + ); + } + return ( + setIsMenuOpen(isOpen)} + items={menuItems} + /> + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/types.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/types.tsx new file mode 100644 index 0000000000000..7e22c67b09acb --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/types.tsx @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type SelectionMode = 'manual' | 'query'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index d5757419e8ea7..5776a163fd6a3 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -8,14 +8,11 @@ import React, { useState, useMemo, useCallback, useRef, useEffect, useContext } from 'react'; import { EuiBasicTable, - EuiButton, - EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiLink, EuiSpacer, EuiText, - EuiContextMenuItem, EuiIcon, EuiPortal, } from '@elastic/eui'; @@ -35,11 +32,7 @@ import { useKibanaVersion, useStartServices, } from '../../../hooks'; -import { - AgentEnrollmentFlyout, - AgentPolicySummaryLine, - ContextMenuActions, -} from '../../../components'; +import { AgentEnrollmentFlyout, AgentPolicySummaryLine } from '../../../components'; import { AgentStatusKueryHelper, isAgentUpgradeable } from '../../../services'; import { AGENTS_PREFIX, FLEET_SERVER_PACKAGE } from '../../../constants'; import { @@ -55,92 +48,13 @@ import { useFleetServerUnhealthy } from '../hooks/use_fleet_server_unhealthy'; import { agentFlyoutContext } from '..'; import { AgentTableHeader } from './components/table_header'; -import type { SelectionMode } from './components/bulk_actions'; +import type { SelectionMode } from './components/types'; import { SearchAndFilterBar } from './components/search_and_filter_bar'; +import { TableRowActions } from './components/table_row_actions'; +import { EmptyPrompt } from './components/empty_prompt'; const REFRESH_INTERVAL_MS = 30000; -const RowActions = React.memo<{ - agent: Agent; - agentPolicy?: AgentPolicy; - refresh: () => void; - onReassignClick: () => void; - onUnenrollClick: () => void; - onUpgradeClick: () => void; -}>(({ agent, agentPolicy, refresh, onReassignClick, onUnenrollClick, onUpgradeClick }) => { - const { getHref } = useLink(); - const hasFleetAllPrivileges = useAuthz().fleet.all; - - const isUnenrolling = agent.status === 'unenrolling'; - const kibanaVersion = useKibanaVersion(); - const [isMenuOpen, setIsMenuOpen] = useState(false); - const menuItems = [ - - - , - ]; - - if (agentPolicy?.is_managed === false) { - menuItems.push( - { - onReassignClick(); - }} - disabled={!agent.active} - key="reassignPolicy" - > - - , - { - onUnenrollClick(); - }} - > - {isUnenrolling ? ( - - ) : ( - - )} - , - { - onUpgradeClick(); - }} - > - - - ); - } - return ( - setIsMenuOpen(isOpen)} - items={menuItems} - /> - ); -}); - function safeMetadata(val: any) { if (typeof val !== 'string') { return '-'; @@ -479,10 +393,9 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { ? agentPoliciesIndexedById[agent.policy_id] : undefined; return ( - fetchData()} onReassignClick={() => setAgentToReassign(agent)} onUnenrollClick={() => setAgentToUnenroll(agent)} onUpgradeClick={() => setAgentToUpgrade(agent)} @@ -495,30 +408,6 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { }, ]; - const emptyPrompt = ( - - - - } - actions={ - hasFleetAllPrivileges ? ( - setEnrollmentFlyoutState({ isOpen: true })} - > - - - ) : null - } - /> - ); - return ( <> {enrollmentFlyout.isOpen ? ( @@ -592,6 +481,12 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { onSelectedStatusChange={setSelectedStatus} showUpgradeable={showUpgradeable} onShowUpgradeableChange={setShowUpgradeable} + totalAgents={totalAgents} + totalInactiveAgents={totalInactiveAgents} + selectionMode={selectionMode} + currentQuery={kuery} + selectedAgents={selectedAgents} + refreshAgents={() => fetchData()} /> @@ -599,12 +494,10 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { { if (tableRef?.current) { @@ -612,7 +505,6 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { setSelectionMode('manual'); } }} - refreshAgents={() => fetchData()} /> @@ -645,7 +537,10 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { }} /> ) : ( - emptyPrompt + ) } items={ diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx index 566bc7f4363ab..5e74b86728247 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx @@ -99,6 +99,7 @@ export const AgentReassignAgentPolicyModal: React.FunctionComponent = ({ return ( = ({ return ( = ({ return ( diff --git a/x-pack/plugins/fleet/public/mocks.ts b/x-pack/plugins/fleet/public/mocks.ts index 92b002a437649..8088f430ee81e 100644 --- a/x-pack/plugins/fleet/public/mocks.ts +++ b/x-pack/plugins/fleet/public/mocks.ts @@ -5,8 +5,14 @@ * 2.0. */ +import type { EuiTheme } from '@kbn/kibana-react-plugin/common'; +import type { RecursivePartial } from '@elastic/eui/src/components/common'; + import { createStartMock } from './mock'; +export const getMockTheme = (partialTheme: RecursivePartial): EuiTheme => + partialTheme as EuiTheme; + export const fleetMock = { createStartMock, }; From 7e5408b8fa487613dcff5d47c4e8a2c3127b91f4 Mon Sep 17 00:00:00 2001 From: Ioana Tagirta Date: Mon, 2 May 2022 15:26:46 +0200 Subject: [PATCH 39/89] Remove unused user filtering (#131316) --- .../applications/workplace_search/types.ts | 2 - .../groups/__mocks__/groups_logic.mock.ts | 7 +- .../groups/components/group_overview.test.tsx | 1 - .../views/groups/components/group_row.tsx | 6 -- .../workplace_search/views/groups/groups.tsx | 3 +- .../views/groups/groups_logic.test.ts | 101 +----------------- .../views/groups/groups_logic.ts | 78 +------------- .../routes/workplace_search/groups.test.ts | 1 - .../server/routes/workplace_search/groups.ts | 1 - .../translations/translations/fr-FR.json | 1 - .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - 12 files changed, 6 insertions(+), 197 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts index 19263f057e40f..984e6664681b4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts @@ -30,8 +30,6 @@ export interface Group { createdAt: string; updatedAt: string; contentSources: ContentSource[]; - users: User[]; - usersCount: number; color?: string; } diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/__mocks__/groups_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/__mocks__/groups_logic.mock.ts index 0e072210d2489..02e80d9f8c5b5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/__mocks__/groups_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/__mocks__/groups_logic.mock.ts @@ -6,12 +6,11 @@ */ import { DEFAULT_META } from '../../../../shared/constants'; -import { ContentSource, User, Group } from '../../../types'; +import { ContentSource, Group } from '../../../types'; export const mockGroupsValues = { groups: [] as Group[], contentSources: [] as ContentSource[], - users: [] as User[], groupsDataLoading: true, groupListLoading: true, newGroupModalOpen: false, @@ -21,10 +20,6 @@ export const mockGroupsValues = { newGroupNameErrors: [], filterSourcesDropdownOpen: false, filteredSources: [], - filterUsersDropdownOpen: false, - filteredUsers: [], - allGroupUsersLoading: false, - allGroupUsers: [], filterValue: '', groupsMeta: DEFAULT_META, }; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx index e1ecc47f02669..97b2879ceef53 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx @@ -91,7 +91,6 @@ describe('GroupOverview', () => { ...mockValues, group: { ...groups[0], - users: [], contentSources: [], }, }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.tsx index effacfa3aa4f8..d118037a2d80c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_row.tsx @@ -28,12 +28,6 @@ export const NO_SOURCES_MESSAGE = i18n.translate( defaultMessage: 'No organizational content sources', } ); -export const NO_USERS_MESSAGE = i18n.translate( - 'xpack.enterpriseSearch.workplaceSearch.groups.noUsersMessage', - { - defaultMessage: 'No users', - } -); const dateDisplay = (date: string) => moment(date).isAfter(moment().subtract(DAYS_CUTOFF, 'days')) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx index 7af93490b2eb2..5b8b01a4bb1ef 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx @@ -38,7 +38,6 @@ export const Groups: React.FC = () => { page: { total_results: numGroups }, }, filteredSources, - filteredUsers, filterValue, } = useValues(GroupsLogic); @@ -47,7 +46,7 @@ export const Groups: React.FC = () => { useEffect(() => { getSearchResults(true); return resetGroups; - }, [filteredSources, filteredUsers, filterValue]); + }, [filteredSources, filterValue]); if (newGroup && hasMessages) { messages[0].description = ( diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts index 97163f1529938..bc82c95871676 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.test.ts @@ -12,7 +12,6 @@ import { } from '../../../__mocks__/kea_logic'; import { contentSources } from '../../__mocks__/content_sources.mock'; import { groups } from '../../__mocks__/groups.mock'; -import { users } from '../../__mocks__/users.mock'; import { mockGroupsValues } from './__mocks__/groups_logic.mock'; import { nextTick } from '@kbn/test-jest-helpers'; @@ -49,13 +48,12 @@ describe('GroupsLogic', () => { describe('actions', () => { describe('onInitializeGroups', () => { it('sets reducers', () => { - GroupsLogic.actions.onInitializeGroups({ contentSources, users }); + GroupsLogic.actions.onInitializeGroups({ contentSources }); expect(GroupsLogic.values).toEqual({ ...mockGroupsValues, groupsDataLoading: false, contentSources, - users, }); }); }); @@ -103,59 +101,6 @@ describe('GroupsLogic', () => { }); }); - describe('addFilteredUser', () => { - it('sets reducers', () => { - GroupsLogic.actions.addFilteredUser('foo'); - GroupsLogic.actions.addFilteredUser('bar'); - GroupsLogic.actions.addFilteredUser('baz'); - - expect(GroupsLogic.values).toEqual({ - ...mockGroupsValues, - hasFiltersSet: true, - filteredUsers: ['bar', 'baz', 'foo'], - }); - }); - }); - - describe('removeFilteredUser', () => { - it('sets reducers', () => { - GroupsLogic.actions.addFilteredUser('foo'); - GroupsLogic.actions.addFilteredUser('bar'); - GroupsLogic.actions.addFilteredUser('baz'); - GroupsLogic.actions.removeFilteredUser('foo'); - - expect(GroupsLogic.values).toEqual({ - ...mockGroupsValues, - hasFiltersSet: true, - filteredUsers: ['bar', 'baz'], - }); - }); - }); - - describe('setGroupUsers', () => { - it('sets reducers', () => { - GroupsLogic.actions.setGroupUsers(users); - - expect(GroupsLogic.values).toEqual({ - ...mockGroupsValues, - allGroupUsersLoading: false, - allGroupUsers: users, - }); - }); - }); - - describe('setAllGroupLoading', () => { - it('sets reducer', () => { - GroupsLogic.actions.setAllGroupLoading(true); - - expect(GroupsLogic.values).toEqual({ - ...mockGroupsValues, - allGroupUsersLoading: true, - allGroupUsers: [], - }); - }); - }); - describe('setFilterValue', () => { it('sets reducer', () => { GroupsLogic.actions.setFilterValue('foo'); @@ -190,7 +135,6 @@ describe('GroupsLogic', () => { newGroup: groups[0], newGroupNameErrors: [], filteredSources: [], - filteredUsers: [], groupsMeta: DEFAULT_META, }); }); @@ -234,19 +178,6 @@ describe('GroupsLogic', () => { }); }); - describe('closeFilterUsersDropdown', () => { - it('sets reducer', () => { - // Open dropdown first - GroupsLogic.actions.toggleFilterUsersDropdown(); - GroupsLogic.actions.closeFilterUsersDropdown(); - - expect(GroupsLogic.values).toEqual({ - ...mockGroupsValues, - filterUsersDropdownOpen: false, - }); - }); - }); - describe('setGroupsLoading', () => { it('sets reducer', () => { // Set to false first @@ -294,7 +225,6 @@ describe('GroupsLogic', () => { const search = { query: '', content_source_ids: [], - user_ids: [], }; const payload = { @@ -352,22 +282,6 @@ describe('GroupsLogic', () => { }); }); - describe('fetchGroupUsers', () => { - it('calls API and sets values', async () => { - const setGroupUsersSpy = jest.spyOn(GroupsLogic.actions, 'setGroupUsers'); - http.get.mockReturnValue(Promise.resolve(users)); - - GroupsLogic.actions.fetchGroupUsers('123'); - expect(http.get).toHaveBeenCalledWith('/internal/workplace_search/groups/123/group_users'); - await nextTick(); - expect(setGroupUsersSpy).toHaveBeenCalledWith(users); - }); - - itShowsServerErrorAsFlashMessage(http.get, () => { - GroupsLogic.actions.fetchGroupUsers('123'); - }); - }); - describe('saveNewGroup', () => { it('calls API and sets values', async () => { const GROUP_NAME = 'new group'; @@ -430,7 +344,6 @@ describe('GroupsLogic', () => { expect(GroupsLogic.values).toEqual({ ...mockGroupsValues, filteredSources: [], - filteredUsers: [], filterValue: '', groupsMeta: DEFAULT_META, }); @@ -449,17 +362,5 @@ describe('GroupsLogic', () => { expect(clearFlashMessages).toHaveBeenCalled(); }); }); - - describe('toggleFilterUsersDropdown', () => { - it('sets reducer and clears flash messages', () => { - GroupsLogic.actions.toggleFilterUsersDropdown(); - - expect(GroupsLogic.values).toEqual({ - ...mockGroupsValues, - filterUsersDropdownOpen: true, - }); - expect(clearFlashMessages).toHaveBeenCalled(); - }); - }); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts index c14538346ad31..3e137ea8a6713 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_logic.ts @@ -18,13 +18,12 @@ import { flashSuccessToast, } from '../../../shared/flash_messages'; import { HttpLogic } from '../../../shared/http'; -import { ContentSource, Group, User } from '../../types'; +import { ContentSource, Group } from '../../types'; export const MAX_NAME_LENGTH = 40; interface GroupsServerData { contentSources: ContentSource[]; - users: User[]; } interface GroupsSearchResponse { @@ -37,10 +36,6 @@ interface GroupsActions { setSearchResults(data: GroupsSearchResponse): GroupsSearchResponse; addFilteredSource(sourceId: string): string; removeFilteredSource(sourceId: string): string; - addFilteredUser(userId: string): string; - removeFilteredUser(userId: string): string; - setGroupUsers(allGroupUsers: User[]): User[]; - setAllGroupLoading(allGroupUsersLoading: boolean): boolean; setFilterValue(filterValue: string): string; setActivePage(activePage: number): number; setNewGroupName(newGroupName: string): string; @@ -49,22 +44,18 @@ interface GroupsActions { openNewGroupModal(): void; closeNewGroupModal(): void; closeFilterSourcesDropdown(): void; - closeFilterUsersDropdown(): void; toggleFilterSourcesDropdown(): void; - toggleFilterUsersDropdown(): void; setGroupsLoading(): void; resetGroupsFilters(): void; resetGroups(): void; initializeGroups(): void; getSearchResults(resetPagination?: boolean): { resetPagination: boolean | undefined }; - fetchGroupUsers(groupId: string): { groupId: string }; saveNewGroup(): void; } interface GroupsValues { groups: Group[]; contentSources: ContentSource[]; - users: User[]; groupsDataLoading: boolean; groupListLoading: boolean; newGroupModalOpen: boolean; @@ -73,10 +64,6 @@ interface GroupsValues { newGroupNameErrors: string[]; filterSourcesDropdownOpen: boolean; filteredSources: string[]; - filterUsersDropdownOpen: boolean; - filteredUsers: string[]; - allGroupUsersLoading: boolean; - allGroupUsers: User[]; filterValue: string; groupsMeta: Meta; hasFiltersSet: boolean; @@ -89,10 +76,6 @@ export const GroupsLogic = kea>({ setSearchResults: (data) => data, addFilteredSource: (sourceId) => sourceId, removeFilteredSource: (sourceId) => sourceId, - addFilteredUser: (userId) => userId, - removeFilteredUser: (userId) => userId, - setGroupUsers: (allGroupUsers) => allGroupUsers, - setAllGroupLoading: (allGroupUsersLoading: boolean) => allGroupUsersLoading, setFilterValue: (filterValue) => filterValue, setActivePage: (activePage) => activePage, setNewGroupName: (newGroupName) => newGroupName, @@ -101,15 +84,12 @@ export const GroupsLogic = kea>({ openNewGroupModal: () => true, closeNewGroupModal: () => true, closeFilterSourcesDropdown: () => true, - closeFilterUsersDropdown: () => true, toggleFilterSourcesDropdown: () => true, - toggleFilterUsersDropdown: () => true, setGroupsLoading: () => true, resetGroupsFilters: () => true, resetGroups: () => true, initializeGroups: () => true, getSearchResults: (resetPagination) => ({ resetPagination }), - fetchGroupUsers: (groupId) => ({ groupId }), saveNewGroup: () => true, }, reducers: { @@ -125,12 +105,6 @@ export const GroupsLogic = kea>({ onInitializeGroups: (_, { contentSources }) => contentSources, }, ], - users: [ - [], - { - onInitializeGroups: (_, { users }) => users, - }, - ], groupsDataLoading: [ true, { @@ -193,36 +167,6 @@ export const GroupsLogic = kea>({ removeFilteredSource: (state, sourceId) => state.filter((id) => id !== sourceId), }, ], - filterUsersDropdownOpen: [ - false, - { - toggleFilterUsersDropdown: (state) => !state, - closeFilterUsersDropdown: () => false, - }, - ], - filteredUsers: [ - [], - { - resetGroupsFilters: () => [], - setNewGroup: () => [], - addFilteredUser: (state, userId) => [...state, userId].sort(), - removeFilteredUser: (state, userId) => state.filter((id) => id !== userId), - }, - ], - allGroupUsersLoading: [ - false, - { - setAllGroupLoading: (_, allGroupUsersLoading) => allGroupUsersLoading, - setGroupUsers: () => false, - }, - ], - allGroupUsers: [ - [], - { - setGroupUsers: (_, allGroupUsers) => allGroupUsers, - setAllGroupLoading: () => [], - }, - ], filterValue: [ '', { @@ -248,8 +192,8 @@ export const GroupsLogic = kea>({ }, selectors: ({ selectors }) => ({ hasFiltersSet: [ - () => [selectors.filteredUsers, selectors.filteredSources], - (filteredUsers, filteredSources) => filteredUsers.length > 0 || filteredSources.length > 0, + () => [selectors.filteredSources], + (filteredSources) => filteredSources.length > 0, ], }), listeners: ({ actions, values }) => ({ @@ -275,7 +219,6 @@ export const GroupsLogic = kea>({ }, filterValue, filteredSources, - filteredUsers, } = values; // Is the user changes the query while on a different page, we want to start back over at 1. @@ -286,7 +229,6 @@ export const GroupsLogic = kea>({ const search = { query: filterValue, content_source_ids: filteredSources, - user_ids: filteredUsers, }; try { @@ -306,17 +248,6 @@ export const GroupsLogic = kea>({ flashAPIErrors(e); } }, - fetchGroupUsers: async ({ groupId }) => { - actions.setAllGroupLoading(true); - try { - const response = await HttpLogic.values.http.get( - `/internal/workplace_search/groups/${groupId}/group_users` - ); - actions.setGroupUsers(response); - } catch (e) { - flashAPIErrors(e); - } - }, saveNewGroup: async () => { try { const response = await HttpLogic.values.http.post( @@ -354,8 +285,5 @@ export const GroupsLogic = kea>({ toggleFilterSourcesDropdown: () => { clearFlashMessages(); }, - toggleFilterUsersDropdown: () => { - clearFlashMessages(); - }, }), }); diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts index 40ee46c7a9ffd..dc1308a4140d3 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.test.ts @@ -107,7 +107,6 @@ describe('groups routes', () => { search: { query: 'foo', content_source_ids: ['123', '234'], - user_ids: ['345', '456'], }, }, }; diff --git a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts index c5c161cf7b2f8..8dc153e7a2923 100644 --- a/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts +++ b/x-pack/plugins/enterprise_search/server/routes/workplace_search/groups.ts @@ -51,7 +51,6 @@ export function registerSearchGroupsRoute({ search: schema.object({ query: schema.string(), content_source_ids: schema.arrayOf(schema.string()), - user_ids: schema.arrayOf(schema.string()), }), }), }, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index a5df7f232217d..63a348198a160 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -11923,7 +11923,6 @@ "xpack.enterpriseSearch.workplaceSearch.groups.newGroup.action": "Gérer le groupe", "xpack.enterpriseSearch.workplaceSearch.groups.newGroupSavedSuccess": "{groupName} créé avec succès", "xpack.enterpriseSearch.workplaceSearch.groups.noSourcesMessage": "Aucune source de contenu organisationnelle", - "xpack.enterpriseSearch.workplaceSearch.groups.noUsersMessage": "Aucun utilisateur", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmRemoveButtonText": "Supprimer {name}", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmRemoveDescription": "Votre groupe sera supprimé de Workplace Search. Voulez-vous vraiment supprimer {name} ?", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmTitleText": "Confirmer", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index ce64e7d5ffda3..118408cc7a6d2 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -11924,7 +11924,6 @@ "xpack.enterpriseSearch.workplaceSearch.groups.newGroup.action": "グループを管理", "xpack.enterpriseSearch.workplaceSearch.groups.newGroupSavedSuccess": "{groupName}が正常に作成されました", "xpack.enterpriseSearch.workplaceSearch.groups.noSourcesMessage": "組織コンテンツソースがありません", - "xpack.enterpriseSearch.workplaceSearch.groups.noUsersMessage": "ユーザーがありません", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmRemoveButtonText": "{name}を削除", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmRemoveDescription": "グループはWorkplace Searchから削除されます。{name}を削除してよろしいですか?", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmTitleText": "確認", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 224ddc34cc13c..0c7f624c259d0 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -11946,7 +11946,6 @@ "xpack.enterpriseSearch.workplaceSearch.groups.newGroup.action": "管理组", "xpack.enterpriseSearch.workplaceSearch.groups.newGroupSavedSuccess": "已成功创建 {groupName}", "xpack.enterpriseSearch.workplaceSearch.groups.noSourcesMessage": "无组织内容源", - "xpack.enterpriseSearch.workplaceSearch.groups.noUsersMessage": "无用户", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmRemoveButtonText": "删除 {name}", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmRemoveDescription": "您的组将从 Workplace Search 中删除。确定要移除 {name}?", "xpack.enterpriseSearch.workplaceSearch.groups.overview.confirmTitleText": "确认", From 15ac5206fe84b924f9cf833318d0db4bb7cfce4a Mon Sep 17 00:00:00 2001 From: Maja Grubic Date: Mon, 2 May 2022 15:39:37 +0200 Subject: [PATCH 40/89] [DataViewEditor] Skip empty prompt screen (#130862) * [DataViewEditor] Skip empty prompt screen * Rename skipEmptyPrompt > skipNoDataViewsPrompt * Rename skipNoDataViewsPrompt > showEmptyPrompt Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../public/components/data_view_editor.tsx | 2 ++ .../components/data_view_editor_flyout_content.tsx | 9 ++++++++- .../data_view_flyout_content_container.tsx | 2 ++ .../components/empty_prompts/empty_prompts.tsx | 13 +++++++++++-- src/plugins/data_view_editor/public/open_editor.tsx | 2 ++ src/plugins/data_view_editor/public/types.ts | 5 +++++ 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/plugins/data_view_editor/public/components/data_view_editor.tsx b/src/plugins/data_view_editor/public/components/data_view_editor.tsx index 18af3c4ebd6d5..e09acfaca4d52 100644 --- a/src/plugins/data_view_editor/public/components/data_view_editor.tsx +++ b/src/plugins/data_view_editor/public/components/data_view_editor.tsx @@ -23,6 +23,7 @@ export const DataViewEditor = ({ services, defaultTypeIsRollup = false, requireTimestampField = false, + showEmptyPrompt = true, }: DataViewEditorPropsWithServices) => { const { Provider: KibanaReactContextProvider } = createKibanaReactContext(services); @@ -35,6 +36,7 @@ export const DataViewEditor = ({ onCancel={onCancel} defaultTypeIsRollup={defaultTypeIsRollup} requireTimestampField={requireTimestampField} + showEmptyPrompt={showEmptyPrompt} /> diff --git a/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx b/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx index 9d21af4b2df09..9cdfad745bea3 100644 --- a/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx +++ b/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx @@ -58,6 +58,7 @@ export interface Props { onCancel: () => void; defaultTypeIsRollup?: boolean; requireTimestampField?: boolean; + showEmptyPrompt?: boolean; } const editorTitle = i18n.translate('indexPatternEditor.title', { @@ -69,6 +70,7 @@ const IndexPatternEditorFlyoutContentComponent = ({ onCancel, defaultTypeIsRollup, requireTimestampField = false, + showEmptyPrompt = true, }: Props) => { const { services: { http, dataViews, uiSettings, searchClient }, @@ -316,7 +318,12 @@ const IndexPatternEditorFlyoutContentComponent = ({ ); return ( - + diff --git a/src/plugins/data_view_editor/public/components/data_view_flyout_content_container.tsx b/src/plugins/data_view_editor/public/components/data_view_flyout_content_container.tsx index 2fe95d753bb09..dd6d474068c2a 100644 --- a/src/plugins/data_view_editor/public/components/data_view_flyout_content_container.tsx +++ b/src/plugins/data_view_editor/public/components/data_view_flyout_content_container.tsx @@ -18,6 +18,7 @@ const IndexPatternFlyoutContentContainer = ({ onCancel = () => {}, defaultTypeIsRollup, requireTimestampField = false, + showEmptyPrompt = true, }: DataViewEditorProps) => { const { services: { dataViews, notifications }, @@ -48,6 +49,7 @@ const IndexPatternFlyoutContentContainer = ({ onCancel={onCancel} defaultTypeIsRollup={defaultTypeIsRollup} requireTimestampField={requireTimestampField} + showEmptyPrompt={showEmptyPrompt} /> ); }; diff --git a/src/plugins/data_view_editor/public/components/empty_prompts/empty_prompts.tsx b/src/plugins/data_view_editor/public/components/empty_prompts/empty_prompts.tsx index 686decce9c655..ecfdd9e5c1c92 100644 --- a/src/plugins/data_view_editor/public/components/empty_prompts/empty_prompts.tsx +++ b/src/plugins/data_view_editor/public/components/empty_prompts/empty_prompts.tsx @@ -27,6 +27,7 @@ interface Props { onCancel: () => void; allSources: MatchedItem[]; loadSources: () => void; + showEmptyPrompt?: boolean; } export function isUserDataIndex(source: MatchedItem) { @@ -45,7 +46,13 @@ export function isUserDataIndex(source: MatchedItem) { return true; } -export const EmptyPrompts: FC = ({ allSources, onCancel, children, loadSources }) => { +export const EmptyPrompts: FC = ({ + allSources, + onCancel, + children, + loadSources, + showEmptyPrompt, +}) => { const { services: { docLinks, application, http, searchClient, dataViews }, } = useKibana(); @@ -93,7 +100,7 @@ export const EmptyPrompts: FC = ({ allSources, onCancel, children, loadSo ); - } else { + } else if (showEmptyPrompt) { // first time return ( <> @@ -108,6 +115,8 @@ export const EmptyPrompts: FC = ({ allSources, onCancel, children, loadSo ); + } else { + setGoToForm(true); } } diff --git a/src/plugins/data_view_editor/public/open_editor.tsx b/src/plugins/data_view_editor/public/open_editor.tsx index 7fd5163edacc4..ed57870c49783 100644 --- a/src/plugins/data_view_editor/public/open_editor.tsx +++ b/src/plugins/data_view_editor/public/open_editor.tsx @@ -49,6 +49,7 @@ export const getEditorOpener = onCancel = () => {}, defaultTypeIsRollup = false, requireTimestampField = false, + showEmptyPrompt = true, }: DataViewEditorProps): CloseEditor => { const closeEditor = () => { if (overlayRef) { @@ -77,6 +78,7 @@ export const getEditorOpener = }} defaultTypeIsRollup={defaultTypeIsRollup} requireTimestampField={requireTimestampField} + showEmptyPrompt={showEmptyPrompt} /> , diff --git a/src/plugins/data_view_editor/public/types.ts b/src/plugins/data_view_editor/public/types.ts index fe6928ee73734..a2d359ba8420b 100644 --- a/src/plugins/data_view_editor/public/types.ts +++ b/src/plugins/data_view_editor/public/types.ts @@ -49,6 +49,11 @@ export interface DataViewEditorProps { * Sets whether a timestamp field is required to create an index pattern. Defaults to false. */ requireTimestampField?: boolean; + /** + * If set to false, the screen for prompting a user to create a data view will be skipped, and the user will be taken directly + * to data view creation. + */ + showEmptyPrompt?: boolean; } // eslint-disable-next-line @typescript-eslint/no-empty-interface From 074519644526ab6e2466a87dca858f63dbfa4086 Mon Sep 17 00:00:00 2001 From: Corey Robertson Date: Mon, 2 May 2022 10:04:25 -0400 Subject: [PATCH 41/89] Disable time slider control (#130978) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/controls/public/plugin.ts | 7 ++++++- src/plugins/controls/server/plugin.ts | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/controls/public/plugin.ts b/src/plugins/controls/public/plugin.ts index 51705640b06f2..9b0d754b3f150 100644 --- a/src/plugins/controls/public/plugin.ts +++ b/src/plugins/controls/public/plugin.ts @@ -30,12 +30,14 @@ import { CONTROL_GROUP_TYPE, OPTIONS_LIST_CONTROL, RANGE_SLIDER_CONTROL, - TIME_SLIDER_CONTROL, + // TIME_SLIDER_CONTROL, } from '.'; +/* import { TimesliderEmbeddableFactory, TimeSliderControlEmbeddableInput, } from './control_types/time_slider'; +*/ import { controlsService } from './services/kibana/controls'; export class ControlsPlugin @@ -104,6 +106,7 @@ export class ControlsPlugin registerControlType(rangeSliderFactory); // Time Slider Control Factory Setup + /* Temporary disabling Time Slider const timeSliderFactoryDef = new TimesliderEmbeddableFactory(); const timeSliderFactory = embeddable.registerEmbeddableFactory( TIME_SLIDER_CONTROL, @@ -113,8 +116,10 @@ export class ControlsPlugin timeSliderFactoryDef, timeSliderFactory ); + registerControlType(timeSliderFactory); + */ }); return { diff --git a/src/plugins/controls/server/plugin.ts b/src/plugins/controls/server/plugin.ts index cbe9d39234361..fb39acfaf913c 100644 --- a/src/plugins/controls/server/plugin.ts +++ b/src/plugins/controls/server/plugin.ts @@ -14,7 +14,7 @@ import { PluginSetup as UnifiedSearchSetup } from '@kbn/unified-search-plugin/se import { setupOptionsListSuggestionsRoute } from './control_types/options_list/options_list_suggestions_route'; import { controlGroupContainerPersistableStateServiceFactory } from './control_group/control_group_container_factory'; import { optionsListPersistableStateServiceFactory } from './control_types/options_list/options_list_embeddable_factory'; -import { timeSliderPersistableStateServiceFactory } from './control_types/time_slider/time_slider_embeddable_factory'; +// import { timeSliderPersistableStateServiceFactory } from './control_types/time_slider/time_slider_embeddable_factory'; interface SetupDeps { embeddable: EmbeddableSetup; @@ -25,7 +25,8 @@ interface SetupDeps { export class ControlsPlugin implements Plugin { public setup(core: CoreSetup, { embeddable, unifiedSearch }: SetupDeps) { embeddable.registerEmbeddableFactory(optionsListPersistableStateServiceFactory()); - embeddable.registerEmbeddableFactory(timeSliderPersistableStateServiceFactory()); + // Temporary disabling Time Slider + // embeddable.registerEmbeddableFactory(timeSliderPersistableStateServiceFactory()); embeddable.registerEmbeddableFactory( controlGroupContainerPersistableStateServiceFactory(embeddable) From 6629d413596ac0f5ca0925cdb253584654692435 Mon Sep 17 00:00:00 2001 From: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> Date: Mon, 2 May 2022 17:15:41 +0200 Subject: [PATCH 42/89] [Lens] Range event annotations (#129848) * [Lens] add Range static annotations * range annotations tests * feedback applied * outsideDimension fix * colors manipulations * outsideDimension calculation * outside dimension calculation * reduce bundle * fix tests * custom swatches and comment * better swatches * types * types Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../annotation_layer_config.ts | 2 +- .../__snapshots__/xy_chart.test.tsx.snap | 123 +++-- .../public/components/annotations.scss | 4 + .../public/components/annotations.tsx | 92 +++- .../public/components/xy_chart.test.tsx | 161 +++---- .../public/components/xy_chart.tsx | 33 +- .../common/event_annotation_group/index.ts | 2 +- src/plugins/event_annotation/common/index.ts | 13 +- .../common/manual_event_annotation/index.ts | 83 +++- .../common/manual_event_annotation/types.ts | 24 +- src/plugins/event_annotation/common/types.ts | 31 +- .../event_annotation_service/helpers.ts | 16 + .../event_annotation_service/service.tsx | 85 ++-- .../public/event_annotation_service/types.ts | 4 +- src/plugins/event_annotation/public/index.ts | 6 +- src/plugins/event_annotation/public/plugin.ts | 9 +- src/plugins/event_annotation/server/plugin.ts | 9 +- .../dimension_panel/dimension_panel.test.tsx | 4 +- x-pack/plugins/lens/public/mocks/index.ts | 4 +- .../public/shared_components/name_input.tsx | 3 +- x-pack/plugins/lens/public/types.ts | 2 +- .../xy_visualization/annotations/helpers.tsx | 17 +- .../public/xy_visualization/to_expression.ts | 24 +- .../annotations_config_panel/index.scss | 12 + .../annotations_config_panel/index.test.tsx | 222 +++++++++ .../annotations_config_panel/index.tsx | 436 +++++++++++++++--- .../xy_config_panel/color_picker.tsx | 97 ++-- .../xy_config_panel/reference_line_panel.tsx | 2 + .../xy_config_panel/shared/icon_select.tsx | 13 +- .../shared/marker_decoration_settings.tsx | 3 + .../test/functional/page_objects/lens_page.ts | 2 +- 31 files changed, 1223 insertions(+), 315 deletions(-) create mode 100644 x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.scss create mode 100644 x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx diff --git a/src/plugins/chart_expressions/expression_xy/common/expression_functions/annotation_layer_config.ts b/src/plugins/chart_expressions/expression_xy/common/expression_functions/annotation_layer_config.ts index 9ec3a43e1d710..1f46f12626f0b 100644 --- a/src/plugins/chart_expressions/expression_xy/common/expression_functions/annotation_layer_config.ts +++ b/src/plugins/chart_expressions/expression_xy/common/expression_functions/annotation_layer_config.ts @@ -33,7 +33,7 @@ export function annotationLayerConfigFunction(): ExpressionFunctionDefinition< help: 'Show details', }, annotations: { - types: ['manual_event_annotation'], + types: ['manual_point_event_annotation', 'manual_range_event_annotation'], help: '', multi: true, }, diff --git a/src/plugins/chart_expressions/expression_xy/public/components/__snapshots__/xy_chart.test.tsx.snap b/src/plugins/chart_expressions/expression_xy/public/components/__snapshots__/xy_chart.test.tsx.snap index f534db5a6c4e9..23354c7bdc786 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/__snapshots__/xy_chart.test.tsx.snap +++ b/src/plugins/chart_expressions/expression_xy/public/components/__snapshots__/xy_chart.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`XYChart component annotations should render basic annotation 1`] = ` +exports[`XYChart component annotations should render basic line annotation 1`] = ` `; -exports[`XYChart component annotations should render grouped annotations preserving the shared styles 1`] = ` +exports[`XYChart component annotations should render basic range annotation 1`] = ` +Array [ + , + , +] +`; + +exports[`XYChart component annotations should render grouped line annotations preserving the shared styles 1`] = ` `; -exports[`XYChart component annotations should render grouped annotations with default styles 1`] = ` +exports[`XYChart component annotations should render grouped line annotations with default styles 1`] = ` `; -exports[`XYChart component annotations should render simplified annotation when hide is true 1`] = ` +exports[`XYChart component annotations should render simplified annotations when hide is true 1`] = ` - } - markerBody={ - - } markerPosition="top" style={ Object { @@ -213,6 +236,50 @@ exports[`XYChart component annotations should render simplified annotation when /> `; +exports[`XYChart component annotations should render simplified annotations when hide is true 2`] = ` +Array [ + , + , +] +`; + exports[`XYChart component it renders area 1`] = ` >; hide?: boolean; minInterval?: number; isBarChart?: boolean; + outsideDimension: number; } -interface CollectiveConfig extends EventAnnotationArgs { +interface CollectiveConfig extends ManualPointEventAnnotationArgs { roundedTimestamp: number; axisMode: 'bottom'; customTooltipDetails?: AnnotationTooltipFormatter | undefined; @@ -55,9 +64,11 @@ const groupVisibleConfigsByInterval = ( firstTimestamp?: number ) => { return layers - .flatMap(({ annotations }) => annotations.filter((a) => !a.isHidden)) + .flatMap(({ annotations }) => + annotations.filter((a) => !a.isHidden && a.type === 'manual_point_event_annotation') + ) .sort((a, b) => moment(a.time).valueOf() - moment(b.time).valueOf()) - .reduce>((acc, current) => { + .reduce>((acc, current) => { const roundedTimestamp = getRoundedTimestamp( moment(current.time).valueOf(), firstTimestamp, @@ -72,7 +83,7 @@ const groupVisibleConfigsByInterval = ( const createCustomTooltipDetails = ( - config: EventAnnotationArgs[], + config: ManualPointEventAnnotationArgs[], formatter?: FieldFormat ): AnnotationTooltipFormatter | undefined => () => { @@ -95,8 +106,8 @@ const createCustomTooltipDetails = ); }; -function getCommonProperty( - configArr: EventAnnotationArgs[], +function getCommonProperty( + configArr: ManualPointEventAnnotationArgs[], propertyName: K, fallbackValue: T ) { @@ -107,9 +118,9 @@ function getCommonProperty( return fallbackValue; } -const getCommonStyles = (configArr: EventAnnotationArgs[]) => { +const getCommonStyles = (configArr: ManualPointEventAnnotationArgs[]) => { return { - color: getCommonProperty( + color: getCommonProperty( configArr, 'color', defaultAnnotationColor @@ -120,6 +131,20 @@ const getCommonStyles = (configArr: EventAnnotationArgs[]) => { }; }; +export const getRangeAnnotations = (layers: AnnotationLayerConfigResult[]) => { + return layers + .flatMap(({ annotations }) => + annotations.filter( + (a): a is ManualRangeEventAnnotationOutput => + a.type === 'manual_range_event_annotation' && !a.isHidden + ) + ) + .sort((a, b) => moment(a.time).valueOf() - moment(b.time).valueOf()); +}; + +export const OUTSIDE_RECT_ANNOTATION_WIDTH = 8; +export const OUTSIDE_RECT_ANNOTATION_WIDTH_SUGGESTION = 2; + export const getAnnotationsGroupedByInterval = ( layers: AnnotationLayerConfigResult[], minInterval?: number, @@ -147,18 +172,23 @@ export const getAnnotationsGroupedByInterval = ( }); }; +// todo: remove when closed https://github.com/elastic/elastic-charts/issues/1647 +RectAnnotation.displayName = 'RectAnnotation'; + export const Annotations = ({ - groupedAnnotations, + groupedLineAnnotations, + rangeAnnotations, formatter, isHorizontal, paddingMap, hide, minInterval, isBarChart, + outsideDimension, }: AnnotationsProps) => { return ( <> - {groupedAnnotations.map((annotation) => { + {groupedLineAnnotations.map((annotation) => { const markerPositionVertical = Position.Top; const markerPosition = isHorizontal ? mapVerticalToHorizontalPlacement(markerPositionVertical) @@ -229,6 +259,40 @@ export const Annotations = ({ /> ); })} + {rangeAnnotations.map(({ label, time, color, endTime, outside }) => { + const id = snakeCase(label); + + return ( + ( +
+ +

+ {formatter + ? `${formatter.convert(time)} — ${formatter?.convert(endTime)}` + : `${moment(time).toISOString()} — ${moment(endTime).toISOString()}`} +

+
+
{label}
+
+ )} + dataValues={[ + { + coordinates: { + x0: moment(time).valueOf(), + x1: moment(endTime).valueOf(), + }, + details: label, + }, + ]} + style={{ fill: color || defaultAnnotationRangeColor, opacity: 1 }} + outside={Boolean(outside)} + outsideDimension={outsideDimension} + /> + ); + })} ); }; diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.test.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.test.tsx index 6ac39b1c0f941..fc93f48a594ad 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.test.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.test.tsx @@ -27,6 +27,7 @@ import { LineAnnotation, LineSeries, Position, + RectAnnotation, ScaleType, SeriesNameFn, Settings, @@ -53,6 +54,7 @@ import { import { XYChart, XYChartRenderProps } from './xy_chart'; import { eventAnnotationServiceMock } from '@kbn/event-annotation-plugin/public/mocks'; import { EventAnnotationOutput } from '@kbn/event-annotation-plugin/common'; +import { Annotations } from './annotations'; const onClickValue = jest.fn(); const onSelectRange = jest.fn(); @@ -2533,30 +2535,35 @@ describe('XYChart component', () => { }); describe('annotations', () => { - const sampleStyledAnnotation: EventAnnotationOutput = { + const customLineStaticAnnotation: EventAnnotationOutput = { time: '2022-03-18T08:25:00.000Z', label: 'Event 1', icon: 'triangle', - type: 'manual_event_annotation', + type: 'manual_point_event_annotation' as const, color: 'red', lineStyle: 'dashed', lineWidth: 3, }; - const sampleAnnotationLayers: AnnotationLayerConfigResult[] = [ - { - type: 'annotationLayer', - layerType: LayerTypes.ANNOTATIONS, - layerId: 'annotation', - annotations: [ - { - time: '2022-03-18T08:25:17.140Z', - label: 'Annotation', - type: 'manual_event_annotation', - }, - ], - }, - ]; - function sampleArgsWithAnnotation(annotationLayers = sampleAnnotationLayers) { + const defaultLineStaticAnnotation = { + time: '2022-03-18T08:25:17.140Z', + label: 'Annotation', + type: 'manual_point_event_annotation' as const, + }; + const defaultRangeStaticAnnotation = { + time: '2022-03-18T08:25:17.140Z', + endTime: '2022-03-31T08:25:17.140Z', + label: 'Event range', + type: 'manual_range_event_annotation' as const, + }; + const createLayerWithAnnotations = ( + annotations: EventAnnotationOutput[] = [defaultLineStaticAnnotation] + ): AnnotationLayerConfigResult => ({ + type: 'annotationLayer', + layerType: LayerTypes.ANNOTATIONS, + layerId: 'annotation', + annotations, + }); + function sampleArgsWithAnnotations(annotationLayers = [createLayerWithAnnotations()]) { const { args } = sampleArgs(); return { data: dateHistogramData, @@ -2566,34 +2573,39 @@ describe('XYChart component', () => { } as XYArgs, }; } - test('should render basic annotation', () => { - const { data, args } = sampleArgsWithAnnotation(); + test('should render basic line annotation', () => { + const { data, args } = sampleArgsWithAnnotations(); const component = mount(); expect(component.find('LineAnnotation')).toMatchSnapshot(); }); - test('should render simplified annotation when hide is true', () => { - const { data, args } = sampleArgsWithAnnotation(); - (args.layers[0] as AnnotationLayerConfigResult).hide = true; + test('should render basic range annotation', () => { + const { data, args } = sampleArgsWithAnnotations([ + createLayerWithAnnotations([defaultLineStaticAnnotation, defaultRangeStaticAnnotation]), + ]); + const component = mount(); + expect(component.find(RectAnnotation)).toMatchSnapshot(); + }); + test('should render simplified annotations when hide is true', () => { + const { data, args } = sampleArgsWithAnnotations([ + createLayerWithAnnotations([defaultLineStaticAnnotation, defaultRangeStaticAnnotation]), + ]); + (args.layers[1] as AnnotationLayerConfigResult).hide = true; const component = mount(); expect(component.find('LineAnnotation')).toMatchSnapshot(); + expect(component.find('RectAnnotation')).toMatchSnapshot(); }); - test('should render grouped annotations preserving the shared styles', () => { - const { data, args } = sampleArgsWithAnnotation([ - { - type: 'annotationLayer', - layerType: LayerTypes.ANNOTATIONS, - layerId: 'annotation', - annotations: [ - sampleStyledAnnotation, - { ...sampleStyledAnnotation, time: '2022-03-18T08:25:00.020Z', label: 'Event 2' }, - { - ...sampleStyledAnnotation, - time: '2022-03-18T08:25:00.001Z', - label: 'Event 3', - }, - ], - }, + test('should render grouped line annotations preserving the shared styles', () => { + const { data, args } = sampleArgsWithAnnotations([ + createLayerWithAnnotations([ + customLineStaticAnnotation, + { ...customLineStaticAnnotation, time: '2022-03-18T08:25:00.020Z', label: 'Event 2' }, + { + ...customLineStaticAnnotation, + time: '2022-03-18T08:25:00.001Z', + label: 'Event 3', + }, + ]), ]); const component = mount(); const groupedAnnotation = component.find(LineAnnotation); @@ -2613,30 +2625,20 @@ describe('XYChart component', () => { ' Event 1 2022-03-18T08:25:00.000Z Event 3 2022-03-18T08:25:00.001Z Event 2 2022-03-18T08:25:00.020Z' ); }); - test('should render grouped annotations with default styles', () => { - const { data, args } = sampleArgsWithAnnotation([ - { - type: 'annotationLayer', - layerType: LayerTypes.ANNOTATIONS, - layerId: 'annotation', - annotations: [sampleStyledAnnotation], - }, - { - type: 'annotationLayer', - layerType: LayerTypes.ANNOTATIONS, - layerId: 'annotation', - annotations: [ - { - ...sampleStyledAnnotation, - icon: 'square', - color: 'blue', - lineStyle: 'dotted', - lineWidth: 10, - time: '2022-03-18T08:25:00.001Z', - label: 'Event 2', - }, - ], - }, + test('should render grouped line annotations with default styles', () => { + const { data, args } = sampleArgsWithAnnotations([ + createLayerWithAnnotations([customLineStaticAnnotation]), + createLayerWithAnnotations([ + { + ...customLineStaticAnnotation, + icon: 'square', + color: 'blue', + lineStyle: 'dotted', + lineWidth: 10, + time: '2022-03-18T08:25:00.001Z', + label: 'Event 2', + }, + ]), ]); const component = mount(); const groupedAnnotation = component.find(LineAnnotation); @@ -2646,27 +2648,26 @@ describe('XYChart component', () => { expect(groupedAnnotation).toMatchSnapshot(); }); test('should not render hidden annotations', () => { - const { data, args } = sampleArgsWithAnnotation([ - { - type: 'annotationLayer', - layerType: LayerTypes.ANNOTATIONS, - layerId: 'annotation', - annotations: [ - sampleStyledAnnotation, - { ...sampleStyledAnnotation, time: '2022-03-18T08:30:00.020Z', label: 'Event 2' }, - { - ...sampleStyledAnnotation, - time: '2022-03-18T08:35:00.001Z', - label: 'Event 3', - isHidden: true, - }, - ], - }, + const { data, args } = sampleArgsWithAnnotations([ + createLayerWithAnnotations([ + customLineStaticAnnotation, + { ...customLineStaticAnnotation, time: '2022-03-18T08:30:00.020Z', label: 'Event 2' }, + { + ...customLineStaticAnnotation, + time: '2022-03-18T08:35:00.001Z', + label: 'Event 3', + isHidden: true, + }, + defaultRangeStaticAnnotation, + { ...defaultRangeStaticAnnotation, label: 'range', isHidden: true }, + ]), ]); const component = mount(); - const annotations = component.find(LineAnnotation); + const lineAnnotations = component.find(LineAnnotation); + const rectAnnotations = component.find(Annotations).find(RectAnnotation); - expect(annotations.length).toEqual(2); + expect(lineAnnotations.length).toEqual(2); + expect(rectAnnotations.length).toEqual(1); }); }); }); diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx index 4f543ae0f09ae..72fc7d05eb13d 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx @@ -65,7 +65,13 @@ import { getLegendAction } from './legend_action'; import { ReferenceLineAnnotations, computeChartMargins } from './reference_lines'; import { visualizationDefinitions } from '../definitions'; import { XYLayerConfigResult } from '../../common/types'; -import { Annotations, getAnnotationsGroupedByInterval } from './annotations'; +import { + Annotations, + getAnnotationsGroupedByInterval, + getRangeAnnotations, + OUTSIDE_RECT_ANNOTATION_WIDTH, + OUTSIDE_RECT_ANNOTATION_WIDTH_SUGGESTION, +} from './annotations'; import './xy_chart.scss'; @@ -265,18 +271,21 @@ export function XYChart({ const xColumnId = firstTable.columns.find((col) => col.id === filteredLayers[0].xAccessor)?.id; - const groupedAnnotations = getAnnotationsGroupedByInterval( + const groupedLineAnnotations = getAnnotationsGroupedByInterval( annotationsLayers, minInterval, xColumnId ? firstTable.rows[0]?.[xColumnId] : undefined, xAxisFormatter ); + const rangeAnnotations = getRangeAnnotations(annotationsLayers); + const visualConfigs = [ ...referenceLineLayers.flatMap(({ yConfig }) => yConfig), - ...groupedAnnotations, + ...groupedLineAnnotations, ].filter(Boolean); - const linesPaddings = getLinesCausedPaddings(visualConfigs, yAxesMap); + const shouldHideDetails = annotationsLayers.length > 0 ? annotationsLayers[0].hide : false; + const linesPaddings = !shouldHideDetails ? getLinesCausedPaddings(visualConfigs, yAxesMap) : {}; const getYAxesStyle = (groupId: 'left' | 'right') => { const tickVisible = @@ -507,7 +516,6 @@ export function XYChart({ : undefined, }, }; - return ( ) : null} - {groupedAnnotations.length ? ( + {rangeAnnotations.length || groupedLineAnnotations.length ? ( 0} minInterval={minInterval} + hide={annotationsLayers?.[0].hide} + outsideDimension={ + rangeAnnotations.length && shouldHideDetails + ? OUTSIDE_RECT_ANNOTATION_WIDTH_SUGGESTION + : shouldUseNewTimeAxis + ? Number(MULTILAYER_TIME_AXIS_STYLE.tickLine?.padding || 0) + + Number(chartTheme.axes?.tickLabel?.fontSize || 0) + : Number(chartTheme.axes?.tickLine?.size) || OUTSIDE_RECT_ANNOTATION_WIDTH + } /> ) : null} diff --git a/src/plugins/event_annotation/common/event_annotation_group/index.ts b/src/plugins/event_annotation/common/event_annotation_group/index.ts index f6a1f38459c13..a3a36505b1c2d 100644 --- a/src/plugins/event_annotation/common/event_annotation_group/index.ts +++ b/src/plugins/event_annotation/common/event_annotation_group/index.ts @@ -35,7 +35,7 @@ export function eventAnnotationGroup(): ExpressionFunctionDefinition< }), args: { annotations: { - types: ['manual_event_annotation'], + types: ['manual_point_event_annotation', 'manual_range_event_annotation'], help: i18n.translate('eventAnnotation.group.args.annotationConfigs', { defaultMessage: 'Annotation configs', }), diff --git a/src/plugins/event_annotation/common/index.ts b/src/plugins/event_annotation/common/index.ts index 332fa19150aad..3ed43b19a705c 100644 --- a/src/plugins/event_annotation/common/index.ts +++ b/src/plugins/event_annotation/common/index.ts @@ -6,8 +6,15 @@ * Side Public License, v 1. */ -export type { EventAnnotationArgs, EventAnnotationOutput } from './manual_event_annotation/types'; -export { manualEventAnnotation } from './manual_event_annotation'; +export type { + EventAnnotationArgs, + EventAnnotationOutput, + ManualPointEventAnnotationArgs, + ManualPointEventAnnotationOutput, + ManualRangeEventAnnotationArgs, + ManualRangeEventAnnotationOutput, +} from './manual_event_annotation/types'; +export { manualPointEventAnnotation, manualRangeEventAnnotation } from './manual_event_annotation'; export { eventAnnotationGroup } from './event_annotation_group'; export type { EventAnnotationGroupArgs } from './event_annotation_group'; -export type { EventAnnotationConfig } from './types'; +export type { EventAnnotationConfig, RangeEventAnnotationConfig } from './types'; diff --git a/src/plugins/event_annotation/common/manual_event_annotation/index.ts b/src/plugins/event_annotation/common/manual_event_annotation/index.ts index 167adcb3ed739..2401af53df76c 100644 --- a/src/plugins/event_annotation/common/manual_event_annotation/index.ts +++ b/src/plugins/event_annotation/common/manual_event_annotation/index.ts @@ -8,16 +8,22 @@ import type { ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; import { i18n } from '@kbn/i18n'; -import type { EventAnnotationArgs, EventAnnotationOutput } from './types'; -export const manualEventAnnotation: ExpressionFunctionDefinition< - 'manual_event_annotation', +import type { + ManualRangeEventAnnotationArgs, + ManualRangeEventAnnotationOutput, + ManualPointEventAnnotationArgs, + ManualPointEventAnnotationOutput, +} from './types'; + +export const manualPointEventAnnotation: ExpressionFunctionDefinition< + 'manual_point_event_annotation', null, - EventAnnotationArgs, - EventAnnotationOutput + ManualPointEventAnnotationArgs, + ManualPointEventAnnotationOutput > = { - name: 'manual_event_annotation', + name: 'manual_point_event_annotation', aliases: [], - type: 'manual_event_annotation', + type: 'manual_point_event_annotation', help: i18n.translate('eventAnnotation.manualAnnotation.description', { defaultMessage: `Configure manual annotation`, }), @@ -73,9 +79,68 @@ export const manualEventAnnotation: ExpressionFunctionDefinition< }), }, }, - fn: function fn(input: unknown, args: EventAnnotationArgs) { + fn: function fn(input: unknown, args: ManualPointEventAnnotationArgs) { + return { + type: 'manual_point_event_annotation', + ...args, + }; + }, +}; + +export const manualRangeEventAnnotation: ExpressionFunctionDefinition< + 'manual_range_event_annotation', + null, + ManualRangeEventAnnotationArgs, + ManualRangeEventAnnotationOutput +> = { + name: 'manual_range_event_annotation', + aliases: [], + type: 'manual_range_event_annotation', + help: i18n.translate('eventAnnotation.manualAnnotation.description', { + defaultMessage: `Configure manual annotation`, + }), + inputTypes: ['null'], + args: { + time: { + types: ['string'], + help: i18n.translate('eventAnnotation.manualAnnotation.args.time', { + defaultMessage: `Timestamp for annotation`, + }), + }, + endTime: { + types: ['string'], + help: i18n.translate('eventAnnotation.manualAnnotation.args.endTime', { + defaultMessage: `Timestamp for range annotation`, + }), + required: false, + }, + outside: { + types: ['boolean'], + help: '', + required: false, + }, + label: { + types: ['string'], + help: i18n.translate('eventAnnotation.manualAnnotation.args.label', { + defaultMessage: `The name of the annotation`, + }), + }, + color: { + types: ['string'], + help: i18n.translate('eventAnnotation.manualAnnotation.args.color', { + defaultMessage: 'The color of the line', + }), + }, + isHidden: { + types: ['boolean'], + help: i18n.translate('eventAnnotation.manualAnnotation.args.isHidden', { + defaultMessage: `Switch to hide annotation`, + }), + }, + }, + fn: function fn(input: unknown, args: ManualRangeEventAnnotationArgs) { return { - type: 'manual_event_annotation', + type: 'manual_range_event_annotation', ...args, }; }, diff --git a/src/plugins/event_annotation/common/manual_event_annotation/types.ts b/src/plugins/event_annotation/common/manual_event_annotation/types.ts index e1bed4a592d23..208383734924c 100644 --- a/src/plugins/event_annotation/common/manual_event_annotation/types.ts +++ b/src/plugins/event_annotation/common/manual_event_annotation/types.ts @@ -6,10 +6,26 @@ * Side Public License, v 1. */ -import { StyleProps } from '../types'; +import { PointStyleProps, RangeStyleProps } from '../types'; -export type EventAnnotationArgs = { +export type ManualPointEventAnnotationArgs = { time: string; -} & StyleProps; +} & PointStyleProps; -export type EventAnnotationOutput = EventAnnotationArgs & { type: 'manual_event_annotation' }; +export type ManualPointEventAnnotationOutput = ManualPointEventAnnotationArgs & { + type: 'manual_point_event_annotation'; +}; + +export type ManualRangeEventAnnotationArgs = { + time: string; + endTime: string; +} & RangeStyleProps; + +export type ManualRangeEventAnnotationOutput = ManualRangeEventAnnotationArgs & { + type: 'manual_range_event_annotation'; +}; + +export type EventAnnotationArgs = ManualPointEventAnnotationArgs | ManualRangeEventAnnotationArgs; +export type EventAnnotationOutput = + | ManualPointEventAnnotationOutput + | ManualRangeEventAnnotationOutput; diff --git a/src/plugins/event_annotation/common/types.ts b/src/plugins/event_annotation/common/types.ts index 95275804d1d1f..664138c9eb9e6 100644 --- a/src/plugins/event_annotation/common/types.ts +++ b/src/plugins/event_annotation/common/types.ts @@ -7,10 +7,11 @@ */ export type LineStyle = 'solid' | 'dashed' | 'dotted'; +export type Fill = 'inside' | 'outside' | 'none'; export type AnnotationType = 'manual'; -export type KeyType = 'point_in_time'; +export type KeyType = 'point_in_time' | 'range'; -export interface StyleProps { +export interface PointStyleProps { label: string; color?: string; icon?: string; @@ -20,10 +21,30 @@ export interface StyleProps { isHidden?: boolean; } -export type EventAnnotationConfig = { +export type PointInTimeEventAnnotationConfig = { id: string; key: { - type: KeyType; + type: 'point_in_time'; timestamp: string; }; -} & StyleProps; +} & PointStyleProps; + +export interface RangeStyleProps { + label: string; + color?: string; + outside?: boolean; + isHidden?: boolean; +} + +export type RangeEventAnnotationConfig = { + id: string; + key: { + type: 'range'; + timestamp: string; + endTimestamp: string; + }; +} & RangeStyleProps; + +export type StyleProps = PointStyleProps & RangeStyleProps; + +export type EventAnnotationConfig = PointInTimeEventAnnotationConfig | RangeEventAnnotationConfig; diff --git a/src/plugins/event_annotation/public/event_annotation_service/helpers.ts b/src/plugins/event_annotation/public/event_annotation_service/helpers.ts index aed33da840574..8eb3d05309ec1 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/helpers.ts +++ b/src/plugins/event_annotation/public/event_annotation_service/helpers.ts @@ -5,5 +5,21 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ +import { i18n } from '@kbn/i18n'; import { euiLightVars } from '@kbn/ui-theme'; +import { EventAnnotationConfig, RangeEventAnnotationConfig } from '../../common'; export const defaultAnnotationColor = euiLightVars.euiColorAccent; +export const defaultAnnotationRangeColor = `#F04E981A`; // defaultAnnotationColor with opacity 0.1 + +export const defaultAnnotationLabel = i18n.translate( + 'eventAnnotation.manualAnnotation.defaultAnnotationLabel', + { + defaultMessage: 'Event', + } +); + +export const isRangeAnnotation = ( + annotation?: EventAnnotationConfig +): annotation is RangeEventAnnotationConfig => { + return Boolean(annotation && annotation?.key.type === 'range'); +}; diff --git a/src/plugins/event_annotation/public/event_annotation_service/service.tsx b/src/plugins/event_annotation/public/event_annotation_service/service.tsx index 3d81ea6a3e3a6..4770c1c182af6 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/service.tsx +++ b/src/plugins/event_annotation/public/event_annotation_service/service.tsx @@ -7,43 +7,70 @@ */ import { EventAnnotationServiceType } from './types'; -import { defaultAnnotationColor } from './helpers'; +import { + defaultAnnotationColor, + defaultAnnotationRangeColor, + defaultAnnotationLabel, +} from './helpers'; +import { EventAnnotationConfig } from '../../common'; +import { RangeEventAnnotationConfig } from '../../common/types'; export function hasIcon(icon: string | undefined): icon is string { return icon != null && icon !== 'empty'; } +const isRangeAnnotation = ( + annotation?: EventAnnotationConfig +): annotation is RangeEventAnnotationConfig => { + return Boolean(annotation && annotation?.key.type === 'range'); +}; + export function getEventAnnotationService(): EventAnnotationServiceType { return { - toExpression: ({ - label, - isHidden, - color, - lineStyle, - lineWidth, - icon, - textVisibility, - time, - }) => { - return { - type: 'expression', - chain: [ - { - type: 'function', - function: 'manual_event_annotation', - arguments: { - time: [time], - label: [label], - color: [color || defaultAnnotationColor], - lineWidth: [lineWidth || 1], - lineStyle: [lineStyle || 'solid'], - icon: hasIcon(icon) ? [icon] : ['triangle'], - textVisibility: [textVisibility || false], - isHidden: [Boolean(isHidden)], + toExpression: (annotation) => { + if (isRangeAnnotation(annotation)) { + const { label, isHidden, color, key, outside } = annotation; + const { timestamp: time, endTimestamp: endTime } = key; + return { + type: 'expression', + chain: [ + { + type: 'function', + function: 'manual_range_event_annotation', + arguments: { + time: [time], + endTime: [endTime], + label: [label || defaultAnnotationLabel], + color: [color || defaultAnnotationRangeColor], + outside: [Boolean(outside)], + isHidden: [Boolean(isHidden)], + }, + }, + ], + }; + } else { + const { label, isHidden, color, lineStyle, lineWidth, icon, key, textVisibility } = + annotation; + return { + type: 'expression', + chain: [ + { + type: 'function', + function: 'manual_point_event_annotation', + arguments: { + time: [key.timestamp], + label: [label || defaultAnnotationLabel], + color: [color || defaultAnnotationColor], + lineWidth: [lineWidth || 1], + lineStyle: [lineStyle || 'solid'], + icon: hasIcon(icon) ? [icon] : ['triangle'], + textVisibility: [textVisibility || false], + isHidden: [Boolean(isHidden)], + }, }, - }, - ], - }; + ], + }; + } }, }; } diff --git a/src/plugins/event_annotation/public/event_annotation_service/types.ts b/src/plugins/event_annotation/public/event_annotation_service/types.ts index c44b2d1e536d5..d5fcaa23107c8 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/types.ts +++ b/src/plugins/event_annotation/public/event_annotation_service/types.ts @@ -7,8 +7,8 @@ */ import { ExpressionAstExpression } from '@kbn/expressions-plugin/common/ast'; -import { EventAnnotationArgs } from '../../common'; +import { EventAnnotationConfig } from '../../common'; export interface EventAnnotationServiceType { - toExpression: (props: EventAnnotationArgs) => ExpressionAstExpression; + toExpression: (props: EventAnnotationConfig) => ExpressionAstExpression; } diff --git a/src/plugins/event_annotation/public/index.ts b/src/plugins/event_annotation/public/index.ts index c15429c94cbe4..56ddc4b8a60e1 100644 --- a/src/plugins/event_annotation/public/index.ts +++ b/src/plugins/event_annotation/public/index.ts @@ -14,4 +14,8 @@ export const plugin = () => new EventAnnotationPlugin(); export type { EventAnnotationPluginSetup, EventAnnotationPluginStart } from './plugin'; export * from './event_annotation_service/types'; export { EventAnnotationService } from './event_annotation_service'; -export { defaultAnnotationColor } from './event_annotation_service/helpers'; +export { + defaultAnnotationColor, + defaultAnnotationRangeColor, + isRangeAnnotation, +} from './event_annotation_service/helpers'; diff --git a/src/plugins/event_annotation/public/plugin.ts b/src/plugins/event_annotation/public/plugin.ts index f3f4fcfcc60f6..9314151375f20 100644 --- a/src/plugins/event_annotation/public/plugin.ts +++ b/src/plugins/event_annotation/public/plugin.ts @@ -8,7 +8,11 @@ import { Plugin, CoreSetup } from '@kbn/core/public'; import { ExpressionsSetup } from '@kbn/expressions-plugin/public'; -import { manualEventAnnotation, eventAnnotationGroup } from '../common'; +import { + manualPointEventAnnotation, + manualRangeEventAnnotation, + eventAnnotationGroup, +} from '../common'; import { EventAnnotationService } from './event_annotation_service'; interface SetupDependencies { @@ -28,7 +32,8 @@ export class EventAnnotationPlugin private readonly eventAnnotationService = new EventAnnotationService(); public setup(core: CoreSetup, dependencies: SetupDependencies): EventAnnotationPluginSetup { - dependencies.expressions.registerFunction(manualEventAnnotation); + dependencies.expressions.registerFunction(manualPointEventAnnotation); + dependencies.expressions.registerFunction(manualRangeEventAnnotation); dependencies.expressions.registerFunction(eventAnnotationGroup); return this.eventAnnotationService; } diff --git a/src/plugins/event_annotation/server/plugin.ts b/src/plugins/event_annotation/server/plugin.ts index 0643611af9bb3..387326fcf2a21 100644 --- a/src/plugins/event_annotation/server/plugin.ts +++ b/src/plugins/event_annotation/server/plugin.ts @@ -8,7 +8,11 @@ import { CoreSetup, Plugin } from '@kbn/core/server'; import { ExpressionsServerSetup } from '@kbn/expressions-plugin/server'; -import { manualEventAnnotation, eventAnnotationGroup } from '../common'; +import { + manualPointEventAnnotation, + eventAnnotationGroup, + manualRangeEventAnnotation, +} from '../common'; interface SetupDependencies { expressions: ExpressionsServerSetup; @@ -16,7 +20,8 @@ interface SetupDependencies { export class EventAnnotationServerPlugin implements Plugin { public setup(core: CoreSetup, dependencies: SetupDependencies) { - dependencies.expressions.registerFunction(manualEventAnnotation); + dependencies.expressions.registerFunction(manualPointEventAnnotation); + dependencies.expressions.registerFunction(manualRangeEventAnnotation); dependencies.expressions.registerFunction(eventAnnotationGroup); return {}; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx index 3ab3633725678..7f21cf21000b1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx @@ -635,7 +635,7 @@ describe('IndexPatternDimensionEditorPanel', () => { act(() => { wrapper - .find('input[data-test-subj="indexPattern-label-edit"]') + .find('input[data-test-subj="column-label-edit"]') .simulate('change', { target: { value: 'New Label' } }); }); @@ -739,7 +739,7 @@ describe('IndexPatternDimensionEditorPanel', () => { act(() => { wrapper - .find('input[data-test-subj="indexPattern-label-edit"]') + .find('input[data-test-subj="column-label-edit"]') .simulate('change', { target: { value: 'Sum of bytes' } }); }); diff --git a/x-pack/plugins/lens/public/mocks/index.ts b/x-pack/plugins/lens/public/mocks/index.ts index ab6f2066e8804..58ef8ce05c613 100644 --- a/x-pack/plugins/lens/public/mocks/index.ts +++ b/x-pack/plugins/lens/public/mocks/index.ts @@ -31,14 +31,14 @@ export type FrameMock = jest.Mocked; export const createMockFramePublicAPI = (): FrameMock => ({ datasourceLayers: {}, - dateRange: { fromDate: 'now-7d', toDate: 'now' }, + dateRange: { fromDate: '2022-03-17T08:25:00.000Z', toDate: '2022-04-17T08:25:00.000Z' }, }); export type FrameDatasourceMock = jest.Mocked; export const createMockFrameDatasourceAPI = (): FrameDatasourceMock => ({ datasourceLayers: {}, - dateRange: { fromDate: 'now-7d', toDate: 'now' }, + dateRange: { fromDate: '2022-03-17T08:25:00.000Z', toDate: '2022-04-17T08:25:00.000Z' }, query: { query: '', language: 'lucene' }, filters: [], }); diff --git a/x-pack/plugins/lens/public/shared_components/name_input.tsx b/x-pack/plugins/lens/public/shared_components/name_input.tsx index 0b65b26021628..9502c7df93d55 100644 --- a/x-pack/plugins/lens/public/shared_components/name_input.tsx +++ b/x-pack/plugins/lens/public/shared_components/name_input.tsx @@ -35,8 +35,9 @@ export const NameInput = ({ fullWidth > { handleInputChange(e.target.value); diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 22d794e803df1..e4ff1aab1a6c4 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -525,7 +525,7 @@ export interface OperationDescriptor extends Operation { export interface VisualizationConfigProps { layerId: string; - frame: Pick; + frame: FramePublicAPI; state: T; } diff --git a/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx b/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx index fe120dc71b17a..9157d310d00b0 100644 --- a/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx @@ -7,7 +7,11 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment'; -import { defaultAnnotationColor } from '@kbn/event-annotation-plugin/public'; +import { + defaultAnnotationColor, + defaultAnnotationRangeColor, + isRangeAnnotation, +} from '@kbn/event-annotation-plugin/public'; import { layerTypes } from '../../../common'; import type { FramePublicAPI, Visualization } from '../../types'; import { isHorizontalChart } from '../state_helpers'; @@ -29,6 +33,13 @@ export const defaultAnnotationLabel = i18n.translate('xpack.lens.xyChart.default defaultMessage: 'Event', }); +export const defaultRangeAnnotationLabel = i18n.translate( + 'xpack.lens.xyChart.defaultRangeAnnotationLabel', + { + defaultMessage: 'Event range', + } +); + export function getStaticDate(dataLayers: XYDataLayerConfig[], frame: FramePublicAPI) { const dataLayersId = dataLayers.map(({ layerId }) => layerId); const { activeData, dateRange } = frame; @@ -161,7 +172,9 @@ export const getAnnotationsAccessorColorConfig = (layer: XYAnnotationLayerConfig return { columnId: annotation.id, triggerIcon: annotation.isHidden ? ('invisible' as const) : ('color' as const), - color: annotation?.color || defaultAnnotationColor, + color: + annotation?.color || + (isRangeAnnotation(annotation) ? defaultAnnotationRangeColor : defaultAnnotationColor), }; }); }; diff --git a/x-pack/plugins/lens/public/xy_visualization/to_expression.ts b/x-pack/plugins/lens/public/xy_visualization/to_expression.ts index eeb56bd7ee115..423cc49b68cf7 100644 --- a/x-pack/plugins/lens/public/xy_visualization/to_expression.ts +++ b/x-pack/plugins/lens/public/xy_visualization/to_expression.ts @@ -28,7 +28,7 @@ import { getReferenceLayers, getAnnotationsLayers, } from './visualization_helpers'; -import { getUniqueLabels, defaultAnnotationLabel } from './annotations/helpers'; +import { getUniqueLabels } from './annotations/helpers'; import { layerTypes } from '../../common'; export const getSortedAccessors = ( @@ -83,7 +83,7 @@ const simplifiedLayerExpression = { [layerTypes.REFERENCELINE]: (layer: XYReferenceLineLayerConfig) => ({ ...layer, hide: true, - yConfig: layer.yConfig?.map(({ lineWidth, ...rest }) => ({ + yConfig: layer.yConfig?.map(({ ...rest }) => ({ ...rest, lineWidth: 1, icon: undefined, @@ -93,12 +93,6 @@ const simplifiedLayerExpression = { [layerTypes.ANNOTATIONS]: (layer: XYAnnotationLayerConfig) => ({ ...layer, hide: true, - annotations: layer.annotations?.map(({ lineWidth, ...rest }) => ({ - ...rest, - lineWidth: 1, - icon: undefined, - textVisibility: false, - })), }), }; @@ -417,19 +411,7 @@ const annotationLayerToExpression = ( hide: [Boolean(layer.hide)], layerId: [layer.layerId], annotations: layer.annotations - ? layer.annotations.map( - (ann): Ast => - eventAnnotationService.toExpression({ - time: ann.key.timestamp, - label: ann.label || defaultAnnotationLabel, - textVisibility: ann.textVisibility, - icon: ann.icon, - lineStyle: ann.lineStyle, - lineWidth: ann.lineWidth, - color: ann.color, - isHidden: Boolean(ann.isHidden), - }) - ) + ? layer.annotations.map((ann): Ast => eventAnnotationService.toExpression(ann)) : [], }, }, diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.scss b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.scss new file mode 100644 index 0000000000000..3a0f4b944aa6c --- /dev/null +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.scss @@ -0,0 +1,12 @@ +.lnsRowCompressedMargin+.lnsRowCompressedMargin { + margin-top: $euiSizeS; +} + +.lnsConfigPanelNoPadding { + padding: 0; +} + +.lnsConfigPanelDate__label { + min-width: 56px; // makes both labels ("from" and "to") the same width + text-align: center; +} \ No newline at end of file diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx new file mode 100644 index 0000000000000..6194a7f0da120 --- /dev/null +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx @@ -0,0 +1,222 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; +import { AnnotationsPanel } from '.'; +import { FramePublicAPI } from '../../../types'; +import { layerTypes } from '../../..'; +import { createMockFramePublicAPI } from '../../../mocks'; +import { State } from '../../types'; +import { Position } from '@elastic/charts'; +import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; +import moment from 'moment'; + +jest.mock('lodash', () => { + const original = jest.requireActual('lodash'); + + return { + ...original, + debounce: (fn: unknown) => fn, + }; +}); + +const customLineStaticAnnotation = { + id: 'ann1', + key: { type: 'point_in_time' as const, timestamp: '2022-03-18T08:25:00.000Z' }, + label: 'Event', + icon: 'triangle', + color: 'red', + lineStyle: 'dashed' as const, + lineWidth: 3, +}; + +describe('AnnotationsPanel', () => { + let frame: FramePublicAPI; + + function testState(): State { + return { + legend: { isVisible: true, position: Position.Right }, + valueLabels: 'hide', + preferredSeriesType: 'bar', + layers: [ + { + layerType: layerTypes.ANNOTATIONS, + layerId: 'annotation', + annotations: [customLineStaticAnnotation], + }, + ], + }; + } + + beforeEach(() => { + frame = createMockFramePublicAPI(); + frame.datasourceLayers = {}; + }); + describe('Dimension Editor', () => { + test('shows correct options for line annotations', () => { + const state = testState(); + const component = mount( + + ); + + expect( + component.find('EuiDatePicker[data-test-subj="lns-xyAnnotation-time"]').prop('selected') + ).toEqual(moment('2022-03-18T08:25:00.000Z')); + expect( + component.find('EuiDatePicker[data-test-subj="lns-xyAnnotation-fromTime"]').exists() + ).toBeFalsy(); + expect( + component.find('EuiDatePicker[data-test-subj="lns-xyAnnotation-toTime"]').exists() + ).toBeFalsy(); + expect( + component.find('EuiSwitch[data-test-subj="lns-xyAnnotation-rangeSwitch"]').prop('checked') + ).toEqual(false); + expect( + component.find('EuiFieldText[data-test-subj="column-label-edit"]').prop('value') + ).toEqual('Event'); + expect( + component.find('EuiComboBox[data-test-subj="lns-icon-select"]').prop('selectedOptions') + ).toEqual([{ label: 'Triangle', value: 'triangle' }]); + expect(component.find('TextDecorationSetting').exists()).toBeTruthy(); + expect(component.find('LineStyleSettings').exists()).toBeTruthy(); + expect( + component.find('EuiButtonGroup[data-test-subj="lns-xyAnnotation-fillStyle"]').exists() + ).toBeFalsy(); + }); + test('shows correct options for range annotations', () => { + const state = testState(); + state.layers[0] = { + annotations: [ + { + color: 'red', + icon: 'triangle', + id: 'ann1', + isHidden: undefined, + key: { + endTimestamp: '2022-03-21T10:49:00.000Z', + timestamp: '2022-03-18T08:25:00.000Z', + type: 'range', + }, + label: 'Event range', + lineStyle: 'dashed', + lineWidth: 3, + }, + ], + layerId: 'annotation', + layerType: 'annotations', + }; + const component = mount( + + ); + + expect( + component.find('EuiDatePicker[data-test-subj="lns-xyAnnotation-fromTime"]').prop('selected') + ).toEqual(moment('2022-03-18T08:25:00.000Z')); + expect( + component.find('EuiDatePicker[data-test-subj="lns-xyAnnotation-toTime"]').prop('selected') + ).toEqual(moment('2022-03-21T10:49:00.000Z')); + expect( + component.find('EuiDatePicker[data-test-subj="lns-xyAnnotation-time"]').exists() + ).toBeFalsy(); + expect( + component.find('EuiSwitch[data-test-subj="lns-xyAnnotation-rangeSwitch"]').prop('checked') + ).toEqual(true); + expect( + component.find('EuiFieldText[data-test-subj="column-label-edit"]').prop('value') + ).toEqual('Event range'); + expect(component.find('EuiComboBox[data-test-subj="lns-icon-select"]').exists()).toBeFalsy(); + expect(component.find('TextDecorationSetting').exists()).toBeFalsy(); + expect(component.find('LineStyleSettings').exists()).toBeFalsy(); + expect(component.find('[data-test-subj="lns-xyAnnotation-fillStyle"]').exists()).toBeTruthy(); + }); + + test('calculates correct endTimstamp and transparent color when switching for range annotation and back', () => { + const state = testState(); + const setState = jest.fn(); + const component = mount( + + ); + component.find('button[data-test-subj="lns-xyAnnotation-rangeSwitch"]').simulate('click'); + + expect(setState).toBeCalledWith({ + ...state, + layers: [ + { + annotations: [ + { + color: '#FF00001A', + id: 'ann1', + isHidden: undefined, + label: 'Event range', + key: { + endTimestamp: '2022-03-21T10:49:00.000Z', + timestamp: '2022-03-18T08:25:00.000Z', + type: 'range', + }, + }, + ], + layerId: 'annotation', + layerType: 'annotations', + }, + ], + }); + component.find('button[data-test-subj="lns-xyAnnotation-rangeSwitch"]').simulate('click'); + expect(setState).toBeCalledWith({ + ...state, + layers: [ + { + annotations: [ + { + color: '#FF0000', + id: 'ann1', + isHidden: undefined, + key: { + timestamp: '2022-03-18T08:25:00.000Z', + type: 'point_in_time', + }, + label: 'Event', + }, + ], + layerId: 'annotation', + layerType: 'annotations', + }, + ], + }); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.tsx index 6435f4c7ba2b8..511d00f33a01c 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.tsx @@ -5,23 +5,115 @@ * 2.0. */ +import './index.scss'; import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiDatePicker, EuiFormRow, EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; +import { + EuiDatePicker, + EuiFormRow, + EuiSwitch, + EuiSwitchEvent, + EuiButtonGroup, + EuiFormLabel, + EuiFormControlLayout, + EuiText, + transparentize, +} from '@elastic/eui'; +import { pick } from 'lodash'; import moment from 'moment'; -import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common/types'; -import type { VisualizationDimensionEditorProps } from '../../../types'; -import { State, XYState, XYAnnotationLayerConfig } from '../../types'; +import { + EventAnnotationConfig, + PointInTimeEventAnnotationConfig, + RangeEventAnnotationConfig, +} from '@kbn/event-annotation-plugin/common/types'; +import { search } from '@kbn/data-plugin/public'; +import { + defaultAnnotationColor, + defaultAnnotationRangeColor, + isRangeAnnotation, +} from '@kbn/event-annotation-plugin/public'; +import Color from 'color'; +import type { FramePublicAPI, VisualizationDimensionEditorProps } from '../../../types'; +import { State, XYState, XYAnnotationLayerConfig, XYDataLayerConfig } from '../../types'; import { FormatFactory } from '../../../../common'; import { DimensionEditorSection, NameInput, useDebouncedValue } from '../../../shared_components'; import { isHorizontalChart } from '../../state_helpers'; -import { defaultAnnotationLabel } from '../../annotations/helpers'; +import { defaultAnnotationLabel, defaultRangeAnnotationLabel } from '../../annotations/helpers'; import { ColorPicker } from '../color_picker'; import { IconSelectSetting, TextDecorationSetting } from '../shared/marker_decoration_settings'; import { LineStyleSettings } from '../shared/line_style_settings'; import { updateLayer } from '..'; import { annotationsIconSet } from './icon_set'; +import { getDataLayers } from '../../visualization_helpers'; + +export const toRangeAnnotationColor = (color = defaultAnnotationColor) => { + return new Color(transparentize(color, 0.1)).hexa(); +}; + +export const toLineAnnotationColor = (color = defaultAnnotationRangeColor) => { + return new Color(transparentize(color, 1)).hex(); +}; + +export const getEndTimestamp = ( + startTime: string, + { activeData, dateRange }: FramePublicAPI, + dataLayers: XYDataLayerConfig[] +) => { + const startTimeNumber = moment(startTime).valueOf(); + const dateRangeFraction = + (moment(dateRange.toDate).valueOf() - moment(dateRange.fromDate).valueOf()) * 0.1; + const fallbackValue = moment(startTimeNumber + dateRangeFraction).toISOString(); + const dataLayersId = dataLayers.map(({ layerId }) => layerId); + if ( + !dataLayersId.length || + !activeData || + Object.entries(activeData) + .filter(([key]) => dataLayersId.includes(key)) + .every(([, { rows }]) => !rows || !rows.length) + ) { + return fallbackValue; + } + const xColumn = activeData?.[dataLayersId[0]].columns.find( + (column) => column.id === dataLayers[0].xAccessor + ); + if (!xColumn) { + return fallbackValue; + } + + const dateInterval = search.aggs.getDateHistogramMetaDataByDatatableColumn(xColumn)?.interval; + if (!dateInterval) return fallbackValue; + const intervalDuration = search.aggs.parseInterval(dateInterval); + if (!intervalDuration) return fallbackValue; + return moment(startTimeNumber + 3 * intervalDuration.as('milliseconds')).toISOString(); +}; + +const sanitizeProperties = (annotation: EventAnnotationConfig) => { + if (isRangeAnnotation(annotation)) { + const rangeAnnotation: RangeEventAnnotationConfig = pick(annotation, [ + 'label', + 'key', + 'id', + 'isHidden', + 'color', + 'outside', + ]); + return rangeAnnotation; + } else { + const lineAnnotation: PointInTimeEventAnnotationConfig = pick(annotation, [ + 'id', + 'label', + 'key', + 'isHidden', + 'lineStyle', + 'lineWidth', + 'color', + 'icon', + 'textVisibility', + ]); + return lineAnnotation; + } +}; export const AnnotationsPanel = ( props: VisualizationDimensionEditorProps & { @@ -29,7 +121,7 @@ export const AnnotationsPanel = ( paletteService: PaletteRegistry; } ) => { - const { state, setState, layerId, accessor } = props; + const { state, setState, layerId, accessor, frame } = props; const isHorizontal = isHorizontalChart(state.layers); const { inputValue: localState, handleInputChange: setLocalState } = useDebouncedValue({ @@ -42,19 +134,26 @@ export const AnnotationsPanel = ( (l) => l.layerId === layerId ) as XYAnnotationLayerConfig; - const currentAnnotations = localLayer.annotations?.find((c) => c.id === accessor); + const currentAnnotation = localLayer.annotations?.find((c) => c.id === accessor); + + const isRange = isRangeAnnotation(currentAnnotation); const setAnnotations = useCallback( - (annotations: Partial | undefined) => { - if (annotations == null) { + (annotation) => { + if (annotation == null) { return; } const newConfigs = [...(localLayer.annotations || [])]; const existingIndex = newConfigs.findIndex((c) => c.id === accessor); if (existingIndex !== -1) { - newConfigs[existingIndex] = { ...newConfigs[existingIndex], ...annotations }; + newConfigs[existingIndex] = sanitizeProperties({ + ...newConfigs[existingIndex], + ...annotation, + }); } else { - return; // that should never happen because annotations are created before annotations panel is opened + throw new Error( + 'should never happen because annotation is created before config panel is opened' + ); } setLocalState(updateLayer(localState, { ...localLayer, annotations: newConfigs }, index)); }, @@ -68,21 +167,97 @@ export const AnnotationsPanel = ( defaultMessage: 'Placement', })} > - { - if (date) { - setAnnotations({ - key: { - ...(currentAnnotations?.key || { type: 'point_in_time' }), - timestamp: date.toISOString(), - }, - }); - } - }} - label={i18n.translate('xpack.lens.xyChart.annotationDate', { - defaultMessage: 'Annotation date', - })} + {isRange ? ( + <> + { + if (date) { + const currentEndTime = moment(currentAnnotation?.key.endTimestamp).valueOf(); + if (currentEndTime < date.valueOf()) { + const currentStartTime = moment(currentAnnotation?.key.timestamp).valueOf(); + const dif = currentEndTime - currentStartTime; + setAnnotations({ + key: { + ...(currentAnnotation?.key || { type: 'range' }), + timestamp: date.toISOString(), + endTimestamp: moment(date.valueOf() + dif).toISOString(), + }, + }); + } else { + setAnnotations({ + key: { + ...(currentAnnotation?.key || { type: 'range' }), + timestamp: date.toISOString(), + }, + }); + } + } + }} + label={i18n.translate('xpack.lens.xyChart.annotationDate', { + defaultMessage: 'Annotation date', + })} + /> + { + if (date) { + const currentStartTime = moment(currentAnnotation?.key.timestamp).valueOf(); + if (currentStartTime > date.valueOf()) { + const currentEndTime = moment(currentAnnotation?.key.endTimestamp).valueOf(); + const dif = currentEndTime - currentStartTime; + setAnnotations({ + key: { + ...(currentAnnotation?.key || { type: 'range' }), + endTimestamp: date.toISOString(), + timestamp: moment(date.valueOf() - dif).toISOString(), + }, + }); + } else { + setAnnotations({ + key: { + ...(currentAnnotation?.key || { type: 'range' }), + endTimestamp: date.toISOString(), + }, + }); + } + } + }} + /> + + ) : ( + { + if (date) { + setAnnotations({ + key: { + ...(currentAnnotation?.key || { type: 'point_in_time' }), + timestamp: date.toISOString(), + }, + }); + } + }} + /> + )} + + { setAnnotations({ label: value }); }} /> - - - + {!isRange && ( + + )} + {!isRange && ( + + )} + {!isRange && ( + + )} + + {isRange && ( + + { + setAnnotations({ + outside: id === `lens_xyChart_fillStyle_outside`, + }); + }} + isFullWidth + /> + + )} + setAnnotations({ isHidden: ev.target.checked })} /> @@ -134,25 +363,114 @@ export const AnnotationsPanel = ( ); }; -const ConfigPanelDatePicker = ({ +const ConfigPanelApplyAsRangeSwitch = ({ + annotation, + onChange, + frame, + state, +}: { + annotation?: EventAnnotationConfig; + onChange: (annotations: Partial | undefined) => void; + frame: FramePublicAPI; + state: XYState; +}) => { + const isRange = isRangeAnnotation(annotation); + return ( + + + {i18n.translate('xpack.lens.xyChart.applyAsRange', { + defaultMessage: 'Apply as range', + })} + + } + checked={isRange} + onChange={() => { + if (isRange) { + const newPointAnnotation: PointInTimeEventAnnotationConfig = { + key: { + type: 'point_in_time', + timestamp: annotation.key.timestamp, + }, + id: annotation.id, + label: + annotation.label === defaultRangeAnnotationLabel + ? defaultAnnotationLabel + : annotation.label, + color: toLineAnnotationColor(annotation.color), + isHidden: annotation.isHidden, + }; + onChange(newPointAnnotation); + } else if (annotation) { + const fromTimestamp = moment(annotation?.key.timestamp); + const dataLayers = getDataLayers(state.layers); + const newRangeAnnotation: RangeEventAnnotationConfig = { + key: { + type: 'range', + timestamp: annotation.key.timestamp, + endTimestamp: getEndTimestamp(fromTimestamp.toISOString(), frame, dataLayers), + }, + id: annotation.id, + label: + annotation.label === defaultAnnotationLabel + ? defaultRangeAnnotationLabel + : annotation.label, + color: toRangeAnnotationColor(annotation.color), + isHidden: annotation.isHidden, + }; + onChange(newRangeAnnotation); + } + }} + compressed + /> + + ); +}; + +const ConfigPanelRangeDatePicker = ({ value, label, + prependLabel, onChange, + dataTestSubj = 'lnsXY_annotation_date_picker', }: { value: moment.Moment; - label: string; + prependLabel?: string; + label?: string; onChange: (val: moment.Moment | null) => void; + dataTestSubj?: string; }) => { return ( - - + + {prependLabel ? ( + {prependLabel} + } + > + + + ) : ( + + )} ); }; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx index 37ee50f527d43..61e6a4f992390 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx @@ -5,23 +5,26 @@ * 2.0. */ -import React, { useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; +import chroma from 'chroma-js'; import { i18n } from '@kbn/i18n'; -import { EuiFormRow, EuiColorPicker, EuiColorPickerProps, EuiToolTip, EuiIcon } from '@elastic/eui'; +import { + EuiFormRow, + EuiColorPicker, + EuiColorPickerProps, + EuiToolTip, + EuiIcon, + euiPaletteColorBlind, +} from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; -import { defaultAnnotationColor } from '@kbn/event-annotation-plugin/public'; import type { VisualizationDimensionEditorProps } from '../../types'; -import { State, XYDataLayerConfig } from '../types'; +import { State } from '../types'; import { FormatFactory } from '../../../common'; import { getSeriesColor } from '../state_helpers'; -import { - defaultReferenceLineColor, - getAccessorColorConfig, - getColorAssignments, -} from '../color_assignment'; +import { getAccessorColorConfig, getColorAssignments } from '../color_assignment'; import { getSortedAccessors } from '../to_expression'; import { TooltipWrapper } from '../../shared_components'; -import { isReferenceLayer, isAnnotationsLayer, getDataLayers } from '../visualization_helpers'; +import { getDataLayers, isDataLayer } from '../visualization_helpers'; const tooltipContent = { auto: i18n.translate('xpack.lens.configPanel.color.tooltip.auto', { @@ -47,6 +50,8 @@ export const ColorPicker = ({ disableHelpTooltip, disabled, setConfig, + showAlpha, + defaultColor, }: VisualizationDimensionEditorProps & { formatFactory: FormatFactory; paletteService: PaletteRegistry; @@ -54,6 +59,8 @@ export const ColorPicker = ({ disableHelpTooltip?: boolean; disabled?: boolean; setConfig: (config: { color?: string }) => void; + showAlpha?: boolean; + defaultColor?: string; }) => { const index = state.layers.findIndex((l) => l.layerId === layerId); const layer = state.layers[index]; @@ -61,35 +68,46 @@ export const ColorPicker = ({ const overwriteColor = getSeriesColor(layer, accessor); const currentColor = useMemo(() => { if (overwriteColor || !frame.activeData) return overwriteColor; - if (isReferenceLayer(layer)) { - return defaultReferenceLineColor; - } else if (isAnnotationsLayer(layer)) { - return defaultAnnotationColor; + if (defaultColor) { + return defaultColor; } + if (isDataLayer(layer)) { + const sortedAccessors: string[] = getSortedAccessors( + frame.datasourceLayers[layer.layerId] ?? layer.accessors, + layer + ); - const dataLayer: XYDataLayerConfig = layer; - const sortedAccessors: string[] = getSortedAccessors( - frame.datasourceLayers[layer.layerId] ?? layer.accessors, - layer - ); + const colorAssignments = getColorAssignments( + getDataLayers(state.layers), + { tables: frame.activeData }, + formatFactory + ); + const mappedAccessors = getAccessorColorConfig( + colorAssignments, + frame, + { + ...layer, + accessors: sortedAccessors.filter((sorted) => layer.accessors.includes(sorted)), + }, + paletteService + ); - const colorAssignments = getColorAssignments( - getDataLayers(state.layers), - { tables: frame.activeData }, - formatFactory - ); - const mappedAccessors = getAccessorColorConfig( - colorAssignments, - frame, - { - ...dataLayer, - accessors: sortedAccessors.filter((sorted) => dataLayer.accessors.includes(sorted)), - }, - paletteService - ); + return mappedAccessors.find((a) => a.columnId === accessor)?.color || null; + } + }, [ + overwriteColor, + frame, + paletteService, + state.layers, + accessor, + formatFactory, + layer, + defaultColor, + ]); - return mappedAccessors.find((a) => a.columnId === accessor)?.color || null; - }, [overwriteColor, frame, paletteService, state.layers, accessor, formatFactory, layer]); + useEffect(() => { + setColor(currentColor); + }, [currentColor]); const [color, setColor] = useState(currentColor); @@ -107,8 +125,11 @@ export const ColorPicker = ({ defaultMessage: 'Series color', }); + const currentColorAlpha = color ? chroma(color).alpha() : 1; + const colorPicker = ( chroma(c).alpha(currentColorAlpha).hex()) + } /> ); diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_panel.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_panel.tsx index d5a3e8ffd7a46..07c9675635a1f 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_panel.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_panel.tsx @@ -25,6 +25,7 @@ import { TextDecorationSetting, } from './shared/marker_decoration_settings'; import { LineStyleSettings } from './shared/line_style_settings'; +import { defaultReferenceLineColor } from '../color_assignment'; export const ReferenceLinePanel = ( props: VisualizationDimensionEditorProps & { @@ -88,6 +89,7 @@ export const ReferenceLinePanel = ( void; customIconSet?: IconSet; + defaultIcon?: string; }) => { const selectedIcon = customIconSet.find((option) => value === option.value) || - customIconSet.find((option) => option.value === 'empty')!; + customIconSet.find((option) => option.value === defaultIcon)!; return ( { onChange(selection[0].value!); }} diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx index b780737877388..a52f3130029fd 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx @@ -132,10 +132,12 @@ export const IconSelectSetting = ({ currentConfig, setConfig, customIconSet, + defaultIcon = 'empty', }: { currentConfig?: MarkerDecorationConfig; setConfig: (config: MarkerDecorationConfig) => void; customIconSet?: IconSet; + defaultIcon?: string; }) => { return ( { diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 9751c7185213e..d38264150cfa5 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -655,7 +655,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont }, async editDimensionLabel(label: string) { - await testSubjects.setValue('indexPattern-label-edit', label, { clearWithKeyboard: true }); + await testSubjects.setValue('column-label-edit', label, { clearWithKeyboard: true }); }, async editDimensionFormat(format: string) { const formatInput = await testSubjects.find('indexPattern-dimension-format'); From 185bb4ee2be361d1fdfbd512f378b268c5c0397d Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 2 May 2022 17:31:41 +0200 Subject: [PATCH 43/89] [Synthetics] Prevent duplicate requests on monitor management page (#130225) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../hooks/use_monitor_list.ts | 67 +++++++++++++++++++ .../monitor_list/monitor_list_container.tsx | 66 +++++------------- .../monitor_management/monitor_management.tsx | 35 ++++------ .../service_allowed_wrapper.tsx | 21 +++--- .../state/effects/monitor_management.ts | 4 +- 5 files changed, 110 insertions(+), 83 deletions(-) create mode 100644 x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_monitor_list.ts diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_monitor_list.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_monitor_list.ts new file mode 100644 index 0000000000000..e0899571f38b8 --- /dev/null +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/hooks/use_monitor_list.ts @@ -0,0 +1,67 @@ +/* + * Copyright 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, useReducer, Reducer } from 'react'; +import { useDispatch } from 'react-redux'; +import { useParams } from 'react-router-dom'; +import { getMonitors } from '../../../state/actions'; +import { ConfigKey } from '../../../../../common/constants/monitor_management'; +import { MonitorManagementListPageState } from '../monitor_list/monitor_list'; + +export function useMonitorList() { + const dispatch = useDispatch(); + + const [pageState, dispatchPageAction] = useReducer( + monitorManagementPageReducer, + { + pageIndex: 1, // saved objects page index is base 1 + pageSize: 10, + sortOrder: 'asc', + sortField: `${ConfigKey.NAME}.keyword`, + } + ); + + const { pageIndex, pageSize, sortField, sortOrder } = pageState as MonitorManagementListPageState; + + const { type: viewType } = useParams<{ type: 'all' | 'invalid' }>(); + + useEffect(() => { + if (viewType === 'all') { + dispatch(getMonitors({ page: pageIndex, perPage: pageSize, sortOrder, sortField })); + } + }, [dispatch, pageIndex, pageSize, sortField, sortOrder, viewType, pageState]); + + return { + pageState, + dispatchPageAction, + viewType, + }; +} + +export type MonitorManagementPageAction = + | { + type: 'update'; + payload: MonitorManagementListPageState; + } + | { type: 'refresh' }; + +const monitorManagementPageReducer: Reducer< + MonitorManagementListPageState, + MonitorManagementPageAction +> = (state: MonitorManagementListPageState, action: MonitorManagementPageAction) => { + switch (action.type) { + case 'update': + return { + ...state, + ...action.payload, + }; + case 'refresh': + return { ...state }; + default: + throw new Error(`Action "${(action as MonitorManagementPageAction)?.type}" not recognizable`); + } +}; diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx index 7191cd71b0a36..727f4f6dee72b 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list_container.tsx @@ -5,32 +5,29 @@ * 2.0. */ -import React, { useEffect, useReducer, useCallback, Reducer } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import React, { useCallback, Dispatch } from 'react'; +import { useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; import { useTrackPageview } from '@kbn/observability-plugin/public'; -import { ConfigKey } from '../../../../../common/runtime_types'; -import { getMonitors } from '../../../state/actions'; import { monitorManagementListSelector } from '../../../state/selectors'; -import { MonitorManagementListPageState } from './monitor_list'; import { MonitorAsyncError } from './monitor_async_error'; import { useInlineErrors } from '../hooks/use_inline_errors'; import { MonitorListTabs } from './list_tabs'; import { AllMonitors } from './all_monitors'; import { InvalidMonitors } from './invalid_monitors'; import { useInvalidMonitors } from '../hooks/use_invalid_monitors'; +import { MonitorManagementListPageState } from './monitor_list'; +import { MonitorManagementPageAction } from '../hooks/use_monitor_list'; -export const MonitorListContainer: React.FC = () => { - const [pageState, dispatchPageAction] = useReducer( - monitorManagementPageReducer, - { - pageIndex: 1, // saved objects page index is base 1 - pageSize: 10, - sortOrder: 'asc', - sortField: `${ConfigKey.NAME}.keyword`, - } - ); - +export const MonitorListContainer = ({ + isEnabled, + pageState, + dispatchPageAction, +}: { + isEnabled?: boolean; + pageState: MonitorManagementListPageState; + dispatchPageAction: Dispatch; +}) => { const onPageStateChange = useCallback( (state) => { dispatchPageAction({ type: 'update', payload: state }); @@ -45,11 +42,8 @@ export const MonitorListContainer: React.FC = () => { useTrackPageview({ app: 'uptime', path: 'manage-monitors' }); useTrackPageview({ app: 'uptime', path: 'manage-monitors', delay: 15000 }); - const dispatch = useDispatch(); const monitorList = useSelector(monitorManagementListSelector); - const { pageIndex, pageSize, sortField, sortOrder } = pageState as MonitorManagementListPageState; - const { type: viewType } = useParams<{ type: 'all' | 'invalid' }>(); const { errorSummaries, loading, count } = useInlineErrors({ onlyInvalidMonitors: viewType === 'invalid', @@ -57,14 +51,12 @@ export const MonitorListContainer: React.FC = () => { sortOrder: pageState.sortOrder, }); - useEffect(() => { - if (viewType === 'all') { - dispatch(getMonitors({ page: pageIndex, perPage: pageSize, sortField, sortOrder })); - } - }, [dispatch, pageState, pageIndex, pageSize, sortField, sortOrder, viewType]); - const { data: monitorSavedObjects, loading: objectsLoading } = useInvalidMonitors(errorSummaries); + if (!isEnabled && monitorList.list.total === 0) { + return null; + } + return ( <> @@ -95,27 +87,3 @@ export const MonitorListContainer: React.FC = () => { ); }; - -type MonitorManagementPageAction = - | { - type: 'update'; - payload: MonitorManagementListPageState; - } - | { type: 'refresh' }; - -const monitorManagementPageReducer: Reducer< - MonitorManagementListPageState, - MonitorManagementPageAction -> = (state: MonitorManagementListPageState, action: MonitorManagementPageAction) => { - switch (action.type) { - case 'update': - return { - ...state, - ...action.payload, - }; - case 'refresh': - return { ...state }; - default: - throw new Error(`Action "${(action as MonitorManagementPageAction)?.type}" not recognizable`); - } -}; diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx index 97013b9905187..ba243388c8a3b 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/monitor_management.tsx @@ -7,11 +7,9 @@ import React, { useEffect, useRef, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { useDispatch, useSelector } from 'react-redux'; +import { useSelector } from 'react-redux'; import { EuiCallOut, EuiButton, EuiSpacer, EuiLink } from '@elastic/eui'; import { useTrackPageview } from '@kbn/observability-plugin/public'; -import { ConfigKey } from '../../../../common/runtime_types'; -import { getMonitors } from '../../state/actions'; import { monitorManagementListSelector } from '../../state/selectors'; import { useMonitorManagementBreadcrumbs } from './use_monitor_management_breadcrumbs'; import { MonitorListContainer } from '../../components/monitor_management/monitor_list/monitor_list_container'; @@ -20,12 +18,12 @@ import { useEnablement } from '../../components/monitor_management/hooks/use_ena import { useLocations } from '../../components/monitor_management/hooks/use_locations'; import { Loader } from '../../components/monitor_management/loader/loader'; import { ERROR_HEADING_LABEL } from './content'; +import { useMonitorList } from '../../components/monitor_management/hooks/use_monitor_list'; export const MonitorManagementPage: React.FC = () => { useTrackPageview({ app: 'uptime', path: 'manage-monitors' }); useTrackPageview({ app: 'uptime', path: 'manage-monitors', delay: 15000 }); useMonitorManagementBreadcrumbs(); - const dispatch = useDispatch(); const [shouldFocusEnablementButton, setShouldFocusEnablementButton] = useState(false); const { @@ -40,19 +38,6 @@ export const MonitorManagementPage: React.FC = () => { const isEnabledRef = useRef(isEnabled); - useEffect(() => { - if (monitorList.total === null) { - dispatch( - getMonitors({ - page: 1, // saved objects page index is base 1 - perPage: 10, - sortOrder: 'asc', - sortField: `${ConfigKey.NAME}.keyword`, - }) - ); - } - }, [dispatch, monitorList.total]); - useEffect(() => { if (!isEnabled && isEnabledRef.current === true) { /* shift focus to enable button when enable toggle disappears. Prevent @@ -62,10 +47,14 @@ export const MonitorManagementPage: React.FC = () => { isEnabledRef.current = Boolean(isEnabled); }, [isEnabled]); + const { pageState, dispatchPageAction } = useMonitorList(); + + const showEmptyState = isEnabled !== undefined && monitorList.total === 0; + return ( <> { ) : null} - {isEnabled || (!isEnabled && monitorList.total) ? : null} + - {isEnabled !== undefined && monitorList.total === 0 && ( - - )} + {showEmptyState && } ); }; diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.tsx index cda0e8a6cdbe9..ff74fd97f0b34 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.tsx +++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/monitor_management/service_allowed_wrapper.tsx @@ -13,15 +13,6 @@ import { useSyntheticsServiceAllowed } from '../../components/monitor_management export const ServiceAllowedWrapper: React.FC = ({ children }) => { const { isAllowed, signupUrl, loading } = useSyntheticsServiceAllowed(); - if (loading) { - return ( - } - title={

{LOADING_MONITOR_MANAGEMENT_LABEL}

} - /> - ); - } - // checking for explicit false if (isAllowed === false) { return ( @@ -37,7 +28,17 @@ export const ServiceAllowedWrapper: React.FC = ({ children }) => { ); } - return <>{children}; + return ( + <> + {loading && ( + } + title={

{LOADING_MONITOR_MANAGEMENT_LABEL}

} + /> + )} +
{children}
+ + ); }; const REQUEST_ACCESS_LABEL = i18n.translate('xpack.synthetics.monitorManagement.requestAccess', { diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_management.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_management.ts index 60a6676721784..b5ee599b0a4f9 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_management.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/effects/monitor_management.ts @@ -35,7 +35,7 @@ import { import { fetchEffectFactory } from './fetch_effect'; export function* fetchMonitorManagementEffect() { - yield takeLatest( + yield takeLeading( getMonitors, fetchEffectFactory(fetchMonitorManagementList, getMonitorsSuccess, getMonitorsFailure) ); @@ -47,7 +47,7 @@ export function* fetchMonitorManagementEffect() { getServiceLocationsFailure ) ); - yield takeLatest( + yield takeLeading( getSyntheticsEnablement, fetchEffectFactory( fetchGetSyntheticsEnablement, From 2ef21c2d445d932f16e9fb9c9a7951853b2cf14d Mon Sep 17 00:00:00 2001 From: Paul Tavares <56442535+paul-tavares@users.noreply.github.com> Date: Mon, 2 May 2022 11:33:00 -0400 Subject: [PATCH 44/89] [Security Solution][Endpoint] Change Endpoint Dev data generator and data loaders so that `agent.id` and `elastic.agent.id` are identical (#131159) * Change generator to set `agent.id` and `elastic.agent.id` to the same value * Add `refresh: 'wait_for',` to all `es.index()` calls in the data loaders Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../index_endpoint_fleet_actions.ts | 7 ++ .../data_loaders/index_endpoint_hosts.ts | 6 ++ .../data_loaders/index_fleet_agent.ts | 2 + .../data_loaders/index_fleet_server.ts | 1 + .../common/endpoint/generate_data.ts | 5 +- .../endpoint_hosts/store/middleware.test.ts | 20 ++--- .../isometric_taxi_layout.test.ts.snap | 88 +++++++++---------- .../apps/endpoint/endpoint_list.ts | 18 ++-- 8 files changed, 82 insertions(+), 65 deletions(-) diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_fleet_actions.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_fleet_actions.ts index 369b1fff5fe39..04dce4e60a092 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_fleet_actions.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_fleet_actions.ts @@ -71,6 +71,7 @@ export const indexEndpointAndFleetActionsForHost = async ( { index: AGENT_ACTIONS_INDEX, body: action, + refresh: 'wait_for', }, ES_INDEX_OPTIONS ) @@ -98,6 +99,7 @@ export const indexEndpointAndFleetActionsForHost = async ( .index({ index: ENDPOINT_ACTIONS_INDEX, body: endpointActionsBody, + refresh: 'wait_for', }) .catch(wrapErrorAndRejectPromise), ]); @@ -125,6 +127,7 @@ export const indexEndpointAndFleetActionsForHost = async ( { index: AGENT_ACTIONS_RESULTS_INDEX, body: actionResponse, + refresh: 'wait_for', }, ES_INDEX_OPTIONS ) @@ -159,6 +162,7 @@ export const indexEndpointAndFleetActionsForHost = async ( .index({ index: ENDPOINT_ACTION_RESPONSES_INDEX, body: endpointActionResponseBody, + refresh: 'wait_for', }) .catch(wrapErrorAndRejectPromise), ]); @@ -197,6 +201,7 @@ export const indexEndpointAndFleetActionsForHost = async ( { index: AGENT_ACTIONS_INDEX, body: action, + refresh: 'wait_for', }, ES_INDEX_OPTIONS ) @@ -221,6 +226,7 @@ export const indexEndpointAndFleetActionsForHost = async ( { index: AGENT_ACTIONS_INDEX, body: action1, + refresh: 'wait_for', }, ES_INDEX_OPTIONS ) @@ -230,6 +236,7 @@ export const indexEndpointAndFleetActionsForHost = async ( { index: AGENT_ACTIONS_INDEX, body: action2, + refresh: 'wait_for', }, ES_INDEX_OPTIONS ) diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts index 2f304351dc435..30d75b30a11b6 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts @@ -165,6 +165,10 @@ export async function indexEndpointHostDocs({ // Update the Host metadata record with the ID of the "real" policy along with the enrolled agent id hostMetadata = { ...hostMetadata, + agent: { + ...hostMetadata.agent, + id: enrolledAgent?.id ?? hostMetadata.agent.id, + }, elastic: { ...hostMetadata.elastic, agent: { @@ -201,6 +205,7 @@ export async function indexEndpointHostDocs({ index: metadataIndex, body: hostMetadata, op_type: 'create', + refresh: 'wait_for', }) .catch(wrapErrorAndRejectPromise); @@ -214,6 +219,7 @@ export async function indexEndpointHostDocs({ index: policyResponseIndex, body: hostPolicyResponse, op_type: 'create', + refresh: 'wait_for', }) .catch(wrapErrorAndRejectPromise); diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_agent.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_agent.ts index 70b1e1c52a77b..b051eff37edc7 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_agent.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_agent.ts @@ -47,6 +47,7 @@ export const indexFleetAgentForHost = async ( fleetAgentGenerator: FleetAgentGenerator = defaultFleetAgentGenerator ): Promise => { const agentDoc = fleetAgentGenerator.generateEsHit({ + _id: endpointHost.agent.id, _source: { agent: { id: endpointHost.agent.id, @@ -75,6 +76,7 @@ export const indexFleetAgentForHost = async ( id: agentDoc._id, body: agentDoc._source, op_type: 'create', + refresh: 'wait_for', }) .catch(wrapErrorAndRejectPromise); diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_server.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_server.ts index c11c2025ee88e..8b8a15a1164e5 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_server.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_server.ts @@ -31,6 +31,7 @@ export const enableFleetServerIfNecessary = async (esClient: Client, version: st await esClient .index({ index: FLEET_SERVER_SERVERS_INDEX, + refresh: 'wait_for', body: { agent: { id: '12988155-475c-430d-ac89-84dc84b67cd1', diff --git a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts index a571c7848bdf3..5a6b20550f224 100644 --- a/x-pack/plugins/security_solution/common/endpoint/generate_data.ts +++ b/x-pack/plugins/security_solution/common/endpoint/generate_data.ts @@ -464,16 +464,17 @@ export class EndpointDocGenerator extends BaseDataGenerator { const agentVersion = this.randomVersion(); const minCapabilitiesVersion = '7.15.0'; const capabilities = ['isolation']; + const agentId = this.seededUUIDv4(); return { agent: { version: agentVersion, - id: this.seededUUIDv4(), + id: agentId, type: 'endpoint', }, elastic: { agent: { - id: this.seededUUIDv4(), + id: agentId, }, }, host: { diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts index 57cdaca1f2147..d8dc87885a1fa 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.test.ts @@ -424,16 +424,16 @@ describe('endpoint list middleware', () => { path: expect.any(String), query: { agent_ids: [ - '6db499e5-4927-4350-abb8-d8318e7d0eec', - 'c082dda9-1847-4997-8eda-f1192d95bec3', - '8aa1cd61-cc25-4783-afb5-0eefc4919c07', - '47fe24c1-7370-419a-9732-3ff38bf41272', - '0d2b2fa7-a9cd-49fc-ad5f-0252c642290e', - 'f480092d-0445-4bf3-9c96-8a3d5cb97824', - '3850e676-0940-4c4b-aaca-571bd1bc66d9', - '46efcc7a-086a-47a3-8f09-c4ecd6d2d917', - 'afa55826-b81b-4440-a2ac-0644d77a3fc6', - '25b49e50-cb5c-43df-824f-67b8cf697d9d', + '0dc3661d-6e67-46b0-af39-6f12b025fcb0', + 'a8e32a61-2685-47f0-83eb-edf157b8e616', + '37e219a8-fe16-4da9-bf34-634c5824b484', + '2484eb13-967e-4491-bf83-dffefdfe607c', + '0bc08ef6-6d6a-4113-92f2-b97811187c63', + 'f4127d87-b567-4a6e-afa6-9a1c7dc95f01', + 'f9ab5b8c-a43e-4e80-99d6-11570845a697', + '406c4b6a-ca57-4bd1-bc66-d9d999df3e70', + '2da1dd51-f7af-4f0e-b64c-e7751c74b0e7', + '89a94ea4-073c-4cb6-90a2-500805837027', ], }, }); diff --git a/x-pack/plugins/security_solution/public/resolver/models/indexed_process_tree/__snapshots__/isometric_taxi_layout.test.ts.snap b/x-pack/plugins/security_solution/public/resolver/models/indexed_process_tree/__snapshots__/isometric_taxi_layout.test.ts.snap index dca100efcc835..b033febcd1ac8 100644 --- a/x-pack/plugins/security_solution/public/resolver/models/indexed_process_tree/__snapshots__/isometric_taxi_layout.test.ts.snap +++ b/x-pack/plugins/security_solution/public/resolver/models/indexed_process_tree/__snapshots__/isometric_taxi_layout.test.ts.snap @@ -15,11 +15,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "A", - "process.name": "powershell.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "", }, "id": "A", - "name": "powershell.exe", + "name": "lsass.exe", "parent": undefined, "stats": Object { "byCategory": Object {}, @@ -33,11 +33,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "A", - "process.name": "powershell.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "", }, "id": "A", - "name": "powershell.exe", + "name": "lsass.exe", "parent": undefined, "stats": Object { "byCategory": Object {}, @@ -58,11 +58,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "A", - "process.name": "lsass.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "", }, "id": "A", - "name": "lsass.exe", + "name": "mimikatz.exe", "parent": undefined, "stats": Object { "byCategory": Object {}, @@ -73,11 +73,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "B", - "process.name": "powershell.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "A", }, "id": "B", - "name": "powershell.exe", + "name": "lsass.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -88,11 +88,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "C", - "process.name": "iexlorer.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "A", }, "id": "C", - "name": "iexlorer.exe", + "name": "lsass.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -103,11 +103,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "I", - "process.name": "explorer.exe", + "process.name": "notepad.exe", "process.parent.entity_id": "A", }, "id": "I", - "name": "explorer.exe", + "name": "notepad.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -118,11 +118,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "D", - "process.name": "mimikatz.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "B", }, "id": "D", - "name": "mimikatz.exe", + "name": "lsass.exe", "parent": "B", "stats": Object { "byCategory": Object {}, @@ -133,11 +133,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "E", - "process.name": "powershell.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "B", }, "id": "E", - "name": "powershell.exe", + "name": "mimikatz.exe", "parent": "B", "stats": Object { "byCategory": Object {}, @@ -148,11 +148,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "F", - "process.name": "explorer.exe", + "process.name": "powershell.exe", "process.parent.entity_id": "C", }, "id": "F", - "name": "explorer.exe", + "name": "powershell.exe", "parent": "C", "stats": Object { "byCategory": Object {}, @@ -178,11 +178,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "H", - "process.name": "lsass.exe", + "process.name": "notepad.exe", "process.parent.entity_id": "G", }, "id": "H", - "name": "lsass.exe", + "name": "notepad.exe", "parent": "G", "stats": Object { "byCategory": Object {}, @@ -439,11 +439,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "A", - "process.name": "lsass.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "", }, "id": "A", - "name": "lsass.exe", + "name": "mimikatz.exe", "parent": undefined, "stats": Object { "byCategory": Object {}, @@ -457,11 +457,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "B", - "process.name": "powershell.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "A", }, "id": "B", - "name": "powershell.exe", + "name": "lsass.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -475,11 +475,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "C", - "process.name": "iexlorer.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "A", }, "id": "C", - "name": "iexlorer.exe", + "name": "lsass.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -493,11 +493,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "I", - "process.name": "explorer.exe", + "process.name": "notepad.exe", "process.parent.entity_id": "A", }, "id": "I", - "name": "explorer.exe", + "name": "notepad.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -511,11 +511,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "D", - "process.name": "mimikatz.exe", + "process.name": "lsass.exe", "process.parent.entity_id": "B", }, "id": "D", - "name": "mimikatz.exe", + "name": "lsass.exe", "parent": "B", "stats": Object { "byCategory": Object {}, @@ -529,11 +529,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "E", - "process.name": "powershell.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "B", }, "id": "E", - "name": "powershell.exe", + "name": "mimikatz.exe", "parent": "B", "stats": Object { "byCategory": Object {}, @@ -547,11 +547,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "F", - "process.name": "explorer.exe", + "process.name": "powershell.exe", "process.parent.entity_id": "C", }, "id": "F", - "name": "explorer.exe", + "name": "powershell.exe", "parent": "C", "stats": Object { "byCategory": Object {}, @@ -583,11 +583,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "H", - "process.name": "lsass.exe", + "process.name": "notepad.exe", "process.parent.entity_id": "G", }, "id": "H", - "name": "lsass.exe", + "name": "notepad.exe", "parent": "G", "stats": Object { "byCategory": Object {}, @@ -608,11 +608,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "A", - "process.name": "explorer.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "", }, "id": "A", - "name": "explorer.exe", + "name": "mimikatz.exe", "parent": undefined, "stats": Object { "byCategory": Object {}, @@ -623,11 +623,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "B", - "process.name": "iexlorer.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "A", }, "id": "B", - "name": "iexlorer.exe", + "name": "mimikatz.exe", "parent": "A", "stats": Object { "byCategory": Object {}, @@ -661,11 +661,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "A", - "process.name": "explorer.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "", }, "id": "A", - "name": "explorer.exe", + "name": "mimikatz.exe", "parent": undefined, "stats": Object { "byCategory": Object {}, @@ -679,11 +679,11 @@ Object { "data": Object { "@timestamp": 1606234833273, "process.entity_id": "B", - "process.name": "iexlorer.exe", + "process.name": "mimikatz.exe", "process.parent.entity_id": "A", }, "id": "B", - "name": "iexlorer.exe", + "name": "mimikatz.exe", "parent": "A", "stats": Object { "byCategory": Object {}, diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts index 368783b0efd1c..48dc450737229 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts @@ -34,29 +34,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'Last active', 'Actions', ], - ['Host-9fafsc3tqe', 'x', 'x', 'Warning', 'Windows', '10.231.117.28', '7.17.12', 'x', ''], [ 'Host-ku5jy6j0pw', 'x', 'x', - 'Warning', + 'Unsupported', 'Windows', - '10.246.87.11, 10.145.117.106,10.109.242.136', + '10.12.215.130, 10.130.188.228,10.19.102.141', '7.0.13', 'x', '', ], [ - 'Host-o07wj6uaa5', + 'Host-ntr4rkj24m', 'x', 'x', - 'Failure', + 'Success', 'Windows', - '10.82.134.220, 10.47.25.170', - '7.11.13', + '10.36.46.252, 10.222.152.110', + '7.4.13', 'x', '', ], + ['Host-q9qenwrl9k', 'x', 'x', 'Warning', 'Windows', '10.206.226.90', '7.11.10', 'x', ''], ]; const formattedTableData = async () => { @@ -209,9 +209,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'Host-ku5jy6j0pw', 'x', 'x', - 'Warning', + 'Unsupported', 'Windows', - '10.246.87.11, 10.145.117.106,10.109.242.136', + '10.12.215.130, 10.130.188.228,10.19.102.141', '7.0.13', 'x', '', From 27d1fa1797b21a975173e89e9d65a2d029b64304 Mon Sep 17 00:00:00 2001 From: Corey Robertson Date: Mon, 2 May 2022 11:36:40 -0400 Subject: [PATCH 45/89] Replace history-extra in place of standard url routing (#121440) * Replace history-extra in place of standard url routing * Fix smoke test * Fix smoke test again * Handle embeddalbe save + return * Update StoryShot --- package.json | 1 - .../renderers/embeddable/embeddable.tsx | 31 +++++++--- .../canvas/public/components/app/index.tsx | 59 ++----------------- .../canvas/public/components/home/home.tsx | 8 --- .../workpad_table.stories.storyshot | 3 + .../public/components/home_app/home_app.tsx | 6 +- .../components/routing/routing_link.tsx | 56 +++++++++++++++++- .../editor_menu/editor_menu.tsx | 6 +- .../plugins/canvas/public/lib/breadcrumbs.ts | 43 ++++++++++++-- x-pack/plugins/canvas/public/routes/index.tsx | 43 ++++++++++++-- .../workpad/workpad_presentation_helper.tsx | 8 ++- .../canvas/public/services/kibana/nav_link.ts | 2 +- .../feature_controls/canvas_security.ts | 4 +- .../canvas/feature_controls/canvas_spaces.ts | 2 +- .../test/functional/apps/canvas/smoke_test.js | 6 +- yarn.lock | 5 -- 16 files changed, 179 insertions(+), 104 deletions(-) diff --git a/package.json b/package.json index 43ab61feba638..1b785b1fcaaab 100644 --- a/package.json +++ b/package.json @@ -271,7 +271,6 @@ "handlebars": "4.7.7", "he": "^1.2.0", "history": "^4.9.0", - "history-extra": "^5.0.1", "hjson": "3.2.1", "http-proxy-agent": "^2.1.0", "https-proxy-agent": "^5.0.0", diff --git a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx index 8add1aa41b83e..dc164f862aa51 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import React from 'react'; +import React, { FC } from 'react'; +import useObservable from 'react-use/lib/useObservable'; import ReactDOM from 'react-dom'; import { CoreStart } from '@kbn/core/public'; import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; @@ -32,9 +33,28 @@ const embeddablesRegistry: { const renderEmbeddableFactory = (core: CoreStart, plugins: StartDeps) => { const I18nContext = core.i18n.Context; + const EmbeddableRenderer: FC<{ embeddable: IEmbeddable }> = ({ embeddable }) => { + const currentAppId = useObservable(core.application.currentAppId$, undefined); - const embeddableContainerContext: EmbeddableContainerContext = { - getCurrentPath: () => window.location.hash, + if (!currentAppId) { + return null; + } + + const embeddableContainerContext: EmbeddableContainerContext = { + getCurrentPath: () => { + const urlToApp = core.application.getUrlForApp(currentAppId); + const inAppPath = window.location.pathname.replace(urlToApp, ''); + + return inAppPath + window.location.search + window.location.hash; + }, + }; + + return ( + + ); }; return (embeddableObject: IEmbeddable) => { @@ -45,10 +65,7 @@ const renderEmbeddableFactory = (core: CoreStart, plugins: StartDeps) => { > - +
diff --git a/x-pack/plugins/canvas/public/components/app/index.tsx b/x-pack/plugins/canvas/public/components/app/index.tsx index d9a8b5fa54695..82404f651ec31 100644 --- a/x-pack/plugins/canvas/public/components/app/index.tsx +++ b/x-pack/plugins/canvas/public/components/app/index.tsx @@ -5,14 +5,9 @@ * 2.0. */ -import React, { FC, useRef, useEffect } from 'react'; -import { Observable } from 'rxjs'; +import React, { FC, useEffect } from 'react'; import PropTypes from 'prop-types'; -import { History } from 'history'; -// @ts-expect-error -import createHashStateHistory from 'history-extra/dist/createHashStateHistory'; import { ScopedHistory } from '@kbn/core/public'; -import { skipWhile, timeout, take } from 'rxjs/operators'; import { useNavLinkService } from '../../services'; // @ts-expect-error import { shortcutManager } from '../../lib/shortcut_manager'; @@ -33,64 +28,18 @@ class ShortcutManagerContextWrapper extends React.Component { } export const App: FC<{ history: ScopedHistory }> = ({ history }) => { - const historyRef = useRef(createHashStateHistory() as History); const { updatePath } = useNavLinkService(); useEffect(() => { - return historyRef.current.listen(({ pathname }) => { - updatePath(pathname); + return history.listen(({ pathname, search }) => { + updatePath(pathname + search); }); }); - useEffect(() => { - return history.listen(({ pathname, hash }) => { - // The scoped history could have something that triggers a url change, and that change is not seen by - // our hash router. For example, a scopedHistory.replace() as done as part of the saved object resolve - // alias match flow will do the replace on the scopedHistory, and our app doesn't react appropriately - - // So, to work around this, whenever we see a url on the scoped history, we're going to wait a beat and see - // if it shows up in our hash router. If it doesn't, then we're going to force it onto our hash router - - // I don't like this at all, and to overcome this we should switch away from hash router sooner rather than later - // and just use scopedHistory as our history object - const expectedPath = hash.substr(1); - const action = history.action; - - // Observable of all the path - const hashPaths$ = new Observable((subscriber) => { - subscriber.next(historyRef.current.location.pathname); - - const unsubscribeHashListener = historyRef.current.listen(({ pathname: newPath }) => { - subscriber.next(newPath); - }); - - return unsubscribeHashListener; - }); - - const subscription = hashPaths$ - .pipe( - skipWhile((value) => value !== expectedPath), - timeout(100), - take(1) - ) - .subscribe({ - error: (e) => { - if (action === 'REPLACE') { - historyRef.current.replace(expectedPath); - } else { - historyRef.current.push(expectedPath); - } - }, - }); - - window.setTimeout(() => subscription.unsubscribe(), 150); - }); - }, [history, historyRef]); - return (
- +
); diff --git a/x-pack/plugins/canvas/public/components/home/home.tsx b/x-pack/plugins/canvas/public/components/home/home.tsx index 6b356ada8681e..98dc99d6caaab 100644 --- a/x-pack/plugins/canvas/public/components/home/home.tsx +++ b/x-pack/plugins/canvas/public/components/home/home.tsx @@ -7,14 +7,10 @@ import React, { useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; - -import { getBaseBreadcrumb } from '../../lib/breadcrumbs'; import { resetWorkpad } from '../../state/actions/workpad'; import { Home as Component } from './home.component'; -import { usePlatformService } from '../../services'; export const Home = () => { - const { setBreadcrumbs } = usePlatformService(); const [isMounted, setIsMounted] = useState(false); const dispatch = useDispatch(); @@ -25,9 +21,5 @@ export const Home = () => { } }, [dispatch, isMounted, setIsMounted]); - useEffect(() => { - setBreadcrumbs([getBaseBreadcrumb()]); - }, [setBreadcrumbs]); - return ; }; diff --git a/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/workpad_table.stories.storyshot b/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/workpad_table.stories.storyshot index 7536cc7acf7dd..d2e52dde1ad5c 100644 --- a/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/workpad_table.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/home/my_workpads/__snapshots__/workpad_table.stories.storyshot @@ -382,6 +382,7 @@ exports[`Storyshots Home/Components/Workpad Table Workpad Table 1`] = ` className="euiLink euiLink--primary" data-test-subj="canvasWorkpadTableWorkpad" href="/workpad/workpad-2" + onClick={[Function]} rel="noreferrer" > @@ -558,6 +559,7 @@ exports[`Storyshots Home/Components/Workpad Table Workpad Table 1`] = ` className="euiLink euiLink--primary" data-test-subj="canvasWorkpadTableWorkpad" href="/workpad/workpad-1" + onClick={[Function]} rel="noreferrer" > @@ -734,6 +736,7 @@ exports[`Storyshots Home/Components/Workpad Table Workpad Table 1`] = ` className="euiLink euiLink--primary" data-test-subj="canvasWorkpadTableWorkpad" href="/workpad/workpad-0" + onClick={[Function]} rel="noreferrer" > diff --git a/x-pack/plugins/canvas/public/components/home_app/home_app.tsx b/x-pack/plugins/canvas/public/components/home_app/home_app.tsx index b288612450bf7..086a737d525e9 100644 --- a/x-pack/plugins/canvas/public/components/home_app/home_app.tsx +++ b/x-pack/plugins/canvas/public/components/home_app/home_app.tsx @@ -6,6 +6,7 @@ */ import React, { useEffect } from 'react'; +import { useHistory } from 'react-router-dom'; import { useDispatch } from 'react-redux'; import { getBaseBreadcrumb } from '../../lib/breadcrumbs'; import { resetWorkpad } from '../../state/actions/workpad'; @@ -16,10 +17,11 @@ export const HomeApp = () => { const { setBreadcrumbs } = usePlatformService(); const dispatch = useDispatch(); const onLoad = () => dispatch(resetWorkpad()); + const history = useHistory(); useEffect(() => { - setBreadcrumbs([getBaseBreadcrumb()]); - }, [setBreadcrumbs]); + setBreadcrumbs([getBaseBreadcrumb(history)]); + }, [setBreadcrumbs, history]); return ; }; diff --git a/x-pack/plugins/canvas/public/components/routing/routing_link.tsx b/x-pack/plugins/canvas/public/components/routing/routing_link.tsx index bb3123de3fec8..5f82b5050a172 100644 --- a/x-pack/plugins/canvas/public/components/routing/routing_link.tsx +++ b/x-pack/plugins/canvas/public/components/routing/routing_link.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { FC } from 'react'; +import React, { FC, useCallback, MouseEvent } from 'react'; import { EuiLink, EuiLinkProps, EuiButtonIcon, EuiButtonIconProps } from '@elastic/eui'; import { useHistory } from 'react-router-dom'; @@ -15,13 +15,43 @@ interface RoutingProps { type RoutingLinkProps = Omit & RoutingProps; +const isModifiedEvent = (event: MouseEvent) => + !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); + +const isLeftClickEvent = (event: MouseEvent) => event.button === 0; + +const isTargetBlank = (event: MouseEvent) => { + const target = (event.target as HTMLElement).getAttribute('target'); + return target && target !== '_self'; +}; + export const RoutingLink: FC = ({ to, ...rest }) => { const history = useHistory(); + const onClick = useCallback( + (event: MouseEvent) => { + if (event.defaultPrevented) { + return; + } + + // Let the browser handle links that open new tabs/windows + if (isModifiedEvent(event) || !isLeftClickEvent(event) || isTargetBlank(event)) { + return; + } + + // Prevent regular link behavior, which causes a browser refresh. + event.preventDefault(); + + // Push the route to the history. + history.push(to); + }, + [history, to] + ); + // Generate the correct link href (with basename accounted for) const href = history.createHref({ pathname: to }); - const props = { ...rest, href } as EuiLinkProps; + const props = { ...rest, href, onClick } as EuiLinkProps; return ; }; @@ -31,10 +61,30 @@ type RoutingButtonIconProps = Omit & Rou export const RoutingButtonIcon: FC = ({ to, ...rest }) => { const history = useHistory(); + const onClick = useCallback( + (event: MouseEvent) => { + if (event.defaultPrevented) { + return; + } + + // Let the browser handle links that open new tabs/windows + if (isModifiedEvent(event) || !isLeftClickEvent(event) || isTargetBlank(event)) { + return; + } + + // Prevent regular link behavior, which causes a browser refresh. + event.preventDefault(); + + // Push the route to the history. + history.push(to); + }, + [history, to] + ); + // Generate the correct link href (with basename accounted for) const href = history.createHref({ pathname: to }); - const props = { ...rest, href } as EuiButtonIconProps; + const props = { ...rest, href, onClick } as EuiButtonIconProps; return ; }; diff --git a/x-pack/plugins/canvas/public/components/workpad_header/editor_menu/editor_menu.tsx b/x-pack/plugins/canvas/public/components/workpad_header/editor_menu/editor_menu.tsx index c02ac90f8066c..8c10efe1b10d9 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/editor_menu/editor_menu.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_header/editor_menu/editor_menu.tsx @@ -29,7 +29,7 @@ interface Props { export const EditorMenu: FC = ({ addElement }) => { const embeddablesService = useEmbeddablesService(); - const { pathname, search } = useLocation(); + const { pathname, search, hash } = useLocation(); const platformService = usePlatformService(); const stateTransferService = embeddablesService.getStateTransfer(); const visualizationsService = useVisualizationsService(); @@ -61,11 +61,11 @@ export const EditorMenu: FC = ({ addElement }) => { path, state: { originatingApp: CANVAS_APP, - originatingPath: `#/${pathname}${search}`, + originatingPath: `${pathname}${search}${hash}`, }, }); }, - [stateTransferService, pathname, search] + [stateTransferService, pathname, search, hash] ); const createNewEmbeddable = useCallback( diff --git a/x-pack/plugins/canvas/public/lib/breadcrumbs.ts b/x-pack/plugins/canvas/public/lib/breadcrumbs.ts index 02036be10322d..53f0fbbfa3346 100644 --- a/x-pack/plugins/canvas/public/lib/breadcrumbs.ts +++ b/x-pack/plugins/canvas/public/lib/breadcrumbs.ts @@ -5,12 +5,47 @@ * 2.0. */ +import { MouseEvent } from 'react'; +import { History } from 'history'; import { ChromeBreadcrumb } from '@kbn/core/public'; -export const getBaseBreadcrumb = (): ChromeBreadcrumb => ({ - text: 'Canvas', - href: '#/', -}); +const isModifiedEvent = (event: MouseEvent) => + !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); + +const isLeftClickEvent = (event: MouseEvent) => event.button === 0; + +const isTargetBlank = (event: MouseEvent) => { + const target = (event.target as HTMLElement).getAttribute('target'); + return target && target !== '_self'; +}; + +export const getBaseBreadcrumb = (history: History): ChromeBreadcrumb => { + const path = '/'; + const href = history.createHref({ pathname: path }); + + const onClick = (event: MouseEvent) => { + if (event.defaultPrevented) { + return; + } + + // Let the browser handle links that open new tabs/windows + if (isModifiedEvent(event) || !isLeftClickEvent(event) || isTargetBlank(event)) { + return; + } + + // Prevent regular link behavior, which causes a browser refresh. + event.preventDefault(); + + // Push the route to the history. + history.push(path); + }; + + return { + text: 'Canvas', + href, + onClick, + }; +}; export const getWorkpadBreadcrumb = ({ name = 'Workpad', diff --git a/x-pack/plugins/canvas/public/routes/index.tsx b/x-pack/plugins/canvas/public/routes/index.tsx index fd09aeae3fa9a..e7e9cd6541a3d 100644 --- a/x-pack/plugins/canvas/public/routes/index.tsx +++ b/x-pack/plugins/canvas/public/routes/index.tsx @@ -6,17 +6,48 @@ */ import React, { FC } from 'react'; -import { Router, Switch } from 'react-router-dom'; +import { Router, Switch, Route, RouteComponentProps, Redirect } from 'react-router-dom'; import { History } from 'history'; +import { parse, stringify } from 'query-string'; import { HomeRoute } from './home'; import { WorkpadRoute, ExportWorkpadRoute } from './workpad'; +const isHashPath = (hash: string) => { + return hash.indexOf('#/') === 0; +}; + +const mergeQueryStrings = (query: string, queryFromHash: string) => { + const queryObject = parse(query); + const hashObject = parse(queryFromHash); + + return stringify({ ...queryObject, ...hashObject }); +}; + export const CanvasRouter: FC<{ history: History }> = ({ history }) => ( - - {ExportWorkpadRoute()} - {WorkpadRoute()} - {HomeRoute()} - + { + // If it looks like the hash is a route then we will do a redirect + if (isHashPath(route.location.hash)) { + const [hashPath, hashQuery] = route.location.hash.split('?'); + let search = route.location.search || '?'; + + if (hashQuery !== undefined) { + search = mergeQueryStrings(search, `?${hashQuery}`); + } + + return 1 ? `?${search}` : ''}`} />; + } + + return ( + + {ExportWorkpadRoute()} + {WorkpadRoute()} + {HomeRoute()} + + ); + }} + /> ); diff --git a/x-pack/plugins/canvas/public/routes/workpad/workpad_presentation_helper.tsx b/x-pack/plugins/canvas/public/routes/workpad/workpad_presentation_helper.tsx index 084c9d8c76b00..d6c4b1c6277f5 100644 --- a/x-pack/plugins/canvas/public/routes/workpad/workpad_presentation_helper.tsx +++ b/x-pack/plugins/canvas/public/routes/workpad/workpad_presentation_helper.tsx @@ -7,6 +7,7 @@ import { i18n } from '@kbn/i18n'; import React, { FC, useEffect } from 'react'; import { useSelector } from 'react-redux'; +import { useHistory } from 'react-router-dom'; import { getBaseBreadcrumb, getWorkpadBreadcrumb } from '../../lib/breadcrumbs'; // @ts-expect-error import { setDocTitle } from '../../lib/doc_title'; @@ -27,13 +28,14 @@ export const WorkpadPresentationHelper: FC = ({ children }) => { useFullscreenPresentationHelper(); useAutoplayHelper(); useRefreshHelper(); + const history = useHistory(); useEffect(() => { platformService.setBreadcrumbs([ - getBaseBreadcrumb(), + getBaseBreadcrumb(history), getWorkpadBreadcrumb({ name: workpad.name }), ]); - }, [workpad.name, workpad.id, platformService]); + }, [workpad.name, workpad.id, platformService, history]); useEffect(() => { setDocTitle(workpad.name); @@ -44,7 +46,7 @@ export const WorkpadPresentationHelper: FC = ({ children }) => { objectNoun: getWorkpadLabel(), currentObjectId: workpad.id, otherObjectId: workpad.aliasId, - otherObjectPath: `#/workpad/${workpad.aliasId}`, + otherObjectPath: `/workpad/${workpad.aliasId}`, }) : null; diff --git a/x-pack/plugins/canvas/public/services/kibana/nav_link.ts b/x-pack/plugins/canvas/public/services/kibana/nav_link.ts index cf68b69155ad7..8470c688f5b2b 100644 --- a/x-pack/plugins/canvas/public/services/kibana/nav_link.ts +++ b/x-pack/plugins/canvas/public/services/kibana/nav_link.ts @@ -20,7 +20,7 @@ export type CanvasNavLinkServiceFactory = KibanaPluginServiceFactory< export const navLinkServiceFactory: CanvasNavLinkServiceFactory = ({ coreStart, appUpdater }) => ({ updatePath: (path: string) => { appUpdater?.next(() => ({ - defaultPath: `#${path}`, + defaultPath: `${path}`, })); getSessionStorage().set(`${SESSIONSTORAGE_LASTPATH}:${coreStart.http.basePath.get()}`, path); diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts index 1497c85b91bad..d1a500be98ff8 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts @@ -94,7 +94,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it(`allows a workpad to be edited`, async () => { await PageObjects.common.navigateToActualUrl( 'canvas', - 'workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31', + '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31', { ensureCurrentUrl: true, shouldLoginIfPrompted: false, @@ -171,7 +171,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it(`does not allow a workpad to be edited`, async () => { await PageObjects.common.navigateToActualUrl( 'canvas', - 'workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31', + '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31', { ensureCurrentUrl: true, shouldLoginIfPrompted: false, diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts index 5060ac60eceae..e030cdbf5f624 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts @@ -80,7 +80,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it(`allows a workpad to be edited`, async () => { await PageObjects.common.navigateToActualUrl( 'canvas', - 'workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31', + '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31', { ensureCurrentUrl: true, shouldLoginIfPrompted: false, diff --git a/x-pack/test/functional/apps/canvas/smoke_test.js b/x-pack/test/functional/apps/canvas/smoke_test.js index 053c58e88cde1..dff3cb7ce30a6 100644 --- a/x-pack/test/functional/apps/canvas/smoke_test.js +++ b/x-pack/test/functional/apps/canvas/smoke_test.js @@ -48,9 +48,9 @@ export default function canvasSmokeTest({ getService, getPageObjects }) { await retry.try(async () => { const url = await browser.getCurrentUrl(); - // remove all the search params, just compare the route - const hashRoute = new URL(url).hash.split('?')[0]; - expect(hashRoute).to.equal(`#/workpad/${testWorkpadId}/page/1`); + const path = new URL(url).pathname; + + expect(path).to.equal(`/app/canvas/workpad/${testWorkpadId}/page/1`); }); }); diff --git a/yarn.lock b/yarn.lock index afc8afb39df49..4ab577b3807dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16133,11 +16133,6 @@ highlight.js@^10.1.1, highlight.js@^10.4.1, highlight.js@~10.4.0: resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.4.1.tgz#d48fbcf4a9971c4361b3f95f302747afe19dbad0" integrity sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg== -history-extra@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/history-extra/-/history-extra-5.0.1.tgz#95a2e59dda526c4241d0ae1b124a77a5e4675ce8" - integrity sha512-6XV1L1lHgporVWgppa/Kq+Fnz4lhBew7iMxYCTfzVmoEywsAKJnTjdw1zOd+EGLHGYp0/V8jSVMEgqx4QbHLTw== - history@^4.9.0: version "4.9.0" resolved "https://registry.yarnpkg.com/history/-/history-4.9.0.tgz#84587c2068039ead8af769e9d6a6860a14fa1bca" From 264c310503e50896d8e1e7d62f835d61a3ef6bd9 Mon Sep 17 00:00:00 2001 From: Beth Richardson <83967298+elastichelix@users.noreply.github.com> Date: Mon, 2 May 2022 11:11:46 -0500 Subject: [PATCH 46/89] Add owner to hello_world plugin tutorial manifest (#131263) * Fix link to developer examples in dev env setup guide --- dev_docs/getting_started/hello_world_plugin.mdx | 5 +++++ dev_docs/getting_started/setting_up_a_development_env.mdx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dev_docs/getting_started/hello_world_plugin.mdx b/dev_docs/getting_started/hello_world_plugin.mdx index be4fcf5671a42..8fa4ea4316129 100644 --- a/dev_docs/getting_started/hello_world_plugin.mdx +++ b/dev_docs/getting_started/hello_world_plugin.mdx @@ -40,6 +40,10 @@ and add the following: "id": "helloWorld", "version": "1.0.0", "kibanaVersion": "kibana", + "owner": { + "name": "Kibana Core", + "githubTeam": "kibana-core" + }, "ui": true } ``` @@ -77,6 +81,7 @@ And add the following to it: ``` $ mkdir public +$ cd public $ touch plugin.tsx ``` diff --git a/dev_docs/getting_started/setting_up_a_development_env.mdx b/dev_docs/getting_started/setting_up_a_development_env.mdx index ae994d6a018de..570dcb57a56b8 100644 --- a/dev_docs/getting_started/setting_up_a_development_env.mdx +++ b/dev_docs/getting_started/setting_up_a_development_env.mdx @@ -72,7 +72,7 @@ In another terminal tab/window you can start Kibana. yarn start ``` -If you include the `--run-examples` flag then all of the [developer examples](https://github.com/elastic/kibana/tree/{branch}/examples). Read more about the advanced options for [Running Kibana](https://www.elastic.co/guide/en/kibana/current/running-kibana-advanced.html). +Include developer examples](https://github.com/elastic/kibana/tree/main/examples) by adding an optional `--run-examples` flag. Read more about the advanced options for [Running Kibana](https://www.elastic.co/guide/en/kibana/current/running-kibana-advanced.html). ## Code away! From 223b49d9af93899423e48177b63ac8d9ebcdac47 Mon Sep 17 00:00:00 2001 From: Jordan <51442161+JordanSh@users.noreply.github.com> Date: Mon, 2 May 2022 19:29:18 +0300 Subject: [PATCH 47/89] flag enabled (#131336) --- x-pack/plugins/cloud_security_posture/common/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/cloud_security_posture/common/constants.ts b/x-pack/plugins/cloud_security_posture/common/constants.ts index a351e6f271c71..1d35d6439bead 100644 --- a/x-pack/plugins/cloud_security_posture/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/common/constants.ts @@ -28,7 +28,7 @@ export const RULE_FAILED = `failed`; // A mapping of in-development features to their status. These features should be hidden from users but can be easily // activated via a simple code change in a single location. export const INTERNAL_FEATURE_FLAGS = { - showBenchmarks: false, + showBenchmarks: true, showManageRulesMock: false, showRisksMock: false, showFindingsGroupBy: false, From 848e020e82b1ee498d45f298e7a576f2576100b9 Mon Sep 17 00:00:00 2001 From: Jordan <51442161+JordanSh@users.noreply.github.com> Date: Mon, 2 May 2022 19:43:11 +0300 Subject: [PATCH 48/89] [Cloud Posture] General and Remediation tabs updates (#131294) --- .../findings_flyout/findings_flyout.tsx | 71 ++++++++++--------- .../pages/findings/findings_table.test.tsx | 9 +++ .../public/pages/findings/translations.ts | 15 ++++ .../public/pages/findings/types.ts | 11 ++- 4 files changed, 68 insertions(+), 38 deletions(-) diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_flyout/findings_flyout.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_flyout/findings_flyout.tsx index f475c9fa5fcb4..be05e2b8418d6 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_flyout/findings_flyout.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_flyout/findings_flyout.tsx @@ -15,7 +15,6 @@ import { EuiFlyoutHeader, EuiTitle, EuiFlyoutBody, - EuiBadge, EuiTabs, EuiTab, EuiFlexGrid, @@ -23,8 +22,10 @@ import { EuiFlexGroup, EuiIcon, type PropsOf, + EuiMarkdownFormat, } from '@elastic/eui'; import { assertNever } from '@kbn/std'; +import moment from 'moment'; import type { CspFinding } from '../types'; import { CspEvaluationBadge } from '../../../components/csp_evaluation_badge'; import * as TEXT from '../translations'; @@ -33,10 +34,19 @@ import k8sLogoIcon from '../../../assets/icons/k8s_logo.svg'; import { ResourceTab } from './resource_tab'; import { JsonTab } from './json_tab'; -const tabs = ['remediation', 'resource', 'general', 'json'] as const; +const tabs = [ + { title: TEXT.REMEDIATION, id: 'remediation' }, + { title: TEXT.RESOURCE, id: 'resource' }, + { title: TEXT.GENERAL, id: 'general' }, + { title: TEXT.JSON, id: 'json' }, +] as const; const CodeBlock: React.FC> = (props) => ( - + +); + +const Markdown: React.FC> = (props) => ( + ); type FindingsTab = typeof tabs[number]; @@ -74,7 +84,7 @@ const Cards = ({ data }: { data: Card[] }) => ( ); const FindingsTab = ({ tab, findings }: { findings: CspFinding; tab: FindingsTab }) => { - switch (tab) { + switch (tab.id) { case 'remediation': return ; case 'resource': @@ -89,7 +99,7 @@ const FindingsTab = ({ tab, findings }: { findings: CspFinding; tab: FindingsTab }; export const FindingsRuleFlyout = ({ onClose, findings }: FindingFlyoutProps) => { - const [tab, setTab] = useState('remediation'); + const [tab, setTab] = useState(tabs[0]); return ( @@ -109,13 +119,8 @@ export const FindingsRuleFlyout = ({ onClose, findings }: FindingFlyoutProps) => {tabs.map((v) => ( - setTab(v)} - style={{ textTransform: 'capitalize' }} - > - {v} + setTab(v)}> + {v.title} ))} @@ -127,13 +132,11 @@ export const FindingsRuleFlyout = ({ onClose, findings }: FindingFlyoutProps) => ); }; -const getGeneralCards = ({ rule }: CspFinding): Card[] => [ +const getGeneralCards = ({ rule, ...rest }: CspFinding): Card[] => [ { title: TEXT.RULE, listItems: [ - [TEXT.SEVERITY, ''], - [TEXT.INDEX, ''], - [TEXT.RULE_EVALUATED_AT, ''], + [TEXT.RULE_EVALUATED_AT, moment(rest['@timestamp']).format('MMMM D, YYYY @ HH:mm:ss.SSS')], [ TEXT.FRAMEWORK_SOURCES, @@ -145,40 +148,38 @@ const getGeneralCards = ({ rule }: CspFinding): Card[] => [
, ], - [TEXT.SECTION, ''], - [TEXT.PROFILE_APPLICABILITY, ''], - [TEXT.AUDIT, ''], + [TEXT.CIS_SECTION, rule.section], + [TEXT.PROFILE_APPLICABILITY, {rule.profile_applicability}], [TEXT.BENCHMARK, rule.benchmark.name], [TEXT.NAME, rule.name], - [TEXT.DESCRIPTION, rule.description], - [ - TEXT.TAGS, - rule.tags.map((t) => ( - - {t} - - )), - ], + [TEXT.DESCRIPTION, {rule.description}], + [TEXT.AUDIT, {rule.audit}], + [TEXT.REFERENCES, {rule.references}], ], }, ]; -const getRemediationCards = ({ result, ...rest }: CspFinding): Card[] => [ +const getRemediationCards = ({ result, rule, ...rest }: CspFinding): Card[] => [ { title: TEXT.RESULT_DETAILS, listItems: [ - [TEXT.EXPECTED, ''], + result.expected + ? [TEXT.EXPECTED, {JSON.stringify(result.expected, null, 2)}] + : ['', ''], [TEXT.EVIDENCE, {JSON.stringify(result.evidence, null, 2)}], - [TEXT.TIMESTAMP, {rest['@timestamp']}], + [ + TEXT.RULE_EVALUATED_AT, + {moment(rest['@timestamp']).format('MMMM D, YYYY @ HH:mm:ss.SSS')}, + ], ], }, { title: TEXT.REMEDIATION, listItems: [ - ['', {rest.rule.remediation}], - [TEXT.IMPACT, rest.rule.impact], - [TEXT.DEFAULT_VALUE, ''], - [TEXT.RATIONALE, ''], + ['', {rule.remediation}], + [TEXT.IMPACT, {rule.impact}], + [TEXT.DEFAULT_VALUE, {rule.default_value}], + [TEXT.RATIONALE, {rule.rationale}], ], }, ]; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.test.tsx b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.test.tsx index 28d14b42ae099..b287a73469d51 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.test.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/findings_table.test.tsx @@ -17,6 +17,9 @@ const chance = new Chance(); const getFakeFindings = (name: string): CspFinding & { id: string } => ({ id: chance.word(), result: { + expected: { + source: {}, + }, evaluation: chance.weighted(['passed', 'failed'], [0.5, 0.5]), evidence: { filemode: chance.word(), @@ -31,6 +34,12 @@ const getFakeFindings = (name: string): CspFinding & { id: string } => ({ name: 'CIS Kubernetes', version: '1.6.0', }, + section: chance.sentence(), + audit: chance.paragraph(), + references: chance.paragraph(), + profile_applicability: chance.sentence(), + rationale: chance.paragraph(), + default_value: chance.sentence(), tags: [], }, agent: { diff --git a/x-pack/plugins/cloud_security_posture/public/pages/findings/translations.ts b/x-pack/plugins/cloud_security_posture/public/pages/findings/translations.ts index df950e59a90db..4256f3219b3f6 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/findings/translations.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/findings/translations.ts @@ -42,6 +42,14 @@ export const RESOURCE = i18n.translate('xpack.csp.findings.resourceLabel', { defaultMessage: 'Resource', }); +export const GENERAL = i18n.translate('xpack.csp.findings.findingsFlyout.generalTabLabel', { + defaultMessage: 'General', +}); + +export const JSON = i18n.translate('xpack.csp.findings.findingsFlyout.jsonTabLabel', { + defaultMessage: 'JSON', +}); + export const RESOURCE_ID = i18n.translate( 'xpack.csp.findings.findingsTable.findingsTableColumn.resourceIdColumnLabel', { @@ -141,6 +149,13 @@ export const AUDIT = i18n.translate('xpack.csp.findings.auditLabel', { defaultMessage: 'Audit', }); +export const REFERENCES = i18n.translate( + 'xpack.csp.findings.findingsFlyout.generalTab.referencesLabel', + { + defaultMessage: 'References', + } +); + export const RESULT_DETAILS = i18n.translate('xpack.csp.findings.resultLabel', { defaultMessage: 'Result Details', }); 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 405ea9f231375..158bbefc422ef 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 @@ -48,8 +48,14 @@ export interface CspFinding { interface CspRule { benchmark: { name: string; version: string }; + section: string; + audit: string; + references: string; + profile_applicability: string; description: string; impact: string; + default_value: string; + rationale: string; name: string; remediation: string; tags: string[]; @@ -57,9 +63,8 @@ interface CspRule { interface CspFindingResult { evaluation: 'passed' | 'failed'; - evidence: { - filemode: string; - }; + expected?: Record; + evidence: Record; } interface CspFindingResource { From 5f290fc0e97adf5999279e36307bf1a7b0ff9592 Mon Sep 17 00:00:00 2001 From: Marshall Main <55718608+marshallmain@users.noreply.github.com> Date: Mon, 2 May 2022 09:57:33 -0700 Subject: [PATCH 49/89] [Security Solution][Alerts] Return tuple of included and excluded docs from value list exception evaluation (#130044) * Return tuple of included and excluded docs from value list exception evaluation * Types and tests * Add doc comment --- .../signals/__mocks__/es_results.ts | 35 +++- .../signals/bulk_create_ml_signals.ts | 23 +-- .../detection_engine/signals/executors/ml.ts | 12 +- .../signals/filters/filter_events.test.ts | 24 +-- .../signals/filters/filter_events.ts | 9 +- .../filter_events_against_list.test.ts | 107 ++++++------ .../filters/filter_events_against_list.ts | 46 +++-- .../detection_engine/signals/filters/types.ts | 7 +- .../signals/search_after_bulk_create.test.ts | 14 +- .../signals/search_after_bulk_create.ts | 21 +-- .../signals/send_telemetry_events.test.ts | 160 ++++++++---------- .../signals/send_telemetry_events.ts | 8 +- .../threat_mapping/build_threat_enrichment.ts | 5 +- .../threat_mapping/create_event_signal.ts | 4 +- .../enrich_signal_threat_matches.test.ts | 36 ++-- .../enrich_signal_threat_matches.ts | 22 +-- .../lib/detection_engine/signals/types.ts | 2 +- 17 files changed, 260 insertions(+), 275 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts index d699e71947853..9213d6c5b278c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts @@ -910,6 +910,32 @@ export const sampleDocSearchResultsNoSortIdNoHits = ( }, }); +/** + * + * @param count Total number of hits to create + * @param guids List of _id values for the hits. If this array is smaller than count, the remaining hits will receive a default value. + * @param ips List of source.ip values for the hits. If this array is smaller than count, the remaining hits will receive a default value. + * @param destIps List of destination.ip values for the hits. If this array is smaller than count, the remaining hits will receive a default value. + * @param sortIds List of sort IDs. The same list is inserted into every hit. + * @returns Array of mock hits + */ +export const repeatedHitsWithSortId = ( + count: number, + guids: string[], + ips?: Array, + destIps?: Array, + sortIds?: string[] +): SignalSourceHit[] => { + return Array.from({ length: count }).map((x, index) => ({ + ...sampleDocWithSortId( + guids[index], + sortIds, + ips ? ips[index] : '127.0.0.1', + destIps ? destIps[index] : '127.0.0.1' + ), + })); +}; + export const repeatedSearchResultsWithSortId = ( total: number, pageSize: number, @@ -929,14 +955,7 @@ export const repeatedSearchResultsWithSortId = ( hits: { total, max_score: 100, - hits: Array.from({ length: pageSize }).map((x, index) => ({ - ...sampleDocWithSortId( - guids[index], - sortIds, - ips ? ips[index] : '127.0.0.1', - destIps ? destIps[index] : '127.0.0.1' - ), - })), + hits: repeatedHitsWithSortId(pageSize, guids, ips, destIps, sortIds), }, }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts index 66394d4bca81d..e38ee3952cadb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/bulk_create_ml_signals.ts @@ -15,7 +15,7 @@ import { RuleExecutorServices, } from '@kbn/alerting-plugin/server'; import { GenericBulkCreateResponse } from '../rule_types/factories'; -import { AnomalyResults, Anomaly } from '../../machine_learning'; +import { Anomaly } from '../../machine_learning'; import { BuildRuleMessage } from './rule_messages'; import { BulkCreate, WrapHits } from './types'; import { CompleteRule, MachineLearningRuleParams } from '../schemas/rule_schemas'; @@ -23,7 +23,7 @@ import { buildReasonMessageForMlAlert } from './reason_formatters'; import { BaseFieldsLatest } from '../../../../common/detection_engine/schemas/alerts'; interface BulkCreateMlSignalsParams { - someResult: AnomalyResults; + anomalyHits: Array>; completeRule: CompleteRule; services: RuleExecutorServices; logger: Logger; @@ -65,32 +65,23 @@ export const transformAnomalyFieldsToEcs = (anomaly: Anomaly): EcsAnomaly => { }; const transformAnomalyResultsToEcs = ( - results: AnomalyResults -): estypes.SearchResponse => { - const transformedHits = results.hits.hits.map(({ _source, ...rest }) => ({ + results: Array> +): Array> => { + return results.map(({ _source, ...rest }) => ({ ...rest, _source: transformAnomalyFieldsToEcs( // @ts-expect-error @elastic/elasticsearch _source is optional _source ), })); - - // @ts-expect-error Anomaly is not assignable to EcsAnomaly - return { - ...results, - hits: { - ...results.hits, - hits: transformedHits, - }, - }; }; export const bulkCreateMlSignals = async ( params: BulkCreateMlSignalsParams ): Promise> => { - const anomalyResults = params.someResult; + const anomalyResults = params.anomalyHits; const ecsResults = transformAnomalyResultsToEcs(anomalyResults); - const wrappedDocs = params.wrapHits(ecsResults.hits.hits, buildReasonMessageForMlAlert); + const wrappedDocs = params.wrapHits(ecsResults, buildReasonMessageForMlAlert); return params.bulkCreate(wrappedDocs); }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts index 2070d487c49d0..22c11b565e909 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts @@ -97,21 +97,21 @@ export const mlExecutor = async ({ exceptionItems, }); - const filteredAnomalyResults = await filterEventsAgainstList({ + const [filteredAnomalyHits, _] = await filterEventsAgainstList({ listClient, exceptionsList: exceptionItems, logger, - eventSearchResult: anomalyResults, + events: anomalyResults.hits.hits, buildRuleMessage, }); - const anomalyCount = filteredAnomalyResults.hits.hits.length; + const anomalyCount = filteredAnomalyHits.length; if (anomalyCount) { logger.debug(buildRuleMessage(`Found ${anomalyCount} signals from ML anomalies.`)); } const { success, errors, bulkCreateDuration, createdItemsCount, createdItems } = await bulkCreateMlSignals({ - someResult: filteredAnomalyResults, + anomalyHits: filteredAnomalyHits, completeRule, services, logger, @@ -124,7 +124,7 @@ export const mlExecutor = async ({ // The legacy ES client does not define failures when it can be present on the structure, hence why I have the & { failures: [] } const shardFailures = ( - filteredAnomalyResults._shards as typeof filteredAnomalyResults._shards & { + anomalyResults._shards as typeof anomalyResults._shards & { failures: []; } ).failures ?? []; @@ -134,7 +134,7 @@ export const mlExecutor = async ({ return mergeReturns([ result, createSearchAfterReturnType({ - success: success && filteredAnomalyResults._shards.failed === 0, + success: success && anomalyResults._shards.failed === 0, errors: [...errors, ...searchErrors], createdSignalsCount: createdItemsCount, createdSignals: createdItems, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts index df9bb0cd59f83..bed5f96fbc233 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts @@ -9,10 +9,10 @@ import { sampleDocWithSortId } from '../__mocks__/es_results'; import { listMock } from '@kbn/lists-plugin/server/mocks'; import { getSearchListItemResponseMock } from '@kbn/lists-plugin/common/schemas/response/search_list_item_schema.mock'; -import { filterEvents } from './filter_events'; +import { partitionEvents } from './filter_events'; import { FieldSet } from './types'; -describe('filterEvents', () => { +describe('partitionEvents', () => { let listClient = listMock.getListClient(); let events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; @@ -43,11 +43,12 @@ describe('filterEvents', () => { matchedSet: new Set([JSON.stringify(['1.1.1.1'])]), }, ]; - const field = filterEvents({ + const [included, excluded] = partitionEvents({ events, fieldAndSetTuples, }); - expect([...field]).toEqual([]); + expect(included).toEqual([]); + expect(excluded).toEqual(events); }); test('it does not filter out the event if it is "excluded"', () => { @@ -59,11 +60,12 @@ describe('filterEvents', () => { matchedSet: new Set([JSON.stringify(['1.1.1.1'])]), }, ]; - const field = filterEvents({ + const [included, excluded] = partitionEvents({ events, fieldAndSetTuples, }); - expect([...field]).toEqual(events); + expect(included).toEqual(events); + expect(excluded).toEqual([]); }); test('it does NOT filter out the event if the field is not found', () => { @@ -75,11 +77,12 @@ describe('filterEvents', () => { matchedSet: new Set([JSON.stringify(['1.1.1.1'])]), }, ]; - const field = filterEvents({ + const [included, excluded] = partitionEvents({ events, fieldAndSetTuples, }); - expect([...field]).toEqual(events); + expect(included).toEqual(events); + expect(excluded).toEqual([]); }); test('it does NOT filter out the event if it is in both an inclusion and exclusion list', () => { @@ -100,10 +103,11 @@ describe('filterEvents', () => { }, ]; - const field = filterEvents({ + const [included, excluded] = partitionEvents({ events, fieldAndSetTuples, }); - expect([...field]).toEqual(events); + expect(included).toEqual(events); + expect(excluded).toEqual([]); }); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.ts index d267153a4813a..aee98b7e0ff5b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.ts @@ -5,6 +5,7 @@ * 2.0. */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { partition } from 'lodash'; import { FilterEventsOptions } from './types'; /** @@ -12,12 +13,14 @@ import { FilterEventsOptions } from './types'; * If the entry is in both an inclusion and exclusion list it will not be filtered out. * @param events The events to check against * @param fieldAndSetTuples The field and set tuples + * @returns A tuple where the first element is an array of alerts that should be created and second element is + * an array of alerts that matched the exception and should not be created. */ -export const filterEvents = ({ +export const partitionEvents = ({ events, fieldAndSetTuples, -}: FilterEventsOptions): Array> => { - return events.filter((item) => { +}: FilterEventsOptions): [Array>, Array>] => { + return partition(events, (item) => { return fieldAndSetTuples .map((tuple) => { const eventItem = item.fields ? item.fields[tuple.field] : undefined; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.test.ts index 8c33cf2ea1314..22dc5136fcded 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.test.ts @@ -8,7 +8,7 @@ import uuid from 'uuid'; import { filterEventsAgainstList } from './filter_events_against_list'; import { buildRuleMessageMock as buildRuleMessage } from '../rule_messages.mock'; -import { mockLogger, repeatedSearchResultsWithSortId } from '../__mocks__/es_results'; +import { mockLogger, repeatedHitsWithSortId } from '../__mocks__/es_results'; import { getExceptionListItemSchemaMock } from '@kbn/lists-plugin/common/schemas/response/exception_list_item_schema.mock'; import { listMock } from '@kbn/lists-plugin/server/mocks'; @@ -30,11 +30,11 @@ describe('filterEventsAgainstList', () => { }); it('should respond with eventSearchResult if exceptionList is empty array', async () => { - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [], - eventSearchResult: repeatedSearchResultsWithSortId(4, 4, someGuids.slice(0, 3), [ + events: repeatedHitsWithSortId(4, someGuids.slice(0, 3), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -42,15 +42,16 @@ describe('filterEventsAgainstList', () => { ]), buildRuleMessage, }); - expect(res.hits.hits.length).toEqual(4); + expect(included.length).toEqual(4); + expect(excluded.length).toEqual(0); }); it('should respond with eventSearchResult if exceptionList does not contain value list exceptions', async () => { - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [getExceptionListItemSchemaMock()], - eventSearchResult: repeatedSearchResultsWithSortId(4, 4, someGuids.slice(0, 3), [ + events: repeatedHitsWithSortId(4, someGuids.slice(0, 3), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -58,7 +59,8 @@ describe('filterEventsAgainstList', () => { ]), buildRuleMessage, }); - expect(res.hits.hits.length).toEqual(4); + expect(included.length).toEqual(4); + expect(excluded.length).toEqual(0); expect((mockLogger.debug as unknown as jest.Mock).mock.calls[0][0]).toContain( 'no exception items of type list found - returning original search result' ); @@ -79,14 +81,15 @@ describe('filterEventsAgainstList', () => { }, ]; - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId(4, 4, someGuids.slice(0, 3)), + events: repeatedHitsWithSortId(4, someGuids.slice(0, 3)), buildRuleMessage, }); - expect(res.hits.hits.length).toEqual(4); + expect(included.length).toEqual(4); + expect(excluded.length).toEqual(0); }); it('should respond with less items in the list if some values match', async () => { @@ -110,11 +113,11 @@ describe('filterEventsAgainstList', () => { })) ) ); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId(4, 4, someGuids.slice(0, 3), [ + events: repeatedHitsWithSortId(4, someGuids.slice(0, 3), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -126,10 +129,11 @@ describe('filterEventsAgainstList', () => { expect((listClient.searchListItemByValues as jest.Mock).mock.calls[0][0].listId).toEqual( 'ci-badguys.txt' ); - expect(res.hits.hits.length).toEqual(2); + expect(included.length).toEqual(2); + expect(excluded.length).toEqual(2); // @ts-expect-error - const ipVals = res.hits.hits.map((item) => item._source.source.ip); + const ipVals = included.map((item) => item._source.source.ip); expect(['3.3.3.3', '7.7.7.7']).toEqual(ipVals); }); @@ -170,11 +174,11 @@ describe('filterEventsAgainstList', () => { { ...getSearchListItemResponseMock(), value: ['6.6.6.6'] }, ]); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem, exceptionItemAgain], - eventSearchResult: repeatedSearchResultsWithSortId(9, 9, someGuids.slice(0, 9), [ + events: repeatedHitsWithSortId(9, someGuids.slice(0, 9), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -188,10 +192,11 @@ describe('filterEventsAgainstList', () => { buildRuleMessage, }); expect(listClient.searchListItemByValues as jest.Mock).toHaveBeenCalledTimes(2); - expect(res.hits.hits.length).toEqual(6); + expect(included.length).toEqual(6); + expect(excluded.length).toEqual(3); // @ts-expect-error - const ipVals = res.hits.hits.map((item) => item._source.source.ip); + const ipVals = included.map((item) => item._source.source.ip); expect(['1.1.1.1', '3.3.3.3', '5.5.5.5', '7.7.7.7', '8.8.8.8', '9.9.9.9']).toEqual(ipVals); }); @@ -231,11 +236,11 @@ describe('filterEventsAgainstList', () => { { ...getSearchListItemResponseMock(), value: ['6.6.6.6'] }, ]); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem, exceptionItemAgain], - eventSearchResult: repeatedSearchResultsWithSortId(9, 9, someGuids.slice(0, 9), [ + events: repeatedHitsWithSortId(9, someGuids.slice(0, 9), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -250,8 +255,9 @@ describe('filterEventsAgainstList', () => { }); expect(listClient.searchListItemByValues as jest.Mock).toHaveBeenCalledTimes(2); // @ts-expect-error - const ipVals = res.hits.hits.map((item) => item._source.source.ip); - expect(res.hits.hits.length).toEqual(7); + const ipVals = included.map((item) => item._source.source.ip); + expect(included.length).toEqual(7); + expect(excluded.length).toEqual(2); expect(['1.1.1.1', '3.3.3.3', '4.4.4.4', '5.5.5.5', '7.7.7.7', '8.8.8.8', '9.9.9.9']).toEqual( ipVals @@ -290,12 +296,11 @@ describe('filterEventsAgainstList', () => { { ...getSearchListItemResponseMock(), value: ['4.4.4.4'] }, ]); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId( - 9, + events: repeatedHitsWithSortId( 9, someGuids.slice(0, 9), [ @@ -324,10 +329,11 @@ describe('filterEventsAgainstList', () => { buildRuleMessage, }); expect(listClient.searchListItemByValues as jest.Mock).toHaveBeenCalledTimes(2); - expect(res.hits.hits.length).toEqual(8); + expect(included.length).toEqual(8); + expect(excluded.length).toEqual(1); // @ts-expect-error - const ipVals = res.hits.hits.map((item) => item._source.source.ip); + const ipVals = included.map((item) => item._source?.source?.ip); expect([ '1.1.1.1', '2.2.2.2', @@ -368,11 +374,11 @@ describe('filterEventsAgainstList', () => { { ...getSearchListItemResponseMock(), value: ['2.2.2.2'] }, ]); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId(9, 9, someGuids.slice(0, 9), [ + events: repeatedHitsWithSortId(9, someGuids.slice(0, 9), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -386,10 +392,11 @@ describe('filterEventsAgainstList', () => { buildRuleMessage, }); expect(listClient.searchListItemByValues as jest.Mock).toHaveBeenCalledTimes(2); - expect(res.hits.hits.length).toEqual(9); + expect(included.length).toEqual(9); + expect(excluded.length).toEqual(0); // @ts-expect-error - const ipVals = res.hits.hits.map((item) => item._source.source.ip); + const ipVals = included.map((item) => item._source.source.ip); expect([ '1.1.1.1', '2.2.2.2', @@ -435,12 +442,11 @@ describe('filterEventsAgainstList', () => { { ...getSearchListItemResponseMock(), value: ['3.3.3.3', '4.4.4.4'] }, ]); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId( - 3, + events: repeatedHitsWithSortId( 3, someGuids.slice(0, 3), [ @@ -467,16 +473,17 @@ describe('filterEventsAgainstList', () => { ['2.2.2.2', '3.3.3.3'], ['3.3.3.3', '4.4.4.4'], ]); - expect(res.hits.hits.length).toEqual(2); + expect(included.length).toEqual(2); + expect(excluded.length).toEqual(1); // @ts-expect-error - const sourceIpVals = res.hits.hits.map((item) => item._source.source.ip); + const sourceIpVals = included.map((item) => item._source.source.ip); expect([ ['1.1.1.1', '1.1.1.1'], ['1.1.1.1', '2.2.2.2'], ]).toEqual(sourceIpVals); // @ts-expect-error - const destIpVals = res.hits.hits.map((item) => item._source.destination.ip); + const destIpVals = included.map((item) => item._source.destination.ip); expect([ ['1.1.1.1', '2.2.2.2'], ['2.2.2.2', '3.3.3.3'], @@ -497,14 +504,15 @@ describe('filterEventsAgainstList', () => { }, }, ]; - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId(4, 4, someGuids.slice(0, 3)), + events: repeatedHitsWithSortId(4, someGuids.slice(0, 3)), buildRuleMessage, }); - expect(res.hits.hits.length).toEqual(0); + expect(included.length).toEqual(0); + expect(excluded.length).toEqual(4); }); it('should respond with less items in the list if some values match', async () => { @@ -528,11 +536,11 @@ describe('filterEventsAgainstList', () => { })) ) ); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId(4, 4, someGuids.slice(0, 3), [ + events: repeatedHitsWithSortId(4, someGuids.slice(0, 3), [ '1.1.1.1', '2.2.2.2', '3.3.3.3', @@ -544,7 +552,8 @@ describe('filterEventsAgainstList', () => { expect((listClient.searchListItemByValues as jest.Mock).mock.calls[0][0].listId).toEqual( 'ci-badguys.txt' ); - expect(res.hits.hits.length).toEqual(2); + expect(included.length).toEqual(2); + expect(excluded.length).toEqual(2); }); it('should respond with the same items in the list given one exception item with two entries of type list and array of values in document', async () => { @@ -582,12 +591,11 @@ describe('filterEventsAgainstList', () => { { ...getSearchListItemResponseMock(), value: ['3.3.3.3', '4.4.4.4'] }, ]); - const res = await filterEventsAgainstList({ + const [included, excluded] = await filterEventsAgainstList({ logger: mockLogger, listClient, exceptionsList: [exceptionItem], - eventSearchResult: repeatedSearchResultsWithSortId( - 3, + events: repeatedHitsWithSortId( 3, someGuids.slice(0, 3), [ @@ -614,16 +622,17 @@ describe('filterEventsAgainstList', () => { ['2.2.2.2', '3.3.3.3'], ['3.3.3.3', '4.4.4.4'], ]); - expect(res.hits.hits.length).toEqual(2); + expect(included.length).toEqual(2); + expect(excluded.length).toEqual(1); // @ts-expect-error - const sourceIpVals = res.hits.hits.map((item) => item._source.source.ip); + const sourceIpVals = included.map((item) => item._source.source.ip); expect([ ['1.1.1.1', '2.2.2.2'], ['2.2.2.2', '3.3.3.3'], ]).toEqual(sourceIpVals); // @ts-expect-error - const destIpVals = res.hits.hits.map((item) => item._source.destination.ip); + const destIpVals = included.map((item) => item._source.destination.ip); expect([ ['2.2.2.2', '3.3.3.3'], ['3.3.3.3', '4.4.4.4'], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.ts index 49a8ab0781eb0..7b9f6fde51842 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.ts @@ -5,13 +5,12 @@ * 2.0. */ -import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { entriesList, ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { hasLargeValueList } from '@kbn/securitysolution-list-utils'; -import { FilterEventsAgainstListOptions } from './types'; -import { filterEvents } from './filter_events'; +import { FilterEventsAgainstListOptions, FilterEventsAgainstListReturn } from './types'; +import { partitionEvents } from './filter_events'; import { createFieldAndSetTuples } from './create_field_and_set_tuples'; /** @@ -39,9 +38,9 @@ export const filterEventsAgainstList = async ({ listClient, exceptionsList, logger, - eventSearchResult, + events, buildRuleMessage, -}: FilterEventsAgainstListOptions): Promise> => { +}: FilterEventsAgainstListOptions): Promise> => { try { const atLeastOneLargeValueList = exceptionsList.some(({ entries }) => hasLargeValueList(entries) @@ -51,46 +50,41 @@ export const filterEventsAgainstList = async ({ logger.debug( buildRuleMessage('no exception items of type list found - returning original search result') ); - return eventSearchResult; + return [events, []]; } const valueListExceptionItems = exceptionsList.filter((listItem: ExceptionListItemSchema) => { return listItem.entries.every((entry) => entriesList.is(entry)); }); - const res = await valueListExceptionItems.reduce>>>( + // Every event starts out in the 'included' list, and each value list item checks all the + // current 'included' events and moves events that match the exception to the 'excluded' list + return valueListExceptionItems.reduce>>( async ( - filteredAccum: Promise>>, + filteredAccum: Promise>, exceptionItem: ExceptionListItemSchema ) => { - const events = await filteredAccum; + const [includedEvents, excludedEvents] = await filteredAccum; const fieldAndSetTuples = await createFieldAndSetTuples({ - events, + events: includedEvents, exceptionItem, listClient, logger, buildRuleMessage, }); - const filteredEvents = filterEvents({ events, fieldAndSetTuples }); - const diff = eventSearchResult.hits.hits.length - filteredEvents.length; + const [nextIncludedEvents, nextExcludedEvents] = partitionEvents({ + events: includedEvents, + fieldAndSetTuples, + }); logger.debug( - buildRuleMessage(`Exception with id ${exceptionItem.id} filtered out ${diff} events`) + buildRuleMessage( + `Exception with id ${exceptionItem.id} filtered out ${nextExcludedEvents.length} events` + ) ); - return filteredEvents; + return [nextIncludedEvents, [...excludedEvents, ...nextExcludedEvents]]; }, - Promise.resolve>>(eventSearchResult.hits.hits) + Promise.resolve>([events, []]) ); - - return { - took: eventSearchResult.took, - timed_out: eventSearchResult.timed_out, - _shards: eventSearchResult._shards, - hits: { - total: res.length, - max_score: eventSearchResult.hits.max_score, - hits: res, - }, - }; } catch (exc) { throw new Error(`Failed to query large value based lists index. Reason: ${exc.message}`); } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts index 051685c67db4a..f5d438f54bdb3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts @@ -15,10 +15,15 @@ export interface FilterEventsAgainstListOptions { listClient: ListClient; exceptionsList: ExceptionListItemSchema[]; logger: Logger; - eventSearchResult: estypes.SearchResponse; + events: Array>; buildRuleMessage: BuildRuleMessage; } +export type FilterEventsAgainstListReturn = [ + Array>, + Array> +]; + export interface CreateSetToFilterAgainstOptions { events: Array>; field: string; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts index b96b0e6dc7148..4f3a798a327ce 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts @@ -1004,16 +1004,12 @@ describe('searchAfterAndBulkCreate', () => { }); expect(mockEnrichment).toHaveBeenCalledWith( - expect.objectContaining({ - hits: expect.objectContaining({ - hits: expect.arrayContaining([ - expect.objectContaining({ - ...sampleDocWithSortId(), - _id: expect.any(String), - }), - ]), + expect.objectContaining([ + expect.objectContaining({ + ...sampleDocWithSortId(), + _id: expect.any(String), }), - }) + ]) ); expect(success).toEqual(true); expect(mockService.scopedClusterClient.asCurrentUser.search).toHaveBeenCalledTimes(4); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts index 69c001898b217..84ef95b856a5f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts @@ -127,11 +127,11 @@ export const searchAfterAndBulkCreate = async ({ // filter out the search results that match with the values found in the list. // the resulting set are signals to be indexed, given they are not duplicates // of signals already present in the signals index. - const filteredEvents = await filterEventsAgainstList({ + const [includedEvents, _] = await filterEventsAgainstList({ listClient, exceptionsList, logger, - eventSearchResult: mergedSearchResults, + events: mergedSearchResults.hits.hits, buildRuleMessage, }); @@ -139,16 +139,11 @@ export const searchAfterAndBulkCreate = async ({ // if there isn't anything after going through the value list filter // skip the call to bulk create and proceed to the next search_after, // if there is a sort id to continue the search_after with. - if (filteredEvents.hits.hits.length !== 0) { + if (includedEvents.length !== 0) { // make sure we are not going to create more signals than maxSignals allows - if (signalsCreatedCount + filteredEvents.hits.hits.length > tuple.maxSignals) { - filteredEvents.hits.hits = filteredEvents.hits.hits.slice( - 0, - tuple.maxSignals - signalsCreatedCount - ); - } - const enrichedEvents = await enrichment(filteredEvents); - const wrappedDocs = wrapHits(enrichedEvents.hits.hits, buildReasonMessage); + const limitedEvents = includedEvents.slice(0, tuple.maxSignals - signalsCreatedCount); + const enrichedEvents = await enrichment(limitedEvents); + const wrappedDocs = wrapHits(enrichedEvents, buildReasonMessage); const { bulkCreateDuration: bulkDuration, @@ -171,9 +166,7 @@ export const searchAfterAndBulkCreate = async ({ signalsCreatedCount += createdCount; logger.debug(buildRuleMessage(`created ${createdCount} signals`)); logger.debug(buildRuleMessage(`signalsCreatedCount: ${signalsCreatedCount}`)); - logger.debug( - buildRuleMessage(`enrichedEvents.hits.hits: ${enrichedEvents.hits.hits.length}`) - ); + logger.debug(buildRuleMessage(`enrichedEvents.hits.hits: ${enrichedEvents.length}`)); sendAlertTelemetryEvents( logger, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.test.ts index 36bb90936620b..d598b84ea99e2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.test.ts @@ -9,100 +9,86 @@ import { selectEvents, enrichEndpointAlertsSignalID } from './send_telemetry_eve describe('sendAlertTelemetry', () => { it('selectEvents', () => { - const filteredEvents = { - took: 0, - timed_out: false, - _shards: { - total: 1, - successful: 1, - failed: 0, - skipped: 0, + const filteredEvents = [ + { + _index: 'x', + _type: 'x', + _id: 'x', + _score: 0, + _source: { + '@timestamp': 'x', + key1: 'hello', + data_stream: { + dataset: 'endpoint.events', + }, + event: { + id: 'foo', + }, + }, }, - hits: { - total: 2, - max_score: 0, - hits: [ - { - _index: 'x', - _type: 'x', - _id: 'x', - _score: 0, - _source: { - '@timestamp': 'x', - key1: 'hello', - data_stream: { - dataset: 'endpoint.events', - }, - event: { - id: 'foo', - }, - }, + { + _index: 'x', + _type: 'x', + _id: 'x', + _score: 0, + _source: { + '@timestamp': 'x', + key2: 'hello', + data_stream: { + dataset: 'endpoint.alerts', + other: 'x', + }, + event: { + id: 'bar', }, - { - _index: 'x', - _type: 'x', - _id: 'x', - _score: 0, - _source: { - '@timestamp': 'x', - key2: 'hello', - data_stream: { - dataset: 'endpoint.alerts', - other: 'x', - }, - event: { - id: 'bar', - }, - }, + }, + }, + { + _index: 'x', + _type: 'x', + _id: 'x', + _score: 0, + _source: { + '@timestamp': 'x', + key3: 'hello', + data_stream: {}, + event: { + id: 'baz', }, - { - _index: 'x', - _type: 'x', - _id: 'x', - _score: 0, - _source: { - '@timestamp': 'x', - key3: 'hello', - data_stream: {}, - event: { - id: 'baz', - }, - }, + }, + }, + { + _index: 'y', + _type: 'y', + _id: 'y', + _score: 0, + _source: { + '@timestamp': 'y', + key3: 'hello', + data_stream: { + dataset: 'endpoint.alerts', + other: 'y', }, - { - _index: 'y', - _type: 'y', - _id: 'y', - _score: 0, - _source: { - '@timestamp': 'y', - key3: 'hello', - data_stream: { - dataset: 'endpoint.alerts', - other: 'y', - }, - event: { - id: 'not-in-map', - }, - }, + event: { + id: 'not-in-map', }, - { - _index: 'z', - _type: 'z', - _id: 'z', - _score: 0, - _source: { - '@timestamp': 'z', - key3: 'no-event-id', - data_stream: { - dataset: 'endpoint.alerts', - other: 'z', - }, - }, + }, + }, + { + _index: 'z', + _type: 'z', + _id: 'z', + _score: 0, + _source: { + '@timestamp': 'z', + key3: 'no-event-id', + data_stream: { + dataset: 'endpoint.alerts', + other: 'z', }, - ], + }, }, - }; + ]; const joinMap = new Map([ ['foo', '1234'], ['bar', 'abcd'], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts index 511f148f13d68..e419fdf632137 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/send_telemetry_events.ts @@ -9,7 +9,7 @@ import { Logger } from '@kbn/core/server'; import { ITelemetryEventsSender } from '../../telemetry/sender'; import { TelemetryEvent } from '../../telemetry/types'; import { BuildRuleMessage } from './rule_messages'; -import { SignalSearchResponse, SignalSource } from './types'; +import { SignalSource, SignalSourceHit } from './types'; interface SearchResultSource { _source: SignalSource; @@ -18,9 +18,9 @@ interface SearchResultSource { type CreatedSignalId = string; type AlertId = string; -export function selectEvents(filteredEvents: SignalSearchResponse): TelemetryEvent[] { +export function selectEvents(filteredEvents: SignalSourceHit[]): TelemetryEvent[] { // @ts-expect-error @elastic/elasticsearch _source is optional - const sources: TelemetryEvent[] = filteredEvents.hits.hits.map(function ( + const sources: TelemetryEvent[] = filteredEvents.map(function ( obj: SearchResultSource ): TelemetryEvent { return obj._source; @@ -46,7 +46,7 @@ export function enrichEndpointAlertsSignalID( export function sendAlertTelemetryEvents( logger: Logger, eventsTelemetry: ITelemetryEventsSender | undefined, - filteredEvents: SignalSearchResponse, + filteredEvents: SignalSourceHit[], createdEvents: SignalSource[], buildRuleMessage: BuildRuleMessage ) { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/build_threat_enrichment.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/build_threat_enrichment.ts index bc31ee660aad8..4c5391d238b31 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/build_threat_enrichment.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/build_threat_enrichment.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SignalSearchResponse, SignalsEnrichment } from '../types'; +import { SignalsEnrichment } from '../types'; import { enrichSignalThreatMatches } from './enrich_signal_threat_matches'; import { BuildThreatEnrichmentOptions, GetMatchedThreats } from './types'; import { getThreatList } from './get_threat_list'; @@ -55,6 +55,5 @@ export const buildThreatEnrichment = ({ return threatResponse.hits.hits; }; - return (signals: SignalSearchResponse): Promise => - enrichSignalThreatMatches(signals, getMatchedThreats, threatIndicatorPath); + return (signals) => enrichSignalThreatMatches(signals, getMatchedThreats, threatIndicatorPath); }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_event_signal.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_event_signal.ts index c5d86c9ab460c..2587c76907ccb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_event_signal.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_event_signal.ts @@ -10,7 +10,7 @@ import { getFilter } from '../get_filter'; import { searchAfterAndBulkCreate } from '../search_after_bulk_create'; import { buildReasonMessageForThreatMatchAlert } from '../reason_formatters'; import { CreateEventSignalOptions } from './types'; -import { SearchAfterAndBulkCreateReturnType, SignalSearchResponse } from '../types'; +import { SearchAfterAndBulkCreateReturnType, SignalSourceHit } from '../types'; import { getAllThreatListHits } from './get_threat_list'; import { enrichSignalThreatMatches, @@ -112,7 +112,7 @@ export const createEventSignal = async ({ ) ); - const threatEnrichment = (signals: SignalSearchResponse): Promise => + const threatEnrichment = (signals: SignalSourceHit[]): Promise => enrichSignalThreatMatches( signals, () => Promise.resolve(threatListHits), diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.test.ts index 66e44e5796eb6..b6df435c04dda 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.test.ts @@ -8,6 +8,7 @@ import { get } from 'lodash'; import { ENRICHMENT_DESTINATION_PATH } from '../../../../../common/constants'; import { ENRICHMENT_TYPES } from '../../../../../common/cti/constants'; +import { SignalSourceHit } from '../types'; import { getThreatListItemMock } from './build_threat_mapping_filter.mock'; import { @@ -16,11 +17,7 @@ import { groupAndMergeSignalMatches, getSignalMatchesFromThreatList, } from './enrich_signal_threat_matches'; -import { - getNamedQueryMock, - getSignalHitMock, - getSignalsResponseMock, -} from './enrich_signal_threat_matches.mock'; +import { getNamedQueryMock, getSignalHitMock } from './enrich_signal_threat_matches.mock'; import { GetMatchedThreats, ThreatListItem, ThreatMatchNamedQuery } from './types'; import { encodeThreatMatchNamedQuery } from './utils'; @@ -507,14 +504,14 @@ describe('enrichSignalThreatMatches', () => { }); it('performs no enrichment if there are no signals', async () => { - const signals = getSignalsResponseMock([]); + const signals: SignalSourceHit[] = []; const enrichedSignals = await enrichSignalThreatMatches( signals, getMatchedThreats, indicatorPath ); - expect(enrichedSignals.hits.hits).toEqual([]); + expect(enrichedSignals).toEqual([]); }); it('preserves existing threat.enrichments objects on signals', async () => { @@ -526,13 +523,13 @@ describe('enrichSignalThreatMatches', () => { }, matched_queries: [matchedQuery], }); - const signals = getSignalsResponseMock([signalHit]); + const signals: SignalSourceHit[] = [signalHit]; const enrichedSignals = await enrichSignalThreatMatches( signals, getMatchedThreats, indicatorPath ); - const [enrichedHit] = enrichedSignals.hits.hits; + const [enrichedHit] = enrichedSignals; const enrichments = get(enrichedHit._source, ENRICHMENT_DESTINATION_PATH); expect(enrichments).toEqual([ @@ -560,13 +557,13 @@ describe('enrichSignalThreatMatches', () => { const signalHit = getSignalHitMock({ matched_queries: [matchedQuery], }); - const signals = getSignalsResponseMock([signalHit]); + const signals: SignalSourceHit[] = [signalHit]; const enrichedSignals = await enrichSignalThreatMatches( signals, getMatchedThreats, indicatorPath ); - const [enrichedHit] = enrichedSignals.hits.hits; + const [enrichedHit] = enrichedSignals; const enrichments = get(enrichedHit._source, ENRICHMENT_DESTINATION_PATH); expect(enrichments).toEqual([ @@ -598,13 +595,13 @@ describe('enrichSignalThreatMatches', () => { }, matched_queries: [matchedQuery], }); - const signals = getSignalsResponseMock([signalHit]); + const signals: SignalSourceHit[] = [signalHit]; const enrichedSignals = await enrichSignalThreatMatches( signals, getMatchedThreats, indicatorPath ); - const [enrichedHit] = enrichedSignals.hits.hits; + const [enrichedHit] = enrichedSignals; const enrichments = get(enrichedHit._source, ENRICHMENT_DESTINATION_PATH); expect(enrichments).toEqual([ @@ -637,7 +634,7 @@ describe('enrichSignalThreatMatches', () => { _source: { '@timestamp': 'mocked', threat: 'whoops' }, matched_queries: [matchedQuery], }); - const signals = getSignalsResponseMock([signalHit]); + const signals: SignalSourceHit[] = [signalHit]; await expect(() => enrichSignalThreatMatches(signals, getMatchedThreats, indicatorPath) ).rejects.toThrowError('Expected threat field to be an object, but found: whoops'); @@ -674,13 +671,13 @@ describe('enrichSignalThreatMatches', () => { }, matched_queries: [matchedQuery], }); - const signals = getSignalsResponseMock([signalHit]); + const signals: SignalSourceHit[] = [signalHit]; const enrichedSignals = await enrichSignalThreatMatches( signals, getMatchedThreats, 'custom_threat.custom_indicator' ); - const [enrichedHit] = enrichedSignals.hits.hits; + const [enrichedHit] = enrichedSignals; const enrichments = get(enrichedHit._source, ENRICHMENT_DESTINATION_PATH); expect(enrichments).toEqual([ @@ -748,16 +745,15 @@ describe('enrichSignalThreatMatches', () => { ), ], }); - const signals = getSignalsResponseMock([signalHit, otherSignalHit]); + const signals: SignalSourceHit[] = [signalHit, otherSignalHit]; const enrichedSignals = await enrichSignalThreatMatches( signals, getMatchedThreats, indicatorPath ); - expect(enrichedSignals.hits.total).toEqual(expect.objectContaining({ value: 1 })); - expect(enrichedSignals.hits.hits).toHaveLength(1); + expect(enrichedSignals).toHaveLength(1); - const [enrichedHit] = enrichedSignals.hits.hits; + const [enrichedHit] = enrichedSignals; const enrichments = get(enrichedHit._source, ENRICHMENT_DESTINATION_PATH); expect(enrichments).toEqual([ diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.ts index c1fb88176fd4c..58a486068013f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/enrich_signal_threat_matches.ts @@ -8,7 +8,7 @@ import { get, isObject } from 'lodash'; import { ENRICHMENT_TYPES, FEED_NAME_PATH } from '../../../../../common/cti/constants'; -import type { SignalSearchResponse, SignalSourceHit } from '../types'; +import type { SignalSourceHit } from '../types'; import type { GetMatchedThreats, ThreatEnrichment, @@ -109,17 +109,16 @@ export const buildEnrichments = ({ }); export const enrichSignalThreatMatches = async ( - signals: SignalSearchResponse, + signals: SignalSourceHit[], getMatchedThreats: GetMatchedThreats, indicatorPath: string, signalMatchesArg?: SignalMatch[] -): Promise => { - const signalHits = signals.hits.hits; - if (signalHits.length === 0) { +): Promise => { + if (signals.length === 0) { return signals; } - const uniqueHits = groupAndMergeSignalMatches(signalHits); + const uniqueHits = groupAndMergeSignalMatches(signals); const signalMatches: SignalMatch[] = signalMatchesArg ? signalMatchesArg : uniqueHits.map((signalHit) => ({ @@ -177,14 +176,5 @@ export const enrichSignalThreatMatches = async ( }; }); - return { - ...signals, - hits: { - ...signals.hits, - hits: enrichedSignals, - total: isObject(signals.hits.total) - ? { ...signals.hits.total, value: enrichedSignals.length } - : enrichedSignals.length, - }, - }; + return enrichedSignals; }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts index 235865a8b60a9..5dc19b1b257b8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts @@ -277,7 +277,7 @@ export interface AlertAttributes { export type BulkResponseErrorAggregation = Record; -export type SignalsEnrichment = (signals: SignalSearchResponse) => Promise; +export type SignalsEnrichment = (signals: SignalSourceHit[]) => Promise; export type BulkCreate = ( docs: Array> From 6278939024a629b0853d41467805a5ead1930193 Mon Sep 17 00:00:00 2001 From: mgiota Date: Mon, 2 May 2022 20:30:17 +0200 Subject: [PATCH 50/89] [Actionable Observability] state containers for last response filtering (#131300) * add lastResponse filtering in the urlbar using routeParams * refactor using state containers --- .../public/pages/rules/index.tsx | 36 +++++-- .../pages/rules/state_container/index.tsx | 9 ++ .../rules/state_container/state_container.tsx | 50 ++++++++++ .../use_rules_page_state_container.tsx | 96 +++++++++++++++++++ 4 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 x-pack/plugins/observability/public/pages/rules/state_container/index.tsx create mode 100644 x-pack/plugins/observability/public/pages/rules/state_container/state_container.tsx create mode 100644 x-pack/plugins/observability/public/pages/rules/state_container/use_rules_page_state_container.tsx diff --git a/x-pack/plugins/observability/public/pages/rules/index.tsx b/x-pack/plugins/observability/public/pages/rules/index.tsx index dd8829937a876..693c5dd11f4d1 100644 --- a/x-pack/plugins/observability/public/pages/rules/index.tsx +++ b/x-pack/plugins/observability/public/pages/rules/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useCallback } from 'react'; import { capitalize, sortBy } from 'lodash'; import { EuiButton, @@ -31,6 +31,8 @@ import { } from '@kbn/triggers-actions-ui-plugin/public'; import { RuleExecutionStatus, ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common'; import { usePluginContext } from '../../hooks/use_plugin_context'; +import { Provider, rulesPageStateContainer, useRulesPageStateContainer } from './state_container'; + import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; import { useKibana } from '../../utils/kibana_react'; import { useFetchRules } from '../../hooks/use_fetch_rules'; @@ -71,7 +73,7 @@ import { import { ExperimentalBadge } from '../../components/shared/experimental_badge'; const ENTER_KEY = 13; -export function RulesPage() { +function RulesPage() { const { ObservabilityPageTemplate, kibanaFeatures } = usePluginContext(); const { http, @@ -80,6 +82,7 @@ export function RulesPage() { application: { capabilities }, notifications: { toasts }, } = useKibana().services; + const { lastResponse, setLastResponse } = useRulesPageStateContainer(); const documentationLink = docLinks.links.observability.createAlerts; const ruleTypeRegistry = triggersActionsUi.ruleTypeRegistry; const canExecuteActions = hasExecuteActionsCapability(capabilities); @@ -90,7 +93,7 @@ export function RulesPage() { }); const [inputText, setInputText] = useState(); const [searchText, setSearchText] = useState(); - const [ruleLastResponseFilter, setRuleLastResponseFilter] = useState([]); + // const [ruleLastResponseFilter, setRuleLastResponseFilter] = useState([]); const [typesFilter, setTypesFilter] = useState([]); const [currentRuleToEdit, setCurrentRuleToEdit] = useState(null); const [rulesToDelete, setRulesToDelete] = useState([]); @@ -106,7 +109,7 @@ export function RulesPage() { const { rulesState, setRulesState, reload, noData, initialLoad } = useFetchRules({ searchText, - ruleLastResponseFilter, + ruleLastResponseFilter: lastResponse, typesFilter, page, setPage, @@ -280,6 +283,13 @@ export function RulesPage() { [] ); + const setExecutionStatusFilter = useCallback( + (ids: string[]) => { + setLastResponse(ids); + }, + [setLastResponse] + ); + const getRulesTable = () => { if (noData && !rulesState.isLoading) { return authorizedToCreateAnyRules ? ( @@ -294,6 +304,10 @@ export function RulesPage() { if (initialLoad) { return ; } + + // const nextSearchParams = new URLSearchParams(history.location.search); + // const xx = [...nextSearchParams.getAll('executionStatus')] || []; + // console.log(xx, '!!'); return ( <> @@ -331,8 +345,8 @@ export function RulesPage() { setRuleLastResponseFilter(ids)} + selectedStatuses={lastResponse} + onChange={setExecutionStatusFilter} /> @@ -457,3 +471,13 @@ export function RulesPage() { ); } + +function WrappedRulesPage() { + return ( + + + + ); +} + +export { WrappedRulesPage as RulesPage }; diff --git a/x-pack/plugins/observability/public/pages/rules/state_container/index.tsx b/x-pack/plugins/observability/public/pages/rules/state_container/index.tsx new file mode 100644 index 0000000000000..7820342482035 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/rules/state_container/index.tsx @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { Provider, rulesPageStateContainer } from './state_container'; +export { useRulesPageStateContainer } from './use_rules_page_state_container'; diff --git a/x-pack/plugins/observability/public/pages/rules/state_container/state_container.tsx b/x-pack/plugins/observability/public/pages/rules/state_container/state_container.tsx new file mode 100644 index 0000000000000..b36ffca96972e --- /dev/null +++ b/x-pack/plugins/observability/public/pages/rules/state_container/state_container.tsx @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + createStateContainer, + createStateContainerReactHelpers, +} from '@kbn/kibana-utils-plugin/public'; + +interface RulesPageContainerState { + lastResponse: string[]; +} + +const defaultState: RulesPageContainerState = { + lastResponse: [], +}; + +interface RulesPageStateTransitions { + setLastResponse: ( + state: RulesPageContainerState + ) => (lastResponse: string[]) => RulesPageContainerState; +} + +const transitions: RulesPageStateTransitions = { + setLastResponse: (state) => (lastResponse) => { + const filteredIds = lastResponse; + lastResponse.forEach((id) => { + const isPreviouslyChecked = state.lastResponse.includes(id); + if (!isPreviouslyChecked) { + filteredIds.concat(id); + } else { + filteredIds.filter((val) => { + return val !== id; + }); + } + }); + return { ...state, lastResponse: filteredIds }; + }, +}; + +const rulesPageStateContainer = createStateContainer(defaultState, transitions); + +type RulesPageStateContainer = typeof rulesPageStateContainer; +const { Provider, useContainer } = createStateContainerReactHelpers(); + +export { Provider, rulesPageStateContainer, useContainer, defaultState }; +export type { RulesPageStateContainer, RulesPageContainerState, RulesPageStateTransitions }; diff --git a/x-pack/plugins/observability/public/pages/rules/state_container/use_rules_page_state_container.tsx b/x-pack/plugins/observability/public/pages/rules/state_container/use_rules_page_state_container.tsx new file mode 100644 index 0000000000000..6b44dc8ae31d5 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/rules/state_container/use_rules_page_state_container.tsx @@ -0,0 +1,96 @@ +/* + * Copyright 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 { useHistory } from 'react-router-dom'; + +import { + createKbnUrlStateStorage, + syncState, + IKbnUrlStateStorage, + useContainerSelector, +} from '@kbn/kibana-utils-plugin/public'; + +import { + useContainer, + defaultState, + RulesPageStateContainer, + RulesPageContainerState, +} from './state_container'; + +export function useRulesPageStateContainer() { + const stateContainer = useContainer(); + + useUrlStateSyncEffect(stateContainer); + + const { setLastResponse } = stateContainer.transitions; + const { lastResponse } = useContainerSelector(stateContainer, (state) => state); + + return { + lastResponse, + setLastResponse, + }; +} + +function useUrlStateSyncEffect(stateContainer: RulesPageStateContainer) { + const history = useHistory(); + + useEffect(() => { + const urlStateStorage = createKbnUrlStateStorage({ + history, + useHash: false, + useHashQuery: false, + }); + const { start, stop } = setupUrlStateSync(stateContainer, urlStateStorage); + + start(); + + syncUrlStateWithInitialContainerState(stateContainer, urlStateStorage); + + return stop; + }, [stateContainer, history]); +} + +function setupUrlStateSync( + stateContainer: RulesPageStateContainer, + stateStorage: IKbnUrlStateStorage +) { + // This handles filling the state when an incomplete URL set is provided + const setWithDefaults = (changedState: Partial | null) => { + stateContainer.set({ ...defaultState, ...changedState }); + }; + return syncState({ + storageKey: '_a', + stateContainer: { + ...stateContainer, + set: setWithDefaults, + }, + stateStorage, + }); +} + +function syncUrlStateWithInitialContainerState( + stateContainer: RulesPageStateContainer, + urlStateStorage: IKbnUrlStateStorage +) { + const urlState = urlStateStorage.get>('_a'); + + if (urlState) { + const newState = { + ...defaultState, + ...urlState, + }; + + stateContainer.set(newState); + } else { + // Reset the state container when no URL state or timefilter range is set to avoid accidentally + // re-using state set on a previous visit to the page in the same session + stateContainer.set(defaultState); + } + + urlStateStorage.set('_a', stateContainer.get()); +} From 41a1975e09ac52be49db5991ee91ad2a88f6864c Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 2 May 2022 12:42:42 -0600 Subject: [PATCH 51/89] [Reporting/Maps] fix background tiles in a map panel might not load in a screenshot report (#131185) * [Reporting/Maps] fix background tiles in a map panel might not load in a screenshot report * add unit tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../ems_vector_tile_layer.test.ts | 38 ++++++- .../ems_vector_tile_layer.tsx | 4 + .../mvt_vector_layer.test.tsx | 106 ++++++++++++++++++ .../mvt_vector_layer/mvt_vector_layer.tsx | 6 + .../mb_map/tile_status_tracker.test.ts | 4 +- .../mb_map/tile_status_tracker.ts | 33 +++++- 6 files changed, 183 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts index 8b27bacff8ecb..21c9c1f79d970 100644 --- a/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.test.ts @@ -6,14 +6,18 @@ */ import { SOURCE_TYPES } from '../../../../common/constants'; -import { DataFilters, XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; +import { + DataFilters, + LayerDescriptor, + XYZTMSSourceDescriptor, +} from '../../../../common/descriptor_types'; import { ILayer } from '../layer'; import { EmsVectorTileLayer } from './ems_vector_tile_layer'; import { DataRequestContext } from '../../../actions'; import { EMSTMSSource } from '../../sources/ems_tms_source'; describe('EmsVectorTileLayer', () => { - it('should correctly inject tileLayerId in meta', async () => { + test('should correctly inject tileLayerId in meta', async () => { const layer: ILayer = new EmsVectorTileLayer({ source: { getTileLayerId: () => { @@ -50,4 +54,34 @@ describe('EmsVectorTileLayer', () => { expect(actualMeta).toStrictEqual({ tileLayerId: 'myTileLayerId' }); expect(actualErrorMessage).toStrictEqual('network error'); }); + + describe('isInitialDataLoadComplete', () => { + test('should return false when tile loading has not started', () => { + const layer = new EmsVectorTileLayer({ + source: {} as unknown as EMSTMSSource, + layerDescriptor: {} as unknown as LayerDescriptor, + }); + expect(layer.isInitialDataLoadComplete()).toBe(false); + }); + + test('should return false when tiles are loading', () => { + const layer = new EmsVectorTileLayer({ + source: {} as unknown as EMSTMSSource, + layerDescriptor: { + __areTilesLoaded: false, + } as unknown as LayerDescriptor, + }); + expect(layer.isInitialDataLoadComplete()).toBe(false); + }); + + test('should return true when tiles are loaded', () => { + const layer = new EmsVectorTileLayer({ + source: {} as unknown as EMSTMSSource, + layerDescriptor: { + __areTilesLoaded: true, + } as unknown as LayerDescriptor, + }); + expect(layer.isInitialDataLoadComplete()).toBe(true); + }); + }); }); diff --git a/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx index 428156165c4c3..646ccb3c09acd 100644 --- a/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/ems_vector_tile_layer/ems_vector_tile_layer.tsx @@ -67,6 +67,10 @@ export class EmsVectorTileLayer extends AbstractLayer { this._style = new TileStyle(); } + isInitialDataLoadComplete(): boolean { + return !!this._descriptor.__areTilesLoaded; + } + getSource(): EMSTMSSource { return super.getSource() as EMSTMSSource; } diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.test.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.test.tsx index 27d377851152e..d9ee5207b29f3 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.test.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/mvt_vector_layer/mvt_vector_layer.test.tsx @@ -17,6 +17,8 @@ import { shallow } from 'enzyme'; import { Feature } from 'geojson'; import { MVTSingleLayerVectorSource } from '../../../sources/mvt_single_layer_vector_source'; +import { IVectorSource } from '../../../sources/vector_source'; +import { InnerJoin } from '../../../joins/inner_join'; import { TiledSingleLayerVectorSourceDescriptor, VectorLayerDescriptor, @@ -93,3 +95,107 @@ describe('getFeatureById', () => { expect(feature).toEqual(null); }); }); + +describe('isInitialDataLoadComplete', () => { + const sourceDataRequestDescriptor = { + data: {}, + dataId: 'source', + dataRequestMeta: {}, + dataRequestMetaAtStart: undefined, + dataRequestToken: undefined, + }; + test('should return false when tile loading has not started', () => { + const layer = new MvtVectorLayer({ + customIcons: [], + layerDescriptor: { + __dataRequests: [sourceDataRequestDescriptor], + } as unknown as VectorLayerDescriptor, + source: {} as unknown as IVectorSource, + }); + expect(layer.isInitialDataLoadComplete()).toBe(false); + }); + + test('should return false when tiles are loading', () => { + const layer = new MvtVectorLayer({ + customIcons: [], + layerDescriptor: { + __areTilesLoaded: false, + __dataRequests: [sourceDataRequestDescriptor], + } as unknown as VectorLayerDescriptor, + source: {} as unknown as IVectorSource, + }); + expect(layer.isInitialDataLoadComplete()).toBe(false); + }); + + test('should return true when tiles are loaded', () => { + const layer = new MvtVectorLayer({ + customIcons: [], + layerDescriptor: { + __areTilesLoaded: true, + __dataRequests: [sourceDataRequestDescriptor], + } as unknown as VectorLayerDescriptor, + source: {} as unknown as IVectorSource, + }); + expect(layer.isInitialDataLoadComplete()).toBe(true); + }); + + test('should return false when tiles are loaded but join is loading', () => { + const layer = new MvtVectorLayer({ + customIcons: [], + joins: [ + { + hasCompleteConfig: () => { + return true; + }, + getSourceDataRequestId: () => { + return 'join_source_a0b0da65-5e1a-4967-9dbe-74f24391afe2'; + }, + } as unknown as InnerJoin, + ], + layerDescriptor: { + __areTilesLoaded: true, + __dataRequests: [ + sourceDataRequestDescriptor, + { + dataId: 'join_source_a0b0da65-5e1a-4967-9dbe-74f24391afe2', + dataRequestMetaAtStart: {}, + dataRequestToken: Symbol('join request'), + }, + ], + } as unknown as VectorLayerDescriptor, + source: {} as unknown as IVectorSource, + }); + expect(layer.isInitialDataLoadComplete()).toBe(false); + }); + + test('should return true when tiles are loaded and joins are loaded', () => { + const layer = new MvtVectorLayer({ + customIcons: [], + joins: [ + { + hasCompleteConfig: () => { + return true; + }, + getSourceDataRequestId: () => { + return 'join_source_a0b0da65-5e1a-4967-9dbe-74f24391afe2'; + }, + } as unknown as InnerJoin, + ], + layerDescriptor: { + __areTilesLoaded: true, + __dataRequests: [ + sourceDataRequestDescriptor, + { + data: {}, + dataId: 'join_source_a0b0da65-5e1a-4967-9dbe-74f24391afe2', + dataRequestMeta: {}, + dataRequestMetaAtStart: undefined, + dataRequestToken: undefined, + }, + ], + } as unknown as VectorLayerDescriptor, + source: {} as unknown as IVectorSource, + }); + expect(layer.isInitialDataLoadComplete()).toBe(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 a7ec941fceca3..6a1b80165433a 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 @@ -68,6 +68,12 @@ export class MvtVectorLayer extends AbstractVectorLayer { this._source = args.source as IMvtVectorSource; } + isInitialDataLoadComplete(): boolean { + return this._descriptor.__areTilesLoaded === undefined || !this._descriptor.__areTilesLoaded + ? false + : super.isInitialDataLoadComplete(); + } + async getBounds(syncContext: DataRequestContext) { // Add filter to narrow bounds to features with matching join keys let joinKeyFilter; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.test.ts b/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.test.ts index ffc6459262c8b..6485582149db7 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.test.ts +++ b/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.test.ts @@ -113,7 +113,7 @@ describe('TileStatusTracker', () => { expect(loadedMap.get('foo')).toBe(true); expect(loadedMap.get('bar')).toBe(false); // still outstanding tile requests - expect(loadedMap.has('foobar')).toBe(true); // never received tile requests + expect(loadedMap.has('foobar')).toBe(false); // never received tile requests, status should not have been reported for layer (aa11BarTile as { tile: { aborted: boolean } })!.tile.aborted = true; // abort tile mockMbMap.emit('sourcedataloading', createMockMbDataEvent('barsource', 'af1d')); @@ -125,7 +125,7 @@ describe('TileStatusTracker', () => { expect(loadedMap.get('foo')).toBe(false); // still outstanding tile requests expect(loadedMap.get('bar')).toBe(true); // tiles were aborted or errored - expect(loadedMap.has('foobar')).toBe(true); // never received tile requests + expect(loadedMap.has('foobar')).toBe(false); // never received tile requests, status should not have been reported for layer }); test('should cleanup listeners on destroy', async () => { diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.ts b/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.ts index 94a4344bac009..c349ef0ede3b6 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.ts +++ b/x-pack/plugins/maps/public/connected_components/mb_map/tile_status_tracker.ts @@ -29,8 +29,21 @@ interface Tile { } export class TileStatusTracker { - private _tileCache: Tile[]; - private _tileErrorCache: Record; + // Tile cache tracks active tile requests + // 'sourcedataloading' event adds tile request to cache + // 'sourcedata' and 'error' events remove tile request from cache + // Tile requests with 'aborted' status are removed from cache when reporting 'areTilesLoaded' status + private _tileCache: Tile[] = []; + + // Tile error cache tracks tile request errors per layer + // Error cache is cleared when map center tile changes + private _tileErrorCache: Record = {}; + + // Layer cache tracks layers that have requested one or more tiles + // Layer cache is used so that only a layer that has requested one or more tiles reports 'areTilesLoaded' status + // layer cache is never cleared + private _layerCache: Map = new Map(); + private _prevCenterTileKey?: string; private readonly _mbMap: MapboxMap; private readonly _updateTileStatus: ( @@ -48,6 +61,14 @@ export class TileStatusTracker { e.tile && (e.source.type === 'vector' || e.source.type === 'raster') ) { + const targetLayer = this._getCurrentLayerList().find((layer) => { + return layer.ownsMbSourceId(e.sourceId); + }); + const layerId = targetLayer ? targetLayer.getId() : undefined; + if (layerId && !this._layerCache.has(layerId)) { + this._layerCache.set(layerId, true); + } + const tracked = this._tileCache.find((tile) => { return ( tile.mbKey === (e.tile.tileID.key as unknown as string) && tile.mbSourceId === e.sourceId @@ -127,8 +148,6 @@ export class TileStatusTracker { updateTileStatus: (layer: ILayer, areTilesLoaded: boolean, errorMessage?: string) => void; getCurrentLayerList: () => ILayer[]; }) { - this._tileCache = []; - this._tileErrorCache = {}; this._updateTileStatus = updateTileStatus; this._getCurrentLayerList = getCurrentLayerList; @@ -146,6 +165,12 @@ export class TileStatusTracker { const layerList = this._getCurrentLayerList(); for (let i = 0; i < layerList.length; i++) { const layer: ILayer = layerList[i]; + + if (!this._layerCache.has(layer.getId())) { + // do not report status for layers that have not started loading tiles. + continue; + } + let atLeastOnePendingTile = false; for (let j = 0; j < this._tileCache.length; j++) { const tile = this._tileCache[j]; From 90e8795ed7d0f8b5e05da17e9a9eb22cc615b72b Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 2 May 2022 11:51:14 -0700 Subject: [PATCH 52/89] Change execution to run in Rules app (#131026) --- .../common/components/execution_duration_chart.tsx | 8 ++++---- .../application/sections/rule_details/components/rule.tsx | 2 +- .../public/application/sections/rule_form/rule_form.tsx | 2 +- .../sections/rules_list/components/rules_list.test.tsx | 2 +- .../sections/rules_list/components/rules_list.tsx | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.tsx index 08fabc3fba2fd..140dae9dc14a5 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/execution_duration_chart.tsx @@ -38,7 +38,7 @@ const NUM_EXECUTIONS_OPTIONS = [120, 60, 30, 15].map((value) => ({ text: i18n.translate( 'xpack.triggersActionsUI.sections.executionDurationChart.numberOfExecutionsOption', { - defaultMessage: '{value} executions', + defaultMessage: '{value} runs', values: { value, }, @@ -70,7 +70,7 @@ export const ExecutionDurationChart: React.FunctionComponent = ({

@@ -84,7 +84,7 @@ export const ExecutionDurationChart: React.FunctionComponent = ({ aria-label={i18n.translate( 'xpack.triggersActionsUI.sections.executionDurationChart.selectNumberOfExecutionDurationsLabel', { - defaultMessage: 'Select number of executions', + defaultMessage: 'Select number of runs', } )} onChange={onChange} @@ -161,7 +161,7 @@ export const ExecutionDurationChart: React.FunctionComponent = ({

diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx index b70eaf20a051d..ad6ef32ab82be 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx @@ -122,7 +122,7 @@ export function RuleComponent({ { id: EVENT_LOG_LIST_TAB, name: i18n.translate('xpack.triggersActionsUI.sections.ruleDetails.rule.eventLogTabText', { - defaultMessage: 'Execution history', + defaultMessage: 'Run history', }), 'data-test-subj': 'eventLogListTab', content: suspendedComponentWithProps( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx index d765fa225ef0c..1bca80a08c936 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_form/rule_form.tsx @@ -488,7 +488,7 @@ export const RuleForm = ({ > )} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx index 098bef2b5af47..727898d42a076 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx @@ -459,7 +459,7 @@ describe('rules_list component with items', () => { jest.runAllTimers(); wrapper.update(); - expect(wrapper.find('.euiToolTipPopover').text()).toBe('Start time of the last execution.'); + expect(wrapper.find('.euiToolTipPopover').text()).toBe('Start time of the last run.'); wrapper .find('[data-test-subj="rulesTableCell-lastExecutionDateTooltip"]') diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx index 9b85334932a99..57c59f3f09782 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx @@ -418,7 +418,7 @@ export const RulesList: React.FunctionComponent = () => { content={i18n.translate( 'xpack.triggersActionsUI.sections.rulesList.rulesListTable.columns.ruleExecutionPercentileTooltip', { - defaultMessage: `{percentileOrdinal} percentile of this rule's past {sampleLimit} execution durations (mm:ss).`, + defaultMessage: `{percentileOrdinal} percentile of this rule's past {sampleLimit} run durations (mm:ss).`, values: { percentileOrdinal: percentileOrdinals[selectedPercentile!], sampleLimit: MONITORING_HISTORY_LIMIT, @@ -605,7 +605,7 @@ export const RulesList: React.FunctionComponent = () => { content={i18n.translate( 'xpack.triggersActionsUI.sections.rulesList.rulesListTable.columns.lastExecutionDateTitle', { - defaultMessage: 'Start time of the last execution.', + defaultMessage: 'Start time of the last run.', } )} > @@ -761,7 +761,7 @@ export const RulesList: React.FunctionComponent = () => { content={i18n.translate( 'xpack.triggersActionsUI.sections.rulesList.rulesListTable.columns.successRatioTitle', { - defaultMessage: 'How often this rule executes successfully.', + defaultMessage: 'How often this rule runs successfully.', } )} > From 060cdf6df2e02357837c19b02bc0985b1ce55b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Mon, 2 May 2022 22:30:12 +0200 Subject: [PATCH 53/89] [`@kbn/docs-utils`] Support ConstructSignatures (#131287) --- .../buid_api_declaration.test.ts | 18 ++++++ .../build_api_declaration.ts | 7 ++- .../build_function_dec.ts | 8 ++- .../api_docs/build_api_declarations/utils.ts | 6 +- .../src/api_docs/build_api_docs_cli.ts | 15 +++-- .../api_docs/mdx/split_apis_by_folder.test.ts | 4 +- .../__fixtures__/src/plugin_a/public/index.ts | 5 ++ .../tests/snapshots/plugin_a.devdocs.json | 61 +++++++++++++++++++ .../src/api_docs/tests/snapshots/plugin_a.mdx | 4 +- .../api_docs/tests/snapshots/plugin_a_foo.mdx | 4 +- .../src/api_docs/tests/snapshots/plugin_b.mdx | 2 +- 11 files changed, 119 insertions(+), 15 deletions(-) diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts index 9b86db445c225..527ce59011a8b 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/buid_api_declaration.test.ts @@ -53,6 +53,24 @@ it('Test number primitive doc def', () => { expect(def.type).toBe(TypeKind.NumberKind); }); +it('Test a constructor type declaration inside an interface', () => { + const node = nodes.find((n) => getNodeName(n) === 'ClassConstructorWithStaticProperties'); + expect(node).toBeDefined(); + const def = buildApiDeclarationTopNode(node!, { + plugins, + log, + currentPluginId: plugins[0].manifest.id, + scope: ApiScope.CLIENT, + captureReferences: false, + }); + + expect(def.type).toBe(TypeKind.InterfaceKind); + expect(def.children).toHaveLength(2); + expect(def.children![1].type).toBe(TypeKind.FunctionKind); + expect(def.children![1].label).toBe('new'); + expect(def.children![1].id).toBe('def-public.ClassConstructorWithStaticProperties.new'); +}); + it('Function type is exported as type with signature', () => { const node = nodes.find((n) => getNodeName(n) === 'FnWithGeneric'); expect(node).toBeDefined(); diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts index 809097ee73818..2e167c7a0a783 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_api_declaration.ts @@ -65,12 +65,17 @@ export function buildApiDeclaration(node: Node, opts: BuildApiDecOpts): ApiDecla Node.isMethodSignature(node) || Node.isFunctionDeclaration(node) || Node.isMethodDeclaration(node) || + Node.isConstructSignatureDeclaration(node) || Node.isConstructorDeclaration(node) ) { return buildFunctionDec(node, { ...opts, // Use "Constructor" if applicable, instead of the default "Unnamed" - name: Node.isConstructorDeclaration(node) ? 'Constructor' : node.getName() || 'Unnamed', + name: Node.isConstructSignatureDeclaration(node) + ? 'new' + : Node.isConstructorDeclaration(node) + ? 'Constructor' + : node.getName() || 'Unnamed', }); } else if ( Node.isPropertySignature(node) || diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts index 3ba688f1ee284..020ffd402366a 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/build_function_dec.ts @@ -11,6 +11,7 @@ import { MethodDeclaration, ConstructorDeclaration, MethodSignature, + ConstructSignatureDeclaration, } from 'ts-morph'; import { buildApiDecsForParameters } from './build_parameter_decs'; @@ -23,7 +24,12 @@ import { BuildApiDecOpts } from './types'; * Takes the various function-like node declaration types and converts them into an ApiDeclaration. */ export function buildFunctionDec( - node: FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature, + node: + | ConstructSignatureDeclaration + | FunctionDeclaration + | MethodDeclaration + | ConstructorDeclaration + | MethodSignature, opts: BuildApiDecOpts ): ApiDeclaration { const fn = { diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts index a57b1790b27a8..76328a314b066 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_declarations/utils.ts @@ -46,7 +46,11 @@ export function buildParentApiId(parentName: string, parentsParentApiId?: string } export function getOptsForChild(node: Node, parentOpts: BuildApiDecOpts): BuildApiDecOpts { - const name = isNamedNode(node) ? node.getName() : 'Unnamed'; + const name = Node.isConstructSignatureDeclaration(node) + ? 'new' + : isNamedNode(node) + ? node.getName() + : 'Unnamed'; return getOptsForChildWithName(name, parentOpts); } diff --git a/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts b/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts index 0617e35a88615..41bb6400b92ab 100644 --- a/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts +++ b/packages/kbn-docs-utils/src/api_docs/build_api_docs_cli.ts @@ -65,11 +65,16 @@ export function runBuildApiDocsCli() { // Delete all files except the README that warns about the auto-generated nature of // the folder. const files = Fs.readdirSync(outputFolder); - files.forEach((file) => { - if (file.indexOf('README.md') < 0) { - Fs.rmSync(Path.resolve(outputFolder, file)); - } - }); + await Promise.all( + files + .filter((file) => file.indexOf('README.md') < 0) + .map( + (file) => + new Promise((resolve, reject) => + Fs.rm(Path.resolve(outputFolder, file), (err) => (err ? reject(err) : resolve())) + ) + ) + ); } const collectReferences = flags.references as boolean; diff --git a/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts b/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts index b1862f9bc2165..1a1ecb8ec3e67 100644 --- a/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts +++ b/packages/kbn-docs-utils/src/api_docs/mdx/split_apis_by_folder.test.ts @@ -38,7 +38,7 @@ beforeAll(() => { }); test('foo service has all exports', () => { - expect(doc?.client.length).toBe(37); + expect(doc?.client.length).toBe(38); const split = splitApisByFolder(doc); expect(split.length).toBe(2); @@ -47,5 +47,5 @@ test('foo service has all exports', () => { expect(fooDoc?.common.length).toBe(1); expect(fooDoc?.client.length).toBe(2); - expect(mainDoc?.client.length).toBe(35); + expect(mainDoc?.client.length).toBe(36); }); diff --git a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts index 345e85bc044b7..ad3d1204aeda9 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts +++ b/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts @@ -24,6 +24,11 @@ export interface InterfaceWithIndexSignature { [key: string]: { foo: string }; } +export interface ClassConstructorWithStaticProperties { + staticProperty1: string; + new (config: { foo: string }): InterfaceWithIndexSignature; +} + export function plugin() { return new PluginA(); } diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.devdocs.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.devdocs.json index ff977517cb5a7..88e4043442e88 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.devdocs.json +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.devdocs.json @@ -712,6 +712,67 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "pluginA", + "id": "def-public.ClassConstructorWithStaticProperties", + "type": "Interface", + "tags": [], + "label": "ClassConstructorWithStaticProperties", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.ClassConstructorWithStaticProperties.staticProperty1", + "type": "string", + "tags": [], + "label": "staticProperty1", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts", + "deprecated": false + }, + { + "parentPluginId": "pluginA", + "id": "def-public.ClassConstructorWithStaticProperties.new", + "type": "Function", + "tags": [], + "label": "new", + "description": [], + "signature": [ + "any" + ], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.ClassConstructorWithStaticProperties.new.$1", + "type": "Object", + "tags": [], + "label": "config", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts", + "deprecated": false, + "children": [ + { + "parentPluginId": "pluginA", + "id": "def-public.ClassConstructorWithStaticProperties.new.$1.foo", + "type": "string", + "tags": [], + "label": "foo", + "description": [], + "path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/index.ts", + "deprecated": false + } + ] + } + ], + "returnComment": [] + } + ], + "initialIsOpen": false + }, { "parentPluginId": "pluginA", "id": "def-public.ExampleInterface", diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx index ab80f1f02d0ac..6a66fa74f7c01 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.mdx @@ -4,7 +4,7 @@ slug: /kibana-dev-docs/api/pluginA title: "pluginA" image: https://source.unsplash.com/400x175/?github summary: API docs for the pluginA plugin -date: 2022-02-14 +date: 2022-04-30 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'pluginA'] warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info. --- @@ -18,7 +18,7 @@ Contact Kibana Core for questions regarding this plugin. | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 131 | 1 | 71 | 2 | +| 136 | 1 | 76 | 2 | ## Client diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx index e9873f8223017..4082de6306895 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a_foo.mdx @@ -4,7 +4,7 @@ slug: /kibana-dev-docs/api/pluginA-foo title: "pluginA.foo" image: https://source.unsplash.com/400x175/?github summary: API docs for the pluginA.foo plugin -date: 2022-02-14 +date: 2022-04-30 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'pluginA.foo'] warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info. --- @@ -18,7 +18,7 @@ Contact Kibana Core for questions regarding this plugin. | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 131 | 1 | 71 | 2 | +| 136 | 1 | 76 | 2 | ## Client diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx index 1671cd7a529d3..d69da971f7e3e 100644 --- a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx +++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_b.mdx @@ -4,7 +4,7 @@ slug: /kibana-dev-docs/api/pluginB title: "pluginB" image: https://source.unsplash.com/400x175/?github summary: API docs for the pluginB plugin -date: 2022-02-14 +date: 2022-04-30 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'pluginB'] warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info. --- From ca134dc18f056b2a7505048c929d7a11b0076811 Mon Sep 17 00:00:00 2001 From: Catherine Liu Date: Mon, 2 May 2022 13:31:16 -0700 Subject: [PATCH 54/89] Cache range slider min and max to prevent resizing on selection change (#131266) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../range_slider/range_slider_popover.tsx | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/plugins/controls/public/control_types/range_slider/range_slider_popover.tsx b/src/plugins/controls/public/control_types/range_slider/range_slider_popover.tsx index a51b46d98ff85..1bb7501f7104f 100644 --- a/src/plugins/controls/public/control_types/range_slider/range_slider_popover.tsx +++ b/src/plugins/controls/public/control_types/range_slider/range_slider_popover.tsx @@ -45,6 +45,8 @@ export const RangeSliderPopover: FC = ({ fieldFormatter, }) => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); + const [rangeSliderMin, setRangeSliderMin] = useState(-Infinity); + const [rangeSliderMax, setRangeSliderMax] = useState(Infinity); const rangeRef = useRef(null); let errorMessage = ''; let helpText = ''; @@ -79,17 +81,6 @@ export const RangeSliderPopover: FC = ({ errorMessage = RangeSliderStrings.errors.getUpperLessThanLowerErrorMessage(); } - const rangeSliderMin = Math.min( - roundedMin, - isNaN(lowerBoundValue) ? Infinity : lowerBoundValue, - isNaN(upperBoundValue) ? Infinity : upperBoundValue - ); - const rangeSliderMax = Math.max( - roundedMax, - isNaN(lowerBoundValue) ? -Infinity : lowerBoundValue, - isNaN(upperBoundValue) ? -Infinity : upperBoundValue - ); - const displayedValue = [ hasLowerBoundSelection ? String(lowerBoundValue) : hasAvailableRange ? String(roundedMin) : '', hasUpperBoundSelection ? String(upperBoundValue) : hasAvailableRange ? String(roundedMax) : '', @@ -106,7 +97,27 @@ export const RangeSliderPopover: FC = ({ const button = (