From eab2e0b04fce0f921c1db0f590f47a3e0f667171 Mon Sep 17 00:00:00 2001
From: shahzad31
Date: Thu, 5 May 2022 09:04:24 +0200
Subject: [PATCH 1/4] add routes to observability nav
---
.../monitor_management/use_breadcrumbs.ts | 2 +-
x-pack/plugins/synthetics/public/plugin.ts | 111 ++++++++++++------
2 files changed, 77 insertions(+), 36 deletions(-)
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_management/use_breadcrumbs.ts b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_management/use_breadcrumbs.ts
index ab44c1b7c37a2..be94df18ef7d2 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_management/use_breadcrumbs.ts
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_management/use_breadcrumbs.ts
@@ -17,7 +17,7 @@ export const useMonitorManagementBreadcrumbs = () => {
useBreadcrumbs([
{
text: MONITOR_MANAGEMENT_CRUMB,
- href: `${appPath}/${MONITOR_MANAGEMENT_ROUTE}/all`,
+ href: `${appPath}/${MONITOR_MANAGEMENT_ROUTE}`,
},
]);
};
diff --git a/x-pack/plugins/synthetics/public/plugin.ts b/x-pack/plugins/synthetics/public/plugin.ts
index 88238b1bfbf37..8427f8c3060de 100644
--- a/x-pack/plugins/synthetics/public/plugin.ts
+++ b/x-pack/plugins/synthetics/public/plugin.ts
@@ -123,41 +123,8 @@ export class UptimePlugin
},
});
- plugins.observability.navigation.registerSections(
- from(core.getStartServices()).pipe(
- map(([coreStart]) => {
- if (coreStart.application.capabilities.uptime.show) {
- return [
- {
- label: 'Uptime',
- sortKey: 500,
- entries: [
- {
- label: i18n.translate('xpack.synthetics.overview.heading', {
- defaultMessage: 'Monitors',
- }),
- app: 'uptime',
- path: '/',
- matchFullPath: true,
- ignoreTrailingSlash: true,
- },
- {
- label: i18n.translate('xpack.synthetics.certificatesPage.heading', {
- defaultMessage: 'TLS Certificates',
- }),
- app: 'uptime',
- path: '/certificates',
- matchFullPath: true,
- },
- ],
- },
- ];
- }
-
- return [];
- })
- )
- );
+ registerUptimeRoutesWithNavigation(core, plugins);
+ registerSyntheticsRoutesWithNavigation(core, plugins);
const { observabilityRuleTypeRegistry } = plugins.observability;
@@ -270,3 +237,77 @@ export class UptimePlugin
public stop(): void {}
}
+
+function registerSyntheticsRoutesWithNavigation(
+ core: CoreSetup,
+ plugins: ClientPluginsSetup
+) {
+ plugins.observability.navigation.registerSections(
+ from(core.getStartServices()).pipe(
+ map(([coreStart]) => {
+ if (coreStart.application.capabilities.uptime.show) {
+ return [
+ {
+ label: 'Synthetics',
+ sortKey: 499,
+ entries: [
+ {
+ label: i18n.translate('xpack.synthetics.overview.heading', {
+ defaultMessage: 'Monitors',
+ }),
+ app: 'synthetics',
+ path: '/manage-monitors',
+ matchFullPath: true,
+ ignoreTrailingSlash: true,
+ },
+ ],
+ },
+ ];
+ }
+
+ return [];
+ })
+ )
+ );
+}
+
+function registerUptimeRoutesWithNavigation(
+ core: CoreSetup,
+ plugins: ClientPluginsSetup
+) {
+ plugins.observability.navigation.registerSections(
+ from(core.getStartServices()).pipe(
+ map(([coreStart]) => {
+ if (coreStart.application.capabilities.uptime.show) {
+ return [
+ {
+ label: 'Uptime',
+ sortKey: 500,
+ entries: [
+ {
+ label: i18n.translate('xpack.synthetics.overview.heading', {
+ defaultMessage: 'Monitors',
+ }),
+ app: 'uptime',
+ path: '/',
+ matchFullPath: true,
+ ignoreTrailingSlash: true,
+ },
+ {
+ label: i18n.translate('xpack.synthetics.certificatesPage.heading', {
+ defaultMessage: 'TLS Certificates',
+ }),
+ app: 'uptime',
+ path: '/certificates',
+ matchFullPath: true,
+ },
+ ],
+ },
+ ];
+ }
+
+ return [];
+ })
+ )
+ );
+}
From 80114eef29ebcfe4f07754070e4413e2dc0728f2 Mon Sep 17 00:00:00 2001
From: shahzad31
Date: Thu, 5 May 2022 09:35:40 +0200
Subject: [PATCH 2/4] ui clean up
---
.../pages/synthetics_page_template.test.tsx | 4 +-
.../common/pages/synthetics_page_template.tsx | 7 +-
.../synthetics_alerts_flyout_wrapper.tsx | 33 --
.../toggle_alert_flyout_button.tsx | 31 --
.../synthetics_alerts_flyout_wrapper.tsx | 45 ---
.../toggle_alert_flyout_button.test.tsx | 64 ----
.../alerts/toggle_alert_flyout_button.tsx | 164 ---------
.../overview/alerts/translations.ts | 345 ------------------
.../overview/filter_group/labels.ts | 24 --
.../public/apps/synthetics/hooks/index.ts | 3 +-
.../hooks/use_filter_update.test.ts | 32 --
.../synthetics/hooks/use_filter_update.ts | 76 ----
.../apps/synthetics/hooks/use_telemetry.ts | 2 +-
.../public/apps/synthetics/routes.tsx | 2 +-
.../apps/synthetics/state/index_status/api.ts | 2 +-
.../public/apps/synthetics/synthetics_app.tsx | 4 +-
.../synthetics/utils/testing/rtl_helpers.tsx | 2 +-
.../hooks/use_breakpoints.test.ts | 0
.../synthetics => }/hooks/use_breakpoints.ts | 0
.../app/uptime_page_template.test.tsx | 4 +-
.../app/uptime_page_template.tsx | 2 +-
.../ping_timestamp/step_image_caption.tsx | 2 +-
.../monitor_list/monitor_list.tsx | 2 +-
.../pages/synthetics/checks_navigation.tsx | 2 +-
.../utils/api_service/api_service.ts | 0
.../utils/api_service/index.ts | 0
.../utils/kibana_service/index.ts | 0
.../utils/kibana_service/kibana_service.ts | 0
28 files changed, 16 insertions(+), 836 deletions(-)
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/synthetics_alerts_flyout_wrapper.tsx
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/synthetics_alerts_flyout_wrapper.tsx
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.test.tsx
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.tsx
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/translations.ts
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/components/overview/filter_group/labels.ts
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.test.ts
delete mode 100644 x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.ts
rename x-pack/plugins/synthetics/public/{apps/synthetics => }/hooks/use_breakpoints.test.ts (100%)
rename x-pack/plugins/synthetics/public/{apps/synthetics => }/hooks/use_breakpoints.ts (100%)
rename x-pack/plugins/synthetics/public/{apps/synthetics => }/utils/api_service/api_service.ts (100%)
rename x-pack/plugins/synthetics/public/{apps/synthetics => }/utils/api_service/index.ts (100%)
rename x-pack/plugins/synthetics/public/{apps/synthetics => }/utils/kibana_service/index.ts (100%)
rename x-pack/plugins/synthetics/public/{apps/synthetics => }/utils/kibana_service/kibana_service.ts (100%)
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.test.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.test.tsx
index 2c8201a175159..bd58aa12b1c82 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.test.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.test.tsx
@@ -11,9 +11,9 @@ import 'jest-styled-components';
import { render } from '../../../utils/testing/rtl_helpers';
import { SyntheticsPageTemplateComponent } from './synthetics_page_template';
import { OVERVIEW_ROUTE } from '../../../../../../common/constants';
-import { useBreakpoints } from '../../../hooks/use_breakpoints';
+import { useBreakpoints } from '../../../../../hooks/use_breakpoints';
-jest.mock('../../../hooks/use_breakpoints', () => {
+jest.mock('../../../../../hooks/use_breakpoints', () => {
const down = jest.fn().mockReturnValue(false);
return {
useBreakpoints: () => ({ down }),
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.tsx
index 0e6c5565b842e..44b38236fc2a2 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/pages/synthetics_page_template.tsx
@@ -10,7 +10,6 @@ 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 { useNoDataConfig } from '../../../hooks/use_no_data_config';
import { EmptyStateLoading } from '../../overview/empty_state/empty_state_loading';
@@ -65,9 +64,7 @@ export const SyntheticsPageTemplateComponent: React.FC;
}
- const isMainRoute = path === OVERVIEW_ROUTE || path === CERTIFICATES_ROUTE;
-
- const showLoading = loading && isMainRoute && !data;
+ const showLoading = loading && !data;
return (
<>
@@ -75,7 +72,7 @@ export const SyntheticsPageTemplateComponent: React.FC
{showLoading && }
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/synthetics_alerts_flyout_wrapper.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/synthetics_alerts_flyout_wrapper.tsx
deleted file mode 100644
index 7271e8cd2e998..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/synthetics_alerts_flyout_wrapper.tsx
+++ /dev/null
@@ -1,33 +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 { useDispatch, useSelector } from 'react-redux';
-import {
- selectAlertFlyoutVisibility,
- selectAlertFlyoutType,
- setAlertFlyoutVisible,
-} from '../../../../state';
-import { SyntheticsAlertsFlyoutWrapperComponent } from '../synthetics_alerts_flyout_wrapper';
-
-export const SyntheticsAlertsFlyoutWrapper: React.FC = () => {
- const dispatch = useDispatch();
- const setAddFlyoutVisibility = (value: React.SetStateAction) =>
- // @ts-ignore the value here is a boolean, and it works with the action creator function
- dispatch(setAlertFlyoutVisible(value));
-
- const alertFlyoutVisible = useSelector(selectAlertFlyoutVisibility);
- const alertTypeId = useSelector(selectAlertFlyoutType);
-
- return (
-
- );
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx
deleted file mode 100644
index 2fea38d99d094..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/alerts_containers/toggle_alert_flyout_button.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import React from 'react';
-import { useDispatch } from 'react-redux';
-import { setAlertFlyoutType, setAlertFlyoutVisible } from '../../../../state';
-import {
- ToggleAlertFlyoutButtonComponent,
- ToggleAlertFlyoutButtonProps,
-} from '../toggle_alert_flyout_button';
-
-export const ToggleAlertFlyoutButton: React.FC = (props) => {
- const dispatch = useDispatch();
- return (
- {
- if (typeof value === 'string') {
- dispatch(setAlertFlyoutType(value));
- dispatch(setAlertFlyoutVisible(true));
- } else {
- dispatch(setAlertFlyoutVisible(value));
- }
- }}
- />
- );
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/synthetics_alerts_flyout_wrapper.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/synthetics_alerts_flyout_wrapper.tsx
deleted file mode 100644
index 33c76176787cf..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/synthetics_alerts_flyout_wrapper.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import React, { useCallback, useMemo } from 'react';
-import { useKibana } from '@kbn/kibana-react-plugin/public';
-import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public';
-
-interface Props {
- alertFlyoutVisible: boolean;
- alertTypeId?: string;
- setAlertFlyoutVisibility: React.Dispatch>;
-}
-
-interface KibanaDeps {
- triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
-}
-
-export const SyntheticsAlertsFlyoutWrapperComponent = ({
- alertFlyoutVisible,
- alertTypeId,
- setAlertFlyoutVisibility,
-}: Props) => {
- const { triggersActionsUi } = useKibana().services;
- const onCloseAlertFlyout = useCallback(
- () => setAlertFlyoutVisibility(false),
- [setAlertFlyoutVisibility]
- );
- const AddAlertFlyout = useMemo(
- () =>
- triggersActionsUi.getAddAlertFlyout({
- consumer: 'synthetics',
- onClose: onCloseAlertFlyout,
- ruleTypeId: alertTypeId,
- canChangeTrigger: !alertTypeId,
- }),
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [onCloseAlertFlyout, alertTypeId]
- );
-
- return <>{alertFlyoutVisible && AddAlertFlyout}>;
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.test.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.test.tsx
deleted file mode 100644
index b185d3897d243..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.test.tsx
+++ /dev/null
@@ -1,64 +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 userEvent from '@testing-library/user-event';
-import { render, forNearestButton, makeSyntheticsPermissionsCore } from '../../../utils/testing';
-import { ToggleAlertFlyoutButtonComponent } from './toggle_alert_flyout_button';
-import { ToggleFlyoutTranslations } from './translations';
-
-describe('ToggleAlertFlyoutButtonComponent', () => {
- describe('when users have write access to synthetics', () => {
- it('enables the button to create a rule', () => {
- const { getByText } = render(
- ,
- { core: makeSyntheticsPermissionsCore({ save: true }) }
- );
- userEvent.click(getByText('Alerts and rules'));
- expect(
- forNearestButton(getByText)(ToggleFlyoutTranslations.openAlertContextPanelLabel)
- ).toBeEnabled();
- });
-
- it("does not contain a tooltip explaining why the user can't create alerts", async () => {
- const { getByText, findByText } = render(
- ,
- { core: makeSyntheticsPermissionsCore({ save: true }) }
- );
- userEvent.click(getByText('Alerts and rules'));
- userEvent.hover(getByText(ToggleFlyoutTranslations.openAlertContextPanelLabel));
- await expect(() =>
- findByText('You need read-write access to Synthetics to create alerts in this app.')
- ).rejects.toEqual(expect.anything());
- });
- });
-
- describe("when users don't have write access to uptime", () => {
- it('disables the button to create a rule', () => {
- const { getByText } = render(
- ,
- { core: makeSyntheticsPermissionsCore({ save: false }) }
- );
- userEvent.click(getByText('Alerts and rules'));
- expect(
- forNearestButton(getByText)(ToggleFlyoutTranslations.openAlertContextPanelLabel)
- ).toBeDisabled();
- });
-
- it("contains a tooltip explaining why users can't create rules", async () => {
- const { getByText, findByText } = render(
- ,
- { core: makeSyntheticsPermissionsCore({ save: false }) }
- );
- userEvent.click(getByText('Alerts and rules'));
- userEvent.hover(getByText(ToggleFlyoutTranslations.openAlertContextPanelLabel));
- expect(
- await findByText('You need read-write access to Uptime to create alerts in this app.')
- ).toBeInTheDocument();
- });
- });
-});
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.tsx
deleted file mode 100644
index f29fe0941ee82..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/toggle_alert_flyout_button.tsx
+++ /dev/null
@@ -1,164 +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 {
- EuiHeaderLink,
- EuiContextMenu,
- EuiContextMenuPanelDescriptor,
- EuiContextMenuPanelItemDescriptor,
- EuiLink,
- EuiPopover,
-} from '@elastic/eui';
-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 '../../../../../plugin';
-
-import { ToggleFlyoutTranslations } from './translations';
-
-interface ComponentProps {
- setAlertFlyoutVisible: (value: boolean | string) => void;
-}
-
-export interface ToggleAlertFlyoutButtonProps {
- alertOptions?: string[];
-}
-
-type Props = ComponentProps & ToggleAlertFlyoutButtonProps;
-
-const ALERT_CONTEXT_MAIN_PANEL_ID = 0;
-const ALERT_CONTEXT_SELECT_TYPE_PANEL_ID = 1;
-
-const noWritePermissionsTooltipContent = i18n.translate(
- 'xpack.synthetics.alertDropdown.noWritePermissions',
- {
- defaultMessage: 'You need read-write access to Uptime to create alerts in this app.',
- }
-);
-
-export const ToggleAlertFlyoutButtonComponent: React.FC = ({
- alertOptions,
- setAlertFlyoutVisible,
-}) => {
- const [isOpen, setIsOpen] = useState(false);
- const kibana = useKibana();
- const {
- services: { observability },
- } = useKibana();
- const manageRulesUrl = observability.useRulesLink();
- const hasUptimeWrite = kibana.services.application?.capabilities.uptime?.save ?? false;
-
- const monitorStatusAlertContextMenuItem: EuiContextMenuPanelItemDescriptor = {
- 'aria-label': ToggleFlyoutTranslations.toggleMonitorStatusAriaLabel,
- 'data-test-subj': 'xpack.synthetics.toggleAlertFlyout',
- name: ToggleFlyoutTranslations.toggleMonitorStatusContent,
- onClick: () => {
- setAlertFlyoutVisible(CLIENT_ALERT_TYPES.MONITOR_STATUS);
- setIsOpen(false);
- },
- };
-
- const tlsAlertContextMenuItem: EuiContextMenuPanelItemDescriptor = {
- 'aria-label': ToggleFlyoutTranslations.toggleTlsAriaLabel,
- 'data-test-subj': 'xpack.synthetics.toggleTlsAlertFlyout',
- name: ToggleFlyoutTranslations.toggleTlsContent,
- onClick: () => {
- setAlertFlyoutVisible(CLIENT_ALERT_TYPES.TLS);
- setIsOpen(false);
- },
- };
-
- const managementContextItem: EuiContextMenuPanelItemDescriptor = {
- 'aria-label': ToggleFlyoutTranslations.navigateToAlertingUIAriaLabel,
- 'data-test-subj': 'xpack.synthetics.navigateToAlertingUi',
- name: (
-
-
-
- ),
- icon: 'tableOfContents',
- };
-
- let selectionItems: EuiContextMenuPanelItemDescriptor[] = [];
- if (!alertOptions) {
- selectionItems = [monitorStatusAlertContextMenuItem, tlsAlertContextMenuItem];
- } else {
- alertOptions.forEach((option) => {
- if (option === CLIENT_ALERT_TYPES.MONITOR_STATUS)
- selectionItems.push(monitorStatusAlertContextMenuItem);
- else if (option === CLIENT_ALERT_TYPES.TLS) selectionItems.push(tlsAlertContextMenuItem);
- });
- }
-
- if (selectionItems.length === 1) {
- selectionItems[0].icon = 'bell';
- }
-
- let panels: EuiContextMenuPanelDescriptor[];
- if (selectionItems.length === 1) {
- panels = [
- {
- id: ALERT_CONTEXT_MAIN_PANEL_ID,
- items: [...selectionItems, managementContextItem],
- },
- ];
- } else {
- panels = [
- {
- id: ALERT_CONTEXT_MAIN_PANEL_ID,
- items: [
- {
- 'aria-label': ToggleFlyoutTranslations.openAlertContextPanelAriaLabel,
- 'data-test-subj': 'xpack.synthetics.openAlertContextPanel',
- name: ToggleFlyoutTranslations.openAlertContextPanelLabel,
- icon: 'bell',
- panel: ALERT_CONTEXT_SELECT_TYPE_PANEL_ID,
- toolTipContent: !hasUptimeWrite ? noWritePermissionsTooltipContent : null,
- disabled: !hasUptimeWrite,
- },
- managementContextItem,
- ],
- },
- {
- id: ALERT_CONTEXT_SELECT_TYPE_PANEL_ID,
- title: ToggleFlyoutTranslations.toggleAlertFlyoutButtonLabel,
- items: selectionItems,
- },
- ];
- }
-
- return (
- setIsOpen(!isOpen)}
- >
-
-
- }
- closePopover={() => setIsOpen(false)}
- isOpen={isOpen}
- ownFocus
- panelPaddingSize="none"
- >
-
-
- );
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/translations.ts b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/translations.ts
deleted file mode 100644
index 0580528b6b38c..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/alerts/translations.ts
+++ /dev/null
@@ -1,345 +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';
-
-export const SECONDS_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.secondsOption.ariaLabel',
- {
- defaultMessage: '"Seconds" time range select item',
- }
-);
-
-export const SECONDS = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.timerangeOption.seconds',
- {
- defaultMessage: 'seconds',
- }
-);
-
-export const MINUTES_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.minutesOption.ariaLabel',
- {
- defaultMessage: '"Minutes" time range select item',
- }
-);
-
-export const MINUTES = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.timerangeOption.minutes',
- {
- defaultMessage: 'minutes',
- }
-);
-
-export const HOURS_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.hoursOption.ariaLabel',
- {
- defaultMessage: '"Hours" time range select item',
- }
-);
-
-export const HOURS = i18n.translate('xpack.synthetics.alerts.monitorStatus.timerangeOption.hours', {
- defaultMessage: 'hours',
-});
-
-export const DAYS_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.daysOption.ariaLabel',
- {
- defaultMessage: '"Days" time range select item',
- }
-);
-
-export const DAYS = i18n.translate('xpack.synthetics.alerts.monitorStatus.timerangeOption.days', {
- defaultMessage: 'days',
-});
-
-export const WEEKS_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.weeksOption.ariaLabel',
- {
- defaultMessage: '"Weeks" time range select item',
- }
-);
-
-export const WEEKS = i18n.translate('xpack.synthetics.alerts.monitorStatus.timerangeOption.weeks', {
- defaultMessage: 'weeks',
-});
-
-export const MONTHS_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.monthsOption.ariaLabel',
- {
- defaultMessage: '"Months" time range select item',
- }
-);
-
-export const MONTHS = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.timerangeOption.months',
- {
- defaultMessage: 'months',
- }
-);
-
-export const YEARS_TIME_RANGE = i18n.translate(
- 'xpack.synthetics.alerts.timerangeUnitSelectable.yearsOption.ariaLabel',
- {
- defaultMessage: '"Years" time range select item',
- }
-);
-
-export const YEARS = i18n.translate('xpack.synthetics.alerts.monitorStatus.timerangeOption.years', {
- defaultMessage: 'years',
-});
-
-export const ALERT_KUERY_BAR_ARIA = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.filterBar.ariaLabel',
- {
- defaultMessage: 'Input that allows filtering criteria for the monitor status alert',
- }
-);
-
-export const OPEN_THE_POPOVER_DOWN_COUNT = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.numTimesExpression.ariaLabel',
- {
- defaultMessage: 'Open the popover for down count input',
- }
-);
-
-export const ENTER_NUMBER_OF_DOWN_COUNTS = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.numTimesField.ariaLabel',
- {
- defaultMessage: 'Enter number of down counts required to trigger the alert',
- }
-);
-
-export const MATCHING_MONITORS_DOWN = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.numTimesExpression.matchingMonitors.description',
- {
- defaultMessage: 'matching monitors are down >',
- }
-);
-
-export const ANY_MONITOR_DOWN = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.numTimesExpression.anyMonitors.description',
- {
- defaultMessage: 'any monitor is down >',
- }
-);
-
-export const OPEN_THE_POPOVER_TIME_RANGE_VALUE = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.timerangeValueExpression.ariaLabel',
- {
- defaultMessage: 'Open the popover for time range value field',
- }
-);
-
-export const ENTER_NUMBER_OF_TIME_UNITS = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.timerangeValueField.ariaLabel',
- {
- defaultMessage: `Enter the number of time units for the alert's range`,
- }
-);
-
-export const ENTER_NUMBER_OF_TIME_UNITS_DESCRIPTION = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.timerangeValueField.expression',
- {
- defaultMessage: 'within',
- }
-);
-
-export const ENTER_NUMBER_OF_TIME_UNITS_VALUE = (value: number) =>
- i18n.translate('xpack.synthetics.alerts.monitorStatus.timerangeValueField.value', {
- defaultMessage: 'last {value}',
- values: { value },
- });
-
-export const ENTER_AVAILABILITY_RANGE_ENABLED = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.isEnabledCheckbox.label',
- {
- defaultMessage: 'Availability',
- }
-);
-
-export const ENTER_AVAILABILITY_RANGE_POPOVER_ARIA_LABEL = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.timerangeValueField.popover.ariaLabel',
- {
- defaultMessage: 'Specify availability tracking time range',
- }
-);
-
-export const ENTER_AVAILABILITY_RANGE_UNITS_ARIA_LABEL = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.timerangeValueField.ariaLabel',
- {
- defaultMessage: `Enter the number of units for the alert's availability check.`,
- }
-);
-
-export const ENTER_AVAILABILITY_RANGE_UNITS_DESCRIPTION = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.timerangeValueField.expression',
- {
- defaultMessage: 'within the last',
- }
-);
-
-export const ENTER_AVAILABILITY_THRESHOLD_ARIA_LABEL = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.threshold.ariaLabel',
- {
- defaultMessage: 'Specify availability thresholds for this alert',
- }
-);
-
-export const ENTER_AVAILABILITY_THRESHOLD_INPUT_ARIA_LABEL = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.threshold.input.ariaLabel',
- {
- defaultMessage: 'Input an availability threshold to check for this alert',
- }
-);
-
-export const ENTER_AVAILABILITY_THRESHOLD_DESCRIPTION = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.threshold.description',
- {
- defaultMessage: 'matching monitors are up in',
- description:
- 'This fragment explains that an alert will fire for monitors matching user-specified criteria',
- }
-);
-
-export const ENTER_ANY_AVAILABILITY_THRESHOLD_DESCRIPTION = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.threshold.anyMonitorDescription',
- {
- defaultMessage: 'any monitor is up in',
- description:
- 'This fragment explains that an alert will fire for monitors matching user-specified criteria',
- }
-);
-
-export const ENTER_AVAILABILITY_THRESHOLD_VALUE = (value: string) =>
- i18n.translate('xpack.synthetics.alerts.monitorStatus.availability.threshold.value', {
- defaultMessage: '< {value}% of checks',
- description:
- 'This fragment specifies criteria that will cause an alert to fire for uptime monitors',
- values: { value },
- });
-
-export const ENTER_AVAILABILITY_RANGE_SELECT_ARIA = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.unit.selectable',
- {
- defaultMessage: 'Use this select to set the availability range units for this alert',
- }
-);
-
-export const ENTER_AVAILABILITY_RANGE_SELECT_HEADLINE = i18n.translate(
- 'xpack.synthetics.alerts.monitorStatus.availability.unit.headline',
- {
- defaultMessage: 'Select time range unit',
- }
-);
-
-export const ADD_FILTER = i18n.translate('xpack.synthetics.alerts.monitorStatus.addFilter', {
- defaultMessage: `Add filter`,
-});
-
-export const LOCATION = i18n.translate('xpack.synthetics.alerts.monitorStatus.addFilter.location', {
- defaultMessage: `Location`,
-});
-
-export const TAG = i18n.translate('xpack.synthetics.alerts.monitorStatus.addFilter.tag', {
- defaultMessage: `Tag`,
-});
-
-export const PORT = i18n.translate('xpack.synthetics.alerts.monitorStatus.addFilter.port', {
- defaultMessage: `Port`,
-});
-
-export const TYPE = i18n.translate('xpack.synthetics.alerts.monitorStatus.addFilter.type', {
- defaultMessage: `Type`,
-});
-
-export const TlsTranslations = {
- criteriaAriaLabel: i18n.translate('xpack.synthetics.alerts.tls.criteriaExpression.ariaLabel', {
- defaultMessage:
- 'An expression displaying the criteria for monitor that are watched by this alert',
- }),
- criteriaDescription: i18n.translate(
- 'xpack.synthetics.alerts.tls.criteriaExpression.description',
- {
- defaultMessage: 'when',
- description:
- 'The context of this `when` is in the conditional sense, like "when there are three cookies, eat them all".',
- }
- ),
- criteriaValue: i18n.translate('xpack.synthetics.alerts.tls.criteriaExpression.value', {
- defaultMessage: 'any monitor',
- }),
- expirationAriaLabel: i18n.translate(
- 'xpack.synthetics.alerts.tls.expirationExpression.ariaLabel',
- {
- defaultMessage:
- 'An expression displaying the threshold that will trigger the TLS alert for certificate expiration',
- }
- ),
- expirationDescription: i18n.translate(
- 'xpack.synthetics.alerts.tls.expirationExpression.description',
- {
- defaultMessage: 'has a certificate expiring within',
- }
- ),
- expirationValue: (value?: number) =>
- i18n.translate('xpack.synthetics.alerts.tls.expirationExpression.value', {
- defaultMessage: '{value} days',
- values: { value },
- }),
- ageAriaLabel: i18n.translate('xpack.synthetics.alerts.tls.ageExpression.ariaLabel', {
- defaultMessage:
- 'An expressing displaying the threshold that will trigger the TLS alert for old certificates',
- }),
- ageDescription: i18n.translate('xpack.synthetics.alerts.tls.ageExpression.description', {
- defaultMessage: 'or older than',
- }),
- ageValue: (value?: number) =>
- i18n.translate('xpack.synthetics.alerts.tls.ageExpression.value', {
- defaultMessage: '{value} days',
- values: { value },
- }),
-};
-
-export const ToggleFlyoutTranslations = {
- toggleButtonAriaLabel: i18n.translate('xpack.synthetics.alertsPopover.toggleButton.ariaLabel', {
- defaultMessage: 'Open alerts and rules context menu',
- }),
- openAlertContextPanelAriaLabel: i18n.translate(
- 'xpack.synthetics.openAlertContextPanel.ariaLabel',
- {
- defaultMessage: 'Open the rule context panel so you can choose a rule type',
- }
- ),
- openAlertContextPanelLabel: i18n.translate('xpack.synthetics.openAlertContextPanel.label', {
- defaultMessage: 'Create rule',
- }),
- toggleTlsAriaLabel: i18n.translate('xpack.synthetics.toggleTlsAlertButton.ariaLabel', {
- defaultMessage: 'Open TLS rule flyout',
- }),
- toggleTlsContent: i18n.translate('xpack.synthetics.toggleTlsAlertButton.content', {
- defaultMessage: 'TLS rule',
- }),
- toggleMonitorStatusAriaLabel: i18n.translate('xpack.synthetics.toggleAlertFlyout.ariaLabel', {
- defaultMessage: 'Open add rule flyout',
- }),
- toggleMonitorStatusContent: i18n.translate('xpack.synthetics.toggleAlertButton.content', {
- defaultMessage: 'Monitor status rule',
- }),
- navigateToAlertingUIAriaLabel: i18n.translate('xpack.synthetics.navigateToAlertingUi', {
- defaultMessage: 'Leave Uptime and go to Alerting Management page',
- }),
- navigateToAlertingButtonContent: i18n.translate(
- 'xpack.synthetics.navigateToAlertingButton.content',
- {
- defaultMessage: 'Manage rules',
- }
- ),
- toggleAlertFlyoutButtonLabel: i18n.translate('xpack.synthetics.alerts.createRulesPanel.title', {
- defaultMessage: 'Create rules',
- }),
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/filter_group/labels.ts b/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/filter_group/labels.ts
deleted file mode 100644
index e1cf5e20e14c3..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/overview/filter_group/labels.ts
+++ /dev/null
@@ -1,24 +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';
-
-export const filterLabels = {
- LOCATION: i18n.translate('xpack.synthetics.filterBar.options.location.name', {
- defaultMessage: 'Location',
- }),
-
- PORT: i18n.translate('xpack.synthetics.filterBar.options.portLabel', { defaultMessage: 'Port' }),
-
- SCHEME: i18n.translate('xpack.synthetics.filterBar.options.schemeLabel', {
- defaultMessage: 'Scheme',
- }),
-
- TAG: i18n.translate('xpack.synthetics.filterBar.options.tagsLabel', {
- defaultMessage: 'Tag',
- }),
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/index.ts
index a7df47d7a0f71..15079dc68823b 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/index.ts
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/index.ts
@@ -6,9 +6,8 @@
*/
export * from './use_url_params';
-export * from './use_filter_update';
export * from './use_breadcrumbs';
export * from './use_telemetry';
-export * from './use_breakpoints';
+export * from '../../../hooks/use_breakpoints';
export * from './use_service_allowed';
export * from './use_no_data_config';
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.test.ts b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.test.ts
deleted file mode 100644
index da3a25a5fc9df..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.test.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import { addUpdatedField } from './use_filter_update';
-
-describe('useFilterUpdate', () => {
- describe('addUpdatedField', () => {
- it('conditionally adds fields if they are new', () => {
- const testVal = {};
- addUpdatedField('a val', 'newField', 'a new val', testVal);
- expect(testVal).toEqual({
- newField: 'a new val',
- });
- });
-
- it('will add a field if the value is the same but not the default', () => {
- const testVal = {};
- addUpdatedField('a val', 'newField', 'a val', testVal);
- expect(testVal).toEqual({ newField: 'a val' });
- });
-
- it(`won't add a field if the current value is empty`, () => {
- const testVal = {};
- addUpdatedField('', 'newField', '', testVal);
- expect(testVal).toEqual({});
- });
- });
-});
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.ts b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.ts
deleted file mode 100644
index 5578230ab2cf0..0000000000000
--- a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_filter_update.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-import { useEffect } from 'react';
-import { useUrlParams } from './use_url_params';
-
-export const parseFiltersMap = (currentFilters: string): Map => {
- try {
- return new Map(JSON.parse(currentFilters));
- } catch {
- return new Map();
- }
-};
-
-const getUpdateFilters = (
- filterKueries: Map,
- fieldName: string,
- values?: string[]
-): string => {
- // add new term to filter map, toggle it off if already present
- const updatedFilterMap = new Map(filterKueries);
- updatedFilterMap.set(fieldName, values ?? []);
- updatedFilterMap.forEach((value, key) => {
- if (typeof value !== 'undefined' && value.length === 0) {
- updatedFilterMap.delete(key);
- }
- });
-
- // store the new set of filters
- const persistedFilters = Array.from(updatedFilterMap);
- return persistedFilters.length === 0 ? '' : JSON.stringify(persistedFilters);
-};
-
-export function addUpdatedField(
- current: string,
- key: string,
- updated: string,
- objToUpdate: { [key: string]: string }
-): void {
- if (current !== updated || current !== '') {
- objToUpdate[key] = updated;
- }
-}
-
-export const useFilterUpdate = (
- fieldName: string,
- values: string[],
- notValues: string[],
- shouldUpdateUrl: boolean = true
-) => {
- const [getUrlParams, updateUrl] = useUrlParams();
-
- const { filters, excludedFilters } = getUrlParams();
-
- useEffect(() => {
- const currentFiltersMap: Map = parseFiltersMap(filters);
- const currentExclusionsMap: Map = parseFiltersMap(excludedFilters);
- const newFiltersString = getUpdateFilters(currentFiltersMap, fieldName, values);
- const newExclusionsString = getUpdateFilters(currentExclusionsMap, fieldName, notValues);
-
- const update: { [key: string]: string } = {};
-
- addUpdatedField(filters, 'filters', newFiltersString, update);
- addUpdatedField(excludedFilters, 'excludedFilters', newExclusionsString, update);
-
- if (shouldUpdateUrl && Object.keys(update).length > 0) {
- // reset pagination whenever filters change
- updateUrl({ ...update, pagination: '' });
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [fieldName, values, notValues]);
-};
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_telemetry.ts b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_telemetry.ts
index f97e4c4b2be09..64ecabaff5d5a 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_telemetry.ts
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_telemetry.ts
@@ -7,7 +7,7 @@
import { useEffect } from 'react';
import { useGetUrlParams } from './use_url_params';
-import { apiService } from '../utils/api_service';
+import { apiService } from '../../../utils/api_service';
// import { API_URLS } from '../../../common/constants';
export enum SyntheticsPage {
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/routes.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/routes.tsx
index d20c390c84b59..7f04b3992885b 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/routes.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/routes.tsx
@@ -23,7 +23,7 @@ import {
OVERVIEW_ROUTE,
} from '../../../common/constants';
import { MonitorManagementPage } from './components/monitor_management/monitor_management_page';
-import { apiService } from './utils/api_service';
+import { apiService } from '../../utils/api_service';
import { SyntheticsPage, useSyntheticsTelemetry } from './hooks/use_telemetry';
type RouteProps = {
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/api.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/api.ts
index f2d5e326ba2ab..ba6ded899f9c4 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/api.ts
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/api.ts
@@ -7,7 +7,7 @@
import { API_URLS } from '../../../../../common/constants';
import { StatesIndexStatus, StatesIndexStatusType } from '../../../../../common/runtime_types';
-import { apiService } from '../../utils/api_service';
+import { apiService } from '../../../../utils/api_service';
export const fetchIndexStatus = async (): Promise => {
return await apiService.get(API_URLS.INDEX_STATUS, undefined, StatesIndexStatusType);
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/synthetics_app.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/synthetics_app.tsx
index 614f77ddff5d7..07fb3604abd42 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/synthetics_app.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/synthetics_app.tsx
@@ -17,7 +17,6 @@ import {
} from '@kbn/kibana-react-plugin/public';
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
import { InspectorContextProvider } from '@kbn/observability-plugin/public';
-import { SyntheticsAlertsFlyoutWrapper } from './components/overview/alerts/alerts_containers/synthetics_alerts_flyout_wrapper';
import { SyntheticsAppProps } from './contexts';
import {
@@ -30,7 +29,7 @@ import {
import { PageRouter } from './routes';
import { store, storage, setBasePath } from './state';
-import { kibanaService } from './utils/kibana_service';
+import { kibanaService } from '../../utils/kibana_service';
import { ActionMenu } from './components/common/header/action_menu';
const Application = (props: SyntheticsAppProps) => {
@@ -99,7 +98,6 @@ const Application = (props: SyntheticsAppProps) => {
application={core.application}
>
-
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/rtl_helpers.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/rtl_helpers.tsx
index 51c186c352a5b..71d86cc53a76b 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/rtl_helpers.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/rtl_helpers.tsx
@@ -36,7 +36,7 @@ import {
SyntheticsRefreshContextProvider,
SyntheticsStartupPluginsContextProvider,
} from '../../contexts';
-import { kibanaService } from '../kibana_service';
+import { kibanaService } from '../../../../utils/kibana_service';
type DeepPartial = {
[P in keyof T]?: DeepPartial;
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_breakpoints.test.ts b/x-pack/plugins/synthetics/public/hooks/use_breakpoints.test.ts
similarity index 100%
rename from x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_breakpoints.test.ts
rename to x-pack/plugins/synthetics/public/hooks/use_breakpoints.test.ts
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_breakpoints.ts b/x-pack/plugins/synthetics/public/hooks/use_breakpoints.ts
similarity index 100%
rename from x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_breakpoints.ts
rename to x-pack/plugins/synthetics/public/hooks/use_breakpoints.ts
diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx
index 57ae3a6514505..4efaf26a7ac11 100644
--- a/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx
+++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.test.tsx
@@ -11,9 +11,9 @@ import 'jest-styled-components';
import { render } from '../lib/helper/rtl_helpers';
import { UptimePageTemplateComponent } from './uptime_page_template';
import { OVERVIEW_ROUTE } from '../../../common/constants';
-import { useBreakpoints } from '../../apps/synthetics/hooks/use_breakpoints';
+import { useBreakpoints } from '../../hooks/use_breakpoints';
-jest.mock('../../apps/synthetics/hooks/use_breakpoints', () => {
+jest.mock('../../hooks/use_breakpoints', () => {
const down = jest.fn().mockReturnValue(false);
return {
useBreakpoints: () => ({ down }),
diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx
index ade54e1e6f61a..fa3ad7e0805e8 100644
--- a/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx
+++ b/x-pack/plugins/synthetics/public/legacy_uptime/app/uptime_page_template.tsx
@@ -16,7 +16,7 @@ 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';
import { useHasData } from '../components/overview/empty_state/use_has_data';
-import { useBreakpoints } from '../../apps/synthetics/hooks/use_breakpoints';
+import { useBreakpoints } from '../../hooks/use_breakpoints';
interface Props {
path: string;
diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/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
index 0e4d03e3ce438..73996c4e3a1b7 100644
--- a/x-pack/plugins/synthetics/public/legacy_uptime/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
@@ -10,7 +10,7 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiText, useEuiTheme } from
import { euiStyled } from '@kbn/kibana-react-plugin/common';
import { ScreenshotRefImageData } from '../../../../../../../common/runtime_types';
-import { useBreakpoints } from '../../../../../../apps/synthetics/hooks/use_breakpoints';
+import { useBreakpoints } from '../../../../../../hooks/use_breakpoints';
import { nextAriaLabel, prevAriaLabel } from './translations';
diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx
index 0c1d56be587a4..4b9374e991e6b 100644
--- a/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx
+++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/monitor_management/monitor_list/monitor_list.tsx
@@ -27,7 +27,7 @@ import {
TCPSimpleFields,
} from '../../../../../common/runtime_types';
import { UptimeSettingsContext } from '../../../contexts';
-import { useBreakpoints } from '../../../../apps/synthetics/hooks/use_breakpoints';
+import { useBreakpoints } from '../../../../hooks/use_breakpoints';
import { MonitorManagementList as MonitorManagementListState } from '../../../state/reducers/monitor_management';
import * as labels from '../../overview/monitor_list/translations';
import { Actions } from './actions';
diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx
index c09da77a6f559..f9d98b7b640c6 100644
--- a/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx
+++ b/x-pack/plugins/synthetics/public/legacy_uptime/pages/synthetics/checks_navigation.tsx
@@ -12,7 +12,7 @@ import { useHistory } from 'react-router-dom';
import moment from 'moment';
import { SyntheticsJourneyApiResponse } from '../../../../common/runtime_types/ping';
import { getShortTimeStamp } from '../../components/overview/monitor_list/columns/monitor_status_column';
-import { useBreakpoints } from '../../../apps/synthetics/hooks/use_breakpoints';
+import { useBreakpoints } from '../../../hooks/use_breakpoints';
interface Props {
timestamp: string;
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/utils/api_service/api_service.ts b/x-pack/plugins/synthetics/public/utils/api_service/api_service.ts
similarity index 100%
rename from x-pack/plugins/synthetics/public/apps/synthetics/utils/api_service/api_service.ts
rename to x-pack/plugins/synthetics/public/utils/api_service/api_service.ts
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/utils/api_service/index.ts b/x-pack/plugins/synthetics/public/utils/api_service/index.ts
similarity index 100%
rename from x-pack/plugins/synthetics/public/apps/synthetics/utils/api_service/index.ts
rename to x-pack/plugins/synthetics/public/utils/api_service/index.ts
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/utils/kibana_service/index.ts b/x-pack/plugins/synthetics/public/utils/kibana_service/index.ts
similarity index 100%
rename from x-pack/plugins/synthetics/public/apps/synthetics/utils/kibana_service/index.ts
rename to x-pack/plugins/synthetics/public/utils/kibana_service/index.ts
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/utils/kibana_service/kibana_service.ts b/x-pack/plugins/synthetics/public/utils/kibana_service/kibana_service.ts
similarity index 100%
rename from x-pack/plugins/synthetics/public/apps/synthetics/utils/kibana_service/kibana_service.ts
rename to x-pack/plugins/synthetics/public/utils/kibana_service/kibana_service.ts
From 5351fb4a82391b4c3b1145bbe05c4f1dad55ef88 Mon Sep 17 00:00:00 2001
From: shahzad31
Date: Thu, 5 May 2022 09:39:44 +0200
Subject: [PATCH 3/4] more clean up
---
.../components/common/header/action_menu_content.tsx | 5 -----
1 file changed, 5 deletions(-)
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.tsx
index 6d3d83146a42c..aaf41dc46bcaf 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.tsx
@@ -14,12 +14,9 @@ import { createExploratoryViewUrl } from '@kbn/observability-plugin/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useSyntheticsSettingsContext } from '../../../contexts';
import { useGetUrlParams } from '../../../hooks';
-import { ToggleAlertFlyoutButton } from '../../overview/alerts/alerts_containers/toggle_alert_flyout_button';
import { MONITOR_ROUTE, SETTINGS_ROUTE } from '../../../../../../common/constants';
import { stringifyUrlParams } from '../../../utils/url_params';
import { InspectorHeaderLink } from './inspector_header_link';
-// import { monitorStatusSelector } from '../../../state/selectors';
-// import { ManageMonitorsBtn } from './manage_monitors_btn';
const ADD_DATA_LABEL = i18n.translate('xpack.synthetics.addDataButtonLabel', {
defaultMessage: 'Add data',
@@ -93,8 +90,6 @@ export function ActionMenuContent(): React.ReactElement {
/>
-
-
{ANALYZE_MESSAGE}
}>
Date: Fri, 6 May 2022 16:05:24 +0200
Subject: [PATCH 4/4] udate test
---
.../common/header/action_menu_content.test.tsx | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.test.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.test.tsx
index 3137862025f15..0439eff39d88c 100644
--- a/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.test.tsx
+++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/common/header/action_menu_content.test.tsx
@@ -6,23 +6,10 @@
*/
import React from 'react';
-import { fireEvent, waitFor } from '@testing-library/react';
import { render } from '../../../utils/testing/rtl_helpers';
import { ActionMenuContent } from './action_menu_content';
describe('ActionMenuContent', () => {
- it('renders alerts dropdown', async () => {
- const { getByLabelText, getByText } = render();
-
- const alertsDropdown = getByLabelText('Open alerts and rules context menu');
- fireEvent.click(alertsDropdown);
-
- await waitFor(() => {
- expect(getByText('Create rule'));
- expect(getByText('Manage rules'));
- });
- });
-
it('renders settings link', () => {
const { getByRole, getByText } = render();