Skip to content

Commit ce45dad

Browse files
Changed alerting API endpoints urls, bodies and params to follow Kibana STYLEGUIDE (#66838)
* Changed alerting API endpoints urls, bodies and params to follow Kibana STYLEGUIDE * Changed alerting REST API to keep the pattern 'alerts/alert/{id}' * fixed tests * fixed tests * Fixed jest tests * Renamed plugin from alerting to alerts * fixed tests * fixed tests * Fixed alert type check error * Fixed find api * fixed type checks * fixed tests security issues * Fixed view in app * - Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 78d5026 commit ce45dad

File tree

317 files changed

+766
-734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

317 files changed

+766
-734
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
/x-pack/plugins/telemetry_collection_xpack/ @elastic/pulse
177177

178178
# Kibana Alerting Services
179-
/x-pack/plugins/alerting/ @elastic/kibana-alerting-services
179+
/x-pack/plugins/alerts/ @elastic/kibana-alerting-services
180180
/x-pack/plugins/actions/ @elastic/kibana-alerting-services
181181
/x-pack/plugins/event_log/ @elastic/kibana-alerting-services
182182
/x-pack/plugins/task_manager/ @elastic/kibana-alerting-services

examples/alerting_example/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"kibanaVersion": "kibana",
55
"server": true,
66
"ui": true,
7-
"requiredPlugins": ["triggers_actions_ui", "charts", "data", "alerting", "actions"],
7+
"requiredPlugins": ["triggers_actions_ui", "charts", "data", "alerts", "actions"],
88
"optionalPlugins": []
99
}

