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_.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 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 { Logger, Plugin, CoreSetup, PluginInitializerContext } from 'src/core/server';
|
|
import { getService, register as registerDataService } from './data';
|
|
|
|
export interface PluginStartContract {
|
|
data: ReturnType<typeof getService>;
|
|
}
|
|
|
|
export class TriggersActionsPlugin implements Plugin<void, PluginStartContract> {
|
|
private readonly logger: Logger;
|
|
private readonly data: PluginStartContract['data'];
|
|
|
|
constructor(ctx: PluginInitializerContext) {
|
|
this.logger = ctx.logger.get();
|
|
this.data = getService();
|
|
}
|
|
|
|
public async setup(core: CoreSetup): Promise<void> {
|
|
registerDataService({
|
|
logger: this.logger,
|
|
data: this.data,
|
|
router: core.http.createRouter(),
|
|
baseRoute: '/api/triggers_actions_ui',
|
|
});
|
|
}
|
|
|
|
public async start(): Promise<PluginStartContract> {
|
|
return {
|
|
data: this.data,
|
|
};
|
|
}
|
|
|
|
public async stop(): Promise<void> {}
|
|
}
|