Alerting: miscllaneous UI fixes & improvements (#33734)

This commit is contained in:
Domas
2021-05-06 11:21:58 +03:00
committed by GitHub
parent d994d0e762
commit d2d13ea39a
27 changed files with 217 additions and 157 deletions

View File

@@ -11,6 +11,14 @@ export enum PromAlertingRuleState {
Pending = 'pending',
}
export enum GrafanaAlertState {
Normal = 'Normal',
Alerting = 'Alerting',
Pending = 'Pending',
NoData = 'NoData',
Error = 'Error',
}
export enum PromRuleType {
Alerting = 'alerting',
Recording = 'recording',
@@ -29,7 +37,7 @@ export interface PromAlertingRuleDTO extends PromRuleDTOBase {
alerts: Array<{
labels: Labels;
annotations: Annotations;
state: Exclude<PromAlertingRuleState, PromAlertingRuleState.Inactive>;
state: Exclude<PromAlertingRuleState | GrafanaAlertState, PromAlertingRuleState.Inactive>;
activeAt: string;
value: string;
}>;
@@ -86,7 +94,7 @@ export interface RulerAlertingRuleDTO extends RulerRuleBaseDTO {
annotations?: Annotations;
}
export enum GrafanaAlertState {
export enum GrafanaAlertStateDecision {
Alerting = 'Alerting',
NoData = 'NoData',
KeepLastState = 'KeepLastState',
@@ -104,8 +112,8 @@ export interface PostableGrafanaRuleDefinition {
uid?: string;
title: string;
condition: string;
no_data_state: GrafanaAlertState;
exec_err_state: GrafanaAlertState;
no_data_state: GrafanaAlertStateDecision;
exec_err_state: GrafanaAlertStateDecision;
data: GrafanaQuery[];
}
export interface GrafanaRuleDefinition extends PostableGrafanaRuleDefinition {

View File

@@ -8,13 +8,14 @@ import {
Labels,
Annotations,
RulerRuleGroupDTO,
GrafanaAlertState,
} from './unified-alerting-dto';
export type Alert = {
activeAt: string;
annotations: { [key: string]: string };
labels: { [key: string]: string };
state: PromAlertingRuleState;
state: PromAlertingRuleState | GrafanaAlertState;
value: string;
};