examples/alerting_example/public/alert_types/astros.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ import {
3232
import { i18n } from '@kbn/i18n';
3333
import { flatten } from 'lodash';
3434
import { ALERTING_EXAMPLE_APP_ID, Craft, Operator } from '../../common/constants';
35-
import { SanitizedAlert } from '../../../../x-pack/plugins/alerting/common';
36-
import { PluginSetupContract as AlertingSetup } from '../../../../x-pack/plugins/alerting/public';
35+
import { SanitizedAlert } from '../../../../x-pack/plugins/alerts/common';
36+
import { PluginSetupContract as AlertingSetup } from '../../../../x-pack/plugins/alerts/public';
3737
import { AlertTypeModel } from '../../../../x-pack/plugins/triggers_actions_ui/public';
3838

39-
export function registerNavigation(alerting: AlertingSetup) {
40-
alerting.registerNavigation(
39+
export function registerNavigation(alerts: AlertingSetup) {
40+
alerts.registerNavigation(
4141
ALERTING_EXAMPLE_APP_ID,
4242
'example.people-in-space',
4343
(alert: SanitizedAlert) => `/astros/${alert.id}`

examples/alerting_example/public/alert_types/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
import { registerNavigation as registerPeopleInSpaceNavigation } from './astros';
2121
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
22-
import { SanitizedAlert } from '../../../../x-pack/plugins/alerting/common';
23-
import { PluginSetupContract as AlertingSetup } from '../../../../x-pack/plugins/alerting/public';
22+
import { SanitizedAlert } from '../../../../x-pack/plugins/alerts/common';
23+
import { PluginSetupContract as AlertingSetup } from '../../../../x-pack/plugins/alerts/public';
2424

25-
export function registerNavigation(alerting: AlertingSetup) {
25+
export function registerNavigation(alerts: AlertingSetup) {
2626
// register default navigation
27-
alerting.registerDefaultNavigation(
27+
alerts.registerDefaultNavigation(
2828
ALERTING_EXAMPLE_APP_ID,
2929
(alert: SanitizedAlert) => `/alert/${alert.id}`
3030
);
3131

32-
registerPeopleInSpaceNavigation(alerting);
32+
registerPeopleInSpaceNavigation(alerts);
3333
}

examples/alerting_example/public/components/view_alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
Alert,
3737
AlertTaskState,
3838
BASE_ALERT_API_PATH,
39-
} from '../../../../x-pack/plugins/alerting/common';
39+
} from '../../../../x-pack/plugins/alerts/common';
4040
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
4141

4242
type Props = RouteComponentProps & {

examples/alerting_example/public/components/view_astros_alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838
Alert,
3939
AlertTaskState,
4040
BASE_ALERT_API_PATH,
41-
} from '../../../../x-pack/plugins/alerting/common';
41+
} from '../../../../x-pack/plugins/alerts/common';
4242
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
4343

4444
type Props = RouteComponentProps & {

examples/alerting_example/public/plugin.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { Plugin, CoreSetup, AppMountParameters } from 'kibana/public';
21-
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerting/public';
21+
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerts/public';
2222
import { ChartsPluginStart } from '../../../src/plugins/charts/public';
2323
import { TriggersAndActionsUIPublicPluginSetup } from '../../../x-pack/plugins/triggers_actions_ui/public';
2424
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
@@ -30,12 +30,12 @@ export type Setup = void;
3030
export type Start = void;
3131

3232
export interface AlertingExamplePublicSetupDeps {
33-
alerting: AlertingSetup;
33+
alerts: AlertingSetup;
3434
triggers_actions_ui: TriggersAndActionsUIPublicPluginSetup;
3535
}
3636

3737
export interface AlertingExamplePublicStartDeps {
38-
alerting: AlertingSetup;
38+
alerts: AlertingSetup;
3939
triggers_actions_ui: TriggersAndActionsUIPublicPluginSetup;
4040
charts: ChartsPluginStart;
4141
data: DataPublicPluginStart;
@@ -44,7 +44,7 @@ export interface AlertingExamplePublicStartDeps {
4444
export class AlertingExamplePlugin implements Plugin<Setup, Start, AlertingExamplePublicSetupDeps> {
4545
public setup(
4646
core: CoreSetup<AlertingExamplePublicStartDeps, Start>,
47-
{ alerting, triggers_actions_ui }: AlertingExamplePublicSetupDeps
47+
{ alerts, triggers_actions_ui }: AlertingExamplePublicSetupDeps
4848
) {
4949
core.application.register({
5050
id: 'AlertingExample',
@@ -59,7 +59,7 @@ export class AlertingExamplePlugin implements Plugin<Setup, Start, AlertingExamp
5959
triggers_actions_ui.alertTypeRegistry.register(getAlwaysFiringAlertType());
6060
triggers_actions_ui.alertTypeRegistry.register(getPeopleInSpaceAlertType());
6161

62-
registerNavigation(alerting);
62+
registerNavigation(alerts);
6363
}
6464

6565
public start() {}

examples/alerting_example/server/alert_types/always_firing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import uuid from 'uuid';
2121
import { range } from 'lodash';
22-
import { AlertType } from '../../../../x-pack/plugins/alerting/server';
22+
import { AlertType } from '../../../../x-pack/plugins/alerts/server';
2323
import { DEFAULT_INSTANCES_TO_GENERATE, ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
2424

2525
export const alertType: AlertType = {

examples/alerting_example/server/alert_types/astros.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import axios from 'axios';
21-
import { AlertType } from '../../../../x-pack/plugins/alerting/server';
21+
import { AlertType } from '../../../../x-pack/plugins/alerts/server';
2222
import { Operator, Craft, ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
2323

2424
interface PeopleInSpace {

examples/alerting_example/server/plugin.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
*/
1919

2020
import { Plugin, CoreSetup } from 'kibana/server';
21-
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerting/server';
21+
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerts/server';
2222

2323
import { alertType as alwaysFiringAlert } from './alert_types/always_firing';
2424
import { alertType as peopleInSpaceAlert } from './alert_types/astros';
2525

2626
// this plugin's dependendencies
2727
export interface AlertingExampleDeps {
28-
alerting: AlertingSetup;
28+
alerts: AlertingSetup;
2929
}
3030

3131
export class AlertingExamplePlugin implements Plugin<void, void, AlertingExampleDeps> {
32-
public setup(core: CoreSetup, { alerting }: AlertingExampleDeps) {
33-
alerting.registerType(alwaysFiringAlert);
34-
alerting.registerType(peopleInSpaceAlert);
32+
public setup(core: CoreSetup, { alerts }: AlertingExampleDeps) {
33+
alerts.registerType(alwaysFiringAlert);
34+
alerts.registerType(peopleInSpaceAlert);
3535
}
3636

3737
public start() {}

0 commit comments

Comments
 (0)