Skip to content

Commit 0426e24

Browse files
committed
validation fix for ecr and azure
1 parent 7a4793a commit 0426e24

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

src/components/dockerRegistry/Docker.tsx

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -663,21 +663,31 @@ function DockerForm({
663663

664664
function onValidation() {
665665
if (selectedDockerRegistryType.value === RegistryType.ECR) {
666-
if (
667-
(!isIAMAuthType &&
668-
(!customState.awsAccessKeyId.value || !(customState.awsSecretAccessKey.value || id))) ||
669-
!customState.registryUrl.value
670-
) {
671-
setCustomState((st) => ({
672-
...st,
673-
awsAccessKeyId: { ...st.awsAccessKeyId, error: st.awsAccessKeyId.value ? '' : 'Mandatory' },
674-
awsSecretAccessKey: {
675-
...st.awsSecretAccessKey,
676-
error: id || st.awsSecretAccessKey.value ? '' : 'Mandatory',
677-
},
678-
registryUrl: { ...st.registryUrl, error: st.registryUrl.value ? '' : 'Mandatory' },
679-
}))
680-
return
666+
if (registryStorageType === RegistryStorageType.OCI_PRIVATE) {
667+
if (
668+
(!isIAMAuthType &&
669+
(!customState.awsAccessKeyId.value || !(customState.awsSecretAccessKey.value || id))) ||
670+
!customState.registryUrl.value
671+
) {
672+
setCustomState((st) => ({
673+
...st,
674+
awsAccessKeyId: { ...st.awsAccessKeyId, error: st.awsAccessKeyId.value ? '' : 'Mandatory' },
675+
awsSecretAccessKey: {
676+
...st.awsSecretAccessKey,
677+
error: id || st.awsSecretAccessKey.value ? '' : 'Mandatory',
678+
},
679+
registryUrl: { ...st.registryUrl, error: st.registryUrl.value ? '' : 'Mandatory' },
680+
}))
681+
return
682+
}
683+
} else {
684+
if (!customState.registryUrl.value) {
685+
setCustomState((st) => ({
686+
...st,
687+
registryUrl: { ...st.registryUrl, error: st.registryUrl.value ? '' : 'Mandatory' },
688+
}))
689+
return
690+
}
681691
}
682692
} else if (selectedDockerRegistryType.value === RegistryType.DOCKER_HUB) {
683693
if (
@@ -731,6 +741,14 @@ function DockerForm({
731741
}))
732742
error = true
733743
}
744+
} else {
745+
if (!customState.registryUrl.value) {
746+
setCustomState((st) => ({
747+
...st,
748+
registryUrl: { ...st.registryUrl, error: st.registryUrl.value ? '' : 'Mandatory' },
749+
}))
750+
error = true
751+
}
734752
}
735753

736754
if (

0 commit comments

Comments
 (0)