|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { shortcut } from '@core/core'; |
|
|
|
|
import { Vertical, TextEditor, TextValueCombo, Label, TextAreaEditor, Editor } from 'ui'; |
|
|
|
|
import { Vertical, TextEditor, TextValueCombo, Label, TextAreaEditor, Editor, SingleSelectInsertCombo } from 'ui'; |
|
|
|
|
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; |
|
|
|
|
import { FormItemXtype } from '../../components/form_item/form_item'; |
|
|
|
|
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; |
|
|
|
@ -70,7 +70,6 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
forms: [{ |
|
|
|
|
type: TextEditor, |
|
|
|
|
width: 300, |
|
|
|
|
allowBlank: true, |
|
|
|
|
value: connectionName, |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.connectionName = _ref; |
|
|
|
@ -82,13 +81,27 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
type: FormItemXtype, |
|
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), |
|
|
|
|
forms: [{ |
|
|
|
|
type: TextValueCombo, |
|
|
|
|
type: SingleSelectInsertCombo, |
|
|
|
|
width: 300, |
|
|
|
|
value: driver, |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.driver = _ref; |
|
|
|
|
}, |
|
|
|
|
items: this.getDrivers(), |
|
|
|
|
itemsCreator: (options: { |
|
|
|
|
keywords?: string[], |
|
|
|
|
selectedValues: string[], |
|
|
|
|
times: number, |
|
|
|
|
type: number, |
|
|
|
|
}, callback: Function) => { |
|
|
|
|
let drivers = this.getDrivers(); |
|
|
|
|
if (options.selectedValues.length > 0) { |
|
|
|
|
drivers = drivers.filter(item => item.text !== options.selectedValues[0]); |
|
|
|
|
} |
|
|
|
|
callback({ |
|
|
|
|
items: drivers, |
|
|
|
|
hasNext: false, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
@ -327,6 +340,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
width: 300, |
|
|
|
|
allowBlank: true, |
|
|
|
|
value: initialSize, |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.initialSize = _ref; |
|
|
|
@ -342,6 +357,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: maxActive, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.maxActive = _ref; |
|
|
|
|
}, |
|
|
|
@ -356,6 +373,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: maxIdle, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.maxIdle = _ref; |
|
|
|
|
}, |
|
|
|
@ -371,6 +390,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: maxWait, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.maxWait = _ref; |
|
|
|
|
}, |
|
|
|
@ -453,6 +474,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: timeBetweenEvictionRunsMillis, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), |
|
|
|
|
validationChecker: (value: string) => this.checkNumber(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.timeBetweenEvictionRunsMillis = _ref; |
|
|
|
|
}, |
|
|
|
@ -473,6 +496,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: numTestsPerEvictionRun, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.numTestsPerEvictionRun = _ref; |
|
|
|
|
}, |
|
|
|
@ -488,6 +513,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: minEvictableIdleTimeMillis, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.minEvictableIdleTimeMillis = _ref; |
|
|
|
|
}, |
|
|
|
@ -505,6 +532,14 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private checkInteger(value: string) { |
|
|
|
|
return /^[\d]+$/.test(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private checkNumber(value: string) { |
|
|
|
|
return /^[(\-|\+)?\d]+$/.test(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private getDrivers() { |
|
|
|
|
const connectionData = this.options.formData.connectionData as ConnectionJDBC; |
|
|
|
|
const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); |
|
|
|
|