Skip to content

Commit

Permalink
Merge pull request #452 from chat2db/developing
Browse files Browse the repository at this point in the history
Developing
  • Loading branch information
Chat2DB-Pro authored Aug 13, 2023
2 parents 4a0bc1b + c9d282f commit 1d59316
Show file tree
Hide file tree
Showing 133 changed files with 3,981 additions and 1,126 deletions.
25 changes: 15 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
{
"cSpell.words": [
"AZUREAI",
"DBAI",
"DBHUB",
"Dmaven",
"Dserver",
"Dspring",
"Mddhhmmss",
"OPENAI",
"RESTAI",
"Sercurity",
"aarch",
"ahooks",
"alicdn",
"aliyuncs",
"altool",
"antd",
"asar",
"AZUREAI",
"bgcolor",
"blockmap",
"cascader",
"chmod",
"CLOB",
"datasource",
"DBAI",
"DBHUB",
"dingtalk",
"Dmaven",
"Dserver",
"Dspring",
"echart",
"echarts",
"favicons",
"ghostoy",
"iconfont",
"jdbc",
"macos",
"Mddhhmmss",
"mkdir",
"monaco",
"msgtype",
"nsis",
"OPENAI",
"ossutil",
"pgsql",
"pnpm",
"remaininguses",
"RESTAI",
"samuelmeuli",
"Sercurity",
"sortablejs",
"temurin",
"Tigger",
"togglefullscreen",
"umijs",
"umirc",
"uuidv",
"VIEWCOLUMN",
"VIEWCOLUMNS",
"wechat",
"wireframe",
"xcrun",
Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
# 2.0.12

## ⭐ New Features

- 🔥Supports viewing views, functions, triggers, and procedures
- Support selected sql formatting
- Added new dark themes

## 🐞 Bug Fixes

- Fixed sql formatting failure issue
- Fixed an issue where locally stored theme colors and background colors are incompatible with the new version, causing page crashes
- Logs desensitize sensitive data
- Fix the issue of 'CLOB' not displaying specific content [Issue #440](https://github.com/chat2db/Chat2DB/issues/440)
- Fix the problem that non-Select does not display query results
- Fix the problem that Oracle cannot query without schema
- Fix the problem of special type of SQL execution error reporting
- Fix the problem that the test link is successful, but the error is reported when saving the link




## ⭐ 新特性

- 🔥支持查看视图、函数、触发器、存储过程
- 支持选中sql格式化
- 增加新的暗色主题

## 🐞 问题修复

- 修复sql格式化会失败问题
- 修复本地存储的主题色、背景色与新版本不兼容时会导致页面崩溃问题
- 日志对敏感数据进行脱敏
- 修复 `CLOB` 不展示具体内容的问题 [Issue #440](https://github.com/chat2db/Chat2DB/issues/440)
- 修复非Select不展示查询结果的问题
- 修复Oracle不带schema无法查询的问题
- 修复特殊类型的SQL执行报错的问题
- 修复测试链接成功,但保存链接报错的问题

# 2.0.11

## 🐞 Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ https://github.com/chat2db/Chat2DB/assets/22975773/b58db908-5768-4a71-aa30-135d2
- 🌈 AI 智能助手,支持自然语言转 SQL、SQL 转自然语言、SQL 优化建议
- 🔥 智能报表,利用AIGC能力,一句话生成报表。
- 👭 支持个人模式、支持团队协作模式,让研发协同效率更高。
- 🔌 除支持目前主流数据库外,还支持国产数据库如:达梦、Oceanbase、北大金仓
- 🔌 除支持目前主流数据库外,还支持国产数据库如:达梦、Oceanbase、人大金仓
- ⚙️ 强大的数据管理能力,支持数据表、视图、存储过程、函数、触发器、索引、序列、用户、角色、授权等管理
- 🛡 前端使用 Electron 开发,提供 Windows、Mac、Linux 客户端、网页版本一体化的解决方案
- 🎁 支持环境隔离、线上、日常数据权限分离
Expand Down
43 changes: 28 additions & 15 deletions chat2db-client/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,53 @@
},
"git.mergeEditor": false,
"cSpell.words": [
"AZUREAI",
"Appstore",
"CLICKHOUSE",
"Cascader",
"DBAI",
"Dmaven",
"Iconfont",
"JDBC",
"KEYPAIR",
"Mddhhmmss",
"OPENAI",
"RESTAI",
"SQLSERVER",
"Sercurity",
"USERANDPASSWORD",
"ahooks",
"antd",
"Appstore",
"AZUREAI",
"bgcolor",
"Cascader",
"chatgpt",
"CLICKHOUSE",
"Consolas",
"datas",
"datasource",
"DBAI",
"dbhub",
"Dmaven",
"echarts",
"favicons",
"findstr",
"gtag",
"Iconfont",
"indexs",
"JDBC",
"KEYPAIR",
"KINGBASE",
"lsof",
"MARIADB",
"Mddhhmmss",
"Menlo",
"netstat",
"OCEANBASE",
"OPENAI",
"pgsql",
"pnpm",
"POSTGRESQL",
"remaininguses",
"RESTAI",
"scrollbar",
"Sercurity",
"sortablejs",
"SQLSERVER",
"Tigger",
"ueabe",
"ueabf",
"ueac",
"umijs",
"USERANDPASSWORD",
"uuidv",
"VIEWCOLUMN",
"wireframe"
],
"typescript.tsdk": "/Users/wangjiaqi/Desktop/Chat2DB/chat2db-client/node_modules/typescript/lib"
Expand Down
30 changes: 27 additions & 3 deletions chat2db-client/src/assets/font/iconfont.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 3633546 */
src: url('iconfont.woff2?t=1691316217339') format('woff2'),
url('iconfont.woff?t=1691316217339') format('woff'),
url('iconfont.ttf?t=1691316217339') format('truetype');
src: url('iconfont.woff2?t=1691924685106') format('woff2'),
url('iconfont.woff?t=1691924685106') format('woff'),
url('iconfont.ttf?t=1691924685106') format('truetype');
}

.iconfont {
Expand All @@ -13,6 +13,30 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-banben:before {
content: "\e70c";
}

.icon-cheweiguanli:before {
content: "\e73c";
}

.icon-dianzhelidaochu:before {
content: "\e64a";
}

.icon-circle-f:before {
content: "\e76a";
}

.icon-tubiao-hanshu:before {
content: "\e6fd";
}

.icon-shituguanliqi:before {
content: "\e647";
}

.icon-huiche:before {
content: "\e643";
}
Expand Down
Binary file modified chat2db-client/src/assets/font/iconfont.ttf
Binary file not shown.
Binary file modified chat2db-client/src/assets/font/iconfont.woff
Binary file not shown.
Binary file modified chat2db-client/src/assets/font/iconfont.woff2
Binary file not shown.
16 changes: 11 additions & 5 deletions chat2db-client/src/blocks/Setting/BaseSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ const themeList = [
name: i18n('setting.text.dark'),
img: themeDarkImg,
},
{
code: ThemeType.DarkDimmed,
name: i18n('setting.text.dark2'),
img: themeDarkImg
},
{
code: ThemeType.FollowOs,
name: i18n('setting.text.followOS'),
Expand Down Expand Up @@ -83,9 +88,9 @@ const colorList = [
// baseBody 基础设置
export default function BaseSetting() {
const [lang, setLang] = useState(currentLang);
const [currentTheme, setCurrentTheme] = useState<ThemeType>(localStorage.getItem('theme'));
const [currentPrimaryColor, setCurrentPrimaryColor] = useState(localStorage.getItem('primary-color'));
const [appTheme, setAppTheme] = useTheme();
const [currentTheme, setCurrentTheme] = useState<ThemeType>(appTheme.backgroundColor);
const [currentPrimaryColor, setCurrentPrimaryColor] = useState(localStorage.getItem('primary-color'));

const changePrimaryColor = (item: any) => {
const html = document.documentElement;
Expand All @@ -103,12 +108,13 @@ export default function BaseSetting() {
location.reload();
}

function handleChangeTheme(theme: ThemeType) {
// TODO: 这里写 ThemeType 为什么报错呢
function handleChangeTheme(backgroundColor: any) {
setAppTheme({
...appTheme,
backgroundColor: theme,
backgroundColor,
});
setCurrentTheme(theme);
setCurrentTheme(backgroundColor);
}

return (
Expand Down
33 changes: 26 additions & 7 deletions chat2db-client/src/components/Console/MonacoEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ function MonacoEditor(props: IProps, ref: ForwardedRef<IExportRefFunction>) {
...options,
value: defaultValue || '',
language: language,
theme: appTheme.backgroundColor === ThemeType.Light ? EditorThemeType.Default : EditorThemeType.BlackTheme,
theme: appTheme.backgroundColor,
});
editorRef.current = editorIns;
didMount && didMount(editorIns);

monaco.editor.defineTheme(EditorThemeType.Default, {
monaco.editor.defineTheme(ThemeType.Light, {
base: 'vs',
inherit: true,
rules: [{ background: '#15161a' }] as any,
Expand All @@ -82,7 +82,7 @@ function MonacoEditor(props: IProps, ref: ForwardedRef<IExportRefFunction>) {
},
});

monaco.editor.defineTheme(EditorThemeType.BlackTheme, {
monaco.editor.defineTheme(ThemeType.Dark, {
base: 'vs-dark',
inherit: true,
rules: [{ background: '#15161a' }] as any,
Expand All @@ -92,6 +92,16 @@ function MonacoEditor(props: IProps, ref: ForwardedRef<IExportRefFunction>) {
'editor.background': '#0A0B0C', //背景色
},
});
monaco.editor.defineTheme(ThemeType.DarkDimmed, {
base: 'vs-dark',
inherit: true,
rules: [{ background: '#15161a' }] as any,
colors: {
// 相关颜色属性配置
'editor.foreground': '#ffffff',
'editor.background': '#1c2128', //背景色
},
});

monaco.editor.defineTheme(EditorThemeType.DashboardLightTheme, {
base: 'vs',
Expand Down Expand Up @@ -136,12 +146,11 @@ function MonacoEditor(props: IProps, ref: ForwardedRef<IExportRefFunction>) {

// 监听主题色变化切换编辑器主题色
useEffect(() => {
const isDark = appTheme.backgroundColor === ThemeType.Dark;
if (options?.theme) {
monaco.editor.setTheme(options.theme);
} else {
monaco.editor.setTheme(isDark ? 'BlackTheme' : 'Default');
return
}
monaco.editor.setTheme(appTheme.backgroundColor);
}, [appTheme.backgroundColor, options?.theme]);

// useEffect(() => {
Expand Down Expand Up @@ -206,7 +215,7 @@ function MonacoEditor(props: IProps, ref: ForwardedRef<IExportRefFunction>) {
return Object.keys(hintData).map((key) => ({
label: key,
kind: monaco.languages.CompletionItemKind.Method,
insertText: `\`${key}\``,
insertText: `${key}`,
detail: '<Database>',
}));
};
Expand Down Expand Up @@ -306,12 +315,22 @@ export const appendMonacoValue = (editor: any, text: any, range: IRangeType = 'e
return;
}
switch (range) {
// 覆盖所有内容
case 'cover':
newRange = model.getFullModelRange();
break;
// 在开头添加内容
case 'front':
newRange = new monaco.Range(1, 1, 1, 1);
break;
// 格式化选中区域的sql
case 'select':
const selection = editor.getSelection();
if (selection) {
newRange = new monaco.Range(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn);
}
break;
// 在末尾添加内容
case 'end':
const lastLine = editor.getModel().getLineCount();
const lastLineLength = editor.getModel().getLineMaxColumn(lastLine);
Expand Down
Loading

0 comments on commit 1d59316

Please sign in to comment.