2023-02-13 12:41:30 +00:00
|
|
|
import {
|
|
|
|
|
SimpleForm,
|
|
|
|
|
FormDataConsumer,
|
|
|
|
|
TextInput,
|
|
|
|
|
Create,
|
|
|
|
|
ArrayInput,
|
|
|
|
|
SimpleFormIterator,
|
|
|
|
|
regex,
|
|
|
|
|
required,
|
|
|
|
|
CreateProps,
|
|
|
|
|
} from "react-admin";
|
|
|
|
|
import { BackendTypeInput, BackendIdInput, HttpMethodInput } from "./shared";
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ReferenceInput
|
|
|
|
|
label="Voice Line"
|
|
|
|
|
source="voiceLineId"
|
|
|
|
|
reference="voiceLines"
|
|
|
|
|
validate={[required()]}
|
|
|
|
|
>
|
|
|
|
|
<SelectInput optionText="number" />
|
|
|
|
|
</ReferenceInput>
|
|
|
|
|
*/
|
2023-03-15 12:17:43 +00:00
|
|
|
const WebhookCreate = (props: CreateProps) => (
|
|
|
|
|
<Create {...props} title="Create Webhooks">
|
|
|
|
|
<SimpleForm>
|
|
|
|
|
<TextInput source="name" validate={[required()]} />
|
|
|
|
|
<BackendTypeInput />
|
|
|
|
|
<FormDataConsumer subscription={{ values: true }}>
|
|
|
|
|
{BackendIdInput}
|
|
|
|
|
</FormDataConsumer>
|
|
|
|
|
<TextInput
|
|
|
|
|
source="endpointUrl"
|
|
|
|
|
validate={[required(), regex(/^https?:\/\/[^/]+/, "validation.url")]}
|
|
|
|
|
/>
|
|
|
|
|
<HttpMethodInput />
|
|
|
|
|
<ArrayInput source="headers">
|
|
|
|
|
<SimpleFormIterator>
|
|
|
|
|
<TextInput
|
|
|
|
|
source="header"
|
|
|
|
|
validate={[required(), regex(/^[\w-]+$/, "validation.headerName")]}
|
|
|
|
|
/>
|
|
|
|
|
<TextInput source="value" validate={[required()]} />
|
|
|
|
|
</SimpleFormIterator>
|
|
|
|
|
</ArrayInput>
|
|
|
|
|
</SimpleForm>
|
|
|
|
|
</Create>
|
|
|
|
|
);
|
2023-02-13 12:41:30 +00:00
|
|
|
|
|
|
|
|
export default WebhookCreate;
|