import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; import { LinkButton, useStyles2 } from '@grafana/ui'; import { AlertmanagerAlert, AlertState } from 'app/plugins/datasource/alertmanager/types'; import React, { FC } from 'react'; import { makeAMLink } from '../../utils/misc'; import { AnnotationDetailsField } from '../AnnotationDetailsField'; import { getMatcherQueryParams } from '../../utils/matchers'; interface AmNotificationsAlertDetailsProps { alertManagerSourceName: string; alert: AlertmanagerAlert; } export const AlertDetails: FC = ({ alert, alertManagerSourceName }) => { const styles = useStyles2(getStyles); return ( <>
{alert.status.state === AlertState.Suppressed && ( Manage silences )} {alert.status.state === AlertState.Active && ( Silence )} {alert.generatorURL && ( See source )}
{Object.entries(alert.annotations).map(([annotationKey, annotationValue]) => ( ))}
Receivers:{' '} {alert.receivers .map(({ name }) => name) .filter((name) => !!name) .join(', ')}
); }; const getStyles = (theme: GrafanaTheme2) => ({ button: css` & + & { margin-left: ${theme.spacing(1)}; } `, actionsRow: css` padding: ${theme.spacing(2, 0)} !important; border-bottom: 1px solid ${theme.colors.border.medium}; `, receivers: css` padding: ${theme.spacing(1, 0)}; `, });