[Transform] Add alerting rules management to Transform UI (#115363)

* transform alert flyout

* fetch alerting rules

* show alerting rules indicators

* filter continuous transforms

* add alert rules to the expanded row

* edit alert rule from the list

* fix ts issues

* fix types

* update texts

* refactor using context, wip create alert from the list

* update unit test

* fix ts issue

* privilege check
This commit is contained in:
Dima Arnautov 2021-10-19 17:15:52 +02:00 committed by GitHub
parent b306f8e2c3
commit 2aaa515bbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 539 additions and 74 deletions

View file

@ -12,7 +12,7 @@ import type { ES_FIELD_TYPES } from '../../../../../src/plugins/data/common';
import type { Dictionary } from '../types/common';
import type { PivotAggDict } from '../types/pivot_aggs';
import type { PivotGroupByDict } from '../types/pivot_group_by';
import type { TransformId, TransformPivotConfig } from '../types/transform';
import type { TransformId, TransformConfigUnion } from '../types/transform';
import { transformStateSchema, runtimeMappingsSchema } from './common';
@ -33,7 +33,7 @@ export type GetTransformsRequestSchema = TypeOf<typeof getTransformsRequestSchem
export interface GetTransformsResponseSchema {
count: number;
transforms: TransformPivotConfig[];
transforms: TransformConfigUnion[];
}
// schemas shared by parts of the preview, create and update endpoint

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type { AlertTypeParams } from '../../../alerting/common';
import type { Alert, AlertTypeParams } from '../../../alerting/common';
export type TransformHealthRuleParams = {
includeTransforms?: string[];
@ -20,3 +20,5 @@ export type TransformHealthRuleParams = {
export type TransformHealthRuleTestsConfig = TransformHealthRuleParams['testsConfig'];
export type TransformHealthTests = keyof Exclude<TransformHealthRuleTestsConfig, null | undefined>;
export type TransformHealthAlertRule = Omit<Alert<TransformHealthRuleParams>, 'apiKey'>;

View file

@ -5,11 +5,12 @@
* 2.0.
*/
import { EuiComboBoxOptionOption } from '@elastic/eui/src/components/combo_box/types';
import type { EuiComboBoxOptionOption } from '@elastic/eui/src/components/combo_box/types';
import type { LatestFunctionConfig, PutTransformsRequestSchema } from '../api_schemas/transforms';
import { isPopulatedObject } from '../shared_imports';
import { PivotGroupByDict } from './pivot_group_by';
import { PivotAggDict } from './pivot_aggs';
import type { PivotGroupByDict } from './pivot_group_by';
import type { PivotAggDict } from './pivot_aggs';
import type { TransformHealthAlertRule } from './alerting';
export type IndexName = string;
export type IndexPattern = string;
@ -22,6 +23,7 @@ export type TransformBaseConfig = PutTransformsRequestSchema & {
id: TransformId;
create_time?: number;
version?: string;
alerting_rules?: TransformHealthAlertRule[];
};
export interface PivotConfigDefinition {
@ -45,6 +47,11 @@ export type TransformLatestConfig = Omit<TransformBaseConfig, 'pivot'> & {
export type TransformConfigUnion = TransformPivotConfig | TransformLatestConfig;
export type ContinuousTransform = Omit<TransformConfigUnion, 'sync'> &
Required<{
sync: TransformConfigUnion['sync'];
}>;
export function isPivotTransform(transform: unknown): transform is TransformPivotConfig {
return isPopulatedObject(transform, ['pivot']);
}
@ -53,6 +60,10 @@ export function isLatestTransform(transform: unknown): transform is TransformLat
return isPopulatedObject(transform, ['latest']);
}
export function isContinuousTransform(transform: unknown): transform is ContinuousTransform {
return isPopulatedObject(transform, ['sync']);
}
export interface LatestFunctionConfigUI {
unique_key: Array<EuiComboBoxOptionOption<string>> | undefined;
sort: EuiComboBoxOptionOption<string> | undefined;