Skip to content

Commit ebc36a2

Browse files
Merge pull request OtterMind#109 from chat2db/developing
Developing
2 parents e6a1cdb + 712fbe9 commit ebc36a2

138 files changed

Lines changed: 3807 additions & 2153 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/release.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,24 @@ jobs:
8888
- name: Copy Jre for Windows
8989
if: ${{ runner.os == 'Windows' }}
9090
run: |
91-
cp -r "${{ env.JAVA_HOME }}" ali-dbhub-client/electron/jre
91+
mkdir chat2db-client/static
92+
cp -r "${{ env.JAVA_HOME }}" chat2db-client/static/jre
9293
9394
# 复制jre macOS
9495
- name: Copy Jre for macOS
9596
if: ${{ runner.os == 'macOS' }}
9697
run: |
97-
cp -r $JAVA_HOME ali-dbhub-client/electron/jre
98-
chmod -R 777 ali-dbhub-client/electron/jre/
98+
mkdir chat2db-client/static
99+
cp -r $JAVA_HOME chat2db-client/static/jre
100+
chmod -R 777 chat2db-client/static/jre/
99101
100102
# 安装node
101103
- name: Install Node.js
102104
uses: actions/setup-node@main
103105
with:
104106
node-version: 16
107+
cache: 'yarn'
108+
cache-dependency-path: chat2db-client/yarn.lock
105109

106110
# 安装java
107111
- name: Install Java and Maven
@@ -118,6 +122,15 @@ jobs:
118122
npm install
119123
npm run build:desktop
120124
cp -r dist ../ali-dbhub-server/ali-dbhub-server-start/src/main/resources/static/front
125+
126+
127+
# 构建静态文件信息
128+
- name: Yarn install & build & copy
129+
run: |
130+
cd chat2db-client
131+
yarn install
132+
yarn run build:web:prod --appVersion=${{ steps.chat2db_version.outputs.substring }}
133+
cp -r dist ../chat2db-server/chat2db-server-start/src/main/resources/static/front
121134
122135
# 编译服务端java版本
123136
- name: Build Java
@@ -126,24 +139,23 @@ jobs:
126139
# 复制服务端java 到指定位置
127140
- name: Copy App
128141
run: |
129-
mkdir ali-dbhub-client/electron/app
130-
cp ali-dbhub-server/ali-dbhub-server-start/target/ali-dbhub-server-start.jar ali-dbhub-client/electron/app/
142+
cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/static/
131143
132-
# 安装electron
133-
- name: Npm install electron
144+
- name: Prepare Build Electron
134145
run: |
135-
cd ali-dbhub-client/electron
136-
cp -r ../dist ./
146+
cd chat2db-client
147+
yarn run build:web:desktop --appVersion=${{ steps.chat2db_version.outputs.substring }}
137148
138149
# windows
139150
- name: Build/release Electron app for Windows
140151
if: ${{ runner.os == 'Windows' }}
141152
uses: samuelmeuli/action-electron-builder@v1
142153
with:
143-
package_root: "ali-dbhub-client/electron"
154+
package_root: "chat2db-client/"
144155
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
145156
mac_certs: ${{ secrets.mac_certs }}
146157
mac_certs_password: ${{ secrets.mac_certs_password }}
158+
skip_build: true
147159
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --win --x64"
148160
release: true
149161

@@ -152,58 +164,61 @@ jobs:
152164
if: ${{ runner.os == 'macOS' && matrix.arch == 'amd64' }}
153165
uses: samuelmeuli/action-electron-builder@v1
154166
with:
155-
package_root: "ali-dbhub-client/electron"
167+
package_root: "chat2db-client/"
156168
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
157169
mac_certs: ${{ secrets.mac_certs }}
158170
mac_certs_password: ${{ secrets.mac_certs_password }}
171+
skip_build: true
159172
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --mac --x64"
160173
release: true
161174

175+
162176
# amd64 notarization
163177
- name: Notarization amd64 App
164178
if: ${{ runner.os == 'macOS' && matrix.arch == 'amd64' }}
165179
run: |
166-
xcrun altool --notarize-app --primary-bundle-id "${{secrets.MAC_PRIMARY_BUNDLE_ID}}" --username "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --asc-provider "${{secrets.MAC_ASC_PROVIDER}}" -t osx --file ali-dbhub-client/electron-build/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg
180+
xcrun altool --notarize-app --primary-bundle-id "${{secrets.MAC_PRIMARY_BUNDLE_ID}}" --username "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --asc-provider "${{secrets.MAC_ASC_PROVIDER}}" -t osx --file chat2db-client/release/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg
167181
168-
# macos amd64
182+
# macos arm64
169183
- name: Build/release Electron app for MacOS arm64
170184
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
171185
uses: samuelmeuli/action-electron-builder@v1
172186
with:
173-
package_root: "ali-dbhub-client/electron"
187+
package_root: "chat2db-client/"
174188
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
175189
mac_certs: ${{ secrets.mac_certs }}
176190
mac_certs_password: ${{ secrets.mac_certs_password }}
191+
skip_build: true
177192
args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --mac --arm64"
178193
release: true
179194

