Skip to content

Commit c8efaf0

Browse files
committed
Merge branch 'dev' of github.com:chat2db/Chat2DB into dev
2 parents d541c2f + 9bd8922 commit c8efaf0

29 files changed

Lines changed: 715 additions & 136 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"bgcolor",
1212
"blockmap",
1313
"cascader",
14+
"charsets",
1415
"chmod",
1516
"CLOB",
1617
"datasource",
@@ -40,6 +41,7 @@
4041
"pgsql",
4142
"pnpm",
4243
"Popconfirm",
44+
"redownload",
4345
"remaininguses",
4446
"RESTAI",
4547
"samuelmeuli",

chat2db-client/.umirc.prod.desktop.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const chainWebpack = (config: any, { webpack }: any) => {
1010
languages: ['mysql', 'pgsql', 'sql'],
1111
},
1212
]);
13-
config.output.filename(`[name].${yarn_config.app_version || new Date().getTime()}.js`);
1413
};
1514

1615
export default defineConfig({

chat2db-client/.umirc.prod.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const chainWebpack = (config: any, { webpack }: any) => {
1010
languages: ['mysql', 'pgsql', 'sql'],
1111
},
1212
]);
13-
config.output.filename(`[name].${yarn_config.app_version || new Date().getTime()}.js`);
1413
};
1514

1615
export default defineConfig({

chat2db-client/.umirc.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ const chainWebpack = (config: any, { webpack }: any) => {
1212
languages: ['mysql', 'pgsql', 'sql'],
1313
},
1414
]);
15-
config.output.filename(`[name].${yarn_config.app_version || new Date().getTime()}.js`);
1615
};
1716

