diff --git a/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx b/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx index 3d423a8a843..53ae44a13a9 100644 --- a/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx +++ b/public/app/plugins/panel/alertlist/UnifiedAlertList.tsx @@ -30,6 +30,14 @@ export function UnifiedAlertList(props: PanelProps) { const dispatch = useDispatch(); const rulesDataSourceNames = useMemo(getAllRulesSourceNames, []); + // backwards compat for "Inactive" state filter + useEffect(() => { + if (props.options.stateFilter.inactive === true) { + props.options.stateFilter.normal = true; // enable the normal filter + } + props.options.stateFilter.inactive = undefined; // now disable inactive + }, [props.options.stateFilter]); + useEffect(() => { dispatch(fetchAllPromRulesAction()); const interval = setInterval(() => dispatch(fetchAllPromRulesAction()), RULE_LIST_POLL_INTERVAL_MS); @@ -127,7 +135,7 @@ function filterRules(props: PanelProps, rules: PromRule return ( (options.stateFilter.firing && rule.rule.state === PromAlertingRuleState.Firing) || (options.stateFilter.pending && rule.rule.state === PromAlertingRuleState.Pending) || - (options.stateFilter.inactive && rule.rule.state === PromAlertingRuleState.Inactive) + (options.stateFilter.normal && rule.rule.state === PromAlertingRuleState.Inactive) ); }); diff --git a/public/app/plugins/panel/alertlist/module.tsx b/public/app/plugins/panel/alertlist/module.tsx index 1b0bcf65a87..fae016c8469 100644 --- a/public/app/plugins/panel/alertlist/module.tsx +++ b/public/app/plugins/panel/alertlist/module.tsx @@ -284,12 +284,6 @@ const unifiedAlertList = new PanelPlugin(UnifiedAlertLi defaultValue: true, category: ['Alert state filter'], }) - .addBooleanSwitch({ - path: 'stateFilter.inactive', - name: 'Inactive', - defaultValue: false, - category: ['Alert state filter'], - }) .addBooleanSwitch({ path: 'stateFilter.noData', name: 'No Data', diff --git a/public/app/plugins/panel/alertlist/types.ts b/public/app/plugins/panel/alertlist/types.ts index 76983e8922a..ec79c8b1e0f 100644 --- a/public/app/plugins/panel/alertlist/types.ts +++ b/public/app/plugins/panel/alertlist/types.ts @@ -40,7 +40,7 @@ export interface AlertListOptions { interface StateFilter { firing: boolean; pending: boolean; - inactive: boolean; + inactive?: boolean; // backwards compat noData: boolean; normal: boolean; error: boolean; diff --git a/public/app/plugins/panel/alertlist/unified-alerting/UngroupedView.tsx b/public/app/plugins/panel/alertlist/unified-alerting/UngroupedView.tsx index 2091462e634..08d8a328b03 100644 --- a/public/app/plugins/panel/alertlist/unified-alerting/UngroupedView.tsx +++ b/public/app/plugins/panel/alertlist/unified-alerting/UngroupedView.tsx @@ -4,7 +4,7 @@ import React, { FC } from 'react'; import { GrafanaTheme2, intervalToAbbreviatedDurationString } from '@grafana/data'; import { Icon, IconName, useStyles2 } from '@grafana/ui'; import alertDef from 'app/features/alerting/state/alertDef'; -import { alertStateToState, getFirstActiveAt } from 'app/features/alerting/unified/utils/rules'; +import { alertStateToReadable, alertStateToState, getFirstActiveAt } from 'app/features/alerting/unified/utils/rules'; import { PromRuleWithLocation } from 'app/types/unified-alerting'; import { PromAlertingRuleState } from 'app/types/unified-alerting-dto'; @@ -44,7 +44,9 @@ const UngroupedModeView: FC = ({ rules, options }) => { {rule.name}
- {rule.state.toUpperCase()}{' '} + + {alertStateToReadable(rule.state)} + {' '} {firstActiveAt && rule.state !== PromAlertingRuleState.Inactive && ( <> for{' '}