Skip to content

Commit 31436a7

Browse files
committed
Merge branch 'main' of https://github.com/dataease/SQLBot
2 parents 85d8146 + ce4c305 commit 31436a7

File tree

7 files changed

+22
-8
lines changed

7 files changed

+22
-8
lines changed

backend/apps/datasource/crud/datasource.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table
246246
if data.fields is None or len(data.fields) == 0:
247247
return {"fields": [], "data": [], "sql": ''}
248248

249-
where = None
249+
where = ''
250250
f_list = [f for f in data.fields if f.checked]
251251
if is_normal_user(current_user):
252252
# column is checked, and, column permission for data.fields
@@ -294,7 +294,7 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table
294294
elif ds.type == "sqlServer":
295295
sql = f"""SELECT [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}]
296296
{where}
297-
ORDER BY [{data.fields[0].field_name}]
297+
ORDER BY [{fields[0]}]
298298
OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY"""
299299
elif ds.type == "pg" or ds.type == "excel":
300300
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
303303
elif ds.type == "oracle":
304304
sql = f"""SELECT "{'", "'.join(fields)}" FROM "{conf.dbSchema}"."{data.table.table_name}"
305305
{where}
306-
ORDER BY "{data.fields[0].field_name}"
306+
ORDER BY "{fields[0]}"
307307
OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY"""
308308
return exec_sql(ds, sql)
309309

frontend/src/i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
"password_reset_successful": "Password reset successful"
3333
},
3434
"dashboard": {
35+
"add_success": "Add Success",
36+
"no_data": "No Relevant Content Found",
3537
"new_tab": "New Tab",
3638
"length_limit64": "Field length must be between 1 and 64",
3739
"sort_column": "Sort field",
@@ -504,4 +506,4 @@
504506
"back_community": "Restore to Community Edition",
505507
"confirm_tips": "Are you sure to restore to Community Edition?"
506508
}
507-
}
509+
}

frontend/src/i18n/zh-CN.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"password_reset_successful": "重置密码成功"
3535
},
3636
"dashboard": {
37+
"add_success": "添加成功",
38+
"no_data": "没找到相关内容",
3739
"new_tab": "新建Tab",
3840
"length_limit64": "字段长度需要在1-64之间",
3941
"sort_column": "排序字段",
@@ -516,4 +518,4 @@
516518
"back_community": "还原至社区版",
517519
"confirm_tips": "确定还原至社区版?"
518520
}
519-
}
521+
}

frontend/src/views/chat/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ function getChatPredictData(recordId?: number) {
569569
chatApi.get_chart_predict_data(recordId).then((response) => {
570570
currentChat.value.records.forEach((record) => {
571571
if (record.id === recordId) {
572-
record.predict_data = response
572+
record.predict_data = response.data ?? []
573573
}
574574
})
575575
})

frontend/src/views/dashboard/editor/ChatChartSelection.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ function adaptorChartInfoList(chatInfo: ChatInfo) {
9999
chartInfoList.value = []
100100
if (chatInfo && chatInfo.records) {
101101
chatInfo.records.forEach((record: any) => {
102-
if (record?.chart && record.data) {
102+
if (
103+
(record?.analysis_record_id === undefined || record?.analysis_record_id === null) &&
104+
(record?.predict_record_id === undefined || record?.predict_record_id === null) &&
105+
record?.chart &&
106+
record.data
107+
) {
103108
const recordeInfo = { id: chatInfo.id + '_' + record.id, data: record.data, chart: {} }
104109
const chartBaseInfo = JSON.parse(record.chart)
105110
recordeInfo['chart'] = {

frontend/src/views/dashboard/editor/DashboardChatList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const filteredAndGroupedData = computed(() => {
130130
"
131131
class="no-data"
132132
>
133-
{{ t('dashboard.no_chat') }}
133+
{{ t('dashboard.no_data') }}
134134
</div>
135135
</div>
136136
</el-scrollbar>
@@ -217,6 +217,7 @@ const filteredAndGroupedData = computed(() => {
217217
.no-data {
218218
text-align: center;
219219
padding: 16px;
220+
margin-top: 140px;
220221
color: var(--ed-text-color-placeholder);
221222
font-size: 14px;
222223
}

frontend/src/views/dashboard/editor/Toolbar.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ const addChatChart = (views: any) => {
138138
views.forEach((view: any) => {
139139
emits('addComponent', 'SQView', cloneDeep(view))
140140
})
141+
ElMessage({
142+
type: 'success',
143+
message: t('dashboard.add_success'),
144+
})
141145
}
142146
143147
const previewInner = () => {

0 commit comments

Comments
 (0)