);
};
-export async function getAlertStatus(
+export async function getAlertInstanceSummary(
alertId: string,
- loadAlertStatus: AlertApis['loadAlertStatus'],
- setAlertStatus: React.Dispatch
>,
+ loadAlertInstanceSummary: AlertApis['loadAlertInstanceSummary'],
+ setAlertInstanceSummary: React.Dispatch>,
toastNotifications: Pick
) {
try {
- const loadedStatus = await loadAlertStatus(alertId);
- setAlertStatus(loadedStatus);
+ const loadedInstanceSummary = await loadAlertInstanceSummary(alertId);
+ setAlertInstanceSummary(loadedInstanceSummary);
} catch (e) {
toastNotifications.addDanger({
title: i18n.translate(
- 'xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertStateMessage',
+ 'xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertInstanceSummaryMessage',
{
- defaultMessage: 'Unable to load alert status: {message}',
+ defaultMessage: 'Unable to load alert instance summary: {message}',
values: {
message: e.message,
},
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_alert_api_operations.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_alert_api_operations.tsx
index fd8b35a96bdf0..dc961482f182d 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_alert_api_operations.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_alert_api_operations.tsx
@@ -10,7 +10,7 @@ import {
Alert,
AlertType,
AlertTaskState,
- AlertStatus,
+ AlertInstanceSummary,
AlertingFrameworkHealth,
} from '../../../../types';
import { useAppDependencies } from '../../../app_context';
@@ -28,7 +28,7 @@ import {
unmuteAlertInstance,
loadAlert,
loadAlertState,
- loadAlertStatus,
+ loadAlertInstanceSummary,
loadAlertTypes,
health,
} from '../../../lib/alert_api';
@@ -58,7 +58,7 @@ export interface ComponentOpts {
}>;
loadAlert: (id: Alert['id']) => Promise;
loadAlertState: (id: Alert['id']) => Promise;
- loadAlertStatus: (id: Alert['id']) => Promise;
+ loadAlertInstanceSummary: (id: Alert['id']) => Promise;
loadAlertTypes: () => Promise;
getHealth: () => Promise;
}
@@ -127,7 +127,9 @@ export function withBulkAlertOperations(
deleteAlert={async (alert: Alert) => deleteAlerts({ http, ids: [alert.id] })}
loadAlert={async (alertId: Alert['id']) => loadAlert({ http, alertId })}
loadAlertState={async (alertId: Alert['id']) => loadAlertState({ http, alertId })}
- loadAlertStatus={async (alertId: Alert['id']) => loadAlertStatus({ http, alertId })}
+ loadAlertInstanceSummary={async (alertId: Alert['id']) =>
+ loadAlertInstanceSummary({ http, alertId })
+ }
loadAlertTypes={async () => loadAlertTypes({ http })}
getHealth={async () => health({ http })}
/>
diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts
index 0c0d99eed4e7b..762f41ba3691c 100644
--- a/x-pack/plugins/triggers_actions_ui/public/types.ts
+++ b/x-pack/plugins/triggers_actions_ui/public/types.ts
@@ -12,7 +12,7 @@ import {
SanitizedAlert as Alert,
AlertAction,
AlertTaskState,
- AlertStatus,
+ AlertInstanceSummary,
AlertInstanceStatus,
RawAlertInstance,
AlertingFrameworkHealth,
@@ -21,7 +21,7 @@ export {
Alert,
AlertAction,
AlertTaskState,
- AlertStatus,
+ AlertInstanceSummary,
AlertInstanceStatus,
RawAlertInstance,
AlertingFrameworkHealth,
diff --git a/x-pack/plugins/uptime/common/constants/client_defaults.ts b/x-pack/plugins/uptime/common/constants/client_defaults.ts
index d8a3ef8d7cbbb..a5db67ae3b58f 100644
--- a/x-pack/plugins/uptime/common/constants/client_defaults.ts
+++ b/x-pack/plugins/uptime/common/constants/client_defaults.ts
@@ -31,6 +31,7 @@ export const CLIENT_DEFAULTS = {
* The end of the default date range is now.
*/
DATE_RANGE_END: 'now',
+ FOCUS_CONNECTOR_FIELD: false,
FILTERS: '',
MONITOR_LIST_PAGE_INDEX: 0,
MONITOR_LIST_PAGE_SIZE: 20,
diff --git a/x-pack/plugins/uptime/common/constants/plugin.ts b/x-pack/plugins/uptime/common/constants/plugin.ts
index 6064524872a0a..71bae9d8dafcd 100644
--- a/x-pack/plugins/uptime/common/constants/plugin.ts
+++ b/x-pack/plugins/uptime/common/constants/plugin.ts
@@ -17,7 +17,6 @@ export const PLUGIN = {
NAME: i18n.translate('xpack.uptime.featureRegistry.uptimeFeatureName', {
defaultMessage: 'Uptime',
}),
- ROUTER_BASE_NAME: '/app/uptime#',
TITLE: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', {
defaultMessage: 'Uptime',
}),
diff --git a/x-pack/plugins/uptime/public/apps/plugin.ts b/x-pack/plugins/uptime/public/apps/plugin.ts
index 9f7907ec39187..8a6699c16269e 100644
--- a/x-pack/plugins/uptime/public/apps/plugin.ts
+++ b/x-pack/plugins/uptime/public/apps/plugin.ts
@@ -59,7 +59,7 @@ export class UptimePlugin
title: PLUGIN.TITLE,
description: PLUGIN.DESCRIPTION,
icon: 'uptimeApp',
- path: '/app/uptime#/',
+ path: '/app/uptime',
showOnHomePage: false,
category: FeatureCatalogueCategory.DATA,
});
@@ -84,7 +84,6 @@ export class UptimePlugin
});
core.application.register({
- appRoute: '/app/uptime#/',
id: PLUGIN.ID,
euiIconType: 'uptimeApp',
order: 8400,
diff --git a/x-pack/plugins/uptime/public/apps/render_app.tsx b/x-pack/plugins/uptime/public/apps/render_app.tsx
index f834f8b5cdd3c..c0567ff956ce4 100644
--- a/x-pack/plugins/uptime/public/apps/render_app.tsx
+++ b/x-pack/plugins/uptime/public/apps/render_app.tsx
@@ -16,13 +16,12 @@ import {
} from '../../common/constants';
import { UptimeApp, UptimeAppProps } from './uptime_app';
import { ClientPluginsSetup, ClientPluginsStart } from './plugin';
-import { PLUGIN } from '../../common/constants/plugin';
export function renderApp(
core: CoreStart,
plugins: ClientPluginsSetup,
startPlugins: ClientPluginsStart,
- { element }: AppMountParameters
+ { element, history }: AppMountParameters
) {
const {
application: { capabilities },
@@ -48,6 +47,7 @@ export function renderApp(
basePath: basePath.get(),
darkMode: core.uiSettings.get(DEFAULT_DARK_MODE),
commonlyUsedRanges: core.uiSettings.get(DEFAULT_TIMEPICKER_QUICK_RANGES),
+ history,
isApmAvailable: apm,
isInfraAvailable: infrastructure,
isLogsAvailable: logs,
@@ -67,7 +67,6 @@ export function renderApp(
},
],
}),
- routerBasename: basePath.prepend(PLUGIN.ROUTER_BASE_NAME),
setBadge,
setBreadcrumbs: core.chrome.setBreadcrumbs,
};
diff --git a/x-pack/plugins/uptime/public/apps/uptime_app.tsx b/x-pack/plugins/uptime/public/apps/uptime_app.tsx
index 1dc34b44b7c64..4b58ba104314f 100644
--- a/x-pack/plugins/uptime/public/apps/uptime_app.tsx
+++ b/x-pack/plugins/uptime/public/apps/uptime_app.tsx
@@ -8,7 +8,7 @@ import { EuiPage, EuiErrorBoundary } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useEffect } from 'react';
import { Provider as ReduxProvider } from 'react-redux';
-import { BrowserRouter as Router } from 'react-router-dom';
+import { Router } from 'react-router-dom';
import { I18nStart, ChromeBreadcrumb, CoreStart } from 'kibana/public';
import {
KibanaContextProvider,
@@ -31,6 +31,7 @@ import {
} from '../components/overview/alerts';
import { store } from '../state';
import { kibanaService } from '../state/kibana_service';
+import { ScopedHistory } from '../../../../../src/core/public';
export interface UptimeAppColors {
danger: string;
@@ -46,13 +47,13 @@ export interface UptimeAppProps {
canSave: boolean;
core: CoreStart;
darkMode: boolean;
+ history: ScopedHistory;
i18n: I18nStart;
isApmAvailable: boolean;
isInfraAvailable: boolean;
isLogsAvailable: boolean;
plugins: ClientPluginsSetup;
startPlugins: ClientPluginsStart;
- routerBasename: string;
setBadge: UMUpdateBadge;
renderGlobalHelpControls(): void;
commonlyUsedRanges: CommonlyUsedRange[];
@@ -68,7 +69,6 @@ const Application = (props: UptimeAppProps) => {
i18n: i18nCore,
plugins,
renderGlobalHelpControls,
- routerBasename,
setBadge,
startPlugins,
} = props;
@@ -99,7 +99,7 @@ const Application = (props: UptimeAppProps) => {
-
+
diff --git a/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts b/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts
index 7e5c18f13b29e..b077f622c1dee 100644
--- a/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts
+++ b/x-pack/plugins/uptime/public/apps/uptime_overview_fetcher.ts
@@ -24,7 +24,7 @@ async function fetchUptimeOverviewData({
const pings = await fetchPingHistogram({ dateStart: start, dateEnd: end, bucketSize });
const response: UptimeFetchDataResponse = {
- appLink: `/app/uptime#/?dateRangeStart=${relativeTime.start}&dateRangeEnd=${relativeTime.end}`,
+ appLink: `/app/uptime?dateRangeStart=${relativeTime.start}&dateRangeEnd=${relativeTime.end}`,
stats: {
monitors: {
type: 'number',
diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap
index 0429d36bf8741..41e46259715ee 100644
--- a/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap
+++ b/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap
@@ -36,7 +36,7 @@ exports[`DataOrIndexMissing component renders headingMessage 1`] = `
-
+
Get https://expired.badssl.com: x509: certificate has expired or is not yet valid
diff --git a/x-pack/plugins/uptime/public/hooks/__tests__/use_breadcrumbs.test.tsx b/x-pack/plugins/uptime/public/hooks/__tests__/use_breadcrumbs.test.tsx
index d688660f564ca..9b9af20285304 100644
--- a/x-pack/plugins/uptime/public/hooks/__tests__/use_breadcrumbs.test.tsx
+++ b/x-pack/plugins/uptime/public/hooks/__tests__/use_breadcrumbs.test.tsx
@@ -44,7 +44,11 @@ describe('useBreadcrumbs', () => {
);
const urlParams: UptimeUrlParams = getSupportedUrlParams({});
- expect(getBreadcrumbs()).toStrictEqual([makeBaseBreadcrumb(urlParams)].concat(expectedCrumbs));
+ expect(JSON.stringify(getBreadcrumbs())).toEqual(
+ JSON.stringify(
+ [makeBaseBreadcrumb('/app/uptime', jest.fn(), urlParams)].concat(expectedCrumbs)
+ )
+ );
});
});
@@ -54,6 +58,10 @@ const mockCore: () => [() => ChromeBreadcrumb[], any] = () => {
return breadcrumbObj;
};
const core = {
+ application: {
+ getUrlForApp: () => '/app/uptime',
+ navigateToUrl: jest.fn(),
+ },
chrome: {
setBreadcrumbs: (newBreadcrumbs: ChromeBreadcrumb[]) => {
breadcrumbObj = newBreadcrumbs;
diff --git a/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.ts b/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.ts
index 182c6b0114128..ddd3ca7c4f528 100644
--- a/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.ts
+++ b/x-pack/plugins/uptime/public/hooks/use_breadcrumbs.ts
@@ -7,35 +7,52 @@
import { ChromeBreadcrumb } from 'kibana/public';
import { i18n } from '@kbn/i18n';
import { useEffect } from 'react';
+import { EuiBreadcrumb } from '@elastic/eui';
import { UptimeUrlParams } from '../lib/helper';
import { stringifyUrlParams } from '../lib/helper/stringify_url_params';
import { useKibana } from '../../../../../src/plugins/kibana_react/public';
import { useUrlParams } from '.';
+import { PLUGIN } from '../../common/constants/plugin';
-export const makeBaseBreadcrumb = (params?: UptimeUrlParams): ChromeBreadcrumb => {
- let href = '#/';
+const EMPTY_QUERY = '?';
+
+export const makeBaseBreadcrumb = (
+ href: string,
+ navigateToHref?: (url: string) => Promise,
+ params?: UptimeUrlParams
+): EuiBreadcrumb => {
if (params) {
const crumbParams: Partial = { ...params };
// We don't want to encode this values because they are often set to Date.now(), the relative
// values in dateRangeStart are better for a URL.
delete crumbParams.absoluteDateRangeStart;
delete crumbParams.absoluteDateRangeEnd;
- href += stringifyUrlParams(crumbParams, true);
+ const query = stringifyUrlParams(crumbParams, true);
+ href += query === EMPTY_QUERY ? '' : query;
}
return {
text: i18n.translate('xpack.uptime.breadcrumbs.overviewBreadcrumbText', {
defaultMessage: 'Uptime',
}),
href,
+ onClick: (event) => {
+ if (href && navigateToHref) {
+ event.preventDefault();
+ navigateToHref(href);
+ }
+ },
};
};
export const useBreadcrumbs = (extraCrumbs: ChromeBreadcrumb[]) => {
const params = useUrlParams()[0]();
- const setBreadcrumbs = useKibana().services.chrome?.setBreadcrumbs;
+ const kibana = useKibana();
+ const setBreadcrumbs = kibana.services.chrome?.setBreadcrumbs;
+ const appPath = kibana.services.application?.getUrlForApp(PLUGIN.ID) ?? '';
+ const navigate = kibana.services.application?.navigateToUrl;
useEffect(() => {
if (setBreadcrumbs) {
- setBreadcrumbs([makeBaseBreadcrumb(params)].concat(extraCrumbs));
+ setBreadcrumbs([makeBaseBreadcrumb(appPath, navigate, params)].concat(extraCrumbs));
}
- }, [extraCrumbs, params, setBreadcrumbs]);
+ }, [appPath, extraCrumbs, navigate, params, setBreadcrumbs]);
};
diff --git a/x-pack/plugins/uptime/public/lib/helper/__tests__/__snapshots__/stringify_url_params.test.ts.snap b/x-pack/plugins/uptime/public/lib/helper/__tests__/__snapshots__/stringify_url_params.test.ts.snap
deleted file mode 100644
index 31f5ceff7d046..0000000000000
--- a/x-pack/plugins/uptime/public/lib/helper/__tests__/__snapshots__/stringify_url_params.test.ts.snap
+++ /dev/null
@@ -1,5 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`stringifyUrlParams creates expected string value 1`] = `"?autorefreshInterval=50000&autorefreshIsPaused=false&dateRangeStart=now-15m&dateRangeEnd=now&filters=monitor.id%3A%20bar&search=monitor.id%3A%20foo&selectedPingStatus=down&statusFilter=up"`;
-
-exports[`stringifyUrlParams creates expected string value when ignore empty is true 1`] = `"?autorefreshInterval=50000&filters=monitor.id%3A%20bar"`;
diff --git a/x-pack/plugins/uptime/public/lib/helper/__tests__/stringify_url_params.test.ts b/x-pack/plugins/uptime/public/lib/helper/__tests__/stringify_url_params.test.ts
index a2f9b29c4ff58..8cf35c728fc04 100644
--- a/x-pack/plugins/uptime/public/lib/helper/__tests__/stringify_url_params.test.ts
+++ b/x-pack/plugins/uptime/public/lib/helper/__tests__/stringify_url_params.test.ts
@@ -14,11 +14,14 @@ describe('stringifyUrlParams', () => {
dateRangeStart: 'now-15m',
dateRangeEnd: 'now',
filters: 'monitor.id: bar',
+ focusConnectorField: true,
search: 'monitor.id: foo',
selectedPingStatus: 'down',
statusFilter: 'up',
});
- expect(result).toMatchSnapshot();
+ expect(result).toMatchInlineSnapshot(
+ `"?autorefreshInterval=50000&autorefreshIsPaused=false&dateRangeStart=now-15m&dateRangeEnd=now&filters=monitor.id%3A%20bar&focusConnectorField=true&search=monitor.id%3A%20foo&selectedPingStatus=down&statusFilter=up"`
+ );
});
it('creates expected string value when ignore empty is true', () => {
@@ -29,6 +32,7 @@ describe('stringifyUrlParams', () => {
dateRangeStart: 'now-15m',
dateRangeEnd: 'now',
filters: 'monitor.id: bar',
+ focusConnectorField: false,
search: undefined,
selectedPingStatus: undefined,
statusFilter: '',
@@ -36,7 +40,9 @@ describe('stringifyUrlParams', () => {
},
true
);
- expect(result).toMatchSnapshot();
+ expect(result).toMatchInlineSnapshot(
+ `"?autorefreshInterval=50000&filters=monitor.id%3A%20bar"`
+ );
expect(result.includes('pagination')).toBeFalsy();
expect(result.includes('search')).toBeFalsy();
diff --git a/x-pack/plugins/uptime/public/lib/helper/stringify_url_params.ts b/x-pack/plugins/uptime/public/lib/helper/stringify_url_params.ts
index a8ce86c4399e2..b10af15961401 100644
--- a/x-pack/plugins/uptime/public/lib/helper/stringify_url_params.ts
+++ b/x-pack/plugins/uptime/public/lib/helper/stringify_url_params.ts
@@ -13,6 +13,7 @@ const {
AUTOREFRESH_IS_PAUSED,
DATE_RANGE_START,
DATE_RANGE_END,
+ FOCUS_CONNECTOR_FIELD,
} = CLIENT_DEFAULTS;
export const stringifyUrlParams = (params: Partial, ignoreEmpty = false) => {
@@ -36,6 +37,9 @@ export const stringifyUrlParams = (params: Partial, ignoreEmpty
if (key === 'autorefreshInterval' && val === AUTOREFRESH_INTERVAL) {
delete params[key];
}
+ if (key === 'focusConnectorField' && val === FOCUS_CONNECTOR_FIELD) {
+ delete params[key];
+ }
});
}
return `?${stringify(params, { sort: false })}`;
diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_status.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_instance_summary.ts
similarity index 90%
rename from x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_status.ts
rename to x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_instance_summary.ts
index b700b5fb40b63..c8148f0c7a871 100644
--- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_status.ts
+++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get_alert_instance_summary.ts
@@ -17,11 +17,11 @@ import { FtrProviderContext } from '../../../common/ftr_provider_context';
import { UserAtSpaceScenarios } from '../../scenarios';
// eslint-disable-next-line import/no-default-export
-export default function createGetAlertStatusTests({ getService }: FtrProviderContext) {
+export default function createGetAlertInstanceSummaryTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');
- describe('getAlertStatus', () => {
+ describe('getAlertInstanceSummary', () => {
const objectRemover = new ObjectRemover(supertest);
afterEach(() => objectRemover.removeAll());
@@ -29,7 +29,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
describe(scenario.id, () => {
- it('should handle getAlertStatus alert request appropriately', async () => {
+ it('should handle getAlertInstanceSummary alert request appropriately', async () => {
const { body: createdAlert } = await supertest
.post(`${getUrlPrefix(space.id)}/api/alerts/alert`)
.set('kbn-xsrf', 'foo')
@@ -38,7 +38,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts');
const response = await supertestWithoutAuth
- .get(`${getUrlPrefix(space.id)}/api/alerts/alert/${createdAlert.id}/status`)
+ .get(`${getUrlPrefix(space.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`)
.auth(user.username, user.password);
switch (scenario.id) {
@@ -85,7 +85,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
}
});
- it('should handle getAlertStatus alert request appropriately when unauthorized', async () => {
+ it('should handle getAlertInstanceSummary alert request appropriately when unauthorized', async () => {
const { body: createdAlert } = await supertest
.post(`${getUrlPrefix(space.id)}/api/alerts/alert`)
.set('kbn-xsrf', 'foo')
@@ -99,7 +99,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts');
const response = await supertestWithoutAuth
- .get(`${getUrlPrefix(space.id)}/api/alerts/alert/${createdAlert.id}/status`)
+ .get(`${getUrlPrefix(space.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`)
.auth(user.username, user.password);
switch (scenario.id) {
@@ -140,7 +140,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
}
});
- it(`shouldn't getAlertStatus for an alert from another space`, async () => {
+ it(`shouldn't getAlertInstanceSummary for an alert from another space`, async () => {
const { body: createdAlert } = await supertest
.post(`${getUrlPrefix(space.id)}/api/alerts/alert`)
.set('kbn-xsrf', 'foo')
@@ -149,7 +149,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
objectRemover.add(space.id, createdAlert.id, 'alert', 'alerts');
const response = await supertestWithoutAuth
- .get(`${getUrlPrefix('other')}/api/alerts/alert/${createdAlert.id}/status`)
+ .get(`${getUrlPrefix('other')}/api/alerts/alert/${createdAlert.id}/_instance_summary`)
.auth(user.username, user.password);
expect(response.statusCode).to.eql(404);
@@ -172,9 +172,9 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
}
});
- it(`should handle getAlertStatus request appropriately when alert doesn't exist`, async () => {
+ it(`should handle getAlertInstanceSummary request appropriately when alert doesn't exist`, async () => {
const response = await supertestWithoutAuth
- .get(`${getUrlPrefix(space.id)}/api/alerts/alert/1/status`)
+ .get(`${getUrlPrefix(space.id)}/api/alerts/alert/1/_instance_summary`)
.auth(user.username, user.password);
switch (scenario.id) {
diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/index.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/index.ts
index 45fa075a65978..b03a3c8ccf6af 100644
--- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/index.ts
+++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/index.ts
@@ -16,7 +16,7 @@ export default function alertingTests({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./enable'));
loadTestFile(require.resolve('./get'));
loadTestFile(require.resolve('./get_alert_state'));
- loadTestFile(require.resolve('./get_alert_status'));
+ loadTestFile(require.resolve('./get_alert_instance_summary'));
loadTestFile(require.resolve('./list_alert_types'));
loadTestFile(require.resolve('./mute_all'));
loadTestFile(require.resolve('./mute_instance'));
diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_status.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_instance_summary.ts
similarity index 95%
rename from x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_status.ts
rename to x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_instance_summary.ts
index 341313ce55c60..563127e028a62 100644
--- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_status.ts
+++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_alert_instance_summary.ts
@@ -18,20 +18,20 @@ import {
import { FtrProviderContext } from '../../../common/ftr_provider_context';
// eslint-disable-next-line import/no-default-export
-export default function createGetAlertStatusTests({ getService }: FtrProviderContext) {
+export default function createGetAlertInstanceSummaryTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');
const retry = getService('retry');
const alertUtils = new AlertUtils({ space: Spaces.space1, supertestWithoutAuth });
- describe('getAlertStatus', () => {
+ describe('getAlertInstanceSummary', () => {
const objectRemover = new ObjectRemover(supertest);
afterEach(() => objectRemover.removeAll());
it(`handles non-existant alert`, async () => {
await supertest
- .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/1/status`)
+ .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/1/_instance_summary`)
.expect(404, {
statusCode: 404,
error: 'Not Found',
@@ -49,7 +49,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
await waitForEvents(createdAlert.id, ['execute']);
const response = await supertest.get(
- `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/status`
+ `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`
);
expect(response.status).to.eql(200);
@@ -82,7 +82,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', 'alerts');
const response = await supertest.get(
- `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/status`
+ `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`
);
expect(response.status).to.eql(200);
@@ -119,7 +119,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
const response = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${
createdAlert.id
- }/status?dateStart=${dateStart}`
+ }/_instance_summary?dateStart=${dateStart}`
);
expect(response.status).to.eql(200);
const { statusStartDate, statusEndDate } = response.body;
@@ -140,7 +140,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
const response = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${
createdAlert.id
- }/status?dateStart=${dateStart}`
+ }/_instance_summary?dateStart=${dateStart}`
);
expect(response.status).to.eql(400);
expect(response.body).to.eql({
@@ -161,7 +161,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
await alertUtils.muteInstance(createdAlert.id, '1');
await waitForEvents(createdAlert.id, ['execute']);
const response = await supertest.get(
- `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/status`
+ `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`
);
expect(response.status).to.eql(200);
@@ -184,7 +184,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
await waitForEvents(createdAlert.id, ['execute']);
const response = await supertest.get(
- `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/status`
+ `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`
);
const { errorMessages } = response.body;
expect(errorMessages.length).to.be.greaterThan(0);
@@ -218,7 +218,7 @@ export default function createGetAlertStatusTests({ getService }: FtrProviderCon
await alertUtils.muteInstance(createdAlert.id, 'instanceD');
await waitForEvents(createdAlert.id, ['new-instance', 'resolved-instance']);
const response = await supertest.get(
- `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/status`
+ `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_instance_summary`
);
const actualInstances = response.body.instances;
diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts
index 78ca2af12ec3f..3a3fed22f0206 100644
--- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts
+++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts
@@ -16,7 +16,7 @@ export default function alertingTests({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./find'));
loadTestFile(require.resolve('./get'));
loadTestFile(require.resolve('./get_alert_state'));
- loadTestFile(require.resolve('./get_alert_status'));
+ loadTestFile(require.resolve('./get_alert_instance_summary'));
loadTestFile(require.resolve('./list_alert_types'));
loadTestFile(require.resolve('./event_log'));
loadTestFile(require.resolve('./mute_all'));
diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts
index 1579d041c9f58..4c97c8556d7df 100644
--- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts
+++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts
@@ -361,7 +361,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// await first run to complete so we have an initial state
await retry.try(async () => {
- const { instances: alertInstances } = await alerting.alerts.getAlertStatus(alert.id);
+ const { instances: alertInstances } = await alerting.alerts.getAlertInstanceSummary(
+ alert.id
+ );
expect(Object.keys(alertInstances).length).to.eql(instances.length);
});
});
@@ -373,10 +375,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Verify content
await testSubjects.existOrFail('alertInstancesList');
- const status = await alerting.alerts.getAlertStatus(alert.id);
+ const summary = await alerting.alerts.getAlertInstanceSummary(alert.id);
const dateOnAllInstancesFromApiResponse = mapValues(
- status.instances,
+ summary.instances,
(instance) => instance.activeStartDate
);
@@ -570,7 +572,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// await first run to complete so we have an initial state
await retry.try(async () => {
- const { instances: alertInstances } = await alerting.alerts.getAlertStatus(alert.id);
+ const { instances: alertInstances } = await alerting.alerts.getAlertInstanceSummary(
+ alert.id
+ );
expect(Object.keys(alertInstances).length).to.eql(instances.length);
});
@@ -591,7 +595,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Verify content
await testSubjects.existOrFail('alertInstancesList');
- const { instances: alertInstances } = await alerting.alerts.getAlertStatus(alert.id);
+ const { instances: alertInstances } = await alerting.alerts.getAlertInstanceSummary(
+ alert.id
+ );
const items = await pageObjects.alertDetailsUI.getAlertInstancesList();
expect(items.length).to.eql(PAGE_SIZE);
@@ -604,7 +610,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Verify content
await testSubjects.existOrFail('alertInstancesList');
- const { instances: alertInstances } = await alerting.alerts.getAlertStatus(alert.id);
+ const { instances: alertInstances } = await alerting.alerts.getAlertInstanceSummary(
+ alert.id
+ );
await pageObjects.alertDetailsUI.clickPaginationNextPage();
diff --git a/x-pack/test/functional_with_es_ssl/services/alerting/alerts.ts b/x-pack/test/functional_with_es_ssl/services/alerting/alerts.ts
index c6fbdecf77f16..942b352b4afd3 100644
--- a/x-pack/test/functional_with_es_ssl/services/alerting/alerts.ts
+++ b/x-pack/test/functional_with_es_ssl/services/alerting/alerts.ts
@@ -8,7 +8,7 @@ import axios, { AxiosInstance } from 'axios';
import util from 'util';
import { ToolingLog } from '@kbn/dev-utils';
-export interface AlertStatus {
+export interface AlertInstanceSummary {
status: string;
muted: boolean;
enabled: boolean;
@@ -156,10 +156,10 @@ export class Alerts {
this.log.debug(`deleted alert ${alert.id}`);
}
- public async getAlertStatus(id: string): Promise {
+ public async getAlertInstanceSummary(id: string): Promise {
this.log.debug(`getting alert ${id} state`);
- const { data } = await this.axios.get(`/api/alerts/alert/${id}/status`);
+ const { data } = await this.axios.get(`/api/alerts/alert/${id}/_instance_summary`);
return data;
}