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O,UAAEiL,EAAYxE,UAAd,aAAE,EAA8BzG","sources":["webpack://grafana/./public/app/features/alerting/unified/Analytics.ts","webpack://grafana/./public/app/features/alerting/unified/components/Provisioning.tsx","webpack://grafana/./public/app/features/alerting/unified/components/alert-groups/MatcherFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/StateHistory.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useManagedAlertStateHistory.ts","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useStateHistoryModal.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleDetailsAnnotations.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx","webpack://grafana/./public/app/features/alerting/unified/components/Expression.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleDetailsExpression.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/AlertInstanceStateFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleDetailsMatchingInstances.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleHealth.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/RuleState.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useCombinedRuleNamespaces.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useFolder.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useIsRuleEditable.ts"],"sourcesContent":["export const LogMessages = {\n filterByLabel: 'filtering alert instances by label',\n loadedList: 'loaded Alert Rules list',\n leavingRuleGroupEdit: 'leaving rule group edit without saving',\n};\n","import React from 'react';\n\nimport { Alert, Badge } from '@grafana/ui';\n\nexport enum ProvisionedResource {\n ContactPoint = 'contact point',\n Template = 'template',\n MuteTiming = 'mute timing',\n AlertRule = 'alert rule',\n RootNotificationPolicy = 'root notification policy',\n}\n\ninterface ProvisioningAlertProps {\n resource: ProvisionedResource;\n}\n\nexport const ProvisioningAlert = ({ resource }: ProvisioningAlertProps) => {\n return (\n \n This {resource} has been provisioned, that means it was created by config. Please contact your server admin to\n update this {resource}.\n \n );\n};\n\nexport const ProvisioningBadge = () => {\n return ;\n};\n","import { css } from '@emotion/css';\nimport { debounce } from 'lodash';\nimport React, { FormEvent } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { logInfo } from '@grafana/runtime';\nimport { Label, Tooltip, Input, Icon, useStyles2, Stack } from '@grafana/ui';\n\nimport { LogMessages } from '../../Analytics';\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 = debounce((e: FormEvent) => {\n logInfo(LogMessages.filterByLabel);\n\n const target = e.target as HTMLInputElement;\n onFilterChange(target.value);\n }, 600);\n const searchIcon = ;\n return (\n
\n
\n }\n >\n \n \n \n \n \n \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 { css } from '@emotion/css';\nimport { groupBy } from 'lodash';\nimport React, { FC, FormEvent, useCallback, useState } from 'react';\n\nimport { AlertState, dateTimeFormat, GrafanaTheme2 } from '@grafana/data';\nimport { Alert, Field, Icon, Input, Label, LoadingPlaceholder, Stack, Tooltip, useStyles2 } from '@grafana/ui';\nimport { StateHistoryItem, StateHistoryItemData } from 'app/types/unified-alerting';\nimport { GrafanaAlertStateWithReason, PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\nimport { useManagedAlertStateHistory } from '../../hooks/useManagedAlertStateHistory';\nimport { AlertLabel } from '../AlertLabel';\nimport { DynamicTable, DynamicTableColumnProps, DynamicTableItemProps } from '../DynamicTable';\n\nimport { AlertStateTag } from './AlertStateTag';\n\ntype StateHistoryRowItem = {\n id: string;\n state: PromAlertingRuleState | GrafanaAlertStateWithReason | AlertState;\n text?: string;\n data?: StateHistoryItemData;\n timestamp?: number;\n stringifiedLabels: string;\n};\n\ntype StateHistoryMap = Record;\n\ntype StateHistoryRow = DynamicTableItemProps;\n\ninterface RuleStateHistoryProps {\n alertId: string;\n}\n\nconst StateHistory: FC = ({ alertId }) => {\n const [textFilter, setTextFilter] = useState('');\n const handleTextFilter = useCallback((event: FormEvent) => {\n setTextFilter(event.currentTarget.value);\n }, []);\n\n const { loading, error, result = [] } = useManagedAlertStateHistory(alertId);\n\n const styles = useStyles2(getStyles);\n\n if (loading && !error) {\n return ;\n }\n\n if (error && !loading) {\n return {error.message};\n }\n\n const columns: Array> = [\n { id: 'state', label: 'State', size: 'max-content', renderCell: renderStateCell },\n { id: 'value', label: '', size: 'auto', renderCell: renderValueCell },\n { id: 'timestamp', label: 'Time', size: 'max-content', renderCell: renderTimestampCell },\n ];\n\n // group the state history list by unique set of labels\n const tables = Object.entries(groupStateByLabels(result))\n // sort and filter each table\n .sort()\n .filter(([groupKey]) => matchKey(groupKey, textFilter))\n .map(([groupKey, items]) => {\n const tableItems: StateHistoryRow[] = items.map((historyItem) => ({\n id: historyItem.id,\n data: historyItem,\n }));\n\n return (\n
\n
\n {groupKey}\n
\n \n
\n );\n });\n\n return (\n
\n
\n }\n >\n \n \n \n \n }\n >\n } onChange={handleTextFilter} placeholder=\"Search\" />\n \n \n {tables}\n \n );\n};\n\n// group state history by labels\nexport function groupStateByLabels(\n history: Array>\n): StateHistoryMap {\n const items: StateHistoryRowItem[] = history.map((item) => {\n // let's grab the last matching set of `{}` since the alert name could also contain { or }\n const LABELS_REGEX = /{.*?}/g;\n const stringifiedLabels = item.text.match(LABELS_REGEX)?.at(-1) ?? '';\n\n return {\n id: String(item.id),\n state: item.newState,\n // let's omit the labels for each entry since it's just added noise to each state history item\n text: item.text.replace(stringifiedLabels, ''),\n data: item.data,\n timestamp: item.updated,\n stringifiedLabels,\n };\n });\n\n // we have to group our state history items by their unique combination of tags since we want to display a DynamicTable for each alert instance\n // (effectively unique combination of labels)\n return groupBy(items, (item) => item.stringifiedLabels);\n}\n\n// match a string either by exact text match or with regular expression when in the form of \"//\"\nexport function matchKey(groupKey: string, textFilter: string) {\n // if the text filter is empty we show all matches\n if (textFilter === '') {\n return true;\n }\n\n const isRegExp = textFilter.startsWith('/') && textFilter.endsWith('/');\n\n // not a regular expression, use normal text matching\n if (!isRegExp) {\n return groupKey.includes(textFilter);\n }\n\n // regular expression, try parsing and applying\n // when we fail to parse the text as a regular expression, we return no match\n try {\n return new RegExp(textFilter.slice(1, -1)).test(groupKey);\n } catch (err) {\n return false;\n }\n}\n\nfunction renderValueCell(item: StateHistoryRow) {\n const matches = item.data.data?.evalMatches ?? [];\n\n return (\n <>\n {item.data.text}\n \n {matches.map((match) => (\n \n ))}\n \n \n );\n}\n\nfunction renderStateCell(item: StateHistoryRow) {\n return ;\n}\n\nfunction renderTimestampCell(item: StateHistoryRow) {\n return (\n
{item.data.timestamp && {dateTimeFormat(item.data.timestamp)}}
\n );\n}\n\nconst LabelsWrapper: FC<{}> = ({ children }) => {\n const { wrapper } = useStyles2(getStyles);\n return
{children}
;\n};\n\nconst TimestampStyle = css`\n display: flex;\n align-items: flex-end;\n flex-direction: column;\n`;\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css`\n & > * {\n margin-right: ${theme.spacing(1)};\n }\n `,\n tableGroupKey: css`\n margin-top: ${theme.spacing(2)};\n margin-bottom: ${theme.spacing(2)};\n `,\n});\n\nexport { StateHistory };\n","import { useEffect } from 'react';\n\nimport { useDispatch } from 'app/types';\nimport { StateHistoryItem } from 'app/types/unified-alerting';\n\nimport { fetchGrafanaAnnotationsAction } from '../state/actions';\nimport { AsyncRequestState } from '../utils/redux';\n\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\nexport function useManagedAlertStateHistory(alertId: string) {\n const dispatch = useDispatch();\n const history = useUnifiedAlertingSelector>(\n (state) => state.managedAlertStateHistory\n );\n\n useEffect(() => {\n dispatch(fetchGrafanaAnnotationsAction(alertId));\n }, [dispatch, alertId]);\n\n return history;\n}\n","import { css } from '@emotion/css';\nimport React, { FC, Fragment, useState } from 'react';\nimport { useLocation } from 'react-router-dom';\n\nimport { GrafanaTheme2, urlUtil } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { Button, ClipboardButton, ConfirmModal, HorizontalGroup, LinkButton, useStyles2 } from '@grafana/ui';\nimport { useAppNotification } from 'app/core/copy/appNotification';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AccessControlAction, useDispatch } from 'app/types';\nimport { CombinedRule, RulesSource } from 'app/types/unified-alerting';\n\nimport { useIsRuleEditable } from '../../hooks/useIsRuleEditable';\nimport { useStateHistoryModal } from '../../hooks/useStateHistoryModal';\nimport { deleteRuleAction } from '../../state/actions';\nimport { getAlertmanagerByUid } from '../../utils/alertmanager';\nimport { Annotation } from '../../utils/constants';\nimport { getRulesSourceName, isCloudRulesSource, isGrafanaRulesSource } from '../../utils/datasource';\nimport { createExploreLink, createViewLink, makeRuleBasedSilenceLink } from '../../utils/misc';\nimport * as ruleId from '../../utils/rule-id';\nimport { isFederatedRuleGroup, isGrafanaRulerRule } from '../../utils/rules';\n\ninterface Props {\n rule: CombinedRule;\n rulesSource: RulesSource;\n}\n\nexport const RuleDetailsActionButtons: FC = ({ rule, rulesSource }) => {\n const dispatch = useDispatch();\n const location = useLocation();\n const notifyApp = useAppNotification();\n const style = useStyles2(getStyles);\n const { namespace, group, rulerRule } = rule;\n const [ruleToDelete, setRuleToDelete] = useState();\n const alertId = isGrafanaRulerRule(rule.rulerRule) ? rule.rulerRule.grafana_alert.id ?? '' : '';\n const { StateHistoryModal, showStateHistoryModal } = useStateHistoryModal(alertId);\n\n const alertmanagerSourceName = isGrafanaRulesSource(rulesSource)\n ? rulesSource\n : getAlertmanagerByUid(rulesSource.jsonData.alertmanagerUid)?.name;\n const rulesSourceName = getRulesSourceName(rulesSource);\n\n const hasExplorePermission = contextSrv.hasPermission(AccessControlAction.DataSourcesExplore);\n const isProvisioned = isGrafanaRulerRule(rule.rulerRule) && Boolean(rule.rulerRule.grafana_alert.provenance);\n\n const leftButtons: JSX.Element[] = [];\n const rightButtons: JSX.Element[] = [];\n\n const isFederated = isFederatedRuleGroup(group);\n const { isEditable, isRemovable } = useIsRuleEditable(rulesSourceName, rulerRule);\n const returnTo = location.pathname + location.search;\n const isViewMode = inViewMode(location.pathname);\n\n const deleteRule = () => {\n if (ruleToDelete && ruleToDelete.rulerRule) {\n const identifier = ruleId.fromRulerRule(\n getRulesSourceName(ruleToDelete.namespace.rulesSource),\n ruleToDelete.namespace.name,\n ruleToDelete.group.name,\n ruleToDelete.rulerRule\n );\n\n dispatch(deleteRuleAction(identifier, { navigateTo: isViewMode ? '/alerting/list' : undefined }));\n setRuleToDelete(undefined);\n }\n };\n\n const buildShareUrl = () => {\n if (isCloudRulesSource(rulesSource)) {\n const { appUrl, appSubUrl } = config;\n const baseUrl = appSubUrl !== '' ? `${appUrl}${appSubUrl}/` : config.appUrl;\n const ruleUrl = `${encodeURIComponent(rulesSource.name)}/${encodeURIComponent(rule.name)}`;\n return `${baseUrl}alerting/${ruleUrl}/find`;\n }\n\n return window.location.href.split('?')[0];\n };\n\n // explore does not support grafana rule queries atm\n // neither do \"federated rules\"\n if (isCloudRulesSource(rulesSource) && hasExplorePermission && !isFederated) {\n leftButtons.push(\n \n See graph\n \n );\n }\n if (rule.annotations[Annotation.runbookURL]) {\n leftButtons.push(\n \n View runbook\n \n );\n }\n if (rule.annotations[Annotation.dashboardUID]) {\n const dashboardUID = rule.annotations[Annotation.dashboardUID];\n if (dashboardUID) {\n leftButtons.push(\n \n Go to dashboard\n \n );\n const panelId = rule.annotations[Annotation.panelID];\n if (panelId) {\n leftButtons.push(\n \n Go to panel\n \n );\n }\n }\n }\n\n if (alertmanagerSourceName && contextSrv.hasAccess(AccessControlAction.AlertingInstanceCreate, contextSrv.isEditor)) {\n leftButtons.push(\n \n Silence\n \n );\n }\n\n if (alertId) {\n leftButtons.push(\n \n \n {StateHistoryModal}\n \n );\n }\n\n if (!isViewMode) {\n rightButtons.push(\n \n View\n \n );\n }\n\n if (isEditable && rulerRule && !isFederated && !isProvisioned) {\n const sourceName = getRulesSourceName(rulesSource);\n const identifier = ruleId.fromRulerRule(sourceName, namespace.name, group.name, rulerRule);\n\n const editURL = urlUtil.renderUrl(\n `${config.appSubUrl}/alerting/${encodeURIComponent(ruleId.stringifyIdentifier(identifier))}/edit`,\n {\n returnTo,\n }\n );\n\n if (isViewMode) {\n rightButtons.push(\n {\n notifyApp.error('Error while copying URL', copiedText);\n }}\n className={style.button}\n size=\"sm\"\n getText={buildShareUrl}\n >\n Copy link to rule\n \n );\n }\n\n rightButtons.push(\n \n Edit\n \n );\n }\n\n if (isRemovable && rulerRule && !isFederated && !isProvisioned) {\n rightButtons.push(\n setRuleToDelete(rule)}\n >\n Delete\n \n );\n }\n\n if (leftButtons.length || rightButtons.length) {\n return (\n <>\n
\n {leftButtons.length ? leftButtons :
}\n {rightButtons.length ? rightButtons :
}\n
\n {!!ruleToDelete && (\n setRuleToDelete(undefined)}\n />\n )}\n \n );\n }\n\n return null;\n};\n\nfunction inViewMode(pathname: string): boolean {\n return pathname.endsWith('/view');\n}\n\nexport const getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css`\n padding: ${theme.spacing(2)} 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n flex-wrap: wrap;\n border-bottom: solid 1px ${theme.colors.border.medium};\n `,\n button: css`\n height: 24px;\n margin-top: ${theme.spacing(1)};\n font-size: ${theme.typography.size.sm};\n `,\n});\n","import React, { useMemo, useState } from 'react';\n\nimport { Modal } from '@grafana/ui';\n\nimport { StateHistory } from '../components/rules/StateHistory';\n\nfunction useStateHistoryModal(alertId: string) {\n const [showModal, setShowModal] = useState(false);\n\n const StateHistoryModal = useMemo(\n () => (\n setShowModal(false)}\n closeOnBackdropClick={true}\n closeOnEscape={true}\n title=\"State history\"\n >\n \n \n ),\n [alertId, showModal]\n );\n\n return {\n StateHistoryModal,\n showStateHistoryModal: () => setShowModal(true),\n hideStateHistoryModal: () => setShowModal(false),\n };\n}\n\nexport { useStateHistoryModal };\n","import { css } from '@emotion/css';\nimport React from 'react';\n\nimport { useStyles2 } from '@grafana/ui';\n\nimport { AnnotationDetailsField } from '../AnnotationDetailsField';\n\ntype Props = {\n annotations: Array<[string, string]>;\n};\n\nexport function RuleDetailsAnnotations(props: Props): JSX.Element | null {\n const { annotations } = props;\n const styles = useStyles2(getStyles);\n\n if (annotations.length === 0) {\n return null;\n }\n\n return (\n
\n {annotations.map(([key, value]) => (\n \n ))}\n
\n );\n}\n\nconst getStyles = () => ({\n annotations: css`\n margin-top: 46px;\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { useMemo } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { getDataSourceSrv } from '@grafana/runtime';\nimport { useStyles2 } from '@grafana/ui';\nimport { ExpressionDatasourceUID } from 'app/features/expressions/ExpressionDatasource';\nimport { CombinedRule, RulesSource } from 'app/types/unified-alerting';\n\nimport { isCloudRulesSource } from '../../utils/datasource';\nimport { isGrafanaRulerRule } from '../../utils/rules';\nimport { DetailsField } from '../DetailsField';\n\ntype Props = {\n rule: CombinedRule;\n rulesSource: RulesSource;\n};\n\nexport function RuleDetailsDataSources(props: Props): JSX.Element | null {\n const { rulesSource, rule } = props;\n const styles = useStyles2(getStyles);\n\n const dataSources: Array<{ name: string; icon?: string }> = useMemo(() => {\n if (isCloudRulesSource(rulesSource)) {\n return [{ name: rulesSource.name, icon: rulesSource.meta.info.logos.small }];\n }\n\n if (isGrafanaRulerRule(rule.rulerRule)) {\n const { data } = rule.rulerRule.grafana_alert;\n const unique = data.reduce((dataSources, query) => {\n const ds = getDataSourceSrv().getInstanceSettings(query.datasourceUid);\n\n if (!ds || ds.uid === ExpressionDatasourceUID) {\n return dataSources;\n }\n\n dataSources[ds.name] = { name: ds.name, icon: ds.meta.info.logos.small };\n return dataSources;\n }, {} as Record);\n\n return Object.values(unique);\n }\n\n return [];\n }, [rule, rulesSource]);\n\n if (dataSources.length === 0) {\n return null;\n }\n\n return (\n \n {dataSources.map(({ name, icon }, index) => (\n
\n {icon && (\n <>\n {`${name}{' '}\n \n )}\n {name}\n
\n ))}\n
\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n const size = theme.spacing(2);\n\n return {\n dataSourceIcon: css`\n width: ${size};\n height: ${size};\n `,\n };\n}\n","import { css, cx } from '@emotion/css';\nimport { LanguageMap, languages as prismLanguages } from 'prismjs';\nimport React, { FC, useMemo } from 'react';\nimport { Editor } from 'slate-react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { makeValue, SlatePrism, useStyles } from '@grafana/ui';\nimport LogqlSyntax from 'app/plugins/datasource/loki/syntax';\nimport PromqlSyntax from 'app/plugins/datasource/prometheus/promql';\nimport { RulesSource } from 'app/types/unified-alerting';\n\nimport { DataSourceType, isCloudRulesSource } from '../utils/datasource';\n\nimport { Well } from './Well';\n\ninterface Props {\n expression: string;\n rulesSource: RulesSource;\n}\n\nexport const HighlightedQuery: FC<{ language: 'promql' | 'logql'; expr: string }> = ({ language, expr }) => {\n const plugins = useMemo(\n () => [\n SlatePrism(\n {\n onlyIn: (node: any) => node.type === 'code_block',\n getSyntax: () => language,\n },\n { ...(prismLanguages as LanguageMap), [language]: language === 'logql' ? LogqlSyntax : PromqlSyntax }\n ),\n ],\n [language]\n );\n\n const slateValue = useMemo(() => makeValue(expr), [expr]);\n\n return ;\n};\n\nexport const Expression: FC = ({ expression: query, rulesSource }) => {\n const styles = useStyles(getStyles);\n\n return (\n \n {isCloudRulesSource(rulesSource) ? (\n \n ) : (\n query\n )}\n \n );\n};\n\nexport const getStyles = (theme: GrafanaTheme) => ({\n well: css`\n font-family: ${theme.typography.fontFamily.monospace};\n `,\n});\n","import { css, cx } from '@emotion/css';\nimport React from 'react';\n\nimport { CombinedRule, RulesSource } from 'app/types/unified-alerting';\n\nimport { isCloudRulesSource } from '../../utils/datasource';\nimport { DetailsField } from '../DetailsField';\nimport { Expression } from '../Expression';\n\ntype Props = {\n rule: CombinedRule;\n rulesSource: RulesSource;\n annotations: Array<[string, string]>;\n};\n\nexport function RuleDetailsExpression(props: Props): JSX.Element | null {\n const { annotations, rulesSource, rule } = props;\n const styles = getStyles();\n\n if (!isCloudRulesSource(rulesSource)) {\n return null;\n }\n\n return (\n \n \n \n );\n}\n\nconst getStyles = () => ({\n exprRow: css`\n margin-bottom: 46px;\n `,\n});\n","import { css } from '@emotion/css';\nimport { capitalize } from 'lodash';\nimport React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data/src';\nimport { Label, RadioButtonGroup, Tag, useStyles2 } from '@grafana/ui';\nimport { GrafanaAlertState, PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\nexport type InstanceStateFilter = GrafanaAlertState | PromAlertingRuleState.Pending | PromAlertingRuleState.Firing;\n\ninterface Props {\n className?: string;\n filterType: 'grafana' | 'prometheus';\n stateFilter?: InstanceStateFilter;\n onStateFilterChange: (value?: InstanceStateFilter) => void;\n itemPerStateStats?: Record;\n}\n\nexport const AlertInstanceStateFilter = ({\n className,\n onStateFilterChange,\n stateFilter,\n filterType,\n itemPerStateStats,\n}: Props) => {\n const styles = useStyles2(getStyles);\n\n const getOptionComponent = (state: InstanceStateFilter) => {\n return function InstanceStateCounter() {\n return itemPerStateStats && itemPerStateStats[state] ? (\n \n ) : null;\n };\n };\n\n const grafanaOptions = Object.values(GrafanaAlertState).map((state) => ({\n label: state,\n value: state,\n component: getOptionComponent(state),\n }));\n\n const promOptionValues = [PromAlertingRuleState.Firing, PromAlertingRuleState.Pending] as const;\n const promOptions = promOptionValues.map((state) => ({\n label: capitalize(state),\n value: state,\n component: getOptionComponent(state),\n }));\n\n const stateOptions = filterType === 'grafana' ? grafanaOptions : promOptions;\n\n return (\n
\n \n {\n if (v === stateFilter) {\n onStateFilterChange(undefined);\n }\n }}\n />\n
\n );\n};\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n tag: css`\n font-size: 11px;\n font-weight: normal;\n padding: ${theme.spacing(0.25, 0.5)};\n vertical-align: middle;\n margin-left: ${theme.spacing(0.5)};\n `,\n };\n}\n","import { css, cx } from '@emotion/css';\nimport { countBy } from 'lodash';\nimport React, { useMemo, useState } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { LinkButton, useStyles } from '@grafana/ui';\nimport { MatcherFilter } from 'app/features/alerting/unified/components/alert-groups/MatcherFilter';\nimport {\n AlertInstanceStateFilter,\n InstanceStateFilter,\n} from 'app/features/alerting/unified/components/rules/AlertInstanceStateFilter';\nimport { labelsMatchMatchers, parseMatchers } from 'app/features/alerting/unified/utils/alertmanager';\nimport { createViewLink, sortAlerts } from 'app/features/alerting/unified/utils/misc';\nimport { SortOrder } from 'app/plugins/panel/alertlist/types';\nimport { Alert, CombinedRule, PaginationProps } from 'app/types/unified-alerting';\nimport { mapStateWithReasonToBaseState } from 'app/types/unified-alerting-dto';\n\nimport { GRAFANA_RULES_SOURCE_NAME, isGrafanaRulesSource } from '../../utils/datasource';\nimport { isAlertingRule } from '../../utils/rules';\nimport { DetailsField } from '../DetailsField';\n\nimport { AlertInstancesTable } from './AlertInstancesTable';\n\ninterface Props {\n rule: CombinedRule;\n pagination?: PaginationProps;\n itemsDisplayLimit?: number;\n}\n\ninterface ShowMoreStats {\n totalItemsCount: number;\n visibleItemsCount: number;\n}\n\nfunction ShowMoreInstances(props: { ruleViewPageLink: string; stats: ShowMoreStats }) {\n const styles = useStyles(getStyles);\n const { ruleViewPageLink, stats } = props;\n\n return (\n
\n
\n Showing {stats.visibleItemsCount} out of {stats.totalItemsCount} instances\n
\n {ruleViewPageLink && (\n \n Show all {stats.totalItemsCount} alert instances\n \n )}\n
\n );\n}\n\nexport function RuleDetailsMatchingInstances(props: Props): JSX.Element | null {\n const {\n rule: { promRule, namespace },\n itemsDisplayLimit = Number.POSITIVE_INFINITY,\n pagination,\n } = props;\n\n const [queryString, setQueryString] = useState();\n const [alertState, setAlertState] = useState();\n\n // This key is used to force a rerender on the inputs when the filters are cleared\n const [filterKey] = useState(Math.floor(Math.random() * 100));\n const queryStringKey = `queryString-${filterKey}`;\n\n const styles = useStyles(getStyles);\n\n const stateFilterType = isGrafanaRulesSource(namespace.rulesSource) ? GRAFANA_RULES_SOURCE_NAME : 'prometheus';\n\n const alerts = useMemo(\n (): Alert[] =>\n isAlertingRule(promRule) && promRule.alerts?.length\n ? filterAlerts(queryString, alertState, sortAlerts(SortOrder.Importance, promRule.alerts))\n : [],\n [promRule, alertState, queryString]\n );\n\n if (!isAlertingRule(promRule)) {\n return null;\n }\n\n const visibleInstances = alerts.slice(0, itemsDisplayLimit);\n\n const countAllByState = countBy(promRule.alerts, (alert) => mapStateWithReasonToBaseState(alert.state));\n const hiddenItemsCount = alerts.length - visibleInstances.length;\n\n const stats: ShowMoreStats = {\n totalItemsCount: alerts.length,\n visibleItemsCount: visibleInstances.length,\n };\n\n const ruleViewPageLink = createViewLink(namespace.rulesSource, props.rule, location.pathname + location.search);\n\n const footerRow = hiddenItemsCount ? (\n \n ) : undefined;\n\n return (\n \n
\n
\n setQueryString(value)}\n />\n \n
\n
\n\n \n
\n );\n}\n\nfunction filterAlerts(\n alertInstanceLabel: string | undefined,\n alertInstanceState: InstanceStateFilter | undefined,\n alerts: Alert[]\n): Alert[] {\n let filteredAlerts = [...alerts];\n if (alertInstanceLabel) {\n const matchers = parseMatchers(alertInstanceLabel || '');\n filteredAlerts = filteredAlerts.filter(({ labels }) => labelsMatchMatchers(labels, matchers));\n }\n if (alertInstanceState) {\n filteredAlerts = filteredAlerts.filter((alert) => {\n return mapStateWithReasonToBaseState(alert.state) === alertInstanceState;\n });\n }\n\n return filteredAlerts;\n}\n\nconst getStyles = (theme: GrafanaTheme) => {\n return {\n flexRow: css`\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n width: 100%;\n flex-wrap: wrap;\n margin-bottom: ${theme.spacing.sm};\n `,\n spaceBetween: css`\n justify-content: space-between;\n `,\n rowChild: css`\n margin-right: ${theme.spacing.sm};\n `,\n footerRow: css`\n display: flex;\n flex-direction: column;\n gap: ${theme.spacing.sm};\n justify-content: space-between;\n align-items: center;\n width: 100%;\n `,\n };\n};\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Icon, Tooltip, useStyles2 } from '@grafana/ui';\nimport { Rule } from 'app/types/unified-alerting';\n\ninterface Prom {\n rule: Rule;\n}\n\nexport const RuleHealth: FC = ({ rule }) => {\n const style = useStyles2(getStyle);\n\n if (rule.health === 'err' || rule.health === 'error') {\n return (\n \n
\n \n error\n
\n
\n );\n }\n\n return <>{rule.health};\n};\n\nconst getStyle = (theme: GrafanaTheme2) => ({\n warn: css`\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n gap: ${theme.spacing(1)};\n\n color: ${theme.colors.warning.text};\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC, useMemo } from 'react';\n\nimport { GrafanaTheme2, intervalToAbbreviatedDurationString } from '@grafana/data';\nimport { HorizontalGroup, Spinner, useStyles2 } from '@grafana/ui';\nimport { CombinedRule } from 'app/types/unified-alerting';\nimport { PromAlertingRuleState } from 'app/types/unified-alerting-dto';\n\nimport { isAlertingRule, isRecordingRule, getFirstActiveAt } from '../../utils/rules';\n\nimport { AlertStateTag } from './AlertStateTag';\n\ninterface Props {\n rule: CombinedRule;\n isDeleting: boolean;\n isCreating: boolean;\n}\n\nexport const RuleState: FC = ({ rule, isDeleting, isCreating }) => {\n const style = useStyles2(getStyle);\n const { promRule } = rule;\n\n // return how long the rule has been in its firing state, if any\n const forTime = useMemo(() => {\n if (\n promRule &&\n isAlertingRule(promRule) &&\n promRule.alerts?.length &&\n promRule.state !== PromAlertingRuleState.Inactive\n ) {\n // find earliest alert\n const firstActiveAt = getFirstActiveAt(promRule);\n\n // calculate time elapsed from earliest alert\n if (firstActiveAt) {\n return (\n \n for{' '}\n {intervalToAbbreviatedDurationString(\n {\n start: firstActiveAt,\n end: new Date(),\n },\n false\n )}\n \n );\n }\n }\n return null;\n }, [promRule, style]);\n\n if (isDeleting) {\n return (\n \n \n deleting\n \n );\n } else if (isCreating) {\n return (\n \n {' '}\n \n creating\n \n );\n } else if (promRule && isAlertingRule(promRule)) {\n return (\n \n \n {forTime}\n \n );\n } else if (promRule && isRecordingRule(promRule)) {\n return <>Recording rule;\n }\n return <>n/a;\n};\n\nconst getStyle = (theme: GrafanaTheme2) => ({\n for: css`\n font-size: ${theme.typography.bodySmall.fontSize};\n color: ${theme.colors.text.secondary};\n white-space: nowrap;\n padding-top: 2px;\n `,\n});\n","import { useMemo, useRef } from 'react';\n\nimport {\n CombinedRule,\n CombinedRuleGroup,\n CombinedRuleNamespace,\n Rule,\n RuleGroup,\n RuleNamespace,\n RulesSource,\n} from 'app/types/unified-alerting';\nimport { RulerRuleDTO, RulerRuleGroupDTO, RulerRulesConfigDTO } from 'app/types/unified-alerting-dto';\n\nimport {\n getAllRulesSources,\n getRulesSourceByName,\n isCloudRulesSource,\n isGrafanaRulesSource,\n} from '../utils/datasource';\nimport { isAlertingRule, isAlertingRulerRule, isRecordingRulerRule } from '../utils/rules';\n\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\ninterface CacheValue {\n promRules?: RuleNamespace[];\n rulerRules?: RulerRulesConfigDTO | null;\n result: CombinedRuleNamespace[];\n}\n\n// this little monster combines prometheus rules and ruler rules to produce a unified data structure\n// can limit to a single rules source\nexport function useCombinedRuleNamespaces(rulesSourceName?: string): CombinedRuleNamespace[] {\n const promRulesResponses = useUnifiedAlertingSelector((state) => state.promRules);\n const rulerRulesResponses = useUnifiedAlertingSelector((state) => state.rulerRules);\n\n // cache results per rules source, so we only recalculate those for which results have actually changed\n const cache = useRef>({});\n\n const rulesSources = useMemo((): RulesSource[] => {\n if (rulesSourceName) {\n const rulesSource = getRulesSourceByName(rulesSourceName);\n if (!rulesSource) {\n throw new Error(`Unknown rules source: ${rulesSourceName}`);\n }\n return [rulesSource];\n }\n return getAllRulesSources();\n }, [rulesSourceName]);\n\n return useMemo(\n () =>\n rulesSources\n .map((rulesSource): CombinedRuleNamespace[] => {\n const rulesSourceName = isCloudRulesSource(rulesSource) ? rulesSource.name : rulesSource;\n const promRules = promRulesResponses[rulesSourceName]?.result;\n const rulerRules = rulerRulesResponses[rulesSourceName]?.result;\n\n const cached = cache.current[rulesSourceName];\n if (cached && cached.promRules === promRules && cached.rulerRules === rulerRules) {\n return cached.result;\n }\n const namespaces: Record = {};\n\n // first get all the ruler rules in\n Object.entries(rulerRules || {}).forEach(([namespaceName, groups]) => {\n const namespace: CombinedRuleNamespace = {\n rulesSource,\n name: namespaceName,\n groups: [],\n };\n namespaces[namespaceName] = namespace;\n addRulerGroupsToCombinedNamespace(namespace, groups);\n });\n\n // then correlate with prometheus rules\n promRules?.forEach(({ name: namespaceName, groups }) => {\n const ns = (namespaces[namespaceName] = namespaces[namespaceName] || {\n rulesSource,\n name: namespaceName,\n groups: [],\n });\n\n addPromGroupsToCombinedNamespace(ns, groups);\n });\n\n const result = Object.values(namespaces);\n\n cache.current[rulesSourceName] = { promRules, rulerRules, result };\n return result;\n })\n .flat(),\n [promRulesResponses, rulerRulesResponses, rulesSources]\n );\n}\n\n// merge all groups in case of grafana managed, essentially treating namespaces (folders) as groups\nexport function flattenGrafanaManagedRules(namespaces: CombinedRuleNamespace[]) {\n return namespaces.map((namespace) => {\n const newNamespace: CombinedRuleNamespace = {\n ...namespace,\n groups: [],\n };\n\n // add default group with ungrouped rules\n newNamespace.groups.push({\n name: 'default',\n rules: sortRulesByName(namespace.groups.flatMap((group) => group.rules)),\n });\n\n return newNamespace;\n });\n}\n\nexport function sortRulesByName(rules: CombinedRule[]) {\n return rules.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nfunction addRulerGroupsToCombinedNamespace(namespace: CombinedRuleNamespace, groups: RulerRuleGroupDTO[] = []): void {\n namespace.groups = groups.map((group) => {\n const combinedGroup: CombinedRuleGroup = {\n name: group.name,\n interval: group.interval,\n source_tenants: group.source_tenants,\n rules: [],\n };\n combinedGroup.rules = group.rules.map((rule) => rulerRuleToCombinedRule(rule, namespace, combinedGroup));\n return combinedGroup;\n });\n}\n\nfunction addPromGroupsToCombinedNamespace(namespace: CombinedRuleNamespace, groups: RuleGroup[]): void {\n groups.forEach((group) => {\n let combinedGroup = namespace.groups.find((g) => g.name === group.name);\n if (!combinedGroup) {\n combinedGroup = {\n name: group.name,\n rules: [],\n };\n namespace.groups.push(combinedGroup);\n }\n\n (group.rules ?? []).forEach((rule) => {\n const existingRule = getExistingRuleInGroup(rule, combinedGroup!, namespace.rulesSource);\n if (existingRule) {\n existingRule.promRule = rule;\n } else {\n combinedGroup!.rules.push(promRuleToCombinedRule(rule, namespace, combinedGroup!));\n }\n });\n });\n}\n\nfunction promRuleToCombinedRule(rule: Rule, namespace: CombinedRuleNamespace, group: CombinedRuleGroup): CombinedRule {\n return {\n name: rule.name,\n query: rule.query,\n labels: rule.labels || {},\n annotations: isAlertingRule(rule) ? rule.annotations || {} : {},\n promRule: rule,\n namespace: namespace,\n group,\n };\n}\n\nfunction rulerRuleToCombinedRule(\n rule: RulerRuleDTO,\n namespace: CombinedRuleNamespace,\n group: CombinedRuleGroup\n): CombinedRule {\n return isAlertingRulerRule(rule)\n ? {\n name: rule.alert,\n query: rule.expr,\n labels: rule.labels || {},\n annotations: rule.annotations || {},\n rulerRule: rule,\n namespace,\n group,\n }\n : isRecordingRulerRule(rule)\n ? {\n name: rule.record,\n query: rule.expr,\n labels: rule.labels || {},\n annotations: {},\n rulerRule: rule,\n namespace,\n group,\n }\n : {\n name: rule.grafana_alert.title,\n query: '',\n labels: rule.labels || {},\n annotations: rule.annotations || {},\n rulerRule: rule,\n namespace,\n group,\n };\n}\n\n// find existing rule in group that matches the given prom rule\nfunction getExistingRuleInGroup(\n rule: Rule,\n group: CombinedRuleGroup,\n rulesSource: RulesSource\n): CombinedRule | undefined {\n if (isGrafanaRulesSource(rulesSource)) {\n // assume grafana groups have only the one rule. check name anyway because paranoid\n return group!.rules.find((existingRule) => existingRule.name === rule.name);\n }\n return (\n // try finding a rule that matches name, labels, annotations and query\n group!.rules.find(\n (existingRule) => !existingRule.promRule && isCombinedRuleEqualToPromRule(existingRule, rule, true)\n ) ??\n // if that fails, try finding a rule that only matches name, labels and annotations.\n // loki & prom can sometimes modify the query so it doesnt match, eg `2 > 1` becomes `1`\n group!.rules.find(\n (existingRule) => !existingRule.promRule && isCombinedRuleEqualToPromRule(existingRule, rule, false)\n )\n );\n}\n\nfunction isCombinedRuleEqualToPromRule(combinedRule: CombinedRule, rule: Rule, checkQuery = true): boolean {\n if (combinedRule.name === rule.name) {\n return (\n JSON.stringify([\n checkQuery ? hashQuery(combinedRule.query) : '',\n combinedRule.labels,\n combinedRule.annotations,\n ]) ===\n JSON.stringify([\n checkQuery ? hashQuery(rule.query) : '',\n rule.labels || {},\n isAlertingRule(rule) ? rule.annotations || {} : {},\n ])\n );\n }\n return false;\n}\n\n// there can be slight differences in how prom & ruler render a query, this will hash them accounting for the differences\nfunction hashQuery(query: string) {\n // one of them might be wrapped in parens\n if (query.length > 1 && query[0] === '(' && query[query.length - 1] === ')') {\n query = query.slice(1, -1);\n }\n // whitespace could be added or removed\n query = query.replace(/\\s|\\n/g, '');\n // labels matchers can be reordered, so sort the enitre string, esentially comparing just the character counts\n return query.split('').sort().join('');\n}\n","import { useEffect } from 'react';\n\nimport { FolderDTO, useDispatch } from 'app/types';\n\nimport { fetchFolderIfNotFetchedAction } from '../state/actions';\nimport { initialAsyncRequestState } from '../utils/redux';\n\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\ninterface ReturnBag {\n folder?: FolderDTO;\n loading: boolean;\n}\n\nexport function useFolder(uid?: string): ReturnBag {\n const dispatch = useDispatch();\n const folderRequests = useUnifiedAlertingSelector((state) => state.folders);\n useEffect(() => {\n if (uid) {\n dispatch(fetchFolderIfNotFetchedAction(uid));\n }\n }, [dispatch, uid]);\n\n if (uid) {\n const request = folderRequests[uid] || initialAsyncRequestState;\n return {\n folder: request.result,\n loading: request.loading,\n };\n }\n return {\n loading: false,\n };\n}\n","import { contextSrv } from 'app/core/services/context_srv';\nimport { RulerRuleDTO } from 'app/types/unified-alerting-dto';\n\nimport { getRulesPermissions } from '../utils/access-control';\nimport { isGrafanaRulerRule } from '../utils/rules';\n\nimport { useFolder } from './useFolder';\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\ninterface ResultBag {\n isEditable?: boolean;\n isRemovable?: boolean;\n loading: boolean;\n}\n\nexport function useIsRuleEditable(rulesSourceName: string, rule?: RulerRuleDTO): ResultBag {\n const dataSources = useUnifiedAlertingSelector((state) => state.dataSources);\n const folderUID = rule && isGrafanaRulerRule(rule) ? rule.grafana_alert.namespace_uid : undefined;\n\n const rulePermission = getRulesPermissions(rulesSourceName);\n\n const { folder, loading } = useFolder(folderUID);\n\n if (!rule) {\n return { isEditable: false, isRemovable: false, loading: false };\n }\n\n // Grafana rules can be edited if user can edit the folder they're in\n // When RBAC is disabled access to a folder is the only requirement for managing rules\n // When RBAC is enabled the appropriate alerting permissions need to be met\n if (isGrafanaRulerRule(rule)) {\n if (!folderUID) {\n throw new Error(\n `Rule ${rule.grafana_alert.title} does not have a folder uid, cannot determine if it is editable.`\n );\n }\n\n if (!folder) {\n // Loading or invalid folder UID\n return {\n isEditable: false,\n isRemovable: false,\n loading,\n };\n }\n const rbacDisabledFallback = folder.canSave;\n\n const canEditGrafanaRules = contextSrv.hasAccessInMetadata(rulePermission.update, folder, rbacDisabledFallback);\n const canRemoveGrafanaRules = contextSrv.hasAccessInMetadata(rulePermission.delete, folder, rbacDisabledFallback);\n\n return {\n isEditable: canEditGrafanaRules,\n isRemovable: canRemoveGrafanaRules,\n loading,\n };\n }\n\n // prom rules are only editable by users with Editor role and only if rules source supports editing\n const isRulerAvailable = Boolean(dataSources[rulesSourceName]?.result?.rulerConfig);\n const canEditCloudRules = contextSrv.hasAccess(rulePermission.update, contextSrv.isEditor);\n const canRemoveCloudRules = contextSrv.hasAccess(rulePermission.delete, contextSrv.isEditor);\n\n return {\n isEditable: canEditCloudRules && isRulerAvailable,\n isRemovable: canRemoveCloudRules && isRulerAvailable,\n loading: dataSources[rulesSourceName]?.loading,\n };\n}\n"],"names":["LogMessages","filterByLabel","loadedList","leavingRuleGroupEdit","ProvisionedResource","ProvisioningAlert","resource","title","severity","ProvisioningBadge","text","color","MatcherFilter","className","onFilterChange","defaultQueryString","queryString","styles","useStyles2","getStyles","handleSearchChange","debounce","e","logInfo","target","value","searchIcon","name","gap","content","icon","size","I","placeholder","defaultValue","onChange","prefix","inputWidth","theme","css","spacing","StateHistory","alertId","textFilter","setTextFilter","useState","handleTextFilter","useCallback","event","currentTarget","loading","error","result","dispatch","useDispatch","history","useUnifiedAlertingSelector","state","managedAlertStateHistory","useEffect","fetchGrafanaAnnotationsAction","useManagedAlertStateHistory","LoadingPlaceholder","Alert","message","columns","id","label","renderCell","renderStateCell","renderValueCell","renderTimestampCell","tables","Object","entries","items","map","item","LABELS_REGEX","stringifiedLabels","match","at","String","newState","replace","data","timestamp","updated","groupBy","groupStateByLabels","sort","filter","groupKey","startsWith","endsWith","includes","RegExp","slice","test","err","matchKey","tableItems","historyItem","tableGroupKey","DynamicTable","cols","Field","Label","Stack","Tooltip","Icon","Input","matches","evalMatches","LabelsWrapper","AlertLabel","labelKey","metric","AlertStateTag","TimestampStyle","dateTimeFormat","children","wrapper","RuleDetailsActionButtons","rule","rulesSource","location","useLocation","notifyApp","useAppNotification","style","namespace","group","rulerRule","ruleToDelete","setRuleToDelete","isGrafanaRulerRule","grafana_alert","StateHistoryModal","showStateHistoryModal","showModal","setShowModal","useMemo","Modal","isOpen","onDismiss","closeOnBackdropClick","closeOnEscape","hideStateHistoryModal","useStateHistoryModal","alertmanagerSourceName","isGrafanaRulesSource","getAlertmanagerByUid","jsonData","alertmanagerUid","rulesSourceName","getRulesSourceName","hasExplorePermission","contextSrv","AccessControlAction","isProvisioned","Boolean","provenance","leftButtons","rightButtons","isFederated","isFederatedRuleGroup","isEditable","isRemovable","useIsRuleEditable","returnTo","pathname","search","isViewMode","deleteRule","identifier","ruleId","deleteRuleAction","navigateTo","undefined","buildShareUrl","isCloudRulesSource","appUrl","appSubUrl","config","encodeURIComponent","window","href","split","push","button","variant","createExploreLink","query","annotations","Annotation","dashboardUID","panelId","makeRuleBasedSilenceLink","Fragment","Button","onClick","createViewLink","sourceName","editURL","urlUtil","ClipboardButton","onClipboardError","copiedText","getText","type","length","width","ConfirmModal","body","confirmText","onConfirm","colors","border","medium","typography","sm","RuleDetailsAnnotations","props","key","annotationKey","RuleDetailsDataSources","dataSources","meta","info","logos","small","unique","reduce","ds","getDataSourceSrv","getInstanceSettings","datasourceUid","uid","ExpressionDatasourceUID","values","index","alt","dataSourceIcon","src","HighlightedQuery","language","expr","plugins","SlatePrism","onlyIn","node","getSyntax","prismLanguages","LogqlSyntax","PromqlSyntax","slateValue","makeValue","readOnly","Expression","expression","useStyles","Well","cx","well","DataSourceType","fontFamily","monospace","RuleDetailsExpression","DetailsField","horizontal","exprRow","AlertInstanceStateFilter","onStateFilterChange","stateFilter","filterType","itemPerStateStats","getOptionComponent","Tag","toFixed","colorIndex","tag","grafanaOptions","GrafanaAlertState","component","promOptions","PromAlertingRuleState","capitalize","stateOptions","RadioButtonGroup","options","v","ShowMoreInstances","ruleViewPageLink","stats","footerRow","visibleItemsCount","totalItemsCount","RuleDetailsMatchingInstances","promRule","itemsDisplayLimit","Number","POSITIVE_INFINITY","pagination","setQueryString","alertState","setAlertState","filterKey","Math","floor","random","queryStringKey","stateFilterType","GRAFANA_RULES_SOURCE_NAME","alerts","isAlertingRule","alertInstanceLabel","alertInstanceState","filteredAlerts","matchers","parseMatchers","labels","labelsMatchMatchers","alert","mapStateWithReasonToBaseState","filterAlerts","sortAlerts","SortOrder","visibleInstances","countAllByState","countBy","hiddenItemsCount","flexRow","spaceBetween","rowChild","AlertInstancesTable","instances","RuleHealth","getStyle","health","lastError","warn","warning","RuleState","isDeleting","isCreating","forTime","firstActiveAt","getFirstActiveAt","for","intervalToAbbreviatedDurationString","start","end","Date","align","isRecordingRule","bodySmall","fontSize","secondary","useCombinedRuleNamespaces","promRulesResponses","promRules","rulerRulesResponses","rulerRules","cache","useRef","rulesSources","getRulesSourceByName","Error","getAllRulesSources","cached","current","namespaces","forEach","namespaceName","groups","combinedGroup","interval","source_tenants","rules","rulerRuleToCombinedRule","addRulerGroupsToCombinedNamespace","find","g","existingRule","isCombinedRuleEqualToPromRule","getExistingRuleInGroup","promRuleToCombinedRule","addPromGroupsToCombinedNamespace","flat","flattenGrafanaManagedRules","newNamespace","flatMap","a","b","localeCompare","isAlertingRulerRule","isRecordingRulerRule","record","combinedRule","checkQuery","JSON","stringify","hashQuery","join","useFolder","folderRequests","folders","fetchFolderIfNotFetchedAction","request","initialAsyncRequestState","folder","folderUID","namespace_uid","rulePermission","getRulesPermissions","rbacDisabledFallback","canSave","update","delete","isRulerAvailable","rulerConfig"],"sourceRoot":""}