|
|
|
@ -38,7 +38,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
authType: null, |
|
|
|
|
principal: null, |
|
|
|
|
keyPath: null, |
|
|
|
|
newCharsetName: null, |
|
|
|
|
originalCharsetName: null, |
|
|
|
|
schema: null, |
|
|
|
|
url: null, |
|
|
|
|
initialSize: null, |
|
|
|
@ -51,14 +51,14 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
testWhileIdle: null, |
|
|
|
|
timeBetweenEvictionRunsMillis: null, |
|
|
|
|
numTestsPerEvictionRun: null, |
|
|
|
|
minIdle: null, |
|
|
|
|
minEvictableIdleTimeMillis: null, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const { connectionName, connectionData } = this.options.formData; |
|
|
|
|
const { driver, user, password, newCharsetName, schema, url, connectionPoolAttr, database, authType, principal, keyPath } = connectionData as ConnectionJDBC; |
|
|
|
|
// minIdle 暂未使用
|
|
|
|
|
const { initialSize, maxActive, maxIdle, maxWait, validationQuery, testOnBorrow, testOnReturn, testWhileIdle, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis } = connectionPoolAttr as ConnectionPoolJDBC; |
|
|
|
|
const { driver, user, password, originalCharsetName, schema, url, connectionPoolAttr, database, authType, principal, keyPath } = connectionData as ConnectionJDBC; |
|
|
|
|
const { initialSize, maxActive, maxIdle, maxWait, validationQuery, testOnBorrow, testOnReturn, testWhileIdle, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minIdle, minEvictableIdleTimeMillis } = connectionPoolAttr as ConnectionPoolJDBC; |
|
|
|
|
const databaseType = getJdbcDatabaseType(database, driver); |
|
|
|
|
this.oldPassword = password; |
|
|
|
|
const { host, port, databaseName } = resolveUrlInfo(url); |
|
|
|
@ -316,10 +316,10 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
forms: [{ |
|
|
|
|
type: TextValueCombo, |
|
|
|
|
width: 300, |
|
|
|
|
value: newCharsetName ? newCharsetName : '', |
|
|
|
|
value: originalCharsetName ? originalCharsetName : '', |
|
|
|
|
items: CONNECT_CHARSET, |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.newCharsetName = _ref; |
|
|
|
|
this.form.originalCharsetName = _ref; |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
@ -449,6 +449,22 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: FormItemXtype, |
|
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), |
|
|
|
|
forms: [{ |
|
|
|
|
type: TextEditor, |
|
|
|
|
width: 300, |
|
|
|
|
allowBlank: true, |
|
|
|
|
value: minIdle, |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
|
validationChecker: (value: string) => this.checkInteger(value), |
|
|
|
|
ref: (_ref: any) => { |
|
|
|
|
this.form.minIdle = _ref; |
|
|
|
|
}, |
|
|
|
|
}], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: FormItemXtype, |
|
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
|
|
|
@ -675,6 +691,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
public getSubmitValue():Connection { |
|
|
|
|
const connectionData = this.options.formData.connectionData as ConnectionJDBC; |
|
|
|
|
const connectionPoolAttr = connectionData.connectionPoolAttr; |
|
|
|
|
const originalCharsetName = this.form.originalCharsetName.getValue()[0] || ''; |
|
|
|
|
// TODO 获取表单数据这里待优化
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
connectionType: connectionType.JDBC, |
|
|
|
@ -688,8 +706,8 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
user: this.form.user.getValue(), |
|
|
|
|
password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.encode(this.form.password.getValue()), |
|
|
|
|
queryType: '', |
|
|
|
|
newCharsetName: this.form.newCharsetName.getValue()[0] || '', |
|
|
|
|
originalCharsetName: this.form.newCharsetName.getValue()[0] || '', |
|
|
|
|
newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk
|
|
|
|
|
originalCharsetName, |
|
|
|
|
schema: this.form.schema.getValue()[0], |
|
|
|
|
host: this.form.host.getValue(), |
|
|
|
|
authType: this.form.authType.getValue()[0] || '', |
|
|
|
@ -700,11 +718,12 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
initialSize: this.form.initialSize.getValue(), |
|
|
|
|
maxActive: this.form.maxActive.getValue(), |
|
|
|
|
maxIdle: this.form.maxIdle.getValue(), |
|
|
|
|
minIdle: this.form.minIdle.getValue(), |
|
|
|
|
maxWait: this.form.maxWait.getValue(), |
|
|
|
|
validationQuery: this.form.validationQuery.getValue(), |
|
|
|
|
testOnBorrow: this.form.testOnBorrow.getValue()[0] || connectionPoolAttr.testOnBorrow, |
|
|
|
|
testOnReturn: this.form.testOnReturn.getValue()[0] || connectionPoolAttr.testOnReturn, |
|
|
|
|
testWhileIdle: this.form.testWhileIdle.getValue()[0] || connectionPoolAttr.testWhileIdle, |
|
|
|
|
testOnBorrow: BI.size(this.form.testOnBorrow.getValue()) > 0 ? this.form.testOnBorrow.getValue()[0] : connectionPoolAttr.testOnBorrow, |
|
|
|
|
testOnReturn: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testOnReturn.getValue()[0] : connectionPoolAttr.testOnReturn, |
|
|
|
|
testWhileIdle: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle, |
|
|
|
|
timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), |
|
|
|
|
numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), |
|
|
|
|
minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), |
|
|
|
|