Browse Source

Pull request #7800: REPORT-96835 数据连接JDBC_URL解析错误

Merge in DEC/decision-webui-dcm from ~CRAWFORD.ZHOU/decision-webui-dcm:release/11.0 to release/11.0

* commit '4dd665d539daeb5abd5cfd8c0c3cd58d721fbcd7':
  REPORT-96835 数据连接JDBC_URL解析错误 fix:解析出正确的database
  REPORT-94752【视觉验收】数据连接 fix:修复视觉问题
release/11.0
Crawford.Zhou-周旭 1 year ago
parent
commit
93c2b80dca
  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 () {
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),
});
});

4
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',

Loading…
Cancel
Save