2023-09-04 18:07:29 +00:00
import { FormikErrors } from 'formik' ;
import { FormControl } from '@@/form-components/FormControl' ;
import { Input } from '@@/form-components/Input' ;
import { ConsoleSettings } from './ConsoleSettings' ;
import { LoggerConfig } from './LoggerConfig' ;
import { OverridableInput } from './OverridableInput' ;
import { Values } from './types' ;
export function CommandsTab ( {
apiVersion ,
values ,
2023-10-19 11:45:50 +00:00
setFieldValue ,
2023-09-04 18:07:29 +00:00
errors ,
} : {
apiVersion : number ;
values : Values ;
2023-10-19 11:45:50 +00:00
setFieldValue : ( field : string , value : unknown ) = > void ;
2023-09-04 18:07:29 +00:00
errors? : FormikErrors < Values > ;
} ) {
return (
< div className = "mt-3" >
< FormControl
label = "Command"
inputId = "command-input"
size = "xsmall"
errors = { errors ? . cmd }
>
< OverridableInput
2023-10-19 11:45:50 +00:00
value = { values . cmd }
onChange = { ( cmd ) = > setFieldValue ( 'cmd' , cmd ) }
2023-09-04 18:07:29 +00:00
id = "command-input"
placeholder = "e.g. '-logtostderr' '--housekeeping_interval=5s' or /usr/bin/nginx -t -c /mynginx.conf"
/ >
< / FormControl >
< FormControl
label = "Entrypoint"
inputId = "entrypoint-input"
size = "xsmall"
tooltip = "When container entrypoint is entered as part of the Command field, set Entrypoint to Override mode and leave blank, else it will revert to default."
errors = { errors ? . entrypoint }
>
< OverridableInput
2023-10-19 11:45:50 +00:00
value = { values . entrypoint }
onChange = { ( entrypoint ) = > setFieldValue ( 'entrypoint' , entrypoint ) }
2023-09-04 18:07:29 +00:00
id = "entrypoint-input"
placeholder = "e.g. /bin/sh -c"
/ >
< / FormControl >
< div className = "flex justify-between gap-4" >
< FormControl
label = "Working Dir"
inputId = "working-dir-input"
className = "w-1/2"
errors = { errors ? . workingDir }
>
< Input
2023-10-19 11:45:50 +00:00
value = { values . workingDir }
onChange = { ( e ) = > setFieldValue ( 'workingDir' , e . target . value ) }
2023-09-04 18:07:29 +00:00
placeholder = "e.g. /myapp"
/ >
< / FormControl >
< FormControl
label = "User"
inputId = "user-input"
className = "w-1/2"
errors = { errors ? . user }
>
< Input
2023-10-19 11:45:50 +00:00
value = { values . user }
onChange = { ( e ) = > setFieldValue ( 'user' , e . target . value ) }
2023-09-04 18:07:29 +00:00
placeholder = "e.g. nginx"
/ >
< / FormControl >
< / div >
< ConsoleSettings
2023-10-19 11:45:50 +00:00
value = { values . console }
onChange = { ( console ) = > setFieldValue ( 'console' , console ) }
2023-09-04 18:07:29 +00:00
/ >
< LoggerConfig
apiVersion = { apiVersion }
2023-10-19 11:45:50 +00:00
value = { values . logConfig }
onChange = { ( logConfig ) = > setFieldValue ( 'logConfig' , logConfig ) }
2023-09-04 18:07:29 +00:00
errors = { errors ? . logConfig }
/ >
< / div >
) ;
}