Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dependencies": {
"@antv/g2": "^5.3.3",
"@antv/s2": "^2.4.3",
"@antv/x6": "^2.18.1",
"@eslint/js": "^9.28.0",
"@highlightjs/vue-plugin": "^2.1.0",
"@npkg/tinymce-plugins": "^0.0.7",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/api/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { request } from '@/utils/request'
export const datasourceApi = {
check: (data: any) => request.post('/datasource/check', data),
check_by_id: (id: any) => request.get(`/datasource/check/${id}`),
relationGet: (id: any) => request.post(`/table_relation/get/${id}`),
relationSave: (dsId: any, data: any) => request.post(`/table_relation/save/${dsId}`, data),
add: (data: any) => request.post('/datasource/add', data),
list: () => request.get('/datasource/list'),
update: (data: any) => request.post('/datasource/update', data),
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/assets/svg/icon_mindnote_outlined.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"AI Model Configuration": "AI Model Configuration"
},
"training": {
"add_it_here": "Drag the table name on the left to add it here",
"table_relationship_management": "Table relationship management",
"system_anagement": "System Management",
"data_training": "SQL Sample Lib",
"problem_description": "Problem Description",
Expand Down Expand Up @@ -669,4 +671,4 @@
"setting_successfully": "Setting Successfully",
"customize_theme_color": "Customize theme color"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"AI Model Configuration": "模型配置"
},
"training": {
"add_it_here": "拖拽左侧表名,添加到这里",
"table_relationship_management": "表关系管理",
"system_anagement": "系统管理",
"data_training": "SQL 示例库",
"problem_description": "问题描述",
Expand Down Expand Up @@ -669,4 +671,4 @@
"setting_successfully": "设置成功",
"customize_theme_color": "自定义主题色"
}
}
}
4 changes: 4 additions & 0 deletions frontend/src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ const scrollBottom = () => {
if (!isTyping.value && !getRecommendQuestionsLoading.value) {
clearInterval(scrollTime)
}
if (!chatListRef.value) {
clearInterval(scrollTime)
return
}
chatListRef.value!.setScrollTop(innerRef.value!.clientHeight)
}

Expand Down
126 changes: 121 additions & 5 deletions frontend/src/views/ds/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
import edit from '@/assets/svg/icon_edit_outlined.svg'
import { useI18n } from 'vue-i18n'
import ParamsForm from './ParamsForm.vue'

