Skip to content

Commit 88fd4d8

Browse files
committed
fix:connection save bug
1 parent 92ae27d commit 88fd4d8

3 files changed

Lines changed: 34 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
`2023-12-13`
44

5-
**更新日志**
5+
**Changelog**
66

7-
- 🐞【修复】切换Tabs时,表空白问题
8-
- 🐞【修复】DM、Oracle无法显示Schema问题
9-
- 🐞【修复】导入链接丢失问题
7+
- 🐞【Fixed】Table blank problem when switching Tabs
8+
- 🐞【Fixed】DM or Oracle cannot display Schema
9+
- 🐞【Fixed】The import connection is lost. Procedure
1010

1111
## 3.1.0
1212

chat2db-client/src/components/ConnectionEdit/index.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import LoadingGracile from '@/components/Loading/LoadingGracile';
1515
import Driver from './components/Driver';
1616

1717
// ----- store -----
18-
import { useConnectionStore } from '@/pages/main/store/connection';
18+
import { useConnectionStore, getConnectionList } from '@/pages/main/store/connection';
1919

2020
const { Option } = Select;
2121

@@ -30,7 +30,6 @@ export enum submitType {
3030
interface IProps {
3131
closeCreateConnection: () => void;
3232
connectionData: IConnectionDetails;
33-
submitCallback?: any;
3433
submit?: (data: IConnectionDetails) => Promise<any>;
3534
}
3635

@@ -39,7 +38,7 @@ export interface ICreateConnectionFunction {
3938
}
4039

4140
const ConnectionEdit = forwardRef((props: IProps, ref: ForwardedRef<ICreateConnectionFunction>) => {
42-
const { closeCreateConnection, submitCallback, connectionData, submit } = props;
41+
const { closeCreateConnection, connectionData, submit } = props;
4342
const [baseInfoForm] = Form.useForm();
4443
const [sshForm] = Form.useForm();
4544
const [driveData, setDriveData] = useState<any>({});
@@ -200,7 +199,6 @@ const ConnectionEdit = forwardRef((props: IProps, ref: ForwardedRef<ICreateConne
200199
}
201200

202201
const api: any = connectionService[type](p);
203-
204202
api
205203
.then((res: any) => {
206204
if (type === submitType.TEST) {
@@ -216,13 +214,13 @@ const ConnectionEdit = forwardRef((props: IProps, ref: ForwardedRef<ICreateConne
216214
: i18n('common.message.addedSuccessfully'),
217215
);
218216

219-
setBackfillData({
220-
...backfillData,
221-
id: res,
222-
});
223-
217+
getConnectionList();
218+
224219
if (type === submitType.SAVE) {
225-
submitCallback?.();
220+
setBackfillData({
221+
...backfillData,
222+
id: res,
223+
});
226224
}
227225
}
228226
})

chat2db-client/src/utils/index.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,17 +227,30 @@ export function getCookie(name: string) {
227227
return null;
228228
}
229229

230-
// 注释出参的含义
230+
// 判断两个版本的大小
231231
export function compareVersion(version1: string, version2: string) {
232-
const version1Arr = version1.split('.');
233-
const version2Arr = version2.split('.');
234-
const v1 = Number(version1Arr.join(''));
235-
const v2 = Number(version2Arr.join(''));
236-
if (v1 > v2) {
237-
return 1;
238-
} else if (v1 < v2) {
239-
return -1;
232+
const v1 = version1.split('.');
233+
const v2 = version2.split('.');
234+
const len = Math.max(v1.length, v2.length);
235+
236+
while (v1.length < len) {
237+
v1.push('0');
240238
}
239+
while (v2.length < len) {
240+
v2.push('0');
241+
}
242+
243+
for (let i = 0; i < len; i++) {
244+
const num1 = parseInt(v1[i]);
245+
const num2 = parseInt(v2[i]);
246+
247+
if (num1 > num2) {
248+
return 1;
249+
} else if (num1 < num2) {
250+
return -1;
251+
}
252+
}
253+
241254
return 0;
242255
}
243256

0 commit comments

Comments
 (0)