Move in progress apps temporarily

This commit is contained in:
Darren Clarke 2023-03-07 14:09:49 +00:00
parent ba04aa108c
commit 6eaaf8e9be
360 changed files with 6171 additions and 55 deletions

View file

@ -1,68 +0,0 @@
import { SelectInput, required } from "react-admin";
import {
VoiceLineField,
VoiceLineSelectInput,
} from "../voice/voicelines/shared";
import {
WhatsAppBotField,
WhatsAppBotSelectInput,
} from "../whatsapp/bots/shared";
import { SignalBotField, SignalBotSelectInput } from "../signal/bots/shared";
const httpChoices = [
{ id: "post", name: "POST" },
{ id: "put", name: "PUT" },
];
export const HttpMethodInput = (props) => (
<SelectInput
source="httpMethod"
choices={httpChoices}
validate={[required()]}
initialValue="post"
{...props}
/>
);
const backendChoices = [
{ id: "signal", name: "Signal" },
{ id: "whatsapp", name: "WhatsApp" },
{ id: "voice", name: "Voice" },
];
const backendInputComponents = {
whatsapp: WhatsAppBotSelectInput("backendId"),
signal: SignalBotSelectInput("backendId"),
voice: VoiceLineSelectInput("backendId"),
};
const backendFieldComponents = {
whatsapp: WhatsAppBotField("backendId"),
signal: SignalBotField("backendId"),
voice: VoiceLineField("backendId"),
};
export const BackendTypeInput = (props) => (
<SelectInput
source="backendType"
choices={backendChoices}
validate={[required()]}
{...props}
/>
);
export const BackendIdInput = (form, ...rest) => {
const Component = form.formData.backendType
? backendInputComponents[form.formData.backendType]
: false;
return <>{Component && <Component form={form} {...rest} />}</>;
};
export const BackendIdField = (form, ...rest) => {
console.log(form);
const Component = form.record.backendType
? backendFieldComponents[form.record.backendType]
: false;
return <>{Component && <Component form={form} {...rest} />}</>;
};