diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts index 4fbcb847022e9..eb54a540cb51d 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts @@ -5,20 +5,20 @@ * 2.0. */ -import { setup as watchListSetup } from './watch_list.helpers'; -import { setup as watchStatusSetup } from './watch_status.helpers'; -import { setup as watchCreateJsonSetup } from './watch_create_json.helpers'; -import { setup as watchCreateThresholdSetup } from './watch_create_threshold.helpers'; -import { setup as watchEditSetup } from './watch_edit.helpers'; +import { setup as watchListPageSetup } from './watch_list_page.helpers'; +import { setup as watchStatusPageSetup } from './watch_status_page.helpers'; +import { setup as watchCreateJsonPageSetup } from './watch_create_json_page.helpers'; +import { setup as watchCreateThresholdPageSetup } from './watch_create_threshold_page.helpers'; +import { setup as watchEditPageSetup } from './watch_edit_page.helpers'; export type { TestBed } from '@kbn/test-jest-helpers'; export { getRandomString, findTestSubject } from '@kbn/test-jest-helpers'; export { setupEnvironment } from './setup_environment'; export const pageHelpers = { - watchList: { setup: watchListSetup }, - watchStatus: { setup: watchStatusSetup }, - watchCreateJson: { setup: watchCreateJsonSetup }, - watchCreateThreshold: { setup: watchCreateThresholdSetup }, - watchEdit: { setup: watchEditSetup }, + watchListPage: { setup: watchListPageSetup }, + watchStatusPage: { setup: watchStatusPageSetup }, + watchCreateJsonPage: { setup: watchCreateJsonPageSetup }, + watchCreateThresholdPage: { setup: watchCreateThresholdPageSetup }, + watchEditPage: { setup: watchEditPageSetup }, }; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json_page.helpers.ts similarity index 94% rename from x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts rename to x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json_page.helpers.ts index 8af924c807372..c526ed75beb71 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json_page.helpers.ts @@ -8,7 +8,7 @@ import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { HttpSetup } from '@kbn/core/public'; -import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; +import { WatchEditPage } from '../../../public/application/sections/watch_edit_page'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; import { WithAppDependencies } from './setup_environment'; @@ -31,7 +31,7 @@ export interface WatchCreateJsonTestBed extends TestBed => { - const initTestBed = registerTestBed(WithAppDependencies(WatchEdit, httpSetup), testBedConfig); + const initTestBed = registerTestBed(WithAppDependencies(WatchEditPage, httpSetup), testBedConfig); const testBed = await initTestBed(); /** diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold_page.helpers.ts similarity index 95% rename from x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts rename to x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold_page.helpers.ts index a4b7cce96ae03..d2bb49a861167 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold_page.helpers.ts @@ -8,7 +8,7 @@ import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { HttpSetup } from '@kbn/core/public'; -import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; +import { WatchEditPage } from '../../../public/application/sections/watch_edit_page'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; import { WithAppDependencies } from './setup_environment'; @@ -34,7 +34,7 @@ export interface WatchCreateThresholdTestBed extends TestBed => { - const initTestBed = registerTestBed(WithAppDependencies(WatchEdit, httpSetup), testBedConfig); + const initTestBed = registerTestBed(WithAppDependencies(WatchEditPage, httpSetup), testBedConfig); const testBed = await initTestBed(); /** diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit_page.helpers.ts similarity index 92% rename from x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts rename to x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit_page.helpers.ts index 22fc71c8d4636..cbda9eb293a70 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit_page.helpers.ts @@ -8,7 +8,7 @@ import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers'; import { HttpSetup } from '@kbn/core/public'; -import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; +import { WatchEditPage } from '../../../public/application/sections/watch_edit_page'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; @@ -30,7 +30,7 @@ export interface WatchEditTestBed extends TestBed { } export const setup = async (httpSetup: HttpSetup): Promise => { - const initTestBed = registerTestBed(WithAppDependencies(WatchEdit, httpSetup), testBedConfig); + const initTestBed = registerTestBed(WithAppDependencies(WatchEditPage, httpSetup), testBedConfig); const testBed = await initTestBed(); /** diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list_page.helpers.ts similarity index 95% rename from x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts rename to x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list_page.helpers.ts index 1da9ad7f23156..fad3898d4e605 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list_page.helpers.ts @@ -14,7 +14,7 @@ import { AsyncTestBedConfig, } from '@kbn/test-jest-helpers'; import { HttpSetup } from '@kbn/core/public'; -import { WatchList } from '../../../public/application/sections/watch_list/components/watch_list'; +import { WatchListPage } from '../../../public/application/sections/watch_list_page'; import { ROUTES, REFRESH_INTERVALS } from '../../../common/constants'; import { WithAppDependencies } from './setup_environment'; @@ -35,7 +35,7 @@ export interface WatchListTestBed extends TestBed { } export const setup = async (httpSetup: HttpSetup): Promise => { - const initTestBed = registerTestBed(WithAppDependencies(WatchList, httpSetup), testBedConfig); + const initTestBed = registerTestBed(WithAppDependencies(WatchListPage, httpSetup), testBedConfig); const testBed = await initTestBed(); /** diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status_page.helpers.ts similarity index 95% rename from x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts rename to x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status_page.helpers.ts index 99e1cf936d1d7..601857ca941f0 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status_page.helpers.ts @@ -16,7 +16,7 @@ import { import { HttpSetup } from '@kbn/core/public'; import { registerRouter } from '../../../public/application/lib/navigation'; -import { WatchStatus } from '../../../public/application/sections/watch_status/components/watch_status'; +import { WatchStatusPage } from '../../../public/application/sections/watch_status_page'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; import { WithAppDependencies } from './setup_environment'; @@ -41,7 +41,10 @@ export interface WatchStatusTestBed extends TestBed { } export const setup = async (httpSetup: HttpSetup): Promise => { - const initTestBed = registerTestBed(WithAppDependencies(WatchStatus, httpSetup), testBedConfig); + const initTestBed = registerTestBed( + WithAppDependencies(WatchStatusPage, httpSetup), + testBedConfig + ); const testBed = await initTestBed(); /** diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_create_json.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_create_json_page.test.ts similarity index 97% rename from x-pack/plugins/watcher/__jest__/client_integration/watch_create_json.test.ts rename to x-pack/plugins/watcher/__jest__/client_integration/watch_create_json_page.test.ts index fc518bcab882b..54352e278770b 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_create_json.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_create_json_page.test.ts @@ -11,12 +11,12 @@ import { getExecuteDetails } from '../../__fixtures__'; import { API_BASE_PATH } from '../../common/constants'; import { defaultWatch } from '../../public/application/models/watch'; import { setupEnvironment, pageHelpers } from './helpers'; -import { WatchCreateJsonTestBed } from './helpers/watch_create_json.helpers'; +import type { WatchCreateJsonTestBed } from './helpers/watch_create_json_page.helpers'; import { WATCH } from './helpers/jest_constants'; -const { setup } = pageHelpers.watchCreateJson; +const { setup } = pageHelpers.watchCreateJsonPage; -describe(' create route', () => { +describe(' create route', () => { const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); let testBed: WatchCreateJsonTestBed; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx b/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold_page.test.tsx similarity index 99% rename from x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx rename to x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold_page.test.tsx index 73b51f0ddbb89..4fe5fb3445da8 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold_page.test.tsx @@ -13,7 +13,7 @@ import { WATCH_ID } from './helpers/jest_constants'; import { getExecuteDetails } from '../../__fixtures__'; import { WATCH_TYPES, API_BASE_PATH } from '../../common/constants'; import { setupEnvironment, pageHelpers } from './helpers'; -import { WatchCreateThresholdTestBed } from './helpers/watch_create_threshold.helpers'; +import type { WatchCreateThresholdTestBed } from './helpers/watch_create_threshold_page.helpers'; const WATCH_NAME = 'my_test_watch'; @@ -77,9 +77,9 @@ jest.mock('@elastic/eui', () => { }; }); -const { setup } = pageHelpers.watchCreateThreshold; +const { setup } = pageHelpers.watchCreateThresholdPage; -describe(' create route', () => { +describe(' create route', () => { const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); let testBed: WatchCreateThresholdTestBed; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit_page.test.ts similarity index 97% rename from x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts rename to x-pack/plugins/watcher/__jest__/client_integration/watch_edit_page.test.ts index 8b0ee0189695b..f57dcb6788fe1 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit_page.test.ts @@ -10,13 +10,13 @@ import { act } from 'react-dom/test-utils'; import { getWatch } from '../../__fixtures__'; import { defaultWatch } from '../../public/application/models/watch'; import { setupEnvironment, pageHelpers } from './helpers'; -import { WatchEditTestBed } from './helpers/watch_edit.helpers'; +import type { WatchEditTestBed } from './helpers/watch_edit_page.helpers'; import { WATCH, WATCH_ID } from './helpers/jest_constants'; import { API_BASE_PATH } from '../../common/constants'; -const { setup } = pageHelpers.watchEdit; +const { setup } = pageHelpers.watchEditPage; -describe('', () => { +describe('', () => { const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); let testBed: WatchEditTestBed; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_list.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_list_page.test.ts similarity index 98% rename from x-pack/plugins/watcher/__jest__/client_integration/watch_list.test.ts rename to x-pack/plugins/watcher/__jest__/client_integration/watch_list_page.test.ts index ac1e7291b187a..3dda2d81b3800 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_list.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_list_page.test.ts @@ -8,12 +8,12 @@ import { act } from 'react-dom/test-utils'; import * as fixtures from '../../__fixtures__'; import { setupEnvironment, pageHelpers, getRandomString, findTestSubject } from './helpers'; -import { WatchListTestBed } from './helpers/watch_list.helpers'; +import type { WatchListTestBed } from './helpers/watch_list_page.helpers'; import { API_BASE_PATH } from '../../common/constants'; -const { setup } = pageHelpers.watchList; +const { setup } = pageHelpers.watchListPage; -describe('', () => { +describe('', () => { const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); let testBed: WatchListTestBed; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_status.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_status_page.test.ts similarity index 98% rename from x-pack/plugins/watcher/__jest__/client_integration/watch_status.test.ts rename to x-pack/plugins/watcher/__jest__/client_integration/watch_status_page.test.ts index 901ebf156911f..bc7784f912fc1 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_status.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_status_page.test.ts @@ -10,11 +10,11 @@ import moment from 'moment'; import { getWatchHistory } from '../../__fixtures__'; import { WATCH_STATES, ACTION_STATES } from '../../common/constants'; import { setupEnvironment, pageHelpers } from './helpers'; -import { WatchStatusTestBed } from './helpers/watch_status.helpers'; +import type { WatchStatusTestBed } from './helpers/watch_status_page.helpers'; import { WATCH, WATCH_ID } from './helpers/jest_constants'; import { API_BASE_PATH } from '../../common/constants'; -const { setup } = pageHelpers.watchStatus; +const { setup } = pageHelpers.watchStatusPage; const watchHistory1 = getWatchHistory({ startTime: '2019-06-04T01:11:11.294' }); const watchHistory2 = getWatchHistory({ startTime: '2019-06-04T01:10:10.987Z' }); @@ -38,7 +38,7 @@ const watch = { }, }; -describe('', () => { +describe('', () => { const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); let testBed: WatchStatusTestBed; diff --git a/x-pack/plugins/watcher/public/application/app.tsx b/x-pack/plugins/watcher/public/application/app.tsx index ab7f1df69f3b7..36371efc98383 100644 --- a/x-pack/plugins/watcher/public/application/app.tsx +++ b/x-pack/plugins/watcher/public/application/app.tsx @@ -26,9 +26,7 @@ import { RegisterManagementAppArgs, ManagementAppMountParams } from '@kbn/manage import { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import { LicenseStatus } from '../../common/types/license_status'; -import { WatchStatus } from './sections/watch_status/components/watch_status'; -import { WatchEdit } from './sections/watch_edit/components/watch_edit'; -import { WatchList } from './sections/watch_list/components/watch_list'; +import { WatchListPage, WatchEditPage, WatchStatusPage } from './sections'; import { registerRouter } from './lib/navigation'; import { AppContextProvider } from './app_context'; import { useExecutionContext } from './shared_imports'; @@ -107,10 +105,10 @@ export const App = (deps: AppDeps) => { // Export this so we can test it with a different router. export const AppWithoutRouter = () => ( - - - - + + + + diff --git a/x-pack/plugins/watcher/public/application/sections/index.ts b/x-pack/plugins/watcher/public/application/sections/index.ts new file mode 100644 index 0000000000000..abea90ac6b5a0 --- /dev/null +++ b/x-pack/plugins/watcher/public/application/sections/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { WatchStatusPage } from './watch_status_page'; +export { WatchEditPage } from './watch_edit_page'; +export { WatchListPage } from './watch_list_page'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/index.ts new file mode 100644 index 0000000000000..b8267592014fb --- /dev/null +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { JsonWatchEdit } from './json_watch_edit'; +export { MonitoringWatchEdit } from './monitoring_watch_edit'; +export { ThresholdWatchEdit } from './threshold_watch_edit'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/index.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/index.ts rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/index.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_form.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit_form.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_form.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit_form.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit_simulate.tsx similarity index 99% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit_simulate.tsx index 788d374df4aba..9e2fa3f35b50f 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit_simulate.tsx @@ -39,7 +39,7 @@ import { import { ErrableFormRow } from '../../../../components'; import { executeWatch } from '../../../../lib/api'; import { WatchContext } from '../../watch_context'; -import { JsonWatchEditSimulateResults } from './json_watch_edit_simulate_results'; +import { SimulateWatchResultsFlyout } from './simulate_watch_results_flyout'; import { getTimeUnitLabel } from '../../../../lib/get_time_unit_label'; import { useAppContext } from '../../../../app_context'; @@ -150,15 +150,6 @@ export const JsonWatchEditSimulate = ({ return ( - { - setExecuteResults(null); - setExecuteResultsError(null); - }} - />

{i18n.translate('xpack.watcher.sections.watchEdit.simulate.pageDescription', { @@ -429,6 +420,16 @@ export const JsonWatchEditSimulate = ({ })} + + { + setExecuteResults(null); + setExecuteResultsError(null); + }} + /> ); }; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate_results.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/simulate_watch_results_flyout.tsx similarity index 99% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate_results.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/simulate_watch_results_flyout.tsx index c96070b076e1a..4383176fb88fc 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate_results.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/simulate_watch_results_flyout.tsx @@ -27,7 +27,7 @@ import { getTypeFromAction } from '../../watch_edit_actions'; import { WatchContext } from '../../watch_context'; import { WatchStatus, SectionError } from '../../../../components'; -export const JsonWatchEditSimulateResults = ({ +export const SimulateWatchResultsFlyout = ({ executeResults, executeDetails, onCloseFlyout, diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/monitoring_watch_edit/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/index.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/monitoring_watch_edit/index.ts rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/index.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/monitoring_watch_edit/monitoring_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/monitoring_watch_edit.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/monitoring_watch_edit/monitoring_watch_edit.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/monitoring_watch_edit.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/request_flyout.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/request_flyout.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/request_flyout.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/request_flyout.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/email_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/email_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/email_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/index.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/index.ts rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/index.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/index_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/index_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/index_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/index_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/jira_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/jira_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/jira_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/jira_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/logging_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/logging_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/logging_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/logging_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/pagerduty_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/pagerduty_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/pagerduty_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/pagerduty_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/slack_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/slack_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/slack_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/slack_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/index.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/index.ts rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/index.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_action_accordion.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_action_accordion.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_action_accordion.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_action_accordion.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_action_dropdown.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_action_dropdown.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_action_dropdown.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_action_dropdown.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_action_panel.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_action_panel.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_action_panel.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_action_panel.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_edit.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_edit.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/watch_visualization.tsx similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/watch_visualization.tsx diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/index.ts new file mode 100644 index 0000000000000..6dd89f80810df --- /dev/null +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { WatchEditPage } from './watch_edit_page'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/watch_context.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_context.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/watch_context.ts rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_context.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/watch_edit_actions.ts b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_actions.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/watch_edit_actions.ts rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_actions.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx similarity index 87% rename from x-pack/plugins/watcher/public/application/sections/watch_edit/components/watch_edit.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx index 363060fbfb96c..75fd085ed7272 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/watch_edit.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx @@ -12,18 +12,16 @@ import { EuiPageContent } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { WATCH_TYPES } from '../../../../../common/constants'; -import { BaseWatch } from '../../../../../common/types/watch_types'; -import { getPageErrorCode, PageError, SectionLoading } from '../../../components'; -import { loadWatch } from '../../../lib/api'; -import { listBreadcrumb, editBreadcrumb, createBreadcrumb } from '../../../lib/breadcrumbs'; -import { useAppContext } from '../../../app_context'; -import { Watch } from '../../../models/watch'; -import { PageError as GenericPageError } from '../../../shared_imports'; -import { WatchContext } from '../watch_context'; -import { JsonWatchEdit } from './json_watch_edit'; -import { ThresholdWatchEdit } from './threshold_watch_edit'; -import { MonitoringWatchEdit } from './monitoring_watch_edit'; +import { WATCH_TYPES } from '../../../../common/constants'; +import { BaseWatch } from '../../../../common/types/watch_types'; +import { getPageErrorCode, PageError, SectionLoading } from '../../components'; +import { loadWatch } from '../../lib/api'; +import { listBreadcrumb, editBreadcrumb, createBreadcrumb } from '../../lib/breadcrumbs'; +import { useAppContext } from '../../app_context'; +import { Watch } from '../../models/watch'; +import { PageError as GenericPageError } from '../../shared_imports'; +import { WatchContext } from './watch_context'; +import { JsonWatchEdit, ThresholdWatchEdit, MonitoringWatchEdit } from './components'; const getTitle = (watch: BaseWatch) => { if (watch.isNew) { @@ -85,7 +83,7 @@ const watchReducer = (state: any, action: any) => { } }; -export const WatchEdit = ({ +export const WatchEditPage = ({ match: { params: { id, type }, }, diff --git a/x-pack/plugins/watcher/public/application/sections/watch_list_page/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_list_page/index.ts new file mode 100644 index 0000000000000..2301d9428c795 --- /dev/null +++ b/x-pack/plugins/watcher/public/application/sections/watch_list_page/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { WatchListPage } from './watch_list_page'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_list/components/watch_list.tsx b/x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx similarity index 97% rename from x-pack/plugins/watcher/public/application/sections/watch_list/components/watch_list.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx index 542196fb517fb..19fd1f536125f 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_list/components/watch_list.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx @@ -30,8 +30,8 @@ import { Moment } from 'moment'; import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public'; -import { REFRESH_INTERVALS, PAGINATION, WATCH_TYPES } from '../../../../../common/constants'; -import { listBreadcrumb } from '../../../lib/breadcrumbs'; +import { REFRESH_INTERVALS, PAGINATION, WATCH_TYPES } from '../../../../common/constants'; +import { listBreadcrumb } from '../../lib/breadcrumbs'; import { getPageErrorCode, PageError, @@ -39,13 +39,13 @@ import { WatchStatus, SectionLoading, Error, -} from '../../../components'; -import { useLoadWatches } from '../../../lib/api'; -import { goToCreateThresholdAlert, goToCreateAdvancedWatch } from '../../../lib/navigation'; -import { useAppContext } from '../../../app_context'; -import { PageError as GenericPageError } from '../../../shared_imports'; +} from '../../components'; +import { useLoadWatches } from '../../lib/api'; +import { goToCreateThresholdAlert, goToCreateAdvancedWatch } from '../../lib/navigation'; +import { useAppContext } from '../../app_context'; +import { PageError as GenericPageError } from '../../shared_imports'; -export const WatchList = () => { +export const WatchListPage = () => { // hooks const { setBreadcrumbs, diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_detail.tsx b/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/action_statuses_panel.tsx similarity index 99% rename from x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_detail.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_status_page/components/action_statuses_panel.tsx index 90042ee85ad95..df5ce20f3cdcf 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_detail.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/action_statuses_panel.tsx @@ -36,7 +36,7 @@ interface ActionStatus { errors: ActionError[]; } -export const WatchDetail = () => { +export const ActionStatusesPanel = () => { const { toasts } = useAppContext(); const { watchDetail } = useContext(WatchDetailsContext); diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_history.tsx b/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/execution_history_panel.tsx similarity index 99% rename from x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_history.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_status_page/components/execution_history_panel.tsx index ba591b7da5357..1e618061cce8b 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_history.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/execution_history_panel.tsx @@ -68,7 +68,7 @@ const watchHistoryTimeSpanOptions = [ }, ]; -export const WatchHistory = () => { +export const ExecutionHistoryPanel = () => { const { watchDetail: loadedWatch } = useContext(WatchDetailsContext); const [isActivated, setIsActivated] = useState(undefined); diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/index.ts new file mode 100644 index 0000000000000..8178ac23d9473 --- /dev/null +++ b/x-pack/plugins/watcher/public/application/sections/watch_status_page/components/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { ActionStatusesPanel } from './action_statuses_panel'; +export { ExecutionHistoryPanel } from './execution_history_panel'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status_page/index.ts b/x-pack/plugins/watcher/public/application/sections/watch_status_page/index.ts new file mode 100644 index 0000000000000..7bb821a2bb690 --- /dev/null +++ b/x-pack/plugins/watcher/public/application/sections/watch_status_page/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { WatchStatusPage } from './watch_status_page'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status/watch_details_context.ts b/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_details_context.ts similarity index 100% rename from x-pack/plugins/watcher/public/application/sections/watch_status/watch_details_context.ts rename to x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_details_context.ts diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_status.tsx b/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx similarity index 87% rename from x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_status.tsx rename to x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx index 0d1c4663ed39f..e72a2bd82d812 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_status/components/watch_status.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx @@ -16,44 +16,37 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { WatchDetail } from './watch_detail'; -import { WatchHistory } from './watch_history'; -import { listBreadcrumb, statusBreadcrumb } from '../../../lib/breadcrumbs'; -import { useLoadWatchDetail, deactivateWatch, activateWatch } from '../../../lib/api'; -import { WatchDetailsContext } from '../watch_details_context'; -import { - getPageErrorCode, - PageError, - SectionLoading, - DeleteWatchesModal, -} from '../../../components'; -import { goToWatchList } from '../../../lib/navigation'; -import { useAppContext } from '../../../app_context'; + +import { listBreadcrumb, statusBreadcrumb } from '../../lib/breadcrumbs'; +import { useLoadWatchDetail, deactivateWatch, activateWatch } from '../../lib/api'; +import { goToWatchList } from '../../lib/navigation'; +import { useAppContext } from '../../app_context'; +import { getPageErrorCode, PageError, SectionLoading, DeleteWatchesModal } from '../../components'; + +import { ActionStatusesPanel, ExecutionHistoryPanel } from './components'; +import { WatchDetailsContext } from './watch_details_context'; interface WatchStatusTab { - id: string; + id: 'executionHistoryTab' | 'actionStatusesTab'; name: string; } -const WATCH_EXECUTION_HISTORY_TAB = 'watchExecutionHistoryTab'; -const WATCH_ACTIONS_TAB = 'watchActionsTab'; - -const WATCH_STATUS_TABS: WatchStatusTab[] = [ +const TABS: WatchStatusTab[] = [ { - id: WATCH_EXECUTION_HISTORY_TAB, + id: 'executionHistoryTab', name: i18n.translate('xpack.watcher.sections.watchStatus.executionHistoryTabLabel', { defaultMessage: 'Execution history', }), }, { - id: WATCH_ACTIONS_TAB, + id: 'actionStatusesTab', name: i18n.translate('xpack.watcher.sections.watchStatus.actionsTabLabel', { defaultMessage: 'Action statuses', }), }, ]; -export const WatchStatus = ({ +export const WatchStatusPage = ({ match: { params: { id }, }, @@ -71,7 +64,7 @@ export const WatchStatus = ({ isLoading: isWatchDetailLoading, } = useLoadWatchDetail(id); - const [selectedTab, setSelectedTab] = useState(WATCH_EXECUTION_HISTORY_TAB); + const [selectedTab, setSelectedTab] = useState('executionHistoryTab'); const [isActivated, setIsActivated] = useState(undefined); const [watchesToDelete, setWatchesToDelete] = useState([]); const [isTogglingActivation, setIsTogglingActivation] = useState(false); @@ -152,6 +145,13 @@ export const WatchStatus = ({ setIsActivated(!isActivated); }; + const selectedPanel = + selectedTab === 'executionHistoryTab' ? ( + + ) : selectedTab === 'actionStatusesTab' ? ( + + ) : undefined; + return ( <> @@ -216,7 +216,7 @@ export const WatchStatus = ({ , ] } - tabs={WATCH_STATUS_TABS.map((tab, index) => ({ + tabs={TABS.map((tab, index) => ({ onClick: () => { setSelectedTab(tab.id); }, @@ -229,7 +229,7 @@ export const WatchStatus = ({ - {selectedTab === WATCH_ACTIONS_TAB ? : } + {selectedPanel} {