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xB,IACd,OAAO6B,EAAAA,EAAAA,UAAQ,KAAMyV,EAAAA,EAAAA,OAAkB","sources":["webpack://grafana/./public/app/core/hooks/useCleanup.ts","webpack://grafana/./public/app/features/alerting/AlertHowToModal.tsx","webpack://grafana/./public/app/features/alerting/AlertRuleItem.tsx","webpack://grafana/./public/app/features/alerting/components/UnifiedAlertingPromotion.tsx","webpack://grafana/./public/app/features/alerting/state/selectors.ts","webpack://grafana/./public/app/features/alerting/AlertRuleList.tsx","webpack://grafana/./public/app/features/alerting/state/actions.ts","webpack://grafana/./public/app/features/alerting/unified/components/rules/NoRulesCTA.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleListErrors.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/EditCloudGroupModal.tsx","webpack://grafana/./public/app/features/alerting/unified/components/StateColoredText.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleStats.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RulesGroup.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/CloudRules.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/GrafanaRules.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleListStateSection.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RulesFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useFilteredRules.ts","webpack://grafana/./public/app/features/alerting/unified/RuleList.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleListGroupView.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleListStateView.tsx","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/RuleLocation.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/ActionIcon.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleDetails.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RulesTable.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useHasRuler.ts","webpack://grafana/./public/app/features/alerting/unified/utils/accessControlHooks.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { cleanUpAction, StateSelector } from '../actions/cleanUp';\n\nexport function useCleanup<T>(stateSelector: StateSelector<T>) {\n  const dispatch = useDispatch();\n  //bit of a hack to unburden user from having to wrap stateSelcetor in a useCallback. Otherwise cleanup would happen on every render\n  const selectorRef = useRef(stateSelector);\n  selectorRef.current = stateSelector;\n  useEffect(() => {\n    return () => {\n      dispatch(cleanUpAction({ stateSelector: selectorRef.current }));\n    };\n  }, [dispatch]);\n}\n","import React from 'react';\n\nimport { Modal, VerticalGroup } from '@grafana/ui';\n\nexport interface AlertHowToModalProps {\n  onDismiss: () => void;\n}\n\nexport function AlertHowToModal({ onDismiss }: AlertHowToModalProps): JSX.Element {\n  return (\n    <Modal title=\"Adding an Alert\" isOpen onDismiss={onDismiss} onClickBackdrop={onDismiss}>\n      <VerticalGroup spacing=\"sm\">\n        <img src=\"public/img/alert_howto_new.png\" alt=\"link to how to alert image\" />\n        <p>\n          Alerts are added and configured in the Alert tab of any dashboard graph panel, letting you build and visualize\n          an alert using existing queries.\n        </p>\n        <p>Remember to save the dashboard to persist your alert rule changes.</p>\n      </VerticalGroup>\n    </Modal>\n  );\n}\n","import React, { useCallback } from 'react';\n// @ts-ignore\nimport Highlighter from 'react-highlight-words';\n\nimport { Icon, IconName, Button, LinkButton, Card } from '@grafana/ui';\n\nimport { AlertRule } from '../../types';\n\nexport interface Props {\n  rule: AlertRule;\n  search: string;\n  onTogglePause: () => void;\n}\n\nconst AlertRuleItem = ({ rule, search, onTogglePause }: Props) => {\n  const ruleUrl = `${rule.url}?editPanel=${rule.panelId}&tab=alert`;\n  const renderText = useCallback(\n    (text) => (\n      <Highlighter\n        key={text}\n        highlightClassName=\"highlight-search-match\"\n        textToHighlight={text}\n        searchWords={[search]}\n      />\n    ),\n    [search]\n  );\n\n  return (\n    <Card>\n      <Card.Heading>{renderText(rule.name)}</Card.Heading>\n      <Card.Figure>\n        <Icon size=\"xl\" name={rule.stateIcon as IconName} className={`alert-rule-item__icon ${rule.stateClass}`} />\n      </Card.Figure>\n      <Card.Meta>\n        <span key=\"state\">\n          <span key=\"text\" className={`${rule.stateClass}`}>\n            {renderText(rule.stateText)}{' '}\n          </span>\n          for {rule.stateAge}\n        </span>\n        {rule.info ? renderText(rule.info) : null}\n      </Card.Meta>\n      <Card.Actions>\n        <Button\n          key=\"play\"\n          variant=\"secondary\"\n          icon={rule.state === 'paused' ? 'play' : 'pause'}\n          onClick={onTogglePause}\n        >\n          {rule.state === 'paused' ? 'Resume' : 'Pause'}\n        </Button>\n        <LinkButton key=\"edit\" variant=\"secondary\" href={ruleUrl} icon=\"cog\">\n          Edit alert\n        </LinkButton>\n      </Card.Actions>\n    </Card>\n  );\n};\n\nexport default AlertRuleItem;\n","import React, { FC } from 'react';\nimport { useLocalStorage } from 'react-use';\n\nimport { Alert } from '@grafana/ui';\n\nexport const LOCAL_STORAGE_KEY = 'grafana.legacyalerting.unifiedalertingpromo';\n\nconst UnifiedAlertingPromotion: FC<{}> = () => {\n  const [showUnifiedAlertingPromotion, setShowUnifiedAlertingPromotion] = useLocalStorage<boolean>(\n    LOCAL_STORAGE_KEY,\n    true\n  );\n\n  if (!showUnifiedAlertingPromotion) {\n    return null;\n  }\n\n  return (\n    <Alert\n      severity=\"info\"\n      title=\"Try out the Grafana 8 alerting!\"\n      onRemove={() => setShowUnifiedAlertingPromotion(false)}\n    >\n      <p>\n        You are using the legacy Grafana alerting.\n        <br />\n        While we have no plans of deprecating it any time soon, we invite you to give the improved Grafana 8 alerting a\n        try.\n      </p>\n      <p>\n        See{' '}\n        <a href=\"https://grafana.com/docs/grafana/latest/alerting/unified-alerting/difference-old-new/\">\n          What’s New with Grafana 8 alerting\n        </a>{' '}\n        to learn more about what&lsquo;s new in Grafana 8 alerting or learn{' '}\n        <a href=\"https://grafana.com/docs/grafana/latest/alerting/unified-alerting/opt-in/\">\n          how to enable the new Grafana 8 alerting feature\n        </a>\n        .\n      </p>\n    </Alert>\n  );\n};\n\nexport { UnifiedAlertingPromotion };\n","import { AlertRule, AlertRulesState, NotificationChannelState, StoreState } from 'app/types';\n\nexport const getSearchQuery = (state: AlertRulesState) => state.searchQuery;\n\nexport const getAlertRuleItems = (state: StoreState): AlertRule[] => {\n  const regex = new RegExp(state.alertRules.searchQuery, 'i');\n\n  return state.alertRules.items.filter((item) => {\n    return regex.test(item.name) || regex.test(item.stateText) || regex.test(item.info!);\n  });\n};\n\nexport const getNotificationChannel = (state: NotificationChannelState, channelId: number) => {\n  if (state.notificationChannel.id === channelId) {\n    return state.notificationChannel;\n  }\n\n  return null;\n};\n","import React, { PureComponent } from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\n\nimport { SelectableValue } from '@grafana/data';\nimport { config, locationService } from '@grafana/runtime';\nimport { Button, FilterInput, LinkButton, Select, VerticalGroup } from '@grafana/ui';\nimport appEvents from 'app/core/app_events';\nimport Page from 'app/core/components/Page/Page';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { AlertRule, StoreState } from 'app/types';\n\nimport { ShowModalReactEvent } from '../../types/events';\n\nimport { AlertHowToModal } from './AlertHowToModal';\nimport AlertRuleItem from './AlertRuleItem';\nimport { UnifiedAlertingPromotion } from './components/UnifiedAlertingPromotion';\nimport { getAlertRulesAsync, togglePauseAlertRule } from './state/actions';\nimport { setSearchQuery } from './state/reducers';\nimport { getAlertRuleItems, getSearchQuery } from './state/selectors';\n\nfunction mapStateToProps(state: StoreState) {\n  return {\n    navModel: getNavModel(state.navIndex, 'alert-list'),\n    alertRules: getAlertRuleItems(state),\n    search: getSearchQuery(state.alertRules),\n    isLoading: state.alertRules.isLoading,\n  };\n}\n\nconst mapDispatchToProps = {\n  getAlertRulesAsync,\n  setSearchQuery,\n  togglePauseAlertRule,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\n\ninterface OwnProps extends GrafanaRouteComponentProps<{}, { state: string }> {}\n\nexport type Props = OwnProps & ConnectedProps<typeof connector>;\n\nexport class AlertRuleListUnconnected extends PureComponent<Props> {\n  stateFilters = [\n    { label: 'All', value: 'all' },\n    { label: 'OK', value: 'ok' },\n    { label: 'Not OK', value: 'not_ok' },\n    { label: 'Alerting', value: 'alerting' },\n    { label: 'No data', value: 'no_data' },\n    { label: 'Paused', value: 'paused' },\n    { label: 'Pending', value: 'pending' },\n  ];\n\n  componentDidMount() {\n    this.fetchRules();\n  }\n\n  componentDidUpdate(prevProps: Props) {\n    if (prevProps.queryParams.state !== this.props.queryParams.state) {\n      this.fetchRules();\n    }\n  }\n\n  async fetchRules() {\n    await this.props.getAlertRulesAsync({ state: this.getStateFilter() });\n  }\n\n  getStateFilter(): string {\n    return this.props.queryParams.state ?? 'all';\n  }\n\n  onStateFilterChanged = (option: SelectableValue) => {\n    locationService.partial({ state: option.value });\n  };\n\n  onOpenHowTo = () => {\n    appEvents.publish(new ShowModalReactEvent({ component: AlertHowToModal }));\n  };\n\n  onSearchQueryChange = (value: string) => {\n    this.props.setSearchQuery(value);\n  };\n\n  onTogglePause = (rule: AlertRule) => {\n    this.props.togglePauseAlertRule(rule.id, { paused: rule.state !== 'paused' });\n  };\n\n  alertStateFilterOption = ({ text, value }: { text: string; value: string }) => {\n    return (\n      <option key={value} value={value}>\n        {text}\n      </option>\n    );\n  };\n\n  render() {\n    const { navModel, alertRules, search, isLoading } = this.props;\n\n    return (\n      <Page navModel={navModel}>\n        <Page.Contents isLoading={isLoading}>\n          <div className=\"page-action-bar\">\n            <div className=\"gf-form gf-form--grow\">\n              <FilterInput placeholder=\"Search alerts\" value={search} onChange={this.onSearchQueryChange} />\n            </div>\n            <div className=\"gf-form\">\n              <label className=\"gf-form-label\" htmlFor=\"alert-state-filter\">\n                States\n              </label>\n\n              <div className=\"width-13\">\n                <Select\n                  inputId={'alert-state-filter'}\n                  menuShouldPortal\n                  options={this.stateFilters}\n                  onChange={this.onStateFilterChanged}\n                  value={this.getStateFilter()}\n                />\n              </div>\n            </div>\n            <div className=\"page-action-bar__spacer\" />\n            {config.unifiedAlertingEnabled && (\n              <LinkButton variant=\"primary\" href=\"alerting/ng/new\">\n                Add NG Alert\n              </LinkButton>\n            )}\n            <Button variant=\"secondary\" onClick={this.onOpenHowTo}>\n              How to add an alert\n            </Button>\n          </div>\n          <UnifiedAlertingPromotion />\n          <VerticalGroup spacing=\"none\">\n            {alertRules.map((rule) => {\n              return (\n                <AlertRuleItem\n                  rule={rule as AlertRule}\n                  key={rule.id}\n                  search={search}\n                  onTogglePause={() => this.onTogglePause(rule as AlertRule)}\n                />\n              );\n            })}\n          </VerticalGroup>\n        </Page.Contents>\n      </Page>\n    );\n  }\n}\n\nexport default connector(AlertRuleListUnconnected);\n","import { getBackendSrv, locationService } from '@grafana/runtime';\nimport { notifyApp } from 'app/core/actions';\nimport { createErrorNotification, createSuccessNotification } from 'app/core/copy/appNotification';\nimport { AlertRuleDTO, NotifierDTO, ThunkResult } from 'app/types';\n\nimport { loadAlertRules, loadedAlertRules, notificationChannelLoaded, setNotificationChannels } from './reducers';\n\nexport function getAlertRulesAsync(options: { state: string }): ThunkResult<void> {\n  return async (dispatch) => {\n    dispatch(loadAlertRules());\n    const rules: AlertRuleDTO[] = await getBackendSrv().get('/api/alerts', options);\n    dispatch(loadedAlertRules(rules));\n  };\n}\n\nexport function togglePauseAlertRule(id: number, options: { paused: boolean }): ThunkResult<void> {\n  return async (dispatch) => {\n    await getBackendSrv().post(`/api/alerts/${id}/pause`, options);\n    const stateFilter = locationService.getSearchObject().state || 'all';\n    dispatch(getAlertRulesAsync({ state: stateFilter.toString() }));\n  };\n}\n\nexport function createNotificationChannel(data: any): ThunkResult<Promise<void>> {\n  return async (dispatch) => {\n    try {\n      await getBackendSrv().post(`/api/alert-notifications`, data);\n      dispatch(notifyApp(createSuccessNotification('Notification created')));\n      locationService.push('/alerting/notifications');\n    } catch (error) {\n      dispatch(notifyApp(createErrorNotification(error.data.error)));\n    }\n  };\n}\n\nexport function updateNotificationChannel(data: any): ThunkResult<void> {\n  return async (dispatch) => {\n    try {\n      await getBackendSrv().put(`/api/alert-notifications/${data.id}`, data);\n      dispatch(notifyApp(createSuccessNotification('Notification updated')));\n    } catch (error) {\n      dispatch(notifyApp(createErrorNotification(error.data.error)));\n    }\n  };\n}\n\nexport function testNotificationChannel(data: any): ThunkResult<void> {\n  return async (dispatch, getState) => {\n    const channel = getState().notificationChannel.notificationChannel;\n    await getBackendSrv().post('/api/alert-notifications/test', { id: channel.id, ...data });\n  };\n}\n\nexport function loadNotificationTypes(): ThunkResult<void> {\n  return async (dispatch) => {\n    const alertNotifiers: NotifierDTO[] = await getBackendSrv().get(`/api/alert-notifiers`);\n\n    const notificationTypes = alertNotifiers.sort((o1, o2) => {\n      if (o1.name > o2.name) {\n        return 1;\n      }\n      return -1;\n    });\n\n    dispatch(setNotificationChannels(notificationTypes));\n  };\n}\n\nexport function loadNotificationChannel(id: number): ThunkResult<void> {\n  return async (dispatch) => {\n    await dispatch(loadNotificationTypes());\n    const notificationChannel = await getBackendSrv().get(`/api/alert-notifications/${id}`);\n    dispatch(notificationChannelLoaded(notificationChannel));\n  };\n}\n","import React, { FC } from 'react';\n\nimport { CallToActionCard } from '@grafana/ui';\nimport EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';\n\nimport { useRulesAccess } from '../../utils/accessControlHooks';\n\nexport const NoRulesSplash: FC = () => {\n  const { canCreateGrafanaRules, canCreateCloudRules } = useRulesAccess();\n\n  if (canCreateGrafanaRules || canCreateCloudRules) {\n    return (\n      <EmptyListCTA\n        title=\"You haven`t created any alert rules yet\"\n        buttonIcon=\"bell\"\n        buttonLink={'alerting/new'}\n        buttonTitle=\"New alert rule\"\n        proTip=\"you can also create alert rules from existing panels and queries.\"\n        proTipLink=\"https://grafana.com/docs/\"\n        proTipLinkTitle=\"Learn more\"\n        proTipTarget=\"_blank\"\n      />\n    );\n  }\n  return <CallToActionCard message=\"No rules exist yet.\" callToActionElement={<div />} />;\n};\n","import { css } from '@emotion/css';\nimport { SerializedError } from '@reduxjs/toolkit';\nimport pluralize from 'pluralize';\nimport React, { useMemo, ReactElement, useState, FC } from 'react';\nimport { useLocalStorage } from 'react-use';\n\nimport { DataSourceInstanceSettings, GrafanaTheme2 } from '@grafana/data';\nimport { Alert, Button, Tooltip, useStyles2 } from '@grafana/ui';\n\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { getRulesDataSources, GRAFANA_RULES_SOURCE_NAME } from '../../utils/datasource';\nimport { isRulerNotSupportedResponse } from '../../utils/rules';\n\nexport function RuleListErrors(): ReactElement {\n  const [expanded, setExpanded] = useState(false);\n  const [closed, setClosed] = useLocalStorage('grafana.unifiedalerting.hideErrors', false);\n  const dataSourceConfigRequests = useUnifiedAlertingSelector((state) => state.dataSources);\n  const promRuleRequests = useUnifiedAlertingSelector((state) => state.promRules);\n  const rulerRuleRequests = useUnifiedAlertingSelector((state) => state.rulerRules);\n  const styles = useStyles2(getStyles);\n\n  const errors = useMemo((): JSX.Element[] => {\n    const [dataSourceConfigErrors, promRequestErrors, rulerRequestErrors] = [\n      dataSourceConfigRequests,\n      promRuleRequests,\n      rulerRuleRequests,\n    ].map((requests) =>\n      getRulesDataSources().reduce<Array<{ error: SerializedError; dataSource: DataSourceInstanceSettings }>>(\n        (result, dataSource) => {\n          const error = requests[dataSource.name]?.error;\n          if (requests[dataSource.name] && error && !isRulerNotSupportedResponse(requests[dataSource.name])) {\n            return [...result, { dataSource, error }];\n          }\n          return result;\n        },\n        []\n      )\n    );\n    const grafanaPromError = promRuleRequests[GRAFANA_RULES_SOURCE_NAME]?.error;\n    const grafanaRulerError = rulerRuleRequests[GRAFANA_RULES_SOURCE_NAME]?.error;\n\n    const result: JSX.Element[] = [];\n\n    if (grafanaPromError) {\n      result.push(<>Failed to load Grafana rules state: {grafanaPromError.message || 'Unknown error.'}</>);\n    }\n    if (grafanaRulerError) {\n      result.push(<>Failed to load Grafana rules config: {grafanaRulerError.message || 'Unknown error.'}</>);\n    }\n\n    dataSourceConfigErrors.forEach(({ dataSource, error }) => {\n      result.push(\n        <>\n          Failed to load the data source configuration for{' '}\n          <a href={`datasources/edit/${dataSource.uid}`}>{dataSource.name}</a>: {error.message || 'Unknown error.'}\n        </>\n      );\n    });\n\n    promRequestErrors.forEach(({ dataSource, error }) =>\n      result.push(\n        <>\n          Failed to load rules state from <a href={`datasources/edit/${dataSource.uid}`}>{dataSource.name}</a>:{' '}\n          {error.message || 'Unknown error.'}\n        </>\n      )\n    );\n\n    rulerRequestErrors.forEach(({ dataSource, error }) =>\n      result.push(\n        <>\n          Failed to load rules config from <a href={`datasources/edit/${dataSource.uid}`}>{dataSource.name}</a>:{' '}\n          {error.message || 'Unknown error.'}\n        </>\n      )\n    );\n\n    return result;\n  }, [dataSourceConfigRequests, promRuleRequests, rulerRuleRequests]);\n\n  return (\n    <>\n      {!!errors.length && closed && (\n        <ErrorSummaryButton count={errors.length} onClick={() => setClosed((closed) => !closed)} />\n      )}\n      {!!errors.length && !closed && (\n        <Alert\n          data-testid=\"cloud-rulessource-errors\"\n          title=\"Errors loading rules\"\n          severity=\"error\"\n          onRemove={() => setClosed(true)}\n        >\n          {expanded && errors.map((item, idx) => <div key={idx}>{item}</div>)}\n          {!expanded && (\n            <>\n              <div>{errors[0]}</div>\n              {errors.length >= 2 && (\n                <Button\n                  className={styles.moreButton}\n                  fill=\"text\"\n                  icon=\"angle-right\"\n                  size=\"sm\"\n                  onClick={() => setExpanded(true)}\n                >\n                  {errors.length - 1} more {pluralize('error', errors.length - 1)}\n                </Button>\n              )}\n            </>\n          )}\n        </Alert>\n      )}\n    </>\n  );\n}\n\ninterface ErrorSummaryProps {\n  count: number;\n  onClick: () => void;\n}\n\nconst ErrorSummaryButton: FC<ErrorSummaryProps> = ({ count, onClick }) => {\n  const styles = useStyles2(getStyles);\n\n  return (\n    <div className={styles.floatRight}>\n      <Tooltip content=\"Show all errors\" placement=\"bottom\">\n        <Button fill=\"text\" variant=\"destructive\" icon=\"exclamation-triangle\" onClick={onClick}>\n          {count > 1 ? <>{count} errors</> : <>1 error</>}\n        </Button>\n      </Tooltip>\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  moreButton: css`\n    padding: 0;\n  `,\n  floatRight: css`\n    display: flex;\n    justify-content: flex-end;\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { useEffect, useMemo } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { Modal, Button, Form, Field, Input, useStyles2 } from '@grafana/ui';\nimport { useCleanup } from 'app/core/hooks/useCleanup';\nimport { CombinedRuleGroup, CombinedRuleNamespace } from 'app/types/unified-alerting';\n\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { updateLotexNamespaceAndGroupAction } from '../../state/actions';\nimport { getRulesSourceName } from '../../utils/datasource';\nimport { initialAsyncRequestState } from '../../utils/redux';\nimport { durationValidationPattern } from '../../utils/time';\n\ninterface Props {\n  namespace: CombinedRuleNamespace;\n  group: CombinedRuleGroup;\n  onClose: () => void;\n}\n\ninterface FormValues {\n  namespaceName: string;\n  groupName: string;\n  groupInterval: string;\n}\n\nexport function EditCloudGroupModal(props: Props): React.ReactElement {\n  const { namespace, group, onClose } = props;\n  const styles = useStyles2(getStyles);\n  const dispatch = useDispatch();\n  const { loading, error, dispatched } =\n    useUnifiedAlertingSelector((state) => state.updateLotexNamespaceAndGroup) ?? initialAsyncRequestState;\n\n  const defaultValues = useMemo(\n    (): FormValues => ({\n      namespaceName: namespace.name,\n      groupName: group.name,\n      groupInterval: group.interval ?? '',\n    }),\n    [namespace, group]\n  );\n\n  // close modal if successfully saved\n  useEffect(() => {\n    if (dispatched && !loading && !error) {\n      onClose();\n    }\n  }, [dispatched, loading, onClose, error]);\n\n  useCleanup((state) => state.unifiedAlerting.updateLotexNamespaceAndGroup);\n\n  const onSubmit = (values: FormValues) => {\n    dispatch(\n      updateLotexNamespaceAndGroupAction({\n        rulesSourceName: getRulesSourceName(namespace.rulesSource),\n        groupName: group.name,\n        newGroupName: values.groupName,\n        namespaceName: namespace.name,\n        newNamespaceName: values.namespaceName,\n        groupInterval: values.groupInterval || undefined,\n      })\n    );\n  };\n\n  return (\n    <Modal\n      className={styles.modal}\n      isOpen={true}\n      title=\"Edit namespace or rule group\"\n      onDismiss={onClose}\n      onClickBackdrop={onClose}\n    >\n      <Form defaultValues={defaultValues} onSubmit={onSubmit} key={JSON.stringify(defaultValues)}>\n        {({ register, errors, formState: { isDirty } }) => (\n          <>\n            <Field label=\"Namespace\" invalid={!!errors.namespaceName} error={errors.namespaceName?.message}>\n              <Input\n                id=\"namespaceName\"\n                {...register('namespaceName', {\n                  required: 'Namespace name is required.',\n                })}\n              />\n            </Field>\n            <Field label=\"Rule group\" invalid={!!errors.groupName} error={errors.groupName?.message}>\n              <Input\n                id=\"groupName\"\n                {...register('groupName', {\n                  required: 'Rule group name is required.',\n                })}\n              />\n            </Field>\n            <Field\n              label=\"Rule group evaluation interval\"\n              invalid={!!errors.groupInterval}\n              error={errors.groupInterval?.message}\n            >\n              <Input\n                id=\"groupInterval\"\n                placeholder=\"1m\"\n                {...register('groupInterval', {\n                  pattern: durationValidationPattern,\n                })}\n              />\n            </Field>\n\n            <Modal.ButtonRow>\n              <Button variant=\"secondary\" type=\"button\" disabled={loading} onClick={onClose} fill=\"outline\">\n                Close\n              </Button>\n              <Button type=\"submit\" disabled={!isDirty || loading}>\n                {loading ? 'Saving...' : 'Save changes'}\n              </Button>\n            </Modal.ButtonRow>\n          </>\n        )}\n      </Form>\n    </Modal>\n  );\n}\n\nconst getStyles = () => ({\n  modal: css`\n    max-width: 560px;\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\ntype Props = {\n  status: PromAlertingRuleState | 'neutral';\n};\n\nexport const StateColoredText: FC<Props> = ({ children, status }) => {\n  const styles = useStyles2(getStyles);\n\n  return <span className={styles[status]}>{children || status}</span>;\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  [PromAlertingRuleState.Inactive]: css`\n    color: ${theme.colors.success.text};\n  `,\n  [PromAlertingRuleState.Pending]: css`\n    color: ${theme.colors.warning.text};\n  `,\n  [PromAlertingRuleState.Firing]: css`\n    color: ${theme.colors.error.text};\n  `,\n  neutral: css`\n    color: ${theme.colors.text.secondary};\n  `,\n});\n","import pluralize from 'pluralize';\nimport React, { FC, Fragment, useMemo } from 'react';\n\nimport { CombinedRule, CombinedRuleGroup, CombinedRuleNamespace } from 'app/types/unified-alerting';\nimport { PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\nimport { isAlertingRule, isRecordingRule, isRecordingRulerRule } from '../../utils/rules';\nimport { StateColoredText } from '../StateColoredText';\n\ninterface Props {\n  showInactive?: boolean;\n  showRecording?: boolean;\n  group?: CombinedRuleGroup;\n  namespaces?: CombinedRuleNamespace[];\n}\n\nconst emptyStats = {\n  total: 0,\n  recording: 0,\n  [PromAlertingRuleState.Firing]: 0,\n  [PromAlertingRuleState.Pending]: 0,\n  [PromAlertingRuleState.Inactive]: 0,\n  error: 0,\n} as const;\n\nexport const RuleStats: FC<Props> = ({ showInactive, showRecording, group, namespaces }) => {\n  const calculated = useMemo(() => {\n    const stats = { ...emptyStats };\n    const calcRule = (rule: CombinedRule) => {\n      if (rule.promRule && isAlertingRule(rule.promRule)) {\n        stats[rule.promRule.state] += 1;\n      }\n      if (rule.promRule?.health === 'err' || rule.promRule?.health === 'error') {\n        stats.error += 1;\n      }\n      if (\n        (rule.promRule && isRecordingRule(rule.promRule)) ||\n        (rule.rulerRule && isRecordingRulerRule(rule.rulerRule))\n      ) {\n        stats.recording += 1;\n      }\n      stats.total += 1;\n    };\n    if (group) {\n      group.rules.forEach(calcRule);\n    }\n    if (namespaces) {\n      namespaces.forEach((namespace) => namespace.groups.forEach((group) => group.rules.forEach(calcRule)));\n    }\n    return stats;\n  }, [group, namespaces]);\n\n  const statsComponents: React.ReactNode[] = [];\n  if (calculated[PromAlertingRuleState.Firing]) {\n    statsComponents.push(\n      <StateColoredText key=\"firing\" status={PromAlertingRuleState.Firing}>\n        {calculated[PromAlertingRuleState.Firing]} firing\n      </StateColoredText>\n    );\n  }\n  if (calculated.error) {\n    statsComponents.push(\n      <StateColoredText key=\"errors\" status={PromAlertingRuleState.Firing}>\n        {calculated.error} errors\n      </StateColoredText>\n    );\n  }\n  if (calculated[PromAlertingRuleState.Pending]) {\n    statsComponents.push(\n      <StateColoredText key=\"pending\" status={PromAlertingRuleState.Pending}>\n        {calculated[PromAlertingRuleState.Pending]} pending\n      </StateColoredText>\n    );\n  }\n  if (showInactive && calculated[PromAlertingRuleState.Inactive]) {\n    statsComponents.push(\n      <StateColoredText key=\"inactive\" status=\"neutral\">\n        {calculated[PromAlertingRuleState.Inactive]} normal\n      </StateColoredText>\n    );\n  }\n  if (showRecording && calculated.recording) {\n    statsComponents.push(\n      <StateColoredText key=\"recording\" status=\"neutral\">\n        {calculated.recording} recording\n      </StateColoredText>\n    );\n  }\n\n  return (\n    <div>\n      <span>\n        {calculated.total} {pluralize('rule', calculated.total)}\n      </span>\n      {!!statsComponents.length && (\n        <>\n          <span>: </span>\n          {statsComponents.reduce<React.ReactNode[]>(\n            (prev, curr, idx) =>\n              prev.length\n                ? [\n                    prev,\n                    <Fragment key={idx}>\n                      <span>, </span>\n                    </Fragment>,\n                    curr,\n                  ]\n                : [curr],\n            []\n          )}\n        </>\n      )}\n    </div>\n  );\n};\n","import { css } from '@emotion/css';\nimport pluralize from 'pluralize';\nimport React, { FC, useEffect, useState } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { Badge, ConfirmModal, HorizontalGroup, Icon, Spinner, Tooltip, useStyles2 } from '@grafana/ui';\nimport kbn from 'app/core/utils/kbn';\nimport { CombinedRuleGroup, CombinedRuleNamespace } from 'app/types/unified-alerting';\n\nimport { useFolder } from '../../hooks/useFolder';\nimport { useHasRuler } from '../../hooks/useHasRuler';\nimport { deleteRulesGroupAction } from '../../state/actions';\nimport { useRulesAccess } from '../../utils/accessControlHooks';\nimport { GRAFANA_RULES_SOURCE_NAME, isCloudRulesSource } from '../../utils/datasource';\nimport { isFederatedRuleGroup, isGrafanaRulerRule } from '../../utils/rules';\nimport { CollapseToggle } from '../CollapseToggle';\nimport { RuleLocation } from '../RuleLocation';\n\nimport { ActionIcon } from './ActionIcon';\nimport { EditCloudGroupModal } from './EditCloudGroupModal';\nimport { RuleStats } from './RuleStats';\nimport { RulesTable } from './RulesTable';\n\ninterface Props {\n  namespace: CombinedRuleNamespace;\n  group: CombinedRuleGroup;\n  expandAll: boolean;\n}\n\nexport const RulesGroup: FC<Props> = React.memo(({ group, namespace, expandAll }) => {\n  const { rulesSource } = namespace;\n  const dispatch = useDispatch();\n  const styles = useStyles2(getStyles);\n\n  const [isEditingGroup, setIsEditingGroup] = useState(false);\n  const [isDeletingGroup, setIsDeletingGroup] = useState(false);\n  const [isCollapsed, setIsCollapsed] = useState(!expandAll);\n\n  const { canEditRules } = useRulesAccess();\n\n  useEffect(() => {\n    setIsCollapsed(!expandAll);\n  }, [expandAll]);\n\n  const hasRuler = useHasRuler();\n  const rulerRule = group.rules[0]?.rulerRule;\n  const folderUID = (rulerRule && isGrafanaRulerRule(rulerRule) && rulerRule.grafana_alert.namespace_uid) || undefined;\n  const { folder } = useFolder(folderUID);\n\n  // group \"is deleting\" if rules source has ruler, but this group has no rules that are in ruler\n  const isDeleting = hasRuler(rulesSource) && !group.rules.find((rule) => !!rule.rulerRule);\n  const isFederated = isFederatedRuleGroup(group);\n\n  const deleteGroup = () => {\n    dispatch(deleteRulesGroupAction(namespace, group));\n    setIsDeletingGroup(false);\n  };\n\n  const actionIcons: React.ReactNode[] = [];\n\n  // for grafana, link to folder views\n  if (isDeleting) {\n    actionIcons.push(\n      <HorizontalGroup key=\"is-deleting\">\n        <Spinner />\n        deleting\n      </HorizontalGroup>\n    );\n  } else if (rulesSource === GRAFANA_RULES_SOURCE_NAME) {\n    if (folderUID) {\n      const baseUrl = `${config.appSubUrl}/dashboards/f/${folderUID}/${kbn.slugifyForUrl(namespace.name)}`;\n      if (folder?.canSave) {\n        actionIcons.push(\n          <ActionIcon\n            aria-label=\"edit folder\"\n            key=\"edit\"\n            icon=\"pen\"\n            tooltip=\"edit folder\"\n            to={baseUrl + '/settings'}\n            target=\"__blank\"\n          />\n        );\n      }\n      if (folder?.canAdmin) {\n        actionIcons.push(\n          <ActionIcon\n            aria-label=\"manage permissions\"\n            key=\"manage-perms\"\n            icon=\"lock\"\n            tooltip=\"manage permissions\"\n            to={baseUrl + '/permissions'}\n            target=\"__blank\"\n          />\n        );\n      }\n    }\n  } else if (canEditRules(rulesSource.name) && hasRuler(rulesSource)) {\n    if (!isFederated) {\n      actionIcons.push(\n        <ActionIcon\n          aria-label=\"edit rule group\"\n          data-testid=\"edit-group\"\n          key=\"edit\"\n          icon=\"pen\"\n          tooltip=\"edit rule group\"\n          onClick={() => setIsEditingGroup(true)}\n        />\n      );\n    }\n\n    actionIcons.push(\n      <ActionIcon\n        aria-label=\"delete rule group\"\n        data-testid=\"delete-group\"\n        key=\"delete-group\"\n        icon=\"trash-alt\"\n        tooltip=\"delete rule group\"\n        onClick={() => setIsDeletingGroup(true)}\n      />\n    );\n  }\n\n  // ungrouped rules are rules that are in the \"default\" group name\n  const isUngrouped = group.name === 'default';\n  const groupName = isUngrouped ? (\n    <RuleLocation namespace={namespace.name} />\n  ) : (\n    <RuleLocation namespace={namespace.name} group={group.name} />\n  );\n\n  return (\n    <div className={styles.wrapper} data-testid=\"rule-group\">\n      <div className={styles.header} data-testid=\"rule-group-header\">\n        <CollapseToggle\n          className={styles.collapseToggle}\n          isCollapsed={isCollapsed}\n          onToggle={setIsCollapsed}\n          data-testid=\"group-collapse-toggle\"\n        />\n        <Icon name={isCollapsed ? 'folder' : 'folder-open'} />\n        {isCloudRulesSource(rulesSource) && (\n          <Tooltip content={rulesSource.name} placement=\"top\">\n            <img\n              alt={rulesSource.meta.name}\n              className={styles.dataSourceIcon}\n              src={rulesSource.meta.info.logos.small}\n            />\n          </Tooltip>\n        )}\n        <h6 className={styles.heading}>\n          {isFederated && <Badge color=\"purple\" text=\"Federated\" />} {groupName}\n        </h6>\n        <div className={styles.spacer} />\n        <div className={styles.headerStats}>\n          <RuleStats showInactive={false} group={group} />\n        </div>\n        {!!actionIcons.length && (\n          <>\n            <div className={styles.actionsSeparator}>|</div>\n            <div className={styles.actionIcons}>{actionIcons}</div>\n          </>\n        )}\n      </div>\n      {!isCollapsed && (\n        <RulesTable showSummaryColumn={true} className={styles.rulesTable} showGuidelines={true} rules={group.rules} />\n      )}\n      {isEditingGroup && (\n        <EditCloudGroupModal group={group} namespace={namespace} onClose={() => setIsEditingGroup(false)} />\n      )}\n      <ConfirmModal\n        isOpen={isDeletingGroup}\n        title=\"Delete group\"\n        body={\n          <div>\n            Deleting this group will permanently remove the group\n            <br />\n            and {group.rules.length} alert {pluralize('rule', group.rules.length)} belonging to it.\n            <br />\n            Are you sure you want to delete this group?\n          </div>\n        }\n        onConfirm={deleteGroup}\n        onDismiss={() => setIsDeletingGroup(false)}\n        confirmText=\"Delete\"\n      />\n    </div>\n  );\n});\n\nRulesGroup.displayName = 'RulesGroup';\n\nexport const getStyles = (theme: GrafanaTheme2) => ({\n  wrapper: css`\n    & + & {\n      margin-top: ${theme.spacing(2)};\n    }\n  `,\n  header: css`\n    display: flex;\n    flex-direction: row;\n    align-items: center;\n    padding: ${theme.spacing(1)} ${theme.spacing(1)} ${theme.spacing(1)} 0;\n    background-color: ${theme.colors.background.secondary};\n    flex-wrap: wrap;\n  `,\n  headerStats: css`\n    span {\n      vertical-align: middle;\n    }\n\n    ${theme.breakpoints.down('sm')} {\n      order: 2;\n      width: 100%;\n      padding-left: ${theme.spacing(1)};\n    }\n  `,\n  heading: css`\n    margin-left: ${theme.spacing(1)};\n    margin-bottom: 0;\n  `,\n  spacer: css`\n    flex: 1;\n  `,\n  collapseToggle: css`\n    background: none;\n    border: none;\n    margin-top: -${theme.spacing(1)};\n    margin-bottom: -${theme.spacing(1)};\n\n    svg {\n      margin-bottom: 0;\n    }\n  `,\n  dataSourceIcon: css`\n    width: ${theme.spacing(2)};\n    height: ${theme.spacing(2)};\n    margin-left: ${theme.spacing(2)};\n  `,\n  dataSourceOrigin: css`\n    margin-right: 1em;\n    color: ${theme.colors.text.disabled};\n  `,\n  actionsSeparator: css`\n    margin: 0 ${theme.spacing(2)};\n  `,\n  actionIcons: css`\n    & > * + * {\n      margin-left: ${theme.spacing(0.5)};\n    }\n  `,\n  rulesTable: css`\n    margin-top: ${theme.spacing(3)};\n  `,\n});\n","import { css } from '@emotion/css';\nimport pluralize from 'pluralize';\nimport React, { FC, useMemo } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { LoadingPlaceholder, useStyles } from '@grafana/ui';\nimport { CombinedRuleNamespace } from 'app/types/unified-alerting';\n\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { getRulesDataSources, getRulesSourceName } from '../../utils/datasource';\n\nimport { RulesGroup } from './RulesGroup';\n\ninterface Props {\n  namespaces: CombinedRuleNamespace[];\n  expandAll: boolean;\n}\n\nexport const CloudRules: FC<Props> = ({ namespaces, expandAll }) => {\n  const styles = useStyles(getStyles);\n  const rules = useUnifiedAlertingSelector((state) => state.promRules);\n  const rulesDataSources = useMemo(getRulesDataSources, []);\n\n  const dataSourcesLoading = useMemo(\n    () => rulesDataSources.filter((ds) => rules[ds.name]?.loading),\n    [rules, rulesDataSources]\n  );\n\n  return (\n    <section className={styles.wrapper}>\n      <div className={styles.sectionHeader}>\n        <h5>Mimir / Cortex / Loki</h5>\n        {dataSourcesLoading.length ? (\n          <LoadingPlaceholder\n            className={styles.loader}\n            text={`Loading rules from ${dataSourcesLoading.length} ${pluralize('source', dataSourcesLoading.length)}`}\n          />\n        ) : (\n          <div />\n        )}\n      </div>\n\n      {namespaces.map((namespace) => {\n        const { groups, rulesSource } = namespace;\n        return groups.map((group) => (\n          <RulesGroup\n            group={group}\n            key={`${getRulesSourceName(rulesSource)}-${name}-${group.name}`}\n            namespace={namespace}\n            expandAll={expandAll}\n          />\n        ));\n      })}\n      {namespaces?.length === 0 && !!rulesDataSources.length && <p>No rules found.</p>}\n      {!rulesDataSources.length && <p>There are no Prometheus or Loki datas sources configured.</p>}\n    </section>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme) => ({\n  loader: css`\n    margin-bottom: 0;\n  `,\n  sectionHeader: css`\n    display: flex;\n    justify-content: space-between;\n  `,\n  wrapper: css`\n    margin-bottom: ${theme.spacing.xl};\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { LoadingPlaceholder, useStyles } from '@grafana/ui';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { CombinedRuleNamespace } from 'app/types/unified-alerting';\n\nimport { flattenGrafanaManagedRules } from '../../hooks/useCombinedRuleNamespaces';\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { GRAFANA_RULES_SOURCE_NAME } from '../../utils/datasource';\nimport { initialAsyncRequestState } from '../../utils/redux';\n\nimport { RulesGroup } from './RulesGroup';\n\ninterface Props {\n  namespaces: CombinedRuleNamespace[];\n  expandAll: boolean;\n}\n\nexport const GrafanaRules: FC<Props> = ({ namespaces, expandAll }) => {\n  const styles = useStyles(getStyles);\n  const [queryParams] = useQueryParams();\n\n  const { loading } = useUnifiedAlertingSelector(\n    (state) => state.promRules[GRAFANA_RULES_SOURCE_NAME] || initialAsyncRequestState\n  );\n\n  const wantsGroupedView = queryParams['view'] === 'grouped';\n  const namespacesFormat = wantsGroupedView ? namespaces : flattenGrafanaManagedRules(namespaces);\n\n  return (\n    <section className={styles.wrapper}>\n      <div className={styles.sectionHeader}>\n        <h5>Grafana</h5>\n        {loading ? <LoadingPlaceholder className={styles.loader} text=\"Loading...\" /> : <div />}\n      </div>\n\n      {namespacesFormat?.map((namespace) =>\n        namespace.groups.map((group) => (\n          <RulesGroup\n            group={group}\n            key={`${namespace.name}-${group.name}`}\n            namespace={namespace}\n            expandAll={expandAll}\n          />\n        ))\n      )}\n      {namespacesFormat?.length === 0 && <p>No rules found.</p>}\n    </section>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme) => ({\n  loader: css`\n    margin-bottom: 0;\n  `,\n  sectionHeader: css`\n    display: flex;\n    justify-content: space-between;\n  `,\n  wrapper: css`\n    margin-bottom: ${theme.spacing.xl};\n  `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC, useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { CombinedRule } from 'app/types/unified-alerting';\nimport { PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\nimport { alertStateToReadable } from '../../utils/rules';\nimport { CollapseToggle } from '../CollapseToggle';\n\nimport { RulesTable } from './RulesTable';\n\ninterface Props {\n  rules: CombinedRule[];\n  state: PromAlertingRuleState;\n  defaultCollapsed?: boolean;\n}\n\nexport const RuleListStateSection: FC<Props> = ({ rules, state, defaultCollapsed = false }) => {\n  const [collapsed, setCollapsed] = useState(defaultCollapsed);\n  const styles = useStyles2(getStyles);\n  return (\n    <>\n      <h4 className={styles.header}>\n        <CollapseToggle\n          className={styles.collapseToggle}\n          size=\"xxl\"\n          isCollapsed={collapsed}\n          onToggle={() => setCollapsed(!collapsed)}\n        />\n        {alertStateToReadable(state)} ({rules.length})\n      </h4>\n      {!collapsed && <RulesTable className={styles.rulesTable} rules={rules} showGroupColumn={true} />}\n    </>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  collapseToggle: css`\n    vertical-align: middle;\n  `,\n  header: css`\n    margin-top: ${theme.spacing(2)};\n  `,\n  rulesTable: css`\n    margin-top: ${theme.spacing(3)};\n  `,\n});\n","import { css, cx } from '@emotion/css';\nimport { debounce } from 'lodash';\nimport React, { FormEvent, useState } from 'react';\n\nimport { DataSourceInstanceSettings, GrafanaTheme, SelectableValue } from '@grafana/data';\nimport { Stack } from '@grafana/experimental';\nimport { DataSourcePicker } from '@grafana/runtime';\nimport { Button, Field, Icon, Input, Label, RadioButtonGroup, Tooltip, useStyles } from '@grafana/ui';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { PromAlertingRuleState, PromRuleType } from 'app/types/unified-alerting-dto';\n\nimport { getFiltersFromUrlParams } from '../../utils/misc';\nimport { alertStateToReadable } from '../../utils/rules';\n\nconst ViewOptions: SelectableValue[] = [\n  {\n    icon: 'list-ul',\n    label: 'List',\n    value: 'list',\n  },\n  {\n    icon: 'folder',\n    label: 'Grouped',\n    value: 'grouped',\n  },\n  {\n    icon: 'heart-rate',\n    label: 'State',\n    value: 'state',\n  },\n];\n\nconst RuleTypeOptions: SelectableValue[] = [\n  {\n    label: 'Alert ',\n    value: PromRuleType.Alerting,\n  },\n  {\n    label: 'Recording ',\n    value: PromRuleType.Recording,\n  },\n];\n\nconst RulesFilter = () => {\n  const [queryParams, setQueryParams] = useQueryParams();\n  // This key is used to force a rerender on the inputs when the filters are cleared\n  const [filterKey, setFilterKey] = useState<number>(Math.floor(Math.random() * 100));\n  const dataSourceKey = `dataSource-${filterKey}`;\n  const queryStringKey = `queryString-${filterKey}`;\n\n  const { dataSource, alertState, queryString, ruleType } = getFiltersFromUrlParams(queryParams);\n\n  const styles = useStyles(getStyles);\n  const stateOptions = Object.entries(PromAlertingRuleState).map(([key, value]) => ({\n    label: alertStateToReadable(value),\n    value,\n  }));\n\n  const handleDataSourceChange = (dataSourceValue: DataSourceInstanceSettings) => {\n    setQueryParams({ dataSource: dataSourceValue.name });\n  };\n\n  const clearDataSource = () => {\n    setQueryParams({ dataSource: null });\n  };\n\n  const handleQueryStringChange = debounce((e: FormEvent<HTMLInputElement>) => {\n    const target = e.target as HTMLInputElement;\n    setQueryParams({ queryString: target.value || null });\n  }, 600);\n\n  const handleAlertStateChange = (value: string) => {\n    setQueryParams({ alertState: value });\n  };\n\n  const handleViewChange = (view: string) => {\n    setQueryParams({ view });\n  };\n\n  const handleRuleTypeChange = (ruleType: PromRuleType) => {\n    setQueryParams({ ruleType });\n  };\n\n  const handleClearFiltersClick = () => {\n    setQueryParams({\n      alertState: null,\n      queryString: null,\n      dataSource: null,\n      ruleType: null,\n    });\n    setTimeout(() => setFilterKey(filterKey + 1), 100);\n  };\n\n  const searchIcon = <Icon name={'search'} />;\n  return (\n    <div className={styles.container}>\n      <Field className={styles.inputWidth} label=\"Search by data source\">\n        <DataSourcePicker\n          key={dataSourceKey}\n          alerting\n          noDefault\n          placeholder=\"All data sources\"\n          current={dataSource}\n          onChange={handleDataSourceChange}\n          onClear={clearDataSource}\n        />\n      </Field>\n      <div className={cx(styles.flexRow, styles.spaceBetween)}>\n        <div className={styles.flexRow}>\n          <Field\n            className={styles.rowChild}\n            label={\n              <Label>\n                <Stack gap={0.5}>\n                  <span>Search by label</span>\n                  <Tooltip\n                    content={\n                      <div>\n                        Filter rules and alerts using label querying, ex:\n                        <code>{`{severity=\"critical\", instance=~\"cluster-us-.+\"}`}</code>\n                      </div>\n                    }\n                  >\n                    <Icon name=\"info-circle\" size=\"sm\" />\n                  </Tooltip>\n                </Stack>\n              </Label>\n            }\n          >\n            <Input\n              key={queryStringKey}\n              className={styles.inputWidth}\n              prefix={searchIcon}\n              onChange={handleQueryStringChange}\n              defaultValue={queryString}\n              placeholder=\"Search\"\n              data-testid=\"search-query-input\"\n            />\n          </Field>\n          <div className={styles.rowChild}>\n            <Label>State</Label>\n            <RadioButtonGroup options={stateOptions} value={alertState} onChange={handleAlertStateChange} />\n          </div>\n          <div className={styles.rowChild}>\n            <Label>Rule type</Label>\n            <RadioButtonGroup\n              options={RuleTypeOptions}\n              value={ruleType as PromRuleType}\n              onChange={handleRuleTypeChange}\n            />\n          </div>\n          <div className={styles.rowChild}>\n            <Label>View as</Label>\n            <RadioButtonGroup\n              options={ViewOptions}\n              value={String(queryParams['view'] ?? ViewOptions[0].value)}\n              onChange={handleViewChange}\n            />\n          </div>\n        </div>\n        {(dataSource || alertState || queryString || ruleType) && (\n          <div className={styles.flexRow}>\n            <Button\n              className={styles.clearButton}\n              fullWidth={false}\n              icon=\"times\"\n              variant=\"secondary\"\n              onClick={handleClearFiltersClick}\n            >\n              Clear filters\n            </Button>\n          </div>\n        )}\n      </div>\n    </div>\n  );\n};\n\nconst getStyles = (theme: GrafanaTheme) => {\n  return {\n    container: css`\n      display: flex;\n      flex-direction: column;\n      padding-bottom: ${theme.spacing.sm};\n      margin-bottom: ${theme.spacing.sm};\n    `,\n    inputWidth: css`\n      width: 340px;\n      flex-grow: 0;\n    `,\n    flexRow: css`\n      display: flex;\n      flex-direction: row;\n      align-items: flex-end;\n      width: 100%;\n      flex-wrap: wrap;\n    `,\n    spaceBetween: css`\n      justify-content: space-between;\n    `,\n    rowChild: css`\n      margin: 0 ${theme.spacing.sm} 0 0;\n    `,\n    clearButton: css`\n      margin-top: ${theme.spacing.sm};\n    `,\n  };\n};\n\nexport default RulesFilter;\n","import { useMemo } from 'react';\n\nimport { getDataSourceSrv } from '@grafana/runtime';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { CombinedRuleGroup, CombinedRuleNamespace, FilterState } from 'app/types/unified-alerting';\nimport { PromRuleType, RulerGrafanaRuleDTO } from 'app/types/unified-alerting-dto';\n\nimport { labelsMatchMatchers, parseMatchers } from '../utils/alertmanager';\nimport { isCloudRulesSource } from '../utils/datasource';\nimport { getFiltersFromUrlParams } from '../utils/misc';\nimport { isAlertingRule, isGrafanaRulerRule } from '../utils/rules';\n\nexport const useFilteredRules = (namespaces: CombinedRuleNamespace[]) => {\n  const [queryParams] = useQueryParams();\n  const filters = getFiltersFromUrlParams(queryParams);\n\n  return useMemo(() => {\n    const filteredNamespaces = namespaces\n      // Filter by data source\n      // TODO: filter by multiple data sources for grafana-managed alerts\n      .filter(({ rulesSource }) =>\n        filters.dataSource && isCloudRulesSource(rulesSource) ? rulesSource.name === filters.dataSource : true\n      )\n      // If a namespace and group have rules that match the rules filters then keep them.\n      .reduce(reduceNamespaces(filters), [] as CombinedRuleNamespace[]);\n    return filteredNamespaces;\n  }, [namespaces, filters]);\n};\n\nconst reduceNamespaces = (filters: FilterState) => {\n  return (namespaceAcc: CombinedRuleNamespace[], namespace: CombinedRuleNamespace) => {\n    const groups = namespace.groups.reduce(reduceGroups(filters), [] as CombinedRuleGroup[]);\n\n    if (groups.length) {\n      namespaceAcc.push({\n        ...namespace,\n        groups,\n      });\n    }\n\n    return namespaceAcc;\n  };\n};\n\n// Reduces groups to only groups that have rules matching the filters\nconst reduceGroups = (filters: FilterState) => {\n  return (groupAcc: CombinedRuleGroup[], group: CombinedRuleGroup) => {\n    const rules = group.rules.filter((rule) => {\n      if (filters.ruleType && filters.ruleType !== rule.promRule?.type) {\n        return false;\n      }\n      if (filters.dataSource && isGrafanaRulerRule(rule.rulerRule) && !isQueryingDataSource(rule.rulerRule, filters)) {\n        return false;\n      }\n      // Query strings can match alert name, label keys, and label values\n      if (filters.queryString) {\n        const normalizedQueryString = filters.queryString.toLocaleLowerCase();\n        const doesNameContainsQueryString = rule.name?.toLocaleLowerCase().includes(normalizedQueryString);\n        const matchers = parseMatchers(filters.queryString);\n\n        const doRuleLabelsMatchQuery = labelsMatchMatchers(rule.labels, matchers);\n        const doAlertsContainMatchingLabels =\n          rule.promRule &&\n          rule.promRule.type === PromRuleType.Alerting &&\n          rule.promRule.alerts &&\n          rule.promRule.alerts.some((alert) => labelsMatchMatchers(alert.labels, matchers));\n\n        if (!(doesNameContainsQueryString || doRuleLabelsMatchQuery || doAlertsContainMatchingLabels)) {\n          return false;\n        }\n      }\n      if (\n        filters.alertState &&\n        !(rule.promRule && isAlertingRule(rule.promRule) && rule.promRule.state === filters.alertState)\n      ) {\n        return false;\n      }\n      return true;\n    });\n    // Add rules to the group that match the rule list filters\n    if (rules.length) {\n      groupAcc.push({\n        ...group,\n        rules,\n      });\n    }\n    return groupAcc;\n  };\n};\n\nconst isQueryingDataSource = (rulerRule: RulerGrafanaRuleDTO, filter: FilterState): boolean => {\n  if (!filter.dataSource) {\n    return true;\n  }\n\n  return !!rulerRule.grafana_alert.data.find((query) => {\n    if (!query.datasourceUid) {\n      return false;\n    }\n    const ds = getDataSourceSrv().getInstanceSettings(query.datasourceUid);\n    return ds?.name === filter.dataSource;\n  });\n};\n","import { css } from '@emotion/css';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { useLocation } from 'react-router-dom';\n\nimport { GrafanaTheme2, urlUtil } from '@grafana/data';\nimport { Button, LinkButton, useStyles2, withErrorBoundary } from '@grafana/ui';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\n\nimport { AlertingPageWrapper } from './components/AlertingPageWrapper';\nimport { NoRulesSplash } from './components/rules/NoRulesCTA';\nimport { RuleListErrors } from './components/rules/RuleListErrors';\nimport { RuleListGroupView } from './components/rules/RuleListGroupView';\nimport { RuleListStateView } from './components/rules/RuleListStateView';\nimport { RuleStats } from './components/rules/RuleStats';\nimport RulesFilter from './components/rules/RulesFilter';\nimport { useCombinedRuleNamespaces } from './hooks/useCombinedRuleNamespaces';\nimport { useFilteredRules } from './hooks/useFilteredRules';\nimport { useUnifiedAlertingSelector } from './hooks/useUnifiedAlertingSelector';\nimport { fetchAllPromAndRulerRulesAction } from './state/actions';\nimport { useRulesAccess } from './utils/accessControlHooks';\nimport { RULE_LIST_POLL_INTERVAL_MS } from './utils/constants';\nimport { getAllRulesSourceNames } from './utils/datasource';\nimport { getFiltersFromUrlParams } from './utils/misc';\n\nconst VIEWS = {\n  groups: RuleListGroupView,\n  state: RuleListStateView,\n};\n\nconst RuleList = withErrorBoundary(\n  () => {\n    const dispatch = useDispatch();\n    const styles = useStyles2(getStyles);\n    const rulesDataSourceNames = useMemo(getAllRulesSourceNames, []);\n    const location = useLocation();\n    const [expandAll, setExpandAll] = useState(false);\n\n    const [queryParams] = useQueryParams();\n    const filters = getFiltersFromUrlParams(queryParams);\n    const filtersActive = Object.values(filters).some((filter) => filter !== undefined);\n\n    const { canCreateGrafanaRules, canCreateCloudRules } = useRulesAccess();\n\n    const view = VIEWS[queryParams['view'] as keyof typeof VIEWS]\n      ? (queryParams['view'] as keyof typeof VIEWS)\n      : 'groups';\n\n    const ViewComponent = VIEWS[view];\n\n    // fetch rules, then poll every RULE_LIST_POLL_INTERVAL_MS\n    useEffect(() => {\n      dispatch(fetchAllPromAndRulerRulesAction());\n      const interval = setInterval(() => dispatch(fetchAllPromAndRulerRulesAction()), RULE_LIST_POLL_INTERVAL_MS);\n      return () => {\n        clearInterval(interval);\n      };\n    }, [dispatch]);\n\n    const promRuleRequests = useUnifiedAlertingSelector((state) => state.promRules);\n    const rulerRuleRequests = useUnifiedAlertingSelector((state) => state.rulerRules);\n\n    const dispatched = rulesDataSourceNames.some(\n      (name) => promRuleRequests[name]?.dispatched || rulerRuleRequests[name]?.dispatched\n    );\n    const loading = rulesDataSourceNames.some(\n      (name) => promRuleRequests[name]?.loading || rulerRuleRequests[name]?.loading\n    );\n    const haveResults = rulesDataSourceNames.some(\n      (name) =>\n        (promRuleRequests[name]?.result?.length && !promRuleRequests[name]?.error) ||\n        (Object.keys(rulerRuleRequests[name]?.result || {}).length && !rulerRuleRequests[name]?.error)\n    );\n\n    const showNewAlertSplash = dispatched && !loading && !haveResults;\n\n    const combinedNamespaces = useCombinedRuleNamespaces();\n    const filteredNamespaces = useFilteredRules(combinedNamespaces);\n    return (\n      <AlertingPageWrapper pageId=\"alert-list\" isLoading={loading && !haveResults}>\n        <RuleListErrors />\n        {!showNewAlertSplash && (\n          <>\n            <RulesFilter />\n            <div className={styles.break} />\n            <div className={styles.buttonsContainer}>\n              <div className={styles.statsContainer}>\n                {view === 'groups' && filtersActive && (\n                  <Button\n                    className={styles.expandAllButton}\n                    icon={expandAll ? 'angle-double-up' : 'angle-double-down'}\n                    variant=\"secondary\"\n                    onClick={() => setExpandAll(!expandAll)}\n                  >\n                    {expandAll ? 'Collapse all' : 'Expand all'}\n                  </Button>\n                )}\n                <RuleStats showInactive={true} showRecording={true} namespaces={filteredNamespaces} />\n              </div>\n              {(canCreateGrafanaRules || canCreateCloudRules) && (\n                <LinkButton\n                  href={urlUtil.renderUrl('alerting/new', { returnTo: location.pathname + location.search })}\n                  icon=\"plus\"\n                >\n                  New alert rule\n                </LinkButton>\n              )}\n            </div>\n          </>\n        )}\n        {showNewAlertSplash && <NoRulesSplash />}\n        {haveResults && <ViewComponent expandAll={expandAll} namespaces={filteredNamespaces} />}\n      </AlertingPageWrapper>\n    );\n  },\n  { style: 'page' }\n);\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n  break: css`\n    width: 100%;\n    height: 0;\n    margin-bottom: ${theme.spacing(2)};\n    border-bottom: solid 1px ${theme.colors.border.medium};\n  `,\n  buttonsContainer: css`\n    margin-bottom: ${theme.spacing(2)};\n    display: flex;\n    justify-content: space-between;\n  `,\n  statsContainer: css`\n    display: flex;\n    flex-direction: row;\n    align-items: center;\n  `,\n  expandAllButton: css`\n    margin-right: ${theme.spacing(1)};\n  `,\n});\n\nexport default RuleList;\n","import React, { FC, useMemo } from 'react';\n\nimport { AccessControlAction } from 'app/types';\nimport { CombinedRuleNamespace } from 'app/types/unified-alerting';\n\nimport { isCloudRulesSource, isGrafanaRulesSource } from '../../utils/datasource';\nimport { Authorize } from '../Authorize';\n\nimport { CloudRules } from './CloudRules';\nimport { GrafanaRules } from './GrafanaRules';\n\ninterface Props {\n  namespaces: CombinedRuleNamespace[];\n  expandAll: boolean;\n}\n\nexport const RuleListGroupView: FC<Props> = ({ namespaces, expandAll }) => {\n  const [grafanaNamespaces, cloudNamespaces] = useMemo(() => {\n    const sorted = namespaces\n      .map((namespace) => ({\n        ...namespace,\n        groups: namespace.groups.sort((a, b) => a.name.localeCompare(b.name)),\n      }))\n      .sort((a, b) => a.name.localeCompare(b.name));\n    return [\n      sorted.filter((ns) => isGrafanaRulesSource(ns.rulesSource)),\n      sorted.filter((ns) => isCloudRulesSource(ns.rulesSource)),\n    ];\n  }, [namespaces]);\n\n  return (\n    <>\n      <Authorize actions={[AccessControlAction.AlertingRuleRead]}>\n        <GrafanaRules namespaces={grafanaNamespaces} expandAll={expandAll} />\n      </Authorize>\n      <Authorize actions={[AccessControlAction.AlertingRuleExternalRead]}>\n        <CloudRules namespaces={cloudNamespaces} expandAll={expandAll} />\n      </Authorize>\n    </>\n  );\n};\n","import React, { FC, useMemo } from 'react';\n\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { CombinedRule, CombinedRuleNamespace } from 'app/types/unified-alerting';\nimport { PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\nimport { getFiltersFromUrlParams } from '../../utils/misc';\nimport { isAlertingRule } from '../../utils/rules';\n\nimport { RuleListStateSection } from './RuleListStateSection';\n\ninterface Props {\n  namespaces: CombinedRuleNamespace[];\n  expandAll?: boolean;\n}\n\ntype GroupedRules = Record<PromAlertingRuleState, CombinedRule[]>;\n\nexport const RuleListStateView: FC<Props> = ({ namespaces }) => {\n  const filters = getFiltersFromUrlParams(useQueryParams()[0]);\n\n  const groupedRules = useMemo(() => {\n    const result: GroupedRules = {\n      [PromAlertingRuleState.Firing]: [],\n      [PromAlertingRuleState.Inactive]: [],\n      [PromAlertingRuleState.Pending]: [],\n    };\n\n    namespaces.forEach((namespace) =>\n      namespace.groups.forEach((group) =>\n        group.rules.forEach((rule) => {\n          if (rule.promRule && isAlertingRule(rule.promRule)) {\n            result[rule.promRule.state].push(rule);\n          }\n        })\n      )\n    );\n\n    Object.values(result).forEach((rules) => rules.sort((a, b) => a.name.localeCompare(b.name)));\n\n    return result;\n  }, [namespaces]);\n  return (\n    <>\n      {(!filters.alertState || filters.alertState === PromAlertingRuleState.Firing) && (\n        <RuleListStateSection state={PromAlertingRuleState.Firing} rules={groupedRules[PromAlertingRuleState.Firing]} />\n      )}\n      {(!filters.alertState || filters.alertState === PromAlertingRuleState.Pending) && (\n        <RuleListStateSection\n          state={PromAlertingRuleState.Pending}\n          rules={groupedRules[PromAlertingRuleState.Pending]}\n        />\n      )}\n      {(!filters.alertState || filters.alertState === PromAlertingRuleState.Inactive) && (\n        <RuleListStateSection\n          defaultCollapsed={filters.alertState !== PromAlertingRuleState.Inactive}\n          state={PromAlertingRuleState.Inactive}\n          rules={groupedRules[PromAlertingRuleState.Inactive]}\n        />\n      )}\n    </>\n  );\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, { FC } from 'react';\n\nimport { Icon } from '@grafana/ui';\n\ninterface RuleLocationProps {\n  namespace: string;\n  group?: string;\n}\n\nconst RuleLocation: FC<RuleLocationProps> = ({ namespace, group }) => {\n  if (!group) {\n    return <>{namespace}</>;\n  }\n\n  return (\n    <>\n      {namespace} <Icon name=\"angle-right\" /> {group}\n    </>\n  );\n};\n\nexport { RuleLocation };\n","import React, { FC } from 'react';\n\nimport { IconName, Tooltip, LinkButton, Button } from '@grafana/ui';\nimport { PopoverContent, TooltipPlacement } from '@grafana/ui/src/components/Tooltip';\n\ninterface Props {\n  tooltip: PopoverContent;\n  icon: IconName;\n  className?: string;\n  tooltipPlacement?: TooltipPlacement;\n  to?: string;\n  target?: string;\n  onClick?: () => void;\n  'data-testid'?: string;\n}\n\nexport const ActionIcon: FC<Props> = ({\n  tooltip,\n  icon,\n  to,\n  target,\n  onClick,\n  className,\n  tooltipPlacement = 'top',\n  ...rest\n}) => {\n  const ariaLabel = typeof tooltip === 'string' ? tooltip : undefined;\n\n  return (\n    <Tooltip content={tooltip} placement={tooltipPlacement}>\n      {to ? (\n        <LinkButton\n          variant=\"secondary\"\n          fill=\"text\"\n          icon={icon}\n          href={to}\n          size=\"sm\"\n          target={target}\n          {...rest}\n          aria-label={ariaLabel}\n        />\n      ) : (\n        <Button\n          className={className}\n          variant=\"secondary\"\n          fill=\"text\"\n          size=\"sm\"\n          icon={icon}\n          type=\"button\"\n          onClick={onClick}\n          {...rest}\n          aria-label={ariaLabel}\n        />\n      )}\n    </Tooltip>\n  );\n};\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { CombinedRule } from 'app/types/unified-alerting';\n\nimport { AlertLabels } from '../AlertLabels';\nimport { DetailsField } from '../DetailsField';\n\nimport { RuleDetailsActionButtons } from './RuleDetailsActionButtons';\nimport { RuleDetailsAnnotations } from './RuleDetailsAnnotations';\nimport { RuleDetailsDataSources } from './RuleDetailsDataSources';\nimport { RuleDetailsExpression } from './RuleDetailsExpression';\nimport { RuleDetailsMatchingInstances } from './RuleDetailsMatchingInstances';\n\ninterface Props {\n  rule: CombinedRule;\n}\n\nexport const RuleDetails: FC<Props> = ({ rule }) => {\n  const styles = useStyles2(getStyles);\n  const {\n    promRule,\n    namespace: { rulesSource },\n  } = rule;\n\n  const annotations = Object.entries(rule.annotations).filter(([_, value]) => !!value.trim());\n\n  return (\n    <div>\n      <RuleDetailsActionButtons rule={rule} rulesSource={rulesSource} />\n      <div className={styles.wrapper}>\n        <div className={styles.leftSide}>\n          {!!rule.labels && !!Object.keys(rule.labels).length && (\n            <DetailsField label=\"Labels\" horizontal={true}>\n              <AlertLabels labels={rule.labels} />\n            </DetailsField>\n          )}\n          <RuleDetailsExpression rulesSource={rulesSource} rule={rule} annotations={annotations} />\n          <RuleDetailsAnnotations annotations={annotations} />\n        </div>\n        <div className={styles.rightSide}>\n          <RuleDetailsDataSources rulesSource={rulesSource} rule={rule} />\n        </div>\n      </div>\n      <RuleDetailsMatchingInstances promRule={promRule} />\n    </div>\n  );\n};\n\nexport const getStyles = (theme: GrafanaTheme2) => ({\n  wrapper: css`\n    display: flex;\n    flex-direction: row;\n    ${theme.breakpoints.down('md')} {\n      flex-direction: column;\n    }\n  `,\n  leftSide: css`\n    flex: 1;\n  `,\n  rightSide: css`\n    ${theme.breakpoints.up('md')} {\n      padding-left: 90px;\n      width: 300px;\n    }\n  `,\n});\n","import { css, cx } from '@emotion/css';\nimport React, { FC, useMemo } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { CombinedRule } from 'app/types/unified-alerting';\n\nimport { useHasRuler } from '../../hooks/useHasRuler';\nimport { Annotation } from '../../utils/constants';\nimport { DynamicTable, DynamicTableColumnProps, DynamicTableItemProps } from '../DynamicTable';\nimport { DynamicTableWithGuidelines } from '../DynamicTableWithGuidelines';\nimport { RuleLocation } from '../RuleLocation';\n\nimport { RuleDetails } from './RuleDetails';\nimport { RuleHealth } from './RuleHealth';\nimport { RuleState } from './RuleState';\n\ntype RuleTableColumnProps = DynamicTableColumnProps<CombinedRule>;\ntype RuleTableItemProps = DynamicTableItemProps<CombinedRule>;\n\ninterface Props {\n  rules: CombinedRule[];\n  showGuidelines?: boolean;\n  showGroupColumn?: boolean;\n  showSummaryColumn?: boolean;\n  emptyMessage?: string;\n  className?: string;\n}\n\nexport const RulesTable: FC<Props> = ({\n  rules,\n  className,\n  showGuidelines = false,\n  emptyMessage = 'No rules found.',\n  showGroupColumn = false,\n  showSummaryColumn = false,\n}) => {\n  const styles = useStyles2(getStyles);\n\n  const wrapperClass = cx(styles.wrapper, className, { [styles.wrapperMargin]: showGuidelines });\n\n  const items = useMemo((): RuleTableItemProps[] => {\n    const seenKeys: string[] = [];\n    return rules.map((rule, ruleIdx) => {\n      let key = JSON.stringify([rule.promRule?.type, rule.labels, rule.query, rule.name, rule.annotations]);\n      if (seenKeys.includes(key)) {\n        key += `-${ruleIdx}`;\n      }\n      seenKeys.push(key);\n      return {\n        id: key,\n        data: rule,\n      };\n    });\n  }, [rules]);\n\n  const columns = useColumns(showSummaryColumn, showGroupColumn);\n\n  if (!rules.length) {\n    return <div className={cx(wrapperClass, styles.emptyMessage)}>{emptyMessage}</div>;\n  }\n\n  const TableComponent = showGuidelines ? DynamicTableWithGuidelines : DynamicTable;\n\n  return (\n    <div className={wrapperClass} data-testid=\"rules-table\">\n      <TableComponent\n        cols={columns}\n        isExpandable={true}\n        items={items}\n        renderExpandedContent={({ data: rule }) => <RuleDetails rule={rule} />}\n      />\n    </div>\n  );\n};\n\nexport const getStyles = (theme: GrafanaTheme2) => ({\n  wrapperMargin: css`\n    ${theme.breakpoints.up('md')} {\n      margin-left: 36px;\n    }\n  `,\n  emptyMessage: css`\n    padding: ${theme.spacing(1)};\n  `,\n  wrapper: css`\n    width: auto;\n    background-color: ${theme.colors.background.secondary};\n    border-radius: ${theme.shape.borderRadius()};\n  `,\n});\n\nfunction useColumns(showSummaryColumn: boolean, showGroupColumn: boolean) {\n  const hasRuler = useHasRuler();\n\n  return useMemo((): RuleTableColumnProps[] => {\n    const columns: RuleTableColumnProps[] = [\n      {\n        id: 'state',\n        label: 'State',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: rule }) => {\n          const { namespace } = rule;\n          const { rulesSource } = namespace;\n          const { promRule, rulerRule } = rule;\n          const isDeleting = !!(hasRuler(rulesSource) && promRule && !rulerRule);\n          const isCreating = !!(hasRuler(rulesSource) && rulerRule && !promRule);\n          return <RuleState rule={rule} isDeleting={isDeleting} isCreating={isCreating} />;\n        },\n        size: '165px',\n      },\n      {\n        id: 'name',\n        label: 'Name',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: rule }) => rule.name,\n        size: 5,\n      },\n      {\n        id: 'health',\n        label: 'Health',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: { promRule } }) => (promRule ? <RuleHealth rule={promRule} /> : null),\n        size: '75px',\n      },\n    ];\n    if (showSummaryColumn) {\n      columns.push({\n        id: 'summary',\n        label: 'Summary',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: rule }) => rule.annotations[Annotation.summary] ?? '',\n        size: 5,\n      });\n    }\n    if (showGroupColumn) {\n      columns.push({\n        id: 'group',\n        label: 'Group',\n        // eslint-disable-next-line react/display-name\n        renderCell: ({ data: rule }) => {\n          const { namespace, group } = rule;\n          // ungrouped rules are rules that are in the \"default\" group name\n          const isUngrouped = group.name === 'default';\n          const groupName = isUngrouped ? (\n            <RuleLocation namespace={namespace.name} />\n          ) : (\n            <RuleLocation namespace={namespace.name} group={group.name} />\n          );\n\n          return groupName;\n        },\n        size: 5,\n      });\n    }\n    return columns;\n  }, [hasRuler, showSummaryColumn, showGroupColumn]);\n}\n","import { useCallback } from 'react';\n\nimport { RulesSource } from 'app/types/unified-alerting';\n\nimport { GRAFANA_RULES_SOURCE_NAME } from '../utils/datasource';\n\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\n// datasource has ruler if it's grafana managed or if we're able to load rules from it\nexport function useHasRuler(): (rulesSource: string | RulesSource) => boolean {\n  const rulerRules = useUnifiedAlertingSelector((state) => state.rulerRules);\n  return useCallback(\n    (rulesSource: string | RulesSource) => {\n      const rulesSourceName = typeof rulesSource === 'string' ? rulesSource : rulesSource.name;\n      return rulesSourceName === GRAFANA_RULES_SOURCE_NAME || !!rulerRules[rulesSourceName]?.result;\n    },\n    [rulerRules]\n  );\n}\n","import { useMemo } from 'react';\n\nimport { getRulesAccess } from './access-control';\n\nexport function useRulesAccess() {\n  return useMemo(() => getRulesAccess(), []);\n}\n"],"names":["useCleanup","stateSelector","dispatch","useDispatch","selectorRef","useRef","current","useEffect","cleanUpAction","AlertHowToModal","onDismiss","Modal","title","isOpen","onClickBackdrop","VerticalGroup","spacing","src","alt","rule","search","onTogglePause","ruleUrl","url","panelId","renderText","useCallback","text","highlightClassName","textToHighlight","searchWords","Card","name","Icon","size","stateIcon","className","stateClass","stateText","stateAge","info","Button","variant","icon","state","onClick","LinkButton","href","UnifiedAlertingPromotion","showUnifiedAlertingPromotion","setShowUnifiedAlertingPromotion","useLocalStorage","Alert","severity","onRemove","getSearchQuery","searchQuery","getAlertRuleItems","regex","RegExp","alertRules","items","filter","item","test","mapDispatchToProps","getAlertRulesAsync","setSearchQuery","togglePauseAlertRule","connector","connect","navModel","getNavModel","navIndex","isLoading","AlertRuleListUnconnected","PureComponent","label","value","option","locationService","appEvents","ShowModalReactEvent","component","this","props","id","paused","componentDidMount","fetchRules","componentDidUpdate","prevProps","queryParams","getStateFilter","render","Page","FilterInput","placeholder","onChange","onSearchQueryChange","htmlFor","Select","inputId","menuShouldPortal","options","stateFilters","onStateFilterChanged","config","onOpenHowTo","map","async","loadAlertRules","rules","getBackendSrv","get","loadedAlertRules","post","toString","createNotificationChannel","data","notifyApp","createSuccessNotification","error","createErrorNotification","updateNotificationChannel","put","testNotificationChannel","getState","channel","notificationChannel","loadNotificationTypes","notificationTypes","sort","o1","o2","setNotificationChannels","loadNotificationChannel","notificationChannelLoaded","NoRulesSplash","canCreateGrafanaRules","canCreateCloudRules","useRulesAccess","EmptyListCTA","buttonIcon","buttonLink","buttonTitle","proTip","proTipLink","proTipLinkTitle","proTipTarget","CallToActionCard","message","callToActionElement","RuleListErrors","expanded","setExpanded","useState","closed","setClosed","dataSourceConfigRequests","useUnifiedAlertingSelector","dataSources","promRuleRequests","promRules","rulerRuleRequests","rulerRules","styles","useStyles2","getStyles","errors","useMemo","dataSourceConfigErrors","promRequestErrors","rulerRequestErrors","requests","getRulesDataSources","reduce","result","dataSource","isRulerNotSupportedResponse","grafanaPromError","GRAFANA_RULES_SOURCE_NAME","grafanaRulerError","push","forEach","uid","length","ErrorSummaryButton","count","idx","moreButton","fill","pluralize","floatRight","Tooltip","content","placement","theme","css","EditCloudGroupModal","namespace","group","onClose","loading","dispatched","updateLotexNamespaceAndGroup","initialAsyncRequestState","defaultValues","namespaceName","groupName","groupInterval","interval","unifiedAlerting","modal","Form","onSubmit","values","updateLotexNamespaceAndGroupAction","rulesSourceName","getRulesSourceName","rulesSource","newGroupName","newNamespaceName","undefined","register","formState","isDirty","Field","invalid","Input","required","pattern","durationValidationPattern","type","disabled","JSON","stringify","StateColoredText","children","status","PromAlertingRuleState","colors","success","warning","neutral","secondary","emptyStats","total","recording","RuleStats","showInactive","showRecording","namespaces","calculated","stats","calcRule","promRule","isAlertingRule","health","isRecordingRule","rulerRule","isRecordingRulerRule","groups","statsComponents","prev","curr","Fragment","RulesGroup","React","expandAll","isEditingGroup","setIsEditingGroup","isDeletingGroup","setIsDeletingGroup","isCollapsed","setIsCollapsed","canEditRules","hasRuler","useHasRuler","folderUID","isGrafanaRulerRule","grafana_alert","namespace_uid","folder","useFolder","isDeleting","find","isFederated","isFederatedRuleGroup","actionIcons","HorizontalGroup","Spinner","baseUrl","kbn","canSave","ActionIcon","A","tooltip","to","target","canAdmin","RuleLocation","wrapper","header","CollapseToggle","collapseToggle","onToggle","isCloudRulesSource","meta","dataSourceIcon","logos","small","heading","Badge","color","spacer","headerStats","actionsSeparator","RulesTable","showSummaryColumn","rulesTable","showGuidelines","ConfirmModal","body","onConfirm","deleteRulesGroupAction","confirmText","displayName","background","breakpoints","down","dataSourceOrigin","CloudRules","useStyles","rulesDataSources","dataSourcesLoading","ds","sectionHeader","LoadingPlaceholder","loader","xl","GrafanaRules","useQueryParams","namespacesFormat","flattenGrafanaManagedRules","RuleListStateSection","defaultCollapsed","collapsed","setCollapsed","alertStateToReadable","showGroupColumn","ViewOptions","RuleTypeOptions","PromRuleType","container","sm","inputWidth","flexRow","spaceBetween","rowChild","clearButton","setQueryParams","filterKey","setFilterKey","Math","floor","random","dataSourceKey","queryStringKey","alertState","queryString","ruleType","getFiltersFromUrlParams","stateOptions","Object","entries","key","handleQueryStringChange","debounce","e","searchIcon","DataSourcePicker","alerting","noDefault","dataSourceValue","onClear","cx","Label","Stack","gap","prefix","defaultValue","RadioButtonGroup","String","view","fullWidth","setTimeout","reduceNamespaces","filters","namespaceAcc","reduceGroups","groupAcc","isQueryingDataSource","normalizedQueryString","toLocaleLowerCase","doesNameContainsQueryString","includes","matchers","parseMatchers","doRuleLabelsMatchQuery","labelsMatchMatchers","labels","doAlertsContainMatchingLabels","alerts","some","alert","query","datasourceUid","getDataSourceSrv","getInstanceSettings","VIEWS","grafanaNamespaces","cloudNamespaces","sorted","a","b","localeCompare","ns","isGrafanaRulesSource","Authorize","actions","AccessControlAction","groupedRules","RuleList","withErrorBoundary","rulesDataSourceNames","getAllRulesSourceNames","location","useLocation","setExpandAll","filtersActive","ViewComponent","fetchAllPromAndRulerRulesAction","setInterval","RULE_LIST_POLL_INTERVAL_MS","clearInterval","haveResults","keys","showNewAlertSplash","filteredNamespaces","useFilteredRules","useCombinedRuleNamespaces","AlertingPageWrapper","pageId","break","buttonsContainer","statsContainer","expandAllButton","urlUtil","returnTo","pathname","style","border","medium","useSelector","fallback","action","contextSrv","DynamicTableWithGuidelines","renderExpandedContent","index","contentGuideline","guideline","renderPrefixHeader","relative","headerGuideline","renderPrefixCell","_","topGuideline","bottomGuideline","tooltipPlacement","rest","ariaLabel","RuleDetails","annotations","trim","RuleDetailsActionButtons","leftSide","DetailsField","horizontal","AlertLabels","RuleDetailsExpression","RuleDetailsAnnotations","rightSide","RuleDetailsDataSources","RuleDetailsMatchingInstances","up","emptyMessage","wrapperClass","wrapperMargin","seenKeys","ruleIdx","columns","renderCell","isCreating","RuleState","RuleHealth","Annotation","useColumns","TableComponent","DynamicTable","cols","isExpandable","shape","borderRadius","getRulesAccess"],"sourceRoot":""}