Skip to content

Commit

Permalink
Bugfix/Credential mandatory field when preview chunks (#2356)
Browse files Browse the repository at this point in the history
check if credential is mandatory field when preview chunks
  • Loading branch information
HenryHengZJ authored May 8, 2024
1 parent 43b2247 commit 26e7a1a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
canSubmit = false
break
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) {
Expand Down

0 comments on commit 26e7a1a

Please sign in to comment.