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:
NelyDavtyan 2022-01-24 22:33:16 +04:00 committed by GitHub
parent 86dad04448
commit 05174fd684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 1 deletions

View file

@ -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 } }) => (

View file

@ -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 } }) => (

View file

@ -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"

View file

@ -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();

View file

@ -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}