mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
Merge branch 'main' of https://github.com/dataease/SQLBot
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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?"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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": "确定还原至社区版?"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 ?? []
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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'] = {
|
||||
|
||||
@@ -130,7 +130,7 @@ const filteredAndGroupedData = computed(() => {
|
||||
"
|
||||
class="no-data"
|
||||
>
|
||||
{{ t('dashboard.no_chat') }}
|
||||
{{ t('dashboard.no_data') }}
|
||||
</div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user