Browse Source

Pull request #8606: REPORT-109671 feat:druid校验语句问题

Merge in DEC/decision-webui-dcm from ~KEVIN.KING/decision-webui-dcm:feature/x to feature/x

* commit 'a26aafbd2369441aaa3947223dea5a495560732a':
  REPORT-109671 feat:druid校验语句问题
feature/x
Kevin.King-王凯壮 11 months ago committed by drew-倪梦威
parent
commit
1b00787f4b
  1. 8
      i18n/zh_cn.properties
  2. 8
      private/i18n.ts
  3. 3
      src/modules/constants/constant.ts
  4. 12
      src/modules/crud/crud.typings.d.ts
  5. 17
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  6. 130
      src/modules/pages/maintain/forms/components/form.jdbc.ts

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_Test_On_Borrow= 获取连接前检验
Dec-Dcm_Connection_Form_Database_Test_On_Return= 归还连接前检验
Dec-Dcm_Connection_Form_Database_Test_While_Idle= 开启空闲回收器检
Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis= 空闲连接回收器休眠时间
Dec-Dcm_Connection_Form_Database_Test_While_Idle= 获取连接时空闲连接可用性校
Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis= 空闲连接回收器工作间隔
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_ReConnect= 重新连接
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_Error= 接口访问错误
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_JDBC_Other=其他JDBC
Dec-Dcm_Connection_JDBC_Warning= 请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录

8
private/i18n.ts

@ -84,10 +84,10 @@ export default {
'Dec-Dcm_Connection_Form_Database_Validation_Query': 'SQL验证查询',
'Dec-Dcm_Connection_Form_Database_Test_On_Borrow': '获取连接前检验',
'Dec-Dcm_Connection_Form_Database_Test_On_Return': '归还连接前检验',
'Dec-Dcm_Connection_Form_Database_Test_While_Idle': '开启空闲回收器检验',
'Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis': '空闲连接回收器休眠时间',
'Dec-Dcm_Connection_Form_Database_Test_While_Idle': '获取连接时空闲连接可用性校验',
'Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis': '空闲连接回收器工作间隔',
'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_ReConnect': '重新连接',
'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_Error': '接口访问错误',
'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_JDBC_Other': '其他JDBC',
'Dec-Dcm_Connection_JDBC_Warning': '请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录',

3
src/modules/constants/constant.ts

@ -834,11 +834,14 @@ export const DEFAULT_JDBC_POOL = {
minIdle: 0,
maxWait: 10000,
testOnBorrow: true,
keepAlive: true,
testOnReturn: false,
testWhileIdle: false,
timeBetweenEvictionRunsMillis: 60000,
numTestsPerEvictionRun: 3,
minEvictableIdleTimeMillis: 1800,
maxEvictableIdleTimeMillis: 25200,
keepAliveBetweenTimeMillis: 120000,
};
export const CONNECTION_LAYOUT = {

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

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

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'),
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,
name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'),
@ -374,6 +379,18 @@ export class ConnectionJdbc extends BI.Widget {
value: connectionPoolAttr.minEvictableIdleTimeMillis,
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,
name: 'Fetchsize',

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

@ -86,12 +86,15 @@ export class FormJdbc extends BI.Widget {
// more
validationQuery: null,
testOnBorrow: null,
keepAlive: null,
testOnReturn: null,
testWhileIdle: null,
timeBetweenEvictionRunsMillis: null,
numTestsPerEvictionRun: null,
minIdle: null,
minEvictableIdleTimeMillis: null,
maxEvictableIdleTimeMillis: null,
keepAliveBetweenTimeMillis: null,
fetchSize: null,
// 并行装载
parallelLoad: {
@ -152,12 +155,15 @@ export class FormJdbc extends BI.Widget {
maxWait,
validationQuery,
testOnBorrow,
keepAlive,
testOnReturn,
testWhileIdle,
timeBetweenEvictionRunsMillis,
numTestsPerEvictionRun,
minIdle,
minEvictableIdleTimeMillis,
maxEvictableIdleTimeMillis,
keepAliveBetweenTimeMillis,
} = connectionPoolAttr as ConnectionPoolJDBC;
const databaseType = getJdbcDatabaseType(database, driver);
this.databaseType = databaseType;
@ -357,7 +363,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -895,7 +901,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -926,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,
@ -960,7 +985,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -1069,7 +1094,7 @@ export class FormJdbc extends BI.Widget {
allowBlank: false,
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -1332,7 +1357,7 @@ export class FormJdbc extends BI.Widget {
value: initialSize,
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -1358,7 +1383,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -1423,6 +1448,11 @@ export class FormJdbc extends BI.Widget {
checker: (value: string) => this.checkNumber(value),
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,
],
ref: (_ref: TextChecker) => {
@ -1450,7 +1480,7 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0),
checker: (value: string) => this.checkInteger(value),
autoFix: true,
},
@ -1475,8 +1505,13 @@ export class FormJdbc extends BI.Widget {
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
validationChecker: [
{
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'),
checker: (value: string) => this.checkInteger(value),
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 30),
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,
},
valueRangeConfig,
@ -1493,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: {
type: BI.VerticalLayout.xtype,
@ -1741,11 +1850,14 @@ export class FormJdbc extends BI.Widget {
maxWait: this.form.maxWait.getValue(),
validationQuery: api.getCipher(this.form.validationQuery.getValue()),
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,
testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle,
timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(),
numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(),
minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(),
maxEvictableIdleTimeMillis: this.form.maxEvictableIdleTimeMillis.getValue(),
keepAliveBetweenTimeMillis: this.form.keepAliveBetweenTimeMillis.getValue(),
},
// 并行装载
parallelLoad: {

Loading…
Cancel
Save