diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 6ce5bce..846d138 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -4,9 +4,39 @@ import { DATA_BASE_TYPES } from '@constants/constant'; BI.provider('dec.connection.provider.datebase', function () { this.resolves = {}; + function starRocksResolve(url: string) { + // 处理starRocks数据连接常规模式 + const result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i); + if (result) { + return { + host: result[1], + port: result[2] === 'port' ? '' : result[2], + databaseName: result[4] || '', + urlInfo: result[0], + }; + } + // 处理starRocks数据连接负载均衡模式 + const loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i); + if (loadBalance){ + const database: string = loadBalance[2]; + return { + host: '', + port: '', + databaseName: database, + urlInfo: loadBalance[0], + } + } + return { + host: '', + port: '', + databaseName: '', + urlInfo: '', + }; + } // 原service中resolveUrlInfo方法 function jdbcResolve(url: string) { if (BI.isNull(url)) return {}; + const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/)([^]+)(.*)/i); if (oracleUlr) { return { @@ -60,7 +90,6 @@ BI.provider('dec.connection.provider.datebase', function () { urlInfo: '', }; } - return { host: '', port: '', @@ -92,7 +121,6 @@ BI.provider('dec.connection.provider.datebase', function () { ...config, type: 'jdbc', }; - BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); if (coverBaseDatabase(config)) return; @@ -101,7 +129,14 @@ BI.provider('dec.connection.provider.datebase', function () { }; this.$get = () => BI.inherit(BI.OB, { - getJdbcResolveByType: (type: string) => this.resolves[type] || jdbcResolve, + getJdbcResolveByType: (type: string) => { + // starRocks特殊处理 + // todo: 后面有专门的迭代系统处理,这里先临时解决下bug + if (type === "starrocks"){ + return starRocksResolve + } + return this.resolves[type] || jdbcResolve + }, customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES), }); }); diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts index d196730..d788cb5 100644 --- a/src/modules/pages/setting/setting.ts +++ b/src/modules/pages/setting/setting.ts @@ -47,7 +47,7 @@ export class TimeOutSetting extends BI.Widget { vgap: 10, items: [ { - el:{ + el: { type: 'bi.vertical_adapt', cls: 'bi-border-bottom', height: 40, @@ -58,7 +58,7 @@ export class TimeOutSetting extends BI.Widget { cls: 'dec-font-weight-bold', text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), }] - }, tgap: -10, hgap: 16, + }, tgap: -10, hgap: 16, }, { type: 'bi.vertical_adapt',