From d0dcb72683a0b552d7c4c2b2f3b9d4fa85506e41 Mon Sep 17 00:00:00 2001 From: Tom Ratcliffe Date: Mon, 25 Mar 2024 18:09:39 +0000 Subject: [PATCH] Display info message on rule form when a rule is paused --- .../rule-editor/alert-rule-form/AlertRuleForm.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx index 645320c32e7..182f76cad1a 100644 --- a/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/alert-rule-form/AlertRuleForm.tsx @@ -5,12 +5,13 @@ import { Link, useParams } from 'react-router-dom'; import { GrafanaTheme2 } from '@grafana/data'; import { config } from '@grafana/runtime'; -import { Button, ConfirmModal, CustomScrollbar, HorizontalGroup, Spinner, Stack, useStyles2 } from '@grafana/ui'; +import { Alert, Button, ConfirmModal, CustomScrollbar, HorizontalGroup, Spinner, Stack, useStyles2 } from '@grafana/ui'; import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate'; import { useAppNotification } from 'app/core/copy/appNotification'; import { contextSrv } from 'app/core/core'; import { useCleanup } from 'app/core/hooks/useCleanup'; import { useQueryParams } from 'app/core/hooks/useQueryParams'; +import { isGrafanaRulerRule, isGrafanaRulerRulePaused } from 'app/features/alerting/unified/utils/rules'; import { useDispatch } from 'app/types'; import { RuleWithLocation } from 'app/types/unified-alerting'; @@ -230,11 +231,18 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => { ); + const isPaused = existing && isGrafanaRulerRule(existing.rule) && isGrafanaRulerRulePaused(existing.rule); return (
e.preventDefault()} className={styles.form}>
+ {isPaused && ( + + Notifications for this rule will not fire and no alert instances will be created until the rule is + un-paused. + + )} {/* Step 1 */} @@ -339,6 +347,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ contentOuter: css({ background: theme.colors.background.primary, overflow: 'hidden', + maxWidth: theme.breakpoints.values.xl, flex: 1, }), flexRow: css({