diff --git a/public/app/features/alerting/unified/components/rule-viewer/StateBadges.tsx b/public/app/features/alerting/unified/components/rule-viewer/StateBadges.tsx index 4dafeb52d17..d213f07103f 100644 --- a/public/app/features/alerting/unified/components/rule-viewer/StateBadges.tsx +++ b/public/app/features/alerting/unified/components/rule-viewer/StateBadges.tsx @@ -48,6 +48,10 @@ export const StateBadge = ({ state, health }: StateBadgeProps) => { color = 'warning'; stateLabel = 'Recovering'; break; + case PromAlertingRuleState.Unknown: + color = 'info'; + stateLabel = 'Unknown'; + break; } // if the rule is in "error" health we don't really care about the state @@ -65,7 +69,7 @@ export const StateBadge = ({ state, health }: StateBadgeProps) => { }; // the generic badge component -type BadgeColor = 'success' | 'error' | 'warning'; +type BadgeColor = 'success' | 'error' | 'warning' | 'info'; interface BadgeProps { color: BadgeColor; diff --git a/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx b/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx index b3e5536bfff..e36cb859c60 100644 --- a/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx @@ -36,6 +36,7 @@ export const RuleListStateView = ({ namespaces }: Props) => { [PromAlertingRuleState.Pending, []], [PromAlertingRuleState.Recovering, []], [PromAlertingRuleState.Inactive, []], + [PromAlertingRuleState.Unknown, []], ]); namespaces.forEach((namespace) => @@ -75,6 +76,7 @@ const STATE_TITLES: Record = { [PromAlertingRuleState.Pending]: 'Pending', [PromAlertingRuleState.Inactive]: 'Normal', [PromAlertingRuleState.Recovering]: 'Recovering', + [PromAlertingRuleState.Unknown]: 'Unknown', }; const RulesByState = ({ state, rules }: { state: PromAlertingRuleState; rules: CombinedRule[] }) => { diff --git a/public/app/features/alerting/unified/rule-list/StateView.tsx b/public/app/features/alerting/unified/rule-list/StateView.tsx index 1fd4efff11b..5fd2644acf0 100644 --- a/public/app/features/alerting/unified/rule-list/StateView.tsx +++ b/public/app/features/alerting/unified/rule-list/StateView.tsx @@ -34,6 +34,7 @@ export const StateView = ({ namespaces }: Props) => { [PromAlertingRuleState.Pending, []], [PromAlertingRuleState.Recovering, []], [PromAlertingRuleState.Inactive, []], + [PromAlertingRuleState.Unknown, []], ]); namespaces.forEach((namespace) => @@ -70,6 +71,7 @@ const STATE_TITLES: Record = { [PromAlertingRuleState.Pending]: 'Pending', [PromAlertingRuleState.Inactive]: 'Normal', [PromAlertingRuleState.Recovering]: 'Recovering', + [PromAlertingRuleState.Unknown]: 'Unknown', }; const RulesByState = ({ state, rules }: { state: PromAlertingRuleState; rules: CombinedRule[] }) => { diff --git a/public/app/features/alerting/unified/rule-list/components/RuleListIcon.tsx b/public/app/features/alerting/unified/rule-list/components/RuleListIcon.tsx index 4dc1cba7338..f9a4de439d6 100644 --- a/public/app/features/alerting/unified/rule-list/components/RuleListIcon.tsx +++ b/public/app/features/alerting/unified/rule-list/components/RuleListIcon.tsx @@ -29,13 +29,15 @@ const icons: Record = { [PromAlertingRuleState.Pending]: 'circle', [PromAlertingRuleState.Recovering]: 'exclamation-circle', [PromAlertingRuleState.Firing]: 'exclamation-circle', + [PromAlertingRuleState.Unknown]: 'question-circle', }; -const color: Record = { +const color: Record = { [PromAlertingRuleState.Inactive]: 'success', [PromAlertingRuleState.Pending]: 'warning', [PromAlertingRuleState.Recovering]: 'warning', [PromAlertingRuleState.Firing]: 'error', + [PromAlertingRuleState.Unknown]: 'info', }; const stateNames: Record = { @@ -43,6 +45,7 @@ const stateNames: Record = { [PromAlertingRuleState.Pending]: 'Pending', [PromAlertingRuleState.Firing]: 'Firing', [PromAlertingRuleState.Recovering]: 'Recovering', + [PromAlertingRuleState.Unknown]: 'Unknown', }; const operationIcons: Record = { diff --git a/public/app/features/alerting/unified/utils/misc.ts b/public/app/features/alerting/unified/utils/misc.ts index daa97475a52..d63b2f42497 100644 --- a/public/app/features/alerting/unified/utils/misc.ts +++ b/public/app/features/alerting/unified/utils/misc.ts @@ -222,6 +222,7 @@ const alertStateSortScore = { [PromAlertingRuleState.Inactive]: 2, [GrafanaAlertState.NoData]: 3, [GrafanaAlertState.Normal]: 4, + [PromAlertingRuleState.Unknown]: 5, }; export function sortAlerts(sortOrder: SortOrder, alerts: Alert[]): Alert[] { diff --git a/public/app/types/unified-alerting-dto.ts b/public/app/types/unified-alerting-dto.ts index b3d66445587..5f220449f3e 100644 --- a/public/app/types/unified-alerting-dto.ts +++ b/public/app/types/unified-alerting-dto.ts @@ -13,6 +13,7 @@ export enum PromAlertingRuleState { Inactive = 'inactive', Pending = 'pending', Recovering = 'recovering', + Unknown = 'unknown', } export enum GrafanaAlertState {