|
|
@ -1,5 +1,5 @@ |
|
|
|
import { shortcut } from '@core/core'; |
|
|
|
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 { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; |
|
|
|
import { FormItemXtype } from '../../components/form_item/form_item'; |
|
|
|
import { FormItemXtype } from '../../components/form_item/form_item'; |
|
|
|
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; |
|
|
|
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; |
|
|
@ -70,7 +70,6 @@ export class FormJdbc extends BI.Widget { |
|
|
|
forms: [{ |
|
|
|
forms: [{ |
|
|
|
type: TextEditor, |
|
|
|
type: TextEditor, |
|
|
|
width: 300, |
|
|
|
width: 300, |
|
|
|
allowBlank: true, |
|
|
|
|
|
|
|
value: connectionName, |
|
|
|
value: connectionName, |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.connectionName = _ref; |
|
|
|
this.form.connectionName = _ref; |
|
|
@ -82,13 +81,27 @@ export class FormJdbc extends BI.Widget { |
|
|
|
type: FormItemXtype, |
|
|
|
type: FormItemXtype, |
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), |
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), |
|
|
|
forms: [{ |
|
|
|
forms: [{ |
|
|
|
type: TextValueCombo, |
|
|
|
type: SingleSelectInsertCombo, |
|
|
|
width: 300, |
|
|
|
width: 300, |
|
|
|
value: driver, |
|
|
|
value: driver, |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.driver = _ref; |
|
|
|
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, |
|
|
|
width: 300, |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: initialSize, |
|
|
|
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'), |
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.initialSize = _ref; |
|
|
|
this.form.initialSize = _ref; |
|
|
@ -342,6 +357,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: maxActive, |
|
|
|
value: maxActive, |
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), |
|
|
|
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) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.maxActive = _ref; |
|
|
|
this.form.maxActive = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -356,6 +373,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: maxIdle, |
|
|
|
value: maxIdle, |
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), |
|
|
|
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) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.maxIdle = _ref; |
|
|
|
this.form.maxIdle = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -371,6 +390,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: maxWait, |
|
|
|
value: maxWait, |
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
|
|
|
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) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.maxWait = _ref; |
|
|
|
this.form.maxWait = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -453,6 +474,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: timeBetweenEvictionRunsMillis, |
|
|
|
value: timeBetweenEvictionRunsMillis, |
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), |
|
|
|
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) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.timeBetweenEvictionRunsMillis = _ref; |
|
|
|
this.form.timeBetweenEvictionRunsMillis = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -473,6 +496,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: numTestsPerEvictionRun, |
|
|
|
value: numTestsPerEvictionRun, |
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), |
|
|
|
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) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.numTestsPerEvictionRun = _ref; |
|
|
|
this.form.numTestsPerEvictionRun = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -488,6 +513,8 @@ export class FormJdbc extends BI.Widget { |
|
|
|
allowBlank: true, |
|
|
|
allowBlank: true, |
|
|
|
value: minEvictableIdleTimeMillis, |
|
|
|
value: minEvictableIdleTimeMillis, |
|
|
|
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'), |
|
|
|
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.minEvictableIdleTimeMillis = _ref; |
|
|
|
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() { |
|
|
|
private getDrivers() { |
|
|
|
const connectionData = this.options.formData.connectionData as ConnectionJDBC; |
|
|
|
const connectionData = this.options.formData.connectionData as ConnectionJDBC; |
|
|
|
const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); |
|
|
|
const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); |
|
|
|