Skip to content

Commit 1a29584

Browse files
committed
feat(datasource): datasource UI
1 parent cb1180e commit 1a29584

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

backend/apps/datasource/crud/datasource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
DatasourceConf
1818

1919

20-
def get_datasource_list(session: SessionDep) -> CoreDatasource:
20+
def get_datasource_list(session: SessionDep):
2121
statement = select(CoreDatasource).order_by(CoreDatasource.create_time.desc())
2222
datasource_list = session.exec(statement).fetchall()
2323
return datasource_list

frontend/src/views/ds/form.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ const check = () => {
281281
type: 'success',
282282
showClose: true
283283
})
284+
} else {
285+
ElMessage({
286+
message: 'Connect failed',
287+
type: 'error',
288+
showClose: true
289+
})
284290
}
285291
})
286292
}
@@ -304,6 +310,12 @@ const next = async(formEl: FormInstance | undefined) => {
304310
datasourceApi.getTablesByConf(form.value).then((res) => {
305311
tableList.value = res
306312
})
313+
} else {
314+
ElMessage({
315+
message: 'Connect failed',
316+
type: 'error',
317+
showClose: true
318+
})
307319
}
308320
})
309321
}

frontend/src/views/ds/index.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div v-loading="loading">
33
<div class="header">
44
<div class="mt-4">
55
<el-input
@@ -72,6 +72,7 @@ const dsForm = ref()
7272
const dsList = ref<any>([])// show ds list
7373
const allDsList = ref<any>([])// all ds list
7474
const router = useRouter()
75+
const loading = ref(false)
7576
7677
const getStatus = (status: string) => {
7778
if (status === 'Success') {
@@ -98,9 +99,11 @@ const refresh = () => {
9899
}
99100
100101
const list = () => {
102+
loading.value = true
101103
datasourceApi.list().then((res) => {
102104
allDsList.value = res
103105
dsList.value = JSON.parse(JSON.stringify(allDsList.value))
106+
loading.value = false
104107
})
105108
}
106109

0 commit comments

Comments
 (0)