Browse Source

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

* commit '3b77884e1f6d477c0c4f19e0d2f2ddb641b78635':
  REPORT-111534 fix:数据连接脏数据容错
  无JIRA任务,修复打包问题
  REPORT-109671 feat:druid校验语句问题
  REPORT-110986 feat: 数据连接支持跳转至详情&联动
  REPORT-110986 feat: 数据连接支持跳转至详情&联动
  FDL-9101 fix: 修复saphana数据连接失败问题
  FDL-9101 fix: 修复saphana数据连接失败问题
  REPORT-107734 fix:【数据连接增加fetchsize配置项】tdsql数据连接特殊处理下
final/11.0
superman 11 months ago
parent
commit
9cdb4ce07a
  1. 14
      babel.config.js
  2. 8
      i18n/zh_cn.properties
  3. 1
      package.json
  4. 8
      private/i18n.ts
  5. 16
      src/modules/app.service.ts
  6. 4
      src/modules/app.typings.d.ts
  7. 10
      src/modules/constants/constant.ts
  8. 12
      src/modules/crud/crud.typings.d.ts
  9. 61
      src/modules/pages/connection/connection.ts
  10. 17
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  11. 29
      src/modules/pages/connection/list/list.model.ts
  12. 3
      src/modules/pages/connection/list/list_item/list_item.model.ts
  13. 131
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  14. 5
      src/modules/pages/maintain/forms/form.model.ts
  15. 2
      src/modules/pages/maintain/forms/form.ts

14
babel.config.js

@ -1,3 +1,13 @@
module.exports = function (api) { module.exports = api => {
return require("@fui/babel-preset-fineui").configs.base(api) const { plugins, presets, sourceType } = require("@fui/babel-preset-fineui").configs.base(api);
return {
compact: false,
presets,
sourceType,
plugins: [
...plugins,
"@babel/plugin-proposal-logical-assignment-operators",
],
};
}; };

8
i18n/zh_cn.properties

@ -85,10 +85,10 @@ Dec-Dcm_Connection_Form_Database_Max_Wait= 最大等待时间
Dec-Dcm_Connection_Form_Database_Validation_Query= SQL验证查询 Dec-Dcm_Connection_Form_Database_Validation_Query= SQL验证查询
Dec-Dcm_Connection_Form_Database_Test_On_Borrow= 获取连接前检验 Dec-Dcm_Connection_Form_Database_Test_On_Borrow= 获取连接前检验
Dec-Dcm_Connection_Form_Database_Test_On_Return= 归还连接前检验 Dec-Dcm_Connection_Form_Database_Test_On_Return= 归还连接前检验
Dec-Dcm_Connection_Form_Database_Test_While_Idle= 开启空闲回收器检 Dec-Dcm_Connection_Form_Database_Test_While_Idle= 获取连接时空闲连接可用性校
Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis= 空闲连接回收器休眠时间 Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis= 空闲连接回收器工作间隔
Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num= 空闲连接回收检查数 Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num= 空闲连接回收检查数
Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis= 保持空闲最小时间 Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis= 空闲连接回收时间阈
Dec-Dcm_Connection_Make_Sure_Delete= 确定删除该数据连接? Dec-Dcm_Connection_Make_Sure_Delete= 确定删除该数据连接?
Dec-Dcm_Connection_ReConnect= 重新连接 Dec-Dcm_Connection_ReConnect= 重新连接
Dec-Dcm_Connection_JNDI_Form_ConnectionName= JNDI的名字 Dec-Dcm_Connection_JNDI_Form_ConnectionName= JNDI的名字
@ -101,7 +101,7 @@ Dec-Dcm_Connection_JNDI= JNDI数据连接
Dec-Dcm_Connection_JNDI_Warning= 注意:需要把包含INTIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下 Dec-Dcm_Connection_JNDI_Warning= 注意:需要把包含INTIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下
Dec-Dcm_Connection_Error= 接口访问错误 Dec-Dcm_Connection_Error= 接口访问错误
Dec-Dcm_Connection_Is_Using= 该连接正在被{R1}编辑,请稍后再试 Dec-Dcm_Connection_Is_Using= 该连接正在被{R1}编辑,请稍后再试
Dec-Dcm_Connection_Check_Integer= 请输入不小于0的整数 Dec-Dcm_Connection_Check_Integer= 请输入不小于{}的整数
Dec-Dcm_Connection_Check_Number= 只允许为整数 Dec-Dcm_Connection_Check_Number= 只允许为整数
Dec-Dcm_Connection_JDBC_Other=其他JDBC Dec-Dcm_Connection_JDBC_Other=其他JDBC
Dec-Dcm_Connection_JDBC_Warning= 请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录 Dec-Dcm_Connection_JDBC_Warning= 请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录

