From dc52ba9d9d51c4635cb236387d1d313d6811db20 Mon Sep 17 00:00:00 2001 From: Tom Ratcliffe Date: Mon, 28 Apr 2025 16:52:56 +0100 Subject: [PATCH] Pass receiver name through components in order to still display name --- .../NotificationPreviewByAlertManager.tsx | 1 + .../rule-editor/notificaton-preview/NotificationRoute.tsx | 8 +++++++- .../notificaton-preview/NotificationRouteDetailsModal.tsx | 6 +++++- .../notificaton-preview/UnknownContactPointDetails.tsx | 8 ++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx index 77230fa7785..e7b0836569c 100644 --- a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationPreviewByAlertManager.tsx @@ -79,6 +79,7 @@ function NotificationPreviewByAlertManager({ route={route} // If we can't find a receiver, it might just be because the user doesn't have access receiver={receiver ? receiver : undefined} + receiverName={route?.receiver ? route.receiver : undefined} key={routeId} routesByIdMap={routesByIdMap} alertManagerSourceName={alertManagerSource.name} diff --git a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx index 5ecf9bd435f..cf0494a14e6 100644 --- a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/NotificationRoute.tsx @@ -24,6 +24,7 @@ import { RouteWithPath } from './route'; function NotificationRouteHeader({ route, receiver, + receiverName, routesByIdMap, instancesCount, alertManagerSourceName, @@ -32,6 +33,7 @@ function NotificationRouteHeader({ }: { route: RouteWithPath; receiver?: Receiver; + receiverName?: string; routesByIdMap: Map; instancesCount: number; alertManagerSourceName: string; @@ -77,7 +79,7 @@ function NotificationRouteHeader({ @ Delivered to {' '} - {receiver ? receiver.name : } + {receiver ? receiver.name : }
@@ -93,6 +95,7 @@ function NotificationRouteHeader({ onClose={() => setShowDetails(false)} route={route} receiver={receiver} + receiverName={receiverName} routesByIdMap={routesByIdMap} alertManagerSourceName={alertManagerSourceName} /> @@ -104,6 +107,7 @@ function NotificationRouteHeader({ interface NotificationRouteProps { route: RouteWithPath; receiver?: Receiver; + receiverName?: string; instanceMatches: AlertInstanceMatch[]; routesByIdMap: Map; alertManagerSourceName: string; @@ -113,6 +117,7 @@ export function NotificationRoute({ route, instanceMatches, receiver, + receiverName, routesByIdMap, alertManagerSourceName, }: NotificationRouteProps) { @@ -127,6 +132,7 @@ export function NotificationRoute({ void; route: RouteWithPath; receiver?: Receiver; + receiverName?: string; routesByIdMap: Map; alertManagerSourceName: string; } @@ -64,6 +65,7 @@ export function NotificationRouteDetailsModal({ onClose, route, receiver, + receiverName, routesByIdMap, alertManagerSourceName, }: NotificationRouteDetailsModalProps) { @@ -108,7 +110,9 @@ export function NotificationRouteDetailsModal({ Contact point - {receiver ? receiver.name : } + + {receiver ? receiver.name : } + diff --git a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/UnknownContactPointDetails.tsx b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/UnknownContactPointDetails.tsx index 7b5fbe3a777..cae79f06f26 100644 --- a/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/UnknownContactPointDetails.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/notificaton-preview/UnknownContactPointDetails.tsx @@ -1,7 +1,7 @@ import { Tooltip } from '@grafana/ui'; import { Trans, t } from 'app/core/internationalization'; -const UnknownContactPointDetails = () => ( +const UnknownContactPointDetails = ({ receiverName }: { receiverName?: string }) => ( ( )} > - Unknown contact point + {receiverName ? ( + receiverName + ) : ( + Unknown contact point + )}