import { css } from '@emotion/css'; import React, { useState, useEffect } from 'react'; import { GrafanaTheme2, intervalToAbbreviatedDurationString } from '@grafana/data'; import { useStyles2, LinkButton } from '@grafana/ui'; import { AlertLabels } from 'app/features/alerting/unified/components/AlertLabels'; import { CollapseToggle } from 'app/features/alerting/unified/components/CollapseToggle'; import { AlertGroupHeader } from 'app/features/alerting/unified/components/alert-groups/AlertGroupHeader'; import { getNotificationsTextColors } from 'app/features/alerting/unified/styles/notifications'; import { makeAMLink, makeLabelBasedSilenceLink } from 'app/features/alerting/unified/utils/misc'; import { AlertmanagerGroup, AlertState } from 'app/plugins/datasource/alertmanager/types'; type Props = { alertManagerSourceName: string; group: AlertmanagerGroup; expandAll: boolean; }; export const AlertGroup = ({ alertManagerSourceName, group, expandAll }: Props) => { const [showAlerts, setShowAlerts] = useState(expandAll); const styles = useStyles2(getStyles); const textStyles = useStyles2(getNotificationsTextColors); useEffect(() => setShowAlerts(expandAll), [expandAll]); return (