1
package.json

@ -7,6 +7,7 @@
"author": "decision", "author": "decision",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
"@types/jss": "9.5.8", "@types/jss": "9.5.8",
"autoprefixer": "^9.6.1", "autoprefixer": "^9.6.1",
"es6-promise": "4.2.6", "es6-promise": "4.2.6",

8
private/i18n.ts

@ -84,10 +84,10 @@ export default {
'Dec-Dcm_Connection_Form_Database_Validation_Query': 'SQL验证查询', 'Dec-Dcm_Connection_Form_Database_Validation_Query': 'SQL验证查询',
'Dec-Dcm_Connection_Form_Database_Test_On_Borrow': '获取连接前检验', 'Dec-Dcm_Connection_Form_Database_Test_On_Borrow': '获取连接前检验',
'Dec-Dcm_Connection_Form_Database_Test_On_Return': '归还连接前检验', 'Dec-Dcm_Connection_Form_Database_Test_On_Return': '归还连接前检验',
'Dec-Dcm_Connection_Form_Database_Test_While_Idle': '开启空闲回收器检验', 'Dec-Dcm_Connection_Form_Database_Test_While_Idle': '获取连接时空闲连接可用性校验',
'Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis': '空闲连接回收器休眠时间', 'Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis': '空闲连接回收器工作间隔',
'Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num': '空闲连接回收检查数', 'Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num': '空闲连接回收检查数',
'Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis': '保持空闲最小时间值', 'Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis': '空闲连接回收时间阈值',
'Dec-Dcm_Connection_Make_Sure_Delete': '确定删除该数据连接?', 'Dec-Dcm_Connection_Make_Sure_Delete': '确定删除该数据连接?',
'Dec-Dcm_Connection_ReConnect': '重新连接', 'Dec-Dcm_Connection_ReConnect': '重新连接',
'Dec-Dcm_Connection_JNDI_Form_ConnectionName': 'JNDI的名字', 'Dec-Dcm_Connection_JNDI_Form_ConnectionName': 'JNDI的名字',
@ -100,7 +100,7 @@ export default {
'Dec-Dcm_Connection_JNDI_Warning': '注意:需要把包含INTIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下', 'Dec-Dcm_Connection_JNDI_Warning': '注意:需要把包含INTIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下',
'Dec-Dcm_Connection_Error': '接口访问错误', 'Dec-Dcm_Connection_Error': '接口访问错误',
'Dec-Dcm_Connection_Is_Using': '该连接正在被{R1}编辑,请稍后再试', 'Dec-Dcm_Connection_Is_Using': '该连接正在被{R1}编辑,请稍后再试',
'Dec-Dcm_Connection_Check_Integer': '请输入不小于0的整数', 'Dec-Dcm_Connection_Check_Integer': '请输入不小于{}的整数',
'Dec-Dcm_Connection_Check_Number': '只允许为整数', 'Dec-Dcm_Connection_Check_Number': '只允许为整数',
'Dec-Dcm_Connection_JDBC_Other': '其他JDBC', 'Dec-Dcm_Connection_JDBC_Other': '其他JDBC',
'Dec-Dcm_Connection_JDBC_Warning': '请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录', 'Dec-Dcm_Connection_JDBC_Warning': '请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录',

16
src/modules/app.service.ts

@ -1,4 +1,10 @@
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant'; import {
DATA_BASE_TYPES,
DATA_BASE_TYPES_OTHER,
DESIGN_DRIVER_TYPE,
OTHER_JDBC,
DATABASE_TYPE,
} from '@constants/constant';
import { DatabaseType } from './app.typings'; import { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings'; import { Connection } from './crud/crud.typings';
export function getAllDatabaseTypes(): DatabaseType[] { export function getAllDatabaseTypes(): DatabaseType[] {
@ -75,7 +81,7 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace(':INFORMIXSERVER={server}', ''); .replace(':INFORMIXSERVER={server}', '');
} }
if (databaseType === 'starrocks') { if (databaseType === DATABASE_TYPE.STAR_ROCKS) {
let databaseStr = ''; let databaseStr = '';
if (!catalog || !database) { if (!catalog || !database) {
databaseStr = catalog + database; databaseStr = catalog + database;
@ -86,6 +92,12 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace('default_catalog.database', databaseStr); .replace('default_catalog.database', databaseStr);
} }
if (databaseType === DATABASE_TYPE.SAP_HANA) {
return baseUrl.replace('hostname', host)
.replace('port', port || '')
.replace('=database', `=${database}`);
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('/database', `/${database}`) .replace('/database', `/${database}`)
.replace(':database', `:${database}`) .replace(':database', `:${database}`)

4
src/modules/app.typings.d.ts vendored

@ -11,6 +11,10 @@ export interface DatabaseType {
hasSchemas?: { hasSchemas?: {
[key: string]: boolean; [key: string]: boolean;
}; };
fetchSize: number;
versionConfig?: {
[key: string]: DatabaseType;
},
kerberos?: boolean; kerberos?: boolean;
iconUrl?: string; iconUrl?: string;
versions?: string[]; versions?: string[];

10
src/modules/constants/constant.ts

@ -5,6 +5,11 @@ export const PAGE_INDEX = {
POOL: 'pool', POOL: 'pool',
}; };
export const DATABASE_TYPE = {
SAP_HANA: "sap-hana",
STAR_ROCKS :'starrocks',
};
export const OTHER_JDBC = 'otherJDBC'; export const OTHER_JDBC = 'otherJDBC';
export const DEFAULT_HELP_LINK = 'databaseHelpLink'; export const DEFAULT_HELP_LINK = 'databaseHelpLink';
@ -609,7 +614,7 @@ export const DATA_BASE_TYPES = [
text: 'SAP HANA', text: 'SAP HANA',
databaseType: 'sap-hana', databaseType: 'sap-hana',
driver: 'com.sap.db.jdbc.Driver', driver: 'com.sap.db.jdbc.Driver',
url: 'jdbc:sap://hostname:port?reconnect=true', url: 'jdbc:sap://hostname:port?databaseName=database&reconnect=true',
commonly: false, commonly: false,
internal: true, internal: true,
type: 'jdbc', type: 'jdbc',
@ -829,11 +834,14 @@ export const DEFAULT_JDBC_POOL = {
minIdle: 0, minIdle: 0,
maxWait: 10000, maxWait: 10000,
testOnBorrow: true, testOnBorrow: true,
keepAlive: true,
testOnReturn: false, testOnReturn: false,
testWhileIdle: false, testWhileIdle: false,
timeBetweenEvictionRunsMillis: 60000, timeBetweenEvictionRunsMillis: 60000,
numTestsPerEvictionRun: 3, numTestsPerEvictionRun: 3,
minEvictableIdleTimeMillis: 1800, minEvictableIdleTimeMillis: 1800,
maxEvictableIdleTimeMillis: 25200,
keepAliveBetweenTimeMillis: 120000,
}; };
export const CONNECTION_LAYOUT = { export const CONNECTION_LAYOUT = {

12
src/modules/crud/crud.typings.d.ts vendored

@ -87,6 +87,10 @@ export interface ConnectionPoolJDBC {
*/ */
testOnBorrow?: boolean; testOnBorrow?: boolean;
/**
*
*/
keepAlive?: boolean;
/** /**
* *
*/ */
@ -108,6 +112,14 @@ export interface ConnectionPoolJDBC {
* *
*/ */
minEvictableIdleTimeMillis?: number; minEvictableIdleTimeMillis?: number;
/**
*
*/
maxEvictableIdleTimeMillis?: number;
/**
*
*/
keepAliveBetweenTimeMillis?: number;
} }
export type ConnectionJDBC = { export type ConnectionJDBC = {

61
src/modules/pages/connection/connection.ts

@ -24,24 +24,13 @@ export class Connection extends BI.Widget {
title: HTapeLayout; title: HTapeLayout;
watch = { watch = {
connectionSelected: (name: string) => { connectionSelected: {
if (name) { immediate: true,
const canEdit = connectionCanEdit(this.model.connectionSelectedOne); handler: (name: string) => {
const type = this.getSelectConnectionType(); BI.nextTick(() => {
this.connectionTitleWidget.setText(`${name}${getTextByDatabaseType(type)}`); name ? this.renderConnectionListView(name) : this.renderEmptyListView();
this.connectionEditWidget.setVisible(canEdit); });
const hasRegistered = this.hasRegistered(); },
this.title.setVisible(hasRegistered);
if (!hasRegistered) {
this.listView.populate(BI.createItems(this.renderNoRegistered()));
} else {
this.listView.populate(BI.createItems(this.renderItems()));
}
} else {
this.listView.populate(BI.createItems(this.renderEmpty()));
this.connectionTitleWidget.setText('');
this.connectionEditWidget.setVisible(false);
}
}, },
}; };
@ -50,8 +39,6 @@ export class Connection extends BI.Widget {
} }
render() { render() {
this.store.setConnectionSelected('');
return { return {
type: BI.HTapeLayout.xtype, type: BI.HTapeLayout.xtype,
hgap: 10, hgap: 10,
@ -214,12 +201,6 @@ export class Connection extends BI.Widget {
}]; }];
} }
private renderEmpty() {
return [{
type: BI.Layout.xtype,
}];
}
private hasRegistered() { private hasRegistered() {
const allDatabaseTypes = getAllDatabaseTypes(); const allDatabaseTypes = getAllDatabaseTypes();
switch (this.model.connectionSelectedOne.connectionType) { switch (this.model.connectionSelectedOne.connectionType) {
@ -246,4 +227,32 @@ export class Connection extends BI.Widget {
this.store.setPageIndex(PAGE_INDEX.MAINTAIN); this.store.setPageIndex(PAGE_INDEX.MAINTAIN);
this.store.setDatebaseTypeSelected(''); this.store.setDatebaseTypeSelected('');
} }
private renderConnectionListView(name: string) {
const canEdit = connectionCanEdit(this.model.connectionSelectedOne),
type = this.getSelectConnectionType(),
hasRegistered = this.hasRegistered();
this.connectionTitleWidget.setText(`${name}${getTextByDatabaseType(type)}`);
this.connectionEditWidget.setVisible(canEdit);
this.title.setVisible(hasRegistered);
hasRegistered
? this.listView.populate(BI.createItems(this.renderItems()))
: this.listView.populate(BI.createItems(this.renderNoRegistered()));
}
private renderEmptyListView() {
this.listView.populate(
BI.createItems([
{
type: BI.Layout.xtype,
}
])
);
this.connectionTitleWidget.setText('');
this.connectionEditWidget.setVisible(false);
}
} }

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

@ -197,6 +197,11 @@ export class ConnectionJdbc extends BI.Widget {
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'),
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
}, },
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'),
value: connectionPoolAttr.keepAlive ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'),
},
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
@ -374,6 +379,18 @@ export class ConnectionJdbc extends BI.Widget {
value: connectionPoolAttr.minEvictableIdleTimeMillis, value: connectionPoolAttr.minEvictableIdleTimeMillis,
unit: BI.i18nText('BI-Basic_Seconds'), unit: BI.i18nText('BI-Basic_Seconds'),
}, },
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'),
value: connectionPoolAttr.maxEvictableIdleTimeMillis,
unit: BI.i18nText('BI-Basic_Seconds'),
},
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'),
value: connectionPoolAttr.keepAliveBetweenTimeMillis,
unit: BI.i18nText('Dec-Dcm_Millisecond'),
},
{ {
type: FormItem.xtype, type: FormItem.xtype,
name: 'Fetchsize', name: 'Fetchsize',

29
src/modules/pages/connection/list/list.model.ts

@ -1,10 +1,11 @@
import { model, Model } from '@core/core'; import { model, Model } from '@core/core';
import { ApiFactory } from '../../..//crud/apiFactory'; import { ApiFactory } from '../../..//crud/apiFactory';
import { AppModel } from '../../../app.model'; import { AppModel } from '../../../app.model';
import type { ConnectionJDBC } from '../../../crud/crud.typings';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@model() @model()
export class ConnectionListModel extends Model<{ export class ConnectionListModel extends Model<{
types : { types: {
connections: AppModel['TYPE']['connections']; connections: AppModel['TYPE']['connections'];
connectionSelected: AppModel['TYPE']['connectionSelected']; connectionSelected: AppModel['TYPE']['connectionSelected'];
}, },
@ -19,22 +20,40 @@ export class ConnectionListModel extends Model<{
} }
actions = { actions = {
setConnections: ():Promise<void> => api.getConnectionList().then(data => { setConnections: (): Promise<void> => api.getConnectionList().then(data => {
data.data.push(...BI.Constants.getConstant('dec.constant.connection.list')); data.data.push(...BI.Constants.getConstant('dec.constant.connection.list'));
if (BI.size(data.data) > 0) { if (BI.size(data.data) > 0) {
this.model.connections = data.data; this.model.connections = data.data;
let defaultDatabaseName,
defaultDatabaseId = BI.Services.getService("dec.service.global")
.getHashSearchParams("databaseId");
this.model.connections.forEach(item => { this.model.connections.forEach(item => {
// REPORT-111534 有些环境存在脏数据,补下容错
if (BI.isNull(item.connectionData)) return;
// 后端传过来的是字符串,转为对象 // 后端传过来的是字符串,转为对象
BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string)); BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string));
// 目前只有jdbc存在identity,后期拓展
if ((item.connectionData as ConnectionJDBC).identity === defaultDatabaseId) {
defaultDatabaseName = item.connectionName;
}
}); });
this.model.connectionSelected = data.data[0].connectionName;
} else { // 仅首次进入时从url中读取参数,其他情况保留选中状态
this.model.connectionSelected = ''; defaultDatabaseName ||= data.data[0].connectionName;
this.setSelectedConnection(this.model.connectionSelected || defaultDatabaseName);
} }
return new Promise(resolve => { return new Promise(resolve => {
resolve(); resolve();
}); });
}), }),
setSelectedConnection(name: string) {
this.model.connectionSelected = name;
}
} }
} }

3
src/modules/pages/connection/list/list_item/list_item.model.ts

@ -139,8 +139,9 @@ export class ListItemModel extends Model<{
// 后端传过来的是字符串,转为对象 // 后端传过来的是字符串,转为对象
item.connectionData = JSON.parse(item.connectionData as string); item.connectionData = JSON.parse(item.connectionData as string);
}); });
if (name === this.model.connectionSelected) { if (name === this.model.connectionSelected) {
this.model.connectionSelected = BI.size(this.model.connections) > 0 ? this.model.connections[0].connectionName : ''; this.setConnectionSelected(this.model.connections?.[0]?.connectionName || '');
} }
api.shutdownConnectionStatus(name); api.shutdownConnectionStatus(name);
}); });

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

