diff --git a/private/i18n.ts b/private/i18n.ts index 6d9294b..a36b80e 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -305,4 +305,5 @@ export default { 'Dec-Dcm_Socket_Unable_Connect_Tip': '可能出现编辑冲突', 'Dec-Connection_Lic_Limit_Approach_Tip': '当前数据连接数量超过注册lic限制({}个),所有数据连接都不可用,请删除多余的数据连接', 'Dec-Connection_Lic_Limit_Approach_Prevent_Tip': '当前数据连接数量已经达到注册lic限制({}个),无法新增', + 'Dec-Dcm_Connection_Check_Fetch_Size_Range': '请输入0-1000000之间的值', }; diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index ba6a849..c519031 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -19,17 +19,17 @@ export const DATEBASE_FILTER_TYPE = { }; export const DATA_BASE_TYPES_OTHER = -{ - text: OTHER_JDBC, - databaseType: OTHER_JDBC, - driver: '', - url: '', - commonly: false, - internal: false, - type: 'jdbc', - hasSchema: true, - kerberos: false, -}; + { + text: OTHER_JDBC, + databaseType: OTHER_JDBC, + driver: '', + url: '', + commonly: false, + internal: false, + type: 'jdbc', + hasSchema: true, + kerberos: false, + }; export const DATA_BASE_DRIVER_LINK = DecCst && DecCst.Hyperlink ? [ { databaseType: 'ads', @@ -444,6 +444,7 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: true, kerberos: false, + fetchSize: 50, }, { text: 'INFORMIX', databaseType: 'informix', @@ -521,6 +522,7 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: true, kerberos: false, + fetchSize: 128, }, { text: 'Pivotal Greenplum Database', @@ -547,6 +549,7 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: true, kerberos: false, + fetchSize: 10000, }, { text: 'Presto', databaseType: 'presto', @@ -648,7 +651,6 @@ export const DATA_BASE_TYPES = [ ]; - export const CONNECT_CHARSET = [ { text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), @@ -740,10 +742,10 @@ export const CONNECTION_LAYOUT = { export const JNDI_FACTORYS = [ { - factory:'', + factory: '', url: '', }, { - factory:'weblogic.jndi.WLInitialContextFactory', + factory: 'weblogic.jndi.WLInitialContextFactory', url: 't3://localhost:7001', }, { factory: 'com.ibm.websphere.naming.WsnInitialContextFactory', diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 2d56028..bdbf770 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -108,6 +108,10 @@ export interface ConnectionJDBC { * 秘钥路径 */ keyPath?: string; + /** + * fetchSize + */ + fetchSize?: string; connectionPoolAttr: ConnectionPoolJDBC; } diff --git a/src/modules/pages/connection/connection.model.ts b/src/modules/pages/connection/connection.model.ts index 5874bdf..bdea196 100644 --- a/src/modules/pages/connection/connection.model.ts +++ b/src/modules/pages/connection/connection.model.ts @@ -30,7 +30,7 @@ export class ConnectionModel extends Model<{ childContext: ['connectionLicInfo']; - context = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected', 'connectionLicInfo']; + context = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected']; actions = { initConnectionLicInfo: (cb: Function) => { diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 9e205aa..3c35f03 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -19,9 +19,20 @@ export class ConnectionJdbc extends BI.Widget { model: ConnectionJdecModel['model']; allDatabaseTypes = getAllDatabaseTypes(); - render () { + render() { const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; - const { driver, database, user, originalCharsetName, schema, connectionPoolAttr, authType, principal, url } = connectionData; + const { + driver, + database, + user, + originalCharsetName, + schema, + connectionPoolAttr, + authType, + principal, + url, + fetchSize, + } = connectionData; const databaseType = getJdbcDatabaseType(database, driver); const { host, port, databaseName } = resolveUrlInfo(url, database); const { hgap, vgap } = CONNECTION_LAYOUT; @@ -169,6 +180,10 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), value: connectionPoolAttr.minEvictableIdleTimeMillis, unit: BI.i18nText('BI-Basic_Seconds'), + }, { + type: FormItem.xtype, + name: 'Fetchsize', + value: fetchSize, }, ], }, diff --git a/src/modules/pages/connection/connection_jndi/connection_jndi.ts b/src/modules/pages/connection/connection_jndi/connection_jndi.ts index 1db4a3b..874120a 100644 --- a/src/modules/pages/connection/connection_jndi/connection_jndi.ts +++ b/src/modules/pages/connection/connection_jndi/connection_jndi.ts @@ -19,7 +19,7 @@ export class ConnectionJndi extends BI.Widget { const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJNDI; const { jndiName, contextHashtable, originalCharsetName } = connectionData; const { hgap, vgap } = CONNECTION_LAYOUT; - + return { type: BI.VerticalLayout.xtype, $testId: 'dec-dcm-connection-jndi', diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index f23de66..f43abb5 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/src/modules/pages/connection/list/list_item/list_item.model.ts @@ -4,13 +4,11 @@ import { ApiFactory } from '../../../../crud/apiFactory'; import { ResultType } from '../../../../crud/crud.typings'; import { getChartLength } from '../../../../app.service'; import { NAME_MAX_LENGTH } from '../../../../app.constant'; -import { PAGE_INDEX } from '@constants/constant'; - const api = new ApiFactory().create(); @model() export class ListItemModel extends Model<{ - types: { + types : { connectionSelected: AppModel['TYPE']['connectionSelected']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne']; datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne']; @@ -23,7 +21,7 @@ export class ListItemModel extends Model<{ }> { static xtype = 'dec.dcm.model.connection.list_item'; - context = ['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'datebaseTypeSelected', 'isCopy', 'connectionLicInfo']; + context = ['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'datebaseTypeSelected', 'isCopy']; state() { return { @@ -54,12 +52,10 @@ export class ListItemModel extends Model<{ }, setIsEdit: (isEdit: boolean, name: string) => { if (isEdit) { - api.getConnectionStatus(name) - .then(re => { - this.model.isEdit = true; - }) - .catch(() => { - }); + api.getConnectionStatus(name).then(re => { + this.model.isEdit = true; + }) + .catch(() => {}); } else { api.shutdownConnectionStatus(name); this.model.isEdit = false; @@ -73,10 +69,7 @@ export class ListItemModel extends Model<{ } if (getChartLength(newName) > NAME_MAX_LENGTH) { return new Promise(resolve => { - resolve({ - errorCode: '1', - errorMsg: BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH), - }); + resolve({ errorCode: '1', errorMsg: BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH) }); }); } const hasNamed = this.model.connections.some(item => item.connectionName === newName); @@ -90,49 +83,30 @@ export class ListItemModel extends Model<{ connection.connectionName = newName; - return api.updateConnection(connection) - .then(re => { - if (!re.errorCode) { - this.model.connections = this.model.connections.map(item => { - return { - ...item, - connectionName: item.connectionName === oldName ? newName : item.connectionName, - connectionId: item.connectionName === oldName ? newName : item.connectionName, - }; - }); - if (this.model.connectionSelected === oldName) { - this.model.connectionSelected = newName; - } + return api.updateConnection(connection).then(re => { + if (!re.errorCode) { + this.model.connections = this.model.connections.map(item => { + return { + ...item, + connectionName: item.connectionName === oldName ? newName : item.connectionName, + connectionId: item.connectionName === oldName ? newName : item.connectionName, + }; + }); + if (this.model.connectionSelected === oldName) { + this.model.connectionSelected = newName; } + } - return re; - }); - }, - copyConnection(connectionName) { - if (this.model.connectionLicInfo.currentConnectionNum >= this.model.connectionLicInfo.maxConnectionNum) { - BI.Services.getService('dec.service.component.icon_text.msg').alert({ - text: BI.i18nText('Dec-Connection_Lic_Limit_Approach_Prevent_Tip', this.model.connectionLicInfo.maxConnectionNum), - }); - - return; - } - this.setConnectionSelected(connectionName); - this.setIsCopy(true); - this.setPageIndex(PAGE_INDEX.MAINTAIN); + return re; + }); }, setIsCopy: (isCopy: boolean) => { this.model.isCopy = isCopy; }, isDriverError: (errorCode: string) => api.isDriverError(errorCode), - }; - + } removeConnection(name: string) { - api.deleteConnection(name) - .then(re => { - this.model.connectionLicInfo.currentConnectionNum -= 1; - - return api.getConnectionList(); - }) + api.deleteConnection(name).then(re => api.getConnectionList()) .then(connections => { this.model.connections = connections.data; this.model.connections.forEach(item => { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index b00d993..3c69a47 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1,12 +1,12 @@ -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 { 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, @@ -14,7 +14,7 @@ import { TextAreaEditor, TextEditor, TextValueCombo, - VerticalLayout + VerticalLayout, } from '@fui/core'; const api = new ApiFactory().create(); @@ -25,7 +25,7 @@ export class FormJdbc extends BI.Widget { props = { formData: {} as Connection, - } + }; oldPassword = ''; allDatabaseTypes = getAllDatabaseTypes(); @@ -63,10 +63,11 @@ export class FormJdbc extends BI.Widget { numTestsPerEvictionRun: null, minIdle: null, minEvictableIdleTimeMillis: null, + fetchSize: null, }; render() { - const {connectionName, connectionData} = this.options.formData; + const { connectionName, connectionData } = this.options.formData; const { driver, user, @@ -78,7 +79,8 @@ export class FormJdbc extends BI.Widget { database, authType, principal, - keyPath + keyPath, + fetchSize, } = connectionData as ConnectionJDBC; const { initialSize, @@ -92,12 +94,12 @@ export class FormJdbc extends BI.Widget { timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minIdle, - minEvictableIdleTimeMillis + 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'), @@ -394,7 +396,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; }, @@ -702,6 +704,37 @@ export class FormJdbc extends BI.Widget { text: BI.i18nText('BI-Basic_Seconds'), }, ], + }, { + el: { + type: BI.VerticalLayout.xtype, + cls: 'bi-border-top', + invisible: BI.parseInt(fetchSize) < 0, + items: [ + { + el: { + type: FormItem.xtype, + name: 'Fetchsize', + forms: [{ + type: TextChecker.xtype, + $value: 'fetch-size', + width: 300, + allowBlank: true, + value: fetchSize, + watermark: 'Fetchsize', + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), + checker: (value: string) => BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, + autoFix: true, + }], + ref: (_ref: TextChecker) => { + this.form.fetchSize = _ref; + }, + }], + }, + vgap: 15, + }, + ], + }, }, ], }, @@ -767,7 +800,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();