From ef61b67e66dcef44982d33ede3b7304f2d9dcbde Mon Sep 17 00:00:00 2001 From: Lauren <61048546+laurenashleigh@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:37:08 +0000 Subject: [PATCH] Alerting: Update tooltip message when routing preview is disabled (#113962) * update tooltip message * generate translations * update translations --- .../NotificationPreview.tsx | 36 +++++++++++-------- public/locales/en-US/grafana.json | 1 + 2 files changed, 22 insertions(+), 15 deletions(-) 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 c767ebe63d3..0e75531c986 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 @@ -36,7 +36,7 @@ export const NotificationPreview = ({ alertUid, }: NotificationPreviewProps) => { const styles = useStyles2(getStyles); - const disabled = !condition || !folder; + const previewRoutingDisabled = !condition || !folder; const [trigger, { data = [], isLoading, isUninitialized: previewUninitialized }] = preview.useMutation(); @@ -51,7 +51,7 @@ export const NotificationPreview = ({ }, []); const onPreview = () => { - if (!folder || !condition) { + if (previewRoutingDisabled) { return; } @@ -67,7 +67,7 @@ export const NotificationPreview = ({ }; useEffectOnce(() => { - if (!disabled) { + if (!previewRoutingDisabled) { onPreview(); } }); @@ -76,6 +76,22 @@ export const NotificationPreview = ({ const alertManagerDataSources = useGetAlertManagerDataSourcesByPermissionAndConfig('notification'); const singleAlertManagerConfigured = alertManagerDataSources.length === 1; + const getTooltipContent = () => { + if (!folder) { + return ( + Select a folder to preview routing + ); + } + if (previewRoutingDisabled) { + return ( + + You don't have sufficient permissions to preview + + ); + } + return ''; + }; + return ( @@ -104,18 +120,8 @@ export const NotificationPreview = ({ )} - - You don't have sufficient permissions to preview - - ) : ( - '' - ) - } - > - diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 69a73888073..27e47141aad 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -1986,6 +1986,7 @@ "error": "Could not load routing preview for {{alertmanager}}", "initialized": "Based on the labels added, alert instances are routed to the following notification policies. Expand each notification policy below to view more details.", "preview-routing": "Preview routing", + "select-folder-tooltip": "Select a folder to preview routing", "text-loading-preview": "Loading preview...", "title": "Alert instance routing preview", "uninitialized": "When you have your folder selected and your query and labels are configured, click \"Preview routing\" to see the results here."