|
|
|
@ -1,13 +1,22 @@
|
|
|
|
|
import { shortcut } from '@core/core'; |
|
|
|
|
import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; |
|
|
|
|
import { FormItem } from '../../components/form_item/form_item'; |
|
|
|
|
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; |
|
|
|
|
import { connectionType } from '@constants/env'; |
|
|
|
|
import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; |
|
|
|
|
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; |
|
|
|
|
import { TextChecker } from '../../../../components/text_checker/text_checker'; |
|
|
|
|
import { ApiFactory } from 'src/modules/crud/apiFactory'; |
|
|
|
|
import { Editor, EditorIconCheckCombo, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout } from '@fui/core'; |
|
|
|
|
import {shortcut} from '@core/core'; |
|
|
|
|
import {Collapse, EVENT_CHANGE} from 'src/modules/components/collapse/collapse'; |
|
|
|
|
import {FormItem} from '../../components/form_item/form_item'; |
|
|
|
|
import {Connection, ConnectionJDBC, ConnectionPoolJDBC} from 'src/modules/crud/crud.typings'; |
|
|
|
|
import {connectionType} from '@constants/env'; |
|
|
|
|
import {CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE} from '@constants/constant'; |
|
|
|
|
import {getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl} from '../../../../app.service'; |
|
|
|
|
import {TextChecker} from '../../../../components/text_checker/text_checker'; |
|
|
|
|
import {ApiFactory} from 'src/modules/crud/apiFactory'; |
|
|
|
|
import { |
|
|
|
|
Editor, |
|
|
|
|
EditorIconCheckCombo, |
|
|
|
|
Label, |
|
|
|
|
TextAreaEditor, |
|
|
|
|
TextEditor, |
|
|
|
|
TextValueCombo, |
|
|
|
|
VerticalLayout |
|
|
|
|
} from '@fui/core'; |
|
|
|
|
|
|
|
|
|
const api = new ApiFactory().create(); |
|
|
|
|
|
|
|
|
|
@shortcut() |
|
|
|
@ -57,13 +66,38 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const { connectionName, connectionData } = this.options.formData; |
|
|
|
|
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 {connectionName, connectionData} = this.options.formData; |
|
|
|
|
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, database); |
|
|
|
|
const { hgap, vgap } = CONNECTION_LAYOUT; |
|
|
|
|
const {host, port, databaseName} = resolveUrlInfo(url, database); |
|
|
|
|
const {hgap, vgap} = CONNECTION_LAYOUT; |
|
|
|
|
|
|
|
|
|
const valueRangeConfig = { |
|
|
|
|
errorText: BI.i18nText('Dec-Dcm_Connection_Value_Out_Range'), |
|
|
|
@ -360,7 +394,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
vgap: 15, |
|
|
|
|
disabled: true, |
|
|
|
|
value: schema, |
|
|
|
|
items: schema ? [{ text: schema, value: schema }] : [], |
|
|
|
|
items: schema ? [{text: schema, value: schema}] : [], |
|
|
|
|
ref: (_ref: TextValueCombo) => { |
|
|
|
|
this.form.schema = _ref; |
|
|
|
|
}, |
|
|
|
@ -547,7 +581,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
type: FormItem.xtype, |
|
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), |
|
|
|
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), |
|
|
|
|
forms: [{ |
|
|
|
|
type: BI.TextValueCombo.xtype, |
|
|
|
|
$value: 'check', |
|
|
|
@ -555,7 +589,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
value: testOnBorrow, |
|
|
|
|
items: this.getBooleanItem(), |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Connection-Check'), |
|
|
|
|
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), |
|
|
|
|
ref: (_ref: TextValueCombo) => { |
|
|
|
|
this.form.testOnBorrow = _ref; |
|
|
|
|
}, |
|
|
|
@ -733,7 +767,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private onHostPortChange(databaseType) { |
|
|
|
|
const { urls, url } = databaseType; |
|
|
|
|
const {urls, url} = databaseType; |
|
|
|
|
const driver = this.form.driver.getValue(); |
|
|
|
|
const selectUrl = BI.get(urls, driver) || url; |
|
|
|
|
const host = this.form.host.getValue(); |
|
|
|
@ -766,7 +800,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
connectionType: connectionType.JDBC, |
|
|
|
|
connectionId: this.form.connectionName.getValue(), |
|
|
|
|
connectionName: this.form.connectionName.getValue(), |
|
|
|
|
connectionData: { |
|
|
|
|
connectionData: <ConnectionJDBC>BI.extend({}, connectionData, { |
|
|
|
|
database: connectionData.database, |
|
|
|
|
connectionName: this.form.connectionName.getValue(), |
|
|
|
|
driver: this.form.driver.getValue(), |
|
|
|
@ -796,7 +830,7 @@ export class FormJdbc extends BI.Widget {
|
|
|
|
|
numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), |
|
|
|
|
minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}), |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|