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EACxB,OAAIT,EAAwBS,GACnB,CAACA,EAAalP,GAGd,MAACiN,EAAWjN,GAIvB,MAAMmP,EAAcJ,EAAAA,EAAAA,IAAUC,EAAAA,IAC9B,OAAIG,GAAsC,iBAAhBA,GAA4BV,EAAwBU,IAC5EnP,EAAOmP,GACA,CAACA,EAAanP,IAGnByO,EAAwBK,EAAAA,IACnB,CAACA,EAAAA,GAA2B9O,GAG9B,MAACiN,EAAWjN,K,kRC7Dd,SAAS2H,EAA6ByH,GAC3C,OAAO/M,EAAAA,EAAAA,UAAQ,KAAMgN,EAAAA,EAAAA,IAAuCD,IAAa,CAACA","sources":["webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/AlertDetails.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/AlertGroupAlertsTable.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/AlertGroup.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/AlertStateFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/AlertGroupFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/AlertGroups.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useGroupedAlerts.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useFilteredAmGroups.ts","webpack://grafana/./public/app/features/alerting/unified/components/AlertingPageWrapper.tsx","webpack://grafana/./public/app/features/alerting/unified/components/Authorize.tsx","webpack://grafana/./public/app/features/alerting/unified/components/DynamicTableWithGuidelines.tsx","webpack://grafana/./public/app/features/alerting/unified/components/NoAlertManagerWarning.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/MatcherFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/AmAlertStateTag.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useAlertManagerSources.ts"],"sourcesContent":["import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { LinkButton, useStyles2 } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AlertmanagerAlert, AlertState } from 'app/plugins/datasource/alertmanager/types';\nimport { AccessControlAction } from 'app/types';\n\nimport { getInstancesPermissions } from '../../utils/access-control';\nimport { isGrafanaRulesSource } from '../../utils/datasource';\nimport { makeAMLink, makeLabelBasedSilenceLink } from '../../utils/misc';\nimport { AnnotationDetailsField } from '../AnnotationDetailsField';\nimport { Authorize } from '../Authorize';\n\ninterface AmNotificationsAlertDetailsProps {\n  alertManagerSourceName: string;\n  alert: AlertmanagerAlert;\n}\n\nexport const AlertDetails: FC<AmNotificationsAlertDetailsProps> = ({ alert, alertManagerSourceName }) => {\n  const styles = useStyles2(getStyles);\n  const instancePermissions = getInstancesPermissions(alertManagerSourceName);\n\n  // For Grafana Managed alerts the Generator URL redirects to the alert rule edit page, so update permission is required\n  // For external alert manager the Generator URL redirects to an external service which we don't control\n  const isGrafanaSource = isGrafanaRulesSource(alertManagerSourceName);\n  const isSeeSourceButtonEnabled = isGrafanaSource\n    ? contextSrv.hasPermission(AccessControlAction.AlertingRuleRead)\n    : true;\n\n  return (\n    <>\n      <div className={styles.actionsRow}>\n        <Authorize actions={[instancePermissions.update, instancePermissions.create]} fallback={contextSrv.isEditor}>\n          {alert.status.state === AlertState.Suppressed && (\n            <LinkButton\n              href={`${makeAMLink(\n                '/alerting/silences',\n                alertManagerSourceName\n              )}&silenceIds=${alert.status.silencedBy.join(',')}`}\n              className={styles.button}\n              icon={'bell'}\n              size={'sm'}\n            >\n              Manage silences\n            </LinkButton>\n          )}\n          {alert.status.state === AlertState.Active && (\n            <LinkButton\n              href={makeLabelBasedSilenceLink(alertManagerSourceName, alert.labels)}\n              className={styles.button}\n              icon={'bell-slash'}\n              size={'sm'}\n            >\n              Silence\n            </LinkButton>\n          )}\n        </Authorize>\n        {isSeeSourceButtonEnabled && alert.generatorURL && (\n          <LinkButton className={styles.button} href={alert.generatorURL} icon={'chart-line'} size={'sm'}>\n            See source\n          </LinkButton>\n        )}\n      </div>\n      {Object.entries(alert.annotations).map(([annotationKey, annotationValue]) => (\n        <AnnotationDetailsField key={annotationKey} annotationKey={annotationKey} value={annotationValue} />\n      ))}\n      <div className={styles.receivers}>\n        Receivers:{' '}\n        {alert.receivers\n          .map(({ name }) => name)\n          .filter((name) => !!name)\n          .join(', ')}\n      </div>\n    </>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  button: css`\n    & + & {\n      margin-left: ${theme.spacing(1)};\n    }\n  `,\n  actionsRow: css`\n    padding: ${theme.spacing(2, 0)} !important;\n    border-bottom: 1px solid ${theme.colors.border.medium};\n  `,\n  receivers: css`\n    padding: ${theme.spacing(1, 0)};\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { useMemo } from 'react';\n\nimport { GrafanaTheme2, intervalToAbbreviatedDurationString } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { AlertmanagerAlert } from 'app/plugins/datasource/alertmanager/types';\n\nimport { AlertLabels } from '../AlertLabels';\nimport { DynamicTableColumnProps, DynamicTableItemProps } from '../DynamicTable';\nimport { DynamicTableWithGuidelines } from '../DynamicTableWithGuidelines';\nimport { AmAlertStateTag } from '../silences/AmAlertStateTag';\n\nimport { AlertDetails } from './AlertDetails';\n\ninterface Props {\n  alerts: AlertmanagerAlert[];\n  alertManagerSourceName: string;\n}\n\ntype AlertGroupAlertsTableColumnProps = DynamicTableColumnProps<AlertmanagerAlert>;\ntype AlertGroupAlertsTableItemProps = DynamicTableItemProps<AlertmanagerAlert>;\n\nexport const AlertGroupAlertsTable = ({ alerts, alertManagerSourceName }: Props) => {\n  const styles = useStyles2(getStyles);\n\n  const columns = useMemo(\n    (): AlertGroupAlertsTableColumnProps[] => [\n      {\n        id: 'state',\n        label: 'State',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: alert }) => (\n          <>\n            <AmAlertStateTag state={alert.status.state} />\n            <span className={styles.duration}>\n              for{' '}\n              {intervalToAbbreviatedDurationString({\n                start: new Date(alert.startsAt),\n                end: new Date(alert.endsAt),\n              })}\n            </span>\n          </>\n        ),\n        size: '220px',\n      },\n      {\n        id: 'labels',\n        label: 'Labels',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: { labels } }) => <AlertLabels className={styles.labels} labels={labels} />,\n        size: 1,\n      },\n    ],\n    [styles]\n  );\n\n  const items = useMemo(\n    (): AlertGroupAlertsTableItemProps[] =>\n      alerts.map((alert) => ({\n        id: alert.fingerprint,\n        data: alert,\n      })),\n    [alerts]\n  );\n\n  return (\n    <div className={styles.tableWrapper} data-testid=\"alert-group-table\">\n      <DynamicTableWithGuidelines\n        cols={columns}\n        items={items}\n        isExpandable={true}\n        renderExpandedContent={({ data: alert }) => (\n          <AlertDetails alert={alert} alertManagerSourceName={alertManagerSourceName} />\n        )}\n      />\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  tableWrapper: css`\n    margin-top: ${theme.spacing(3)};\n    ${theme.breakpoints.up('md')} {\n      margin-left: ${theme.spacing(4.5)};\n    }\n  `,\n  duration: css`\n    margin-left: ${theme.spacing(1)};\n    font-size: ${theme.typography.bodySmall.fontSize};\n  `,\n  labels: css`\n    padding-bottom: 0;\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { AlertmanagerGroup, AlertState } from 'app/plugins/datasource/alertmanager/types';\n\nimport { AlertLabels } from '../AlertLabels';\nimport { CollapseToggle } from '../CollapseToggle';\n\nimport { AlertGroupAlertsTable } from './AlertGroupAlertsTable';\nimport { AlertGroupHeader } from './AlertGroupHeader';\n\ninterface Props {\n  group: AlertmanagerGroup;\n  alertManagerSourceName: string;\n}\n\nexport const AlertGroup = ({ alertManagerSourceName, group }: Props) => {\n  const [isCollapsed, setIsCollapsed] = useState<boolean>(true);\n  const styles = useStyles2(getStyles);\n\n  return (\n    <div className={styles.wrapper}>\n      <div className={styles.header}>\n        <div className={styles.group} data-testid=\"alert-group\">\n          <CollapseToggle\n            isCollapsed={isCollapsed}\n            onToggle={() => setIsCollapsed(!isCollapsed)}\n            data-testid=\"alert-group-collapse-toggle\"\n          />\n          {Object.keys(group.labels).length ? (\n            <AlertLabels className={styles.headerLabels} labels={group.labels} />\n          ) : (\n            <span>No grouping</span>\n          )}\n        </div>\n        <AlertGroupHeader group={group} />\n      </div>\n      {!isCollapsed && <AlertGroupAlertsTable alertManagerSourceName={alertManagerSourceName} alerts={group.alerts} />}\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  wrapper: css`\n    & + & {\n      margin-top: ${theme.spacing(2)};\n    }\n  `,\n  headerLabels: css`\n    padding-bottom: 0 !important;\n    margin-bottom: -${theme.spacing(0.5)};\n  `,\n  header: css`\n    display: flex;\n    flex-direction: row;\n    flex-wrap: wrap;\n    align-items: center;\n    justify-content: space-between;\n    padding: ${theme.spacing(1, 1, 1, 0)};\n    background-color: ${theme.colors.background.secondary};\n    width: 100%;\n  `,\n  group: css`\n    display: flex;\n    flex-direction: row;\n    align-items: center;\n  `,\n  summary: css``,\n  spanElement: css`\n    margin-left: ${theme.spacing(0.5)};\n  `,\n  [AlertState.Active]: css`\n    color: ${theme.colors.error.main};\n  `,\n  [AlertState.Suppressed]: css`\n    color: ${theme.colors.primary.main};\n  `,\n  [AlertState.Unprocessed]: css`\n    color: ${theme.colors.secondary.main};\n  `,\n});\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { RadioButtonGroup, Label, useStyles2 } from '@grafana/ui';\nimport { AlertState } from 'app/plugins/datasource/alertmanager/types';\n\ninterface Props {\n  stateFilter?: AlertState;\n  onStateFilterChange: (value: AlertState) => void;\n}\n\nexport const AlertStateFilter = ({ onStateFilterChange, stateFilter }: Props) => {\n  const styles = useStyles2(getStyles);\n  const alertStateOptions: SelectableValue[] = Object.entries(AlertState)\n    .sort(([labelA], [labelB]) => (labelA < labelB ? -1 : 1))\n    .map(([label, state]) => ({\n      label,\n      value: state,\n    }));\n\n  return (\n    <div className={styles.wrapper}>\n      <Label>State</Label>\n      <RadioButtonGroup options={alertStateOptions} value={stateFilter} onChange={onStateFilterChange} />\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  wrapper: css`\n    margin-left: ${theme.spacing(1)};\n  `,\n});\n","import { uniq } from 'lodash';\nimport React from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Icon, Label, MultiSelect } from '@grafana/ui';\nimport { AlertmanagerGroup } from 'app/plugins/datasource/alertmanager/types';\n\ninterface Props {\n  className?: string;\n  groups: AlertmanagerGroup[];\n  groupBy: string[];\n  onGroupingChange: (keys: string[]) => void;\n}\n\nexport const GroupBy = ({ className, groups, groupBy, onGroupingChange }: Props) => {\n  const labelKeyOptions = uniq(groups.flatMap((group) => group.alerts).flatMap(({ labels }) => Object.keys(labels)))\n    .filter((label) => !(label.startsWith('__') && label.endsWith('__'))) // Filter out private labels\n    .map<SelectableValue>((key) => ({\n      label: key,\n      value: key,\n    }));\n\n  return (\n    <div data-testid={'group-by-container'} className={className}>\n      <Label>Custom group by</Label>\n      <MultiSelect\n        aria-label={'group by label keys'}\n        value={groupBy}\n        placeholder=\"Group by\"\n        prefix={<Icon name={'tag-alt'} />}\n        onChange={(items) => {\n          onGroupingChange(items.map(({ value }) => value as string));\n        }}\n        options={labelKeyOptions}\n        menuShouldPortal\n      />\n    </div>\n  );\n};\n","import { css } from '@emotion/css';\nimport React, { useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, useStyles2 } from '@grafana/ui';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { AlertmanagerGroup, AlertState } from 'app/plugins/datasource/alertmanager/types';\n\nimport { useAlertManagerSourceName } from '../../hooks/useAlertManagerSourceName';\nimport { useAlertManagersByPermission } from '../../hooks/useAlertManagerSources';\nimport { getFiltersFromUrlParams } from '../../utils/misc';\nimport { AlertManagerPicker } from '../AlertManagerPicker';\n\nimport { AlertStateFilter } from './AlertStateFilter';\nimport { GroupBy } from './GroupBy';\nimport { MatcherFilter } from './MatcherFilter';\n\ninterface Props {\n  groups: AlertmanagerGroup[];\n}\n\nexport const AlertGroupFilter = ({ groups }: Props) => {\n  const [filterKey, setFilterKey] = useState<number>(Math.floor(Math.random() * 100));\n  const [queryParams, setQueryParams] = useQueryParams();\n  const { groupBy = [], queryString, alertState } = getFiltersFromUrlParams(queryParams);\n  const matcherFilterKey = `matcher-${filterKey}`;\n\n  const alertManagers = useAlertManagersByPermission('instance');\n  const [alertManagerSourceName, setAlertManagerSourceName] = useAlertManagerSourceName(alertManagers);\n  const styles = useStyles2(getStyles);\n\n  const clearFilters = () => {\n    setQueryParams({\n      groupBy: null,\n      queryString: null,\n      alertState: null,\n    });\n    setTimeout(() => setFilterKey(filterKey + 1), 100);\n  };\n\n  const showClearButton = !!(groupBy.length > 0 || queryString || alertState);\n\n  return (\n    <div className={styles.wrapper}>\n      <AlertManagerPicker\n        current={alertManagerSourceName}\n        onChange={setAlertManagerSourceName}\n        dataSources={alertManagers}\n      />\n      <div className={styles.filterSection}>\n        <MatcherFilter\n          className={styles.filterInput}\n          key={matcherFilterKey}\n          defaultQueryString={queryString}\n          onFilterChange={(value) => setQueryParams({ queryString: value ? value : null })}\n        />\n        <GroupBy\n          className={styles.filterInput}\n          groups={groups}\n          groupBy={groupBy}\n          onGroupingChange={(keys) => setQueryParams({ groupBy: keys.length ? keys.join(',') : null })}\n        />\n        <AlertStateFilter\n          stateFilter={alertState as AlertState}\n          onStateFilterChange={(value) => setQueryParams({ alertState: value ? value : null })}\n        />\n        {showClearButton && (\n          <Button className={styles.clearButton} variant={'secondary'} icon=\"times\" onClick={clearFilters}>\n            Clear filters\n          </Button>\n        )}\n      </div>\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  wrapper: css`\n    border-bottom: 1px solid ${theme.colors.border.medium};\n    margin-bottom: ${theme.spacing(3)};\n  `,\n  filterSection: css`\n    display: flex;\n    flex-direction: row;\n    margin-bottom: ${theme.spacing(3)};\n  `,\n  filterInput: css`\n    width: 340px;\n    & + & {\n      margin-left: ${theme.spacing(1)};\n    }\n  `,\n  clearButton: css`\n    margin-left: ${theme.spacing(1)};\n    margin-top: 19px;\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { useEffect } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Alert, LoadingPlaceholder, useStyles2 } from '@grafana/ui';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\n\nimport { AlertingPageWrapper } from './components/AlertingPageWrapper';\nimport { NoAlertManagerWarning } from './components/NoAlertManagerWarning';\nimport { AlertGroup } from './components/alert-groups/AlertGroup';\nimport { AlertGroupFilter } from './components/alert-groups/AlertGroupFilter';\nimport { useAlertManagerSourceName } from './hooks/useAlertManagerSourceName';\nimport { useAlertManagersByPermission } from './hooks/useAlertManagerSources';\nimport { useFilteredAmGroups } from './hooks/useFilteredAmGroups';\nimport { useGroupedAlerts } from './hooks/useGroupedAlerts';\nimport { useUnifiedAlertingSelector } from './hooks/useUnifiedAlertingSelector';\nimport { fetchAlertGroupsAction } from './state/actions';\nimport { NOTIFICATIONS_POLL_INTERVAL_MS } from './utils/constants';\nimport { getFiltersFromUrlParams } from './utils/misc';\nimport { initialAsyncRequestState } from './utils/redux';\n\nconst AlertGroups = () => {\n  const alertManagers = useAlertManagersByPermission('instance');\n  const [alertManagerSourceName] = useAlertManagerSourceName(alertManagers);\n  const dispatch = useDispatch();\n  const [queryParams] = useQueryParams();\n  const { groupBy = [] } = getFiltersFromUrlParams(queryParams);\n  const styles = useStyles2(getStyles);\n\n  const alertGroups = useUnifiedAlertingSelector((state) => state.amAlertGroups);\n  const {\n    loading,\n    error,\n    result: results = [],\n  } = alertGroups[alertManagerSourceName || ''] ?? initialAsyncRequestState;\n\n  const groupedAlerts = useGroupedAlerts(results, groupBy);\n  const filteredAlertGroups = useFilteredAmGroups(groupedAlerts);\n\n  useEffect(() => {\n    function fetchNotifications() {\n      if (alertManagerSourceName) {\n        dispatch(fetchAlertGroupsAction(alertManagerSourceName));\n      }\n    }\n    fetchNotifications();\n    const interval = setInterval(fetchNotifications, NOTIFICATIONS_POLL_INTERVAL_MS);\n    return () => {\n      clearInterval(interval);\n    };\n  }, [dispatch, alertManagerSourceName]);\n\n  if (!alertManagerSourceName) {\n    return (\n      <AlertingPageWrapper pageId=\"groups\">\n        <NoAlertManagerWarning availableAlertManagers={alertManagers} />\n      </AlertingPageWrapper>\n    );\n  }\n\n  return (\n    <AlertingPageWrapper pageId=\"groups\">\n      <AlertGroupFilter groups={results} />\n      {loading && <LoadingPlaceholder text=\"Loading notifications\" />}\n      {error && !loading && (\n        <Alert title={'Error loading notifications'} severity={'error'}>\n          {error.message || 'Unknown error'}\n        </Alert>\n      )}\n      {results &&\n        filteredAlertGroups.map((group, index) => {\n          return (\n            <React.Fragment key={`${JSON.stringify(group.labels)}-group-${index}`}>\n              {((index === 1 && Object.keys(filteredAlertGroups[0].labels).length === 0) ||\n                (index === 0 && Object.keys(group.labels).length > 0)) && (\n                <p className={styles.groupingBanner}>Grouped by: {Object.keys(group.labels).join(', ')}</p>\n              )}\n              <AlertGroup alertManagerSourceName={alertManagerSourceName || ''} group={group} />\n            </React.Fragment>\n          );\n        })}\n      {results && !filteredAlertGroups.length && <p>No results.</p>}\n    </AlertingPageWrapper>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  groupingBanner: css`\n    margin: ${theme.spacing(2, 0)};\n  `,\n});\n\nexport default AlertGroups;\n","import { uniqBy } from 'lodash';\nimport { useMemo } from 'react';\n\nimport { Labels } from '@grafana/data';\nimport { AlertmanagerGroup } from 'app/plugins/datasource/alertmanager/types';\n\nexport const useGroupedAlerts = (groups: AlertmanagerGroup[], groupBy: string[]): AlertmanagerGroup[] => {\n  return useMemo(() => {\n    if (groupBy.length === 0) {\n      const emptyGroupings = groups.filter((group) => Object.keys(group.labels).length === 0);\n      if (emptyGroupings.length > 1) {\n        // Merges multiple ungrouped grouping\n        return groups.reduce((combinedGroups, group) => {\n          if (Object.keys(group.labels).length === 0) {\n            const noGroupingGroup = combinedGroups.find(({ labels }) => Object.keys(labels));\n            if (!noGroupingGroup) {\n              combinedGroups.push({ alerts: group.alerts, labels: {}, receiver: { name: 'NONE' } });\n            } else {\n              noGroupingGroup.alerts = uniqBy([...noGroupingGroup.alerts, ...group.alerts], 'labels');\n            }\n          } else {\n            combinedGroups.push(group);\n          }\n          return combinedGroups;\n        }, [] as AlertmanagerGroup[]);\n      } else {\n        return groups;\n      }\n    }\n    const alerts = groups.flatMap(({ alerts }) => alerts);\n    return alerts.reduce((groupings, alert) => {\n      const alertContainsGroupings = groupBy.every((groupByLabel) => Object.keys(alert.labels).includes(groupByLabel));\n\n      if (alertContainsGroupings) {\n        const existingGrouping = groupings.find((group) => {\n          return groupBy.every((groupKey) => {\n            return group.labels[groupKey] === alert.labels[groupKey];\n          });\n        });\n        if (!existingGrouping) {\n          const labels = groupBy.reduce((acc, key) => {\n            acc = { ...acc, [key]: alert.labels[key] };\n            return acc;\n          }, {} as Labels);\n          groupings.push({\n            alerts: [alert],\n            labels,\n            receiver: {\n              name: 'NONE',\n            },\n          });\n        } else {\n          existingGrouping.alerts.push(alert);\n        }\n      } else {\n        const noGroupingGroup = groupings.find((group) => Object.keys(group.labels).length === 0);\n        if (!noGroupingGroup) {\n          groupings.push({ alerts: [alert], labels: {}, receiver: { name: 'NONE' } });\n        } else {\n          noGroupingGroup.alerts.push(alert);\n        }\n      }\n\n      return groupings;\n    }, [] as AlertmanagerGroup[]);\n  }, [groups, groupBy]);\n};\n","import { useMemo } from 'react';\n\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { AlertmanagerGroup } from 'app/plugins/datasource/alertmanager/types';\n\nimport { labelsMatchMatchers, parseMatchers } from '../utils/alertmanager';\nimport { getFiltersFromUrlParams } from '../utils/misc';\n\nexport const useFilteredAmGroups = (groups: AlertmanagerGroup[]) => {\n  const [queryParams] = useQueryParams();\n  const filters = getFiltersFromUrlParams(queryParams);\n  const matchers = parseMatchers(filters.queryString || '');\n\n  return useMemo(() => {\n    return groups.reduce((filteredGroup: AlertmanagerGroup[], group) => {\n      const alerts = group.alerts.filter(({ labels, status }) => {\n        const labelsMatch = labelsMatchMatchers(labels, matchers);\n        const filtersMatch = filters.alertState ? status.state === filters.alertState : true;\n        return labelsMatch && filtersMatch;\n      });\n      if (alerts.length > 0) {\n        // The ungrouped alerts should be first in the results\n        if (Object.keys(group.labels).length === 0) {\n          filteredGroup.unshift({ ...group, alerts });\n        } else {\n          filteredGroup.push({ ...group, alerts });\n        }\n      }\n      return filteredGroup;\n    }, []);\n  }, [groups, filters, matchers]);\n};\n","import React, { FC } from 'react';\nimport { useSelector } from 'react-redux';\n\nimport Page from 'app/core/components/Page/Page';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types/store';\n\ninterface Props {\n  pageId: string;\n  isLoading?: boolean;\n}\n\nexport const AlertingPageWrapper: FC<Props> = ({ children, pageId, isLoading }) => {\n  const navModel = getNavModel(\n    useSelector((state: StoreState) => state.navIndex),\n    pageId\n  );\n\n  return (\n    <Page navModel={navModel}>\n      <Page.Contents isLoading={isLoading}>{children}</Page.Contents>\n    </Page>\n  );\n};\n","import React, { FC } from 'react';\n\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AccessControlAction } from 'app/types';\n\ntype Props = {\n  actions: AccessControlAction[];\n  fallback?: boolean;\n};\n\nexport const Authorize: FC<Props> = ({ actions, children, fallback = true }) => {\n  if (actions.some((action) => contextSrv.hasAccess(action, fallback))) {\n    return <>{children}</>;\n  } else {\n    return null;\n  }\n};\n","import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\n\nimport { DynamicTable, DynamicTableProps } from './DynamicTable';\n\nexport type DynamicTableWithGuidelinesProps<T> = Omit<DynamicTableProps<T>, 'renderPrefixHeader, renderPrefixCell'>;\n\n// DynamicTable, but renders visual guidelines on the left, for larger screen widths\nexport const DynamicTableWithGuidelines = <T extends object>({\n  renderExpandedContent,\n  ...props\n}: DynamicTableWithGuidelinesProps<T>) => {\n  const styles = useStyles2(getStyles);\n  return (\n    <DynamicTable\n      renderExpandedContent={\n        renderExpandedContent\n          ? (item, index, items) => (\n              <>\n                {!(index === items.length - 1) && <div className={cx(styles.contentGuideline, styles.guideline)} />}\n                {renderExpandedContent(item, index, items)}\n              </>\n            )\n          : undefined\n      }\n      renderPrefixHeader={() => (\n        <div className={styles.relative}>\n          <div className={cx(styles.headerGuideline, styles.guideline)} />\n        </div>\n      )}\n      renderPrefixCell={(_, index, items) => (\n        <div className={styles.relative}>\n          <div className={cx(styles.topGuideline, styles.guideline)} />\n          {!(index === items.length - 1) && <div className={cx(styles.bottomGuideline, styles.guideline)} />}\n        </div>\n      )}\n      {...props}\n    />\n  );\n};\n\nexport const getStyles = (theme: GrafanaTheme2) => ({\n  relative: css`\n    position: relative;\n    height: 100%;\n  `,\n  guideline: css`\n    left: -19px;\n    border-left: 1px solid ${theme.colors.border.medium};\n    position: absolute;\n\n    ${theme.breakpoints.down('md')} {\n      display: none;\n    }\n  `,\n  topGuideline: css`\n    width: 18px;\n    border-bottom: 1px solid ${theme.colors.border.medium};\n    top: 0;\n    bottom: 50%;\n  `,\n  bottomGuideline: css`\n    top: 50%;\n    bottom: 0;\n  `,\n  contentGuideline: css`\n    top: 0;\n    bottom: 0;\n    left: -49px !important;\n  `,\n  headerGuideline: css`\n    top: -25px;\n    bottom: 0;\n  `,\n});\n","import React from 'react';\n\nimport { Alert } from '@grafana/ui';\n\nimport { useAlertManagerSourceName } from '../hooks/useAlertManagerSourceName';\nimport { AlertManagerDataSource } from '../utils/datasource';\n\nimport { AlertManagerPicker } from './AlertManagerPicker';\n\ninterface Props {\n  availableAlertManagers: AlertManagerDataSource[];\n}\n\nconst NoAlertManagersAvailable = () => (\n  <Alert title=\"No Alertmanager found\" severity=\"warning\">\n    We could not find any external Alertmanagers and you may not have access to the built-in Grafana Alertmanager.\n  </Alert>\n);\n\nconst OtherAlertManagersAvailable = () => (\n  <Alert title=\"Selected Alertmanager not found. Select a different Alertmanager.\" severity=\"warning\">\n    Selected Alertmanager no longer exists or you may not have permission to access it.\n  </Alert>\n);\n\nexport const NoAlertManagerWarning = ({ availableAlertManagers }: Props) => {\n  const [_, setAlertManagerSourceName] = useAlertManagerSourceName(availableAlertManagers);\n  const hasOtherAMs = availableAlertManagers.length > 0;\n\n  return (\n    <div>\n      {hasOtherAMs ? (\n        <>\n          <AlertManagerPicker onChange={setAlertManagerSourceName} dataSources={availableAlertManagers} />\n          <OtherAlertManagersAvailable />\n        </>\n      ) : (\n        <NoAlertManagersAvailable />\n      )}\n    </div>\n  );\n};\n","import { css } from '@emotion/css';\nimport React, { FormEvent } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Stack } from '@grafana/experimental';\nimport { Label, Tooltip, Input, Icon, useStyles2 } from '@grafana/ui';\n\ninterface Props {\n  className?: string;\n  queryString?: string;\n  defaultQueryString?: string;\n  onFilterChange: (filterString: string) => void;\n}\n\nexport const MatcherFilter = ({ className, onFilterChange, defaultQueryString, queryString }: Props) => {\n  const styles = useStyles2(getStyles);\n  const handleSearchChange = (e: FormEvent<HTMLInputElement>) => {\n    const target = e.target as HTMLInputElement;\n    onFilterChange(target.value);\n  };\n  const searchIcon = <Icon name={'search'} />;\n  return (\n    <div className={className}>\n      <Label>\n        <Stack gap={0.5}>\n          <span>Search by label</span>\n          <Tooltip\n            content={\n              <div>\n                Filter alerts using label querying, ex:\n                <pre>{`{severity=\"critical\", instance=~\"cluster-us-.+\"}`}</pre>\n              </div>\n            }\n          >\n            <Icon className={styles.icon} name=\"info-circle\" size=\"sm\" />\n          </Tooltip>\n        </Stack>\n      </Label>\n      <Input\n        placeholder=\"Search\"\n        defaultValue={defaultQueryString}\n        value={queryString}\n        onChange={handleSearchChange}\n        data-testid=\"search-query-input\"\n        prefix={searchIcon}\n        className={styles.inputWidth}\n      />\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  icon: css`\n    margin-right: ${theme.spacing(0.5)};\n  `,\n  inputWidth: css`\n    width: 340px;\n    flex-grow: 0;\n  `,\n});\n","import React, { FC } from 'react';\n\nimport { AlertState } from 'app/plugins/datasource/alertmanager/types';\n\nimport { State, StateTag } from '../StateTag';\n\nconst alertStateToState: Record<AlertState, State> = {\n  [AlertState.Active]: 'bad',\n  [AlertState.Unprocessed]: 'neutral',\n  [AlertState.Suppressed]: 'info',\n};\n\ninterface Props {\n  state: AlertState;\n}\n\nexport const AmAlertStateTag: FC<Props> = ({ state }) => <StateTag state={alertStateToState[state]}>{state}</StateTag>;\n","import { useCallback } from 'react';\n\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport store from 'app/core/store';\n\nimport { ALERTMANAGER_NAME_LOCAL_STORAGE_KEY, ALERTMANAGER_NAME_QUERY_KEY } from '../utils/constants';\nimport { AlertManagerDataSource, GRAFANA_RULES_SOURCE_NAME } from '../utils/datasource';\n\nfunction useIsAlertManagerAvailable(availableAlertManagers: AlertManagerDataSource[]) {\n  return useCallback(\n    (alertManagerName: string) => {\n      const availableAlertManagersNames = availableAlertManagers.map((am) => am.name);\n      return availableAlertManagersNames.includes(alertManagerName);\n    },\n    [availableAlertManagers]\n  );\n}\n\n/* This will return am name either from query params or from local storage or a default (grafana).\n * Due to RBAC permissions Grafana Managed Alert manager or external alert managers may not be available\n * In the worst case neihter GMA nor external alert manager is available\n */\nexport function useAlertManagerSourceName(\n  availableAlertManagers: AlertManagerDataSource[]\n): [string | undefined, (alertManagerSourceName: string) => void] {\n  const [queryParams, updateQueryParams] = useQueryParams();\n  const isAlertManagerAvailable = useIsAlertManagerAvailable(availableAlertManagers);\n\n  const update = useCallback(\n    (alertManagerSourceName: string) => {\n      if (!isAlertManagerAvailable(alertManagerSourceName)) {\n        return;\n      }\n      if (alertManagerSourceName === GRAFANA_RULES_SOURCE_NAME) {\n        store.delete(ALERTMANAGER_NAME_LOCAL_STORAGE_KEY);\n        updateQueryParams({ [ALERTMANAGER_NAME_QUERY_KEY]: null });\n      } else {\n        store.set(ALERTMANAGER_NAME_LOCAL_STORAGE_KEY, alertManagerSourceName);\n        updateQueryParams({ [ALERTMANAGER_NAME_QUERY_KEY]: alertManagerSourceName });\n      }\n    },\n    [updateQueryParams, isAlertManagerAvailable]\n  );\n\n  const querySource = queryParams[ALERTMANAGER_NAME_QUERY_KEY];\n\n  if (querySource && typeof querySource === 'string') {\n    if (isAlertManagerAvailable(querySource)) {\n      return [querySource, update];\n    } else {\n      // non existing alertmanager\n      return [undefined, update];\n    }\n  }\n\n  const storeSource = store.get(ALERTMANAGER_NAME_LOCAL_STORAGE_KEY);\n  if (storeSource && typeof storeSource === 'string' && isAlertManagerAvailable(storeSource)) {\n    update(storeSource);\n    return [storeSource, update];\n  }\n\n  if (isAlertManagerAvailable(GRAFANA_RULES_SOURCE_NAME)) {\n    return [GRAFANA_RULES_SOURCE_NAME, update];\n  }\n\n  return [undefined, update];\n}\n","import { useMemo } from 'react';\n\nimport { getAlertManagerDataSourcesByPermission } from '../utils/datasource';\n\nexport function useAlertManagersByPermission(accessType: 'instance' | 'notification') {\n  return useMemo(() => getAlertManagerDataSourcesByPermission(accessType), [accessType]);\n}\n"],"names":["AlertDetails","alert","alertManagerSourceName","styles","useStyles2","getStyles","instancePermissions","getInstancesPermissions","isSeeSourceButtonEnabled","isGrafanaRulesSource","contextSrv","AccessControlAction","className","actionsRow","Authorize","actions","update","create","fallback","status","state","AlertState","LinkButton","href","makeAMLink","silencedBy","join","button","icon","size","makeLabelBasedSilenceLink","labels","generatorURL","Object","entries","annotations","map","annotationKey","annotationValue","AnnotationDetailsField","value","receivers","name","filter","theme","css","spacing","colors","border","medium","AlertGroupAlertsTable","alerts","columns","useMemo","id","label","renderCell","data","AmAlertStateTag","duration","intervalToAbbreviatedDurationString","start","Date","startsAt","end","endsAt","AlertLabels","items","fingerprint","tableWrapper","DynamicTableWithGuidelines","cols","isExpandable","renderExpandedContent","breakpoints","up","typography","bodySmall","fontSize","AlertGroup","group","isCollapsed","setIsCollapsed","useState","wrapper","header","CollapseToggle","onToggle","keys","length","headerLabels","AlertGroupHeader","background","secondary","summary","spanElement","error","main","primary","AlertStateFilter","onStateFilterChange","stateFilter","alertStateOptions","sort","labelA","labelB","Label","RadioButtonGroup","options","onChange","GroupBy","groups","groupBy","onGroupingChange","labelKeyOptions","uniq","flatMap","startsWith","endsWith","key","MultiSelect","placeholder","prefix","Icon","menuShouldPortal","AlertGroupFilter","filterKey","setFilterKey","Math","floor","random","queryParams","setQueryParams","useQueryParams","queryString","alertState","getFiltersFromUrlParams","matcherFilterKey","alertManagers","useAlertManagersByPermission","setAlertManagerSourceName","useAlertManagerSourceName","showClearButton","AlertManagerPicker","current","dataSources","filterSection","MatcherFilter","filterInput","defaultQueryString","onFilterChange","Button","clearButton","variant","onClick","setTimeout","groupingBanner","dispatch","useDispatch","alertGroups","useUnifiedAlertingSelector","amAlertGroups","loading","result","results","initialAsyncRequestState","groupedAlerts","reduce","combinedGroups","noGroupingGroup","find","uniqBy","push","receiver","groupings","every","groupByLabel","includes","existingGrouping","groupKey","acc","useGroupedAlerts","filteredAlertGroups","filters","matchers","parseMatchers","filteredGroup","labelsMatch","labelsMatchMatchers","filtersMatch","unshift","useFilteredAmGroups","useEffect","fetchNotifications","fetchAlertGroupsAction","interval","setInterval","NOTIFICATIONS_POLL_INTERVAL_MS","clearInterval","AlertingPageWrapper","pageId","LoadingPlaceholder","text","Alert","title","severity","message","index","JSON","stringify","NoAlertManagerWarning","availableAlertManagers","children","isLoading","navModel","getNavModel","useSelector","navIndex","some","action","props","item","cx","contentGuideline","guideline","undefined","renderPrefixHeader","relative","headerGuideline","renderPrefixCell","_","topGuideline","bottomGuideline","down","NoAlertManagersAvailable","OtherAlertManagersAvailable","hasOtherAMs","searchIcon","Stack","gap","Tooltip","content","Input","defaultValue","e","target","inputWidth","alertStateToState","updateQueryParams","isAlertManagerAvailable","useCallback","alertManagerName","am","useIsAlertManagerAvailable","GRAFANA_RULES_SOURCE_NAME","store","ALERTMANAGER_NAME_LOCAL_STORAGE_KEY","ALERTMANAGER_NAME_QUERY_KEY","querySource","storeSource","accessType","getAlertManagerDataSourcesByPermission"],"sourceRoot":""}