Alerting: Fix contact points url field validation (#74510)

This commit is contained in:
Konrad Lalik 2023-09-07 10:58:47 +02:00 committed by GitHub
parent a6aa8f46d1
commit 8b00d7d7af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import {
updateConfigWithReceiver,
} from '../../../utils/receiver-form';
import { ProvisionedResource, ProvisioningAlert } from '../../Provisioning';
import { ReceiverTypes } from '../grafanaAppReceivers/onCall/onCall';
import { useOnCallIntegration } from '../grafanaAppReceivers/onCall/useOnCallIntegration';
import { GrafanaCommonChannelSettings } from './GrafanaCommonChannelSettings';
@ -167,7 +168,7 @@ export const GrafanaReceiverForm = ({ existing, alertManagerSourceName, config }
defaultItem={{ ...defaultChannelValues }}
takenReceiverNames={takenReceiverNames}
commonSettingsComponent={GrafanaCommonChannelSettings}
customValidators={onCallFormValidators}
customValidators={{ [ReceiverTypes.OnCall]: onCallFormValidators }}
/>
<TestContactPointModal
onDismiss={() => setTestChannelValues(undefined)}

View File

@ -34,7 +34,7 @@ interface Props<R extends ChannelValues> {
initialValues?: ReceiverFormValues<R>;
isEditable: boolean;
isTestable?: boolean;
customValidators?: React.ComponentProps<typeof ChannelSubForm>['customValidators'];
customValidators?: Record<string, React.ComponentProps<typeof ChannelSubForm>['customValidators']>;
}
export function ReceiverForm<R extends ChannelValues>({
@ -167,7 +167,7 @@ export function ReceiverForm<R extends ChannelValues>({
commonSettingsComponent={commonSettingsComponent}
isEditable={isEditable}
isTestable={isTestable}
customValidators={customValidators}
customValidators={customValidators ? customValidators[field.type] : undefined}
/>
);
})}