@@ -18,8 +18,6 @@ import { KeyboardEventHandler, useEffect, useState } from 'react'
18
18
import {
19
19
showError ,
20
20
Progressing ,
21
- TippyCustomized ,
22
- TippyTheme ,
23
21
sortCallback ,
24
22
ErrorScreenNotAuthorized ,
25
23
Reload ,
@@ -53,7 +51,7 @@ import {
53
51
RegistryIcon ,
54
52
ComponentSizeType ,
55
53
PasswordField ,
56
- OtherRegistryAuthenticationType ,
54
+ RegistryCredentialsType ,
57
55
} from '@devtron-labs/devtron-fe-common-lib'
58
56
import Tippy from '@tippyjs/react'
59
57
import { useHistory , useParams , useRouteMatch } from 'react-router-dom'
@@ -261,7 +259,7 @@ const CollapsedList = ({
261
259
repositoryList = [ ] ,
262
260
disabledFields = [ ] ,
263
261
ociRegistryConfig,
264
- credentialsType ,
262
+ registryCredentialsType ,
265
263
...rest
266
264
} ) => {
267
265
const [ collapsed , toggleCollapse ] = useState ( true )
@@ -341,7 +339,7 @@ const CollapsedList = ({
341
339
isPublic,
342
340
disabledFields,
343
341
ociRegistryConfig,
344
- credentialsType ,
342
+ registryCredentialsType ,
345
343
} }
346
344
/>
347
345
) }
@@ -381,7 +379,7 @@ const DockerForm = ({
381
379
: {
382
380
CONTAINER : OCIRegistryConfigConstants . PULL_PUSH ,
383
381
} ,
384
- credentialsType : authCredentialsType ,
382
+ registryCredentialsType ,
385
383
...rest
386
384
} ) => {
387
385
const re = PATTERNS . APP_NAME
@@ -439,7 +437,7 @@ const DockerForm = ({
439
437
registryUrl : { value : registryUrl , error : '' } ,
440
438
username : { value : username , error : '' } ,
441
439
password : {
442
- value : id && ! password ? DEFAULT_SECRET_PLACEHOLDER : regPass ,
440
+ value : id && username && ! password ? DEFAULT_SECRET_PLACEHOLDER : regPass ,
443
441
error : '' ,
444
442
} ,
445
443
repositoryList : {
@@ -544,8 +542,8 @@ const DockerForm = ({
544
542
const [ registryStorageType , setRegistryStorageType ] = useState < string > (
545
543
isPublic ? RegistryStorageType . OCI_PUBLIC : RegistryStorageType . OCI_PRIVATE ,
546
544
)
547
- const [ authenticationType , setAuthenticationType ] = useState < OtherRegistryAuthenticationType > (
548
- id && authCredentialsType ? authCredentialsType : OtherRegistryAuthenticationType . USERNAME_PASSWORD ,
545
+ const [ authenticationType , setAuthenticationType ] = useState < RegistryCredentialsType > (
546
+ id && registryCredentialsType ? registryCredentialsType : RegistryCredentialsType . USERNAME_PASSWORD ,
549
547
)
550
548
551
549
const InitialValueOfIsContainerStore : boolean =
@@ -721,7 +719,7 @@ const DockerForm = ({
721
719
}
722
720
723
721
const handleChangeOtherRegistryAuthType = ( e ) => {
724
- const updatedAuthType = e . target . value as OtherRegistryAuthenticationType
722
+ const updatedAuthType = e . target . value as RegistryCredentialsType
725
723
setAuthenticationType ( updatedAuthType )
726
724
}
727
725
@@ -818,7 +816,7 @@ const DockerForm = ({
818
816
...( registryStorageType !== RegistryStorageType . OCI_PUBLIC &&
819
817
selectedDockerRegistryType . value === RegistryType . OTHER
820
818
? {
821
- ...( authenticationType === OtherRegistryAuthenticationType . USERNAME_PASSWORD
819
+ ...( authenticationType === RegistryCredentialsType . USERNAME_PASSWORD
822
820
? {
823
821
username : trimmedUsername ,
824
822
password : parsePassword ( customState . password . value ) ,
@@ -857,7 +855,7 @@ const DockerForm = ({
857
855
sshConnectionType ,
858
856
) ,
859
857
...( AuthenticationTypeRadio && selectedDockerRegistryType . value === RegistryType . OTHER
860
- ? { credentialsType : authenticationType }
858
+ ? { registryCredentialsType : authenticationType }
861
859
: { } ) ,
862
860
}
863
861
}
@@ -1023,13 +1021,13 @@ const DockerForm = ({
1023
1021
let error = false
1024
1022
if (
1025
1023
registryStorageType === RegistryStorageType . OCI_PRIVATE &&
1026
- authenticationType === OtherRegistryAuthenticationType . USERNAME_PASSWORD &&
1027
- ( ! customState . username . value || ! ( customState . password . value || id ) )
1024
+ authenticationType === RegistryCredentialsType . USERNAME_PASSWORD &&
1025
+ ( ! customState . username . value || ! ( customState . password . value || ( id && username ) ) )
1028
1026
) {
1029
1027
setCustomState ( ( st ) => ( {
1030
1028
...st ,
1031
1029
username : { ...st . username , error : st . username . value ? '' : 'Mandatory' } ,
1032
- password : { ...st . password , error : id || st . password . value ? '' : 'Mandatory' } ,
1030
+ password : { ...st . password , error : ( id && username ) || st . password . value ? '' : 'Mandatory' } ,
1033
1031
} ) )
1034
1032
error = true
1035
1033
}
@@ -1629,7 +1627,7 @@ const DockerForm = ({
1629
1627
1630
1628
const isUserNamePasswordRequired =
1631
1629
selectedDockerRegistryType . value === RegistryType . OTHER
1632
- ? authenticationType === OtherRegistryAuthenticationType . USERNAME_PASSWORD
1630
+ ? authenticationType === RegistryCredentialsType . USERNAME_PASSWORD
1633
1631
: true
1634
1632
1635
1633
return (
@@ -1664,7 +1662,7 @@ const DockerForm = ({
1664
1662
selectedDockerRegistryType . value === RegistryType . QUAY ||
1665
1663
selectedDockerRegistryType . value === RegistryType . OTHER ) && (
1666
1664
< PasswordField
1667
- shouldShowDefaultPlaceholderOnBlur = { ! ! id }
1665
+ shouldShowDefaultPlaceholderOnBlur = { ! ! id && ! ! username }
1668
1666
name = "password"
1669
1667
required
1670
1668
value = { customState . password . value }
0 commit comments