|
|
@ -4,7 +4,7 @@ import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/col |
|
|
|
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'; |
|
|
|
import { connectionType } from '@constants/env'; |
|
|
|
import { connectionType } from '@constants/env'; |
|
|
|
import { CONNECT_CHARSET, CONNECTION_LAYOUT } from '@constants/constant'; |
|
|
|
import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; |
|
|
|
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; |
|
|
|
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; |
|
|
|
import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; |
|
|
|
import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; |
|
|
|
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc'; |
|
|
|
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc'; |
|
|
@ -62,6 +62,12 @@ export class FormJdbc extends BI.Widget { |
|
|
|
const { host, port, databaseName } = resolveUrlInfo(url); |
|
|
|
const { host, port, databaseName } = resolveUrlInfo(url); |
|
|
|
const { hgap, vgap } = CONNECTION_LAYOUT; |
|
|
|
const { hgap, vgap } = CONNECTION_LAYOUT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const valueRangeConfig = { |
|
|
|
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Value_Out_Range'), |
|
|
|
|
|
|
|
checker: (value: string) => this.checkValueRange(value), |
|
|
|
|
|
|
|
autoFix: true, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
type: Vertical, |
|
|
|
type: Vertical, |
|
|
|
hgap, |
|
|
|
hgap, |
|
|
@ -161,7 +167,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.port = _ref; |
|
|
|
this.form.port = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -408,7 +414,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
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; |
|
|
@ -428,7 +434,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.maxActive = _ref; |
|
|
|
this.form.maxActive = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -447,7 +453,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.maxIdle = _ref; |
|
|
|
this.form.maxIdle = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -466,7 +472,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.minIdle = _ref; |
|
|
|
this.form.minIdle = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -486,7 +492,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.maxWait = _ref; |
|
|
|
this.form.maxWait = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -574,7 +580,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), |
|
|
|
checker: (value: string) => this.checkNumber(value), |
|
|
|
checker: (value: string) => this.checkNumber(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.timeBetweenEvictionRunsMillis = _ref; |
|
|
|
this.form.timeBetweenEvictionRunsMillis = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -600,7 +606,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.numTestsPerEvictionRun = _ref; |
|
|
|
this.form.numTestsPerEvictionRun = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -620,7 +626,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
checker: (value: string) => this.checkInteger(value), |
|
|
|
autoFix: true, |
|
|
|
autoFix: true, |
|
|
|
}], |
|
|
|
}, valueRangeConfig], |
|
|
|
ref: (_ref: any) => { |
|
|
|
ref: (_ref: any) => { |
|
|
|
this.form.minEvictableIdleTimeMillis = _ref; |
|
|
|
this.form.minEvictableIdleTimeMillis = _ref; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -651,6 +657,10 @@ export class FormJdbc extends BI.Widget { |
|
|
|
return /^[(\-|\+)?\d]+$/.test(value); |
|
|
|
return /^[(\-|\+)?\d]+$/.test(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private checkValueRange(value: string) { |
|
|
|
|
|
|
|
return parseInt(value, 0) <= INT_MAX_VALUE && parseInt(value, 0) >= INT_MIN_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); |
|
|
@ -732,7 +742,7 @@ export class FormJdbc extends BI.Widget { |
|
|
|
driver: this.form.driver.getValue(), |
|
|
|
driver: this.form.driver.getValue(), |
|
|
|
url: this.form.url.getValue(), |
|
|
|
url: this.form.url.getValue(), |
|
|
|
user: this.form.user.getValue(), |
|
|
|
user: this.form.user.getValue(), |
|
|
|
password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.encode(this.form.password.getValue()), |
|
|
|
password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.Providers.getProvider('dec.provider.cipher').getCipher(this.form.password.getValue()), |
|
|
|
queryType: '', |
|
|
|
queryType: '', |
|
|
|
newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk
|
|
|
|
newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk
|
|
|
|
originalCharsetName, |
|
|
|
originalCharsetName, |
|
|
|