import TableRelationship from '@/views/ds/TableRelationship.vue'
import icon_mindnote_outlined from '@/assets/svg/icon_mindnote_outlined.svg'
interface Table {
name: string
host: string
Expand Down Expand Up @@ -54,6 +55,7 @@ const paramsFormRef = ref()
const tableList = ref([] as any[])
const loading = ref(false)
const initLoading = ref(false)
const activeRelationship = ref(false)
const keywords = ref('')
const tableListWithSearch = computed(() => {
if (!keywords.value) return tableList.value
Expand All @@ -66,13 +68,29 @@ const showNum = ref(100)
const currentTable = ref<any>({})
const ds = ref<any>({})
const btnSelect = ref('d')

const isDrag = ref(false)
const tableName = ref<any[]>([])
const pageInfo = reactive({
currentPage: 1,
pageSize: 10,
total: 0,
})
const handleRelationship = () => {
activeRelationship.value = !activeRelationship.value
currentTable.value = {}
}
const singleDragStartD = (e: DragEvent, ele: any) => {
isDrag.value = true
e.dataTransfer!.setData('table', JSON.stringify(ele))
}

const getTableName = (val: any) => {
tableName.value = val
}

const singleDragEnd = () => {
isDrag.value = false
}
const handleSizeChange = (val: number) => {
pageInfo.currentPage = 1
pageInfo.pageSize = val
Expand Down Expand Up @@ -119,6 +137,7 @@ const handleSelectTableList = () => {
}

const clickTable = (table: any) => {
if (activeRelationship.value) return
loading.value = true
currentTable.value = table
fieldList.value = []
Expand Down Expand Up @@ -290,8 +309,14 @@ const btnSelectClick = (val: any) => {
<div
v-for="ele in tableListWithSearch"
:key="ele.table_name"
:draggable="activeRelationship && !tableName.includes(ele.id)"
class="model"
:class="currentTable.table_name === ele.table_name && 'isActive'"
@dragstart="($event: any) => singleDragStartD($event, ele)"
@dragend="singleDragEnd"
:class="[
currentTable.table_name === ele.table_name && 'isActive',
tableName.includes(ele.id) && activeRelationship && 'disabled-table',
]"
:title="ele.table_name"
@click="clickTable(ele)"
>
Expand All @@ -318,9 +343,32 @@ const btnSelectClick = (val: any) => {
</div>
</div>
</div>
<div class="table-relationship">
<div @click="handleRelationship" :class="activeRelationship && 'active'" class="btn">
<el-icon size="16">
<icon_mindnote_outlined></icon_mindnote_outlined>
</el-icon>
{{ t('training.table_relationship_management') }}
</div>
</div>
</div>

<div v-if="activeRelationship" class="relationship-content">
<div class="title">{{ t('training.table_relationship_management') }}</div>
<div class="content">
<TableRelationship
@getTableName="getTableName"
:dragging="isDrag"
:id="info.id"
></TableRelationship>
</div>
</div>

<div v-if="currentTable.table_name" v-loading="loading" class="info-table">
<div
v-if="currentTable.table_name && !activeRelationship"
v-loading="loading"
class="info-table"
>
<div class="table-name">
<div class="name">{{ currentTable.table_name }}</div>
<div class="notes">
Expand All @@ -336,6 +384,7 @@ const btnSelectClick = (val: any) => {
</el-tooltip>
</div>
</div>

<div class="table-content">
<div class="btn-select">
<el-button
Expand Down Expand Up @@ -532,6 +581,46 @@ const btnSelectClick = (val: any) => {
padding: 8px 16px;
height: 100%;
border-right: 1px solid #1f232926;
.table-relationship {
height: 56px;
width: 100%;
display: flex;
align-items: center;
margin-top: 20px;
position: relative;

&::after {
content: '';
width: calc(100% + 32px);
position: absolute;
left: -16px;
background-color: #1f232926;
top: 0;
height: 1px;
}

.btn {
width: 248px;
height: 32px;
cursor: pointer;
border-radius: 6px;
display: flex;
align-items: center;
padding-left: 8px;
.ed-icon {
color: #646a73;
margin-right: 8px;
}

&.active {
color: var(--ed-color-primary);
.ed-icon {
color: var(--ed-color-primary);
}
background-color: var(--ed-color-primary-1a);
}
}
}
.select-table_top {
height: 40px;
display: flex;
Expand All @@ -551,7 +640,7 @@ const btnSelectClick = (val: any) => {
}

.list-content {
height: calc(100% - 100px);
height: calc(100% - 156px);
.no-result {
margin-top: 72px;
font-weight: 400;
Expand All @@ -569,6 +658,12 @@ const btnSelectClick = (val: any) => {
border-radius: 4px;
cursor: pointer;

&.disabled-table {
background: #dee0e3 !important;
color: #646a73;
cursor: not-allowed;
}

.name {
margin-left: 8px;
font-weight: 500;
Expand Down Expand Up @@ -604,6 +699,27 @@ const btnSelectClick = (val: any) => {
}
}
}
.relationship-content {
position: absolute;
right: 0;
top: 0;
width: calc(100% - 280px);
height: 100%;

.content {
height: calc(100% - 56px);
width: 100%;
}

.title {
height: 56px;
padding-left: 24px;
line-height: 56px;
font-weight: 500;
font-size: 16px;
border-bottom: 1px solid #1f232926;
}
}
.info-table {
position: absolute;
right: 0;
Expand Down
Loading