@@ -21,12 +21,11 @@ import {
21
21
22
22
import {
23
23
MAX_PORT_NUMBER ,
24
- validateEmail ,
25
24
validateField ,
26
25
validatePortNumber ,
27
26
} from 'uiSrc/utils/validations'
28
27
import { APPLICATION_NAME } from 'uiSrc/constants'
29
- import { ErrorTextValidation , handlePasteHostName } from 'uiSrc/utils'
28
+ import { handlePasteHostName } from 'uiSrc/utils'
30
29
import validationErrors from 'uiSrc/constants/validationErrors'
31
30
import { ICredentialsRedisCluster } from 'uiSrc/slices/interfaces'
32
31
@@ -65,8 +64,6 @@ const fieldDisplayNames: Values = {
65
64
password : 'Admin Password' ,
66
65
}
67
66
68
- const initErrorEmail = `Username/email ${ ErrorTextValidation . FormatIncorrect } `
69
-
70
67
const Message = ( ) => (
71
68
< EuiText color = "subdued" size = "s" className = { styles . message } data-testid = "summary" >
72
69
Your Redis Enterprise databases can be automatically added. Enter the
@@ -105,7 +102,6 @@ const ClusterConnectionForm = (props: Props) => {
105
102
const [ errors , setErrors ] = useState < FormikErrors < Values > > (
106
103
host || port || username || password ? { } : fieldDisplayNames
107
104
)
108
- const [ errorEmail , setErrorEmail ] = useState < string > ( '' )
109
105
110
106
const [ initialValues , setInitialValues ] = useState ( {
111
107
host,
@@ -132,24 +128,6 @@ const ClusterConnectionForm = (props: Props) => {
132
128
! value && Object . assign ( errs , { [ key ] : fieldDisplayNames [ key ] } )
133
129
)
134
130
135
- if (
136
- values . username
137
- && formik . touched . username
138
- && ! validateEmail ( values . username )
139
- ) {
140
- setErrorEmail ( initErrorEmail )
141
- Object . assign ( errs , { username : initErrorEmail } )
142
- }
143
-
144
- if (
145
- values . username
146
- && formik . touched . username
147
- && validateEmail ( values . username )
148
- ) {
149
- setErrorEmail ( '' )
150
- delete errs . username
151
- }
152
-
153
131
setErrors ( errs )
154
132
return errs
155
133
}
@@ -173,16 +151,6 @@ const ClusterConnectionForm = (props: Props) => {
173
151
}
174
152
}
175
153
176
- const onBlurUsername = ( username : string ) => {
177
- formik . setFieldTouched ( 'username' )
178
- if ( username && ! validateEmail ( username ) ) {
179
- setErrorEmail ( initErrorEmail )
180
- setErrors ( Object . assign ( errors , { username : initErrorEmail } ) )
181
- } else {
182
- setErrorEmail ( '' )
183
- }
184
- }
185
-
186
154
const AppendHostName = ( ) => (
187
155
< EuiToolTip
188
156
title = { (
@@ -342,23 +310,16 @@ const ClusterConnectionForm = (props: Props) => {
342
310
< EuiFlexItem className = { flexItemClassName } >
343
311
< EuiFormRow
344
312
label = "Admin Username*"
345
- error = { errorEmail }
346
- isInvalid = { ! ! errorEmail }
347
313
>
348
314
< EuiFieldText
349
315
name = "username"
350
316
id = "username"
351
317
data-testid = "username"
352
318
fullWidth
353
319
maxLength = { 200 }
354
- isInvalid = { ! ! errorEmail }
355
320
placeholder = "Enter Admin Username"
356
321
value = { formik . values . username }
357
322
onChange = { formik . handleChange }
358
- onBlur = { ( e : React . FocusEvent < HTMLInputElement > ) => {
359
- onBlurUsername ( e . target . value )
360
- formik . handleBlur ( e )
361
- } }
362
323
/>
363
324
</ EuiFormRow >
364
325
</ EuiFlexItem >
0 commit comments