180195
# arm notarization
181196
- name: Notarization arm64 App
182197
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
183198
run: |
184-
xcrun altool --notarize-app --primary-bundle-id "${{secrets.MAC_PRIMARY_BUNDLE_ID}}" --username "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --asc-provider "${{secrets.MAC_ASC_PROVIDER}}" -t osx --file ali-dbhub-client/electron-build/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg
199+
xcrun altool --notarize-app --primary-bundle-id "${{secrets.MAC_PRIMARY_BUNDLE_ID}}" --username "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --asc-provider "${{secrets.MAC_ASC_PROVIDER}}" -t osx --file chat2db-client/release/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg
185200
186201
# 准备要需要的数据 Windows
187202
- name: Prepare upload for Windows
188203
if: runner.os == 'Windows'
189204
run: |
190205
mkdir oss_temp_file
191-
cp -r ali-dbhub-client/electron-build/*Setup*.exe ./oss_temp_file
206+
cp -r chat2db-client/release/*Setup*.exe ./oss_temp_file
192207
193208
# 准备要需要的数据 MacOS amd64
194209
- name: Prepare upload for MacOS amd64
195210
if: ${{ runner.os == 'macOS' && matrix.arch == 'amd64' }}
196211
run: |
197212
mkdir oss_temp_file
198-
cp ali-dbhub-client/electron/app/ali-dbhub-server-start.jar ./oss_temp_file
199-
cp -r ali-dbhub-client/electron-build/*.dmg ./oss_temp_file
213+
cp chat2db-client/static/chat2db-server-start.jar ./oss_temp_file
214+
cp -r chat2db-client/release/*.dmg ./oss_temp_file
200215
201216
# 准备要需要的数据 MacOS arm64
202217
- name: Prepare upload for MacOS arm64
203218
if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }}
204219
run: |
205220
mkdir oss_temp_file
206-
cp -r ali-dbhub-client/electron-build/*.dmg ./oss_temp_file
221+
cp -r chat2db-client/release/*.dmg ./oss_temp_file
207222
208223
# 把文件上传到OSS 方便下载
209224
- name: Set up oss utils

.vscode/settings.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
{
22
"cSpell.words": [
3-
"Dserver",
4-
"Dspring",
5-
"Sercurity",
63
"ahooks",
74
"antd",
85
"asar",
96
"cascader",
7+
"Dserver",
8+
"Dspring",
9+
"echart",
1010
"echarts",
11+
"favicons",
12+
"iconfont",
13+
"monaco",
1114
"nsis",
1215
"pgsql",
16+
"Sercurity",
1317
"sortablejs",
1418
"wireframe"
1519
]

chat2db-client/.umirc.desktop.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ const chainWebpack = (config: any, { webpack }: any) => {
99
languages: ['mysql', 'pgsql', 'sql'],
1010
},
1111
]);
12-
13-
config.plugin('define').use(require('webpack').DefinePlugin, [
14-
{
15-
__BUILD_TIME__: JSON.stringify(formatDate(new Date(), 'yyyyMMddhhmmss')),
16-
__APP_VERSION__: JSON.stringify(process.env.APP_VERSION || '0.0.0'),
17-
},
18-
]);
1912
};
2013

2114
export default defineConfig({
@@ -24,5 +17,5 @@ export default defineConfig({
2417
headScripts: ['if (window.myAPI) { window.myAPI.startServerForSpawn() }'],
2518
define: {
2619
'process.env.UMI_ENV': process.env.UMI_ENV,
27-
}
20+
},
2821
});

chat2db-client/.umirc.prod.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,12 @@ const chainWebpack = (config: any, { webpack }: any) => {
99
languages: ['mysql', 'pgsql', 'sql'],
1010
},
1111
]);
12-
13-
config.plugin('define').use(require('webpack').DefinePlugin, [
14-
{
15-
__BUILD_TIME__: JSON.stringify(formatDate(new Date(), 'yyyyMMddhhmmss')),
16-
__APP_VERSION__: JSON.stringify(process.env.APP_VERSION || '0.0.0'),
17-
},
18-
]);
1912
};
2013

2114
export default defineConfig({
2215
publicPath: UMI_PublicPath,
2316
chainWebpack,
2417
define: {
2518
'process.env.UMI_ENV': process.env.UMI_ENV,
26-
}
19+
},
2720
});

chat2db-client/.umirc.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
import { formatDate } from './src/utils/date';
22
import { defineConfig } from 'umi';
3+
import { getLang } from '@/utils/localStorage';
34
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
5+
console.log(process.env.UMI_ENV);
46

57
const chainWebpack = (config: any, { webpack }: any) => {
68
config.plugin('monaco-editor').use(MonacoWebpackPlugin, [
79
{
810
languages: ['mysql', 'pgsql', 'sql'],
911
},
1012
]);
11-
12-
config.plugin('define').use(require('webpack').DefinePlugin, [
13-
{
14-
__BUILD_TIME__: JSON.stringify(formatDate(new Date(), 'yyyyMMddhhmmss')),
15-
__APP_VERSION__: JSON.stringify(process.env.APP_VERSION || '0.0.0'),
16-
},
17-
]);
1813
};
1914

2015
export default defineConfig({
2116
title: 'Chat2DB',
22-
history: {
23-
type: 'hash',
24-
},
17+
// history: {
18+
// type: 'hash',
19+
// },
2520
base: '/',
2621
publicPath: '/',
2722
hash: false,
@@ -40,12 +35,14 @@ export default defineConfig({
4035
proxy: {
4136
'/api': {
4237
target: 'http://127.0.0.1:10821',
43-
changeOrigin: true,
38+
changeOrigin: true
4439
},
4540
},
4641
headScripts: ['if (window.myAPI) { window.myAPI.startServerForSpawn() }'],
4742
favicons: ['logo.ico'],
4843
define: {
49-
'process.env.UMI_ENV': process.env.UMI_ENV,
50-
}
44+
__ENV: process.env.UMI_ENV,
45+
__BUILD_TIME__: formatDate(new Date(), 'yyyyMMddhhmmss'),
46+
__APP_VERSION__: process.env.APP_VERSION || '0.0.0',
47+
},
5148
});

chat2db-client/.vscode/settings.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@
1515
},
1616
"git.mergeEditor": false,
1717
"cSpell.words": [
18-
"antd",
1918
"Appstore",
20-
"Cascader",
2119
"CLICKHOUSE",
22-
"datas",
23-
"datasource",
24-
"dbhub",
20+
"Cascader",
2521
"Iconfont",
2622
"JDBC",
2723
"KEYPAIR",
2824
"SQLSERVER",
2925
"USERANDPASSWORD",
26+
"antd",
27+
"chatgpt",
28+
"datas",
29+
"datasource",
30+
"dbhub",
3031
"uuidv",
3132
"wireframe"
3233
]

chat2db-client/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module 'monaco-editor/esm/vs/basic-languages/sql/sql';
2+
declare module 'monaco-editor/esm/vs/language/typescript/ts.worker.js';
3+
declare module 'monaco-editor/esm/vs/editor/editor.worker.js';

chat2db-client/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
"start": "concurrently \"npm run start:web\" \"npm run start:main\"",
2323
"start:main": "cross-env NODE_ENV=development electron .",
2424
"start:main:prod": "cross-env NODE_ENV=production electron .",
25-
"start:web": "umi dev"
25+
"start:web": "cross-env UMI_ENV=local umi dev"
2626
},
2727
"dependencies": {
2828
"ahooks": "^3.7.7",
29+
"ali-react-table": "^2.6.1",
2930
"antd": "^5.6.0",
3031
"echarts": "^5.4.2",
3132
"echarts-for-react": "^3.0.2",
@@ -101,4 +102,4 @@
101102
"icon": "src/assets/logo/logo.png"
102103
}
103104
}
104-
}
105+
}

chat2db-client/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
目录结构 tree ./ -L 2 -I node_modules
1010

11+
## TS书写规范
12+
1. 所有的interfase 与 type 必须已I开头
13+
`interfase IState { name: string }` // good
14+
`interfase State { name: string }` // bad
15+
1116

1217
## 如何使用国际化
1318

chat2db-client/src/blocks/Setting/index.less

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
.f-icon-button();
55
}
66

7+
.settingIcon {
8+
color: var(--custom-color-icon);
9+
}
10+
711
.backgroundList {
812
display: flex;
913
margin: 0px 0px 20px -7px;
@@ -93,6 +97,7 @@
9397
margin: -16px;
9498
height: 70vh;
9599
overflow-y: auto;
100+
border-radius: var(--border-radius-l-g);
96101
}
97102

98103
.menus {
@@ -128,7 +133,6 @@
128133
min-height: 400px;
129134
padding: 20px;
130135
flex: 1;
131-
background-color: var(--color-bg-base);
132136

133137
.menuContentTitle {
134138
font-size: 16px;

0 commit comments

Comments
 (0)