Bugfix/Credential mandatory field when preview chunks (#2356)

check if credential is mandatory field when preview chunks
This commit is contained in:
Henry Heng 2024-05-08 02:13:08 +01:00 committed by GitHub
parent 43b22476e3
commit 26e7a1ac35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -120,9 +120,14 @@ const LoaderConfigPreviewChunks = () => {
let canSubmit = true
const inputParams = (selectedDocumentLoader.inputParams ?? []).filter((inputParam) => !inputParam.hidden)
for (const inputParam of inputParams) {
if (!inputParam.optional && !selectedDocumentLoader.inputs[inputParam.name]) {
if (!inputParam.optional && (!selectedDocumentLoader.inputs[inputParam.name] || !selectedDocumentLoader.credential)) {
if (inputParam.type === 'credential' && !selectedDocumentLoader.credential) {
canSubmit = false
break
} else if (inputParam.type !== 'credential' && !selectedDocumentLoader.inputs[inputParam.name]) {
canSubmit = false
break
}
}
}
if (!canSubmit) {