mirror of https://github.com/grafana/grafana.git
Pass receiver name through components in order to still display name
This commit is contained in:
parent
641c28c549
commit
dc52ba9d9d
|
@ -79,6 +79,7 @@ function NotificationPreviewByAlertManager({
|
||||||
route={route}
|
route={route}
|
||||||
// If we can't find a receiver, it might just be because the user doesn't have access
|
// If we can't find a receiver, it might just be because the user doesn't have access
|
||||||
receiver={receiver ? receiver : undefined}
|
receiver={receiver ? receiver : undefined}
|
||||||
|
receiverName={route?.receiver ? route.receiver : undefined}
|
||||||
key={routeId}
|
key={routeId}
|
||||||
routesByIdMap={routesByIdMap}
|
routesByIdMap={routesByIdMap}
|
||||||
alertManagerSourceName={alertManagerSource.name}
|
alertManagerSourceName={alertManagerSource.name}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { RouteWithPath } from './route';
|
||||||
function NotificationRouteHeader({
|
function NotificationRouteHeader({
|
||||||
route,
|
route,
|
||||||
receiver,
|
receiver,
|
||||||
|
receiverName,
|
||||||
routesByIdMap,
|
routesByIdMap,
|
||||||
instancesCount,
|
instancesCount,
|
||||||
alertManagerSourceName,
|
alertManagerSourceName,
|
||||||
|
@ -32,6 +33,7 @@ function NotificationRouteHeader({
|
||||||
}: {
|
}: {
|
||||||
route: RouteWithPath;
|
route: RouteWithPath;
|
||||||
receiver?: Receiver;
|
receiver?: Receiver;
|
||||||
|
receiverName?: string;
|
||||||
routesByIdMap: Map<string, RouteWithPath>;
|
routesByIdMap: Map<string, RouteWithPath>;
|
||||||
instancesCount: number;
|
instancesCount: number;
|
||||||
alertManagerSourceName: string;
|
alertManagerSourceName: string;
|
||||||
|
@ -77,7 +79,7 @@ function NotificationRouteHeader({
|
||||||
<span className={styles.textMuted}>
|
<span className={styles.textMuted}>
|
||||||
<Trans i18nKey="alerting.notification-route-header.delivered-to">@ Delivered to</Trans>
|
<Trans i18nKey="alerting.notification-route-header.delivered-to">@ Delivered to</Trans>
|
||||||
</span>{' '}
|
</span>{' '}
|
||||||
{receiver ? receiver.name : <UnknownContactPointDetails />}
|
{receiver ? receiver.name : <UnknownContactPointDetails receiverName={receiverName} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.verticalBar} />
|
<div className={styles.verticalBar} />
|
||||||
|
@ -93,6 +95,7 @@ function NotificationRouteHeader({
|
||||||
onClose={() => setShowDetails(false)}
|
onClose={() => setShowDetails(false)}
|
||||||
route={route}
|
route={route}
|
||||||
receiver={receiver}
|
receiver={receiver}
|
||||||
|
receiverName={receiverName}
|
||||||
routesByIdMap={routesByIdMap}
|
routesByIdMap={routesByIdMap}
|
||||||
alertManagerSourceName={alertManagerSourceName}
|
alertManagerSourceName={alertManagerSourceName}
|
||||||
/>
|
/>
|
||||||
|
@ -104,6 +107,7 @@ function NotificationRouteHeader({
|
||||||
interface NotificationRouteProps {
|
interface NotificationRouteProps {
|
||||||
route: RouteWithPath;
|
route: RouteWithPath;
|
||||||
receiver?: Receiver;
|
receiver?: Receiver;
|
||||||
|
receiverName?: string;
|
||||||
instanceMatches: AlertInstanceMatch[];
|
instanceMatches: AlertInstanceMatch[];
|
||||||
routesByIdMap: Map<string, RouteWithPath>;
|
routesByIdMap: Map<string, RouteWithPath>;
|
||||||
alertManagerSourceName: string;
|
alertManagerSourceName: string;
|
||||||
|
@ -113,6 +117,7 @@ export function NotificationRoute({
|
||||||
route,
|
route,
|
||||||
instanceMatches,
|
instanceMatches,
|
||||||
receiver,
|
receiver,
|
||||||
|
receiverName,
|
||||||
routesByIdMap,
|
routesByIdMap,
|
||||||
alertManagerSourceName,
|
alertManagerSourceName,
|
||||||
}: NotificationRouteProps) {
|
}: NotificationRouteProps) {
|
||||||
|
@ -127,6 +132,7 @@ export function NotificationRoute({
|
||||||
<NotificationRouteHeader
|
<NotificationRouteHeader
|
||||||
route={route}
|
route={route}
|
||||||
receiver={receiver}
|
receiver={receiver}
|
||||||
|
receiverName={receiverName}
|
||||||
routesByIdMap={routesByIdMap}
|
routesByIdMap={routesByIdMap}
|
||||||
instancesCount={instanceMatches.length}
|
instancesCount={instanceMatches.length}
|
||||||
alertManagerSourceName={alertManagerSourceName}
|
alertManagerSourceName={alertManagerSourceName}
|
||||||
|
|
|
@ -56,6 +56,7 @@ interface NotificationRouteDetailsModalProps {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
route: RouteWithPath;
|
route: RouteWithPath;
|
||||||
receiver?: Receiver;
|
receiver?: Receiver;
|
||||||
|
receiverName?: string;
|
||||||
routesByIdMap: Map<string, RouteWithPath>;
|
routesByIdMap: Map<string, RouteWithPath>;
|
||||||
alertManagerSourceName: string;
|
alertManagerSourceName: string;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +65,7 @@ export function NotificationRouteDetailsModal({
|
||||||
onClose,
|
onClose,
|
||||||
route,
|
route,
|
||||||
receiver,
|
receiver,
|
||||||
|
receiverName,
|
||||||
routesByIdMap,
|
routesByIdMap,
|
||||||
alertManagerSourceName,
|
alertManagerSourceName,
|
||||||
}: NotificationRouteDetailsModalProps) {
|
}: NotificationRouteDetailsModalProps) {
|
||||||
|
@ -108,7 +110,9 @@ export function NotificationRouteDetailsModal({
|
||||||
<Stack gap={1} direction="column">
|
<Stack gap={1} direction="column">
|
||||||
<Trans i18nKey="alerting.notification-route-details-modal.contact-point">Contact point</Trans>
|
<Trans i18nKey="alerting.notification-route-details-modal.contact-point">Contact point</Trans>
|
||||||
|
|
||||||
<span className={styles.textMuted}>{receiver ? receiver.name : <UnknownContactPointDetails />}</span>
|
<span className={styles.textMuted}>
|
||||||
|
{receiver ? receiver.name : <UnknownContactPointDetails receiverName={receiverName} />}
|
||||||
|
</span>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Authorize actions={[AlertmanagerAction.UpdateContactPoint]}>
|
<Authorize actions={[AlertmanagerAction.UpdateContactPoint]}>
|
||||||
<Stack gap={1} direction="row" alignItems="center">
|
<Stack gap={1} direction="row" alignItems="center">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Tooltip } from '@grafana/ui';
|
import { Tooltip } from '@grafana/ui';
|
||||||
import { Trans, t } from 'app/core/internationalization';
|
import { Trans, t } from 'app/core/internationalization';
|
||||||
|
|
||||||
const UnknownContactPointDetails = () => (
|
const UnknownContactPointDetails = ({ receiverName }: { receiverName?: string }) => (
|
||||||
<span style={{ cursor: 'help' }}>
|
<span style={{ cursor: 'help' }}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={t(
|
content={t(
|
||||||
|
@ -10,7 +10,11 @@ const UnknownContactPointDetails = () => (
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
|
{receiverName ? (
|
||||||
|
receiverName
|
||||||
|
) : (
|
||||||
<Trans i18nKey="alerting.unknown-contact-point-details.unknown-contact-point">Unknown contact point</Trans>
|
<Trans i18nKey="alerting.unknown-contact-point-details.unknown-contact-point">Unknown contact point</Trans>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in New Issue