Merge pull request #9066 from dataease/pr@dev-v2@fix_dataset_edit_ds_validate

fix(数据集): 编辑数据集页面首先验证数据源是否存在
This commit is contained in:
fit2cloud-chenyw 2024-04-11 17:32:02 +08:00 committed by GitHub
commit 5788168502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,7 +34,8 @@ import {
getTables,
getPreviewData,
getDatasetDetails,
saveDatasetTree
saveDatasetTree,
barInfoApi
} from '@/api/dataset'
import type { Table } from '@/api/dataset'
import DatasetUnion from './DatasetUnion.vue'
@ -581,14 +582,19 @@ const getTableName = async (datasourceId, tableName) => {
}
}
const initEdite = () => {
const initEdite = async () => {
const { id, datasourceId, tableName } = route.query
const { id: copyId } = route.params
const barRes = await barInfoApi(copyId || id)
if (!barRes || !barRes['id']) {
return
}
if (datasourceId) {
dataSource.value = datasourceId as string
getTableName(datasourceId as string, tableName)
}
if (!id && !copyId) return
loading.value = true
getDatasetDetails(copyId || id)
.then(res => {
@ -859,7 +865,7 @@ let p = null
const XpackLoaded = () => p(true)
onMounted(async () => {
await new Promise(r => (p = r))
initEdite()
await initEdite()
getDatasource()
useEmitt({
name: 'onDatasetSave',