Browse Source

Merge pull request #3984 in DEC/decision-webui-dcm from release/11.0 to final/11.0

* commit 'fe3b4370b73e700aff8a75b569dc64f3ab349876':
  DEC-21782 feat: 适配dremio数据源
  DEC-21809 fix: 【迭代】【连接池配置优化】最大空闲连接数未删除
  DEC-21782 feat: 适配dremio数据源
  DEC-21498 fix: 【FR配合】连接池配置优化
final/11.0
superman 3 years ago
parent
commit
9093ac8099
  1. 11
      src/modules/constants/constant.ts
  2. 385
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  3. 1735
      src/modules/pages/maintain/forms/components/form.jdbc.ts

11
src/modules/constants/constant.ts

@ -583,6 +583,17 @@ export const DATA_BASE_TYPES = [
type: 'jdbc', type: 'jdbc',
hasSchema: true, hasSchema: true,
kerberos: true, kerberos: true,
}, {
text: 'dremio',
databaseType: 'dremio',
driver: 'com.dremio.jdbc.Driver',
drivers: ['com.dremio.jdbc.Driver'],
url: 'jdbc:dremio:direct=hostname:31010',
commonly: false,
internal: true,
type: 'jdbc',
hasSchema: true,
kerberos: false,
}, { }, {
text: 'Presto', text: 'Presto',
databaseType: 'presto', databaseType: 'presto',

385
src/modules/pages/connection/connection_jdbc/connection_jdbc.ts

@ -1,195 +1,190 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { FormItem } from '../components/form_item/form_item'; import { FormItem } from '../components/form_item/form_item';
import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse';
import { ConnectionJdecModel } from './connection_jdbc.model'; import { ConnectionJdecModel } from './connection_jdbc.model';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service';
import { CONNECTION_LAYOUT } from '@constants/constant'; import { CONNECTION_LAYOUT } from '@constants/constant';
import { VerticalLayout } from '@fui/core'; import { VerticalLayout } from '@fui/core';
import { ApiFactory } from '../../../crud/apiFactory'; import { ApiFactory } from '../../../crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@shortcut() @shortcut()
@store(ConnectionJdecModel) @store(ConnectionJdecModel)
export class ConnectionJdbc extends BI.Widget { export class ConnectionJdbc extends BI.Widget {
static xtype = 'dec.dcm.connection_jdbc'; static xtype = 'dec.dcm.connection_jdbc';
advancedSet: any; advancedSet: any;
model: ConnectionJdecModel['model']; model: ConnectionJdecModel['model'];
allDatabaseTypes = getAllDatabaseTypes(); allDatabaseTypes = getAllDatabaseTypes();
render() { render() {
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC;
const { const {
driver, driver,
driverSource, driverSource,
database, database,
user, user,
originalCharsetName, originalCharsetName,
schema, schema,
connectionPoolAttr, connectionPoolAttr,
authType, authType,
principal, principal,
url, url,
fetchSize, fetchSize,
} = connectionData; } = connectionData;
const databaseType = getJdbcDatabaseType(database, driver); const databaseType = getJdbcDatabaseType(database, driver);
const { host, port, databaseName } = resolveUrlInfo(url, database); const { host, port, databaseName } = resolveUrlInfo(url, database);
const { hgap, vgap } = CONNECTION_LAYOUT; const { hgap, vgap } = CONNECTION_LAYOUT;
return { return {
type: BI.VerticalLayout.xtype, type: BI.VerticalLayout.xtype,
hgap, hgap,
vgap, vgap,
items: [ items: [
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'),
value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
value: databaseName, value: databaseName,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), name: BI.i18nText('Dec-Dcm_Connection_Form_Host'),
value: host, value: host,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
value: port, value: port,
}, },
authType ? authType ?
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'),
value: authType, value: authType,
} : { } : {
type: BI.Layout.xtype, type: BI.Layout.xtype,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
value: authType ? principal : user, value: authType ? principal : user,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'),
value: '******', value: '******',
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Default'), value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Default'),
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'),
value: schema, value: schema,
invisible: !databaseType.hasSchema, invisible: !databaseType.hasSchema,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'),
value: url, value: url,
}, },
{ {
type: Collapse.xtype, type: FormItem.xtype,
width: 70, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), value: connectionPoolAttr.maxActive,
listeners: [ },
{ {
eventName: EVENT_CHANGE, type: FormItem.xtype,
action: (isCollapse: boolean) => { name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'),
this.advancedSet.setVisible(!isCollapse); value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
}, {
], type: FormItem.xtype,
}, name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
{ value: api.getPlain(connectionPoolAttr.validationQuery || ''),
type: BI.VerticalLayout.xtype, },
tgap: -15, {
vgap, type: FormItem.xtype,
invisible: true, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
ref: (_ref: VerticalLayout) => { value: connectionPoolAttr.maxWait,
this.advancedSet = _ref; unit: BI.i18nText('Dec-Dcm_Millisecond'),
}, },
items: [ {
{ type: Collapse.xtype,
type: FormItem.xtype, width: 70,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'),
value: connectionPoolAttr.initialSize, listeners: [
}, {
{ eventName: EVENT_CHANGE,
type: FormItem.xtype, action: (isCollapse: boolean) => {
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), this.advancedSet.setVisible(!isCollapse);
value: connectionPoolAttr.maxActive, },
}, },
{ ],
type: FormItem.xtype, },
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), {
value: connectionPoolAttr.maxIdle, type: BI.VerticalLayout.xtype,
}, tgap: -15,
{ vgap,
type: FormItem.xtype, invisible: true,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), ref: (_ref: VerticalLayout) => {
value: connectionPoolAttr.minIdle, this.advancedSet = _ref;
}, },
{ items: [
type: FormItem.xtype, {
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), type: FormItem.xtype,
value: connectionPoolAttr.maxWait, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
unit: BI.i18nText('Dec-Dcm_Millisecond'), value: connectionPoolAttr.initialSize,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
value: api.getPlain(connectionPoolAttr.validationQuery || ''), value: connectionPoolAttr.minIdle,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.timeBetweenEvictionRunsMillis,
}, unit: BI.i18nText('Dec-Dcm_Millisecond'),
{ },
type: FormItem.xtype, {
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), type: FormItem.xtype,
value: connectionPoolAttr.timeBetweenEvictionRunsMillis, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
unit: BI.i18nText('Dec-Dcm_Millisecond'), value: connectionPoolAttr.numTestsPerEvictionRun,
}, },
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
value: connectionPoolAttr.numTestsPerEvictionRun, value: connectionPoolAttr.minEvictableIdleTimeMillis,
}, unit: BI.i18nText('BI-Basic_Seconds'),
{ }, {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), invisible: fetchSize < 0 && fetchSize !== -2,
value: connectionPoolAttr.minEvictableIdleTimeMillis, name: 'Fetchsize',
unit: BI.i18nText('BI-Basic_Seconds'), value: fetchSize === -2 ? '' : fetchSize,
}, { },
type: FormItem.xtype, ],
invisible: fetchSize < 0 && fetchSize !== -2, },
name: 'Fetchsize', ],
value: fetchSize === -2 ? '' : fetchSize, };
}, }
], }
},
],
};
}
}

1735
src/modules/pages/maintain/forms/components/form.jdbc.ts

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save