fix: skip credential validation when editing data source

main
langcaiye 2026-06-03 19:11:23 +08:00 committed by lyingbug
parent f8b5569867
commit 3c2ee171cb
1 changed files with 12 additions and 6 deletions

View File

@ -311,12 +311,14 @@ function selectType(def: ConnectorDef) {
// --- Test connection (stateless, no DB write) ---
async function testConnection() {
const fields = currentDef.value?.fields || []
for (const f of fields) {
if (f.optional) continue
if (!form.value.config.credentials[f.key]) {
MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`)
return
if (!isEdit.value || !credentialsConfigured.value || replaceCredentialsMode.value) {
const fields = currentDef.value?.fields || []
for (const f of fields) {
if (f.optional) continue
if (!form.value.config.credentials[f.key]) {
MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`)
return
}
}
}
@ -441,6 +443,10 @@ function toggleResource(id: string) {
}
function validateStep1Fields(): boolean {
if (isEdit.value && credentialsConfigured.value && !replaceCredentialsMode.value) {
return true
}
const fields = currentDef.value?.fields || []
for (const f of fields) {
if (f.optional) continue