Skip to content

Commit 7a4793a

Browse files
committed
fix for check
1 parent 225af2e commit 7a4793a

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/components/dockerRegistry/Docker.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -697,28 +697,27 @@ function DockerForm({
697697
) {
698698
const isValidJsonFile = isValidJson(customState.password.value) || id
699699
const isValidJsonStr = isValidJsonFile ? '' : 'Invalid JSON'
700-
if (
701-
(registryStorageType === RegistryStorageType.OCI_PRIVATE && !customState.username.value) ||
702-
!(customState.password.value || id) ||
703-
!isValidJsonFile
704-
) {
705-
setCustomState((st) => ({
706-
...st,
707-
username: { ...st.username, error: st.username.value ? '' : 'Mandatory' },
708-
password: {
709-
...st.password,
710-
error: id || st.password.value ? isValidJsonStr : 'Mandatory',
711-
},
712-
}))
713-
return
700+
if (registryStorageType === RegistryStorageType.OCI_PRIVATE) {
701+
if (!customState.username.value || !(customState.password.value || id) || !isValidJsonFile) {
702+
setCustomState((st) => ({
703+
...st,
704+
username: { ...st.username, error: st.username.value ? '' : 'Mandatory' },
705+
password: {
706+
...st.password,
707+
error: id || st.password.value ? isValidJsonStr : 'Mandatory',
708+
},
709+
}))
710+
return
711+
}
714712
}
713+
715714
} else if (
716715
selectedDockerRegistryType.value === RegistryType.ACR ||
717716
selectedDockerRegistryType.value === RegistryType.QUAY ||
718717
selectedDockerRegistryType.value === RegistryType.OTHER
719718
) {
720719
let error = false
721-
if (registryStorageType === RegistryStorageType.OCI_PRIVATE) {
720+
if (registryStorageType !== RegistryStorageType.OCI_PUBLIC) {
722721
if (
723722
!customState.username.value ||
724723
!(customState.password.value || id) ||

0 commit comments

Comments
 (0)