diff --git a/backend/apps/datasource/crud/datasource.py b/backend/apps/datasource/crud/datasource.py index 75edb427..3d01880e 100644 --- a/backend/apps/datasource/crud/datasource.py +++ b/backend/apps/datasource/crud/datasource.py @@ -246,7 +246,7 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table if data.fields is None or len(data.fields) == 0: return {"fields": [], "data": [], "sql": ''} - where = None + where = '' f_list = [f for f in data.fields if f.checked] if is_normal_user(current_user): # column is checked, and, column permission for data.fields @@ -294,7 +294,7 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table elif ds.type == "sqlServer": sql = f"""SELECT [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}] {where} - ORDER BY [{data.fields[0].field_name}] + ORDER BY [{fields[0]}] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY""" elif ds.type == "pg" or ds.type == "excel": sql = f"""SELECT "{'", "'.join(fields)}" FROM "{conf.dbSchema}"."{data.table.table_name}" @@ -303,7 +303,7 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table elif ds.type == "oracle": sql = f"""SELECT "{'", "'.join(fields)}" FROM "{conf.dbSchema}"."{data.table.table_name}" {where} - ORDER BY "{data.fields[0].field_name}" + ORDER BY "{fields[0]}" OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY""" return exec_sql(ds, sql) diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 7f801fd3..c61b1cce 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -32,6 +32,8 @@ "password_reset_successful": "Password reset successful" }, "dashboard": { + "add_success": "Add Success", + "no_data": "No Relevant Content Found", "new_tab": "New Tab", "length_limit64": "Field length must be between 1 and 64", "sort_column": "Sort field", @@ -504,4 +506,4 @@ "back_community": "Restore to Community Edition", "confirm_tips": "Are you sure to restore to Community Edition?" } -} \ No newline at end of file +} diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 6b70d46a..aea50c1b 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -34,6 +34,8 @@ "password_reset_successful": "重置密码成功" }, "dashboard": { + "add_success": "添加成功", + "no_data": "没找到相关内容", "new_tab": "新建Tab", "length_limit64": "字段长度需要在1-64之间", "sort_column": "排序字段", @@ -516,4 +518,4 @@ "back_community": "还原至社区版", "confirm_tips": "确定还原至社区版?" } -} \ No newline at end of file +} diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 5f6571d2..514d4db6 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -569,7 +569,7 @@ function getChatPredictData(recordId?: number) { chatApi.get_chart_predict_data(recordId).then((response) => { currentChat.value.records.forEach((record) => { if (record.id === recordId) { - record.predict_data = response + record.predict_data = response.data ?? [] } }) }) diff --git a/frontend/src/views/dashboard/editor/ChatChartSelection.vue b/frontend/src/views/dashboard/editor/ChatChartSelection.vue index 9ed36a1a..26e84803 100644 --- a/frontend/src/views/dashboard/editor/ChatChartSelection.vue +++ b/frontend/src/views/dashboard/editor/ChatChartSelection.vue @@ -99,7 +99,12 @@ function adaptorChartInfoList(chatInfo: ChatInfo) { chartInfoList.value = [] if (chatInfo && chatInfo.records) { chatInfo.records.forEach((record: any) => { - if (record?.chart && record.data) { + if ( + (record?.analysis_record_id === undefined || record?.analysis_record_id === null) && + (record?.predict_record_id === undefined || record?.predict_record_id === null) && + record?.chart && + record.data + ) { const recordeInfo = { id: chatInfo.id + '_' + record.id, data: record.data, chart: {} } const chartBaseInfo = JSON.parse(record.chart) recordeInfo['chart'] = { diff --git a/frontend/src/views/dashboard/editor/DashboardChatList.vue b/frontend/src/views/dashboard/editor/DashboardChatList.vue index b9cf325c..0641d0cc 100644 --- a/frontend/src/views/dashboard/editor/DashboardChatList.vue +++ b/frontend/src/views/dashboard/editor/DashboardChatList.vue @@ -130,7 +130,7 @@ const filteredAndGroupedData = computed(() => { " class="no-data" > - {{ t('dashboard.no_chat') }} + {{ t('dashboard.no_data') }} @@ -217,6 +217,7 @@ const filteredAndGroupedData = computed(() => { .no-data { text-align: center; padding: 16px; + margin-top: 140px; color: var(--ed-text-color-placeholder); font-size: 14px; } diff --git a/frontend/src/views/dashboard/editor/Toolbar.vue b/frontend/src/views/dashboard/editor/Toolbar.vue index 5a6e1906..7b59d3f9 100644 --- a/frontend/src/views/dashboard/editor/Toolbar.vue +++ b/frontend/src/views/dashboard/editor/Toolbar.vue @@ -138,6 +138,10 @@ const addChatChart = (views: any) => { views.forEach((view: any) => { emits('addComponent', 'SQView', cloneDeep(view)) }) + ElMessage({ + type: 'success', + message: t('dashboard.add_success'), + }) } const previewInner = () => {