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SAAoC5B,GAClC,OAAOnF,EAAAA,EAAAA,cACJgH,GACqC7B,EAAuB9V,KAAK4X,GAAOA,EAAG3a,OACvCuP,SAASmL,IAE9C,CAAC7B,IAY6B+B,CAA2B/B,GAErDhO,GAAS6I,EAAAA,EAAAA,cACZ3P,IACM0W,EAAwB1W,KAGzBA,IAA2BK,EAAAA,IAC7ByW,EAAAA,EAAAA,OAAaC,EAAAA,IACbP,EAAkB,CAAE,CAACQ,EAAAA,IAA8B,SAEnDF,EAAAA,EAAAA,IAAUC,EAAAA,GAAqC/W,GAC/CwW,EAAkB,CAAE,CAACQ,EAAAA,IAA8BhX,QAGvD,CAACwW,EAAmBE,IAGhBO,EAAcV,EAAYS,EAAAA,IAEhC,GAAIC,GAAsC,iBAAhBA,EACxB,OAAIP,EAAwBO,GACnB,CAACA,EAAanQ,GAGd,MAACpK,EAAWoK,GAIvB,MAAMoQ,EAAcJ,EAAAA,EAAAA,IAAUC,EAAAA,IAC9B,OAAIG,GAAsC,iBAAhBA,GAA4BR,EAAwBQ,IAC5EpQ,EAAOoQ,GACA,CAACA,EAAapQ,IAGnB4P,EAAwBrW,EAAAA,IACnB,CAACA,EAAAA,GAA2ByG,GAG9B,MAACpK,EAAWoK,K,0DC7Dd,SAAS0B,EAA6B2O,GAC3C,OAAOtO,EAAAA,EAAAA,UAAQ,KAAMuO,EAAAA,EAAAA,IAAuCD,IAAa,CAACA,M,sECArE,SAAStF,IAId,MAAM,OAAEwF,IAAWC,EAAAA,EAAAA,MAOnB,MAAO,EANazO,EAAAA,EAAAA,UAAQ,IAAM,IAAI0O,gBAAgBF,IAAS,CAACA,KAEjD1H,EAAAA,EAAAA,cAAY,CAAC6H,EAA6DC,KACvFC,EAAAA,gBAAAA,QAAwBF,EAAcC,KACrC","sources":["webpack://grafana/./public/app/core/hooks/useCleanup.ts","webpack://grafana/./public/app/features/alerting/unified/utils/amroutes.ts","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/formStyles.ts","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmRootRouteForm.tsx","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/gridStyles.ts","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmRootRouteRead.tsx","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmRootRoute.tsx","webpack://grafana/./public/app/features/alerting/unified/components/EmptyArea.tsx","webpack://grafana/./public/app/features/alerting/unified/components/EmptyAreaWithCTA.tsx","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useMuteTimingOptions.ts","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/MuteTimingsTable.tsx","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedRead.tsx","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmRoutesTable.tsx","webpack://grafana/./public/app/features/alerting/unified/utils/dynamicTable.ts","webpack://grafana/./public/app/features/alerting/unified/components/amroutes/AmSpecificRouting.tsx","webpack://grafana/./public/app/features/alerting/unified/AmRoutes.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/alert-groups/MatcherFilter.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/useURLSearchParams.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { cleanUpAction, StateSelector } from '../actions/cleanUp';\n\nexport function useCleanup<T>(stateSelector: StateSelector<T>) {\n const dispatch = useDispatch();\n //bit of a hack to unburden user from having to wrap stateSelcetor in a useCallback. Otherwise cleanup would happen on every render\n const selectorRef = useRef(stateSelector);\n selectorRef.current = stateSelector;\n useEffect(() => {\n return () => {\n dispatch(cleanUpAction({ stateSelector: selectorRef.current }));\n };\n }, [dispatch]);\n}\n","import { isUndefined, omitBy } from 'lodash';\nimport { Validate } from 'react-hook-form';\n\nimport { SelectableValue } from '@grafana/data';\nimport { MatcherOperator, Route } from 'app/plugins/datasource/alertmanager/types';\n\nimport { FormAmRoute } from '../types/amroutes';\nimport { MatcherFieldValue } from '../types/silence-form';\n\nimport { matcherToMatcherField, parseMatcher } from './alertmanager';\nimport { GRAFANA_RULES_SOURCE_NAME } from './datasource';\nimport { parseInterval, timeOptions } from './time';\n\nconst defaultValueAndType: [string, string] = ['', ''];\n\nconst matchersToArrayFieldMatchers = (\n matchers: Record<string, string> | undefined,\n isRegex: boolean\n): MatcherFieldValue[] =>\n Object.entries(matchers ?? {}).reduce<MatcherFieldValue[]>(\n (acc, [name, value]) => [\n ...acc,\n {\n name,\n value,\n operator: isRegex ? MatcherOperator.regex : MatcherOperator.equal,\n },\n ],\n [] as MatcherFieldValue[]\n );\n\nconst intervalToValueAndType = (\n strValue: string | undefined,\n defaultValue?: typeof defaultValueAndType\n): [string, string] => {\n if (!strValue) {\n return defaultValue ?? defaultValueAndType;\n }\n\n const [value, valueType] = strValue ? parseInterval(strValue) : [undefined, undefined];\n\n const timeOption = timeOptions.find((opt) => opt.value === valueType);\n\n if (!value || !timeOption) {\n return defaultValueAndType;\n }\n\n return [String(value), timeOption.value];\n};\n\nconst selectableValueToString = (selectableValue: SelectableValue<string>): string => selectableValue.value!;\n\nconst selectableValuesToStrings = (arr: Array<SelectableValue<string>> | undefined): string[] =>\n (arr ?? []).map(selectableValueToString);\n\nexport const emptyArrayFieldMatcher: MatcherFieldValue = {\n name: '',\n value: '',\n operator: MatcherOperator.equal,\n};\n\nexport const emptyRoute: FormAmRoute = {\n id: '',\n overrideGrouping: false,\n groupBy: [],\n object_matchers: [],\n routes: [],\n continue: false,\n receiver: '',\n overrideTimings: false,\n groupWaitValue: '',\n groupWaitValueType: timeOptions[0].value,\n groupIntervalValue: '',\n groupIntervalValueType: timeOptions[0].value,\n repeatIntervalValue: '',\n repeatIntervalValueType: timeOptions[0].value,\n muteTimeIntervals: [],\n};\n\n//returns route, and a record mapping id to existing route\nexport const amRouteToFormAmRoute = (route: Route | undefined): [FormAmRoute, Record<string, Route>] => {\n if (!route) {\n return [emptyRoute, {}];\n }\n\n const id = String(Math.random());\n const id2route = {\n [id]: route,\n };\n\n if (Object.keys(route).length === 0) {\n const formAmRoute = { ...emptyRoute, id };\n return [formAmRoute, id2route];\n }\n\n const formRoutes: FormAmRoute[] = [];\n route.routes?.forEach((subRoute) => {\n const [subFormRoute, subId2Route] = amRouteToFormAmRoute(subRoute);\n formRoutes.push(subFormRoute);\n Object.assign(id2route, subId2Route);\n });\n\n // Frontend migration to use object_matchers instead of matchers\n const matchers = route.matchers\n ? route.matchers?.map((matcher) => matcherToMatcherField(parseMatcher(matcher))) ?? []\n : route.object_matchers?.map(\n (matcher) => ({ name: matcher[0], operator: matcher[1], value: matcher[2] } as MatcherFieldValue)\n ) ?? [];\n\n const [groupWaitValue, groupWaitValueType] = intervalToValueAndType(route.group_wait, ['', 's']);\n const [groupIntervalValue, groupIntervalValueType] = intervalToValueAndType(route.group_interval, ['', 'm']);\n const [repeatIntervalValue, repeatIntervalValueType] = intervalToValueAndType(route.repeat_interval, ['', 'h']);\n\n return [\n {\n id,\n object_matchers: [\n ...matchers,\n ...matchersToArrayFieldMatchers(route.match, false),\n ...matchersToArrayFieldMatchers(route.match_re, true),\n ],\n continue: route.continue ?? false,\n receiver: route.receiver ?? '',\n overrideGrouping: Array.isArray(route.group_by) && route.group_by.length !== 0,\n groupBy: route.group_by ?? [],\n overrideTimings: [groupWaitValue, groupIntervalValue, repeatIntervalValue].some(Boolean),\n groupWaitValue,\n groupWaitValueType,\n groupIntervalValue,\n groupIntervalValueType,\n repeatIntervalValue,\n repeatIntervalValueType,\n routes: formRoutes,\n muteTimeIntervals: route.mute_time_intervals ?? [],\n },\n id2route,\n ];\n};\n\nexport const formAmRouteToAmRoute = (\n alertManagerSourceName: string | undefined,\n formAmRoute: FormAmRoute,\n id2ExistingRoute: Record<string, Route>\n): Route => {\n const existing: Route | undefined = id2ExistingRoute[formAmRoute.id];\n\n const {\n overrideGrouping,\n groupBy,\n overrideTimings,\n groupWaitValue,\n groupWaitValueType,\n groupIntervalValue,\n groupIntervalValueType,\n repeatIntervalValue,\n repeatIntervalValueType,\n } = formAmRoute;\n\n const group_by = overrideGrouping && groupBy ? groupBy : [];\n\n const overrideGroupWait = overrideTimings && groupWaitValue;\n const group_wait = overrideGroupWait ? `${groupWaitValue}${groupWaitValueType}` : undefined;\n\n const overrideGroupInterval = overrideTimings && groupIntervalValue;\n const group_interval = overrideGroupInterval ? `${groupIntervalValue}${groupIntervalValueType}` : undefined;\n\n const overrideRepeatInterval = overrideTimings && repeatIntervalValue;\n const repeat_interval = overrideRepeatInterval ? `${repeatIntervalValue}${repeatIntervalValueType}` : undefined;\n\n const amRoute: Route = {\n ...(existing ?? {}),\n continue: formAmRoute.continue,\n group_by: group_by,\n object_matchers: formAmRoute.object_matchers.length\n ? formAmRoute.object_matchers.map((matcher) => [matcher.name, matcher.operator, matcher.value])\n : undefined,\n match: undefined, // DEPRECATED: Use matchers\n match_re: undefined, // DEPRECATED: Use matchers\n group_wait,\n group_interval,\n repeat_interval,\n routes: formAmRoute.routes.map((subRoute) =>\n formAmRouteToAmRoute(alertManagerSourceName, subRoute, id2ExistingRoute)\n ),\n mute_time_intervals: formAmRoute.muteTimeIntervals,\n };\n\n if (alertManagerSourceName !== GRAFANA_RULES_SOURCE_NAME) {\n amRoute.matchers = formAmRoute.object_matchers.map(({ name, operator, value }) => `${name}${operator}${value}`);\n amRoute.object_matchers = undefined;\n } else {\n amRoute.matchers = undefined;\n }\n\n if (formAmRoute.receiver) {\n amRoute.receiver = formAmRoute.receiver;\n }\n\n return omitBy(amRoute, isUndefined);\n};\n\nexport const stringToSelectableValue = (str: string): SelectableValue<string> => ({\n label: str,\n value: str,\n});\n\nexport const stringsToSelectableValues = (arr: string[] | undefined): Array<SelectableValue<string>> =>\n (arr ?? []).map(stringToSelectableValue);\n\nexport const mapSelectValueToString = (selectableValue: SelectableValue<string>): string => {\n if (!selectableValue) {\n return '';\n }\n\n return selectableValueToString(selectableValue) ?? '';\n};\n\nexport const mapMultiSelectValueToStrings = (\n selectableValues: Array<SelectableValue<string>> | undefined\n): string[] => {\n if (!selectableValues) {\n return [];\n }\n\n return selectableValuesToStrings(selectableValues);\n};\n\nexport const optionalPositiveInteger: Validate<string> = (value) => {\n if (!value) {\n return undefined;\n }\n\n return !/^\\d+$/.test(value) ? 'Must be a positive integer.' : undefined;\n};\n","import { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nexport const getFormStyles = (theme: GrafanaTheme2) => {\n return {\n container: css`\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n\n & > * + * {\n margin-left: ${theme.spacing(1)};\n }\n `,\n input: css`\n flex: 1;\n `,\n timingContainer: css`\n max-width: ${theme.spacing(33)};\n `,\n smallInput: css`\n width: ${theme.spacing(6.5)};\n `,\n linkText: css`\n text-decoration: underline;\n `,\n collapse: css`\n border: none;\n background: none;\n color: ${theme.colors.text.primary};\n `,\n };\n};\n","import { cx } from '@emotion/css';\nimport React, { FC, useState } from 'react';\n\nimport { Button, Collapse, Field, Form, Input, InputControl, Link, MultiSelect, Select, useStyles2 } from '@grafana/ui';\n\nimport { AmRouteReceiver, FormAmRoute } from '../../types/amroutes';\nimport {\n mapMultiSelectValueToStrings,\n mapSelectValueToString,\n optionalPositiveInteger,\n stringToSelectableValue,\n stringsToSelectableValues,\n} from '../../utils/amroutes';\nimport { makeAMLink } from '../../utils/misc';\nimport { timeOptions } from '../../utils/time';\n\nimport { getFormStyles } from './formStyles';\n\nexport interface AmRootRouteFormProps {\n alertManagerSourceName: string;\n onCancel: () => void;\n onSave: (data: FormAmRoute) => void;\n receivers: AmRouteReceiver[];\n routes: FormAmRoute;\n}\n\nexport const AmRootRouteForm: FC<AmRootRouteFormProps> = ({\n alertManagerSourceName,\n onCancel,\n onSave,\n receivers,\n routes,\n}) => {\n const styles = useStyles2(getFormStyles);\n const [isTimingOptionsExpanded, setIsTimingOptionsExpanded] = useState(false);\n const [groupByOptions, setGroupByOptions] = useState(stringsToSelectableValues(routes.groupBy));\n\n return (\n <Form defaultValues={{ ...routes, overrideTimings: true, overrideGrouping: true }} onSubmit={onSave}>\n {({ control, errors, setValue }) => (\n <>\n <Field label=\"Default contact point\" invalid={!!errors.receiver} error={errors.receiver?.message}>\n <>\n <div className={styles.container} data-testid=\"am-receiver-select\">\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n aria-label=\"Default contact point\"\n {...field}\n className={styles.input}\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={receivers}\n />\n )}\n control={control}\n name=\"receiver\"\n rules={{ required: { value: true, message: 'Required.' } }}\n />\n <span>or</span>\n <Link\n className={styles.linkText}\n href={makeAMLink('/alerting/notifications/receivers/new', alertManagerSourceName)}\n >\n Create a contact point\n </Link>\n </div>\n </>\n </Field>\n <Field\n label=\"Group by\"\n description=\"Group alerts when you receive a notification based on labels.\"\n data-testid=\"am-group-select\"\n >\n {/* @ts-ignore-check: react-hook-form made me do this */}\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <MultiSelect\n aria-label=\"Group by\"\n {...field}\n allowCustomValue\n className={styles.input}\n onCreateOption={(opt: string) => {\n setGroupByOptions((opts) => [...opts, stringToSelectableValue(opt)]);\n\n // @ts-ignore-check: react-hook-form made me do this\n setValue('groupBy', [...field.value, opt]);\n }}\n onChange={(value) => onChange(mapMultiSelectValueToStrings(value))}\n options={groupByOptions}\n />\n )}\n control={control}\n name=\"groupBy\"\n />\n </Field>\n <Collapse\n collapsible\n className={styles.collapse}\n isOpen={isTimingOptionsExpanded}\n label=\"Timing options\"\n onToggle={setIsTimingOptionsExpanded}\n >\n <Field\n label=\"Group wait\"\n description=\"The waiting time until the initial notification is sent for a new group created by an incoming alert. Default 30 seconds.\"\n invalid={!!errors.groupWaitValue}\n error={errors.groupWaitValue?.message}\n data-testid=\"am-group-wait\"\n >\n <>\n <div className={cx(styles.container, styles.timingContainer)}>\n <InputControl\n render={({ field, fieldState: { invalid } }) => (\n <Input {...field} className={styles.smallInput} invalid={invalid} placeholder={'30'} />\n )}\n control={control}\n name=\"groupWaitValue\"\n rules={{\n validate: optionalPositiveInteger,\n }}\n />\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={styles.input}\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={timeOptions}\n aria-label=\"Group wait type\"\n />\n )}\n control={control}\n name=\"groupWaitValueType\"\n />\n </div>\n </>\n </Field>\n <Field\n label=\"Group interval\"\n description=\"The waiting time to send a batch of new alerts for that group after the first notification was sent. Default 5 minutes.\"\n invalid={!!errors.groupIntervalValue}\n error={errors.groupIntervalValue?.message}\n data-testid=\"am-group-interval\"\n >\n <>\n <div className={cx(styles.container, styles.timingContainer)}>\n <InputControl\n render={({ field, fieldState: { invalid } }) => (\n <Input {...field} className={styles.smallInput} invalid={invalid} placeholder={'5'} />\n )}\n control={control}\n name=\"groupIntervalValue\"\n rules={{\n validate: optionalPositiveInteger,\n }}\n />\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={styles.input}\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={timeOptions}\n aria-label=\"Group interval type\"\n />\n )}\n control={control}\n name=\"groupIntervalValueType\"\n />\n </div>\n </>\n </Field>\n <Field\n label=\"Repeat interval\"\n description=\"The waiting time to resend an alert after they have successfully been sent. Default 4 hours.\"\n invalid={!!errors.repeatIntervalValue}\n error={errors.repeatIntervalValue?.message}\n data-testid=\"am-repeat-interval\"\n >\n <>\n <div className={cx(styles.container, styles.timingContainer)}>\n <InputControl\n render={({ field, fieldState: { invalid } }) => (\n <Input {...field} className={styles.smallInput} invalid={invalid} placeholder=\"4\" />\n )}\n control={control}\n name=\"repeatIntervalValue\"\n rules={{\n validate: optionalPositiveInteger,\n }}\n />\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={styles.input}\n menuPlacement=\"top\"\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={timeOptions}\n aria-label=\"Repeat interval type\"\n />\n )}\n control={control}\n name=\"repeatIntervalValueType\"\n />\n </div>\n </>\n </Field>\n </Collapse>\n <div className={styles.container}>\n <Button type=\"submit\">Save</Button>\n <Button onClick={onCancel} type=\"reset\" variant=\"secondary\" fill=\"outline\">\n Cancel\n </Button>\n </div>\n </>\n )}\n </Form>\n );\n};\n","import { css } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nexport const getGridStyles = (theme: GrafanaTheme2) => {\n return {\n container: css`\n display: grid;\n font-style: ${theme.typography.fontSize};\n grid-template-columns: ${theme.spacing(15.5)} auto;\n\n ${theme.breakpoints.down('md')} {\n grid-template-columns: 100%;\n }\n `,\n titleCell: css`\n color: ${theme.colors.text.primary};\n `,\n valueCell: css`\n color: ${theme.colors.text.secondary};\n margin-bottom: ${theme.spacing(1)};\n `,\n };\n};\n","import React, { FC } from 'react';\n\nimport { useStyles2 } from '@grafana/ui';\n\nimport { FormAmRoute } from '../../types/amroutes';\n\nimport { getGridStyles } from './gridStyles';\n\nexport interface AmRootRouteReadProps {\n routes: FormAmRoute;\n}\n\nexport const AmRootRouteRead: FC<AmRootRouteReadProps> = ({ routes }) => {\n const styles = useStyles2(getGridStyles);\n\n const receiver = routes.receiver || '-';\n const groupBy = routes.groupBy.join(', ') || '-';\n const groupWait = routes.groupWaitValue ? `${routes.groupWaitValue}${routes.groupWaitValueType}` : '-';\n const groupInterval = routes.groupIntervalValue\n ? `${routes.groupIntervalValue}${routes.groupIntervalValueType}`\n : '-';\n const repeatInterval = routes.repeatIntervalValue\n ? `${routes.repeatIntervalValue}${routes.repeatIntervalValueType}`\n : '-';\n\n return (\n <div className={styles.container}>\n <div className={styles.titleCell}>Contact point</div>\n <div className={styles.valueCell} data-testid=\"am-routes-root-receiver\">\n {receiver}\n </div>\n <div className={styles.titleCell}>Group by</div>\n <div className={styles.valueCell} data-testid=\"am-routes-root-group-by\">\n {groupBy}\n </div>\n <div className={styles.titleCell}>Timings</div>\n <div className={styles.valueCell} data-testid=\"am-routes-root-timings\">\n Group wait: {groupWait} | Group interval: {groupInterval} | Repeat interval: {repeatInterval}\n </div>\n </div>\n );\n};\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, useStyles2 } from '@grafana/ui';\n\nimport { Authorize } from '../../components/Authorize';\nimport { AmRouteReceiver, FormAmRoute } from '../../types/amroutes';\nimport { getNotificationsPermissions } from '../../utils/access-control';\nimport { isVanillaPrometheusAlertManagerDataSource } from '../../utils/datasource';\n\nimport { AmRootRouteForm } from './AmRootRouteForm';\nimport { AmRootRouteRead } from './AmRootRouteRead';\n\nexport interface AmRootRouteProps {\n isEditMode: boolean;\n onEnterEditMode: () => void;\n onExitEditMode: () => void;\n onSave: (data: Partial<FormAmRoute>) => void;\n receivers: AmRouteReceiver[];\n routes: FormAmRoute;\n alertManagerSourceName: string;\n}\n\nexport const AmRootRoute: FC<AmRootRouteProps> = ({\n isEditMode,\n onSave,\n onEnterEditMode,\n onExitEditMode,\n receivers,\n routes,\n alertManagerSourceName,\n}) => {\n const styles = useStyles2(getStyles);\n\n const permissions = getNotificationsPermissions(alertManagerSourceName);\n const isReadOnly = isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName);\n\n return (\n <div className={styles.container} data-testid=\"am-root-route-container\">\n <div className={styles.titleContainer}>\n <h5 className={styles.title}>\n Root policy - <i>default for all alerts</i>\n </h5>\n {!isEditMode && !isReadOnly && (\n <Authorize actions={[permissions.update]}>\n <Button icon=\"pen\" onClick={onEnterEditMode} size=\"sm\" type=\"button\" variant=\"secondary\">\n Edit\n </Button>\n </Authorize>\n )}\n </div>\n <p>\n All alerts will go to the default contact point, unless you set additional matchers in the specific routing\n area.\n </p>\n {isEditMode ? (\n <AmRootRouteForm\n alertManagerSourceName={alertManagerSourceName}\n onCancel={onExitEditMode}\n onSave={onSave}\n receivers={receivers}\n routes={routes}\n />\n ) : (\n <AmRootRouteRead routes={routes} />\n )}\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n container: css`\n background-color: ${theme.colors.background.secondary};\n color: ${theme.colors.text.secondary};\n padding: ${theme.spacing(2)};\n `,\n titleContainer: css`\n color: ${theme.colors.text.primary};\n display: flex;\n flex-flow: row nowrap;\n `,\n title: css`\n flex: 100%;\n `,\n };\n};\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { useStyles } from '@grafana/ui';\n\nexport const EmptyArea: FC = ({ children }) => {\n const styles = useStyles(getStyles);\n\n return <div className={styles.container}>{children}</div>;\n};\n\nconst getStyles = (theme: GrafanaTheme) => {\n return {\n container: css`\n background-color: ${theme.colors.bg2};\n color: ${theme.colors.textSemiWeak};\n padding: ${theme.spacing.xl};\n text-align: center;\n `,\n };\n};\n","import { css } from '@emotion/css';\nimport React, { ButtonHTMLAttributes, FC } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { Button, ButtonVariant, IconName, LinkButton, useStyles } from '@grafana/ui';\n\nimport { EmptyArea } from './EmptyArea';\n\nexport interface EmptyAreaWithCTAProps {\n buttonLabel: string;\n href?: string;\n onButtonClick?: ButtonHTMLAttributes<HTMLButtonElement>['onClick'];\n text: string;\n\n buttonIcon?: IconName;\n buttonSize?: 'xs' | 'sm' | 'md' | 'lg';\n buttonVariant?: ButtonVariant;\n showButton?: boolean;\n}\n\nexport const EmptyAreaWithCTA: FC<EmptyAreaWithCTAProps> = ({\n buttonIcon,\n buttonLabel,\n buttonSize = 'lg',\n buttonVariant = 'primary',\n onButtonClick,\n text,\n href,\n showButton = true,\n}) => {\n const styles = useStyles(getStyles);\n\n const commonProps = {\n className: styles.button,\n icon: buttonIcon,\n size: buttonSize,\n variant: buttonVariant,\n };\n\n return (\n <EmptyArea>\n <>\n <p className={styles.text}>{text}</p>\n {showButton &&\n (href ? (\n <LinkButton href={href} type=\"button\" {...commonProps}>\n {buttonLabel}\n </LinkButton>\n ) : (\n <Button onClick={onButtonClick} type=\"button\" {...commonProps}>\n {buttonLabel}\n </Button>\n ))}\n </>\n </EmptyArea>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme) => {\n return {\n container: css`\n background-color: ${theme.colors.bg2};\n color: ${theme.colors.textSemiWeak};\n padding: ${theme.spacing.xl};\n text-align: center;\n `,\n text: css`\n margin-bottom: ${theme.spacing.md};\n `,\n button: css`\n margin: ${theme.spacing.md} 0 ${theme.spacing.sm};\n `,\n };\n};\n","import { css, cx } from '@emotion/css';\nimport React, { FC, useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport {\n Button,\n Field,\n FieldArray,\n Form,\n HorizontalGroup,\n IconButton,\n Input,\n InputControl,\n MultiSelect,\n Select,\n Switch,\n useStyles2,\n Badge,\n VerticalGroup,\n} from '@grafana/ui';\n\nimport { useMuteTimingOptions } from '../../hooks/useMuteTimingOptions';\nimport { AmRouteReceiver, FormAmRoute } from '../../types/amroutes';\nimport { matcherFieldOptions } from '../../utils/alertmanager';\nimport {\n emptyArrayFieldMatcher,\n mapMultiSelectValueToStrings,\n mapSelectValueToString,\n optionalPositiveInteger,\n stringToSelectableValue,\n stringsToSelectableValues,\n} from '../../utils/amroutes';\nimport { timeOptions } from '../../utils/time';\n\nimport { getFormStyles } from './formStyles';\n\nexport interface AmRoutesExpandedFormProps {\n onCancel: () => void;\n onSave: (data: FormAmRoute) => void;\n receivers: AmRouteReceiver[];\n routes: FormAmRoute;\n}\n\nexport const AmRoutesExpandedForm: FC<AmRoutesExpandedFormProps> = ({ onCancel, onSave, receivers, routes }) => {\n const styles = useStyles2(getStyles);\n const formStyles = useStyles2(getFormStyles);\n const [groupByOptions, setGroupByOptions] = useState(stringsToSelectableValues(routes.groupBy));\n const muteTimingOptions = useMuteTimingOptions();\n\n return (\n <Form defaultValues={routes} onSubmit={onSave}>\n {({ control, register, errors, setValue, watch }) => (\n <>\n {/* @ts-ignore-check: react-hook-form made me do this */}\n <input type=\"hidden\" {...register('id')} />\n {/* @ts-ignore-check: react-hook-form made me do this */}\n <FieldArray name=\"object_matchers\" control={control}>\n {({ fields, append, remove }) => (\n <>\n <VerticalGroup justify=\"flex-start\" spacing=\"md\">\n <div>Matching labels</div>\n {fields.length === 0 && (\n <Badge\n color=\"orange\"\n className={styles.noMatchersWarning}\n icon=\"exclamation-triangle\"\n text=\"If no matchers are specified, this notification policy will handle all alert instances.\"\n />\n )}\n {fields.length > 0 && (\n <div className={styles.matchersContainer}>\n {fields.map((field, index) => {\n const localPath = `object_matchers[${index}]`;\n return (\n <HorizontalGroup key={field.id} align=\"flex-start\" height=\"auto\">\n <Field\n label=\"Label\"\n invalid={!!errors.object_matchers?.[index]?.name}\n error={errors.object_matchers?.[index]?.name?.message}\n >\n <Input\n {...register(`${localPath}.name`, { required: 'Field is required' })}\n defaultValue={field.name}\n placeholder=\"label\"\n />\n </Field>\n <Field label={'Operator'}>\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={styles.matchersOperator}\n onChange={(value) => onChange(value?.value)}\n options={matcherFieldOptions}\n aria-label=\"Operator\"\n />\n )}\n defaultValue={field.operator}\n control={control}\n name={`${localPath}.operator` as const}\n rules={{ required: { value: true, message: 'Required.' } }}\n />\n </Field>\n <Field\n label=\"Value\"\n invalid={!!errors.object_matchers?.[index]?.value}\n error={errors.object_matchers?.[index]?.value?.message}\n >\n <Input\n {...register(`${localPath}.value`, { required: 'Field is required' })}\n defaultValue={field.value}\n placeholder=\"value\"\n />\n </Field>\n <IconButton\n className={styles.removeButton}\n tooltip=\"Remove matcher\"\n name={'trash-alt'}\n onClick={() => remove(index)}\n >\n Remove\n </IconButton>\n </HorizontalGroup>\n );\n })}\n </div>\n )}\n <Button\n className={styles.addMatcherBtn}\n icon=\"plus\"\n onClick={() => append(emptyArrayFieldMatcher)}\n variant=\"secondary\"\n type=\"button\"\n >\n Add matcher\n </Button>\n </VerticalGroup>\n </>\n )}\n </FieldArray>\n <Field label=\"Contact point\">\n {/* @ts-ignore-check: react-hook-form made me do this */}\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n aria-label=\"Contact point\"\n {...field}\n className={formStyles.input}\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={receivers}\n />\n )}\n control={control}\n name=\"receiver\"\n />\n </Field>\n <Field label=\"Continue matching subsequent sibling nodes\">\n <Switch id=\"continue-toggle\" {...register('continue')} />\n </Field>\n <Field label=\"Override grouping\">\n <Switch id=\"override-grouping-toggle\" {...register('overrideGrouping')} />\n </Field>\n {watch().overrideGrouping && (\n <Field\n label=\"Group by\"\n description=\"Group alerts when you receive a notification based on labels. If empty it will be inherited from the parent policy.\"\n >\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <MultiSelect\n aria-label=\"Group by\"\n {...field}\n allowCustomValue\n className={formStyles.input}\n onCreateOption={(opt: string) => {\n setGroupByOptions((opts) => [...opts, stringToSelectableValue(opt)]);\n\n // @ts-ignore-check: react-hook-form made me do this\n setValue('groupBy', [...field.value, opt]);\n }}\n onChange={(value) => onChange(mapMultiSelectValueToStrings(value))}\n options={groupByOptions}\n />\n )}\n control={control}\n name=\"groupBy\"\n />\n </Field>\n )}\n <Field label=\"Override general timings\">\n <Switch id=\"override-timings-toggle\" {...register('overrideTimings')} />\n </Field>\n {watch().overrideTimings && (\n <>\n <Field\n label=\"Group wait\"\n description=\"The waiting time until the initial notification is sent for a new group created by an incoming alert. If empty it will be inherited from the parent policy.\"\n invalid={!!errors.groupWaitValue}\n error={errors.groupWaitValue?.message}\n >\n <>\n <div className={cx(formStyles.container, formStyles.timingContainer)}>\n <InputControl\n render={({ field, fieldState: { invalid } }) => (\n <Input\n {...field}\n className={formStyles.smallInput}\n invalid={invalid}\n aria-label=\"Group wait value\"\n />\n )}\n control={control}\n name=\"groupWaitValue\"\n rules={{\n validate: optionalPositiveInteger,\n }}\n />\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={formStyles.input}\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={timeOptions}\n aria-label=\"Group wait type\"\n />\n )}\n control={control}\n name=\"groupWaitValueType\"\n />\n </div>\n </>\n </Field>\n <Field\n label=\"Group interval\"\n description=\"The waiting time to send a batch of new alerts for that group after the first notification was sent. If empty it will be inherited from the parent policy.\"\n invalid={!!errors.groupIntervalValue}\n error={errors.groupIntervalValue?.message}\n >\n <>\n <div className={cx(formStyles.container, formStyles.timingContainer)}>\n <InputControl\n render={({ field, fieldState: { invalid } }) => (\n <Input\n {...field}\n className={formStyles.smallInput}\n invalid={invalid}\n aria-label=\"Group interval value\"\n />\n )}\n control={control}\n name=\"groupIntervalValue\"\n rules={{\n validate: optionalPositiveInteger,\n }}\n />\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={formStyles.input}\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={timeOptions}\n aria-label=\"Group interval type\"\n />\n )}\n control={control}\n name=\"groupIntervalValueType\"\n />\n </div>\n </>\n </Field>\n <Field\n label=\"Repeat interval\"\n description=\"The waiting time to resend an alert after they have successfully been sent.\"\n invalid={!!errors.repeatIntervalValue}\n error={errors.repeatIntervalValue?.message}\n >\n <>\n <div className={cx(formStyles.container, formStyles.timingContainer)}>\n <InputControl\n render={({ field, fieldState: { invalid } }) => (\n <Input\n {...field}\n className={formStyles.smallInput}\n invalid={invalid}\n aria-label=\"Repeat interval value\"\n />\n )}\n control={control}\n name=\"repeatIntervalValue\"\n rules={{\n validate: optionalPositiveInteger,\n }}\n />\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n className={formStyles.input}\n menuPlacement=\"top\"\n onChange={(value) => onChange(mapSelectValueToString(value))}\n options={timeOptions}\n aria-label=\"Repeat interval type\"\n />\n )}\n control={control}\n name=\"repeatIntervalValueType\"\n />\n </div>\n </>\n </Field>\n </>\n )}\n <Field\n label=\"Mute timings\"\n data-testid=\"am-mute-timing-select\"\n description=\"Add mute timing to policy\"\n invalid={!!errors.muteTimeIntervals}\n >\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <MultiSelect\n aria-label=\"Mute timings\"\n {...field}\n className={formStyles.input}\n onChange={(value) => onChange(mapMultiSelectValueToStrings(value))}\n options={muteTimingOptions}\n />\n )}\n control={control}\n name=\"muteTimeIntervals\"\n />\n </Field>\n <div className={styles.buttonGroup}>\n <Button type=\"submit\">Save policy</Button>\n <Button onClick={onCancel} fill=\"outline\" type=\"button\" variant=\"secondary\">\n Cancel\n </Button>\n </div>\n </>\n )}\n </Form>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n const commonSpacing = theme.spacing(3.5);\n\n return {\n addMatcherBtn: css`\n margin-bottom: ${commonSpacing};\n `,\n matchersContainer: css`\n background-color: ${theme.colors.background.secondary};\n margin: ${theme.spacing(1, 0)};\n padding: ${theme.spacing(1, 4.6, 1, 1.5)};\n width: fit-content;\n `,\n matchersOperator: css`\n min-width: 140px;\n `,\n nestedPolicies: css`\n margin-top: ${commonSpacing};\n `,\n removeButton: css`\n margin-left: ${theme.spacing(1)};\n margin-top: ${theme.spacing(2.5)};\n `,\n buttonGroup: css`\n margin: ${theme.spacing(6)} 0 ${commonSpacing};\n\n & > * + * {\n margin-left: ${theme.spacing(1.5)};\n }\n `,\n noMatchersWarning: css`\n padding: ${theme.spacing(1)} ${theme.spacing(2)};\n `,\n };\n};\n","import { useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { AlertmanagerConfig } from 'app/plugins/datasource/alertmanager/types';\n\nimport { timeIntervalToString } from '../utils/alertmanager';\nimport { initialAsyncRequestState } from '../utils/redux';\n\nimport { useAlertManagerSourceName } from './useAlertManagerSourceName';\nimport { useAlertManagersByPermission } from './useAlertManagerSources';\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\nexport function useMuteTimingOptions(): Array<SelectableValue<string>> {\n const alertManagers = useAlertManagersByPermission('notification');\n const [alertManagerSourceName] = useAlertManagerSourceName(alertManagers);\n const amConfigs = useUnifiedAlertingSelector((state) => state.amConfigs);\n\n return useMemo(() => {\n const { result } = (alertManagerSourceName && amConfigs[alertManagerSourceName]) || initialAsyncRequestState;\n const config: AlertmanagerConfig = result?.alertmanager_config ?? {};\n\n const muteTimingsOptions: Array<SelectableValue<string>> =\n config?.mute_time_intervals?.map((value) => ({\n value: value.name,\n label: value.name,\n description: value.time_intervals.map((interval) => timeIntervalToString(interval)).join(', AND '),\n })) ?? [];\n\n return muteTimingsOptions;\n }, [alertManagerSourceName, amConfigs]);\n}\n","import { css } from '@emotion/css';\nimport React, { FC, useMemo, useState } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { IconButton, LinkButton, Link, useStyles2, ConfirmModal } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AlertManagerCortexConfig, MuteTimeInterval, TimeInterval } from 'app/plugins/datasource/alertmanager/types';\n\nimport { Authorize } from '../../components/Authorize';\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { deleteMuteTimingAction } from '../../state/actions';\nimport { getNotificationsPermissions } from '../../utils/access-control';\nimport {\n getTimeString,\n getWeekdayString,\n getDaysOfMonthString,\n getMonthsString,\n getYearsString,\n} from '../../utils/alertmanager';\nimport { makeAMLink } from '../../utils/misc';\nimport { AsyncRequestState, initialAsyncRequestState } from '../../utils/redux';\nimport { DynamicTable, DynamicTableItemProps, DynamicTableColumnProps } from '../DynamicTable';\nimport { EmptyAreaWithCTA } from '../EmptyAreaWithCTA';\n\ninterface Props {\n alertManagerSourceName: string;\n muteTimingNames?: string[];\n hideActions?: boolean;\n}\n\nexport const MuteTimingsTable: FC<Props> = ({ alertManagerSourceName, muteTimingNames, hideActions }) => {\n const styles = useStyles2(getStyles);\n const dispatch = useDispatch();\n const permissions = getNotificationsPermissions(alertManagerSourceName);\n const amConfigs = useUnifiedAlertingSelector((state) => state.amConfigs);\n const [muteTimingName, setMuteTimingName] = useState<string>('');\n const { result }: AsyncRequestState<AlertManagerCortexConfig> =\n (alertManagerSourceName && amConfigs[alertManagerSourceName]) || initialAsyncRequestState;\n\n const items = useMemo((): Array<DynamicTableItemProps<MuteTimeInterval>> => {\n const muteTimings = result?.alertmanager_config?.mute_time_intervals ?? [];\n return muteTimings\n .filter(({ name }) => (muteTimingNames ? muteTimingNames.includes(name) : true))\n .map((mute) => {\n return {\n id: mute.name,\n data: mute,\n };\n });\n }, [result?.alertmanager_config?.mute_time_intervals, muteTimingNames]);\n\n const columns = useColumns(alertManagerSourceName, hideActions, setMuteTimingName);\n\n return (\n <div className={styles.container}>\n {!hideActions && <h5>Mute timings</h5>}\n {!hideActions && (\n <p>\n Mute timings are a named interval of time that may be referenced in the notification policy tree to mute\n particular notification policies for specific times of the day.\n </p>\n )}\n {!hideActions && items.length > 0 && (\n <Authorize actions={[permissions.create]}>\n <LinkButton\n className={styles.addMuteButton}\n icon=\"plus\"\n variant=\"primary\"\n href={makeAMLink('alerting/routes/mute-timing/new', alertManagerSourceName)}\n >\n New mute timing\n </LinkButton>\n </Authorize>\n )}\n {items.length > 0 ? (\n <DynamicTable items={items} cols={columns} />\n ) : !hideActions ? (\n <EmptyAreaWithCTA\n text=\"You haven't created any mute timings yet\"\n buttonLabel=\"Add mute timing\"\n buttonIcon=\"plus\"\n buttonSize=\"lg\"\n href={makeAMLink('alerting/routes/mute-timing/new', alertManagerSourceName)}\n showButton={contextSrv.hasPermission(permissions.create)}\n />\n ) : (\n <p>No mute timings configured</p>\n )}\n {!hideActions && (\n <ConfirmModal\n isOpen={!!muteTimingName}\n title=\"Delete mute timing\"\n body={`Are you sure you would like to delete \"${muteTimingName}\"`}\n confirmText=\"Delete\"\n onConfirm={() => dispatch(deleteMuteTimingAction(alertManagerSourceName, muteTimingName))}\n onDismiss={() => setMuteTimingName('')}\n />\n )}\n </div>\n );\n};\n\nfunction useColumns(alertManagerSourceName: string, hideActions = false, setMuteTimingName: (name: string) => void) {\n const permissions = getNotificationsPermissions(alertManagerSourceName);\n\n const userHasEditPermissions = contextSrv.hasPermission(permissions.update);\n const userHasDeletePermissions = contextSrv.hasPermission(permissions.delete);\n const showActions = !hideActions && (userHasEditPermissions || userHasDeletePermissions);\n return useMemo((): Array<DynamicTableColumnProps<MuteTimeInterval>> => {\n const columns: Array<DynamicTableColumnProps<MuteTimeInterval>> = [\n {\n id: 'name',\n label: 'Name',\n renderCell: function renderName({ data }) {\n return data.name;\n },\n size: '250px',\n },\n {\n id: 'timeRange',\n label: 'Time range',\n renderCell: ({ data }) => renderTimeIntervals(data.time_intervals),\n },\n ];\n if (showActions) {\n columns.push({\n id: 'actions',\n label: 'Actions',\n renderCell: function renderActions({ data }) {\n return (\n <div>\n <Authorize actions={[permissions.update]}>\n <Link\n href={makeAMLink(`/alerting/routes/mute-timing/edit`, alertManagerSourceName, {\n muteName: data.name,\n })}\n >\n <IconButton name=\"edit\" title=\"Edit mute timing\" />\n </Link>\n </Authorize>\n <Authorize actions={[permissions.delete]}>\n <IconButton\n name={'trash-alt'}\n title=\"Delete mute timing\"\n onClick={() => setMuteTimingName(data.name)}\n />\n </Authorize>\n </div>\n );\n },\n size: '100px',\n });\n }\n return columns;\n }, [alertManagerSourceName, setMuteTimingName, showActions, permissions]);\n}\n\nfunction renderTimeIntervals(timeIntervals: TimeInterval[]) {\n return timeIntervals.map((interval, index) => {\n const { times, weekdays, days_of_month, months, years } = interval;\n const timeString = getTimeString(times);\n const weekdayString = getWeekdayString(weekdays);\n const daysString = getDaysOfMonthString(days_of_month);\n const monthsString = getMonthsString(months);\n const yearsString = getYearsString(years);\n\n return (\n <React.Fragment key={JSON.stringify(interval) + index}>\n {`${timeString} ${weekdayString}`}\n <br />\n {[daysString, monthsString, yearsString].join(' | ')}\n <br />\n </React.Fragment>\n );\n });\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n container: css`\n display: flex;\n flex-flow: column nowrap;\n `,\n addMuteButton: css`\n margin-bottom: ${theme.spacing(2)};\n align-self: flex-end;\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC, useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, useStyles2 } from '@grafana/ui';\n\nimport { AmRouteReceiver, FormAmRoute } from '../../types/amroutes';\nimport { getNotificationsPermissions } from '../../utils/access-control';\nimport { emptyRoute } from '../../utils/amroutes';\nimport { Authorize } from '../Authorize';\n\nimport { AmRoutesTable } from './AmRoutesTable';\nimport { MuteTimingsTable } from './MuteTimingsTable';\nimport { getGridStyles } from './gridStyles';\n\nexport interface AmRoutesExpandedReadProps {\n onChange: (routes: FormAmRoute) => void;\n receivers: AmRouteReceiver[];\n routes: FormAmRoute;\n readOnly?: boolean;\n alertManagerSourceName: string;\n}\n\nexport const AmRoutesExpandedRead: FC<AmRoutesExpandedReadProps> = ({\n onChange,\n receivers,\n routes,\n readOnly = false,\n alertManagerSourceName,\n}) => {\n const styles = useStyles2(getStyles);\n const gridStyles = useStyles2(getGridStyles);\n const permissions = getNotificationsPermissions(alertManagerSourceName);\n\n const groupWait = routes.groupWaitValue ? `${routes.groupWaitValue}${routes.groupWaitValueType}` : '-';\n const groupInterval = routes.groupIntervalValue\n ? `${routes.groupIntervalValue}${routes.groupIntervalValueType}`\n : '-';\n const repeatInterval = routes.repeatIntervalValue\n ? `${routes.repeatIntervalValue}${routes.repeatIntervalValueType}`\n : '-';\n\n const [subroutes, setSubroutes] = useState(routes.routes);\n const [isAddMode, setIsAddMode] = useState(false);\n\n return (\n <div className={gridStyles.container}>\n <div className={gridStyles.titleCell}>Group wait</div>\n <div className={gridStyles.valueCell}>{groupWait}</div>\n <div className={gridStyles.titleCell}>Group interval</div>\n <div className={gridStyles.valueCell}>{groupInterval}</div>\n <div className={gridStyles.titleCell}>Repeat interval</div>\n <div className={gridStyles.valueCell}>{repeatInterval}</div>\n <div className={gridStyles.titleCell}>Nested policies</div>\n <div className={gridStyles.valueCell}>\n {!!subroutes.length ? (\n <AmRoutesTable\n isAddMode={isAddMode}\n onCancelAdd={() => {\n setIsAddMode(false);\n setSubroutes((subroutes) => {\n const newSubroutes = [...subroutes];\n newSubroutes.pop();\n\n return newSubroutes;\n });\n }}\n onChange={(newRoutes) => {\n onChange({\n ...routes,\n routes: newRoutes,\n });\n\n if (isAddMode) {\n setIsAddMode(false);\n }\n }}\n receivers={receivers}\n routes={subroutes}\n alertManagerSourceName={alertManagerSourceName}\n />\n ) : (\n <p>No nested policies configured.</p>\n )}\n {!isAddMode && !readOnly && (\n <Authorize actions={[permissions.create]}>\n <Button\n className={styles.addNestedRoutingBtn}\n icon=\"plus\"\n onClick={() => {\n setSubroutes((subroutes) => [...subroutes, emptyRoute]);\n setIsAddMode(true);\n }}\n variant=\"secondary\"\n type=\"button\"\n >\n Add nested policy\n </Button>\n </Authorize>\n )}\n </div>\n <div className={gridStyles.titleCell}>Mute timings</div>\n <div className={gridStyles.valueCell}>\n <MuteTimingsTable\n alertManagerSourceName={alertManagerSourceName!}\n muteTimingNames={routes.muteTimeIntervals}\n hideActions\n />\n </div>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n addNestedRoutingBtn: css`\n margin-top: ${theme.spacing(2)};\n `,\n };\n};\n","import { intersectionWith, isEqual } from 'lodash';\nimport React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { Button, ConfirmModal, HorizontalGroup, IconButton } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\n\nimport { AmRouteReceiver, FormAmRoute } from '../../types/amroutes';\nimport { getNotificationsPermissions } from '../../utils/access-control';\nimport { matcherFieldToMatcher, parseMatchers } from '../../utils/alertmanager';\nimport { prepareItems } from '../../utils/dynamicTable';\nimport { DynamicTable, DynamicTableColumnProps, DynamicTableItemProps } from '../DynamicTable';\nimport { EmptyArea } from '../EmptyArea';\nimport { Matchers } from '../silences/Matchers';\n\nimport { AmRoutesExpandedForm } from './AmRoutesExpandedForm';\nimport { AmRoutesExpandedRead } from './AmRoutesExpandedRead';\n\nexport interface AmRoutesTableProps {\n isAddMode: boolean;\n onChange: (routes: FormAmRoute[]) => void;\n onCancelAdd: () => void;\n receivers: AmRouteReceiver[];\n routes: FormAmRoute[];\n filters?: { queryString?: string; contactPoint?: string };\n readOnly?: boolean;\n alertManagerSourceName: string;\n}\n\ntype RouteTableColumnProps = DynamicTableColumnProps<FormAmRoute>;\ntype RouteTableItemProps = DynamicTableItemProps<FormAmRoute>;\n\nexport const getFilteredRoutes = (routes: FormAmRoute[], labelMatcherQuery?: string, contactPointQuery?: string) => {\n const matchers = parseMatchers(labelMatcherQuery ?? '');\n\n let filteredRoutes = routes;\n\n if (matchers.length) {\n filteredRoutes = routes.filter((route) => {\n const routeMatchers = route.object_matchers.map(matcherFieldToMatcher);\n return intersectionWith(routeMatchers, matchers, isEqual).length > 0;\n });\n }\n\n if (contactPointQuery && contactPointQuery.length > 0) {\n filteredRoutes = filteredRoutes.filter((route) =>\n route.receiver.toLowerCase().includes(contactPointQuery.toLowerCase())\n );\n }\n\n return filteredRoutes;\n};\n\nexport const updatedRoute = (routes: FormAmRoute[], updatedRoute: FormAmRoute): FormAmRoute[] => {\n const newRoutes = [...routes];\n const editIndex = newRoutes.findIndex((route) => route.id === updatedRoute.id);\n\n if (editIndex >= 0) {\n newRoutes[editIndex] = {\n ...newRoutes[editIndex],\n ...updatedRoute,\n };\n }\n return newRoutes;\n};\n\nexport const deleteRoute = (routes: FormAmRoute[], routeId: string): FormAmRoute[] => {\n return routes.filter((route) => route.id !== routeId);\n};\n\nexport const AmRoutesTable: FC<AmRoutesTableProps> = ({\n isAddMode,\n onCancelAdd,\n onChange,\n receivers,\n routes,\n filters,\n readOnly = false,\n alertManagerSourceName,\n}) => {\n const [editMode, setEditMode] = useState(false);\n const [deletingRouteId, setDeletingRouteId] = useState<string | undefined>(undefined);\n const [expandedId, setExpandedId] = useState<string | number>();\n const permissions = getNotificationsPermissions(alertManagerSourceName);\n const canEditRoutes = contextSrv.hasPermission(permissions.update);\n const canDeleteRoutes = contextSrv.hasPermission(permissions.delete);\n\n const showActions = !readOnly && (canEditRoutes || canDeleteRoutes);\n\n const expandItem = useCallback((item: RouteTableItemProps) => setExpandedId(item.id), []);\n const collapseItem = useCallback(() => setExpandedId(undefined), []);\n\n const cols: RouteTableColumnProps[] = [\n {\n id: 'matchingCriteria',\n label: 'Matching labels',\n // eslint-disable-next-line react/display-name\n renderCell: (item) => {\n return item.data.object_matchers.length ? (\n <Matchers matchers={item.data.object_matchers.map(matcherFieldToMatcher)} />\n ) : (\n <span>Matches all alert instances</span>\n );\n },\n size: 10,\n },\n {\n id: 'groupBy',\n label: 'Group by',\n renderCell: (item) => (item.data.overrideGrouping && item.data.groupBy.join(', ')) || '-',\n size: 5,\n },\n {\n id: 'receiverChannel',\n label: 'Contact point',\n renderCell: (item) => item.data.receiver || '-',\n size: 5,\n },\n {\n id: 'muteTimings',\n label: 'Mute timings',\n renderCell: (item) => item.data.muteTimeIntervals.join(', ') || '-',\n size: 5,\n },\n ...(!showActions\n ? []\n : [\n {\n id: 'actions',\n label: 'Actions',\n // eslint-disable-next-line react/display-name\n renderCell: (item) => {\n if (item.renderExpandedContent) {\n return null;\n }\n\n const expandWithCustomContent = () => {\n expandItem(item);\n setEditMode(true);\n };\n\n return (\n <>\n <HorizontalGroup>\n <Button\n aria-label=\"Edit route\"\n icon=\"pen\"\n onClick={expandWithCustomContent}\n size=\"sm\"\n type=\"button\"\n variant=\"secondary\"\n >\n Edit\n </Button>\n <IconButton\n aria-label=\"Delete route\"\n name=\"trash-alt\"\n onClick={() => {\n setDeletingRouteId(item.data.id);\n }}\n type=\"button\"\n />\n </HorizontalGroup>\n </>\n );\n },\n size: '100px',\n } as RouteTableColumnProps,\n ]),\n ];\n\n const filteredRoutes = useMemo(\n () => getFilteredRoutes(routes, filters?.queryString, filters?.contactPoint),\n [routes, filters]\n );\n\n const dynamicTableRoutes = useMemo(\n () => prepareItems(isAddMode ? routes : filteredRoutes),\n [isAddMode, routes, filteredRoutes]\n );\n\n // expand the last item when adding or reset when the length changed\n useEffect(() => {\n if (isAddMode && dynamicTableRoutes.length) {\n setExpandedId(dynamicTableRoutes[dynamicTableRoutes.length - 1].id);\n }\n if (!isAddMode && dynamicTableRoutes.length) {\n setExpandedId(undefined);\n }\n }, [isAddMode, dynamicTableRoutes]);\n\n if (routes.length > 0 && filteredRoutes.length === 0) {\n return (\n <EmptyArea>\n <p>No policies found</p>\n </EmptyArea>\n );\n }\n\n return (\n <>\n <DynamicTable\n cols={cols}\n isExpandable={true}\n items={dynamicTableRoutes}\n testIdGenerator={() => 'am-routes-row'}\n onCollapse={collapseItem}\n onExpand={expandItem}\n isExpanded={(item) => expandedId === item.id}\n renderExpandedContent={(item: RouteTableItemProps) =>\n isAddMode || editMode ? (\n <AmRoutesExpandedForm\n onCancel={() => {\n if (isAddMode) {\n onCancelAdd();\n }\n setEditMode(false);\n }}\n onSave={(data) => {\n const newRoutes = updatedRoute(routes, data);\n\n setEditMode(false);\n onChange(newRoutes);\n }}\n receivers={receivers}\n routes={item.data}\n />\n ) : (\n <AmRoutesExpandedRead\n onChange={(data) => {\n const newRoutes = updatedRoute(routes, data);\n onChange(newRoutes);\n }}\n receivers={receivers}\n routes={item.data}\n readOnly={readOnly}\n alertManagerSourceName={alertManagerSourceName}\n />\n )\n }\n />\n <ConfirmModal\n isOpen={!!deletingRouteId}\n title=\"Delete notification policy\"\n body=\"Deleting this notification policy will permanently remove it. Are you sure you want to delete this policy?\"\n confirmText=\"Yes, delete\"\n icon=\"exclamation-triangle\"\n onConfirm={() => {\n if (deletingRouteId) {\n const newRoutes = deleteRoute(routes, deletingRouteId);\n onChange(newRoutes);\n setDeletingRouteId(undefined);\n }\n }}\n onDismiss={() => setDeletingRouteId(undefined)}\n />\n </>\n );\n};\n","import { DynamicTableItemProps } from '../components/DynamicTable';\n\nexport const prepareItems = <T = unknown>(\n items: T[],\n idCreator?: (item: T) => number | string\n): Array<DynamicTableItemProps<T>> =>\n items.map((item, index) => ({\n id: idCreator?.(item) ?? index,\n data: item,\n }));\n","import { css } from '@emotion/css';\nimport React, { FC, useState } from 'react';\nimport { useDebounce } from 'react-use';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, Icon, Input, Label, useStyles2 } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\n\nimport { Authorize } from '../../components/Authorize';\nimport { useURLSearchParams } from '../../hooks/useURLSearchParams';\nimport { AmRouteReceiver, FormAmRoute } from '../../types/amroutes';\nimport { getNotificationsPermissions } from '../../utils/access-control';\nimport { emptyArrayFieldMatcher, emptyRoute } from '../../utils/amroutes';\nimport { getNotificationPoliciesFilters } from '../../utils/misc';\nimport { EmptyArea } from '../EmptyArea';\nimport { EmptyAreaWithCTA } from '../EmptyAreaWithCTA';\nimport { MatcherFilter } from '../alert-groups/MatcherFilter';\n\nimport { AmRoutesTable } from './AmRoutesTable';\n\nexport interface AmSpecificRoutingProps {\n alertManagerSourceName: string;\n onChange: (routes: FormAmRoute) => void;\n onRootRouteEdit: () => void;\n receivers: AmRouteReceiver[];\n routes: FormAmRoute;\n readOnly?: boolean;\n}\n\ninterface Filters {\n queryString?: string;\n contactPoint?: string;\n}\n\nexport const AmSpecificRouting: FC<AmSpecificRoutingProps> = ({\n alertManagerSourceName,\n onChange,\n onRootRouteEdit,\n receivers,\n routes,\n readOnly = false,\n}) => {\n const [actualRoutes, setActualRoutes] = useState([...routes.routes]);\n const [isAddMode, setIsAddMode] = useState(false);\n const permissions = getNotificationsPermissions(alertManagerSourceName);\n const canCreateNotifications = contextSrv.hasPermission(permissions.create);\n\n const [searchParams, setSearchParams] = useURLSearchParams();\n const { queryString, contactPoint } = getNotificationPoliciesFilters(searchParams);\n\n const [filters, setFilters] = useState<Filters>({ queryString, contactPoint });\n\n useDebounce(\n () => {\n setSearchParams({ queryString: filters.queryString, contactPoint: filters.contactPoint });\n },\n 400,\n [filters]\n );\n\n const styles = useStyles2(getStyles);\n\n const clearFilters = () => {\n setFilters({ queryString: undefined, contactPoint: undefined });\n setSearchParams({ queryString: undefined, contactPoint: undefined });\n };\n\n const addNewRoute = () => {\n clearFilters();\n setIsAddMode(true);\n setActualRoutes(() => [\n ...routes.routes,\n {\n ...emptyRoute,\n matchers: [emptyArrayFieldMatcher],\n },\n ]);\n };\n\n const onCancelAdd = () => {\n setIsAddMode(false);\n setActualRoutes([...routes.routes]);\n };\n\n const onTableRouteChange = (newRoutes: FormAmRoute[]): void => {\n onChange({\n ...routes,\n routes: newRoutes,\n });\n\n if (isAddMode) {\n setIsAddMode(false);\n }\n };\n return (\n <div className={styles.container}>\n <h5>Specific routing</h5>\n <p>Send specific alerts to chosen contact points, based on matching criteria</p>\n {!routes.receiver ? (\n readOnly ? (\n <EmptyArea>\n <p>There is no default contact point configured for the root route.</p>\n </EmptyArea>\n ) : (\n <EmptyAreaWithCTA\n buttonIcon=\"rocket\"\n buttonLabel=\"Set a default contact point\"\n onButtonClick={onRootRouteEdit}\n text=\"You haven't set a default contact point for the root route yet.\"\n showButton={canCreateNotifications}\n />\n )\n ) : actualRoutes.length > 0 ? (\n <>\n <div>\n {!isAddMode && (\n <div className={styles.searchContainer}>\n <MatcherFilter\n onFilterChange={(filter) =>\n setFilters((currentFilters) => ({ ...currentFilters, queryString: filter }))\n }\n queryString={filters.queryString ?? ''}\n className={styles.filterInput}\n />\n <div className={styles.filterInput}>\n <Label>Search by contact point</Label>\n <Input\n onChange={({ currentTarget }) =>\n setFilters((currentFilters) => ({ ...currentFilters, contactPoint: currentTarget.value }))\n }\n value={filters.contactPoint ?? ''}\n placeholder=\"Search by contact point\"\n data-testid=\"search-query-input\"\n prefix={<Icon name={'search'} />}\n />\n </div>\n {(queryString || contactPoint) && (\n <Button variant=\"secondary\" icon=\"times\" onClick={clearFilters} className={styles.clearFilterBtn}>\n Clear filters\n </Button>\n )}\n </div>\n )}\n\n {!isAddMode && !readOnly && (\n <Authorize actions={[permissions.create]}>\n <div className={styles.addMatcherBtnRow}>\n <Button className={styles.addMatcherBtn} icon=\"plus\" onClick={addNewRoute} type=\"button\">\n New policy\n </Button>\n </div>\n </Authorize>\n )}\n </div>\n <AmRoutesTable\n isAddMode={isAddMode}\n readOnly={readOnly}\n onCancelAdd={onCancelAdd}\n onChange={onTableRouteChange}\n receivers={receivers}\n routes={actualRoutes}\n filters={{ queryString, contactPoint }}\n alertManagerSourceName={alertManagerSourceName}\n />\n </>\n ) : readOnly ? (\n <EmptyArea>\n <p>There are no specific policies configured.</p>\n </EmptyArea>\n ) : (\n <EmptyAreaWithCTA\n buttonIcon=\"plus\"\n buttonLabel=\"New specific policy\"\n onButtonClick={addNewRoute}\n text=\"You haven't created any specific policies yet.\"\n showButton={canCreateNotifications}\n />\n )}\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n container: css`\n display: flex;\n flex-flow: column wrap;\n `,\n searchContainer: css`\n display: flex;\n flex-flow: row nowrap;\n padding-bottom: ${theme.spacing(2)};\n border-bottom: 1px solid ${theme.colors.border.strong};\n `,\n clearFilterBtn: css`\n align-self: flex-end;\n margin-left: ${theme.spacing(1)};\n `,\n filterInput: css`\n width: 340px;\n & + & {\n margin-left: ${theme.spacing(1)};\n }\n `,\n addMatcherBtnRow: css`\n display: flex;\n flex-flow: column nowrap;\n padding: ${theme.spacing(2)} 0;\n `,\n addMatcherBtn: css`\n align-self: flex-end;\n `,\n };\n};\n","import { css } from '@emotion/css';\nimport React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Alert, LoadingPlaceholder, useStyles2, withErrorBoundary } from '@grafana/ui';\nimport { Receiver } from 'app/plugins/datasource/alertmanager/types';\n\nimport { useCleanup } from '../../../core/hooks/useCleanup';\n\nimport { AlertManagerPicker } from './components/AlertManagerPicker';\nimport { AlertingPageWrapper } from './components/AlertingPageWrapper';\nimport { NoAlertManagerWarning } from './components/NoAlertManagerWarning';\nimport { AmRootRoute } from './components/amroutes/AmRootRoute';\nimport { AmSpecificRouting } from './components/amroutes/AmSpecificRouting';\nimport { MuteTimingsTable } from './components/amroutes/MuteTimingsTable';\nimport { useAlertManagerSourceName } from './hooks/useAlertManagerSourceName';\nimport { useAlertManagersByPermission } from './hooks/useAlertManagerSources';\nimport { useUnifiedAlertingSelector } from './hooks/useUnifiedAlertingSelector';\nimport { fetchAlertManagerConfigAction, updateAlertManagerConfigAction } from './state/actions';\nimport { AmRouteReceiver, FormAmRoute } from './types/amroutes';\nimport { amRouteToFormAmRoute, formAmRouteToAmRoute, stringsToSelectableValues } from './utils/amroutes';\nimport { isVanillaPrometheusAlertManagerDataSource } from './utils/datasource';\nimport { initialAsyncRequestState } from './utils/redux';\n\nconst AmRoutes: FC = () => {\n const dispatch = useDispatch();\n const styles = useStyles2(getStyles);\n const [isRootRouteEditMode, setIsRootRouteEditMode] = useState(false);\n const alertManagers = useAlertManagersByPermission('notification');\n const [alertManagerSourceName, setAlertManagerSourceName] = useAlertManagerSourceName(alertManagers);\n\n const readOnly = alertManagerSourceName ? isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName) : true;\n\n const amConfigs = useUnifiedAlertingSelector((state) => state.amConfigs);\n\n const fetchConfig = useCallback(() => {\n if (alertManagerSourceName) {\n dispatch(fetchAlertManagerConfigAction(alertManagerSourceName));\n }\n }, [alertManagerSourceName, dispatch]);\n\n useEffect(() => {\n fetchConfig();\n }, [fetchConfig]);\n\n const {\n result,\n loading: resultLoading,\n error: resultError,\n } = (alertManagerSourceName && amConfigs[alertManagerSourceName]) || initialAsyncRequestState;\n\n const config = result?.alertmanager_config;\n const [rootRoute, id2ExistingRoute] = useMemo(() => amRouteToFormAmRoute(config?.route), [config?.route]);\n\n const receivers = stringsToSelectableValues(\n (config?.receivers ?? []).map((receiver: Receiver) => receiver.name)\n ) as AmRouteReceiver[];\n\n const enterRootRouteEditMode = () => {\n setIsRootRouteEditMode(true);\n };\n\n const exitRootRouteEditMode = () => {\n setIsRootRouteEditMode(false);\n };\n\n useCleanup((state) => state.unifiedAlerting.saveAMConfig);\n const handleSave = (data: Partial<FormAmRoute>) => {\n if (!result) {\n return;\n }\n\n const newData = formAmRouteToAmRoute(\n alertManagerSourceName,\n {\n ...rootRoute,\n ...data,\n },\n id2ExistingRoute\n );\n\n if (isRootRouteEditMode) {\n exitRootRouteEditMode();\n }\n\n dispatch(\n updateAlertManagerConfigAction({\n newConfig: {\n ...result,\n alertmanager_config: {\n ...result.alertmanager_config,\n route: newData,\n },\n },\n oldConfig: result,\n alertManagerSourceName: alertManagerSourceName!,\n successMessage: 'Saved',\n refetch: true,\n })\n );\n };\n\n if (!alertManagerSourceName) {\n return (\n <AlertingPageWrapper pageId=\"am-routes\">\n <NoAlertManagerWarning availableAlertManagers={alertManagers} />\n </AlertingPageWrapper>\n );\n }\n\n return (\n <AlertingPageWrapper pageId=\"am-routes\">\n <AlertManagerPicker\n current={alertManagerSourceName}\n onChange={setAlertManagerSourceName}\n dataSources={alertManagers}\n />\n {resultError && !resultLoading && (\n <Alert severity=\"error\" title=\"Error loading Alertmanager config\">\n {resultError.message || 'Unknown error.'}\n </Alert>\n )}\n {resultLoading && <LoadingPlaceholder text=\"Loading Alertmanager config...\" />}\n {result && !resultLoading && !resultError && (\n <>\n <AmRootRoute\n alertManagerSourceName={alertManagerSourceName}\n isEditMode={isRootRouteEditMode}\n onSave={handleSave}\n onEnterEditMode={enterRootRouteEditMode}\n onExitEditMode={exitRootRouteEditMode}\n receivers={receivers}\n routes={rootRoute}\n />\n <div className={styles.break} />\n <AmSpecificRouting\n alertManagerSourceName={alertManagerSourceName}\n onChange={handleSave}\n readOnly={readOnly}\n onRootRouteEdit={enterRootRouteEditMode}\n receivers={receivers}\n routes={rootRoute}\n />\n <div className={styles.break} />\n <MuteTimingsTable alertManagerSourceName={alertManagerSourceName} />\n </>\n )}\n </AlertingPageWrapper>\n );\n};\n\nexport default withErrorBoundary(AmRoutes, { style: 'page' });\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n break: css`\n width: 100%;\n height: 0;\n margin-bottom: ${theme.spacing(2)};\n `,\n});\n","import React, { FC } from 'react';\nimport { useSelector } from 'react-redux';\n\nimport Page from 'app/core/components/Page/Page';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types/store';\n\ninterface Props {\n pageId: string;\n isLoading?: boolean;\n}\n\nexport const AlertingPageWrapper: FC<Props> = ({ children, pageId, isLoading }) => {\n const navModel = getNavModel(\n useSelector((state: StoreState) => state.navIndex),\n pageId\n );\n\n return (\n <Page navModel={navModel}>\n <Page.Contents isLoading={isLoading}>{children}</Page.Contents>\n </Page>\n );\n};\n","import React, { FC } from 'react';\n\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AccessControlAction } from 'app/types';\n\ntype Props = {\n actions: AccessControlAction[];\n fallback?: boolean;\n};\n\nexport const Authorize: FC<Props> = ({ actions, children, fallback = true }) => {\n if (actions.some((action) => contextSrv.hasAccess(action, fallback))) {\n return <>{children}</>;\n } else {\n return null;\n }\n};\n","import React from 'react';\n\nimport { Alert } from '@grafana/ui';\n\nimport { useAlertManagerSourceName } from '../hooks/useAlertManagerSourceName';\nimport { AlertManagerDataSource } from '../utils/datasource';\n\nimport { AlertManagerPicker } from './AlertManagerPicker';\n\ninterface Props {\n availableAlertManagers: AlertManagerDataSource[];\n}\n\nconst NoAlertManagersAvailable = () => (\n <Alert title=\"No Alertmanager found\" severity=\"warning\">\n We could not find any external Alertmanagers and you may not have access to the built-in Grafana Alertmanager.\n </Alert>\n);\n\nconst OtherAlertManagersAvailable = () => (\n <Alert title=\"Selected Alertmanager not found. Select a different Alertmanager.\" severity=\"warning\">\n Selected Alertmanager no longer exists or you may not have permission to access it.\n </Alert>\n);\n\nexport const NoAlertManagerWarning = ({ availableAlertManagers }: Props) => {\n const [_, setAlertManagerSourceName] = useAlertManagerSourceName(availableAlertManagers);\n const hasOtherAMs = availableAlertManagers.length > 0;\n\n return (\n <div>\n {hasOtherAMs ? (\n <>\n <AlertManagerPicker onChange={setAlertManagerSourceName} dataSources={availableAlertManagers} />\n <OtherAlertManagersAvailable />\n </>\n ) : (\n <NoAlertManagersAvailable />\n )}\n </div>\n );\n};\n","import { css } from '@emotion/css';\nimport React, { FormEvent } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Stack } from '@grafana/experimental';\nimport { Label, Tooltip, Input, Icon, useStyles2 } from '@grafana/ui';\n\ninterface Props {\n className?: string;\n queryString?: string;\n defaultQueryString?: string;\n onFilterChange: (filterString: string) => void;\n}\n\nexport const MatcherFilter = ({ className, onFilterChange, defaultQueryString, queryString }: Props) => {\n const styles = useStyles2(getStyles);\n const handleSearchChange = (e: FormEvent<HTMLInputElement>) => {\n const target = e.target as HTMLInputElement;\n onFilterChange(target.value);\n };\n const searchIcon = <Icon name={'search'} />;\n return (\n <div className={className}>\n <Label>\n <Stack gap={0.5}>\n <span>Search by label</span>\n <Tooltip\n content={\n <div>\n Filter alerts using label querying, ex:\n <pre>{`{severity=\"critical\", instance=~\"cluster-us-.+\"}`}</pre>\n </div>\n }\n >\n <Icon className={styles.icon} name=\"info-circle\" size=\"sm\" />\n </Tooltip>\n </Stack>\n </Label>\n <Input\n placeholder=\"Search\"\n defaultValue={defaultQueryString}\n value={queryString}\n onChange={handleSearchChange}\n data-testid=\"search-query-input\"\n prefix={searchIcon}\n className={styles.inputWidth}\n />\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n icon: css`\n margin-right: ${theme.spacing(0.5)};\n `,\n inputWidth: css`\n width: 340px;\n flex-grow: 0;\n `,\n});\n","import { 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<MatchersProps> = ({ matchers }) => {\n const styles = useStyles2(getStyles);\n return (\n <div>\n <TagList\n className={styles.tags}\n tags={matchers.map((matcher) => `${matcher.name}${matcherToOperator(matcher)}${matcher.value}`)}\n />\n </div>\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 { 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<string, string | string[] | undefined>, replace?: boolean) => void\n] {\n const { search } = useLocation();\n const queryParams = useMemo(() => new URLSearchParams(search), [search]);\n\n const update = useCallback((searchValues: Record<string, string | string[] | undefined>, replace?: boolean) => {\n locationService.partial(searchValues, replace);\n }, []);\n\n return [queryParams, update];\n}\n"],"names":["useCleanup","stateSelector","dispatch","useDispatch","selectorRef","useRef","current","useEffect","cleanUpAction","defaultValueAndType","matchersToArrayFieldMatchers","matchers","isRegex","Object","entries","reduce","acc","name","value","operator","MatcherOperator","intervalToValueAndType","strValue","defaultValue","valueType","parseInterval","undefined","timeOption","timeOptions","opt","String","selectableValueToString","selectableValue","emptyArrayFieldMatcher","emptyRoute","id","overrideGrouping","groupBy","object_matchers","routes","continue","receiver","overrideTimings","groupWaitValue","groupWaitValueType","groupIntervalValue","groupIntervalValueType","repeatIntervalValue","repeatIntervalValueType","muteTimeIntervals","amRouteToFormAmRoute","route","Math","random","id2route","keys","length","formRoutes","forEach","subRoute","subFormRoute","subId2Route","push","assign","map","matcher","matcherToMatcherField","parseMatcher","group_wait","group_interval","repeat_interval","match","match_re","Array","isArray","group_by","some","Boolean","mute_time_intervals","formAmRouteToAmRoute","alertManagerSourceName","formAmRoute","id2ExistingRoute","existing","amRoute","GRAFANA_RULES_SOURCE_NAME","omitBy","isUndefined","stringToSelectableValue","str","label","stringsToSelectableValues","arr","mapSelectValueToString","mapMultiSelectValueToStrings","selectableValues","optionalPositiveInteger","test","getFormStyles","theme","container","css","spacing","input","timingContainer","smallInput","linkText","collapse","colors","text","primary","AmRootRouteForm","onCancel","onSave","receivers","styles","useStyles2","isTimingOptionsExpanded","setIsTimingOptionsExpanded","useState","groupByOptions","setGroupByOptions","Form","defaultValues","onSubmit","control","errors","setValue","Field","invalid","error","message","className","InputControl","render","field","onChange","Select","options","rules","required","Link","href","makeAMLink","description","MultiSelect","allowCustomValue","onCreateOption","opts","Collapse","collapsible","isOpen","onToggle","cx","fieldState","Input","placeholder","validate","menuPlacement","Button","type","onClick","variant","fill","getGridStyles","typography","fontSize","breakpoints","down","titleCell","valueCell","secondary","AmRootRouteRead","join","groupWait","groupInterval","repeatInterval","AmRootRoute","isEditMode","onEnterEditMode","onExitEditMode","getStyles","permissions","getNotificationsPermissions","isReadOnly","isVanillaPrometheusAlertManagerDataSource","titleContainer","title","Authorize","actions","update","icon","size","background","EmptyArea","children","useStyles","bg2","textSemiWeak","xl","EmptyAreaWithCTA","buttonIcon","buttonLabel","buttonSize","buttonVariant","onButtonClick","showButton","commonProps","button","LinkButton","md","sm","AmRoutesExpandedForm","formStyles","muteTimingOptions","alertManagers","useAlertManagersByPermission","useAlertManagerSourceName","amConfigs","useUnifiedAlertingSelector","state","useMemo","result","initialAsyncRequestState","config","alertmanager_config","time_intervals","interval","timeIntervalToString","useMuteTimingOptions","register","watch","FieldArray","fields","append","remove","VerticalGroup","justify","Badge","color","noMatchersWarning","matchersContainer","index","localPath","HorizontalGroup","align","height","matchersOperator","matcherFieldOptions","IconButton","removeButton","tooltip","addMatcherBtn","Switch","buttonGroup","commonSpacing","nestedPolicies","MuteTimingsTable","muteTimingNames","hideActions","muteTimingName","setMuteTimingName","items","filter","includes","mute","data","columns","userHasEditPermissions","contextSrv","userHasDeletePermissions","delete","showActions","renderCell","renderTimeIntervals","muteName","useColumns","create","addMuteButton","DynamicTable","cols","ConfirmModal","body","confirmText","onConfirm","deleteMuteTimingAction","onDismiss","timeIntervals","times","weekdays","days_of_month","months","years","timeString","getTimeString","weekdayString","getWeekdayString","daysString","getDaysOfMonthString","monthsString","getMonthsString","yearsString","getYearsString","JSON","stringify","AmRoutesExpandedRead","readOnly","gridStyles","subroutes","setSubroutes","isAddMode","setIsAddMode","AmRoutesTable","onCancelAdd","newSubroutes","pop","newRoutes","addNestedRoutingBtn","updatedRoute","editIndex","findIndex","filters","editMode","setEditMode","deletingRouteId","setDeletingRouteId","expandedId","setExpandedId","canEditRoutes","canDeleteRoutes","expandItem","useCallback","item","collapseItem","Matchers","matcherFieldToMatcher","renderExpandedContent","filteredRoutes","labelMatcherQuery","contactPointQuery","parseMatchers","routeMatchers","intersectionWith","isEqual","toLowerCase","getFilteredRoutes","queryString","contactPoint","dynamicTableRoutes","prepareItems","idCreator","isExpandable","testIdGenerator","onCollapse","onExpand","isExpanded","routeId","deleteRoute","AmSpecificRouting","onRootRouteEdit","actualRoutes","setActualRoutes","canCreateNotifications","searchParams","setSearchParams","useURLSearchParams","getNotificationPoliciesFilters","setFilters","useDebounce","clearFilters","addNewRoute","searchContainer","MatcherFilter","onFilterChange","currentFilters","filterInput","Label","currentTarget","prefix","Icon","clearFilterBtn","addMatcherBtnRow","border","strong","withErrorBoundary","isRootRouteEditMode","setIsRootRouteEditMode","setAlertManagerSourceName","fetchConfig","fetchAlertManagerConfigAction","loading","resultLoading","resultError","rootRoute","enterRootRouteEditMode","exitRootRouteEditMode","unifiedAlerting","saveAMConfig","handleSave","newData","updateAlertManagerConfigAction","newConfig","oldConfig","successMessage","refetch","AlertingPageWrapper","pageId","AlertManagerPicker","dataSources","Alert","severity","LoadingPlaceholder","break","NoAlertManagerWarning","availableAlertManagers","style","isLoading","navModel","getNavModel","useSelector","navIndex","fallback","action","NoAlertManagersAvailable","OtherAlertManagersAvailable","_","hasOtherAMs","defaultQueryString","searchIcon","Stack","gap","Tooltip","content","e","target","inputWidth","TagList","tags","matcherToOperator","queryParams","updateQueryParams","useQueryParams","isAlertManagerAvailable","alertManagerName","am","useIsAlertManagerAvailable","store","ALERTMANAGER_NAME_LOCAL_STORAGE_KEY","ALERTMANAGER_NAME_QUERY_KEY","querySource","storeSource","accessType","getAlertManagerDataSourcesByPermission","search","useLocation","URLSearchParams","searchValues","replace","locationService"],"sourceRoot":""}
|