mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
fix: add loading while click to start chat in datasource management
This commit is contained in:
@@ -35,6 +35,8 @@ const emits = defineEmits([
|
||||
'dataTableDetail',
|
||||
'showTable',
|
||||
'recommendation',
|
||||
'startChecking',
|
||||
'endChecking',
|
||||
])
|
||||
const icon = computed(() => {
|
||||
return (dsTypeWithImg.find((ele) => props.type === ele.type) || {}).img
|
||||
@@ -53,11 +55,17 @@ const handleDel = () => {
|
||||
|
||||
const handleQuestion = () => {
|
||||
//check first
|
||||
datasourceApi.check_by_id(props.id).then((res: any) => {
|
||||
if (res) {
|
||||
emits('question', props.id)
|
||||
}
|
||||
})
|
||||
emits('startChecking')
|
||||
datasourceApi
|
||||
.check_by_id(props.id)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
emits('question', props.id)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
emits('endChecking')
|
||||
})
|
||||
}
|
||||
|
||||
function runSQL() {
|
||||
|
||||
@@ -198,6 +198,15 @@ const back = () => {
|
||||
currentDataTable.value = null
|
||||
}
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
function startLoading() {
|
||||
loading.value = true
|
||||
}
|
||||
function endLoading() {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
useEmitt({
|
||||
name: 'ds-index-click',
|
||||
callback: back,
|
||||
@@ -205,7 +214,7 @@ useEmitt({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-show="!currentDataTable" class="datasource-config no-padding">
|
||||
<div v-show="!currentDataTable" v-loading="loading" class="datasource-config no-padding">
|
||||
<div class="datasource-methods">
|
||||
<span class="title">{{ $t('ds.title') }}</span>
|
||||
<div class="button-input">
|
||||
@@ -299,6 +308,8 @@ useEmitt({
|
||||
:type-name="ele.type_name"
|
||||
:num="ele.num"
|
||||
:description="ele.description"
|
||||
@start-checking="startLoading"
|
||||
@end-checking="endLoading"
|
||||
@question="handleQuestion"
|
||||
@edit="handleEditDatasource(ele)"
|
||||
@recommendation="handleRecommendation(ele)"
|
||||
|
||||
Reference in New Issue
Block a user