⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.72
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
grafana
/
public
/
build
/
View File Name :
7455.845968885abe369e6479.js.map
{"version":3,"file":"7455.845968885abe369e6479.js","mappings":"wLAmBO,MAAMA,EAAgC,sBAgBvCC,EAAkBC,GAAiB,qBAAqB,IAAgB,SAASA,IAE1EC,EAAY,IAAY,gBAAgB,CACnD,UAAYC,IAAW,CACrB,0BAA2BA,EAAM,MAAoC,CACnE,MAAO,KAAO,CACZ,IAAKH,EAAe,0CAA0C,EAG9D,OAAQ,CACN,QAAS,GACT,YAAa,CAAC,KAAiC,yBAAyB,EACxE,gBAAiB,EACnB,EACA,eAAgB,EAClB,GACA,kBAAoBI,GACdC,EAAoBD,CAAQ,EACvBA,EAAS,QAEXA,EAET,aAAc,CAAC,oBAAoB,CACrC,CAAC,EACD,wBAAyBD,EAAM,MAAuB,CACpD,MAAQG,IAAU,CAChB,IAAKN,EAAe,wDAAwD,EAC5E,OAAQ,CAAE,YAAaM,CAAK,EAC5B,eAAgB,EAClB,EACF,CAAC,EACD,kBAAmBH,EAAM,SAAwD,CAC/E,MAAQI,IAAiB,CACvB,IAAKP,EAAe,0CAA0C,EAC9D,KAAMO,EACN,OAAQ,OACR,eAAgB,EAClB,GACA,gBAAiB,CAAC,oBAAoB,CACxC,CAAC,EACD,SAAUJ,EAAM,MAA6B,CAC3C,MAAO,KAAO,CACZ,IAAKH,EAAe,4BAA4B,EAChD,eAAgB,EAClB,EACF,CAAC,CACH,EACF,CAAC,EAED,SAASK,EACPD,EACyD,CACzD,MAAO,YAAaA,GAAY,MAAM,QAAQA,EAAS,OAAO,CAChE,CAEO,KAAM,CAAE,kCAAAI,CAAkC,EAAIN,EAE9C,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AoB,GAAI,6BAA0C,EACrF,cAAeT,EAA0B,IAAKpB,IAAO,CACnD,MAAOA,EAAE,aACT,YAAaA,EAAE,gBACf,MAAOA,EAAE,eACX,EAAE,CACJ,CAAC,CACH,EAEO,CAAE,GAAG9C,EAAU,QAAAyE,CAAQ,EAGhC,OAAOzE,CACT,EACA,CAACkE,EAA2BR,CAA8B,CAC5D,EAEA,MAAO,CACL,kBAAAD,EACA,mBAAoB,CAClB,QAAS,CAAC,CAACN,EACX,MAAO,GACP,YAAaA,EACT,yCACA,uDACJ,QAAS,IAAmC,IAAgB,MAAM,CACpE,EACA,6BAAArH,EACA,sBAAAC,GACA,yBAAAE,EACA,qBAAAD,GACA,2BAA4BmI,IAA+BR,EAC3D,aAAAK,EACA,eAAgB,EAAQJ,GAAgBQ,EAC1C,CACF,C,mDCnPO,MAAMQ,EAAsE,CACjF,CAAC,IAAgB,MAAM,EAAG,sCAE1B,CAAC,IAAgB,QAAQ,EAAG,GAC5B,CAAC,IAAgB,eAAe,EAAG,EACrC,C","sources":["webpack://grafana/./public/app/features/alerting/unified/api/onCallApi.ts","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/CloudCommonChannelSettings.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/GrafanaCommonChannelSettings.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/TestContactPointModal.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/fields/DeletedSubform.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/util.ts","webpack://grafana/./public/app/features/alerting/unified/components/receivers/form/ReceiverForm.tsx","webpack://grafana/./public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/onCall/onCall.ts","webpack://grafana/./public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/onCall/useOnCallIntegration.ts","webpack://grafana/./public/app/features/alerting/unified/components/receivers/grafanaAppReceivers/types.ts"],"sourcesContent":["import { FetchError, isFetchError } from '@grafana/runtime';\n\nimport { GRAFANA_ONCALL_INTEGRATION_TYPE } from '../components/receivers/grafanaAppReceivers/onCall/onCall';\nimport { SupportedPlugin } from '../types/pluginBridges';\n\nimport { alertingApi } from './alertingApi';\n\nexport interface NewOnCallIntegrationDTO {\n id: string;\n connected_escalations_chains_count: number;\n integration: string;\n integration_url: string;\n verbal_name: string;\n}\n\nexport interface OnCallPaginatedResult
{\n results: T[];\n}\n\nexport const ONCALL_INTEGRATION_V2_FEATURE = 'grafana_alerting_v2';\ntype OnCallFeature = typeof ONCALL_INTEGRATION_V2_FEATURE | string;\n\ntype AlertReceiveChannelsResult = OnCallPaginatedResult
| OnCallIntegrationDTO[];\n\nexport interface OnCallIntegrationDTO {\n value: string;\n display_name: string;\n integration_url: string;\n}\n\nexport interface CreateIntegrationDTO {\n integration: typeof GRAFANA_ONCALL_INTEGRATION_TYPE; // The only one supported right now\n verbal_name: string;\n}\n\nconst getProxyApiUrl = (path: string) => `/api/plugin-proxy/${SupportedPlugin.OnCall}${path}`;\n\nexport const onCallApi = alertingApi.injectEndpoints({\n endpoints: (build) => ({\n grafanaOnCallIntegrations: build.query
({\n query: () => ({\n url: getProxyApiUrl('/api/internal/v1/alert_receive_channels/'),\n // legacy_grafana_alerting is necessary for OnCall.\n // We do NOT need to differentiate between these two on our side\n params: {\n filters: true,\n integration: [GRAFANA_ONCALL_INTEGRATION_TYPE, 'legacy_grafana_alerting'],\n skip_pagination: true,\n },\n showErrorAlert: false,\n }),\n transformResponse: (response: AlertReceiveChannelsResult) => {\n if (isPaginatedResponse(response)) {\n return response.results;\n }\n return response;\n },\n providesTags: ['OnCallIntegrations'],\n }),\n validateIntegrationName: build.query
({\n query: (name) => ({\n url: getProxyApiUrl('/api/internal/v1/alert_receive_channels/validate_name/'),\n params: { verbal_name: name },\n showErrorAlert: false,\n }),\n }),\n createIntegration: build.mutation
({\n query: (integration) => ({\n url: getProxyApiUrl('/api/internal/v1/alert_receive_channels/'),\n data: integration,\n method: 'POST',\n showErrorAlert: true,\n }),\n invalidatesTags: ['OnCallIntegrations'],\n }),\n features: build.query
({\n query: () => ({\n url: getProxyApiUrl('/api/internal/v1/features/'),\n showErrorAlert: false,\n }),\n }),\n }),\n});\n\nfunction isPaginatedResponse(\n response: AlertReceiveChannelsResult\n): response is OnCallPaginatedResult
{\n return 'results' in response && Array.isArray(response.results);\n}\n\nexport const { useGrafanaOnCallIntegrationsQuery } = onCallApi;\n\nexport function isOnCallFetchError(error: unknown): error is FetchError<{ detail: string }> {\n return isFetchError(error) && 'detail' in error.data;\n}\n","import React from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { Checkbox, Field } from '@grafana/ui';\n\nimport { CommonSettingsComponentProps } from '../../../types/receiver-form';\n\nexport const CloudCommonChannelSettings = ({\n pathPrefix,\n className,\n readOnly = false,\n}: CommonSettingsComponentProps) => {\n const { register } = useFormContext();\n return (\n
\n
\n
\n
\n
\n );\n};\n","import React, { useMemo } from 'react';\n\nimport { Alert } from '@grafana/ui';\nimport { AlertManagerCortexConfig, Receiver } from 'app/plugins/datasource/alertmanager/types';\nimport { useDispatch } from 'app/types';\n\nimport { alertmanagerApi } from '../../../api/alertmanagerApi';\nimport { updateAlertManagerConfigAction } from '../../../state/actions';\nimport { CloudChannelValues, ReceiverFormValues, CloudChannelMap } from '../../../types/receiver-form';\nimport { cloudNotifierTypes } from '../../../utils/cloud-alertmanager-notifier-types';\nimport { isVanillaPrometheusAlertManagerDataSource } from '../../../utils/datasource';\nimport {\n cloudReceiverToFormValues,\n formValuesToCloudReceiver,\n updateConfigWithReceiver,\n} from '../../../utils/receiver-form';\n\nimport { CloudCommonChannelSettings } from './CloudCommonChannelSettings';\nimport { ReceiverForm } from './ReceiverForm';\nimport { Notifier } from './notifiers';\n\ninterface Props {\n alertManagerSourceName: string;\n config: AlertManagerCortexConfig;\n existing?: Receiver;\n readOnly?: boolean;\n}\n\nconst defaultChannelValues: CloudChannelValues = Object.freeze({\n __id: '',\n sendResolved: true,\n secureSettings: {},\n settings: {},\n secureFields: {},\n type: 'email',\n});\n\nconst cloudNotifiers = cloudNotifierTypes.map
((n) => ({ dto: n }));\n\nexport const CloudReceiverForm = ({ existing, alertManagerSourceName, config, readOnly = false }: Props) => {\n const dispatch = useDispatch();\n const isVanillaAM = isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName);\n\n // transform receiver DTO to form values\n const [existingValue] = useMemo((): [ReceiverFormValues
| undefined, CloudChannelMap] => {\n if (!existing) {\n return [undefined, {}];\n }\n return cloudReceiverToFormValues(existing, cloudNotifierTypes);\n }, [existing]);\n\n const onSubmit = async (values: ReceiverFormValues
) => {\n const newReceiver = formValuesToCloudReceiver(values, defaultChannelValues);\n await dispatch(\n updateAlertManagerConfigAction({\n newConfig: updateConfigWithReceiver(config, newReceiver, existing?.name),\n oldConfig: config,\n alertManagerSourceName,\n successMessage: existing ? 'Contact point updated.' : 'Contact point created.',\n redirectPath: '/alerting/notifications',\n })\n ).then(() => {\n dispatch(alertmanagerApi.util.invalidateTags(['AlertmanagerConfiguration']));\n });\n };\n\n const takenReceiverNames = useMemo(\n () => config.alertmanager_config.receivers?.map(({ name }) => name).filter((name) => name !== existing?.name) ?? [],\n [config, existing]\n );\n\n // this basically checks if we can manage the selected alert manager data source, either because it's a Grafana Managed one\n // or a Mimir-based AlertManager\n const isManageableAlertManagerDataSource =\n !readOnly ?? !isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName);\n\n return (\n <>\n {!isVanillaAM && (\n
\n Note that empty string values will be replaced with global defaults where appropriate.\n
\n )}\n
\n isEditable={isManageableAlertManagerDataSource}\n isTestable={isManageableAlertManagerDataSource}\n config={config}\n onSubmit={onSubmit}\n initialValues={existingValue}\n notifiers={cloudNotifiers}\n alertManagerSourceName={alertManagerSourceName}\n defaultItem={defaultChannelValues}\n takenReceiverNames={takenReceiverNames}\n commonSettingsComponent={CloudCommonChannelSettings}\n />\n >\n );\n};\n","import React from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { Checkbox, Field } from '@grafana/ui';\n\nimport { CommonSettingsComponentProps } from '../../../types/receiver-form';\n\nexport const GrafanaCommonChannelSettings = ({\n pathPrefix,\n className,\n readOnly = false,\n}: CommonSettingsComponentProps) => {\n const { register } = useFormContext();\n return (\n
\n
\n
\n
\n
\n );\n};\n","import { css } from '@emotion/css';\nimport React, { useState } from 'react';\nimport { FormProvider, useForm } from 'react-hook-form';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, Label, Modal, RadioButtonGroup, useStyles2 } from '@grafana/ui';\nimport { TestReceiversAlert } from 'app/plugins/datasource/alertmanager/types';\nimport { Annotations, Labels } from 'app/types/unified-alerting-dto';\n\nimport { defaultAnnotations } from '../../../utils/constants';\nimport AnnotationsStep from '../../rule-editor/AnnotationsStep';\nimport LabelsField from '../../rule-editor/LabelsField';\n\ninterface Props {\n isOpen: boolean;\n onDismiss: () => void;\n onTest: (alert?: TestReceiversAlert) => void;\n}\n\ntype AnnoField = {\n key: string;\n value: string;\n};\n\ninterface FormFields {\n annotations: AnnoField[];\n labels: AnnoField[];\n}\n\nenum NotificationType {\n predefined = 'Predefined',\n custom = 'Custom',\n}\n\nconst notificationOptions = Object.values(NotificationType).map((value) => ({ label: value, value: value }));\n\nconst defaultValues: FormFields = {\n annotations: [...defaultAnnotations],\n labels: [{ key: '', value: '' }],\n};\n\nexport const TestContactPointModal = ({ isOpen, onDismiss, onTest }: Props) => {\n const [notificationType, setNotificationType] = useState
(NotificationType.predefined);\n const styles = useStyles2(getStyles);\n const formMethods = useForm
({ defaultValues, mode: 'onBlur' });\n\n const onSubmit = (data: FormFields) => {\n if (notificationType === NotificationType.custom) {\n const alert = {\n annotations: data.annotations\n .filter(({ key, value }) => !!key && !!value)\n .reduce
((acc, { key, value }) => {\n return { ...acc, [key]: value };\n }, {}),\n labels: data.labels\n .filter(({ key, value }) => !!key && !!value)\n .reduce
((acc, { key, value }) => {\n return { ...acc, [key]: value };\n }, {}),\n };\n onTest(alert);\n } else {\n onTest();\n }\n };\n\n return (\n
\n
\n
Notification message
\n
setNotificationType(value)}\n />\n
\n\n
\n
\n {notificationType === NotificationType.predefined && (\n
\n You will send a test notification that uses a predefined alert. If you have defined a custom template or\n message, for better results switch to
custom
notification message, from above.\n
\n )}\n {notificationType === NotificationType.custom && (\n <>\n
\n You will send a test notification that uses the annotations defined below. This is a good option if you\n use custom templates and messages.\n
\n
\n
\n
\n
\n
\n
\n >\n )}\n\n
\n
Send test notification
\n
\n
\n
\n
\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n flexRow: css`\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n margin-bottom: ${theme.spacing(1)};\n `,\n section: css`\n margin-bottom: ${theme.spacing(2)};\n `,\n});\n","import React, { useMemo, useState } from 'react';\n\nimport { Alert, LoadingPlaceholder } from '@grafana/ui';\nimport {\n AlertManagerCortexConfig,\n GrafanaManagedContactPoint,\n GrafanaManagedReceiverConfig,\n TestReceiversAlert,\n} from 'app/plugins/datasource/alertmanager/types';\nimport { useDispatch } from 'app/types';\n\nimport { alertmanagerApi } from '../../../api/alertmanagerApi';\nimport { testReceiversAction, updateAlertManagerConfigAction } from '../../../state/actions';\nimport { GrafanaChannelValues, ReceiverFormValues } from '../../../types/receiver-form';\nimport { GRAFANA_RULES_SOURCE_NAME } from '../../../utils/datasource';\nimport {\n formChannelValuesToGrafanaChannelConfig,\n formValuesToGrafanaReceiver,\n grafanaReceiverToFormValues,\n updateConfigWithReceiver,\n} from '../../../utils/receiver-form';\nimport { ProvisionedResource, ProvisioningAlert } from '../../Provisioning';\nimport { ReceiverTypes } from '../grafanaAppReceivers/onCall/onCall';\nimport { useOnCallIntegration } from '../grafanaAppReceivers/onCall/useOnCallIntegration';\n\nimport { GrafanaCommonChannelSettings } from './GrafanaCommonChannelSettings';\nimport { ReceiverForm } from './ReceiverForm';\nimport { TestContactPointModal } from './TestContactPointModal';\nimport { Notifier } from './notifiers';\n\ninterface Props {\n alertManagerSourceName: string;\n config: AlertManagerCortexConfig;\n existing?: GrafanaManagedContactPoint;\n readOnly?: boolean;\n}\n\nconst defaultChannelValues: GrafanaChannelValues = Object.freeze({\n __id: '',\n secureSettings: {},\n settings: {},\n secureFields: {},\n disableResolveMessage: false,\n type: 'email',\n});\n\nexport const GrafanaReceiverForm = ({ existing, alertManagerSourceName, config, readOnly = false }: Props) => {\n const dispatch = useDispatch();\n\n const {\n onCallNotifierMeta,\n extendOnCallNotifierFeatures,\n extendOnCallReceivers,\n onCallFormValidators,\n createOnCallIntegrations,\n isLoadingOnCallIntegration,\n hasOnCallError,\n } = useOnCallIntegration();\n\n const { useGrafanaNotifiersQuery } = alertmanagerApi;\n const { data: grafanaNotifiers = [], isLoading: isLoadingNotifiers } = useGrafanaNotifiersQuery();\n\n const [testChannelValues, setTestChannelValues] = useState
();\n\n // transform receiver DTO to form values\n const [existingValue, id2original] = useMemo((): [\n ReceiverFormValues
| undefined,\n Record
,\n ] => {\n if (!existing || isLoadingNotifiers || isLoadingOnCallIntegration) {\n return [undefined, {}];\n }\n\n return grafanaReceiverToFormValues(extendOnCallReceivers(existing), grafanaNotifiers);\n }, [existing, isLoadingNotifiers, grafanaNotifiers, extendOnCallReceivers, isLoadingOnCallIntegration]);\n\n const onSubmit = async (values: ReceiverFormValues
) => {\n const newReceiver = formValuesToGrafanaReceiver(values, id2original, defaultChannelValues, grafanaNotifiers);\n const receiverWithOnCall = await createOnCallIntegrations(newReceiver);\n\n const newConfig = updateConfigWithReceiver(config, receiverWithOnCall, existing?.name);\n await dispatch(\n updateAlertManagerConfigAction({\n newConfig: newConfig,\n oldConfig: config,\n alertManagerSourceName: GRAFANA_RULES_SOURCE_NAME,\n successMessage: existing ? 'Contact point updated.' : 'Contact point created',\n redirectPath: '/alerting/notifications',\n })\n ).then(() => {\n dispatch(alertmanagerApi.util.invalidateTags(['AlertmanagerConfiguration']));\n });\n };\n\n const onTestChannel = (values: GrafanaChannelValues) => {\n setTestChannelValues(values);\n };\n\n const testNotification = (alert?: TestReceiversAlert) => {\n if (testChannelValues) {\n const existing: GrafanaManagedReceiverConfig | undefined = id2original[testChannelValues.__id];\n const chan = formChannelValuesToGrafanaChannelConfig(testChannelValues, defaultChannelValues, 'test', existing);\n\n const payload = {\n alertManagerSourceName,\n receivers: [\n {\n name: 'test',\n grafana_managed_receiver_configs: [chan],\n },\n ],\n alert,\n };\n\n dispatch(testReceiversAction(payload));\n }\n };\n\n const takenReceiverNames = useMemo(\n () => config.alertmanager_config.receivers?.map(({ name }) => name).filter((name) => name !== existing?.name) ?? [],\n [config, existing]\n );\n\n // if any receivers in the contact point have a \"provenance\", the entire contact point should be readOnly\n const hasProvisionedItems = existing\n ? (existing.grafana_managed_receiver_configs ?? []).some((item) => Boolean(item.provenance))\n : false;\n\n const isEditable = !readOnly && !hasProvisionedItems;\n const isTestable = !readOnly;\n\n if (isLoadingNotifiers || isLoadingOnCallIntegration) {\n return
;\n }\n\n const notifiers: Notifier[] = grafanaNotifiers.map((n) => {\n if (n.type === 'oncall') {\n return {\n dto: extendOnCallNotifierFeatures(n),\n meta: onCallNotifierMeta,\n };\n }\n\n return { dto: n };\n });\n\n return (\n <>\n {hasOnCallError && (\n
\n Grafana OnCall plugin has been enabled in your Grafana instances but it is not reachable. Please check the\n plugin configuration\n
\n )}\n\n {hasProvisionedItems &&
}\n\n
\n isEditable={isEditable}\n isTestable={isTestable}\n config={config}\n onSubmit={onSubmit}\n initialValues={existingValue}\n onTestChannel={onTestChannel}\n notifiers={notifiers}\n alertManagerSourceName={alertManagerSourceName}\n defaultItem={{ ...defaultChannelValues }}\n takenReceiverNames={takenReceiverNames}\n commonSettingsComponent={GrafanaCommonChannelSettings}\n customValidators={{ [ReceiverTypes.OnCall]: onCallFormValidators }}\n />\n
setTestChannelValues(undefined)}\n isOpen={!!testChannelValues}\n onTest={(alert) => testNotification(alert)}\n />\n >\n );\n};\n","import React from 'react';\nimport { useFormContext, FieldError, FieldErrors, DeepMap } from 'react-hook-form';\n\nimport { Button, Field, Input } from '@grafana/ui';\nimport { NotificationChannelOption, NotificationChannelSecureFields } from 'app/types';\n\nimport { ChannelValues, ReceiverFormValues } from '../../../types/receiver-form';\n\nimport { OptionField } from './fields/OptionField';\n\nexport interface Props
{\n defaultValues: R;\n selectedChannelOptions: NotificationChannelOption[];\n secureFields: NotificationChannelSecureFields;\n\n onResetSecureField: (key: string) => void;\n errors?: FieldErrors
;\n pathPrefix?: string;\n readOnly?: boolean;\n\n customValidators?: Record
['customValidator']>;\n}\n\nexport function ChannelOptions
({\n defaultValues,\n selectedChannelOptions,\n onResetSecureField,\n secureFields,\n errors,\n pathPrefix = '',\n readOnly = false,\n customValidators = {},\n}: Props
): JSX.Element {\n const { watch } = useFormContext
>();\n const currentFormValues = watch(); // react hook form types ARE LYING!\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 // pathPrefix = items.index.\n const paths = pathPrefix.split('.');\n const selectedOptionValue =\n paths.length >= 2 ? currentFormValues.items?.[Number(paths[1])].settings?.[option.showWhen.field] : undefined;\n\n if (option.showWhen.field && selectedOptionValue !== option.showWhen.is) {\n return null;\n }\n\n if (secureFields && secureFields[option.propertyName]) {\n return (\n
\n
onResetSecureField(option.propertyName)} fill=\"text\" type=\"button\" size=\"sm\">\n Clear\n \n )\n }\n />\n
\n );\n }\n\n const error: FieldError | DeepMap
| undefined = (\n (option.secure ? errors?.secureSettings : errors?.settings) as DeepMap
| undefined\n )?.[option.propertyName];\n\n const defaultValue = defaultValues?.settings?.[option.propertyName];\n\n return (\n
\n );\n })}\n >\n );\n}\n","import { css } from '@emotion/css';\nimport { sortBy } from 'lodash';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useFormContext, FieldErrors, FieldValues } from 'react-hook-form';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Alert, Button, Field, InputControl, Select, useStyles2 } from '@grafana/ui';\n\nimport { useUnifiedAlertingSelector } from '../../../hooks/useUnifiedAlertingSelector';\nimport { ChannelValues, CommonSettingsComponentType } from '../../../types/receiver-form';\nimport { OnCallIntegrationType } from '../grafanaAppReceivers/onCall/useOnCallIntegration';\n\nimport { ChannelOptions } from './ChannelOptions';\nimport { CollapsibleSection } from './CollapsibleSection';\nimport { Notifier } from './notifiers';\n\ninterface Props
{\n defaultValues: R;\n initialValues?: R;\n pathPrefix: string;\n notifiers: Notifier[];\n onDuplicate: () => void;\n onTest?: () => void;\n commonSettingsComponent: CommonSettingsComponentType;\n\n secureFields?: Record
;\n errors?: FieldErrors
;\n onDelete?: () => void;\n isEditable?: boolean;\n isTestable?: boolean;\n\n customValidators?: React.ComponentProps
['customValidators'];\n}\n\nexport function ChannelSubForm
({\n defaultValues,\n initialValues,\n pathPrefix,\n onDuplicate,\n onDelete,\n onTest,\n notifiers,\n errors,\n secureFields,\n commonSettingsComponent: CommonSettingsComponent,\n isEditable = true,\n isTestable,\n customValidators = {},\n}: Props
): JSX.Element {\n const styles = useStyles2(getStyles);\n\n const fieldName = useCallback((fieldName: string) => `${pathPrefix}${fieldName}`, [pathPrefix]);\n\n const { control, watch, register, trigger, formState, setValue } = useFormContext();\n const selectedType = watch(fieldName('type')) ?? defaultValues.type; // nope, setting \"default\" does not work at all.\n const { loading: testingReceiver } = useUnifiedAlertingSelector((state) => state.testReceivers);\n\n // TODO I don't like integration specific code here but other ways require a bigger refactoring\n const onCallIntegrationType = watch(fieldName('settings.integration_type'));\n const isTestAvailable = onCallIntegrationType !== OnCallIntegrationType.NewIntegration;\n\n useEffect(() => {\n register(`${pathPrefix}.__id`);\n /* Need to manually register secureFields or else they'll\n be lost when testing a contact point */\n register(`${pathPrefix}.secureFields`);\n }, [register, pathPrefix]);\n\n // Prevent forgetting about initial values when switching the integration type and the oncall integration type\n useEffect(() => {\n // Restore values when switching back from a changed integration to the default one\n const subscription = watch((v, { name, type }) => {\n const value = name ? v[name] : '';\n if (initialValues && name === fieldName('type') && value === initialValues.type && type === 'change') {\n setValue(fieldName('settings'), initialValues.settings);\n }\n // Restore initial value of an existing oncall integration\n if (\n initialValues &&\n name === fieldName('settings.integration_type') &&\n value === OnCallIntegrationType.ExistingIntegration\n ) {\n setValue(fieldName('settings.url'), initialValues.settings['url']);\n }\n });\n\n return () => subscription.unsubscribe();\n }, [selectedType, initialValues, setValue, fieldName, watch]);\n\n const [_secureFields, setSecureFields] = useState(secureFields ?? {});\n\n const onResetSecureField = (key: string) => {\n if (_secureFields[key]) {\n const updatedSecureFields = { ...secureFields };\n delete updatedSecureFields[key];\n setSecureFields(updatedSecureFields);\n setValue(`${pathPrefix}.secureFields`, updatedSecureFields);\n }\n };\n\n const typeOptions = useMemo(\n (): SelectableValue[] =>\n sortBy(notifiers, ({ dto, meta }) => [meta?.order ?? 0, dto.name])\n // .notifiers.sort((a, b) => a.dto.name.localeCompare(b.dto.name))\n .map
(({ dto: { name, type }, meta }) => ({\n label: name,\n value: type,\n description: meta?.description,\n isDisabled: meta ? !meta.enabled : false,\n imgUrl: meta?.iconUrl,\n })),\n [notifiers]\n );\n\n const handleTest = async () => {\n await trigger();\n const isValid = Object.keys(formState.errors).length === 0;\n\n if (isValid && onTest) {\n onTest();\n }\n };\n\n const notifier = notifiers.find(({ dto: { type } }) => type === selectedType);\n // if there are mandatory options defined, optional options will be hidden by a collapse\n // if there aren't mandatory options, all options will be shown without collapse\n const mandatoryOptions = notifier?.dto.options.filter((o) => o.required);\n const optionalOptions = notifier?.dto.options.filter((o) => !o.required);\n\n const contactPointTypeInputId = `contact-point-type-${pathPrefix}`;\n\n return (\n
\n
\n
\n
\n
(\n
onChange(value?.value)}\n />\n )}\n control={control}\n rules={{ required: true }}\n />\n
\n
\n
\n {isTestable && onTest && isTestAvailable && (\n
handleTest()}\n icon={testingReceiver ? 'spinner' : 'message'}\n >\n Test\n
\n )}\n {isEditable && (\n <>\n
onDuplicate()} icon=\"copy\">\n Duplicate\n
\n {onDelete && (\n
onDelete()}\n icon=\"trash-alt\"\n >\n Delete\n
\n )}\n >\n )}\n
\n
\n {notifier && (\n
\n
\n defaultValues={defaultValues}\n selectedChannelOptions={mandatoryOptions?.length ? mandatoryOptions! : optionalOptions!}\n secureFields={_secureFields}\n errors={errors}\n onResetSecureField={onResetSecureField}\n pathPrefix={pathPrefix}\n readOnly={!isEditable}\n customValidators={customValidators}\n />\n {!!(mandatoryOptions?.length && optionalOptions?.length) && (\n
\n {notifier.dto.info !== '' && (\n
\n {notifier.dto.info}\n
\n )}\n
\n defaultValues={defaultValues}\n selectedChannelOptions={optionalOptions!}\n secureFields={_secureFields}\n onResetSecureField={onResetSecureField}\n errors={errors}\n pathPrefix={pathPrefix}\n readOnly={!isEditable}\n customValidators={customValidators}\n />\n
\n )}\n
\n
\n
\n
\n )}\n
\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n buttons: css`\n & > * + * {\n margin-left: ${theme.spacing(1)};\n }\n `,\n innerContent: css`\n max-width: 536px;\n `,\n wrapper: css`\n margin: ${theme.spacing(2, 0)};\n padding: ${theme.spacing(1)};\n border: solid 1px ${theme.colors.border.medium};\n border-radius: ${theme.shape.radius.default};\n max-width: ${theme.breakpoints.values.xl}${theme.breakpoints.unit};\n `,\n topRow: css`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n `,\n channelSettingsHeader: css`\n margin-top: ${theme.spacing(2)};\n `,\n});\n","import React, { useEffect } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\ninterface Props {\n pathPrefix: string;\n}\n\n// we can't drop the deleted item from list entirely because\n// there will be a rece condition with register/unregister calls in react-hook-form\n// and fields will become randomly erroneously unregistered\nexport function DeletedSubForm({ pathPrefix }: Props): JSX.Element {\n const { register } = useFormContext();\n\n // required to be registered or react-hook-form will randomly drop the values when it feels like it\n useEffect(() => {\n register(`${pathPrefix}.__id`);\n register(`${pathPrefix}.__deleted`);\n }, [register, pathPrefix]);\n\n return <>>;\n}\n","import { omit } from 'lodash';\n\nimport { ChannelValues, ReceiverFormValues } from '../../../types/receiver-form';\n\nexport interface DeprecatedAuthHTTPConfig {\n bearer_token?: string;\n bearer_token_file?: string;\n}\n\nexport interface HTTPAuthConfig {\n authorization?: {\n type: string;\n credentials?: string;\n credentials_file?: string;\n };\n}\n\n// convert the newer http_config to the older (deprecated) format\nexport function normalizeFormValues(\n values?: ReceiverFormValues
\n): ReceiverFormValues
| undefined {\n if (!values) {\n return;\n }\n\n return {\n ...values,\n items: values.items.map((item) => ({\n ...item,\n settings: {\n ...item.settings,\n http_config: item.settings?.http_config ? normalizeHTTPConfig(item.settings?.http_config) : undefined,\n },\n })),\n };\n}\n\nfunction normalizeHTTPConfig(config: HTTPAuthConfig | DeprecatedAuthHTTPConfig): DeprecatedAuthHTTPConfig {\n if (isDeprecatedHTTPAuthConfig(config)) {\n return config;\n }\n\n return {\n ...omit(config, 'authorization'),\n bearer_token: config.authorization?.credentials,\n bearer_token_file: config.authorization?.credentials_file,\n };\n}\n\nfunction isDeprecatedHTTPAuthConfig(\n config: HTTPAuthConfig | DeprecatedAuthHTTPConfig\n): config is DeprecatedAuthHTTPConfig {\n return ['bearer_token', 'bearer_token_file'].some((prop) => prop in config);\n}\n","import { css } from '@emotion/css';\nimport React, { useCallback } from 'react';\nimport { FieldErrors, FormProvider, SubmitErrorHandler, useForm, Validate } from 'react-hook-form';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { isFetchError } from '@grafana/runtime';\nimport { Alert, Button, Field, Input, LinkButton, useStyles2 } from '@grafana/ui';\nimport { useAppNotification } from 'app/core/copy/appNotification';\nimport { useCleanup } from 'app/core/hooks/useCleanup';\nimport { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types';\n\nimport { getMessageFromError } from '../../../../../../core/utils/errors';\nimport { logError } from '../../../Analytics';\nimport { isOnCallFetchError } from '../../../api/onCallApi';\nimport { useControlledFieldArray } from '../../../hooks/useControlledFieldArray';\nimport { ChannelValues, CommonSettingsComponentType, ReceiverFormValues } from '../../../types/receiver-form';\nimport { makeAMLink } from '../../../utils/misc';\nimport { initialAsyncRequestState } from '../../../utils/redux';\n\nimport { ChannelSubForm } from './ChannelSubForm';\nimport { DeletedSubForm } from './fields/DeletedSubform';\nimport { Notifier } from './notifiers';\nimport { normalizeFormValues } from './util';\n\ninterface Props
{\n config: AlertManagerCortexConfig;\n notifiers: Notifier[];\n defaultItem: R;\n alertManagerSourceName: string;\n onTestChannel?: (channel: R) => void;\n onSubmit: (values: ReceiverFormValues
) => Promise
;\n takenReceiverNames: string[]; // will validate that user entered receiver name is not one of these\n commonSettingsComponent: CommonSettingsComponentType;\n initialValues?: ReceiverFormValues
;\n isEditable: boolean;\n isTestable?: boolean;\n customValidators?: Record
['customValidators']>;\n}\n\nexport function ReceiverForm
({\n config,\n initialValues,\n defaultItem,\n notifiers,\n alertManagerSourceName,\n onSubmit,\n onTestChannel,\n takenReceiverNames,\n commonSettingsComponent,\n isEditable,\n isTestable,\n customValidators,\n}: Props
): JSX.Element {\n const notifyApp = useAppNotification();\n const styles = useStyles2(getStyles);\n\n // normalize deprecated and new config values\n const normalizedConfig = normalizeFormValues(initialValues);\n\n const defaultValues = normalizedConfig ?? {\n name: '',\n items: [\n {\n ...defaultItem,\n __id: String(Math.random()),\n } as any,\n ],\n };\n\n const formAPI = useForm
>({\n // making a copy here beacuse react-hook-form will mutate these, and break if the object is frozen. for real.\n defaultValues: structuredClone(defaultValues),\n });\n\n useCleanup((state) => (state.unifiedAlerting.saveAMConfig = initialAsyncRequestState));\n\n const {\n handleSubmit,\n register,\n formState: { errors, isSubmitting },\n getValues,\n } = formAPI;\n\n const { fields, append, remove } = useControlledFieldArray
({ name: 'items', formAPI, softDelete: true });\n\n const validateNameIsAvailable: Validate
> = useCallback(\n (name: string) =>\n takenReceiverNames.map((name) => name.trim().toLowerCase()).includes(name.trim().toLowerCase())\n ? 'Another receiver with this name already exists.'\n : true,\n [takenReceiverNames]\n );\n\n const submitCallback = async (values: ReceiverFormValues
) => {\n try {\n await onSubmit({\n ...values,\n items: values.items.filter((item) => !item.__deleted),\n });\n } catch (e) {\n if (e instanceof Error || isFetchError(e)) {\n notifyApp.error('Failed to save the contact point', getErrorMessage(e));\n\n const error = new Error('Failed to save the contact point');\n error.cause = e;\n logError(error);\n }\n throw e;\n }\n };\n\n const onInvalid: SubmitErrorHandler
> = () => {\n notifyApp.error('There are errors in the form. Please correct them and try again!');\n };\n\n return (\n
\n {!config.alertmanager_config.route && (\n
\n Because there is no default policy configured yet, this contact point will automatically be set as default.\n
\n )}\n
\n
\n {!isEditable ? 'Contact point' : initialValues ? 'Update contact point' : 'Create contact point'}\n
\n
\n
\n
\n {fields.map((field, index) => {\n const pathPrefix = `items.${index}.`;\n if (field.__deleted) {\n return
;\n }\n const initialItem = initialValues?.items.find(({ __id }) => __id === field.__id);\n return (\n
\n defaultValues={field}\n initialValues={initialItem}\n key={field.__id}\n onDuplicate={() => {\n const currentValues: R = getValues().items[index];\n append({ ...currentValues, __id: String(Math.random()) });\n }}\n onTest={\n onTestChannel\n ? () => {\n const currentValues: R = getValues().items[index];\n onTestChannel(currentValues);\n }\n : undefined\n }\n onDelete={() => remove(index)}\n pathPrefix={pathPrefix}\n notifiers={notifiers}\n secureFields={initialItem?.secureFields}\n errors={errors?.items?.[index] as FieldErrors
}\n commonSettingsComponent={commonSettingsComponent}\n isEditable={isEditable}\n isTestable={isTestable}\n customValidators={customValidators ? customValidators[field.type] : undefined}\n />\n );\n })}\n <>\n {isEditable && (\n
append({ ...defaultItem, __id: String(Math.random()) })}\n >\n Add contact point integration\n
\n )}\n
\n {isEditable && (\n <>\n {isSubmitting && (\n
\n Saving...\n
\n )}\n {!isSubmitting &&
Save contact point
}\n >\n )}\n
\n Cancel\n
\n
\n >\n
\n
\n );\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n heading: css`\n margin: ${theme.spacing(4, 0)};\n `,\n buttons: css`\n margin-top: ${theme.spacing(4)};\n\n & > * + * {\n margin-left: ${theme.spacing(1)};\n }\n `,\n});\n\nfunction getErrorMessage(error: unknown) {\n if (isOnCallFetchError(error)) {\n return error.data.detail;\n }\n\n return getMessageFromError(error);\n}\n","import { Receiver } from 'app/plugins/datasource/alertmanager/types';\n\nimport { OnCallIntegrationDTO } from '../../../../api/onCallApi';\n\n// TODO This value needs to be changed to grafana_alerting when the OnCall team introduces the necessary changes\nexport const GRAFANA_ONCALL_INTEGRATION_TYPE = 'grafana_alerting';\n\nexport enum ReceiverTypes {\n OnCall = 'oncall',\n}\n\nexport const isInOnCallIntegrations = (url: string, integrationsUrls: string[]) => {\n return integrationsUrls.includes(url);\n};\n\nexport const isOnCallReceiver = (receiver: Receiver, integrations: OnCallIntegrationDTO[]) => {\n if (!receiver.grafana_managed_receiver_configs) {\n return false;\n }\n // A receiver it's an onCall contact point if it includes only one integration, and this integration it's an onCall\n // An integration it's an onCall type if it's included in the list of integrations returned by the onCall api endpoint\n const onlyOneIntegration = receiver.grafana_managed_receiver_configs.length === 1;\n const isOnCall = isInOnCallIntegrations(\n receiver.grafana_managed_receiver_configs[0]?.settings?.url ?? '',\n integrations.map((i) => i.integration_url)\n );\n return onlyOneIntegration && isOnCall;\n};\n","import { produce } from 'immer';\nimport { useCallback, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { isFetchError } from '@grafana/runtime';\n\nimport { useAppNotification } from '../../../../../../../core/copy/appNotification';\nimport { Receiver } from '../../../../../../../plugins/datasource/alertmanager/types';\nimport { NotifierDTO } from '../../../../../../../types';\nimport { ONCALL_INTEGRATION_V2_FEATURE, onCallApi } from '../../../../api/onCallApi';\nimport { usePluginBridge } from '../../../../hooks/usePluginBridge';\nimport { SupportedPlugin } from '../../../../types/pluginBridges';\nimport { option } from '../../../../utils/notifier-types';\nimport { GRAFANA_APP_RECEIVERS_SOURCE_IMAGE } from '../types';\n\nimport { GRAFANA_ONCALL_INTEGRATION_TYPE, ReceiverTypes } from './onCall';\n\nexport enum OnCallIntegrationType {\n NewIntegration = 'new_oncall_integration',\n ExistingIntegration = 'existing_oncall_integration',\n}\n\nexport enum OnCallIntegrationSetting {\n IntegrationType = 'integration_type',\n IntegrationName = 'integration_name',\n}\n\nenum OnCallIntegrationStatus {\n Disabled = 'disabled',\n // The old integration done exclusively on the OnCall side\n // Relies on automatic creation of contact points and altering notification policies\n // If enabled Alerting UI should not enable any OnCall integration features\n V1 = 'v1',\n // The new integration - On Alerting side we create OnCall integrations and use theirs URLs\n // as parameters for oncall contact points\n V2 = 'v2',\n}\n\nfunction useOnCallPluginStatus() {\n const {\n installed: isOnCallEnabled,\n loading: isPluginBridgeLoading,\n error: pluginError,\n } = usePluginBridge(SupportedPlugin.OnCall);\n\n const {\n data: onCallFeatures = [],\n error: onCallFeaturesError,\n isLoading: isOnCallFeaturesLoading,\n } = onCallApi.endpoints.features.useQuery(undefined, { skip: !isOnCallEnabled });\n\n const integrationStatus = useMemo((): OnCallIntegrationStatus => {\n if (!isOnCallEnabled) {\n return OnCallIntegrationStatus.Disabled;\n }\n // TODO Support for V2 integration should be added when the OnCall team introduces the necessary changes\n\n return onCallFeatures.includes(ONCALL_INTEGRATION_V2_FEATURE)\n ? OnCallIntegrationStatus.V2\n : OnCallIntegrationStatus.V1;\n }, [isOnCallEnabled, onCallFeatures]);\n\n const isAlertingV2IntegrationEnabled = useMemo(\n () => integrationStatus === OnCallIntegrationStatus.V2,\n [integrationStatus]\n );\n\n return {\n isOnCallEnabled,\n integrationStatus,\n isAlertingV2IntegrationEnabled,\n isOnCallStatusLoading: isPluginBridgeLoading || isOnCallFeaturesLoading,\n onCallError: pluginError ?? onCallFeaturesError,\n };\n}\n\nexport function useOnCallIntegration() {\n const notifyApp = useAppNotification();\n\n const { isOnCallEnabled, integrationStatus, isAlertingV2IntegrationEnabled, isOnCallStatusLoading, onCallError } =\n useOnCallPluginStatus();\n\n const { useCreateIntegrationMutation, useGrafanaOnCallIntegrationsQuery, useLazyValidateIntegrationNameQuery } =\n onCallApi;\n\n const [validateIntegrationNameQuery, { isFetching: isValidating }] = useLazyValidateIntegrationNameQuery();\n const [createIntegrationMutation] = useCreateIntegrationMutation();\n\n const {\n data: grafanaOnCallIntegrations = [],\n isLoading: isLoadingOnCallIntegrations,\n isError: isIntegrationsQueryError,\n } = useGrafanaOnCallIntegrationsQuery(undefined, { skip: !isAlertingV2IntegrationEnabled });\n\n const onCallFormValidators = useMemo(() => {\n return {\n integration_name: async (value: string) => {\n try {\n await validateIntegrationNameQuery(value).unwrap();\n return true;\n } catch (error) {\n if (isFetchError(error) && error.status === 409) {\n return 'Integration of this name already exists in OnCall';\n }\n\n notifyApp.error('Failed to validate OnCall integration name. Is the OnCall API available?');\n throw error;\n }\n },\n url: (value: string) => {\n if (!isAlertingV2IntegrationEnabled) {\n return true;\n }\n\n return grafanaOnCallIntegrations.map((i) => i.integration_url).includes(value)\n ? true\n : 'Selection of existing OnCall integration is required';\n },\n };\n }, [grafanaOnCallIntegrations, validateIntegrationNameQuery, isAlertingV2IntegrationEnabled, notifyApp]);\n\n const extendOnCallReceivers = useCallback(\n (receiver: Receiver): Receiver => {\n if (!isAlertingV2IntegrationEnabled) {\n return receiver;\n }\n\n return produce(receiver, (draft) => {\n draft.grafana_managed_receiver_configs?.forEach((config) => {\n if (config.type === ReceiverTypes.OnCall) {\n config.settings[OnCallIntegrationSetting.IntegrationType] = OnCallIntegrationType.ExistingIntegration;\n }\n });\n });\n },\n [isAlertingV2IntegrationEnabled]\n );\n\n const createOnCallIntegrations = useCallback(\n async (receiver: Receiver): Promise
=> {\n if (!isAlertingV2IntegrationEnabled) {\n return receiver;\n }\n\n const onCallIntegrations = receiver.grafana_managed_receiver_configs?.filter((c) => c.type === 'oncall') ?? [];\n const newOnCallIntegrations = onCallIntegrations.filter(\n (c) => c.settings[OnCallIntegrationSetting.IntegrationType] === OnCallIntegrationType.NewIntegration\n );\n\n const createNewOnCallIntegrationJobs = newOnCallIntegrations.map(async (c) => {\n const newIntegration = await createIntegrationMutation({\n integration: GRAFANA_ONCALL_INTEGRATION_TYPE,\n verbal_name: c.settings[OnCallIntegrationSetting.IntegrationName],\n }).unwrap();\n\n c.settings['url'] = newIntegration.integration_url;\n });\n\n await Promise.all(createNewOnCallIntegrationJobs);\n\n return produce(receiver, (draft) => {\n draft.grafana_managed_receiver_configs?.forEach((c) => {\n // Clean up the settings before sending the receiver to the backend\n // The settings object can contain any additional data but integration type and name are purely frontend thing\n // and should not be sent and kept in the backend\n if (c.type === ReceiverTypes.OnCall) {\n delete c.settings[OnCallIntegrationSetting.IntegrationType];\n delete c.settings[OnCallIntegrationSetting.IntegrationName];\n }\n });\n });\n },\n [isAlertingV2IntegrationEnabled, createIntegrationMutation]\n );\n\n const extendOnCallNotifierFeatures = useCallback(\n (notifier: NotifierDTO): NotifierDTO => {\n // If V2 integration is not enabled the receiver will not be extended\n // We still allow users to use this contact point but they need to provide URL manually\n // As they do for webhook integration\n // Removing the oncall notifier from the list of available notifiers has drawbacks - it's tricky to define what should happen\n // if someone turned off or downgraded the OnCall plugin but had some receivers configured with OnCall notifier\n // By falling back to plain URL input we allow users to change the config with OnCall disabled/not supporting V2 integration\n if (notifier.type === ReceiverTypes.OnCall && isAlertingV2IntegrationEnabled) {\n const options = notifier.options.filter((o) => o.propertyName !== 'url');\n\n const newIntegrationOption: SelectableValue
= {\n value: OnCallIntegrationType.NewIntegration,\n label: 'New OnCall integration',\n description: 'A new OnCall integration without escalation chains will be automatically created',\n };\n const existingIntegrationOption: SelectableValue
= {\n value: OnCallIntegrationType.ExistingIntegration,\n label: 'Existing OnCall integration',\n description: 'Use an existing OnCall integration',\n };\n\n options.unshift(\n option(OnCallIntegrationSetting.IntegrationType, 'How to connect to OnCall', '', {\n required: true,\n element: 'radio',\n defaultValue: newIntegrationOption,\n selectOptions: [newIntegrationOption, existingIntegrationOption],\n }),\n option(\n OnCallIntegrationSetting.IntegrationName,\n 'Integration name',\n 'The name of the new OnCall integration',\n {\n required: true,\n showWhen: { field: 'integration_type', is: OnCallIntegrationType.NewIntegration },\n }\n ),\n option('url', 'OnCall Integration', 'The OnCall integration to send alerts to', {\n element: 'select',\n required: true,\n showWhen: { field: 'integration_type', is: OnCallIntegrationType.ExistingIntegration },\n selectOptions: grafanaOnCallIntegrations.map((i) => ({\n label: i.display_name,\n description: i.integration_url,\n value: i.integration_url,\n })),\n })\n );\n\n return { ...notifier, options };\n }\n\n return notifier;\n },\n [grafanaOnCallIntegrations, isAlertingV2IntegrationEnabled]\n );\n\n return {\n integrationStatus,\n onCallNotifierMeta: {\n enabled: !!isOnCallEnabled,\n order: -1, // The default is 0. We want OnCall to be the first on the list\n description: isOnCallEnabled\n ? 'Connect effortlessly to Grafana OnCall'\n : 'Enable Grafana OnCall plugin to use this integration',\n iconUrl: GRAFANA_APP_RECEIVERS_SOURCE_IMAGE[SupportedPlugin.OnCall],\n },\n extendOnCallNotifierFeatures,\n extendOnCallReceivers,\n createOnCallIntegrations,\n onCallFormValidators,\n isLoadingOnCallIntegration: isLoadingOnCallIntegrations || isOnCallStatusLoading,\n isValidating,\n hasOnCallError: Boolean(onCallError) || isIntegrationsQueryError,\n };\n}\n","import { SupportedPlugin } from '../../../types/pluginBridges';\n\nexport interface AmRouteReceiver {\n label: string;\n value: string;\n grafanaAppReceiverType?: SupportedPlugin;\n}\n\nexport const GRAFANA_APP_RECEIVERS_SOURCE_IMAGE: Record
= {\n [SupportedPlugin.OnCall]: 'public/img/alerting/oncall_logo.svg',\n\n [SupportedPlugin.Incident]: '',\n [SupportedPlugin.MachineLearning]: '',\n};\n"],"names":["ONCALL_INTEGRATION_V2_FEATURE","getProxyApiUrl","path","onCallApi","build","response","isPaginatedResponse","name","integration","useGrafanaOnCallIntegrationsQuery","isOnCallFetchError","error","CloudCommonChannelSettings","pathPrefix","className","readOnly","register","Field","Checkbox","defaultChannelValues","cloudNotifiers","n","CloudReceiverForm","existing","alertManagerSourceName","config","dispatch","isVanillaAM","existingValue","onSubmit","values","newReceiver","alertmanagerApi","takenReceiverNames","isManageableAlertManagerDataSource","Alert","ReceiverForm","GrafanaCommonChannelSettings","NotificationType","notificationOptions","value","defaultValues","TestContactPointModal","isOpen","onDismiss","onTest","notificationType","setNotificationType","styles","getStyles","formMethods","data","alert","key","acc","Modal","Label","RadioButtonGroup","AnnotationsStep","LabelsField","Button","theme","GrafanaReceiverForm","onCallNotifierMeta","extendOnCallNotifierFeatures","extendOnCallReceivers","onCallFormValidators","createOnCallIntegrations","isLoadingOnCallIntegration","hasOnCallError","useOnCallIntegration","useGrafanaNotifiersQuery","grafanaNotifiers","isLoadingNotifiers","testChannelValues","setTestChannelValues","id2original","receiverWithOnCall","newConfig","onTestChannel","testNotification","chan","payload","hasProvisionedItems","item","isEditable","isTestable","LoadingPlaceholder","notifiers","Provisioning","ChannelOptions","selectedChannelOptions","onResetSecureField","secureFields","errors","customValidators","watch","currentFormValues","option","index","paths","selectedOptionValue","Input","defaultValue","OptionField","ChannelSubForm","initialValues","onDuplicate","onDelete","CommonSettingsComponent","fieldName","control","trigger","formState","setValue","selectedType","testingReceiver","useUnifiedAlertingSelector","state","isTestAvailable","subscription","v","type","_secureFields","setSecureFields","updatedSecureFields","typeOptions","dto","meta","handleTest","notifier","mandatoryOptions","o","optionalOptions","contactPointTypeInputId","InputControl","ref","onChange","field","Select","CollapsibleSection","DeletedSubForm","normalizeFormValues","normalizeHTTPConfig","isDeprecatedHTTPAuthConfig","prop","defaultItem","commonSettingsComponent","notifyApp","formAPI","useCleanup","handleSubmit","isSubmitting","getValues","fields","append","remove","useControlledFieldArray","validateNameIsAvailable","submitCallback","e","getErrorMessage","onInvalid","initialItem","__id","currentValues","GRAFANA_ONCALL_INTEGRATION_TYPE","ReceiverTypes","isInOnCallIntegrations","url","integrationsUrls","isOnCallReceiver","receiver","integrations","onlyOneIntegration","isOnCall","i","OnCallIntegrationType","OnCallIntegrationSetting","OnCallIntegrationStatus","useOnCallPluginStatus","isOnCallEnabled","isPluginBridgeLoading","pluginError","onCallFeatures","onCallFeaturesError","isOnCallFeaturesLoading","integrationStatus","isAlertingV2IntegrationEnabled","isOnCallStatusLoading","onCallError","useCreateIntegrationMutation","useLazyValidateIntegrationNameQuery","validateIntegrationNameQuery","isValidating","createIntegrationMutation","grafanaOnCallIntegrations","isLoadingOnCallIntegrations","isIntegrationsQueryError","draft","createNewOnCallIntegrationJobs","c","newIntegration","options","newIntegrationOption","existingIntegrationOption","GRAFANA_APP_RECEIVERS_SOURCE_IMAGE"],"sourceRoot":""}