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C,IACzCD,EAAqB,IAAKR,GAC3BS,EACK,CACL,MAAOT,EAAQ,MACf,MAAOA,EAAQ,MACf,YAAaA,EAAQ,WACvB,EAEK,CACL,MAAOA,EAAQ,MACf,MAAOA,EAAQ,KACjB,CACD,CAEL,EAEaU,EAAuB9E,GAAqC,CAKvE,MAAM+E,EAAW,OAAO,YACtB,OAAO,QAAQ/E,EAAS,QAAQ,EAAE,IAAI,CAAC,CAACmC,EAAKR,CAAK,IACzC,CAACQ,EAAKR,GAASA,EAAM,eAAe,OAAO,EAAIA,EAAM,MAAQA,CAAK,CAC1E,CACH,EAEA,MAAO,CACL,GAAG+C,EACH,GAAG1E,EACH,UAAWA,EAAS,YAAc,GAAK0E,EAAc,UAAY1E,EAAS,UAC1E,KAAMA,EAAS,KAAK,MACpB,SAAU,CAAE,GAAG0E,EAAc,SAAU,GAAGK,CAAS,EACnD,eAAgB,CAAE,GAAG/E,EAAS,cAAe,CAC/C,CACF,EAEagF,EAAqBhF,IACzB,CACL,KAAMA,EAAS,KACf,KAAMA,EAAS,KAAK,MACpB,UAAWA,EAAS,WAAa0E,EAAc,UAC/C,SAAU,CAAE,GAAG,OAAO,OAAOA,EAAc,SAAU1E,EAAS,QAAQ,CAAE,EACxE,eAAgB,CAAE,GAAGA,EAAS,cAAe,CAC/C,E","sources":["webpack://grafana/./public/app/core/components/connectWithCleanUp.tsx","webpack://grafana/./public/app/features/alerting/EditNotificationChannelPage.tsx","webpack://grafana/./public/app/features/alerting/components/OptionElement.tsx","webpack://grafana/./public/app/features/alerting/components/NotificationChannelOptions.tsx","webpack://grafana/./public/app/features/alerting/components/BasicSettings.tsx","webpack://grafana/./public/app/features/alerting/components/ChannelSettings.tsx","webpack://grafana/./public/app/features/alerting/components/NotificationSettings.tsx","webpack://grafana/./public/app/features/alerting/components/NotificationChannelForm.tsx","webpack://grafana/./public/app/features/alerting/state/actions.ts","webpack://grafana/./public/app/features/alerting/utils/notificationChannels.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport React, { ComponentType, FunctionComponent, useEffect } from 'react';\nimport { connect, MapDispatchToPropsParam, MapStateToPropsParam } from 'react-redux';\n\nimport { useDispatch } from 'app/types';\n\nimport { cleanUpAction, CleanUpAction } from '../actions/cleanUp';\n\nexport const connectWithCleanUp =\n (\n mapStateToProps: MapStateToPropsParam,\n mapDispatchToProps: MapDispatchToPropsParam,\n cleanupAction: CleanUpAction\n ) =>\n (Component: ComponentType) => {\n const ConnectedComponent = connect(\n mapStateToProps,\n mapDispatchToProps\n // @ts-ignore\n )(Component);\n\n const ConnectedComponentWithCleanUp: FunctionComponent = (props) => {\n const dispatch = useDispatch();\n useEffect(() => {\n return function cleanUp() {\n dispatch(cleanUpAction({ cleanupAction: cleanupAction }));\n };\n }, [dispatch]);\n // @ts-ignore\n return ;\n };\n\n ConnectedComponentWithCleanUp.displayName = `ConnectWithCleanUp(${ConnectedComponent.displayName})`;\n hoistNonReactStatics(ConnectedComponentWithCleanUp, Component);\n type Hoisted = typeof ConnectedComponentWithCleanUp & Statics;\n\n return ConnectedComponentWithCleanUp as Hoisted;\n };\n","import React, { PureComponent } from 'react';\nimport { MapDispatchToProps, MapStateToProps } from 'react-redux';\n\nimport { config } from '@grafana/runtime';\nimport { Form, Spinner } from '@grafana/ui';\nimport { Page } from 'app/core/components/Page/Page';\nimport { connectWithCleanUp } from 'app/core/components/connectWithCleanUp';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\nimport { NotificationChannelType, NotificationChannelDTO, StoreState } from 'app/types';\n\nimport { NotificationChannelForm } from './components/NotificationChannelForm';\nimport { loadNotificationChannel, testNotificationChannel, updateNotificationChannel } from './state/actions';\nimport { initialChannelState, resetSecureField } from './state/reducers';\nimport { mapChannelsToSelectableValue, transformSubmitData, transformTestData } from './utils/notificationChannels';\n\ninterface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {}\n\ninterface ConnectedProps {\n notificationChannel: any;\n notificationChannelTypes: NotificationChannelType[];\n}\n\ninterface DispatchProps {\n loadNotificationChannel: typeof loadNotificationChannel;\n testNotificationChannel: typeof testNotificationChannel;\n updateNotificationChannel: typeof updateNotificationChannel;\n resetSecureField: typeof resetSecureField;\n}\n\ntype Props = OwnProps & ConnectedProps & DispatchProps;\n\nexport class EditNotificationChannelPage extends PureComponent {\n componentDidMount() {\n this.props.loadNotificationChannel(parseInt(this.props.match.params.id, 10));\n }\n\n onSubmit = (formData: NotificationChannelDTO) => {\n const { notificationChannel } = this.props;\n\n this.props.updateNotificationChannel({\n /*\n Some settings which lives in a collapsed section will not be registered since\n the section will not be rendered if a user doesn't expand it. Therefore we need to\n merge the initialData with any changes from the form.\n */\n ...transformSubmitData({\n ...notificationChannel,\n ...formData,\n settings: { ...notificationChannel.settings, ...formData.settings },\n }),\n id: notificationChannel.id,\n });\n };\n\n onTestChannel = (formData: NotificationChannelDTO) => {\n const { notificationChannel } = this.props;\n /*\n Same as submit\n */\n this.props.testNotificationChannel(\n transformTestData({\n ...notificationChannel,\n ...formData,\n settings: { ...notificationChannel.settings, ...formData.settings },\n })\n );\n };\n\n render() {\n const { notificationChannel, notificationChannelTypes } = this.props;\n\n return (\n \n \n

