>(renameMap, query);
+
if (query.search_fields) {
options.searchFields = Array.isArray(query.search_fields)
? query.search_fields
: [query.search_fields];
}
- if (query.has_reference) {
- options.hasReference = query.has_reference;
- }
-
- const findResult = await alertsClient.find({
- options,
- });
+ const findResult = await alertsClient.find({ options });
return res.ok({
body: findResult,
});
diff --git a/x-pack/plugins/alerting/server/routes/get.test.ts b/x-pack/plugins/alerts/server/routes/get.test.ts
similarity index 97%
rename from x-pack/plugins/alerting/server/routes/get.test.ts
rename to x-pack/plugins/alerts/server/routes/get.test.ts
index 7335f13c85a4d..b11224ff4794e 100644
--- a/x-pack/plugins/alerting/server/routes/get.test.ts
+++ b/x-pack/plugins/alerts/server/routes/get.test.ts
@@ -60,7 +60,7 @@ describe('getAlertRoute', () => {
getAlertRoute(router, licenseState);
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/get.ts b/x-pack/plugins/alerts/server/routes/get.ts
similarity index 96%
rename from x-pack/plugins/alerting/server/routes/get.ts
rename to x-pack/plugins/alerts/server/routes/get.ts
index cd78e7fbacddb..ae9ebe1299371 100644
--- a/x-pack/plugins/alerting/server/routes/get.ts
+++ b/x-pack/plugins/alerts/server/routes/get.ts
@@ -23,7 +23,7 @@ const paramSchema = schema.object({
export const getAlertRoute = (router: IRouter, licenseState: LicenseState) => {
router.get(
{
- path: `${BASE_ALERT_API_PATH}/{id}`,
+ path: `${BASE_ALERT_API_PATH}/alert/{id}`,
validate: {
params: paramSchema,
},
diff --git a/x-pack/plugins/alerting/server/routes/get_alert_state.test.ts b/x-pack/plugins/alerts/server/routes/get_alert_state.test.ts
similarity index 94%
rename from x-pack/plugins/alerting/server/routes/get_alert_state.test.ts
rename to x-pack/plugins/alerts/server/routes/get_alert_state.test.ts
index 20a420ca00986..8c9051093f85b 100644
--- a/x-pack/plugins/alerting/server/routes/get_alert_state.test.ts
+++ b/x-pack/plugins/alerts/server/routes/get_alert_state.test.ts
@@ -47,7 +47,7 @@ describe('getAlertStateRoute', () => {
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}/state"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@@ -90,7 +90,7 @@ describe('getAlertStateRoute', () => {
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}/state"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@@ -133,7 +133,7 @@ describe('getAlertStateRoute', () => {
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}/state"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/get_alert_state.ts b/x-pack/plugins/alerts/server/routes/get_alert_state.ts
similarity index 96%
rename from x-pack/plugins/alerting/server/routes/get_alert_state.ts
rename to x-pack/plugins/alerts/server/routes/get_alert_state.ts
index a5cb14154db67..b27ae3758e1b9 100644
--- a/x-pack/plugins/alerting/server/routes/get_alert_state.ts
+++ b/x-pack/plugins/alerts/server/routes/get_alert_state.ts
@@ -23,7 +23,7 @@ const paramSchema = schema.object({
export const getAlertStateRoute = (router: IRouter, licenseState: LicenseState) => {
router.get(
{
- path: `${BASE_ALERT_API_PATH}/{id}/state`,
+ path: `${BASE_ALERT_API_PATH}/alert/{id}/state`,
validate: {
params: paramSchema,
},
diff --git a/x-pack/plugins/alerting/server/routes/health.test.ts b/x-pack/plugins/alerts/server/routes/health.test.ts
similarity index 99%
rename from x-pack/plugins/alerting/server/routes/health.test.ts
rename to x-pack/plugins/alerts/server/routes/health.test.ts
index 9b1c95c393f56..b3f41e03ebdc9 100644
--- a/x-pack/plugins/alerting/server/routes/health.test.ts
+++ b/x-pack/plugins/alerts/server/routes/health.test.ts
@@ -31,7 +31,7 @@ describe('healthRoute', () => {
const [config] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/_health"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/_health"`);
});
it('queries the usage api', async () => {
diff --git a/x-pack/plugins/alerting/server/routes/health.ts b/x-pack/plugins/alerts/server/routes/health.ts
similarity index 98%
rename from x-pack/plugins/alerting/server/routes/health.ts
rename to x-pack/plugins/alerts/server/routes/health.ts
index fb4c5e76a02c9..b66e28b24e8a7 100644
--- a/x-pack/plugins/alerting/server/routes/health.ts
+++ b/x-pack/plugins/alerts/server/routes/health.ts
@@ -34,7 +34,7 @@ export function healthRoute(
) {
router.get(
{
- path: '/api/alert/_health',
+ path: '/api/alerts/_health',
validate: false,
},
router.handleLegacyErrors(async function (
diff --git a/x-pack/plugins/alerting/server/routes/index.ts b/x-pack/plugins/alerts/server/routes/index.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/routes/index.ts
rename to x-pack/plugins/alerts/server/routes/index.ts
diff --git a/x-pack/plugins/alerting/server/routes/lib/error_handler.ts b/x-pack/plugins/alerts/server/routes/lib/error_handler.ts
similarity index 94%
rename from x-pack/plugins/alerting/server/routes/lib/error_handler.ts
rename to x-pack/plugins/alerts/server/routes/lib/error_handler.ts
index b3cf48c52fe17..e0c620b0670c9 100644
--- a/x-pack/plugins/alerting/server/routes/lib/error_handler.ts
+++ b/x-pack/plugins/alerts/server/routes/lib/error_handler.ts
@@ -27,7 +27,7 @@ export function handleDisabledApiKeysError(
if (isApiKeyDisabledError(e)) {
return response.badRequest({
body: new Error(
- i18n.translate('xpack.alerting.api.error.disabledApiKeys', {
+ i18n.translate('xpack.alerts.api.error.disabledApiKeys', {
defaultMessage: 'Alerting relies upon API keys which appear to be disabled',
})
),
diff --git a/x-pack/plugins/alerts/server/routes/lib/rename_keys.ts b/x-pack/plugins/alerts/server/routes/lib/rename_keys.ts
new file mode 100644
index 0000000000000..bfe60a0ecc648
--- /dev/null
+++ b/x-pack/plugins/alerts/server/routes/lib/rename_keys.ts
@@ -0,0 +1,16 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+export const renameKeys = , U extends Record>(
+ keysMap: Record,
+ obj: Record
+): T =>
+ Object.keys(obj).reduce((acc, key) => {
+ return {
+ ...acc,
+ ...{ [keysMap[key] || key]: obj[key] },
+ };
+ }, {} as T);
diff --git a/x-pack/plugins/alerting/server/routes/list_alert_types.test.ts b/x-pack/plugins/alerts/server/routes/list_alert_types.test.ts
similarity index 94%
rename from x-pack/plugins/alerting/server/routes/list_alert_types.test.ts
rename to x-pack/plugins/alerts/server/routes/list_alert_types.test.ts
index e940b2d102045..3192154f6664c 100644
--- a/x-pack/plugins/alerting/server/routes/list_alert_types.test.ts
+++ b/x-pack/plugins/alerts/server/routes/list_alert_types.test.ts
@@ -27,7 +27,7 @@ describe('listAlertTypesRoute', () => {
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/types"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@@ -89,7 +89,7 @@ describe('listAlertTypesRoute', () => {
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/types"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@@ -140,7 +140,7 @@ describe('listAlertTypesRoute', () => {
const [config, handler] = router.get.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/types"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/list_alert_types.ts b/x-pack/plugins/alerts/server/routes/list_alert_types.ts
similarity index 95%
rename from x-pack/plugins/alerting/server/routes/list_alert_types.ts
rename to x-pack/plugins/alerts/server/routes/list_alert_types.ts
index f5b4e3263f341..51a4558108e29 100644
--- a/x-pack/plugins/alerting/server/routes/list_alert_types.ts
+++ b/x-pack/plugins/alerts/server/routes/list_alert_types.ts
@@ -18,7 +18,7 @@ import { BASE_ALERT_API_PATH } from '../../common';
export const listAlertTypesRoute = (router: IRouter, licenseState: LicenseState) => {
router.get(
{
- path: `${BASE_ALERT_API_PATH}/types`,
+ path: `${BASE_ALERT_API_PATH}/list_alert_types`,
validate: {},
options: {
tags: ['access:alerting-read'],
diff --git a/x-pack/plugins/alerting/server/routes/mute_all.test.ts b/x-pack/plugins/alerts/server/routes/mute_all.test.ts
similarity index 95%
rename from x-pack/plugins/alerting/server/routes/mute_all.test.ts
rename to x-pack/plugins/alerts/server/routes/mute_all.test.ts
index 5ef9e3694f8f4..bcdb8cbd022ac 100644
--- a/x-pack/plugins/alerting/server/routes/mute_all.test.ts
+++ b/x-pack/plugins/alerts/server/routes/mute_all.test.ts
@@ -28,7 +28,7 @@ describe('muteAllAlertRoute', () => {
const [config, handler] = router.post.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}/_mute_all"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_mute_all"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/mute_all.ts b/x-pack/plugins/alerts/server/routes/mute_all.ts
similarity index 96%
rename from x-pack/plugins/alerting/server/routes/mute_all.ts
rename to x-pack/plugins/alerts/server/routes/mute_all.ts
index b43a1ec30ed1f..5b05d7231c385 100644
--- a/x-pack/plugins/alerting/server/routes/mute_all.ts
+++ b/x-pack/plugins/alerts/server/routes/mute_all.ts
@@ -23,7 +23,7 @@ const paramSchema = schema.object({
export const muteAllAlertRoute = (router: IRouter, licenseState: LicenseState) => {
router.post(
{
- path: `${BASE_ALERT_API_PATH}/{id}/_mute_all`,
+ path: `${BASE_ALERT_API_PATH}/alert/{id}/_mute_all`,
validate: {
params: paramSchema,
},
diff --git a/x-pack/plugins/alerting/server/routes/mute_instance.test.ts b/x-pack/plugins/alerts/server/routes/mute_instance.test.ts
similarity index 92%
rename from x-pack/plugins/alerting/server/routes/mute_instance.test.ts
rename to x-pack/plugins/alerts/server/routes/mute_instance.test.ts
index 2e6adedb76df9..c382c12de21cd 100644
--- a/x-pack/plugins/alerting/server/routes/mute_instance.test.ts
+++ b/x-pack/plugins/alerts/server/routes/mute_instance.test.ts
@@ -29,7 +29,7 @@ describe('muteAlertInstanceRoute', () => {
const [config, handler] = router.post.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(
- `"/api/alert/{alertId}/alert_instance/{alertInstanceId}/_mute"`
+ `"/api/alerts/alert/{alert_id}/alert_instance/{alert_instance_id}/_mute"`
);
expect(config.options).toMatchInlineSnapshot(`
Object {
@@ -45,8 +45,8 @@ describe('muteAlertInstanceRoute', () => {
{ alertsClient },
{
params: {
- alertId: '1',
- alertInstanceId: '2',
+ alert_id: '1',
+ alert_instance_id: '2',
},
},
['noContent']
diff --git a/x-pack/plugins/alerting/server/routes/mute_instance.ts b/x-pack/plugins/alerts/server/routes/mute_instance.ts
similarity index 72%
rename from x-pack/plugins/alerting/server/routes/mute_instance.ts
rename to x-pack/plugins/alerts/server/routes/mute_instance.ts
index c0c69fe9653da..00550f4af3418 100644
--- a/x-pack/plugins/alerting/server/routes/mute_instance.ts
+++ b/x-pack/plugins/alerts/server/routes/mute_instance.ts
@@ -15,16 +15,18 @@ import {
import { LicenseState } from '../lib/license_state';
import { verifyApiAccess } from '../lib/license_api_access';
import { BASE_ALERT_API_PATH } from '../../common';
+import { renameKeys } from './lib/rename_keys';
+import { MuteOptions } from '../alerts_client';
const paramSchema = schema.object({
- alertId: schema.string(),
- alertInstanceId: schema.string(),
+ alert_id: schema.string(),
+ alert_instance_id: schema.string(),
});
export const muteAlertInstanceRoute = (router: IRouter, licenseState: LicenseState) => {
router.post(
{
- path: `${BASE_ALERT_API_PATH}/{alertId}/alert_instance/{alertInstanceId}/_mute`,
+ path: `${BASE_ALERT_API_PATH}/alert/{alert_id}/alert_instance/{alert_instance_id}/_mute`,
validate: {
params: paramSchema,
},
@@ -42,8 +44,14 @@ export const muteAlertInstanceRoute = (router: IRouter, licenseState: LicenseSta
return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' });
}
const alertsClient = context.alerting.getAlertsClient();
- const { alertId, alertInstanceId } = req.params;
- await alertsClient.muteInstance({ alertId, alertInstanceId });
+
+ const renameMap = {
+ alert_id: 'alertId',
+ alert_instance_id: 'alertInstanceId',
+ };
+
+ const renamedQuery = renameKeys>(renameMap, req.params);
+ await alertsClient.muteInstance(renamedQuery);
return res.noContent();
})
);
diff --git a/x-pack/plugins/alerting/server/routes/unmute_all.test.ts b/x-pack/plugins/alerts/server/routes/unmute_all.test.ts
similarity index 95%
rename from x-pack/plugins/alerting/server/routes/unmute_all.test.ts
rename to x-pack/plugins/alerts/server/routes/unmute_all.test.ts
index 1756dbd3fb41d..e13af38fe4cb1 100644
--- a/x-pack/plugins/alerting/server/routes/unmute_all.test.ts
+++ b/x-pack/plugins/alerts/server/routes/unmute_all.test.ts
@@ -27,7 +27,7 @@ describe('unmuteAllAlertRoute', () => {
const [config, handler] = router.post.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}/_unmute_all"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_unmute_all"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/unmute_all.ts b/x-pack/plugins/alerts/server/routes/unmute_all.ts
similarity index 96%
rename from x-pack/plugins/alerting/server/routes/unmute_all.ts
rename to x-pack/plugins/alerts/server/routes/unmute_all.ts
index d4b6e8b7d61b1..1efc9ed40054e 100644
--- a/x-pack/plugins/alerting/server/routes/unmute_all.ts
+++ b/x-pack/plugins/alerts/server/routes/unmute_all.ts
@@ -23,7 +23,7 @@ const paramSchema = schema.object({
export const unmuteAllAlertRoute = (router: IRouter, licenseState: LicenseState) => {
router.post(
{
- path: `${BASE_ALERT_API_PATH}/{id}/_unmute_all`,
+ path: `${BASE_ALERT_API_PATH}/alert/{id}/_unmute_all`,
validate: {
params: paramSchema,
},
diff --git a/x-pack/plugins/alerting/server/routes/unmute_instance.test.ts b/x-pack/plugins/alerts/server/routes/unmute_instance.test.ts
similarity index 95%
rename from x-pack/plugins/alerting/server/routes/unmute_instance.test.ts
rename to x-pack/plugins/alerts/server/routes/unmute_instance.test.ts
index 9b9542c606741..b2e2f24e91de9 100644
--- a/x-pack/plugins/alerting/server/routes/unmute_instance.test.ts
+++ b/x-pack/plugins/alerts/server/routes/unmute_instance.test.ts
@@ -29,7 +29,7 @@ describe('unmuteAlertInstanceRoute', () => {
const [config, handler] = router.post.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(
- `"/api/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute"`
+ `"/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute"`
);
expect(config.options).toMatchInlineSnapshot(`
Object {
diff --git a/x-pack/plugins/alerting/server/routes/unmute_instance.ts b/x-pack/plugins/alerts/server/routes/unmute_instance.ts
similarity index 94%
rename from x-pack/plugins/alerting/server/routes/unmute_instance.ts
rename to x-pack/plugins/alerts/server/routes/unmute_instance.ts
index 97ccd8f0adce7..967f9f890c9fb 100644
--- a/x-pack/plugins/alerting/server/routes/unmute_instance.ts
+++ b/x-pack/plugins/alerts/server/routes/unmute_instance.ts
@@ -24,7 +24,7 @@ const paramSchema = schema.object({
export const unmuteAlertInstanceRoute = (router: IRouter, licenseState: LicenseState) => {
router.post(
{
- path: `${BASE_ALERT_API_PATH}/{alertId}/alert_instance/{alertInstanceId}/_unmute`,
+ path: `${BASE_ALERT_API_PATH}/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute`,
validate: {
params: paramSchema,
},
diff --git a/x-pack/plugins/alerting/server/routes/update.test.ts b/x-pack/plugins/alerts/server/routes/update.test.ts
similarity index 98%
rename from x-pack/plugins/alerting/server/routes/update.test.ts
rename to x-pack/plugins/alerts/server/routes/update.test.ts
index cd96f289b8714..c7d23f2670b45 100644
--- a/x-pack/plugins/alerting/server/routes/update.test.ts
+++ b/x-pack/plugins/alerts/server/routes/update.test.ts
@@ -51,7 +51,7 @@ describe('updateAlertRoute', () => {
const [config, handler] = router.put.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/update.ts b/x-pack/plugins/alerts/server/routes/update.ts
similarity index 98%
rename from x-pack/plugins/alerting/server/routes/update.ts
rename to x-pack/plugins/alerts/server/routes/update.ts
index 23fea7dc4002f..99b81dfc5b56e 100644
--- a/x-pack/plugins/alerting/server/routes/update.ts
+++ b/x-pack/plugins/alerts/server/routes/update.ts
@@ -44,7 +44,7 @@ const bodySchema = schema.object({
export const updateAlertRoute = (router: IRouter, licenseState: LicenseState) => {
router.put(
{
- path: `${BASE_ALERT_API_PATH}/{id}`,
+ path: `${BASE_ALERT_API_PATH}/alert/{id}`,
validate: {
body: bodySchema,
params: paramSchema,
diff --git a/x-pack/plugins/alerting/server/routes/update_api_key.test.ts b/x-pack/plugins/alerts/server/routes/update_api_key.test.ts
similarity index 95%
rename from x-pack/plugins/alerting/server/routes/update_api_key.test.ts
rename to x-pack/plugins/alerts/server/routes/update_api_key.test.ts
index 0347feb24a235..babae59553b5b 100644
--- a/x-pack/plugins/alerting/server/routes/update_api_key.test.ts
+++ b/x-pack/plugins/alerts/server/routes/update_api_key.test.ts
@@ -28,7 +28,7 @@ describe('updateApiKeyRoute', () => {
const [config, handler] = router.post.mock.calls[0];
- expect(config.path).toMatchInlineSnapshot(`"/api/alert/{id}/_update_api_key"`);
+ expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_update_api_key"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
diff --git a/x-pack/plugins/alerting/server/routes/update_api_key.ts b/x-pack/plugins/alerts/server/routes/update_api_key.ts
similarity index 96%
rename from x-pack/plugins/alerting/server/routes/update_api_key.ts
rename to x-pack/plugins/alerts/server/routes/update_api_key.ts
index 9d88201d7cd43..4736351a25cbd 100644
--- a/x-pack/plugins/alerting/server/routes/update_api_key.ts
+++ b/x-pack/plugins/alerts/server/routes/update_api_key.ts
@@ -24,7 +24,7 @@ const paramSchema = schema.object({
export const updateApiKeyRoute = (router: IRouter, licenseState: LicenseState) => {
router.post(
{
- path: `${BASE_ALERT_API_PATH}/{id}/_update_api_key`,
+ path: `${BASE_ALERT_API_PATH}/alert/{id}/_update_api_key`,
validate: {
params: paramSchema,
},
diff --git a/x-pack/plugins/alerting/server/saved_objects/index.ts b/x-pack/plugins/alerts/server/saved_objects/index.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/saved_objects/index.ts
rename to x-pack/plugins/alerts/server/saved_objects/index.ts
diff --git a/x-pack/plugins/alerting/server/saved_objects/mappings.json b/x-pack/plugins/alerts/server/saved_objects/mappings.json
similarity index 100%
rename from x-pack/plugins/alerting/server/saved_objects/mappings.json
rename to x-pack/plugins/alerts/server/saved_objects/mappings.json
diff --git a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts b/x-pack/plugins/alerts/server/task_runner/alert_task_instance.test.ts
similarity index 98%
rename from x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts
rename to x-pack/plugins/alerts/server/task_runner/alert_task_instance.test.ts
index 28b3576dffc6e..efac4c5dcdc01 100644
--- a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.test.ts
+++ b/x-pack/plugins/alerts/server/task_runner/alert_task_instance.test.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { ConcreteTaskInstance, TaskStatus } from '../../../../plugins/task_manager/server';
+import { ConcreteTaskInstance, TaskStatus } from '../../../task_manager/server';
import { AlertTaskInstance, taskInstanceToAlertTaskInstance } from './alert_task_instance';
import uuid from 'uuid';
import { SanitizedAlert } from '../types';
diff --git a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts b/x-pack/plugins/alerts/server/task_runner/alert_task_instance.ts
similarity index 95%
rename from x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts
rename to x-pack/plugins/alerts/server/task_runner/alert_task_instance.ts
index 4be506b78493b..a290f3fa33c70 100644
--- a/x-pack/plugins/alerting/server/task_runner/alert_task_instance.ts
+++ b/x-pack/plugins/alerts/server/task_runner/alert_task_instance.ts
@@ -6,7 +6,7 @@
import * as t from 'io-ts';
import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
-import { ConcreteTaskInstance } from '../../../../plugins/task_manager/server';
+import { ConcreteTaskInstance } from '../../../task_manager/server';
import {
SanitizedAlert,
AlertTaskState,
diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts b/x-pack/plugins/alerts/server/task_runner/create_execution_handler.test.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts
rename to x-pack/plugins/alerts/server/task_runner/create_execution_handler.test.ts
diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts b/x-pack/plugins/alerts/server/task_runner/create_execution_handler.ts
similarity index 98%
rename from x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts
rename to x-pack/plugins/alerts/server/task_runner/create_execution_handler.ts
index 61bbab50b1222..3c58c6d9ba288 100644
--- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts
+++ b/x-pack/plugins/alerts/server/task_runner/create_execution_handler.ts
@@ -8,7 +8,7 @@ import { pluck } from 'lodash';
import { AlertAction, State, Context, AlertType } from '../types';
import { Logger } from '../../../../../src/core/server';
import { transformActionParams } from './transform_action_params';
-import { PluginStartContract as ActionsPluginStartContract } from '../../../../plugins/actions/server';
+import { PluginStartContract as ActionsPluginStartContract } from '../../../actions/server';
import { IEventLogger, IEvent, SAVED_OBJECT_REL_PRIMARY } from '../../../event_log/server';
import { EVENT_LOG_ACTIONS } from '../plugin';
diff --git a/x-pack/plugins/alerting/server/task_runner/get_next_run_at.test.ts b/x-pack/plugins/alerts/server/task_runner/get_next_run_at.test.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/task_runner/get_next_run_at.test.ts
rename to x-pack/plugins/alerts/server/task_runner/get_next_run_at.test.ts
diff --git a/x-pack/plugins/alerting/server/task_runner/get_next_run_at.ts b/x-pack/plugins/alerts/server/task_runner/get_next_run_at.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/task_runner/get_next_run_at.ts
rename to x-pack/plugins/alerts/server/task_runner/get_next_run_at.ts
diff --git a/x-pack/plugins/alerting/server/task_runner/index.ts b/x-pack/plugins/alerts/server/task_runner/index.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/task_runner/index.ts
rename to x-pack/plugins/alerts/server/task_runner/index.ts
diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts b/x-pack/plugins/alerts/server/task_runner/task_runner.test.ts
similarity index 99%
rename from x-pack/plugins/alerting/server/task_runner/task_runner.test.ts
rename to x-pack/plugins/alerts/server/task_runner/task_runner.test.ts
index 98824b8cf4e1a..983dff86d5602 100644
--- a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts
+++ b/x-pack/plugins/alerts/server/task_runner/task_runner.test.ts
@@ -7,10 +7,10 @@
import sinon from 'sinon';
import { schema } from '@kbn/config-schema';
import { AlertExecutorOptions } from '../types';
-import { ConcreteTaskInstance, TaskStatus } from '../../../../plugins/task_manager/server';
+import { ConcreteTaskInstance, TaskStatus } from '../../../task_manager/server';
import { TaskRunnerContext } from './task_runner_factory';
import { TaskRunner } from './task_runner';
-import { encryptedSavedObjectsMock } from '../../../../plugins/encrypted_saved_objects/server/mocks';
+import { encryptedSavedObjectsMock } from '../../../encrypted_saved_objects/server/mocks';
import { loggingServiceMock } from '../../../../../src/core/server/mocks';
import { PluginStartContract as ActionsPluginStart } from '../../../actions/server';
import { actionsMock } from '../../../actions/server/mocks';
diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerts/server/task_runner/task_runner.ts
similarity index 99%
rename from x-pack/plugins/alerting/server/task_runner/task_runner.ts
rename to x-pack/plugins/alerts/server/task_runner/task_runner.ts
index 0831163d1d326..be399893088e3 100644
--- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts
+++ b/x-pack/plugins/alerts/server/task_runner/task_runner.ts
@@ -7,7 +7,7 @@
import { pick, mapValues, omit, without } from 'lodash';
import { Logger, SavedObject, KibanaRequest } from '../../../../../src/core/server';
import { TaskRunnerContext } from './task_runner_factory';
-import { ConcreteTaskInstance } from '../../../../plugins/task_manager/server';
+import { ConcreteTaskInstance } from '../../../task_manager/server';
import { createExecutionHandler } from './create_execution_handler';
import { AlertInstance, createAlertInstanceFactory } from '../alert_instance';
import { getNextRunAt } from './get_next_run_at';
diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts b/x-pack/plugins/alerts/server/task_runner/task_runner_factory.test.ts
similarity index 93%
rename from x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts
rename to x-pack/plugins/alerts/server/task_runner/task_runner_factory.test.ts
index c1318bac48dfb..7d9710d8a3e08 100644
--- a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.test.ts
+++ b/x-pack/plugins/alerts/server/task_runner/task_runner_factory.test.ts
@@ -5,9 +5,9 @@
*/
import sinon from 'sinon';
-import { ConcreteTaskInstance, TaskStatus } from '../../../../plugins/task_manager/server';
+import { ConcreteTaskInstance, TaskStatus } from '../../../task_manager/server';
import { TaskRunnerContext, TaskRunnerFactory } from './task_runner_factory';
-import { encryptedSavedObjectsMock } from '../../../../plugins/encrypted_saved_objects/server/mocks';
+import { encryptedSavedObjectsMock } from '../../../encrypted_saved_objects/server/mocks';
import { loggingServiceMock } from '../../../../../src/core/server/mocks';
import { actionsMock } from '../../../actions/server/mocks';
import { alertsMock } from '../mocks';
diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts b/x-pack/plugins/alerts/server/task_runner/task_runner_factory.ts
similarity index 87%
rename from x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts
rename to x-pack/plugins/alerts/server/task_runner/task_runner_factory.ts
index c50e288d2e520..ca762cf2b2105 100644
--- a/x-pack/plugins/alerting/server/task_runner/task_runner_factory.ts
+++ b/x-pack/plugins/alerts/server/task_runner/task_runner_factory.ts
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Logger } from '../../../../../src/core/server';
-import { RunContext } from '../../../../plugins/task_manager/server';
-import { EncryptedSavedObjectsClient } from '../../../../plugins/encrypted_saved_objects/server';
-import { PluginStartContract as ActionsPluginStartContract } from '../../../../plugins/actions/server';
+import { RunContext } from '../../../task_manager/server';
+import { EncryptedSavedObjectsClient } from '../../../encrypted_saved_objects/server';
+import { PluginStartContract as ActionsPluginStartContract } from '../../../actions/server';
import {
AlertType,
GetBasePathFunction,
diff --git a/x-pack/plugins/alerting/server/task_runner/transform_action_params.test.ts b/x-pack/plugins/alerts/server/task_runner/transform_action_params.test.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/task_runner/transform_action_params.test.ts
rename to x-pack/plugins/alerts/server/task_runner/transform_action_params.test.ts
diff --git a/x-pack/plugins/alerting/server/task_runner/transform_action_params.ts b/x-pack/plugins/alerts/server/task_runner/transform_action_params.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/task_runner/transform_action_params.ts
rename to x-pack/plugins/alerts/server/task_runner/transform_action_params.ts
diff --git a/x-pack/plugins/alerting/server/test_utils/index.ts b/x-pack/plugins/alerts/server/test_utils/index.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/test_utils/index.ts
rename to x-pack/plugins/alerts/server/test_utils/index.ts
diff --git a/x-pack/plugins/alerting/server/types.ts b/x-pack/plugins/alerts/server/types.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/types.ts
rename to x-pack/plugins/alerts/server/types.ts
diff --git a/x-pack/plugins/alerting/server/usage/alerts_telemetry.test.ts b/x-pack/plugins/alerts/server/usage/alerts_telemetry.test.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/alerts_telemetry.test.ts
rename to x-pack/plugins/alerts/server/usage/alerts_telemetry.test.ts
diff --git a/x-pack/plugins/alerting/server/usage/alerts_telemetry.ts b/x-pack/plugins/alerts/server/usage/alerts_telemetry.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/alerts_telemetry.ts
rename to x-pack/plugins/alerts/server/usage/alerts_telemetry.ts
diff --git a/x-pack/plugins/alerting/server/usage/alerts_usage_collector.test.ts b/x-pack/plugins/alerts/server/usage/alerts_usage_collector.test.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/alerts_usage_collector.test.ts
rename to x-pack/plugins/alerts/server/usage/alerts_usage_collector.test.ts
diff --git a/x-pack/plugins/alerting/server/usage/alerts_usage_collector.ts b/x-pack/plugins/alerts/server/usage/alerts_usage_collector.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/alerts_usage_collector.ts
rename to x-pack/plugins/alerts/server/usage/alerts_usage_collector.ts
diff --git a/x-pack/plugins/alerting/server/usage/index.ts b/x-pack/plugins/alerts/server/usage/index.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/index.ts
rename to x-pack/plugins/alerts/server/usage/index.ts
diff --git a/x-pack/plugins/alerting/server/usage/task.ts b/x-pack/plugins/alerts/server/usage/task.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/task.ts
rename to x-pack/plugins/alerts/server/usage/task.ts
diff --git a/x-pack/plugins/alerting/server/usage/types.ts b/x-pack/plugins/alerts/server/usage/types.ts
similarity index 100%
rename from x-pack/plugins/alerting/server/usage/types.ts
rename to x-pack/plugins/alerts/server/usage/types.ts
diff --git a/x-pack/plugins/apm/common/service_map.ts b/x-pack/plugins/apm/common/service_map.ts
index 9f20005c2b189..43f3585d0ebb2 100644
--- a/x-pack/plugins/apm/common/service_map.ts
+++ b/x-pack/plugins/apm/common/service_map.ts
@@ -6,7 +6,7 @@
import { i18n } from '@kbn/i18n';
import cytoscape from 'cytoscape';
-import { ILicense } from '../../licensing/public';
+import { ILicense } from '../../licensing/common/types';
import {
AGENT_NAME,
SERVICE_ENVIRONMENT,
diff --git a/x-pack/plugins/apm/dev_docs/vscode_setup.md b/x-pack/plugins/apm/dev_docs/vscode_setup.md
index 1c80d1476520d..c7adad4fd0942 100644
--- a/x-pack/plugins/apm/dev_docs/vscode_setup.md
+++ b/x-pack/plugins/apm/dev_docs/vscode_setup.md
@@ -1,8 +1,8 @@
-### Visual Studio Code
+# Visual Studio Code
When using [Visual Studio Code](https://code.visualstudio.com/) with APM it's best to set up a [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) and add the `x-pack/plugins/apm` directory, the `x-pack` directory, and the root of the Kibana repository to the workspace. This makes it so you can navigate and search within APM and use the wider workspace roots when you need to widen your search.
-#### Using the Jest extension
+## Using the Jest extension
The [vscode-jest extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) is a good way to run your Jest tests inside the editor.
@@ -22,31 +22,21 @@ If you have a workspace configured as described above you should have:
"jest.disabledWorkspaceFolders": ["kibana", "x-pack"]
```
-in your Workspace settings, and:
-
-```json
-"jest.pathToJest": "node scripts/jest.js --testPathPattern=plugins/apm",
-"jest.rootPath": "../../.."
-```
-
-in the settings for the APM folder.
-
-#### Jest debugging
+## Jest debugging
To make the [VSCode debugger](https://vscode.readthedocs.io/en/latest/editor/debugging/) work with Jest (you can set breakpoints in the code and tests and use the VSCode debugger) you'll need the [Node Debug extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.node-debug2) installed and can set up a launch configuration like:
```json
{
"type": "node",
- "name": "APM Jest",
+ "name": "vscode-jest-tests",
"request": "launch",
- "args": ["--runInBand", "--testPathPattern=plugins/apm"],
- "cwd": "${workspaceFolder}/../../..",
- "console": "internalConsole",
- "internalConsoleOptions": "openOnSessionStart",
+ "args": ["--runInBand"],
+ "cwd": "${workspaceFolder}",
+ "console": "integratedTerminal",
+ "internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
- "program": "${workspaceFolder}/../../../scripts/jest.js",
- "runtimeVersion": "10.15.2"
+ "program": "${workspaceFolder}/../../../node_modules/jest/bin/jest"
}
```
diff --git a/x-pack/plugins/apm/jest.config.js b/x-pack/plugins/apm/jest.config.js
new file mode 100644
index 0000000000000..c3ae694fe8e14
--- /dev/null
+++ b/x-pack/plugins/apm/jest.config.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+// This is an APM-specific Jest configuration which overrides the x-pack
+// configuration. It's intended for use in development and does not run in CI,
+// which runs the entire x-pack suite. Run `npx jest`.
+
+require('../../../src/setup_node_env');
+
+const { createJestConfig } = require('../../dev-tools/jest/create_jest_config');
+const { resolve } = require('path');
+
+const rootDir = resolve(__dirname, '.');
+const xPackKibanaDirectory = resolve(__dirname, '../..');
+const kibanaDirectory = resolve(__dirname, '../../..');
+
+const jestConfig = createJestConfig({
+ kibanaDirectory,
+ rootDir,
+ xPackKibanaDirectory,
+});
+
+module.exports = {
+ ...jestConfig,
+ reporters: ['default'],
+ roots: [`${rootDir}/common`, `${rootDir}/public`, `${rootDir}/server`],
+ collectCoverage: true,
+ collectCoverageFrom: [
+ '**/*.{js,jsx,ts,tsx}',
+ '!**/{__test__,__snapshots__,__examples__,integration_tests,tests}/**',
+ '!**/*.test.{js,ts,tsx}',
+ '!**/dev_docs/**',
+ '!**/e2e/**',
+ '!**/scripts/**',
+ '!**/target/**',
+ '!**/typings/**',
+ '!**/mocks/**',
+ ],
+ coverageDirectory: `${rootDir}/target/coverage/jest`,
+ coverageReporters: ['html'],
+};
diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json
index dd89fac66f6e8..2de3c9c97065d 100644
--- a/x-pack/plugins/apm/kibana.json
+++ b/x-pack/plugins/apm/kibana.json
@@ -15,7 +15,7 @@
"usageCollection",
"taskManager",
"actions",
- "alerting",
+ "alerts",
"observability",
"security"
],
diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/index.tsx
index bfb9e99b4fc4c..80d5f739bea5a 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/index.tsx
@@ -82,7 +82,7 @@ export function AlertIntegrations(props: Props) {
}
),
href: plugin.core.http.basePath.prepend(
- '/app/kibana#/management/insightsAndAlerting/triggersActions/alerts'
+ '/app/management/insightsAndAlerting/triggersActions/alerts'
),
icon: 'tableOfContents',
},
diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/index.tsx
index bcc31a30b154d..321617ed8496a 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceIntegrations/index.tsx
@@ -92,7 +92,7 @@ export class ServiceIntegrations extends React.Component {
),
icon: 'watchesApp',
href: core.http.basePath.prepend(
- '/app/kibana#/management/insightsAndAlerting/watcher'
+ '/app/management/insightsAndAlerting/watcher'
),
target: '_blank',
onClick: () => this.closePopover(),
diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx
index c3d426a6275a7..0dbde5ea86a18 100644
--- a/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx
+++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx
@@ -28,7 +28,7 @@ export function ServiceDetails({ tab }: Props) {
const canSaveAlerts = !!plugin.core.application.capabilities.apm[
'alerting:save'
];
- const isAlertingPluginEnabled = 'alerting' in plugin.plugins;
+ const isAlertingPluginEnabled = 'alerts' in plugin.plugins;
const isAlertingAvailable =
isAlertingPluginEnabled && (canReadAlerts || canSaveAlerts);
diff --git a/x-pack/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx b/x-pack/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx
index 4033d684da981..481e89e09685e 100644
--- a/x-pack/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx
+++ b/x-pack/plugins/apm/public/context/LicenseContext/InvalidLicenseNotification.tsx
@@ -11,7 +11,7 @@ import { useApmPluginContext } from '../../hooks/useApmPluginContext';
export function InvalidLicenseNotification() {
const { core } = useApmPluginContext();
const manageLicenseURL = core.http.basePath.prepend(
- '/app/kibana#/management/stack/license_management'
+ '/app/management/stack/license_management'
);
return (
diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts
index e732e695b36b1..76320efe617ea 100644
--- a/x-pack/plugins/apm/public/plugin.ts
+++ b/x-pack/plugins/apm/public/plugin.ts
@@ -17,7 +17,7 @@ import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import {
PluginSetupContract as AlertingPluginPublicSetup,
PluginStartContract as AlertingPluginPublicStart,
-} from '../../alerting/public';
+} from '../../alerts/public';
import { FeaturesPluginSetup } from '../../features/public';
import {
DataPublicPluginSetup,
@@ -44,7 +44,7 @@ export type ApmPluginSetup = void;
export type ApmPluginStart = void;
export interface ApmPluginSetupDeps {
- alerting?: AlertingPluginPublicSetup;
+ alerts?: AlertingPluginPublicSetup;
data: DataPublicPluginSetup;
features: FeaturesPluginSetup;
home: HomePublicPluginSetup;
@@ -53,7 +53,7 @@ export interface ApmPluginSetupDeps {
}
export interface ApmPluginStartDeps {
- alerting?: AlertingPluginPublicStart;
+ alerts?: AlertingPluginPublicStart;
data: DataPublicPluginStart;
home: void;
licensing: void;
diff --git a/x-pack/plugins/apm/readme.md b/x-pack/plugins/apm/readme.md
index 62465e920d793..ceed5e6c39716 100644
--- a/x-pack/plugins/apm/readme.md
+++ b/x-pack/plugins/apm/readme.md
@@ -39,18 +39,26 @@ _Starts Kibana (:5701), APM Server (:8201) and Elasticsearch (:9201). Ingests sa
### Unit testing
-Note: Run the following commands from `kibana/x-pack`.
+Note: Run the following commands from `kibana/x-pack/plugins/apm`.
#### Run unit tests
```
-node scripts/jest.js plugins/apm --watch
+npx jest --watch
```
#### Update snapshots
```
-node scripts/jest.js plugins/apm --updateSnapshot
+npx jest --updateSnapshot
+```
+
+#### Coverage
+
+HTML coverage report can be found in target/coverage/jest after tests have run.
+
+```
+open target/coverage/jest/index.html
```
### Functional tests
diff --git a/x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts b/x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts
index 8af9f386ecebf..4b8e9cf937a2b 100644
--- a/x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts
+++ b/x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts
@@ -5,25 +5,25 @@
*/
import { Observable } from 'rxjs';
-import { AlertingPlugin } from '../../../../alerting/server';
+import { AlertingPlugin } from '../../../../alerts/server';
import { ActionsPlugin } from '../../../../actions/server';
import { registerTransactionDurationAlertType } from './register_transaction_duration_alert_type';
import { registerErrorRateAlertType } from './register_error_rate_alert_type';
import { APMConfig } from '../..';
interface Params {
- alerting: AlertingPlugin['setup'];
+ alerts: AlertingPlugin['setup'];
actions: ActionsPlugin['setup'];
config$: Observable;
}
export function registerApmAlerts(params: Params) {
registerTransactionDurationAlertType({
- alerting: params.alerting,
+ alerts: params.alerts,
config$: params.config$,
});
registerErrorRateAlertType({
- alerting: params.alerting,
+ alerts: params.alerts,
config$: params.config$,
});
}
diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_rate_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_error_rate_alert_type.ts
index ee7bd9eeb4b6f..53843b7f7412b 100644
--- a/x-pack/plugins/apm/server/lib/alerts/register_error_rate_alert_type.ts
+++ b/x-pack/plugins/apm/server/lib/alerts/register_error_rate_alert_type.ts
@@ -19,12 +19,12 @@ import {
SERVICE_NAME,
SERVICE_ENVIRONMENT,
} from '../../../common/elasticsearch_fieldnames';
-import { AlertingPlugin } from '../../../../alerting/server';
+import { AlertingPlugin } from '../../../../alerts/server';
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
import { APMConfig } from '../..';
interface RegisterAlertParams {
- alerting: AlertingPlugin['setup'];
+ alerts: AlertingPlugin['setup'];
config$: Observable;
}
@@ -39,10 +39,10 @@ const paramsSchema = schema.object({
const alertTypeConfig = ALERT_TYPES_CONFIG[AlertType.ErrorRate];
export function registerErrorRateAlertType({
- alerting,
+ alerts,
config$,
}: RegisterAlertParams) {
- alerting.registerType({
+ alerts.registerType({
id: AlertType.ErrorRate,
name: alertTypeConfig.name,
actionGroups: alertTypeConfig.actionGroups,
diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts
index afb402200a07b..1fd1aef4c8b70 100644
--- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts
+++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts
@@ -18,12 +18,12 @@ import {
TRANSACTION_DURATION,
SERVICE_ENVIRONMENT,
} from '../../../common/elasticsearch_fieldnames';
-import { AlertingPlugin } from '../../../../alerting/server';
+import { AlertingPlugin } from '../../../../alerts/server';
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
import { APMConfig } from '../..';
interface RegisterAlertParams {
- alerting: AlertingPlugin['setup'];
+ alerts: AlertingPlugin['setup'];
config$: Observable;
}
@@ -44,10 +44,10 @@ const paramsSchema = schema.object({
const alertTypeConfig = ALERT_TYPES_CONFIG[AlertType.TransactionDuration];
export function registerTransactionDurationAlertType({
- alerting,
+ alerts,
config$,
}: RegisterAlertParams) {
- alerting.registerType({
+ alerts.registerType({
id: AlertType.TransactionDuration,
name: alertTypeConfig.name,
actionGroups: alertTypeConfig.actionGroups,
diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts
index b9ad14f7ec47d..d32d16d4c3cc8 100644
--- a/x-pack/plugins/apm/server/plugin.ts
+++ b/x-pack/plugins/apm/server/plugin.ts
@@ -17,7 +17,7 @@ import { ObservabilityPluginSetup } from '../../observability/server';
import { SecurityPluginSetup } from '../../security/public';
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server';
import { TaskManagerSetupContract } from '../../task_manager/server';
-import { AlertingPlugin } from '../../alerting/server';
+import { AlertingPlugin } from '../../alerts/server';
import { ActionsPlugin } from '../../actions/server';
import { APMOSSPluginSetup } from '../../../../src/plugins/apm_oss/server';
import { createApmAgentConfigurationIndex } from './lib/settings/agent_configuration/create_agent_config_index';
@@ -57,7 +57,7 @@ export class APMPlugin implements Plugin {
cloud?: CloudSetup;
usageCollection?: UsageCollectionSetup;
taskManager?: TaskManagerSetupContract;
- alerting?: AlertingPlugin['setup'];
+ alerts?: AlertingPlugin['setup'];
actions?: ActionsPlugin['setup'];
observability?: ObservabilityPluginSetup;
features: FeaturesPluginSetup;
@@ -73,9 +73,9 @@ export class APMPlugin implements Plugin {
core.savedObjects.registerType(apmIndices);
core.savedObjects.registerType(apmTelemetry);
- if (plugins.actions && plugins.alerting) {
+ if (plugins.actions && plugins.alerts) {
registerApmAlerts({
- alerting: plugins.alerting,
+ alerts: plugins.alerts,
actions: plugins.actions,
config$: mergedConfig$,
});
diff --git a/x-pack/plugins/apm/typings/numeral.d.ts b/x-pack/plugins/apm/typings/numeral.d.ts
deleted file mode 100644
index 2616639cdeff0..0000000000000
--- a/x-pack/plugins/apm/typings/numeral.d.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-interface Numeral {
- (value?: unknown): Numeral;
- format: (pattern: string) => string;
- unformat: (pattern: string) => number;
- language: (key?: any, values?: any) => Numeral;
- set: (value?: any) => Numeral;
-}
-
-// eslint-disable-next-line no-var
-declare var numeral: Numeral;
-
-declare module '@elastic/numeral' {
- export = numeral;
-}
diff --git a/x-pack/plugins/beats_management/public/application.tsx b/x-pack/plugins/beats_management/public/application.tsx
index 6711e93895b62..0b8b0ad3dafc9 100644
--- a/x-pack/plugins/beats_management/public/application.tsx
+++ b/x-pack/plugins/beats_management/public/application.tsx
@@ -8,7 +8,7 @@ import * as euiVars from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
import React from 'react';
import ReactDOM from 'react-dom';
-import { HashRouter } from 'react-router-dom';
+import { Router } from 'react-router-dom';
import { ThemeProvider } from 'styled-components';
import { Provider as UnstatedProvider, Subscribe } from 'unstated';
import { Background } from './components/layouts/background';
@@ -19,19 +19,13 @@ import { TagsContainer } from './containers/tags';
import { FrontendLibs } from './lib/types';
import { AppRouter } from './router';
import { services } from './kbn_services';
-import {
- ManagementAppMountParams,
- ManagementSectionId,
-} from '../../../../src/plugins/management/public';
+import { ManagementAppMountParams } from '../../../../src/plugins/management/public';
-export const renderApp = (
- { basePath, element, setBreadcrumbs }: ManagementAppMountParams,
- libs: FrontendLibs
-) => {
+export const renderApp = ({ element, history }: ManagementAppMountParams, libs: FrontendLibs) => {
ReactDOM.render(
-
+
@@ -48,7 +42,7 @@ export const renderApp = (
-
+