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], urlInfo: oracleUlr[10],
}; };
} }
const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;)([^]+)(.*)/i); const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;)([^]+)(.*)/i);
if (greenplumUrl) { if (greenplumUrl) {
return { return {
@ -25,7 +25,7 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: greenplumUrl[9], 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) { if (result) {
return { return {
host: result[5], host: result[5],
@ -34,13 +34,13 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: result[10], urlInfo: result[10],
}; };
} }
// 处理oracle的RAC方式 // 处理oracle的RAC方式
if (/^jdbc:oracle:thin:([0-9a-zA-Z/]*)?@\(DESCRIPTION/i.test(url)) { 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 host = url.match(/\(HOST\s*=\s*([0-9a-zA-Z_\\.-]+)\)/i);
const port = url.match(/\(PORT\s*=\s*([0-9]+)\)/i); const port = url.match(/\(PORT\s*=\s*([0-9]+)\)/i);
const databaseName = url.match(/\(SERVICE_NAME\s*=\s*([\s0-9a-zA-Z_\\.]+)\)/i); const databaseName = url.match(/\(SERVICE_NAME\s*=\s*([\s0-9a-zA-Z_\\.]+)\)/i);
return { return {
host: host ? host[1] : '', host: host ? host[1] : '',
port: port && port[1] !== 'port' ? port[1] : '', port: port && port[1] !== 'port' ? port[1] : '',
@ -48,7 +48,7 @@ BI.provider('dec.connection.provider.datebase', function() {
urlInfo: '', urlInfo: '',
}; };
} }
return { return {
host: '', host: '',
port: '', port: '',
@ -60,10 +60,10 @@ BI.provider('dec.connection.provider.datebase', function() {
this.registerDatabaseType = (config: any) => { this.registerDatabaseType = (config: any) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config));
}; };
this.registerJdbcDatabase = (config: any, resolve?: Function) => { this.registerJdbcDatabase = (config: any, resolve?: Function) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' })); BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' }));
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); 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', type: 'jdbc',
hasSchema: false, hasSchema: false,
kerberos: 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', text: 'Presto',
databaseType: 'presto', databaseType: 'presto',

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

@ -79,7 +79,7 @@ export class Connection extends BI.Widget {
right: [ right: [
{ {
type: 'dec.connection.driver.entry', type: 'dec.connection.driver.entry',
invisible: true, invisible: !BI.Services.getService('dec.service.global').isAdmin(),
from: '.dec-dcm', from: '.dec-dcm',
listeners: [ 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.customDriver.driver = driver;
this.model.customDrivers.some(customDriver => { 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.driverSource = customDriver.name;
this.model.customDriver.value = `${driver} (${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; customDrivers: SearchTextValueCombo = null;
beforeRender(cb: Function) {
this.store.initDriverClassList(cb);
}
watch = { watch = {
driverClassItems: items => { driverClassItems: items => {
// this.customDrivers.populate(items); this.customDrivers.populate(items);
// this.customDrivers.setValue(this.model.customDriver.value); this.customDrivers.setValue(this.model.customDriver.value);
}, },
driverManageEntryVisible: b => { driverManageEntryVisible: b => {
this.driverManageEntry.setVisible(false); this.driverManageEntry.setVisible(b);
}, },
}; };
@ -55,7 +59,6 @@ export class DriverSelector extends BI.Widget {
type: BI.TextValueCombo.xtype, type: BI.TextValueCombo.xtype,
width: 86, width: 86,
value: this.model.selectedDriverType, value: this.model.selectedDriverType,
invisible: true,
items: [ items: [
{ {
text: BI.i18nText('Dec-Basic_Default'), text: BI.i18nText('Dec-Basic_Default'),
@ -95,7 +98,7 @@ export class DriverSelector extends BI.Widget {
this.defaultDrivers = _ref; this.defaultDrivers = _ref;
}, },
invisible: this.model.driverSource !== '', invisible: this.model.driverSource !== '',
width: 300, width: 204,
items: this.model.defaultDrivers, items: this.model.defaultDrivers,
value: this.model.defaultDriver.driver, value: this.model.defaultDriver.driver,
listeners: [ listeners: [
@ -116,7 +119,7 @@ export class DriverSelector extends BI.Widget {
ref: _ref => { ref: _ref => {
this.customDrivers = _ref; this.customDrivers = _ref;
}, },
invisible: true, invisible: this.model.driverSource === '',
width: 204, width: 204,
watermark: BI.i18nText('Dec-Please_Input'), watermark: BI.i18nText('Dec-Please_Input'),
items: this.model.driverClassItems, items: this.model.driverClassItems,
@ -146,7 +149,7 @@ export class DriverSelector extends BI.Widget {
text: BI.i18nText('Dec-Dcm_Create_New_Driver'), text: BI.i18nText('Dec-Dcm_Create_New_Driver'),
}, },
from: '.dec-dcm', from: '.dec-dcm',
invisible: true, invisible: !this.model.driverManageEntryVisible,
listeners: [ listeners: [
{ {
eventName: 'EVENT_CLOSE', eventName: 'EVENT_CLOSE',
@ -175,7 +178,7 @@ export class DriverSelector extends BI.Widget {
getValue() { getValue() {
return { return {
// driverSource: this.model.driverSource, driverSource: this.model.driverSource,
driver: this.model.driverSource === '' ? this.model.defaultDriver.driver : this.model.customDriver.driver, 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.isEdit = true;
this.connectionName = this.model.connectionSelectedOne.connectionName; this.connectionName = this.model.connectionSelectedOne.connectionName;
const connection = BI.clone(this.model.connectionSelectedOne); const connection = BI.clone(this.model.connectionSelectedOne);
const { database, driver } = connection.connectionData as ConnectionJDBC; connectionData = connection.connectionData as ConnectionJDBC;
(connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType; const { database, driver } = connectionData;
connectionData.database = getJdbcDatabaseType(database, driver).databaseType;
if (this.model.isCopy) {
connectionData.identity = BI.UUID();
}
return connection; return connection;
} }

Loading…
Cancel
Save