diff --git a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreview.tsx b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreview.tsx index c1396464c86..c767ebe63d3 100644 --- a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreview.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreview.tsx @@ -4,7 +4,7 @@ import { useEffectOnce } from 'react-use'; import { GrafanaTheme2 } from '@grafana/data'; import { Trans, t } from '@grafana/i18n'; -import { Button, LoadingPlaceholder, Stack, Text, useStyles2 } from '@grafana/ui'; +import { Button, LoadingPlaceholder, Stack, Text, Tooltip, useStyles2 } from '@grafana/ui'; import { alertRuleApi } from 'app/features/alerting/unified/api/alertRuleApi'; import { AlertQuery, Labels } from 'app/types/unified-alerting-dto'; @@ -67,7 +67,9 @@ export const NotificationPreview = ({ }; useEffectOnce(() => { - onPreview(); + if (!disabled) { + onPreview(); + } }); // Get alert managers's data source information @@ -102,9 +104,21 @@ export const NotificationPreview = ({ )} - + + You don't have sufficient permissions to preview + + ) : ( + '' + ) + } + > + + {potentialInstances.length > 0 && (