You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
6.7 KiB
149 lines
6.7 KiB
import { shortcut, store } from '@core/core'; |
|
import { Vertical } from 'ui'; |
|
import { FormItemXtype } from '../components/form_item/form_item'; |
|
import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; |
|
import { ConnectionJdbcModelXtype, ConnectionJdecModel } from './connection_jdbc.model'; |
|
import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; |
|
import { getAllDatabaseTypes } from '../../../app.service'; |
|
export const ConnectionJdbcXtype = 'dec.dcm.connection_jdbc'; |
|
@shortcut(ConnectionJdbcXtype) |
|
@store(ConnectionJdbcModelXtype) |
|
export class ConnectionJdbc extends BI.Widget { |
|
advancedSet: any; |
|
|
|
model: ConnectionJdecModel['model']; |
|
allDatabaseTypes = getAllDatabaseTypes(); |
|
|
|
render () { |
|
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; |
|
const { driver, database, host, user, newCharsetName, schema, connectionPool, port, authType, principal, keyPath } = connectionData; |
|
const databaseType = this.allDatabaseTypes.find(item => item.databaseType === database); |
|
|
|
return { |
|
type: Vertical, |
|
hgap: 15, |
|
vgap: 10, |
|
items: [ |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), |
|
value: driver, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), |
|
value: database, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), |
|
value: host, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), |
|
value: port === 0 ? '' : port, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), |
|
value: authType ? user : principal, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), |
|
value: authType ? keyPath : '******', |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), |
|
value: newCharsetName ? newCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), |
|
value: schema, |
|
invisible: !databaseType.hasSchema, |
|
}, |
|
{ |
|
type: CollapseXtype, |
|
width: 70, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), |
|
listeners: [ |
|
{ |
|
eventName: EVENT_CHANGE, |
|
action: (isCollapse: boolean) => { |
|
this.advancedSet.setVisible(!isCollapse); |
|
}, |
|
}, |
|
], |
|
}, |
|
{ |
|
type: Vertical, |
|
vgap: 10, |
|
invisible: true, |
|
ref: (_ref: any) => { |
|
this.advancedSet = _ref; |
|
}, |
|
items: [ |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), |
|
value: connectionPool.initialSize, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), |
|
value: connectionPool.maxActive, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), |
|
value: connectionPool.maxIdle, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
|
value: connectionPool.maxWait, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), |
|
value: connectionPool.validationQuery, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), |
|
value: connectionPool.testOnBorrow, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), |
|
value: connectionPool.testOnReturn, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), |
|
value: connectionPool.testWhileIdle, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), |
|
value: connectionPool.timeBetweenEvictionRunsMillis, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), |
|
value: connectionPool.numTestsPerEvictionRun, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), |
|
value: connectionPool.minEvictableIdleTimeMillis, |
|
}, |
|
], |
|
}, |
|
], |
|
}; |
|
} |
|
}
|
|
|