Browse Source

Merge pull request #7903 in DEC/decision-webui-dcm from final/11.0 to persist/11.0

* commit 'cf82354adaff06ab06446843522867ed40ecd1d7':
  REPORT-96835 数据连接JDBC_URL解析错误 fix:解析出正确的database
  REPORT-94752【视觉验收】数据连接 fix:修复视觉问题
persist/11.0
superman 1 year ago
parent
commit
848c71bc4f
  1. 41
      src/modules/app.provider.ts
  2. 4
      src/modules/pages/setting/setting.ts

41
src/modules/app.provider.ts

@ -4,9 +4,39 @@ import { DATA_BASE_TYPES } from '@constants/constant';
BI.provider('dec.connection.provider.datebase', function () { BI.provider('dec.connection.provider.datebase', function () {
this.resolves = {}; 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方法 // 原service中resolveUrlInfo方法
function jdbcResolve(url: string) { function jdbcResolve(url: string) {
if (BI.isNull(url)) return {}; 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); 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) { if (oracleUlr) {
return { return {
@ -60,7 +90,6 @@ BI.provider('dec.connection.provider.datebase', function () {
urlInfo: '', urlInfo: '',
}; };
} }
return { return {
host: '', host: '',
port: '', port: '',
@ -92,7 +121,6 @@ BI.provider('dec.connection.provider.datebase', function () {
...config, ...config,
type: 'jdbc', type: 'jdbc',
}; };
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve);
if (coverBaseDatabase(config)) return; if (coverBaseDatabase(config)) return;
@ -101,7 +129,14 @@ BI.provider('dec.connection.provider.datebase', function () {
}; };
this.$get = () => BI.inherit(BI.OB, { 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), customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES),
}); });
}); });

4
src/modules/pages/setting/setting.ts

@ -47,7 +47,7 @@ export class TimeOutSetting extends BI.Widget {
vgap: 10, vgap: 10,
items: [ items: [
{ {
el:{ el: {
type: 'bi.vertical_adapt', type: 'bi.vertical_adapt',
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
height: 40, height: 40,
@ -58,7 +58,7 @@ export class TimeOutSetting extends BI.Widget {
cls: 'dec-font-weight-bold', cls: 'dec-font-weight-bold',
text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'),
}] }]
}, tgap: -10, hgap: 16, }, tgap: -10, hgap: 16,
}, },
{ {
type: 'bi.vertical_adapt', type: 'bi.vertical_adapt',

Loading…
Cancel
Save