mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
feat(datasource): datasource UI
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user