import React from 'react'; import type { AppForm } from '@/components/form'; import TitledGreyBox from '@/components/elements/TitledGreyBox'; import Label from '@/components/elements/Label'; import type { CodemirrorEditorHandle } from '@/components/elements/LazyCodemirrorEditor'; import CodemirrorEditor from '@/components/elements/LazyCodemirrorEditor'; import type { AdminEggListItem } from '@/api/admin/eggs/queries'; import type { EggFormValues } from '@/components/admin/eggs/helpers'; export type EggForm = AppForm; const validateEggName = (value: string): string | undefined => { if (value.length < 1) { return 'An egg name must be provided.'; } if (value.length > 191) { return 'An egg name must not exceed 191 characters.'; } return undefined; }; const EggJsonField = ({ label, description, initialContent, editorRef, }: { label: string; description: string; initialContent: string; editorRef: React.RefObject; }) => (
{}} />

{description}

); interface Props { form: EggForm; eggs: AdminEggListItem[]; initialConfigLogs: string; initialConfigFiles: string; initialConfigStartup: string; logRef: React.RefObject; filesRef: React.RefObject; startupRef: React.RefObject; } const EggConfigurationFields = ({ form, eggs, initialConfigLogs, initialConfigFiles, initialConfigStartup, logRef, filesRef, startupRef, }: Props) => (
validateEggName(value), }} > {(field) => ( )} {(field) => ( )} {(field) => ( )}
value.length >= 1 ? undefined : 'At least one docker image must be provided.', }} > {(field) => ( )} value.length >= 1 ? undefined : 'A startup command must be provided.', }} > {(field) => ( )} {(field) => ( )}

These options should not be edited unless you understand how this system works. All fields are required unless you select an Egg from the "Copy Settings From" dropdown, in which case the process fields may be left blank to inherit from that Egg.

{(field) => ( ({ value: egg.attributes.id, label: `${egg.attributes.name} <${egg.attributes.author}>`, })), ]} /> )} {(field) => ( )}
); export default EggConfigurationFields;