Skip to content

Commit 2f40ba6

Browse files
authored
Merge branch 'chat2db:dev' into dev
2 parents 04bf636 + 6965917 commit 2f40ba6

84 files changed

Lines changed: 2286 additions & 542 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,30 @@
44
- ⭐【New Features】The tree node operation menu supports right-clicking
55
- ⭐【New Features】The tree node operation menu can copy the names of tables, fields, keys, indexes, and functions
66
- ⭐【New Features】Edit table structure supports setting primary keys in columns
7-
- ⚡️【Optimize】
7+
- ⭐【New Features】Edit data to support cell-level undo changes
8+
- ⭐【New Features】 Edit data support right click operation
9+
1. Supports single-row replication of Insert, Update, table header fields, and row data
10+
2. Clone the selected row
11+
3. Replication of cell data is supported
12+
4. You can set the cell to Null or Default
13+
5. Row deletion is supported
14+
- ⭐【New Features】History is added to the foldable panel on the right
15+
- ⚡️【Optimize】Edit the table structure to add loading
816
- 🐞【Fixed】Fixed table structure editing floating-point decimal Settings display exception
917

1018
**更新日志**
1119
- ⭐【新功能】树节点操作菜单支持右键唤出
1220
- ⭐【新功能】树节点操作菜单支持复制表、字段、key、index、函数等名称
1321
- ⭐【新功能】编辑表结构支持在列中设置主键
14-
- ⚡️【优化】
22+
- ⭐【新功能】编辑数据支持单元格级别撤销修改
23+
- ⭐【新功能】编辑数据支持右键操作
24+
1. 支持单行复制 Insert、Update、表头字段、行数据
25+
2. 支持克隆选中行
26+
3. 支持复制单元格数据
27+
4. 支持设置单元格为Null和Default
28+
5. 支持删除行
29+
- ⭐【新功能】右侧可折叠面板中增加历史记录
30+
- ⚡️【优化】编辑表结构添加loading
1531
- 🐞【修复】修复表结构编辑浮点数小数位设置显示异常
1632

1733

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Chat2DB supports connecting to the following databases:
6969
- SQLServer
7070
- SQLite
7171
- MariaDB
72-
- ClickHouseare
72+
- ClickHouse
7373
- DM
7474
- Presto
7575
- DB2

chat2db-client/readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010

1111
## 启动项目
1212

13+
1314
强制使用 yarn,因为环境变量、lock 文件只维护了 yarn,npm/pnpm 可能会产生意想不到的 bug node 版本要求 16 以上 `npm i -g yarn` `yarn` `yarn run build:web:prod` `cp -r dist ../chat2db-server/chat2db-server-start/src/main/resources/static/front` (复制打包结果到指定目录。windows 可能命令不一样,可以手动复制下) 之后就可以启动后端了 `mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml`
1415

1516
启动前端项目调试 `yarn run start:web` 注意:因为 electron 包比较难下载,如果 yarn 时 electron 下载失败或超时,可以删除掉 chat2db-client/package.json 下的 electron,再次 yarn
1617

17-
## TS 书写规范
18+
## TS书写规范
1819

19-
1. 所有的 interface 与 type 必须已 I 开头 `interface IState { name: string }` // good `interface State { name: string }` // bad
20+
1. 所有的interface 与 type 必须已I开头
21+
`interface IState { name: string }` // good
22+
`interface State { name: string }` // bad
2023

2124
## 如何在 js 与 css 中使用颜色
2225

chat2db-client/src/blocks/DatabaseTableEditor/index.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React, { memo, useRef, useState, createContext, useEffect, useMemo } from 'react';
22
import { Button, Modal, message } from 'antd';
3+
import i18n from '@/i18n';
4+
import lodash from 'lodash';
35
import styles from './index.less';
46
import classnames from 'classnames';
57
import IndexList, { IIndexListRef } from './IndexList';
@@ -9,8 +11,7 @@ import sqlService, { IModifyTableSqlParams } from '@/service/sql';
911
import ExecuteSQL from '@/components/ExecuteSQL';
1012
import { IEditTableInfo, IWorkspaceTab, IColumnTypes } from '@/typings';
1113
import { DatabaseTypeCode, WorkspaceTabType } from '@/constants';
12-
import i18n from '@/i18n';
13-
import lodash from 'lodash';
14+
import LoadingContent from '@/components/Loading/LoadingContent';
1415
interface IProps {
1516
dataSourceId: number;
1617
databaseName: string;
@@ -93,6 +94,7 @@ export default memo((props: IProps) => {
9394
collations: [],
9495
indexTypes: [],
9596
});
97+
const [isLoading, setIsLoading] = useState<boolean>(false);
9698

9799
function changeTab(item: ITabItem) {
98100
setCurrentTab(item);
@@ -103,7 +105,7 @@ export default memo((props: IProps) => {
103105
getTableDetails();
104106
}
105107
getDatabaseFieldTypeList();
106-
}, []);
108+
}, [])
107109

108110
// 获取数据库字段类型列表
109111
const getDatabaseFieldTypeList = () => {
@@ -153,7 +155,7 @@ export default memo((props: IProps) => {
153155
indexTypes,
154156
});
155157
});
156-
};
158+
}
157159

