Skip to content

Commit 05174fd

Browse files
NelyDavtyanEkaterina Petrova
andauthored
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 <[email protected]>
1 parent 86dad04 commit 05174fd

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

kafka-ui-react-app/src/components/Connect/New/New.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ const New: React.FC<NewProps> = ({
127127
<div className={['field', connectNameFieldClassName].join(' ')}>
128128
<InputLabel>Connect *</InputLabel>
129129
<Controller
130+
defaultValue={connectOptions[0].value}
130131
control={control}
131132
name="connectName"
132133
render={({ field: { name, onChange } }) => (

kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const Edit: React.FC = () => {
8686
<div>
8787
<InputLabel>Type</InputLabel>
8888
<Controller
89+
defaultValue={schema.schemaType}
8990
control={control}
9091
rules={{ required: true }}
9192
name="schemaType"
@@ -108,6 +109,9 @@ const Edit: React.FC = () => {
108109
<div>
109110
<InputLabel>Compatibility level</InputLabel>
110111
<Controller
112+
defaultValue={
113+
schema.compatibilityLevel as CompatibilityLevelCompatibilityEnum
114+
}
111115
control={control}
112116
name="compatibilityLevel"
113117
render={({ field: { name, onChange } }) => (

kafka-ui-react-app/src/components/Schemas/New/New.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const New: React.FC = () => {
9999
<div>
100100
<InputLabel>Schema Type *</InputLabel>
101101
<Controller
102+
defaultValue={SchemaTypeOptions[0].value as SchemaType}
102103
control={control}
103104
rules={{ required: 'Schema Type is required.' }}
104105
name="schemaType"

kafka-ui-react-app/src/components/Topics/New/New.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ interface RouterParams {
2121

2222
const New: React.FC = () => {
2323
const methods = useForm<TopicFormData>({
24-
mode: 'onTouched',
24+
mode: 'all',
2525
resolver: yupResolver(topicFormValidationSchema),
2626
});
27+
2728
const { clusterName } = useParams<RouterParams>();
2829
const history = useHistory();
2930
const dispatch = useDispatch();

kafka-ui-react-app/src/components/Topics/shared/Form/TopicForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const TopicForm: React.FC<Props> = ({
115115
<div>
116116
<InputLabel>Cleanup policy</InputLabel>
117117
<Controller
118+
defaultValue={CleanupPolicyOptions[0].value}
118119
control={control}
119120
name="cleanupPolicy"
120121
render={({ field: { name, onChange } }) => (
@@ -142,6 +143,7 @@ const TopicForm: React.FC<Props> = ({
142143
<Controller
143144
control={control}
144145
name="retentionBytes"
146+
defaultValue={0}
145147
render={({ field: { name, onChange } }) => (
146148
<Select
147149
name={name}

0 commit comments

Comments
 (0)