Skip to content

Commit 3c92110

Browse files
committed
fix(Smart Q&A): When creating a new conversation, click Create Data Source to directly open the new process page
1 parent 1315287 commit 3c92110

File tree

9 files changed

+190
-117
lines changed

9 files changed

+190
-117
lines changed

frontend/src/style.less

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,16 @@ strong {
317317
}
318318
}
319319
}
320+
321+
.ed-popper__arrow {
322+
width: 10px !important;
323+
height: 10px !important;
324+
}
325+
326+
.ed-popper[data-popper-placement^='top'] > .ed-popper__arrow {
327+
bottom: -5px !important;
328+
}
329+
330+
.ed-popper[data-popper-placement^='right'] > .ed-popper__arrow {
331+
left: -5px !important;
332+
}

frontend/src/views/chat/ChatCreator.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import { onMounted, ref, computed, shallowRef } from 'vue'
33
import icon_close_outlined from '@/assets/svg/operate/ope-close.svg'
44
import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
5-
import { useRouter } from 'vue-router'
65
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
76
import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlined.svg'
87
import { chatApi, ChatInfo } from '@/api/chat.ts'
98
import { datasourceApi } from '@/api/datasource.ts'
109
import Card from '@/views/ds/ChatCard.vue'
10+
import AddDrawer from '@/views/ds/AddDrawer.vue'
1111
1212
const props = withDefaults(
1313
defineProps<{
@@ -18,7 +18,7 @@ const props = withDefaults(
1818
}
1919
)
2020
21-
const router = useRouter()
21+
const addDrawerRef = ref()
2222
const searchLoading = ref(false)
2323
const datasourceConfigVisible = ref(false)
2424
const keywords = ref('')
@@ -113,7 +113,7 @@ onMounted(() => {
113113
})
114114
115115
const handleAddDatasource = () => {
116-
router.push('/ds/index')
116+
addDrawerRef.value.handleAddDatasource()
117117
}
118118
119119
defineExpose({
@@ -217,6 +217,7 @@ defineExpose({
217217
</div>
218218
</template>
219219
</el-drawer>
220+
<AddDrawer ref="addDrawerRef" @search="listDs"></AddDrawer>
220221
</div>
221222
</template>
222223

frontend/src/views/chat/chat-block/ChartBlock.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ watch(
311311
</div>
312312
<div class="buttons-bar">
313313
<div class="chart-select-container">
314-
<el-tooltip effect="dark" :content="t('chat.type')" placement="top">
314+
<el-tooltip effect="dark" :offset="8" :content="t('chat.type')" placement="top">
315315
<ChartPopover
316316
v-if="chartTypeList.length > 0"
317317
:chart-type-list="chartTypeList"
@@ -321,7 +321,12 @@ watch(
321321
></ChartPopover>
322322
</el-tooltip>
323323

324-
<el-tooltip effect="dark" :content="t('chat.chart_type.table')" placement="top">
324+
<el-tooltip
325+
effect="dark"
326+
:offset="8"
327+
:content="t('chat.chart_type.table')"
328+
placement="top"
329+
>
325330
<el-button
326331
class="tool-btn"
327332
:class="{ 'chart-active': currentChartType === 'table' }"
@@ -336,7 +341,7 @@ watch(
336341
</div>
337342

338343
<div v-if="message?.record?.sql">
339-
<el-tooltip effect="dark" :content="t('chat.show_sql')" placement="top">
344+
<el-tooltip effect="dark" :offset="8" :content="t('chat.show_sql')" placement="top">
340345
<el-button class="tool-btn" text @click="showSql">
341346
<el-icon size="16">
342347
<icon_sql_outlined />
@@ -353,7 +358,12 @@ watch(
353358
>
354359
<template #reference>
355360
<div>
356-
<el-tooltip effect="dark" :content="t('chat.export_to')" placement="top">
361+
<el-tooltip
362+
effect="dark"
363+
:offset="8"
364+
:content="t('chat.export_to')"
365+
placement="top"
366+
>
357367
<el-button class="tool-btn" text>
358368
<el-icon size="16">
359369
<icon_export_outlined />
@@ -398,6 +408,7 @@ watch(
398408
<div v-if="!enlarge">
399409
<el-tooltip
400410
effect="dark"
411+
:offset="8"
401412
:content="isAssistant ? $t('common.zoom_in') : t('chat.full_screen')"
402413
placement="top"
403414
>
@@ -411,6 +422,7 @@ watch(
411422
<div v-else>
412423
<el-tooltip
413424
effect="dark"
425+
:offset="8"
414426
:content="isAssistant ? $t('common.zoom_out') : t('chat.exit_full_screen')"
415427
placement="top"
416428
>

frontend/src/views/chat/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
/>
7575
</el-drawer>
7676

77-
<el-tooltip effect="dark" :content="t('qa.new_chat')" placement="bottom">
77+
<el-tooltip effect="dark" :offset="8" :content="t('qa.new_chat')" placement="bottom">
7878
<el-button link type="primary" class="icon-btn" @click="createNewChatSimple">
7979
<el-icon>
8080
<icon_new_chat_outlined />
@@ -165,7 +165,12 @@
165165
<template #tool>
166166
<ChatToolBar v-if="!message.isTyping" :message="message">
167167
<div class="tool-btns">
168-
<el-tooltip effect="dark" :content="t('qa.ask_again')" placement="top">
168+
<el-tooltip
169+
effect="dark"
170+
:offset="8"
171+
:content="t('qa.ask_again')"
172+
placement="top"
173+
>
169174
<el-button
170175
class="tool-btn"
171176
text

frontend/src/views/dashboard/common/ResourceTree.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ defineExpose({
322322
<div class="tree-header">
323323
<div class="icon-methods">
324324
<span class="title">{{ t('dashboard.dashboard') }} </span>
325-
<el-tooltip :content="t('dashboard.new_dashboard')" placement="top" effect="dark">
325+
<el-tooltip
326+
:offset="12"
327+
:content="t('dashboard.new_dashboard')"
328+
placement="top"
329+
effect="dark"
330+
>
326331
<el-icon
327332
class="custom-icon btn hover-icon_with_bg"
328333
@click="addOperation({ opt: 'newLeaf', type: 'dashboard' })"
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<script lang="ts" setup>
2+
import { ref, nextTick } from 'vue'
3+
import { datasourceApi } from '@/api/datasource'
4+
import { useI18n } from 'vue-i18n'
5+
import icon_close_outlined from '@/assets/svg/operate/ope-close.svg'
6+
import DatasourceList from './DatasourceList.vue'
7+
import DatasourceListSide from './DatasourceListSide.vue'
8+
import DatasourceForm from './DatasourceForm.vue'
9+
10+
const { t } = useI18n()
11+
const datasourceConfigVisible = ref(false)
12+
const activeStep = ref(0)
13+
const currentType = ref('')
14+
const editDatasource = ref(false)
15+
const activeName = ref('')
16+
const activeType = ref('')
17+
const datasourceFormRef = ref()
18+
19+
const beforeClose = () => {
20+
datasourceConfigVisible.value = false
21+
activeStep.value = 0
22+
datasourceApi.cancelRequests()
23+
}
24+
const clickDatasource = (ele: any) => {
25+
activeStep.value = 1
26+
activeName.value = ele.name
27+
activeType.value = ele.type
28+
}
29+
30+
const clickDatasourceSide = (ele: any) => {
31+
activeName.value = ele.name
32+
activeType.value = ele.type
33+
}
34+
35+
const emits = defineEmits(['search'])
36+
37+
const refresh = () => {
38+
activeName.value = ''
39+
activeStep.value = 0
40+
activeType.value = ''
41+
datasourceConfigVisible.value = false
42+
emits('search')
43+
}
44+
45+
const handleEditDatasource = (res: any) => {
46+
activeStep.value = 1
47+
datasourceConfigVisible.value = true
48+
editDatasource.value = true
49+
currentType.value = res.type_name
50+
nextTick(() => {
51+
datasourceFormRef.value.initForm(res)
52+
})
53+
}
54+
55+
const handleAddDatasource = () => {
56+
editDatasource.value = false
57+
datasourceConfigVisible.value = true
58+
}
59+
60+
const changeActiveStep = (val: number) => {
61+
activeStep.value = val > 2 ? 2 : val
62+
}
63+
64+
defineExpose({
65+
handleEditDatasource,
66+
handleAddDatasource,
67+
})
68+
</script>
69+
70+
<template>
71+
<el-drawer
72+
v-model="datasourceConfigVisible"
73+
:close-on-click-modal="false"
74+
size="calc(100% - 100px)"
75+
modal-class="datasource-drawer-fullscreen"
76+
direction="btt"
77+
:before-close="beforeClose"
78+
:show-close="false"
79+
>
80+
<template #header="{ close }">
81+
<span style="white-space: nowrap">{{
82+
editDatasource
83+
? t('datasource.mysql_data_source', { msg: currentType })
84+
: $t('datasource.new_data_source')
85+
}}</span>
86+
<div v-if="!editDatasource" class="flex-center" style="width: 100%">
87+
<el-steps custom style="max-width: 800px; flex: 1" :active="activeStep" align-center>
88+
<el-step>
89+
<template #title> {{ $t('qa.select_datasource') }} </template>
90+
</el-step>
91+
<el-step>
92+
<template #title> {{ $t('datasource.configuration_information') }} </template>
93+
</el-step>
94+
<el-step>
95+
<template #title> {{ $t('ds.form.choose_tables') }} </template>
96+
</el-step>
97+
</el-steps>
98+
</div>
99+
<el-icon style="cursor: pointer" @click="close">
100+
<icon_close_outlined></icon_close_outlined>
101+
</el-icon>
102+
</template>
103+
<DatasourceList v-if="activeStep === 0" @click-datasource="clickDatasource"></DatasourceList>
104+
<DatasourceListSide
105+
v-if="activeStep === 1 && !editDatasource"
106+
:active-name="activeName"
107+
@click-datasource="clickDatasourceSide"
108+
></DatasourceListSide>
109+
<DatasourceForm
110+
v-if="[1, 2].includes(activeStep)"
111+
ref="datasourceFormRef"
112+
:is-data-table="false"
113+
:active-step="activeStep"
114+
:active-name="activeName"
115+
:active-type="activeType"
116+
@refresh="refresh"
117+
@close="beforeClose"
118+
@change-active-step="changeActiveStep"
119+
></DatasourceForm>
120+
</el-drawer>
121+
</template>
122+
123+
<style lang="less">
124+
.datasource-drawer-fullscreen {
125+
.ed-drawer__body {
126+
padding: 0;
127+
}
128+
.is-process .ed-step__line {
129+
background-color: var(--ed-color-primary);
130+
}
131+
}
132+
</style>

frontend/src/views/ds/DataTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ const btnSelectClick = (val: any) => {
521521
align-items: center;
522522
justify-content: space-between;
523523
padding: 8px;
524+
font-weight: 500;
524525
525526
.ed-icon {
526527
cursor: pointer;

0 commit comments

Comments
 (0)