158160
const getTableDetails = (myParams?: { tableNameProps?: string }) => {
159161
const { tableNameProps } = myParams || {};
@@ -166,13 +168,17 @@ export default memo((props: IProps) => {
166168
schemaName,
167169
refresh: true,
168170
};
171+
setIsLoading(true);
169172
sqlService.getTableDetails(params).then((res) => {
170173
const newTableDetails = lodash.cloneDeep(res);
171174
setTableDetails(newTableDetails || {});
172175
setOldTableDetails(res);
173-
});
176+
})
177+
.finally(()=>{
178+
setIsLoading(false);
179+
})
174180
}
175-
};
181+
}
176182

177183
function submit() {
178184
if (baseInfoRef.current && columnListRef.current && indexListRef.current) {
@@ -218,7 +224,7 @@ export default memo((props: IProps) => {
218224
},
219225
});
220226
}
221-
};
227+
}
222228

223229
return (
224230
<Context.Provider
@@ -232,7 +238,7 @@ export default memo((props: IProps) => {
232238
databaseType,
233239
}}
234240
>
235-
<div className={classnames(styles.box)}>
241+
<LoadingContent coverLoading isLoading={isLoading} className={classnames(styles.box)}>
236242
<div className={styles.header}>
237243
<div className={styles.tabList} style={{ '--i': currentTab.index } as any}>
238244
{tabList.map((item) => {
@@ -262,7 +268,8 @@ export default memo((props: IProps) => {
262268
);
263269
})}
264270
</div>
265-
</div>
271+
</LoadingContent>
272+
266273
<Modal
267274
title={i18n('editTable.title.sqlPreview')}
268275
open={!!viewSqlModal}

chat2db-client/src/components/Console/ChatInput/index.tsx

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ const ChatInput = (props: IProps) => {
6060
<Radio value={SyncModelType.MANUAL}>手动</Radio>
6161
</Space>
6262
</Radio.Group>
63-
{syncTableModel === 0 ? (
63+
{/* {syncTableModel === 0 ? (
6464
i18n('chat.input.syncTable.tips')
6565
) : (
66-
<>
67-
<span className={styles.aiSelectedTableTips}>{i18n('chat.input.remain.tooltip')}</span>
68-
<Select
69-
showSearch
70-
mode="multiple"
71-
allowClear
72-
options={options}
73-
placeholder={i18n('chat.input.tableSelect.placeholder')}
74-
value={selectedTables}
75-
onChange={(v) => {
76-
onSelectTables && onSelectTables(v);
77-
}}
78-
/>
79-
</>
80-
)}
66+
)} */}
67+
<>
68+
<span className={styles.aiSelectedTableTips}>{i18n('chat.input.remain.tooltip')}</span>
69+
<Select
70+
showSearch
71+
mode="multiple"
72+
allowClear
73+
options={options}
74+
placeholder={i18n('chat.input.tableSelect.placeholder')}
75+
value={selectedTables}
76+
onChange={(v) => {
77+
onSelectTables && onSelectTables(v);
78+
}}
79+
/>
80+
</>
8181
</div>
8282
);
8383
};
@@ -108,7 +108,7 @@ const ChatInput = (props: IProps) => {
108108
<Iconfont code="&#xe643;" className={styles.enterIcon} />
109109
</Button>
110110
)}
111-
<Tooltip
111+
{/* <Tooltip
112112
title={<span style={{ color: window._AppThemePack.colorText }}>{i18n('chat.input.syncTable.tempTips')}</span>}
113113
defaultOpen={!hasBubble}
114114
color={window._AppThemePack.colorBgBase}
@@ -117,12 +117,13 @@ const ChatInput = (props: IProps) => {
117117
localStorage.setItem('syncTableBubble', 'true');
118118
}}
119119
>
120-
<div className={styles.tableSelectBlock}>
121-
<Popover content={renderSelectTable()} placement="bottomLeft">
122-
<Iconfont code="&#xe618;" />
123-
</Popover>
124-
</div>
125-
</Tooltip>
120+
121+
</Tooltip> */}
122+
<div className={styles.tableSelectBlock}>
123+
<Popover content={renderSelectTable()} placement="bottomLeft">
124+
<Iconfont code="&#xe618;" />
125+
</Popover>
126+
</div>
126127

127128
{/* {props.aiType === AIType.CHAT2DBAI && (
128129
<Spin spinning={!!props.remainingBtnLoading} size="small">

chat2db-client/src/components/Console/MonacoEditor/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function MonacoEditor(props: IProps, ref: ForwardedRef<IExportRefFunction>) {
160160

161161
const colors = {
162162
'editor.lineHighlightBackground': colorPrimary + '14', // 当前行背景色
163-
'editor.selectionBackground': colorPrimary + '20', // 选中文本的背景色
163+
'editor.selectionBackground': colorPrimary + '50', // 选中文本的背景色
164164
// 'editorLineNumber.foreground': colorPrimary, // 行号颜色
165165
'editorLineNumber.activeForeground': colorPrimary, // 当前行号颜色
166166
// 'editorCursor.foreground': colorPrimary, // 光标颜色

0 commit comments

Comments
 (0)