Skip to content

Commit a1b4b96

Browse files
committed
fix: add loading while click to start chat in datasource management
1 parent a645de1 commit a1b4b96

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

frontend/src/views/ds/Card.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const emits = defineEmits([
3535
'dataTableDetail',
3636
'showTable',
3737
'recommendation',
38+
'startChecking',
39+
'endChecking',
3840
])
3941
const icon = computed(() => {
4042
return (dsTypeWithImg.find((ele) => props.type === ele.type) || {}).img
@@ -53,11 +55,17 @@ const handleDel = () => {
5355
5456
const handleQuestion = () => {
5557
//check first
56-
datasourceApi.check_by_id(props.id).then((res: any) => {
57-
if (res) {
58-
emits('question', props.id)
59-
}
60-
})
58+
emits('startChecking')
59+
datasourceApi
60+
.check_by_id(props.id)
61+
.then((res: any) => {
62+
if (res) {
63+
emits('question', props.id)
64+
}
65+
})
66+
.finally(() => {
67+
emits('endChecking')
68+
})
6169
}
6270
6371
function runSQL() {

frontend/src/views/ds/Datasource.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,23 @@ const back = () => {
198198
currentDataTable.value = null
199199
}
200200
201+
const loading = ref(false)
202+
203+
function startLoading() {
204+
loading.value = true
205+
}
206+
function endLoading() {
207+
loading.value = false
208+
}
209+
201210
useEmitt({
202211
name: 'ds-index-click',
203212
callback: back,
204213
})
205214
</script>
206215

207216
<template>
208-
<div v-show="!currentDataTable" class="datasource-config no-padding">
217+
<div v-show="!currentDataTable" v-loading="loading" class="datasource-config no-padding">
209218
<div class="datasource-methods">
210219
<span class="title">{{ $t('ds.title') }}</span>
211220
<div class="button-input">
@@ -299,6 +308,8 @@ useEmitt({
299308
:type-name="ele.type_name"
300309
:num="ele.num"
301310
:description="ele.description"
311+
@start-checking="startLoading"
312+
@end-checking="endLoading"
302313
@question="handleQuestion"
303314
@edit="handleEditDatasource(ele)"
304315
@recommendation="handleRecommendation(ele)"

0 commit comments

Comments
 (0)