Skip to content

Commit 0d2dbe8

Browse files
committed
retain old behavior
1 parent 223fc4d commit 0d2dbe8

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

frontend/src/widgets/ClusterConfigForm/Sections/KSQL.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, {useState} from 'react';
22
import Input from 'components/common/Input/Input';
33
import { useFormContext } from 'react-hook-form';
44
import SectionHeader from 'widgets/ClusterConfigForm/common/SectionHeader';
@@ -8,7 +8,9 @@ import Credentials from 'widgets/ClusterConfigForm/common/Credentials';
88
const KSQL = () => {
99
const { setValue, watch } = useFormContext();
1010
const ksql = watch('ksql');
11+
const [configOpen, setConfigOpen] = useState(false);
1112
const toggleConfig = () => {
13+
setConfigOpen((prevConfigOpen) => !prevConfigOpen);
1214
setValue('ksql', ksql ? undefined : { url: '', isAuth: false }, {
1315
shouldValidate: true,
1416
shouldDirty: true,
@@ -19,11 +21,11 @@ const KSQL = () => {
1921
<>
2022
<SectionHeader
2123
title="KSQL DB"
22-
adding={!ksql}
24+
adding={!configOpen}
2325
addButtonText="Configure KSQL DB"
2426
onClick={toggleConfig}
2527
/>
26-
{ksql && (
28+
{configOpen && (
2729
<>
2830
<Input
2931
label="URL *"

frontend/src/widgets/ClusterConfigForm/Sections/SchemaRegistry.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ import SSLForm from 'widgets/ClusterConfigForm/common/SSLForm';
77
import Credentials from 'widgets/ClusterConfigForm/common/Credentials';
88

99
const SchemaRegistry = () => {
10-
const { setValue } = useFormContext();
10+
const { setValue, watch } = useFormContext();
11+
const schemaRegistry = watch('schemaRegistry');
1112
const [configOpen, setConfigOpen] = useState(false);
1213
const toggleConfig = () => {
1314
setConfigOpen((prevConfigOpen) => !prevConfigOpen);
14-
setValue('schemaRegistry', { url: '', isAuth: false });
15+
setValue('schemaRegistry', schemaRegistry ? undefined : { url: '', isAuth: false }, {
16+
shouldValidate: true,
17+
shouldDirty: true,
18+
shouldTouch: true,
19+
});
1520
};
1621
return (
1722
<>

0 commit comments

Comments
 (0)