Edit notification channel

\n {notificationChannel && notificationChannel.id > 0 ? (\n n.value === notificationChannel.type),\n }}\n >\n {({ control, errors, getValues, register, watch }) => {\n const selectedChannel = notificationChannelTypes.find((c) => c.value === getValues().type.value);\n\n return (\n \n );\n }}\n \n ) : (\n
\n Loading notification channel\n \n
\n )}\n
\n
\n );\n }\n}\n\nconst mapStateToProps: MapStateToProps = (state) => {\n return {\n notificationChannel: state.notificationChannel.notificationChannel,\n notificationChannelTypes: state.notificationChannel.notificationChannelTypes,\n };\n};\n\nconst mapDispatchToProps: MapDispatchToProps = {\n loadNotificationChannel,\n testNotificationChannel,\n updateNotificationChannel,\n resetSecureField,\n};\n\nexport default connectWithCleanUp(\n mapStateToProps,\n mapDispatchToProps,\n (state) => (state.notificationChannel = initialChannelState)\n)(EditNotificationChannelPage);\n","import React from 'react';\nimport { Controller, UseFormReturn } from 'react-hook-form';\n\nimport { Input, Select, TextArea } from '@grafana/ui';\n\nimport { NotificationChannelOption } from '../../../types';\n\ninterface Props extends Pick, 'register' | 'control'> {\n option: NotificationChannelOption;\n invalid?: boolean;\n}\n\nexport const OptionElement = ({ control, option, register, invalid }: Props) => {\n const modelValue = option.secure ? `secureSettings.${option.propertyName}` : `settings.${option.propertyName}`;\n switch (option.element) {\n case 'input':\n return (\n (option.validationRule !== '' ? validateOption(v, option.validationRule) : true),\n })}\n invalid={invalid}\n type={option.inputType}\n placeholder={option.placeholder}\n />\n );\n\n case 'select':\n return (\n (\n \n \n \n \n \n \n )}\n \n );\n};\n","import { css } from '@emotion/css';\nimport React, { useEffect } from 'react';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Button, FormAPI, HorizontalGroup, Spinner, useStyles2 } from '@grafana/ui';\nimport config from 'app/core/config';\n\nimport { NotificationChannelType, NotificationChannelDTO, NotificationChannelSecureFields } from '../../../types';\n\nimport { BasicSettings } from './BasicSettings';\nimport { ChannelSettings } from './ChannelSettings';\nimport { NotificationSettings } from './NotificationSettings';\n\ninterface Props\n extends Pick, 'control' | 'errors' | 'register' | 'watch' | 'getValues'> {\n selectableChannels: Array>;\n selectedChannel?: NotificationChannelType;\n imageRendererAvailable: boolean;\n secureFields: NotificationChannelSecureFields;\n resetSecureField: (key: string) => void;\n onTestChannel: (data: NotificationChannelDTO) => void;\n}\n\nexport interface NotificationSettingsProps\n extends Pick, 'control' | 'errors' | 'register'> {\n currentFormValues: NotificationChannelDTO;\n}\n\nexport const NotificationChannelForm = ({\n control,\n errors,\n selectedChannel,\n selectableChannels,\n register,\n watch,\n getValues,\n imageRendererAvailable,\n onTestChannel,\n resetSecureField,\n secureFields,\n}: Props) => {\n const styles = useStyles2(getStyles);\n\n useEffect(() => {\n /*\n Find fields that have dependencies on other fields and removes duplicates.\n Needs to be prefixed with settings.\n */\n const fieldsToWatch =\n new Set(\n selectedChannel?.options\n .filter((o) => o.showWhen.field)\n .map((option) => {\n return `settings.${option.showWhen.field}`;\n })\n ) || [];\n watch(['type', 'sendReminder', 'uploadImage', ...fieldsToWatch]);\n }, [selectedChannel?.options, watch]);\n\n const currentFormValues = getValues();\n\n if (!selectedChannel) {\n return ;\n }\n\n return (\n
\n
\n \n
\n {/* If there are no non-required fields, don't render this section*/}\n {selectedChannel.options.filter((o) => !o.required).length > 0 && (\n
\n \n
\n )}\n
\n \n
\n
\n \n \n \n \n \n \n \n
\n
\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n formContainer: css``,\n formItem: css`\n flex-grow: 1;\n padding-top: ${theme.spacing(2)};\n `,\n formButtons: css`\n padding-top: ${theme.spacing(4)};\n `,\n };\n};\n","import { getBackendSrv, isFetchError, locationService } from '@grafana/runtime';\nimport { notifyApp } from 'app/core/actions';\nimport { createErrorNotification, createSuccessNotification } from 'app/core/copy/appNotification';\nimport { AlertRuleDTO, NotifierDTO, ThunkResult } from 'app/types';\n\nimport { loadAlertRules, loadedAlertRules, notificationChannelLoaded, setNotificationChannels } from './reducers';\n\nexport function getAlertRulesAsync(options: { state: string }): ThunkResult {\n return async (dispatch) => {\n dispatch(loadAlertRules());\n const rules: AlertRuleDTO[] = await getBackendSrv().get('/api/alerts', options);\n dispatch(loadedAlertRules(rules));\n };\n}\n\nexport function togglePauseAlertRule(id: number, options: { paused: boolean }): ThunkResult {\n return async (dispatch) => {\n await getBackendSrv().post(`/api/alerts/${id}/pause`, options);\n const stateFilter = locationService.getSearchObject().state || 'all';\n dispatch(getAlertRulesAsync({ state: stateFilter.toString() }));\n };\n}\n\nexport function createNotificationChannel(data: any): ThunkResult> {\n return async (dispatch) => {\n try {\n await getBackendSrv().post(`/api/alert-notifications`, data);\n dispatch(notifyApp(createSuccessNotification('Notification created')));\n locationService.push('/alerting-legacy/notifications');\n } catch (error) {\n if (isFetchError(error)) {\n dispatch(notifyApp(createErrorNotification(error.data.error)));\n }\n }\n };\n}\n\nexport function updateNotificationChannel(data: any): ThunkResult {\n return async (dispatch) => {\n try {\n await getBackendSrv().put(`/api/alert-notifications/${data.id}`, data);\n dispatch(notifyApp(createSuccessNotification('Notification updated')));\n } catch (error) {\n if (isFetchError(error)) {\n dispatch(notifyApp(createErrorNotification(error.data.error)));\n }\n }\n };\n}\n\nexport function testNotificationChannel(data: any): ThunkResult {\n return async (dispatch, getState) => {\n const channel = getState().notificationChannel.notificationChannel;\n await getBackendSrv().post('/api/alert-notifications/test', { id: channel.id, ...data });\n };\n}\n\nexport function loadNotificationTypes(): ThunkResult {\n return async (dispatch) => {\n const alertNotifiers: NotifierDTO[] = await getBackendSrv().get(`/api/alert-notifiers-legacy`);\n\n const notificationTypes = alertNotifiers.sort((o1, o2) => {\n if (o1.name > o2.name) {\n return 1;\n }\n return -1;\n });\n\n dispatch(setNotificationChannels(notificationTypes));\n };\n}\n\nexport function loadNotificationChannel(id: number): ThunkResult {\n return async (dispatch) => {\n await dispatch(loadNotificationTypes());\n const notificationChannel = await getBackendSrv().get(`/api/alert-notifications/${id}`);\n dispatch(notificationChannelLoaded(notificationChannel));\n };\n}\n","import memoizeOne from 'memoize-one';\n\nimport { SelectableValue } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { NotificationChannelDTO, NotificationChannelType } from 'app/types';\n\nexport const defaultValues: NotificationChannelDTO = {\n id: -1,\n name: '',\n type: { value: 'email', label: 'Email' },\n sendReminder: false,\n disableResolveMessage: false,\n frequency: '15m',\n settings: {\n uploadImage: config.rendererAvailable,\n autoResolve: true,\n httpMethod: 'POST',\n severity: 'critical',\n },\n secureSettings: {},\n secureFields: {},\n isDefault: false,\n};\n\nexport const mapChannelsToSelectableValue = memoizeOne(\n (notificationChannels: NotificationChannelType[], includeDescription: boolean): Array> => {\n return notificationChannels.map((channel) => {\n if (includeDescription) {\n return {\n value: channel.value,\n label: channel.label,\n description: channel.description,\n };\n }\n return {\n value: channel.value,\n label: channel.label,\n };\n });\n }\n);\n\nexport const transformSubmitData = (formData: NotificationChannelDTO) => {\n /*\n Some settings can be options in a select, in order to not save a SelectableValue\n we need to use check if it is a SelectableValue and use its value.\n */\n const settings = Object.fromEntries(\n Object.entries(formData.settings).map(([key, value]) => {\n return [key, value && value.hasOwnProperty('value') ? value.value : value];\n })\n );\n\n return {\n ...defaultValues,\n ...formData,\n frequency: formData.frequency === '' ? defaultValues.frequency : formData.frequency,\n type: formData.type.value,\n settings: { ...defaultValues.settings, ...settings },\n secureSettings: { ...formData.secureSettings },\n };\n};\n\nexport const transformTestData = (formData: NotificationChannelDTO) => {\n return {\n name: formData.name,\n type: formData.type.value,\n frequency: formData.frequency ?? defaultValues.frequency,\n settings: { ...Object.assign(defaultValues.settings, formData.settings) },\n secureSettings: { ...formData.secureSettings },\n };\n};\n"],"names":["connectWithCleanUp","mapStateToProps","mapDispatchToProps","cleanupAction","Component","ConnectedComponent","ConnectedComponentWithCleanUp","props","dispatch","EditNotificationChannelPage","formData","notificationChannel","notificationChannelTypes","Page","Form","n","control","errors","getValues","register","watch","selectedChannel","c","NotificationChannelForm","config","Spinner","state","OptionElement","option","invalid","modelValue","Input","validateOption","ref","field","Select","TextArea","value","validationRule","NotificationChannelOptions","currentFormValues","selectedChannelOptions","onResetSecureField","secureFields","index","key","selectedOptionValue","Field","Checkbox","Button","BasicSettings","channels","resetSecureField","o","ChannelSettings","CollapsableSection","Alert","NotificationSettings","imageRendererAvailable","InfoBox","selectableChannels","onTestChannel","styles","getStyles","fieldsToWatch","theme","getAlertRulesAsync","options","rules","togglePauseAlertRule","id","stateFilter","createNotificationChannel","data","error","updateNotificationChannel","testNotificationChannel","getState","channel","loadNotificationTypes","notificationTypes","o1","o2","loadNotificationChannel","defaultValues","mapChannelsToSelectableValue","notificationChannels","includeDescription","transformSubmitData","settings","transformTestData"],"sourceRoot":""}