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AM7V,MAAM,GAAI,KAG1B6V,EAAQA,EAAM2B,QAAQ,SAAU,KAEnB/I,MAAM,IAAIuI,OAAOS,KAAK,M,sECrP9B,SAAS7Q,IAId,MAAM,OAAE8Q,IAAW5G,EAAAA,EAAAA,MAOnB,MAAO,EANahK,EAAAA,EAAAA,UAAQ,IAAM,IAAI6Q,gBAAgBD,IAAS,CAACA,KAEjDjG,EAAAA,EAAAA,cAAY,CAACmG,EAA6DJ,KACvFK,EAAAA,gBAAAA,QAAwBD,EAAcJ,KACrC,O,gDCVE,MAAMnM,EAAuBjL,IAAD,CACjCX,MAAOY,EAAAA,GAAI;;qBAEQD,EAAM0X,MAAMC;wBACT3X,EAAMQ,OAAOsN,OAAO8J;wBACpB5X,EAAMQ,OAAOC,WAAWC;;;iBAG/BV,EAAMK,QAAQ;;;;mBAIZL,EAAMK,QAAQ;;;;;;IAO/B8K,QAASlL,EAAAA,GAAI;wBACSD,EAAMQ,OAAOC,WAAWkL;IAE9CT,UAAWjL,EAAAA,GAAI;;IAGf4X,YAAa5X,EAAAA,GAAI;;;;;;qBAMED,EAAMK,QAAQ","sources":["webpack://grafana/./public/app/core/hooks/useCleanup.ts","webpack://grafana/./public/app/features/alerting/unified/components/silences/MatchedSilencedRules.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/MatchersField.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilencePeriod.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilencesEditor.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/ActionButton.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/NoSilencesCTA.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilencedAlertsTableRow.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilencedAlertsTable.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilenceDetails.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilenceStateTag.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilencesFilter.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/SilencesTable.tsx","webpack://grafana/./public/app/features/alerting/unified/Silences.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/NoAlertManagerWarning.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rules/ActionIcon.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/AmAlertStateTag.tsx","webpack://grafana/./public/app/features/alerting/unified/components/silences/Matchers.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useAlertManagerSources.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useCombinedRuleNamespaces.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useURLSearchParams.ts","webpack://grafana/./public/app/features/alerting/unified/styles/table.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { cleanUpAction, StateSelector } from '../actions/cleanUp';\n\nexport function useCleanup(stateSelector: StateSelector) {\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 { css } from '@emotion/css';\nimport React, { useEffect, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { useDispatch } from 'react-redux';\nimport { useDebounce } from 'react-use';\n\nimport { dateTime, GrafanaTheme2 } from '@grafana/data';\nimport { Badge, useStyles2 } from '@grafana/ui';\nimport { Alert, AlertingRule } from 'app/types/unified-alerting';\n\nimport { useCombinedRuleNamespaces } from '../../hooks/useCombinedRuleNamespaces';\nimport { fetchAllPromAndRulerRulesAction } from '../../state/actions';\nimport { MatcherFieldValue, SilenceFormFields } from '../../types/silence-form';\nimport { findAlertInstancesWithMatchers } from '../../utils/matchers';\nimport { isAlertingRule } from '../../utils/rules';\nimport { AlertLabels } from '../AlertLabels';\nimport { DynamicTable, DynamicTableColumnProps, DynamicTableItemProps } from '../DynamicTable';\nimport { AlertStateTag } from '../rules/AlertStateTag';\n\ntype MatchedRulesTableItemProps = DynamicTableItemProps<{\n matchedInstance: Alert;\n}>;\ntype MatchedRulesTableColumnProps = DynamicTableColumnProps<{ matchedInstance: Alert }>;\n\nexport const MatchedSilencedRules = () => {\n const [matchedAlertRules, setMatchedAlertRules] = useState([]);\n const formApi = useFormContext();\n const dispatch = useDispatch();\n const { watch } = formApi;\n const matchers: MatcherFieldValue[] = watch('matchers');\n const styles = useStyles2(getStyles);\n const columns = useColumns();\n\n useEffect(() => {\n dispatch(fetchAllPromAndRulerRulesAction());\n }, [dispatch]);\n\n const combinedNamespaces = useCombinedRuleNamespaces();\n useDebounce(\n () => {\n const matchedInstances = combinedNamespaces.flatMap((namespace) => {\n return namespace.groups.flatMap((group) => {\n return group.rules\n .map((combinedRule) => combinedRule.promRule)\n .filter((rule): rule is AlertingRule => isAlertingRule(rule))\n .flatMap((rule) => findAlertInstancesWithMatchers(rule.alerts ?? [], matchers));\n });\n });\n setMatchedAlertRules(matchedInstances);\n },\n 500,\n [combinedNamespaces, matchers]\n );\n\n return (\n
\n

\n Affected alert instances\n {matchedAlertRules.length > 0 ? (\n \n ) : null}\n

