File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
frontend/src/widgets/ClusterConfigForm/Sections Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import { useState } from 'react' ;
2
3
import Input from 'components/common/Input/Input' ;
3
4
import { useFormContext } from 'react-hook-form' ;
4
5
import SectionHeader from 'widgets/ClusterConfigForm/common/SectionHeader' ;
5
6
import SSLForm from 'widgets/ClusterConfigForm/common/SSLForm' ;
6
7
import Credentials from 'widgets/ClusterConfigForm/common/Credentials' ;
7
8
8
9
const SchemaRegistry = ( ) => {
9
- const { setValue, watch } = useFormContext ( ) ;
10
- const schemaRegistry = watch ( 'schemaRegistry' ) ;
10
+ const { setValue } = useFormContext ( ) ;
11
+ const [ configOpen , setConfigOpen ] = useState ( false ) ;
11
12
const toggleConfig = ( ) => {
12
- setValue (
13
- 'schemaRegistry' ,
14
- schemaRegistry ? undefined : { url : '' , isAuth : false } ,
15
- { shouldValidate : true , shouldDirty : true , shouldTouch : true }
16
- ) ;
13
+ setConfigOpen ( ( prevConfigOpen ) => ! prevConfigOpen ) ;
14
+ setValue ( 'schemaRegistry' , { url : '' , isAuth : false } ) ;
17
15
} ;
18
16
return (
19
17
< >
20
18
< SectionHeader
21
19
title = "Schema Registry"
22
- adding = { ! schemaRegistry }
20
+ adding = { ! configOpen }
23
21
addButtonText = "Configure Schema Registry"
24
22
onClick = { toggleConfig }
25
23
/>
26
- { schemaRegistry && (
24
+ { configOpen && (
27
25
< >
28
26
< Input
29
27
label = "URL *"
You can’t perform that action at this time.
0 commit comments