This PR includes the following refactors: 1. Moves the Index Pattern Api from _Stack Alerts_ to the _Server_ plugin of _Trigger Actions UI_. This fixes a potential bug where a user could disable the _Stack Alerts_ plugin and inadvertently break the UI of the _ES Index _ action type. 2. Extracts the UI components for _Index Threshold_ and _Geo Threshold_ from the _Trigger Actions UI_ plugin and moves them into _Stack Alerts_.
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/*
|
|
* 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.
|
|
*/
|
|
|
|
import { CoreSetup, Plugin, PluginInitializerContext } from 'src/core/public';
|
|
import { TriggersAndActionsUIPublicPluginSetup } from '../../../plugins/triggers_actions_ui/public';
|
|
import { registerAlertTypes } from './alert_types';
|
|
import { Config } from '../common';
|
|
|
|
export type Setup = void;
|
|
export type Start = void;
|
|
|
|
export interface StackAlertsPublicSetupDeps {
|
|
triggersActionsUi: TriggersAndActionsUIPublicPluginSetup;
|
|
}
|
|
|
|
export class StackAlertsPublicPlugin implements Plugin<Setup, Start, StackAlertsPublicSetupDeps> {
|
|
private initializerContext: PluginInitializerContext;
|
|
|
|
constructor(initializerContext: PluginInitializerContext) {
|
|
this.initializerContext = initializerContext;
|
|
}
|
|
|
|
public setup(core: CoreSetup, { triggersActionsUi }: StackAlertsPublicSetupDeps) {
|
|
registerAlertTypes({
|
|
alertTypeRegistry: triggersActionsUi.alertTypeRegistry,
|
|
config: this.initializerContext.config.get<Config>(),
|
|
});
|
|
}
|
|
|
|
public start() {}
|
|
public stop() {}
|
|
}
|