import { ReactNode } from 'react'; import { mixed } from 'yup'; import { ContainerConfig } from 'docker-types/generated/1.41'; import { FormControl } from '@@/form-components/FormControl'; const consoleSettingTypes = ['tty', 'interactive', 'both', 'none'] as const; export type ConsoleSetting = (typeof consoleSettingTypes)[number]; export type ConsoleConfig = Pick; export function ConsoleSettings({ value, onChange, }: { value: ConsoleSetting; onChange(value: ConsoleSetting): void; }) { return ( Interactive & TTY (-i -t) } selected={value} /> Interactive (-i) } selected={value} /> TTY (-t) } selected={value} /> None} selected={value} /> ); function handleChange(value: ConsoleSetting) { onChange(value); } } function Item({ value, selected, onChange, label, }: { value: ConsoleSetting; selected: ConsoleSetting; onChange(value: ConsoleSetting): void; label: ReactNode; }) { return ( ); } export function validation() { return mixed() .oneOf([...consoleSettingTypes]) .default('none'); }