Browse Source

Merge pull request #3660 in DEC/decision-webui-dcm from release/11.0 to final/11.0

* commit 'd6baceaab09f3372fa10a6765d37ca4735ca770c':
  DEC-21535 fix: 【迭代】【达梦数据库适配】数据库输入URL,对应参数不回填
  DEC-21444 feat: 【BI配合】达梦数据库适配
  DEC-21444 feat: 【BI配合】达梦数据库适配
  DEC-21469 fix: 【迭代】【驱动管理v1.1】两个驱动类相同的自定义驱动,新建数据连接保存后会默认显示最新的那个
  BI-95685 fix: 平台复制链接时需要重建 identity
  Revert "DEC-20201 feat: 【迭代】【驱动管理】屏蔽驱动管理入口以及相关功能"
  DEC-20979 feat: 【BI配合】适配doris数据库
final/11.0
superman 3 years ago
parent
commit
40235f248d
  1. 14
      src/modules/app.provider.ts
  2. 22
      src/modules/constants/constant.ts
  3. 2
      src/modules/pages/connection/connection.ts
  4. 3
      src/modules/pages/maintain/components/driverselector/driverselector.model.ts
  5. 19
      src/modules/pages/maintain/components/driverselector/driverselector.ts
  6. 9
      src/modules/pages/maintain/forms/form.ts

14
src/modules/app.provider.ts

@ -15,7 +15,7 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: oracleUlr[10],
};
}
const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;)([^]+)(.*)/i);
if (greenplumUrl) {
return {
@ -25,7 +25,7 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: greenplumUrl[9],
};
}
const result = url.match(/^jdbc:(mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)?(.*)/i);
const result = url.match(/^jdbc:(mysql|sqlserver|db2|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)?(.*)/i);
if (result) {
return {
host: result[5],
@ -34,13 +34,13 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: result[10],
};
}
// 处理oracle的RAC方式
if (/^jdbc:oracle:thin:([0-9a-zA-Z/]*)?@\(DESCRIPTION/i.test(url)) {
const host = url.match(/\(HOST\s*=\s*([0-9a-zA-Z_\\.-]+)\)/i);
const port = url.match(/\(PORT\s*=\s*([0-9]+)\)/i);
const databaseName = url.match(/\(SERVICE_NAME\s*=\s*([\s0-9a-zA-Z_\\.]+)\)/i);
return {
host: host ? host[1] : '',
port: port && port[1] !== 'port' ? port[1] : '',
@ -48,7 +48,7 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: '',
};
}
return {
host: '',
port: '',
@ -60,10 +60,10 @@ BI.provider('dec.connection.provider.datebase', function() {
this.registerDatabaseType = (config: any) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config));
};
this.registerJdbcDatabase = (config: any, resolve?: Function) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' }));
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve);
};

22
src/modules/constants/constant.ts

@ -561,6 +561,28 @@ export const DATA_BASE_TYPES = [
type: 'jdbc',
hasSchema: false,
kerberos: false,
}, {
text: 'Doris',
databaseType: 'doris',
driver: 'com.mysql.jdbc.Driver',
drivers: ['com.mysql.jdbc.Driver'],
url: 'jdbc:mysql://hostname:port/database',
commonly: false,
internal: true,
type: 'jdbc',
hasSchema: false,
kerberos: false,
}, {
text: BI.i18nText('Dec-Dcm_Connection_Database_DM'),
databaseType: 'dm',
driver: 'dm.jdbc.driver.DmDriver',
drivers: ['dm.jdbc.driver.DmDriver'],
url: 'jdbc:dm://hostname:port',
commonly: false,
internal: true,
type: 'jdbc',
hasSchema: true,
kerberos: true,
}, {
text: 'Presto',
databaseType: 'presto',

2
src/modules/pages/connection/connection.ts

@ -79,7 +79,7 @@ export class Connection extends BI.Widget {
right: [
{
type: 'dec.connection.driver.entry',
invisible: true,
invisible: !BI.Services.getService('dec.service.global').isAdmin(),
from: '.dec-dcm',
listeners: [
{

3
src/modules/pages/maintain/components/driverselector/driverselector.model.ts

@ -67,7 +67,8 @@ export class DriverSelectorModel extends Model {
this.model.customDriver.driver = driver;
this.model.customDrivers.some(customDriver => {
if (customDriver.driverClass === driver) {
// DEC-21469 存在driver值相同但driver名不同的场景,因此要用拼接名判断
if (`${customDriver.driverClass} (${customDriver.name})` === value) {
this.model.driverSource = customDriver.name;
this.model.customDriver.value = `${driver} (${customDriver.name})`;

19
src/modules/pages/maintain/components/driverselector/driverselector.ts

@ -30,14 +30,18 @@ export class DriverSelector extends BI.Widget {
customDrivers: SearchTextValueCombo = null;
beforeRender(cb: Function) {
this.store.initDriverClassList(cb);
}
watch = {
driverClassItems: items => {
// this.customDrivers.populate(items);
// this.customDrivers.setValue(this.model.customDriver.value);
this.customDrivers.populate(items);
this.customDrivers.setValue(this.model.customDriver.value);
},
driverManageEntryVisible: b => {
this.driverManageEntry.setVisible(false);
this.driverManageEntry.setVisible(b);
},
};
@ -55,7 +59,6 @@ export class DriverSelector extends BI.Widget {
type: BI.TextValueCombo.xtype,
width: 86,
value: this.model.selectedDriverType,
invisible: true,
items: [
{
text: BI.i18nText('Dec-Basic_Default'),
@ -95,7 +98,7 @@ export class DriverSelector extends BI.Widget {
this.defaultDrivers = _ref;
},
invisible: this.model.driverSource !== '',
width: 300,
width: 204,
items: this.model.defaultDrivers,
value: this.model.defaultDriver.driver,
listeners: [
@ -116,7 +119,7 @@ export class DriverSelector extends BI.Widget {
ref: _ref => {
this.customDrivers = _ref;
},
invisible: true,
invisible: this.model.driverSource === '',
width: 204,
watermark: BI.i18nText('Dec-Please_Input'),
items: this.model.driverClassItems,
@ -146,7 +149,7 @@ export class DriverSelector extends BI.Widget {
text: BI.i18nText('Dec-Dcm_Create_New_Driver'),
},
from: '.dec-dcm',
invisible: true,
invisible: !this.model.driverManageEntryVisible,
listeners: [
{
eventName: 'EVENT_CLOSE',
@ -175,7 +178,7 @@ export class DriverSelector extends BI.Widget {
getValue() {
return {
// driverSource: this.model.driverSource,
driverSource: this.model.driverSource,
driver: this.model.driverSource === '' ? this.model.defaultDriver.driver : this.model.customDriver.driver,
};
}

9
src/modules/pages/maintain/forms/form.ts

@ -139,9 +139,12 @@ export class MaintainForm extends BI.Widget {
this.isEdit = true;
this.connectionName = this.model.connectionSelectedOne.connectionName;
const connection = BI.clone(this.model.connectionSelectedOne);
const { database, driver } = connection.connectionData as ConnectionJDBC;
(connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType;
connectionData = connection.connectionData as ConnectionJDBC;
const { database, driver } = connectionData;
connectionData.database = getJdbcDatabaseType(database, driver).databaseType;
if (this.model.isCopy) {
connectionData.identity = BI.UUID();
}
return connection;
}

Loading…
Cancel
Save