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.
166 lines
7.6 KiB
166 lines
7.6 KiB
import { shortcut, store } from '@core/core'; |
|
import { Vertical, Layout } 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, getJdbcDatabaseType, resolveUrlInfo } 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, user, newCharsetName, schema, connectionPoolAttr, authType, principal, url } = connectionData; |
|
const databaseType = getJdbcDatabaseType(database, driver); |
|
const { host, port, databaseName } = resolveUrlInfo(url); |
|
|
|
return { |
|
type: Vertical, |
|
hgap: 15, |
|
vgap: 15, |
|
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: databaseName, |
|
}, |
|
{ |
|
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, |
|
}, |
|
authType ? |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), |
|
value: authType, |
|
} : { |
|
type: Layout, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), |
|
value: authType ? principal : user, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), |
|
value: '******', |
|
}, |
|
{ |
|
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: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), |
|
value: url, |
|
}, |
|
{ |
|
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: 15, |
|
invisible: true, |
|
ref: (_ref: any) => { |
|
this.advancedSet = _ref; |
|
}, |
|
items: [ |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), |
|
value: connectionPoolAttr.initialSize, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), |
|
value: connectionPoolAttr.maxActive, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), |
|
value: connectionPoolAttr.maxIdle, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), |
|
value: connectionPoolAttr.maxWait, |
|
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), |
|
value: connectionPoolAttr.validationQuery, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), |
|
value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), |
|
value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), |
|
value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), |
|
value: connectionPoolAttr.timeBetweenEvictionRunsMillis, |
|
unit: BI.i18nText('Dec-Dcm_Millisecond'), |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), |
|
value: connectionPoolAttr.numTestsPerEvictionRun, |
|
}, |
|
{ |
|
type: FormItemXtype, |
|
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), |
|
value: connectionPoolAttr.minEvictableIdleTimeMillis, |
|
unit: BI.i18nText('BI-Basic_Seconds'), |
|
}, |
|
], |
|
}, |
|
], |
|
}; |
|
} |
|
}
|
|
|