Browse Source

Pull request #889: 无jira任务, feature/10.0 合 research/10.0

Merge in DEC/decision-webui-dcm from feature/10.0 to research/10.0

* commit 'a6ef52da9ecd478ec11f38f1a6d67dfc03a15f11':
  DEC-15854 fix: 【数据连接】新建其他JDBC类型数据连接,默认驱动只有一个
research/10.0
Frank.Qiu 4 years ago
parent
commit
5d0e897413
  1. 1
      src/modules/__test__/app.test.ts
  2. 5
      src/modules/app.service.ts

1
src/modules/__test__/app.test.ts

@ -19,6 +19,7 @@ test('DEC-11030 拼接url', () => {
*/
test('BI-56355 如果数据库类型和驱动都为空,则为其他jdbc', () => {
expect(getJdbcDatabaseType('', '').databaseType).toEqual('otherJDBC');
expect(getJdbcDatabaseType('otherJDBC', 'org.h2.Driver').databaseType).toEqual('otherJDBC');
expect(getJdbcDatabaseType('mysql', '').databaseType).toEqual('mysql');
expect(getJdbcDatabaseType('', 'com.mysql.jdbc.Driver').databaseType).toEqual('mysql');
});

5
src/modules/app.service.ts

@ -1,4 +1,4 @@
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE } from '@constants/constant';
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant';
import { CONSTANT_PLUGIN_TYPES } from './app.constant';
import { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings';
@ -32,7 +32,8 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
}
let databaseType = null;
// 从全部数据库类型中获取jdbc类型的
const jdbcDatabases = getAllDatabaseTypes().filter(v => v.type === 'jdbc');
// 兼容之前的逻辑,otherJdbc要单独处理一下
const jdbcDatabases = getAllDatabaseTypes().filter(v => v.type === 'jdbc' || v.type === OTHER_JDBC);
// KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driver来判断数据类型
if (database && database !== 'other' && jdbcDatabases.some(item => item.databaseType === database)) {
databaseType = jdbcDatabases.find(item => item.databaseType === database);

Loading…
Cancel
Save