mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
refactor: 拆分数据源接口
This commit is contained in:
parent
2342eb240e
commit
3401731a91
@ -91,6 +91,24 @@ export const save = async (data = {}): Promise<Dataset> => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const move = async (data = {}): Promise<Dataset> => {
|
||||||
|
return request.post({ url: '/datasource/move', data }).then(res => {
|
||||||
|
return res?.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const reName = async (data = {}): Promise<Dataset> => {
|
||||||
|
return request.post({ url: '/datasource/reName', data }).then(res => {
|
||||||
|
return res?.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createFolder = async (data = {}): Promise<Dataset> => {
|
||||||
|
return request.post({ url: '/datasource/createFolder', data }).then(res => {
|
||||||
|
return res?.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const checkRepeat = async (data = {}): Promise<Dataset> => {
|
export const checkRepeat = async (data = {}): Promise<Dataset> => {
|
||||||
return request.post({ url: '/datasource/checkRepeat', data }).then(res => {
|
return request.post({ url: '/datasource/checkRepeat', data }).then(res => {
|
||||||
return res?.data
|
return res?.data
|
||||||
|
@ -22,7 +22,9 @@ import {
|
|||||||
getTableField,
|
getTableField,
|
||||||
listDatasourceTables,
|
listDatasourceTables,
|
||||||
deleteById,
|
deleteById,
|
||||||
save,
|
move,
|
||||||
|
reName,
|
||||||
|
createFolder,
|
||||||
validateById,
|
validateById,
|
||||||
syncApiDs,
|
syncApiDs,
|
||||||
syncApiTable
|
syncApiTable
|
||||||
@ -234,8 +236,7 @@ const handleLoadExcel = data => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const validateDS = () => {
|
const validateDS = () => {
|
||||||
validateById(nodeInfo.id as number)
|
validateById(nodeInfo.id as number).then(res => {
|
||||||
.then(res => {
|
|
||||||
if (res.data.type === 'API') {
|
if (res.data.type === 'API') {
|
||||||
let error = 0
|
let error = 0
|
||||||
const status = JSON.parse(res.data.status)
|
const status = JSON.parse(res.data.status)
|
||||||
@ -253,9 +254,6 @@ const validateDS = () => {
|
|||||||
ElMessage.success('校验成功')
|
ElMessage.success('校验成功')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
|
||||||
ElMessage.error('校验失败')
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const dialogErrorInfo = ref(false)
|
const dialogErrorInfo = ref(false)
|
||||||
@ -351,21 +349,29 @@ const infoList = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const saveDsFolder = (params, successCb, finallyCb, cmd) => {
|
const saveDsFolder = (params, successCb, finallyCb, cmd) => {
|
||||||
save(params)
|
let method = move
|
||||||
|
let message = '移动成功'
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
case 'move':
|
||||||
|
method = move
|
||||||
|
message = '移动成功'
|
||||||
|
|
||||||
|
break
|
||||||
|
case 'rename':
|
||||||
|
method = reName
|
||||||
|
message = '重命名成功'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
method = createFolder
|
||||||
|
message = '新建成功'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
method(params)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res !== undefined) {
|
if (res !== undefined) {
|
||||||
successCb()
|
successCb()
|
||||||
switch (cmd) {
|
ElMessage.success(message)
|
||||||
case 'move':
|
|
||||||
ElMessage.success('移动成功')
|
|
||||||
break
|
|
||||||
case 'rename':
|
|
||||||
ElMessage.success('重命名成功')
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
ElMessage.success('新建成功')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
listDs()
|
listDs()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -35,6 +35,15 @@ public interface DatasourceApi {
|
|||||||
DatasourceDTO save(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
DatasourceDTO save(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/move")
|
||||||
|
DatasourceDTO move(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
||||||
|
|
||||||
|
@PostMapping("/reName")
|
||||||
|
DatasourceDTO reName(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
||||||
|
|
||||||
|
@PostMapping("/createFolder")
|
||||||
|
DatasourceDTO createFolder(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
||||||
|
|
||||||
@PostMapping("/checkRepeat")
|
@PostMapping("/checkRepeat")
|
||||||
boolean checkRepeat(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
boolean checkRepeat(@RequestBody DatasourceDTO dataSourceDTO) throws DEException;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user