mirror of
https://github.com/dataease/dataease.git
synced 2026-05-18 01:38:11 +08:00
feat: 校验数据源状态时,同时刷新左侧菜单中数据源的状态
This commit is contained in:
@@ -50,6 +50,14 @@ export function validateDs(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function validateDsById(datasourceId) {
|
||||
return request({
|
||||
url: 'datasource/validate/' + datasourceId,
|
||||
method: 'get',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function getSchema(data) {
|
||||
return request({
|
||||
url: 'datasource/getSchema/',
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<script>
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import { addDs, editDs, getSchema, validateDs } from '@/api/system/datasource'
|
||||
import { addDs, editDs, getSchema, validateDs, validateDsById } from '@/api/system/datasource'
|
||||
import { $confirm } from '@/utils/message'
|
||||
|
||||
export default {
|
||||
@@ -276,9 +276,29 @@ export default {
|
||||
if (valid) {
|
||||
const data = JSON.parse(JSON.stringify(this.form))
|
||||
data.configuration = JSON.stringify(data.configuration)
|
||||
validateDs(data).then(res => {
|
||||
this.$success(this.$t('datasource.validate_success'))
|
||||
})
|
||||
if(data.showModel === 'show' && !this.canEdit){
|
||||
validateDsById(data.id).then(res => {
|
||||
if(res.success === 'true'){
|
||||
this.$success(this.$t('datasource.validate_success'))
|
||||
}else {
|
||||
this.$error(this.$t(res.message))
|
||||
}
|
||||
this.refreshTree()
|
||||
}).catch(res => {
|
||||
this.$error(res.message)
|
||||
})
|
||||
|
||||
}else {
|
||||
validateDs(data).then(res => {
|
||||
if(res.success === 'true'){
|
||||
this.$success(this.$t('datasource.validate_success'))
|
||||
}else {
|
||||
this.$error(this.$t(res.message))
|
||||
}
|
||||
}).catch(res => {
|
||||
this.$error(res.message)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user