1817
export default defineConfig({
1918
title: 'Chat2DB',
2019
base: '/',
2120
publicPath: '/',
22-
hash: false,
21+
hash: true,
2322
routes: [
2423
{ path: '/demo', component: '@/pages/demo' },
2524
{ path: '/connections', component: 'main' },
@@ -98,7 +97,7 @@ export default defineConfig({
9897
define: {
9998
__ENV__: process.env.UMI_ENV,
10099
__BUILD_TIME__: transitionTimezoneTimestamp(new Date().getTime()),
101-
__APP_VERSION__: yarn_config.app_version || '0.0.0',
100+
__APP_VERSION__: yarn_config.app_version || '9.9.9',
102101
__APP_PORT__: yarn_config.app_port,
103102
},
104103
esbuildMinifyIIFE: true

chat2db-client/.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"uuidv",
8585
"VARCHAR",
8686
"VIEWCOLUMN",
87+
"webp",
8788
"wireframe",
8889
"Wppk",
8990
"yapi"
67 KB
Loading
-25 KB
Loading

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

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,55 @@
11
.aboutUs {
2-
display: flex;
3-
flex-direction: column;
4-
align-items: center;
5-
6-
.brief {
2+
.versionsInfo {
73
display: flex;
8-
flex-direction: column;
94
align-items: center;
10-
5+
padding-bottom: 10px;
6+
border-bottom: 1px solid var(--color-border);
7+
margin-bottom: 10px;
8+
}
9+
.brandLogo {
10+
margin-right: 15px;
11+
}
12+
.currentVersion {
13+
font-size: 20px;
14+
line-height: 24px;
1115
.appName {
12-
font-size: 20px;
16+
margin-right: 10px;
17+
}
18+
}
19+
.newVersion {
20+
color: var(--color-text-tertiary);
21+
font-size: 14px;
22+
margin-top: 2px;
23+
}
24+
.updateButton {
25+
margin-top: 10px;
26+
button:nth-of-type(1) {
27+
margin-right: 20px;
1328
}
29+
}
30+
.updateRule {
31+
.updateRuleTitle {
32+
font-size: 16px;
33+
margin-bottom: 10px;
34+
}
35+
.updateRuleGroup {
36+
display: flex;
37+
flex-direction: column;
38+
.updateRuleRadioContent {
39+
display: flex;
40+
align-items: center;
41+
i {
42+
margin-left: 4px;
43+
color: var(--color-text-tertiary);
44+
font-size: 12px;
45+
}
46+
}
47+
}
48+
}
49+
.brief {
50+
display: flex;
51+
flex-direction: column;
52+
align-items: center;
1453

1554
.env,
1655
.version {
@@ -28,4 +67,4 @@
2867
}
2968
}
3069
}
31-
}
70+
}
Lines changed: 121 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,129 @@
1+
import React, { useEffect, useMemo } from 'react';
2+
import styles from './index.less';
3+
// import i18n from '@/i18n';
14
import BrandLogo from '@/components/BrandLogo';
2-
import { APP_NAME, GITHUB_URL } from '@/constants/appConfig';
5+
import { APP_NAME, WEBSITE_DOC } from '@/constants/appConfig';
6+
// import { formatDate, getUserTimezoneTimestamp } from '@/utils/date';
7+
import { Button, Radio, Space } from 'antd';
8+
import configService from '@/service/config';
9+
import { DownloadOutlined,RedoOutlined } from '@ant-design/icons';
10+
import { IUpdateDetectionData } from '../index';
11+
import { IUpdateDetectionRef, UpdatedStatusEnum } from '../UpdateDetection';
312
import i18n from '@/i18n';
4-
import React from 'react';
5-
import styles from './index.less';
6-
import { formatDate, getUserTimezoneTimestamp } from '@/utils/date';
13+
14+
interface IProps {
15+
updateDetectionData: IUpdateDetectionData | null;
16+
updateDetectionRef: React.MutableRefObject<IUpdateDetectionRef> | null;
17+
}
718

819
// 关于我们
9-
export default function AboutUs() {
20+
export default function AboutUs(props: IProps) {
21+
const { updateDetectionData, updateDetectionRef } = props;
22+
const [updateRule, setUpdateRule] = React.useState<'manual' | 'auto'>(updateDetectionData?.type || 'manual');
23+
24+
const onChangeUpdateRul = (e) => {
25+
configService.setAppUpdateType(e.target.value).then(() => {
26+
setUpdateRule(e.target.value);
27+
});
28+
};
29+
30+
useEffect(()=>{
31+
setUpdateRule(updateDetectionData?.type || 'manual');
32+
},[updateDetectionData?.type])
33+
34+
const jumpDoc = () => {
35+
window.open(WEBSITE_DOC, '_blank');
36+
};
37+
38+
const updateButton = useMemo(() => {
39+
if (!updateDetectionData?.needUpdate) {
40+
return false;
41+
}
42+
switch (updateDetectionData?.updatedStatusEnum) {
43+
case UpdatedStatusEnum.NOT_UPDATED:
44+
return (
45+
<Button
46+
onClick={() => {
47+
updateDetectionRef?.current?.openDownload();
48+
}}
49+
icon={<DownloadOutlined />}
50+
type="primary"
51+
>
52+
{i18n('setting.button.startDownloading')}
53+
</Button>
54+
);
55+
case UpdatedStatusEnum.UPDATING:
56+
return (
57+
<Button type="primary" loading>
58+
{i18n('setting.button.beDownloading')}
59+
</Button>
60+
);
61+
// 超时后端如何处理 TODO:
62+
case UpdatedStatusEnum.TIMEOUT:
63+
return (
64+
<Button
65+
onClick={() => {
66+
updateDetectionRef?.current?.openDownload();
67+
}}
68+
icon={<DownloadOutlined />}
69+
type="primary"
70+
loading
71+
>
72+
{i18n('setting.button.redownload')}
73+
</Button>
74+
);
75+
// case UpdatedStatusEnum.UPDATED:
76+
// return (
77+
// <Button icon={<RedoOutlined />} type="primary">
78+
// {i18n('setting.button.restart')}
79+
// </Button>
80+
// );
81+
default:
82+
return false;
83+
}
84+
}, [updateDetectionData]);
85+
1086
return (
1187
<div className={styles.aboutUs}>
12-
<BrandLogo size={60} className={styles.brandLogo} />
13-
<div className={styles.brief}>
88+
<div className={styles.versionsInfo}>
89+
<BrandLogo size={98} className={styles.brandLogo} />
90+
<div>
91+
<div className={styles.currentVersion}>
92+
<span className={styles.appName}>{APP_NAME}</span>
93+
<span>{__APP_VERSION__}</span>
94+
</div>
95+
<div className={styles.newVersion}>
96+
{updateDetectionData?.needUpdate ? (
97+
UpdatedStatusEnum.UPDATED === updateDetectionData?.updatedStatusEnum ?
98+
<span>{i18n('setting.text.RestartingInstall')}</span>
99+
:
100+
<span>{i18n('setting.text.discoverNewVersion', updateDetectionData?.version)}</span>
101+
) : (
102+
<span>{i18n('setting.text.isLatestVersion')}</span>
103+
)}
104+
</div>
105+
{updateDetectionData?.desktop && (
106+
<div className={styles.updateButton}>
107+
{updateButton}
108+
<Button onClick={jumpDoc}>{i18n('setting.button.changeLog')}</Button>
109+
</div>
110+
)}
111+
</div>
112+
</div>
113+
<div className={styles.updateRule}>
114+
<div className={styles.updateRuleTitle}>{i18n('setting.title.updateRule')}</div>
115+
<Radio.Group className={styles.updateRuleGroup} onChange={onChangeUpdateRul} value={updateRule}>
116+
<Space direction="vertical">
117+
<Radio className={styles.updateRuleRadio} value="auto">
118+
{i18n('setting.text.autoUpdate')}
119+
</Radio>
120+
<Radio className={styles.updateRuleRadio} value="manual">
121+
{i18n('setting.text.manualUpdate')}
122+
</Radio>
123+
</Space>
124+
</Radio.Group>
125+
</div>
126+
{/* <div className={styles.brief}>
14127
<div className={styles.appName}>{APP_NAME}</div>
15128
<div className={styles.env}>
16129
{i18n('setting.text.currentEnv')}:{__ENV__}
@@ -22,7 +135,7 @@ export default function AboutUs() {
22135
<a target="blank" href={GITHUB_URL} className={styles.log}>
23136
{i18n('setting.text.viewingUpdateLogs')}
24137
</a>
25-
</div>
138+
</div> */}
26139
</div>
27140
);
28141
}

0 commit comments

Comments
 (0)