@ -86,12 +86,15 @@ export class FormJdbc extends BI.Widget {
// more // more
validationQuery: null, validationQuery: null,
testOnBorrow: null, testOnBorrow: null,
keepAlive: null,
testOnReturn: null, testOnReturn: null,
testWhileIdle: null, testWhileIdle: null,
timeBetweenEvictionRunsMillis: null, timeBetweenEvictionRunsMillis: null,
numTestsPerEvictionRun: null, numTestsPerEvictionRun: null,
minIdle: null, minIdle: null,
minEvictableIdleTimeMillis: null, minEvictableIdleTimeMillis: null,
maxEvictableIdleTimeMillis: null,
keepAliveBetweenTimeMillis: null,
fetchSize: null, fetchSize: null,
// 并行装载 // 并行装载
parallelLoad: { parallelLoad: {
@ -152,12 +155,15 @@ export class FormJdbc extends BI.Widget {
maxWait, maxWait,
validationQuery, validationQuery,
testOnBorrow, testOnBorrow,
keepAlive,
testOnReturn, testOnReturn,
testWhileIdle, testWhileIdle,
timeBetweenEvictionRunsMillis, timeBetweenEvictionRunsMillis,
numTestsPerEvictionRun, numTestsPerEvictionRun,
minIdle, minIdle,
minEvictableIdleTimeMillis, minEvictableIdleTimeMillis,
maxEvictableIdleTimeMillis,
keepAliveBetweenTimeMillis,
} = connectionPoolAttr as ConnectionPoolJDBC; } = connectionPoolAttr as ConnectionPoolJDBC;
const databaseType = getJdbcDatabaseType(database, driver); const databaseType = getJdbcDatabaseType(database, driver);
this.databaseType = databaseType; this.databaseType = databaseType;
@ -222,6 +228,7 @@ export class FormJdbc extends BI.Widget {
this.sslCollapse.setCollapse(true); this.sslCollapse.setCollapse(true);
this.sslCollapse.setVisible(this.getSslSetEnabled()); this.sslCollapse.setVisible(this.getSslSetEnabled());
!BI.isUndefined(databaseType.hasSchemas) && this.schemaForm.setVisible(databaseType.hasSchemas[version]); !BI.isUndefined(databaseType.hasSchemas) && this.schemaForm.setVisible(databaseType.hasSchemas[version]);
!BI.isUndefined(databaseType.versionConfig?.[version]?.fetchSize) && this.form.fetchSize.setValue(databaseType.versionConfig[version].fetchSize);
this.form.driver.setDefaultDrivers(version); this.form.driver.setDefaultDrivers(version);
}, },
}, },
@ -356,7 +363,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -894,7 +901,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -925,6 +932,25 @@ export class FormJdbc extends BI.Widget {
}, },
], ],
}, },
// 空闲连接可用性定期检查
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'),
forms: [
{
type: BI.TextValueCombo.xtype,
$value: 'keep-alive-check',
width: EDITOR_WIDTH,
allowBlank: true,
value: keepAlive,
items: this.getBooleanItem(),
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'),
ref: (_ref: TextValueCombo) => {
this.form.keepAlive = _ref;
},
},
],
},
// 校验语句 // 校验语句
{ {
type: FormItem.xtype, type: FormItem.xtype,
@ -959,7 +985,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -1068,7 +1094,7 @@ export class FormJdbc extends BI.Widget {
allowBlank: false, allowBlank: false,
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -1331,7 +1357,7 @@ export class FormJdbc extends BI.Widget {
value: initialSize, value: initialSize,
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -1357,7 +1383,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -1422,6 +1448,11 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkNumber(value), checker: (value: string) => this.checkNumber(value),
autoFix: true, autoFix: true,
}, },
{
errorText: BI.i18nText('Dec-Util-Must_Less_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold')),
checker: (value: string) => this.checkNumber(value) && (parseInt(value) < parseInt(this.form.keepAliveBetweenTimeMillis.getValue())),
autoFix: true,
},
valueRangeConfig, valueRangeConfig,
], ],
ref: (_ref: TextChecker) => { ref: (_ref: TextChecker) => {
@ -1449,7 +1480,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkInteger(value),
autoFix: true, autoFix: true,
}, },
@ -1474,8 +1505,13 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
validationChecker: [ validationChecker: [
{ {
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 30),
checker: (value: string) => this.checkInteger(value), checker: (value: string) => this.checkNumber(value) && (parseInt(value) >= 30),
autoFix: true,
},
{
errorText: BI.i18nText('Dec-Util-Must_Less_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis')),
checker: (value: string) => parseInt(value) < parseInt(this.form.maxEvictableIdleTimeMillis.getValue()),
autoFix: true, autoFix: true,
}, },
valueRangeConfig, valueRangeConfig,
@ -1492,6 +1528,80 @@ export class FormJdbc extends BI.Widget {
}, },
], ],
}, },
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'),
forms: [
{
type: TextChecker.xtype,
$value: 'max-evictable-idle-time-millis',
width: EDITOR_WIDTH,
allowBlank: false,
value: maxEvictableIdleTimeMillis,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
{
errorText: BI.i18nText('Dec-Util-Must_More_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis')),
checker: (value: string) => parseInt(value) > parseInt(this.form.minEvictableIdleTimeMillis.getValue()),
autoFix: true,
},
valueRangeConfig,
],
ref: (_ref: TextChecker) => {
this.form.maxEvictableIdleTimeMillis = _ref;
},
},
{
type: BI.Label.xtype,
lgap: 5,
height: CONNECTION_LAYOUT.labelHeight,
text: BI.i18nText('BI-Basic_Seconds'),
},
],
},
{
type: FormItem.xtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'),
forms: [
{
type: TextChecker.xtype,
$value: 'keep-live-between-time-millis',
width: EDITOR_WIDTH,
allowBlank: false,
value: keepAliveBetweenTimeMillis,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 30000),
checker: (value: string) => this.checkNumber(value) && (parseInt(value) > 30000),
autoFix: true,
},
{
errorText: BI.i18nText('Dec-Util-Must_More_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis')),
checker: (value: string) => this.checkNumber(value) && (parseInt(value) > parseInt(this.form.timeBetweenEvictionRunsMillis.getValue())),
autoFix: true,
},
valueRangeConfig,
],
ref: (_ref: TextChecker) => {
this.form.keepAliveBetweenTimeMillis = _ref;
},
},
{
type: BI.Label.xtype,
lgap: 5,
height: CONNECTION_LAYOUT.labelHeight,
text: BI.i18nText('Dec-Dcm_Millisecond'),
},
],
},
{ {
el: { el: {
type: BI.VerticalLayout.xtype, type: BI.VerticalLayout.xtype,
@ -1740,11 +1850,14 @@ export class FormJdbc extends BI.Widget {
maxWait: this.form.maxWait.getValue(), maxWait: this.form.maxWait.getValue(),
validationQuery: api.getCipher(this.form.validationQuery.getValue()), validationQuery: api.getCipher(this.form.validationQuery.getValue()),
testOnBorrow: BI.size(this.form.testOnBorrow.getValue()) > 0 ? this.form.testOnBorrow.getValue()[0] : connectionPoolAttr.testOnBorrow, testOnBorrow: BI.size(this.form.testOnBorrow.getValue()) > 0 ? this.form.testOnBorrow.getValue()[0] : connectionPoolAttr.testOnBorrow,
keepAlive: BI.size(this.form.keepAlive.getValue()) > 0 ? this.form.keepAlive.getValue()[0] : connectionPoolAttr.keepAlive,
testOnReturn: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testOnReturn.getValue()[0] : connectionPoolAttr.testOnReturn, testOnReturn: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testOnReturn.getValue()[0] : connectionPoolAttr.testOnReturn,
testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle, testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle,
timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(),
numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(),
minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(),
maxEvictableIdleTimeMillis: this.form.maxEvictableIdleTimeMillis.getValue(),
keepAliveBetweenTimeMillis: this.form.keepAliveBetweenTimeMillis.getValue(),
}, },
// 并行装载 // 并行装载
parallelLoad: { parallelLoad: {

5
src/modules/pages/maintain/forms/form.model.ts

@ -17,6 +17,7 @@ export class MaintainFormModel extends Model<{
pageIndex: AppModel['TYPE']['pageIndex']; pageIndex: AppModel['TYPE']['pageIndex'];
connections: AppModel['TYPE']['connections']; connections: AppModel['TYPE']['connections'];
isCopy: AppModel['TYPE']['isCopy']; isCopy: AppModel['TYPE']['isCopy'];
connectionSelected: AppModel['TYPE']['connectionSelected'];
}, },
context: MaintainFormModel['context']; context: MaintainFormModel['context'];
}> { }> {
@ -31,6 +32,7 @@ export class MaintainFormModel extends Model<{
'testEvent', 'testEvent',
'connections', 'connections',
'isCopy', 'isCopy',
'connectionSelected',
]; ];
actions = { actions = {
@ -51,5 +53,8 @@ export class MaintainFormModel extends Model<{
goFirstPage() { goFirstPage() {
this.model.pageIndex = PAGE_INDEX.CONNECTION; this.model.pageIndex = PAGE_INDEX.CONNECTION;
}, },
setConnectionSelected(name: string) {
this.model.connectionSelected = name;
}
} }
} }

2
src/modules/pages/maintain/forms/form.ts

@ -295,6 +295,8 @@ export class MaintainForm extends BI.Widget {
return; return;
} }
// 新增之后connections待更新,connectionSelected先置空
this.store.setConnectionSelected('');
this.store.goFirstPage(); this.store.goFirstPage();
this.store.setIsCopy(false); this.store.setIsCopy(false);
}); });

Loading…
Cancel
Save