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
-
- ) : (
- ''
- )
- }
- >
-