diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index af2db61..d36a9f8 100644 --- a/src/modules/app.provider.ts +++ b/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); }; diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 5bb3778..4becb61 100644 --- a/src/modules/constants/constant.ts +++ b/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', diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index f8d175c..90f5ba1 100644 --- a/src/modules/pages/connection/connection.ts +++ b/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: [ { diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts index 384e4f4..382f439 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts +++ b/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})`; diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index ef6c351..896c157 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/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, }; } diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index cb3b573..5cc3b2a 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/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; }