\n
\n {matchers.every((matcher) => !matcher.value && !matcher.name) ? (\n Add a valid matcher to see affected alerts\n ) : (\n <>\n \n {matchedAlertRules.length > 5 && (\n
and {matchedAlertRules.length - 5} more
\n )}\n \n )}\n
\n
\n );\n};\n\nfunction useColumns(): MatchedRulesTableColumnProps[] {\n return [\n {\n id: 'state',\n label: 'State',\n renderCell: function renderStateTag({ data: { matchedInstance } }) {\n return ;\n },\n size: '160px',\n },\n {\n id: 'labels',\n label: 'Labels',\n renderCell: function renderName({ data: { matchedInstance } }) {\n return ;\n },\n size: '250px',\n },\n {\n id: 'created',\n label: 'Created',\n renderCell: function renderSummary({ data: { matchedInstance } }) {\n return (\n <>\n {matchedInstance.activeAt.startsWith('0001')\n ? '-'\n : dateTime(matchedInstance.activeAt).format('YYYY-MM-DD HH:mm:ss')}\n \n );\n },\n size: '400px',\n },\n ];\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n table: css`\n max-width: ${theme.breakpoints.values.lg}px;\n `,\n moreMatches: css`\n margin-top: ${theme.spacing(1)};\n `,\n title: css`\n display: flex;\n align-items: center;\n `,\n badge: css`\n margin-left: ${theme.spacing(1)};\n `,\n});\n","import { css, cx } from '@emotion/css';\nimport React, { FC } from 'react';\nimport { useFormContext, useFieldArray } from 'react-hook-form';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, Field, Input, IconButton, InputControl, useStyles2, Select } from '@grafana/ui';\nimport { MatcherOperator } from 'app/plugins/datasource/alertmanager/types';\n\nimport { SilenceFormFields } from '../../types/silence-form';\nimport { matcherFieldOptions } from '../../utils/alertmanager';\n\ninterface Props {\n className?: string;\n}\n\nconst MatchersField: FC = ({ className }) => {\n const styles = useStyles2(getStyles);\n const formApi = useFormContext();\n const {\n control,\n register,\n formState: { errors },\n } = formApi;\n\n const { fields: matchers = [], append, remove } = useFieldArray({ name: 'matchers' });\n\n return (\n
\n \n
\n
\n {matchers.map((matcher, index) => {\n return (\n
\n \n \n \n \n (\n onChange(value.value)}\n className={styles.matcherOptions}\n options={matcherFieldOptions}\n aria-label=\"operator\"\n />\n )}\n defaultValue={matcher.operator || matcherFieldOptions[0].value}\n name={`matchers.${index}.operator` as const}\n rules={{ required: { value: true, message: 'Required.' } }}\n />\n \n \n \n \n {matchers.length > 1 && (\n remove(index)}\n >\n Remove\n \n )}\n
\n );\n })}\n
\n {\n const newMatcher = { name: '', value: '', operator: MatcherOperator.equal };\n append(newMatcher);\n }}\n >\n Add matcher\n \n
\n
\n
\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n wrapper: css`\n margin-top: ${theme.spacing(2)};\n `,\n row: css`\n display: flex;\n align-items: flex-start;\n flex-direction: row;\n background-color: ${theme.colors.background.secondary};\n padding: ${theme.spacing(1)} ${theme.spacing(1)} 0 ${theme.spacing(1)};\n & > * + * {\n margin-left: ${theme.spacing(2)};\n }\n `,\n removeButton: css`\n margin-left: ${theme.spacing(1)};\n margin-top: ${theme.spacing(2.5)};\n `,\n matcherOptions: css`\n min-width: 140px;\n `,\n matchers: css`\n max-width: ${theme.breakpoints.values.sm}px;\n margin: ${theme.spacing(1)} 0;\n padding-top: ${theme.spacing(0.5)};\n `,\n };\n};\n\nexport default MatchersField;\n","import { css } from '@emotion/css';\nimport React from 'react';\nimport { useController, useFormContext } from 'react-hook-form';\n\nimport { dateTime, GrafanaTheme } from '@grafana/data';\nimport { Field, TimeRangeInput, useStyles } from '@grafana/ui';\n\nimport { SilenceFormFields } from '../../types/silence-form';\n\nexport const SilencePeriod = () => {\n const { control, getValues } = useFormContext();\n const styles = useStyles(getStyles);\n const {\n field: { onChange: onChangeStartsAt, value: startsAt },\n fieldState: { invalid: startsAtInvalid },\n } = useController({\n name: 'startsAt',\n control,\n rules: {\n validate: (value) => getValues().endsAt > value,\n },\n });\n\n const {\n field: { onChange: onChangeEndsAt, value: endsAt },\n fieldState: { invalid: endsAtInvalid },\n } = useController({\n name: 'endsAt',\n control,\n rules: {\n validate: (value) => getValues().startsAt < value,\n },\n });\n\n const {\n field: { onChange: onChangeTimeZone, value: timeZone },\n } = useController({\n name: 'timeZone',\n control,\n });\n\n const invalid = startsAtInvalid || endsAtInvalid;\n\n const from = dateTime(startsAt);\n const to = dateTime(endsAt);\n\n return (\n \n {\n onChangeStartsAt(dateTime(newValue.from));\n onChangeEndsAt(dateTime(newValue.to));\n }}\n onChangeTimeZone={(newValue) => onChangeTimeZone(newValue)}\n hideTimeZone={false}\n hideQuickRanges={true}\n placeholder={'Select time range'}\n />\n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme) => ({\n timeRange: css`\n width: 400px;\n `,\n});\n","import { css, cx } from '@emotion/css';\nimport { pickBy } from 'lodash';\nimport React, { FC, useMemo, useState } from 'react';\nimport { useForm, FormProvider } from 'react-hook-form';\nimport { useDispatch } from 'react-redux';\nimport { useDebounce } from 'react-use';\n\nimport {\n DefaultTimeZone,\n parseDuration,\n intervalToAbbreviatedDurationString,\n addDurationToDate,\n dateTime,\n isValidDate,\n GrafanaTheme2,\n} from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { Button, Field, FieldSet, Input, LinkButton, TextArea, useStyles2 } from '@grafana/ui';\nimport { useCleanup } from 'app/core/hooks/useCleanup';\nimport { MatcherOperator, Silence, SilenceCreatePayload } from 'app/plugins/datasource/alertmanager/types';\n\nimport { useURLSearchParams } from '../../hooks/useURLSearchParams';\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { createOrUpdateSilenceAction } from '../../state/actions';\nimport { SilenceFormFields } from '../../types/silence-form';\nimport { matcherToMatcherField, matcherFieldToMatcher } from '../../utils/alertmanager';\nimport { parseQueryParamMatchers } from '../../utils/matchers';\nimport { makeAMLink } from '../../utils/misc';\n\nimport { MatchedSilencedRules } from './MatchedSilencedRules';\nimport MatchersField from './MatchersField';\nimport { SilencePeriod } from './SilencePeriod';\n\ninterface Props {\n silence?: Silence;\n alertManagerSourceName: string;\n}\n\nconst defaultsFromQuery = (searchParams: URLSearchParams): Partial => {\n const defaults: Partial = {};\n\n const comment = searchParams.get('comment');\n const matchers = searchParams.getAll('matcher');\n\n const formMatchers = parseQueryParamMatchers(matchers);\n if (formMatchers.length) {\n defaults.matchers = formMatchers.map(matcherToMatcherField);\n }\n\n if (comment) {\n defaults.comment = comment;\n }\n\n return defaults;\n};\n\nconst getDefaultFormValues = (searchParams: URLSearchParams, silence?: Silence): SilenceFormFields => {\n const now = new Date();\n if (silence) {\n const isExpired = Date.parse(silence.endsAt) < Date.now();\n const interval = isExpired\n ? {\n start: now,\n end: addDurationToDate(now, { hours: 2 }),\n }\n : { start: new Date(silence.startsAt), end: new Date(silence.endsAt) };\n return {\n id: silence.id,\n startsAt: interval.start.toISOString(),\n endsAt: interval.end.toISOString(),\n comment: silence.comment,\n createdBy: silence.createdBy,\n duration: intervalToAbbreviatedDurationString(interval),\n isRegex: false,\n matchers: silence.matchers?.map(matcherToMatcherField) || [],\n matcherName: '',\n matcherValue: '',\n timeZone: DefaultTimeZone,\n };\n } else {\n const endsAt = addDurationToDate(now, { hours: 2 }); // Default time period is now + 2h\n return {\n id: '',\n startsAt: now.toISOString(),\n endsAt: endsAt.toISOString(),\n comment: `created ${dateTime().format('YYYY-MM-DD HH:mm')}`,\n createdBy: config.bootData.user.name,\n duration: '2h',\n isRegex: false,\n matchers: [{ name: '', value: '', operator: MatcherOperator.equal }],\n matcherName: '',\n matcherValue: '',\n timeZone: DefaultTimeZone,\n ...defaultsFromQuery(searchParams),\n };\n }\n};\n\nexport const SilencesEditor: FC = ({ silence, alertManagerSourceName }) => {\n const [urlSearchParams] = useURLSearchParams();\n\n const defaultValues = useMemo(() => getDefaultFormValues(urlSearchParams, silence), [silence, urlSearchParams]);\n const formAPI = useForm({ defaultValues });\n const dispatch = useDispatch();\n const styles = useStyles2(getStyles);\n\n const { loading } = useUnifiedAlertingSelector((state) => state.updateSilence);\n\n useCleanup((state) => state.unifiedAlerting.updateSilence);\n\n const { register, handleSubmit, formState, watch, setValue, clearErrors } = formAPI;\n\n const onSubmit = (data: SilenceFormFields) => {\n const { id, startsAt, endsAt, comment, createdBy, matchers: matchersFields } = data;\n const matchers = matchersFields.map(matcherFieldToMatcher);\n const payload = pickBy(\n {\n id,\n startsAt,\n endsAt,\n comment,\n createdBy,\n matchers,\n },\n (value) => !!value\n ) as SilenceCreatePayload;\n dispatch(\n createOrUpdateSilenceAction({\n alertManagerSourceName,\n payload,\n exitOnSave: true,\n successMessage: `Silence ${payload.id ? 'updated' : 'created'}`,\n })\n );\n };\n\n const duration = watch('duration');\n const startsAt = watch('startsAt');\n const endsAt = watch('endsAt');\n\n // Keep duration and endsAt in sync\n const [prevDuration, setPrevDuration] = useState(duration);\n useDebounce(\n () => {\n if (isValidDate(startsAt) && isValidDate(endsAt)) {\n if (duration !== prevDuration) {\n setValue('endsAt', dateTime(addDurationToDate(new Date(startsAt), parseDuration(duration))).toISOString());\n setPrevDuration(duration);\n } else {\n const startValue = new Date(startsAt).valueOf();\n const endValue = new Date(endsAt).valueOf();\n if (endValue > startValue) {\n const nextDuration = intervalToAbbreviatedDurationString({\n start: new Date(startsAt),\n end: new Date(endsAt),\n });\n setValue('duration', nextDuration);\n setPrevDuration(nextDuration);\n }\n }\n }\n },\n 700,\n [clearErrors, duration, endsAt, prevDuration, setValue, startsAt]\n );\n\n return (\n \n
\n
\n
\n \n \n \n Object.keys(parseDuration(value)).length === 0\n ? 'Invalid duration. Valid example: 1d 4h (Available units: y, M, w, d, h, m, s)'\n : undefined,\n })}\n id=\"duration\"\n />\n \n
\n\n \n \n \n \n \n
\n
\n {loading && (\n \n )}\n {!loading && }\n \n Cancel\n \n
\n
\n
\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n field: css`\n margin: ${theme.spacing(1, 0)};\n `,\n textArea: css`\n max-width: ${theme.breakpoints.values.sm}px;\n `,\n createdBy: css`\n width: 200px;\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n\n & > * {\n margin-right: ${theme.spacing(1)};\n }\n `,\n silencePeriod: css`\n max-width: ${theme.breakpoints.values.sm}px;\n `,\n});\n\nexport default SilencesEditor;\n","import { css, cx } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { useStyles } from '@grafana/ui';\nimport { Button, ButtonProps } from '@grafana/ui/src/components/Button';\n\ntype Props = Omit;\n\nexport const ActionButton: FC = ({ className, ...restProps }) => (\n \n \n )}\n \n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n searchInput: css`\n width: 360px;\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n padding-bottom: ${theme.spacing(2)};\n border-bottom: 1px solid ${theme.colors.border.strong};\n `,\n rowChild: css`\n margin-right: ${theme.spacing(1)};\n margin-bottom: 0;\n max-height: 52px;\n `,\n fieldLabel: css`\n font-size: 12px;\n font-weight: 500;\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC, useMemo } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { GrafanaTheme2, dateMath } from '@grafana/data';\nimport { Stack } from '@grafana/experimental';\nimport { Icon, useStyles2, Link, Button } from '@grafana/ui';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AlertmanagerAlert, Silence, SilenceState } from 'app/plugins/datasource/alertmanager/types';\n\nimport { expireSilenceAction } from '../../state/actions';\nimport { getInstancesPermissions } from '../../utils/access-control';\nimport { parseMatchers } from '../../utils/alertmanager';\nimport { getSilenceFiltersFromUrlParams, makeAMLink } from '../../utils/misc';\nimport { Authorize } from '../Authorize';\nimport { DynamicTable, DynamicTableColumnProps, DynamicTableItemProps } from '../DynamicTable';\nimport { ActionButton } from '../rules/ActionButton';\nimport { ActionIcon } from '../rules/ActionIcon';\n\nimport { Matchers } from './Matchers';\nimport { NoSilencesSplash } from './NoSilencesCTA';\nimport { SilenceDetails } from './SilenceDetails';\nimport { SilenceStateTag } from './SilenceStateTag';\nimport { SilencesFilter } from './SilencesFilter';\n\nexport interface SilenceTableItem extends Silence {\n silencedAlerts: AlertmanagerAlert[];\n}\n\ntype SilenceTableColumnProps = DynamicTableColumnProps;\ntype SilenceTableItemProps = DynamicTableItemProps;\ninterface Props {\n silences: Silence[];\n alertManagerAlerts: AlertmanagerAlert[];\n alertManagerSourceName: string;\n}\n\nconst SilencesTable: FC = ({ silences, alertManagerAlerts, alertManagerSourceName }) => {\n const styles = useStyles2(getStyles);\n const [queryParams] = useQueryParams();\n const filteredSilences = useFilteredSilences(silences);\n const permissions = getInstancesPermissions(alertManagerSourceName);\n\n const { silenceState } = getSilenceFiltersFromUrlParams(queryParams);\n\n const showExpiredSilencesBanner =\n !!filteredSilences.length && (silenceState === undefined || silenceState === SilenceState.Expired);\n\n const columns = useColumns(alertManagerSourceName);\n\n const items = useMemo((): SilenceTableItemProps[] => {\n const findSilencedAlerts = (id: string) => {\n return alertManagerAlerts.filter((alert) => alert.status.silencedBy.includes(id));\n };\n return filteredSilences.map((silence) => {\n const silencedAlerts = findSilencedAlerts(silence.id);\n return {\n id: silence.id,\n data: { ...silence, silencedAlerts },\n };\n });\n }, [filteredSilences, alertManagerAlerts]);\n\n return (\n
\n {!!silences.length && (\n <>\n \n \n
\n \n \n \n
\n
\n {!!items.length ? (\n <>\n }\n />\n {showExpiredSilencesBanner && (\n
\n \n Expired silences are automatically deleted after 5 days.\n
\n )}\n \n ) : (\n 'No matching silences found'\n )}\n \n )}\n {!silences.length && }\n
\n );\n};\n\nconst useFilteredSilences = (silences: Silence[]) => {\n const [queryParams] = useQueryParams();\n return useMemo(() => {\n const { queryString, silenceState } = getSilenceFiltersFromUrlParams(queryParams);\n const silenceIdsString = queryParams?.silenceIds;\n return silences.filter((silence) => {\n if (typeof silenceIdsString === 'string') {\n const idsIncluded = silenceIdsString.split(',').includes(silence.id);\n if (!idsIncluded) {\n return false;\n }\n }\n if (queryString) {\n const matchers = parseMatchers(queryString);\n const matchersMatch = matchers.every((matcher) =>\n silence.matchers?.some(\n ({ name, value, isEqual, isRegex }) =>\n matcher.name === name &&\n matcher.value === value &&\n matcher.isEqual === isEqual &&\n matcher.isRegex === isRegex\n )\n );\n if (!matchersMatch) {\n return false;\n }\n }\n if (silenceState) {\n const stateMatches = silence.status.state === silenceState;\n if (!stateMatches) {\n return false;\n }\n }\n return true;\n });\n }, [queryParams, silences]);\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n topButtonContainer: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n `,\n addNewSilence: css`\n margin: ${theme.spacing(2, 0)};\n `,\n callout: css`\n background-color: ${theme.colors.background.secondary};\n border-top: 3px solid ${theme.colors.info.border};\n border-radius: 2px;\n height: 62px;\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-top: ${theme.spacing(2)};\n\n & > * {\n margin-left: ${theme.spacing(1)};\n }\n `,\n calloutIcon: css`\n color: ${theme.colors.info.text};\n `,\n editButton: css`\n margin-left: ${theme.spacing(0.5)};\n `,\n});\n\nfunction useColumns(alertManagerSourceName: string) {\n const dispatch = useDispatch();\n const styles = useStyles2(getStyles);\n const permissions = getInstancesPermissions(alertManagerSourceName);\n return useMemo((): SilenceTableColumnProps[] => {\n const handleExpireSilenceClick = (id: string) => {\n dispatch(expireSilenceAction(alertManagerSourceName, id));\n };\n const showActions = contextSrv.hasAccess(permissions.update, contextSrv.isEditor);\n const columns: SilenceTableColumnProps[] = [\n {\n id: 'state',\n label: 'State',\n renderCell: function renderStateTag({ data: { status } }) {\n return ;\n },\n size: '88px',\n },\n {\n id: 'matchers',\n label: 'Matching labels',\n renderCell: function renderMatchers({ data: { matchers } }) {\n return ;\n },\n size: 9,\n },\n {\n id: 'alerts',\n label: 'Alerts',\n renderCell: function renderSilencedAlerts({ data: { silencedAlerts } }) {\n return {silencedAlerts.length};\n },\n size: 1,\n },\n {\n id: 'schedule',\n label: 'Schedule',\n renderCell: function renderSchedule({ data: { startsAt, endsAt } }) {\n const startsAtDate = dateMath.parse(startsAt);\n const endsAtDate = dateMath.parse(endsAt);\n const dateDisplayFormat = 'YYYY-MM-DD HH:mm';\n return (\n <>\n {' '}\n {startsAtDate?.format(dateDisplayFormat)} {'-'}\n
\n {endsAtDate?.format(dateDisplayFormat)}\n \n );\n },\n size: '150px',\n },\n ];\n if (showActions) {\n columns.push({\n id: 'actions',\n label: 'Actions',\n renderCell: function renderActions({ data: silence }) {\n return (\n \n {silence.status.state === 'expired' ? (\n \n Recreate\n \n ) : (\n handleExpireSilenceClick(silence.id)}>\n Unsilence\n \n )}\n {silence.status.state !== 'expired' && (\n \n )}\n \n );\n },\n size: '147px',\n });\n }\n return columns;\n }, [alertManagerSourceName, dispatch, styles, permissions]);\n}\n\nexport default SilencesTable;\n","import React, { FC, useCallback, useEffect } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { Redirect, Route, RouteChildrenProps, Switch, useLocation } from 'react-router-dom';\n\nimport { Alert, LoadingPlaceholder, withErrorBoundary } from '@grafana/ui';\nimport { Silence } from 'app/plugins/datasource/alertmanager/types';\n\nimport { AlertManagerPicker } from './components/AlertManagerPicker';\nimport { AlertingPageWrapper } from './components/AlertingPageWrapper';\nimport { NoAlertManagerWarning } from './components/NoAlertManagerWarning';\nimport SilencesEditor from './components/silences/SilencesEditor';\nimport SilencesTable from './components/silences/SilencesTable';\nimport { useAlertManagerSourceName } from './hooks/useAlertManagerSourceName';\nimport { useAlertManagersByPermission } from './hooks/useAlertManagerSources';\nimport { useUnifiedAlertingSelector } from './hooks/useUnifiedAlertingSelector';\nimport { fetchAmAlertsAction, fetchSilencesAction } from './state/actions';\nimport { SILENCES_POLL_INTERVAL_MS } from './utils/constants';\nimport { AsyncRequestState, initialAsyncRequestState } from './utils/redux';\n\nconst Silences: FC = () => {\n const alertManagers = useAlertManagersByPermission('instance');\n const [alertManagerSourceName, setAlertManagerSourceName] = useAlertManagerSourceName(alertManagers);\n\n const dispatch = useDispatch();\n const silences = useUnifiedAlertingSelector((state) => state.silences);\n const alertsRequests = useUnifiedAlertingSelector((state) => state.amAlerts);\n const alertsRequest = alertManagerSourceName\n ? alertsRequests[alertManagerSourceName] || initialAsyncRequestState\n : undefined;\n\n const location = useLocation();\n const isRoot = location.pathname.endsWith('/alerting/silences');\n\n useEffect(() => {\n function fetchAll() {\n if (alertManagerSourceName) {\n dispatch(fetchSilencesAction(alertManagerSourceName));\n dispatch(fetchAmAlertsAction(alertManagerSourceName));\n }\n }\n fetchAll();\n const interval = setInterval(() => fetchAll, SILENCES_POLL_INTERVAL_MS);\n return () => {\n clearInterval(interval);\n };\n }, [alertManagerSourceName, dispatch]);\n\n const { result, loading, error }: AsyncRequestState =\n (alertManagerSourceName && silences[alertManagerSourceName]) || initialAsyncRequestState;\n\n const getSilenceById = useCallback((id: string) => result && result.find((silence) => silence.id === id), [result]);\n\n if (!alertManagerSourceName) {\n return isRoot ? (\n \n \n \n ) : (\n \n );\n }\n\n return (\n \n \n {error && !loading && (\n \n {error.message || 'Unknown error.'}\n \n )}\n {alertsRequest?.error && !alertsRequest?.loading && (\n \n {alertsRequest.error?.message || 'Unknown error.'}\n \n )}\n {loading && }\n {result && !error && (\n \n \n \n \n \n \n \n \n {({ match }: RouteChildrenProps<{ id: string }>) => {\n return (\n match?.params.id && (\n \n )\n );\n }}\n \n \n )}\n \n );\n};\n\nexport default withErrorBoundary(Silences, { style: 'page' });\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 = ({ children, pageId, isLoading }) => {\n const navModel = getNavModel(\n useSelector((state: StoreState) => state.navIndex),\n pageId\n );\n\n return (\n \n {children}\n \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 = ({ 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 React from 'react';\n\nimport { Alert } from '@grafana/ui';\n\nimport { useAlertManagerSourceName } from '../hooks/useAlertManagerSourceName';\nimport { AlertManagerDataSource } from '../utils/datasource';\n\nimport { AlertManagerPicker } from './AlertManagerPicker';\n\ninterface Props {\n availableAlertManagers: AlertManagerDataSource[];\n}\n\nconst NoAlertManagersAvailable = () => (\n \n We could not find any external Alertmanagers and you may not have access to the built-in Grafana Alertmanager.\n \n);\n\nconst OtherAlertManagersAvailable = () => (\n \n Selected Alertmanager no longer exists or you may not have permission to access it.\n \n);\n\nexport const NoAlertManagerWarning = ({ availableAlertManagers }: Props) => {\n const [_, setAlertManagerSourceName] = useAlertManagerSourceName(availableAlertManagers);\n const hasOtherAMs = availableAlertManagers.length > 0;\n\n return (\n
\n {hasOtherAMs ? (\n <>\n \n \n \n ) : (\n \n )}\n
\n );\n};\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 = ({\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 \n {to ? (\n \n ) : (\n \n )}\n \n );\n};\n","import React, { FC } from 'react';\n\nimport { AlertState } from 'app/plugins/datasource/alertmanager/types';\n\nimport { State, StateTag } from '../StateTag';\n\nconst alertStateToState: Record = {\n [AlertState.Active]: 'bad',\n [AlertState.Unprocessed]: 'neutral',\n [AlertState.Suppressed]: 'info',\n};\n\ninterface Props {\n state: AlertState;\n}\n\nexport const AmAlertStateTag: FC = ({ state }) => {state};\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { TagList, useStyles2 } from '@grafana/ui';\nimport { Matcher } from 'app/plugins/datasource/alertmanager/types';\n\nimport { matcherToOperator } from '../../utils/alertmanager';\n\ntype MatchersProps = { matchers: Matcher[] };\n\nexport const Matchers: FC = ({ matchers }) => {\n const styles = useStyles2(getStyles);\n return (\n
\n `${matcher.name}${matcherToOperator(matcher)}${matcher.value}`)}\n />\n
\n );\n};\n\nconst getStyles = () => ({\n tags: css`\n justify-content: flex-start;\n `,\n});\n","import { useCallback } from 'react';\n\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport store from 'app/core/store';\n\nimport { ALERTMANAGER_NAME_LOCAL_STORAGE_KEY, ALERTMANAGER_NAME_QUERY_KEY } from '../utils/constants';\nimport { AlertManagerDataSource, GRAFANA_RULES_SOURCE_NAME } from '../utils/datasource';\n\nfunction useIsAlertManagerAvailable(availableAlertManagers: AlertManagerDataSource[]) {\n return useCallback(\n (alertManagerName: string) => {\n const availableAlertManagersNames = availableAlertManagers.map((am) => am.name);\n return availableAlertManagersNames.includes(alertManagerName);\n },\n [availableAlertManagers]\n );\n}\n\n/* This will return am name either from query params or from local storage or a default (grafana).\n * Due to RBAC permissions Grafana Managed Alert manager or external alert managers may not be available\n * In the worst case neihter GMA nor external alert manager is available\n */\nexport function useAlertManagerSourceName(\n availableAlertManagers: AlertManagerDataSource[]\n): [string | undefined, (alertManagerSourceName: string) => void] {\n const [queryParams, updateQueryParams] = useQueryParams();\n const isAlertManagerAvailable = useIsAlertManagerAvailable(availableAlertManagers);\n\n const update = useCallback(\n (alertManagerSourceName: string) => {\n if (!isAlertManagerAvailable(alertManagerSourceName)) {\n return;\n }\n if (alertManagerSourceName === GRAFANA_RULES_SOURCE_NAME) {\n store.delete(ALERTMANAGER_NAME_LOCAL_STORAGE_KEY);\n updateQueryParams({ [ALERTMANAGER_NAME_QUERY_KEY]: null });\n } else {\n store.set(ALERTMANAGER_NAME_LOCAL_STORAGE_KEY, alertManagerSourceName);\n updateQueryParams({ [ALERTMANAGER_NAME_QUERY_KEY]: alertManagerSourceName });\n }\n },\n [updateQueryParams, isAlertManagerAvailable]\n );\n\n const querySource = queryParams[ALERTMANAGER_NAME_QUERY_KEY];\n\n if (querySource && typeof querySource === 'string') {\n if (isAlertManagerAvailable(querySource)) {\n return [querySource, update];\n } else {\n // non existing alertmanager\n return [undefined, update];\n }\n }\n\n const storeSource = store.get(ALERTMANAGER_NAME_LOCAL_STORAGE_KEY);\n if (storeSource && typeof storeSource === 'string' && isAlertManagerAvailable(storeSource)) {\n update(storeSource);\n return [storeSource, update];\n }\n\n if (isAlertManagerAvailable(GRAFANA_RULES_SOURCE_NAME)) {\n return [GRAFANA_RULES_SOURCE_NAME, update];\n }\n\n return [undefined, update];\n}\n","import { useMemo } from 'react';\n\nimport { getAlertManagerDataSourcesByPermission } from '../utils/datasource';\n\nexport function useAlertManagersByPermission(accessType: 'instance' | 'notification') {\n return useMemo(() => getAlertManagerDataSourcesByPermission(accessType), [accessType]);\n}\n","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 { useCallback, useMemo } from 'react';\nimport { useLocation } from 'react-router-dom';\n\nimport { locationService } from '@grafana/runtime';\n\nexport function useURLSearchParams(): [\n URLSearchParams,\n (searchValues: Record, replace?: boolean) => void\n] {\n const { search } = useLocation();\n const queryParams = useMemo(() => new URLSearchParams(search), [search]);\n\n const update = useCallback((searchValues: Record, replace?: boolean) => {\n locationService.partial(searchValues, replace);\n }, []);\n\n return [queryParams, update];\n}\n","import { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nexport const getAlertTableStyles = (theme: GrafanaTheme2) => ({\n table: css`\n width: 100%;\n border-radius: ${theme.shape.borderRadius()};\n border: solid 1px ${theme.colors.border.weak};\n background-color: ${theme.colors.background.secondary};\n\n th {\n padding: ${theme.spacing(1)};\n }\n\n td {\n padding: 0 ${theme.spacing(1)};\n }\n\n tr {\n height: 38px;\n }\n `,\n evenRow: css`\n background-color: ${theme.colors.background.primary};\n `,\n colExpand: css`\n width: 36px;\n `,\n actionsCell: css`\n text-align: right;\n width: 1%;\n white-space: nowrap;\n\n & > * + * {\n margin-left: ${theme.spacing(0.5)};\n }\n `,\n});\n"],"names":["useCleanup","stateSelector","dispatch","useDispatch","selectorRef","useRef","current","useEffect","cleanUpAction","MatchedSilencedRules","matchedAlertRules","setMatchedAlertRules","useState","formApi","useFormContext","watch","matchers","styles","useStyles2","getStyles","columns","id","label","renderCell","data","matchedInstance","AlertStateTag","state","size","AlertLabels","labels","activeAt","startsWith","dateTime","format","fetchAllPromAndRulerRulesAction","combinedNamespaces","useCombinedRuleNamespaces","useDebounce","matchedInstances","flatMap","namespace","groups","group","rules","map","combinedRule","promRule","filter","rule","isAlertingRule","findAlertInstancesWithMatchers","alerts","className","title","length","Badge","badge","color","text","table","every","matcher","value","name","DynamicTable","items","slice","isExpandable","cols","moreMatches","theme","css","breakpoints","values","lg","spacing","wrapper","row","colors","background","secondary","removeButton","matcherOptions","sm","control","register","formState","errors","fields","append","remove","useFieldArray","cx","Field","required","index","invalid","error","message","Input","defaultValue","placeholder","InputControl","render","field","onChange","Select","options","matcherFieldOptions","operator","IconButton","tooltip","onClick","Button","type","icon","variant","newMatcher","MatcherOperator","SilencePeriod","getValues","useStyles","onChangeStartsAt","startsAt","fieldState","startsAtInvalid","useController","validate","endsAt","onChangeEndsAt","endsAtInvalid","onChangeTimeZone","timeZone","from","to","timeRange","TimeRangeInput","raw","newValue","hideTimeZone","hideQuickRanges","getDefaultFormValues","searchParams","silence","now","Date","interval","parse","start","end","addDurationToDate","hours","toISOString","comment","createdBy","duration","intervalToAbbreviatedDurationString","isRegex","matcherToMatcherField","matcherName","matcherValue","DefaultTimeZone","config","defaults","get","getAll","formMatchers","parseQueryParamMatchers","defaultsFromQuery","textArea","flexRow","silencePeriod","alertManagerSourceName","urlSearchParams","useURLSearchParams","defaultValues","useMemo","formAPI","useForm","loading","useUnifiedAlertingSelector","updateSilence","unifiedAlerting","handleSubmit","setValue","clearErrors","prevDuration","setPrevDuration","isValidDate","parseDuration","startValue","valueOf","nextDuration","onSubmit","matchersFields","matcherFieldToMatcher","payload","pickBy","createOrUpdateSilenceAction","exitOnSave","successMessage","FieldSet","Object","keys","undefined","TextArea","rows","disabled","LinkButton","href","makeAMLink","fill","ActionButton","restProps","getStyle","typography","NoSilencesSplash","permissions","getInstancesPermissions","contextSrv","create","EmptyListCTA","buttonIcon","buttonLink","buttonTitle","CallToActionCard","callToActionElement","SilencedAlertsTableRow","alert","isCollapsed","setIsCollapsed","alertName","entries","reduce","labelKey","labelValue","CollapseToggle","onToggle","collapsed","AmAlertStateTag","status","colSpan","tableMargin","colState","colName","silencedAlerts","tableStyles","getAlertTableStyles","colExpand","evenRow","fingerprint","SilenceDetails","dateDisplayFormat","startsAtDate","dateMath","endsAtDate","container","primary","silenceStateToState","SilenceState","SilenceStateTag","StateTag","stateOptions","key","getQueryStringKey","uniqueId","SilencesFilter","queryStringKey","setQueryStringKey","queryParams","setQueryParams","useQueryParams","queryString","silenceState","getSilenceFiltersFromUrlParams","handleQueryStringChange","debounce","e","target","inputInvalid","parseMatchers","rowChild","Label","Stack","gap","Tooltip","content","Icon","searchInput","prefix","RadioButtonGroup","setTimeout","border","strong","fieldLabel","useFilteredSilences","silences","silenceIdsString","silenceIds","split","includes","some","isEqual","topButtonContainer","addNewSilence","callout","info","calloutIcon","editButton","alertManagerAlerts","filteredSilences","showExpiredSilencesBanner","handleExpireSilenceClick","expireSilenceAction","Matchers","update","push","Link","ActionIcon","A","useColumns","silencedBy","Authorize","actions","fallback","renderExpandedContent","withErrorBoundary","alertManagers","useAlertManagersByPermission","setAlertManagerSourceName","useAlertManagerSourceName","alertsRequests","amAlerts","alertsRequest","initialAsyncRequestState","isRoot","useLocation","pathname","endsWith","fetchAll","fetchSilencesAction","fetchAmAlertsAction","setInterval","SILENCES_POLL_INTERVAL_MS","clearInterval","result","getSilenceById","useCallback","find","AlertingPageWrapper","pageId","AlertManagerPicker","dataSources","Alert","severity","LoadingPlaceholder","exact","path","match","params","NoAlertManagerWarning","availableAlertManagers","style","children","isLoading","navModel","getNavModel","useSelector","navIndex","action","NoAlertManagersAvailable","OtherAlertManagersAvailable","_","hasOtherAMs","tooltipPlacement","rest","ariaLabel","placement","alertStateToState","AlertState","TagList","tags","matcherToOperator","updateQueryParams","isAlertManagerAvailable","alertManagerName","am","useIsAlertManagerAvailable","GRAFANA_RULES_SOURCE_NAME","store","ALERTMANAGER_NAME_LOCAL_STORAGE_KEY","ALERTMANAGER_NAME_QUERY_KEY","querySource","storeSource","accessType","getAlertManagerDataSourcesByPermission","rulesSourceName","promRulesResponses","promRules","rulerRulesResponses","rulerRules","cache","rulesSources","rulesSource","getRulesSourceByName","Error","getAllRulesSources","isCloudRulesSource","cached","namespaces","forEach","namespaceName","combinedGroup","source_tenants","isAlertingRulerRule","query","expr","annotations","rulerRule","isRecordingRulerRule","record","grafana_alert","rulerRuleToCombinedRule","addRulerGroupsToCombinedNamespace","g","existingRule","isGrafanaRulesSource","isCombinedRuleEqualToPromRule","getExistingRuleInGroup","promRuleToCombinedRule","addPromGroupsToCombinedNamespace","flat","flattenGrafanaManagedRules","newNamespace","sort","a","b","localeCompare","checkQuery","JSON","stringify","hashQuery","replace","join","search","URLSearchParams","searchValues","locationService","shape","borderRadius","weak","actionsCell"],"sourceRoot":""}