feat(datasource): datasource UI

This commit is contained in:
junjun
2025-05-21 14:10:59 +08:00
parent cb1180e0f7
commit 1a295844af
3 changed files with 17 additions and 2 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ from ..models.datasource import CoreDatasource, CreateDatasource, CoreTable, Cor
DatasourceConf
def get_datasource_list(session: SessionDep) -> CoreDatasource:
def get_datasource_list(session: SessionDep):
statement = select(CoreDatasource).order_by(CoreDatasource.create_time.desc())
datasource_list = session.exec(statement).fetchall()
return datasource_list
+12
View File
@@ -281,6 +281,12 @@ const check = () => {
type: 'success',
showClose: true
})
} else {
ElMessage({
message: 'Connect failed',
type: 'error',
showClose: true
})
}
})
}
@@ -304,6 +310,12 @@ const next = async(formEl: FormInstance | undefined) => {
datasourceApi.getTablesByConf(form.value).then((res) => {
tableList.value = res
})
} else {
ElMessage({
message: 'Connect failed',
type: 'error',
showClose: true
})
}
})
}
+4 -1
View File
@@ -1,5 +1,5 @@
<template>
<div>
<div v-loading="loading">
<div class="header">
<div class="mt-4">
<el-input
@@ -72,6 +72,7 @@ const dsForm = ref()
const dsList = ref<any>([])// show ds list
const allDsList = ref<any>([])// all ds list
const router = useRouter()
const loading = ref(false)
const getStatus = (status: string) => {
if (status === 'Success') {
@@ -98,9 +99,11 @@ const refresh = () => {
}
const list = () => {
loading.value = true
datasourceApi.list().then((res) => {
allDsList.value = res
dsList.value = JSON.parse(JSON.stringify(allDsList.value))
loading.value = false
})
}