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AAQzH,MACfqD,MAAOoE,EAAQpE,WAMV1E,EAAuBJ,IAKlC,MAAMK,EAAW8J,OAAOC,YACtBD,OAAOE,QAAQrK,EAASK,UAAUsE,KAAI,IAAkB,IAAhBE,EAAKpD,GAAW,EACtD,MAAO,CAACoD,EAAKpD,GAASA,EAAM6I,eAAe,SAAW7I,EAAMA,MAAQA,OAIxE,wBACKJ,EACArB,EAFL,CAGE2J,UAAkC,KAAvB3J,EAAS2J,UAAmBtI,EAAcsI,UAAY3J,EAAS2J,UAC1ErI,KAAMtB,EAASsB,KAAKG,MACpBpB,SAAU,OAAF,UAAOgB,EAAchB,SAAaA,GAC1CyJ,eAAgB,OAAF,UAAO9J,EAAS8J,mBAIrBtJ,EAAqBR,IAAqC,MACrE,MAAO,CACL4D,KAAM5D,EAAS4D,KACftC,KAAMtB,EAASsB,KAAKG,MACpBkI,UAAS,UAAE3J,EAAS2J,iBAAX,QAAwBtI,EAAcsI,UAC/CtJ,SAAU,OAAF,UAAO8J,OAAOI,OAAOlJ,EAAchB,SAAUL,EAASK,WAC9DyJ,eAAgB,OAAF,UAAO9J,EAAS8J","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, useDispatch } from 'react-redux';\n\nimport { cleanUpAction, StateSelector } from '../actions/cleanUp';\n\nexport const connectWithCleanUp =\n <\n TStateProps extends {} = {},\n TDispatchProps = {},\n TOwnProps = {},\n State = {},\n TSelector extends object = {},\n Statics = {}\n >(\n mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,\n mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,\n stateSelector: StateSelector<TSelector>\n ) =>\n (Component: ComponentType<any>) => {\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({ stateSelector }));\n };\n }, [dispatch]);\n // @ts-ignore\n return <ConnectedComponent {...props} />;\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 { NavModel } from '@grafana/data';\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 { getNavModel } from 'app/core/selectors/navModel';\nimport { NotificationChannelType, NotificationChannelDTO, StoreState } from 'app/types';\n\nimport { NotificationChannelForm } from './components/NotificationChannelForm';\nimport { loadNotificationChannel, testNotificationChannel, updateNotificationChannel } from './state/actions';\nimport { resetSecureField } from './state/reducers';\nimport { mapChannelsToSelectableValue, transformSubmitData, transformTestData } from './utils/notificationChannels';\n\ninterface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {}\n\ninterface ConnectedProps {\n navModel: NavModel;\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<Props> {\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 { navModel, notificationChannel, notificationChannelTypes } = this.props;\n\n return (\n <Page navModel={navModel}>\n <Page.Contents>\n <h2 className=\"page-sub-heading\">Edit notification channel</h2>\n {notificationChannel && notificationChannel.id > 0 ? (\n <Form\n maxWidth={600}\n onSubmit={this.onSubmit}\n defaultValues={{\n ...notificationChannel,\n type: notificationChannelTypes.find((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 <NotificationChannelForm\n selectableChannels={mapChannelsToSelectableValue(notificationChannelTypes, true)}\n selectedChannel={selectedChannel}\n imageRendererAvailable={config.rendererAvailable}\n onTestChannel={this.onTestChannel}\n register={register}\n watch={watch}\n errors={errors}\n getValues={getValues}\n control={control}\n resetSecureField={this.props.resetSecureField}\n secureFields={notificationChannel.secureFields}\n />\n );\n }}\n </Form>\n ) : (\n <div>\n Loading notification channel\n <Spinner />\n </div>\n )}\n </Page.Contents>\n </Page>\n );\n }\n}\n\nconst mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (state) => {\n return {\n navModel: getNavModel(state.navIndex, 'channels'),\n notificationChannel: state.notificationChannel.notificationChannel,\n notificationChannelTypes: state.notificationChannel.notificationChannelTypes,\n };\n};\n\nconst mapDispatchToProps: MapDispatchToProps<DispatchProps, OwnProps> = {\n loadNotificationChannel,\n testNotificationChannel,\n updateNotificationChannel,\n resetSecureField,\n};\n\nexport default connectWithCleanUp(\n mapStateToProps,\n mapDispatchToProps,\n (state) => state.notificationChannel\n)(EditNotificationChannelPage);\n","import React, { FC } from 'react';\n\nimport { FormAPI, Input, InputControl, Select, TextArea } from '@grafana/ui';\n\nimport { NotificationChannelOption } from '../../../types';\n\ninterface Props extends Pick<FormAPI<any>, 'register' | 'control'> {\n option: NotificationChannelOption;\n invalid?: boolean;\n}\n\nexport const OptionElement: FC<Props> = ({ control, option, register, invalid }) => {\n const modelValue = option.secure ? `secureSettings.${option.propertyName}` : `settings.${option.propertyName}`;\n switch (option.element) {\n case 'input':\n return (\n <Input\n {...register(`${modelValue}`, {\n required: option.required ? 'Required' : false,\n validate: (v) => (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 <InputControl\n control={control}\n name={`${modelValue}`}\n render={({ field: { ref, ...field } }) => (\n <Select {...field} options={option.selectOptions ?? undefined} invalid={invalid} />\n )}\n />\n );\n\n case 'textarea':\n return (\n <TextArea\n invalid={invalid}\n {...register(`${modelValue}`, {\n required: option.required ? 'Required' : false,\n validate: (v) => (option.validationRule !== '' ? validateOption(v, option.validationRule) : true),\n })}\n />\n );\n\n default:\n console.error('Element not supported', option.element);\n return null;\n }\n};\n\nconst validateOption = (value: string, validationRule: string) => {\n return RegExp(validationRule).test(value) ? true : 'Invalid format';\n};\n","import React, { FC } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Button, Checkbox, Field, Input } from '@grafana/ui';\n\nimport { NotificationChannelDTO, NotificationChannelOption, NotificationChannelSecureFields } from '../../../types';\n\nimport { NotificationSettingsProps } from './NotificationChannelForm';\nimport { OptionElement } from './OptionElement';\n\ninterface Props extends NotificationSettingsProps {\n selectedChannelOptions: NotificationChannelOption[];\n currentFormValues: NotificationChannelDTO;\n secureFields: NotificationChannelSecureFields;\n\n onResetSecureField: (key: string) => void;\n}\n\nexport const NotificationChannelOptions: FC<Props> = ({\n control,\n currentFormValues,\n errors,\n selectedChannelOptions,\n register,\n onResetSecureField,\n secureFields,\n}) => {\n return (\n <>\n {selectedChannelOptions.map((option: NotificationChannelOption, index: number) => {\n const key = `${option.label}-${index}`;\n // Some options can be dependent on other options, this determines what is selected in the dependency options\n // I think this needs more thought.\n const selectedOptionValue =\n currentFormValues[`settings.${option.showWhen.field}`] &&\n (currentFormValues[`settings.${option.showWhen.field}`] as SelectableValue<string>).value;\n\n if (option.showWhen.field && selectedOptionValue !== option.showWhen.is) {\n return null;\n }\n\n if (option.element === 'checkbox') {\n return (\n <Field key={key}>\n <Checkbox\n {...register(\n option.secure ? `secureSettings.${option.propertyName}` : `settings.${option.propertyName}`\n )}\n label={option.label}\n description={option.description}\n />\n </Field>\n );\n }\n return (\n <Field\n key={key}\n label={option.label}\n description={option.description}\n invalid={errors.settings && !!errors.settings[option.propertyName]}\n error={errors.settings && errors.settings[option.propertyName]?.message}\n >\n {secureFields && secureFields[option.propertyName] ? (\n <Input\n readOnly={true}\n value=\"Configured\"\n suffix={\n <Button onClick={() => onResetSecureField(option.propertyName)} fill=\"text\" type=\"button\" size=\"sm\">\n Clear\n </Button>\n }\n />\n ) : (\n <OptionElement option={option} register={register} control={control} />\n )}\n </Field>\n );\n })}\n </>\n );\n};\n","import React, { FC } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Field, Input, InputControl, Select } from '@grafana/ui';\n\nimport { NotificationChannelSecureFields, NotificationChannelType } from '../../../types';\n\nimport { NotificationSettingsProps } from './NotificationChannelForm';\nimport { NotificationChannelOptions } from './NotificationChannelOptions';\n\ninterface Props extends NotificationSettingsProps {\n selectedChannel: NotificationChannelType;\n channels: Array<SelectableValue<string>>;\n secureFields: NotificationChannelSecureFields;\n resetSecureField: (key: string) => void;\n}\n\nexport const BasicSettings: FC<Props> = ({\n control,\n currentFormValues,\n errors,\n secureFields,\n selectedChannel,\n channels,\n register,\n resetSecureField,\n}) => {\n return (\n <>\n <Field label=\"Name\" invalid={!!errors.name} error={errors.name && errors.name.message}>\n <Input {...register('name', { required: 'Name is required' })} />\n </Field>\n <Field label=\"Type\">\n <InputControl\n name=\"type\"\n render={({ field: { ref, ...field } }) => <Select {...field} options={channels} />}\n control={control}\n rules={{ required: true }}\n />\n </Field>\n <NotificationChannelOptions\n selectedChannelOptions={selectedChannel.options.filter((o) => o.required)}\n currentFormValues={currentFormValues}\n secureFields={secureFields}\n onResetSecureField={resetSecureField}\n register={register}\n errors={errors}\n control={control}\n />\n </>\n );\n};\n","import React, { FC } from 'react';\n\nimport { Alert, CollapsableSection } from '@grafana/ui';\n\nimport { NotificationChannelSecureFields, NotificationChannelType } from '../../../types';\n\nimport { NotificationSettingsProps } from './NotificationChannelForm';\nimport { NotificationChannelOptions } from './NotificationChannelOptions';\n\ninterface Props extends NotificationSettingsProps {\n selectedChannel: NotificationChannelType;\n secureFields: NotificationChannelSecureFields;\n resetSecureField: (key: string) => void;\n}\n\nexport const ChannelSettings: FC<Props> = ({\n control,\n currentFormValues,\n errors,\n selectedChannel,\n secureFields,\n register,\n resetSecureField,\n}) => {\n return (\n <CollapsableSection label={`Optional ${selectedChannel.heading}`} isOpen={false}>\n {selectedChannel.info !== '' && <Alert severity=\"info\" title={selectedChannel.info ?? ''} />}\n <NotificationChannelOptions\n selectedChannelOptions={selectedChannel.options.filter((o) => !o.required)}\n currentFormValues={currentFormValues}\n register={register}\n errors={errors}\n control={control}\n onResetSecureField={resetSecureField}\n secureFields={secureFields}\n />\n </CollapsableSection>\n );\n};\n","import React, { FC } from 'react';\n\nimport { Checkbox, CollapsableSection, Field, InfoBox, Input } from '@grafana/ui';\n\nimport { NotificationSettingsProps } from './NotificationChannelForm';\n\ninterface Props extends NotificationSettingsProps {\n imageRendererAvailable: boolean;\n}\n\nexport const NotificationSettings: FC<Props> = ({ currentFormValues, imageRendererAvailable, register }) => {\n return (\n <CollapsableSection label=\"Notification settings\" isOpen={false}>\n <Field>\n <Checkbox {...register('isDefault')} label=\"Default\" description=\"Use this notification for all alerts\" />\n </Field>\n <Field>\n <Checkbox\n {...register('settings.uploadImage')}\n label=\"Include image\"\n description=\"Captures an image and include it in the notification\"\n />\n </Field>\n {currentFormValues.uploadImage && !imageRendererAvailable && (\n <InfoBox title=\"No image renderer available/installed\">\n Grafana cannot find an image renderer to capture an image for the notification. Please make sure the Grafana\n Image Renderer plugin is installed. Please contact your Grafana administrator to install the plugin.\n </InfoBox>\n )}\n <Field>\n <Checkbox\n {...register('disableResolveMessage')}\n label=\"Disable Resolve Message\"\n description=\"Disable the resolve message [OK] that is sent when alerting state returns to false\"\n />\n </Field>\n <Field>\n <Checkbox\n {...register('sendReminder')}\n label=\"Send reminders\"\n description=\"Send additional notifications for triggered alerts\"\n />\n </Field>\n {currentFormValues.sendReminder && (\n <>\n <Field\n label=\"Send reminder every\"\n description=\"Specify how often reminders should be sent, e.g. every 30s, 1m, 10m, 30m', or 1h etc.\n Alert reminders are sent after rules are evaluated. A reminder can never be sent more frequently\n than a configured alert rule evaluation interval.\"\n >\n <Input {...register('frequency')} width={8} />\n </Field>\n </>\n )}\n </CollapsableSection>\n );\n};\n","import { css } from '@emotion/css';\nimport React, { FC, useEffect } from 'react';\n\nimport { GrafanaTheme, SelectableValue } from '@grafana/data';\nimport { Button, FormAPI, HorizontalGroup, stylesFactory, useTheme, Spinner } 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<FormAPI<NotificationChannelDTO>, 'control' | 'errors' | 'register' | 'watch' | 'getValues'> {\n selectableChannels: Array<SelectableValue<string>>;\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<FormAPI<NotificationChannelDTO>, 'control' | 'errors' | 'register'> {\n currentFormValues: NotificationChannelDTO;\n}\n\nexport const NotificationChannelForm: FC<Props> = ({\n control,\n errors,\n selectedChannel,\n selectableChannels,\n register,\n watch,\n getValues,\n imageRendererAvailable,\n onTestChannel,\n resetSecureField,\n secureFields,\n}) => {\n const styles = getStyles(useTheme());\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 <Spinner />;\n }\n\n return (\n <div className={styles.formContainer}>\n <div className={styles.formItem}>\n <BasicSettings\n selectedChannel={selectedChannel}\n channels={selectableChannels}\n secureFields={secureFields}\n resetSecureField={resetSecureField}\n currentFormValues={currentFormValues}\n register={register}\n errors={errors}\n control={control}\n />\n </div>\n {/* If there are no non-required fields, don't render this section*/}\n {selectedChannel.options.filter((o) => !o.required).length > 0 && (\n <div className={styles.formItem}>\n <ChannelSettings\n selectedChannel={selectedChannel}\n secureFields={secureFields}\n resetSecureField={resetSecureField}\n currentFormValues={currentFormValues}\n register={register}\n errors={errors}\n control={control}\n />\n </div>\n )}\n <div className={styles.formItem}>\n <NotificationSettings\n imageRendererAvailable={imageRendererAvailable}\n currentFormValues={currentFormValues}\n register={register}\n errors={errors}\n control={control}\n />\n </div>\n <div className={styles.formButtons}>\n <HorizontalGroup>\n <Button type=\"submit\">Save</Button>\n <Button type=\"button\" variant=\"secondary\" onClick={() => onTestChannel(getValues())}>\n Test\n </Button>\n <a href={`${config.appSubUrl}/alerting/notifications`}>\n <Button type=\"button\" variant=\"secondary\">\n Back\n </Button>\n </a>\n </HorizontalGroup>\n </div>\n </div>\n );\n};\n\nconst getStyles = stylesFactory((theme: GrafanaTheme) => {\n return {\n formContainer: css``,\n formItem: css`\n flex-grow: 1;\n padding-top: ${theme.spacing.md};\n `,\n formButtons: css`\n padding-top: ${theme.spacing.xl};\n `,\n };\n});\n","import { getBackendSrv, locationService } from '@grafana/runtime';\nimport { notifyApp } from 'app/core/actions';\nimport { createErrorNotification, createSuccessNotification } from 'app/core/copy/appNotification';\nimport { AlertRuleDTO, NotifierDTO, ThunkResult } from 'app/types';\n\nimport { loadAlertRules, loadedAlertRules, notificationChannelLoaded, setNotificationChannels } from './reducers';\n\nexport function getAlertRulesAsync(options: { state: string }): ThunkResult<void> {\n return async (dispatch) => {\n dispatch(loadAlertRules());\n const rules: AlertRuleDTO[] = await getBackendSrv().get('/api/alerts', options);\n dispatch(loadedAlertRules(rules));\n };\n}\n\nexport function togglePauseAlertRule(id: number, options: { paused: boolean }): ThunkResult<void> {\n return async (dispatch) => {\n await getBackendSrv().post(`/api/alerts/${id}/pause`, options);\n const stateFilter = locationService.getSearchObject().state || 'all';\n dispatch(getAlertRulesAsync({ state: stateFilter.toString() }));\n };\n}\n\nexport function createNotificationChannel(data: any): ThunkResult<Promise<void>> {\n return async (dispatch) => {\n try {\n await getBackendSrv().post(`/api/alert-notifications`, data);\n dispatch(notifyApp(createSuccessNotification('Notification created')));\n locationService.push('/alerting/notifications');\n } catch (error) {\n dispatch(notifyApp(createErrorNotification(error.data.error)));\n }\n };\n}\n\nexport function updateNotificationChannel(data: any): ThunkResult<void> {\n return async (dispatch) => {\n try {\n await getBackendSrv().put(`/api/alert-notifications/${data.id}`, data);\n dispatch(notifyApp(createSuccessNotification('Notification updated')));\n } catch (error) {\n dispatch(notifyApp(createErrorNotification(error.data.error)));\n }\n };\n}\n\nexport function testNotificationChannel(data: any): ThunkResult<void> {\n return async (dispatch, getState) => {\n const channel = getState().notificationChannel.notificationChannel;\n await getBackendSrv().post('/api/alert-notifications/test', { id: channel.id, ...data });\n };\n}\n\nexport function loadNotificationTypes(): ThunkResult<void> {\n return async (dispatch) => {\n const alertNotifiers: NotifierDTO[] = await getBackendSrv().get(`/api/alert-notifiers`);\n\n const notificationTypes = alertNotifiers.sort((o1, o2) => {\n if (o1.name > o2.name) {\n return 1;\n }\n return -1;\n });\n\n dispatch(setNotificationChannels(notificationTypes));\n };\n}\n\nexport function loadNotificationChannel(id: number): ThunkResult<void> {\n return async (dispatch) => {\n await dispatch(loadNotificationTypes());\n const notificationChannel = await getBackendSrv().get(`/api/alert-notifications/${id}`);\n dispatch(notificationChannelLoaded(notificationChannel));\n };\n}\n","import 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<SelectableValue<string>> => {\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<T>\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","stateSelector","Component","ConnectedComponent","connect","ConnectedComponentWithCleanUp","props","dispatch","useDispatch","useEffect","cleanUpAction","displayName","hoistNonReactStatics","EditNotificationChannelPage","PureComponent","formData","notificationChannel","this","updateNotificationChannel","transformSubmitData","settings","id","testNotificationChannel","transformTestData","componentDidMount","loadNotificationChannel","parseInt","match","params","render","navModel","notificationChannelTypes","className","Form","maxWidth","onSubmit","defaultValues","type","find","n","value","control","errors","getValues","register","watch","selectedChannel","c","selectableChannels","mapChannelsToSelectableValue","imageRendererAvailable","config","onTestChannel","resetSecureField","secureFields","Spinner","state","getNavModel","navIndex","OptionElement","option","invalid","modelValue","secure","propertyName","element","Input","required","validate","v","validationRule","validateOption","inputType","placeholder","InputControl","name","field","Select","options","selectOptions","undefined","TextArea","console","error","RegExp","test","NotificationChannelOptions","currentFormValues","selectedChannelOptions","onResetSecureField","map","index","key","label","selectedOptionValue","showWhen","is","Field","Checkbox","description","message","readOnly","suffix","Button","onClick","fill","size","BasicSettings","channels","rules","filter","o","ChannelSettings","CollapsableSection","heading","isOpen","info","Alert","severity","title","NotificationSettings","uploadImage","InfoBox","sendReminder","width","NotificationChannelForm","styles","getStyles","useTheme","fieldsToWatch","Set","formContainer","formItem","length","formButtons","HorizontalGroup","variant","href","stylesFactory","theme","css","spacing","md","xl","getAlertRulesAsync","async","loadAlertRules","getBackendSrv","get","loadedAlertRules","togglePauseAlertRule","post","locationService","toString","createNotificationChannel","data","notifyApp","createSuccessNotification","createErrorNotification","put","getState","channel","loadNotificationTypes","notificationTypes","sort","o1","o2","setNotificationChannels","notificationChannelLoaded","disableResolveMessage","frequency","autoResolve","httpMethod","secureSettings","isDefault","memoizeOne","notificationChannels","includeDescription","Object","fromEntries","entries","hasOwnProperty","assign"],"sourceRoot":""}