mirror of
https://github.com/dataease/dataease.git
synced 2026-05-14 21:12:33 +08:00
fix(系统设置): sqlbot设置点击校验会关闭抽屉并保存,但提示没有关于校验的验证信息
This commit is contained in:
@@ -110,19 +110,27 @@ const closeLoading = () => {
|
||||
loadingInstance.value?.close()
|
||||
}
|
||||
|
||||
const validateHandler = () => {
|
||||
const validateHandlerOnly = () => {
|
||||
let url = `${
|
||||
state.form.domain.endsWith('/') ? state.form.domain : state.form.domain + '/'
|
||||
}api/v1/system/assistant/info/${state.form.id}`
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok')
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.then(() => {
|
||||
state.form.valid = true
|
||||
ElMessage.success(t('datasource.validate_success'))
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.error(t('data_source.verification_failed'))
|
||||
state.form.enabled = false
|
||||
state.form.valid = false
|
||||
})
|
||||
.finally(() => {
|
||||
save()
|
||||
})
|
||||
}
|
||||
@@ -158,7 +166,7 @@ defineExpose({
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="resetForm(dingtalkForm)">{{ t('common.cancel') }}</el-button>
|
||||
<el-button :disabled="!state.form.id || !state.form.domain" @click="validateHandler">
|
||||
<el-button :disabled="!state.form.id || !state.form.domain" @click="validateHandlerOnly">
|
||||
{{ t('commons.validate') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submitForm(dingtalkForm)">
|
||||
|
||||
@@ -67,14 +67,22 @@ const validateHandler = () => {
|
||||
info.value.domain.endsWith('/') ? info.value.domain : info.value.domain + '/'
|
||||
}api/v1/system/assistant/info/${info.value.id}`
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok')
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.then(() => {
|
||||
info.value.valid = true
|
||||
ElMessage.success(t('datasource.validate_success'))
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.error(t('data_source.verification_failed'))
|
||||
info.value.enabled = false
|
||||
info.value.valid = false
|
||||
})
|
||||
.finally(() => {
|
||||
save()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user