fixing cannot create a topic issue,added some default values to pass … (#1467)
* fixing cannot create a topic issue,added some default values to pass validation * fixed default values in other forms Co-authored-by: Ekaterina Petrova <epetrova@provectus.com>
This commit is contained in:
parent
86dad04448
commit
05174fd684
5 changed files with 10 additions and 1 deletions
|
@ -127,6 +127,7 @@ const New: React.FC<NewProps> = ({
|
|||
<div className={['field', connectNameFieldClassName].join(' ')}>
|
||||
<InputLabel>Connect *</InputLabel>
|
||||
<Controller
|
||||
defaultValue={connectOptions[0].value}
|
||||
control={control}
|
||||
name="connectName"
|
||||
render={({ field: { name, onChange } }) => (
|
||||
|
|
|
@ -86,6 +86,7 @@ const Edit: React.FC = () => {
|
|||
<div>
|
||||
<InputLabel>Type</InputLabel>
|
||||
<Controller
|
||||
defaultValue={schema.schemaType}
|
||||
control={control}
|
||||
rules={{ required: true }}
|
||||
name="schemaType"
|
||||
|
@ -108,6 +109,9 @@ const Edit: React.FC = () => {
|
|||
<div>
|
||||
<InputLabel>Compatibility level</InputLabel>
|
||||
<Controller
|
||||
defaultValue={
|
||||
schema.compatibilityLevel as CompatibilityLevelCompatibilityEnum
|
||||
}
|
||||
control={control}
|
||||
name="compatibilityLevel"
|
||||
render={({ field: { name, onChange } }) => (
|
||||
|
|
|
@ -99,6 +99,7 @@ const New: React.FC = () => {
|
|||
<div>
|
||||
<InputLabel>Schema Type *</InputLabel>
|
||||
<Controller
|
||||
defaultValue={SchemaTypeOptions[0].value as SchemaType}
|
||||
control={control}
|
||||
rules={{ required: 'Schema Type is required.' }}
|
||||
name="schemaType"
|
||||
|
|
|
@ -21,9 +21,10 @@ interface RouterParams {
|
|||
|
||||
const New: React.FC = () => {
|
||||
const methods = useForm<TopicFormData>({
|
||||
mode: 'onTouched',
|
||||
mode: 'all',
|
||||
resolver: yupResolver(topicFormValidationSchema),
|
||||
});
|
||||
|
||||
const { clusterName } = useParams<RouterParams>();
|
||||
const history = useHistory();
|
||||
const dispatch = useDispatch();
|
||||
|
|
|
@ -115,6 +115,7 @@ const TopicForm: React.FC<Props> = ({
|
|||
<div>
|
||||
<InputLabel>Cleanup policy</InputLabel>
|
||||
<Controller
|
||||
defaultValue={CleanupPolicyOptions[0].value}
|
||||
control={control}
|
||||
name="cleanupPolicy"
|
||||
render={({ field: { name, onChange } }) => (
|
||||
|
@ -142,6 +143,7 @@ const TopicForm: React.FC<Props> = ({
|
|||
<Controller
|
||||
control={control}
|
||||
name="retentionBytes"
|
||||
defaultValue={0}
|
||||
render={({ field: { name, onChange } }) => (
|
||||
<Select
|
||||
name={name}
|
||||
|
|
Loading…
Add table
Reference in a new issue