diff --git a/package.json b/package.json index 8f7d836..d7f4eac 100644 --- a/package.json +++ b/package.json @@ -48,15 +48,14 @@ "source-map-loader": "0.2.4", "style-loader": "0.23.1", "ts-jest": "24.0.2", - "typescript": "3.5.1", + "typescript": "^4.3.5", "webpack": "4.35.2", "webpack-cli": "3.3.5", "webpack-dev-server": "3.7.2", "webpack-merge": "4.2.1" }, "optionalDependencies": { - "@fui/core": "^2.0.0", - "@fui/materials": "10.0.0-release - 10.0.0-release.99999999999999" + "@fui/core": "^2.0.20210721103227" }, "scripts": { "dev": "cross-env NODE_ENV=mock webpack-dev-server -p --progress --config=webpack/webpack.dev.js --mode development --open", @@ -67,10 +66,5 @@ "i18n": "node ./lib/transform-i18n/transform-i18n.js", "test": "jest --passWithNoTests", "upgrade": "node lib/upgrade" - }, - "husky": { - "hooks": { - "pre-push": "npm run eslint && npm run test" - } } } diff --git a/src/modules/app.ts b/src/modules/app.ts index 73561fc..c347927 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -15,6 +15,10 @@ import '../less/index.less'; export class App extends BI.Widget { static xtype = 'dec.dcm.main'; + props = { + baseCls: 'dec-dcm', + }; + tab: Tab; store: AppModel['store']; @@ -24,7 +28,7 @@ export class App extends BI.Widget { pageIndex: (index: string) => { this.tab.setSelect(index); }, - } + }; render() { return { diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index bdbf770..9f0f69f 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -22,12 +22,12 @@ export interface Connection { privilegeDetailBeanList?: { privilegeType: number; privilegeValue: number; - }[] + }[]; } export interface ConnectionLicInfo { currentConnectionNum: number; - maxConnectionNum: number + maxConnectionNum: number; } export interface ConnectionJDBC { @@ -111,7 +111,11 @@ export interface ConnectionJDBC { /** * fetchSize */ - fetchSize?: string; + fetchSize?: number; + /** + * 连接池id + */ + identity?: string; connectionPoolAttr: ConnectionPoolJDBC; } diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 60327af..4682418 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -64,15 +64,25 @@ export class Connection extends BI.Widget { items: [ { el: { - type: BI.VerticalAdaptLayout.xtype, + type: BI.LeftRightVerticalAdaptLayout.xtype, cls: 'bi-border-bottom', - items: [{ - type: BI.Button.xtype, - text: BI.i18nText('Dec-Dcm_Connection_New'), - handler: () => { - this.store.createNewConnection(); - }, - }], + items: { + left: [ + { + type: BI.Button.xtype, + text: BI.i18nText('Dec-Dcm_Connection_New'), + handler: () => { + this.store.createNewConnection(); + }, + }, + ], + right: [ + { + type: 'dec.connection.driver.entry', + from: '.dec-dcm', + }, + ], + }, }, height: 40, }, diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 3c35f03..4dc6d0e 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -182,6 +182,7 @@ export class ConnectionJdbc extends BI.Widget { unit: BI.i18nText('BI-Basic_Seconds'), }, { type: FormItem.xtype, + invisible: BI.parseInt(fetchSize) < 0, name: 'Fetchsize', value: fetchSize, }, diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 1c2f519..a0c49d4 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -849,7 +849,7 @@ export class FormJdbc extends BI.Widget { creator: Dec ? Dec.personal.username : '', principal: this.form.principal.getValue(), keyPath: this.form.keyPath.getValue(), - fetchSize: this.form.fetchSize.getValue(), + fetchSize: BI.parseInt(this.form.fetchSize.getValue()), connectionPoolAttr: { initialSize: this.form.initialSize.getValue(), maxActive: this.form.maxActive.getValue(), diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index fe33db2..ceb59cc 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -16,10 +16,10 @@ export class MaintainForm extends BI.Widget { props = { connectionType: '', - } + }; isEdit = false; connectionName = ''; - + model: MaintainFormModel['model']; store: MaintainFormModel['store']; @@ -39,7 +39,7 @@ export class MaintainForm extends BI.Widget { this.store.updateConnection(this.connectionName, value).then(result => { if (result.errorCode) { this.showError(result); - + return; } this.store.goFirstPage(); @@ -55,7 +55,7 @@ export class MaintainForm extends BI.Widget { testEvent: () => { this.testConnection(); }, - } + }; render() { const formData = BI.clone(this.getFormData()); @@ -63,7 +63,7 @@ export class MaintainForm extends BI.Widget { formData.connectionName = this.getConnectionName(formData.connectionName); this.isEdit = false; } - + return { type: this.getFormType(), formData, @@ -98,7 +98,7 @@ export class MaintainForm extends BI.Widget { } } - private getFormData():Connection { + private getFormData(): Connection { switch (this.options.connectionType) { case connectionType.JDBC: return this.getJdbcConnection(); @@ -111,7 +111,7 @@ export class MaintainForm extends BI.Widget { } } - private getJdbcConnection():Connection { + private getJdbcConnection(): Connection { const connectionName = this.getConnectionName(); let editConnection: Connection; let connectionData: ConnectionJDBC; @@ -122,8 +122,10 @@ export class MaintainForm extends BI.Widget { database: this.model.datebaseTypeSelectedOne.databaseType, connectionName, connectionPoolAttr: DEFAULT_JDBC_POOL, - port:'', + port: '', host: 'localhost', + fetchSize: this.model.datebaseTypeSelectedOne.fetchSize ?? -1, + identity: BI.UUID(), }; editConnection = { connectionId: '', @@ -131,7 +133,7 @@ export class MaintainForm extends BI.Widget { connectionType: connectionType.JDBC, connectionName, }; - + return editConnection; } this.isEdit = true; @@ -139,11 +141,11 @@ export class MaintainForm extends BI.Widget { const connection = BI.clone(this.model.connectionSelectedOne); const { database, driver } = connection.connectionData as ConnectionJDBC; (connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType; - + return connection; } - private getJndiConnection():Connection { + private getJndiConnection(): Connection { if (this.model.datebaseTypeSelected) { return { connectionId: '', @@ -154,18 +156,18 @@ export class MaintainForm extends BI.Widget { } this.connectionName = this.model.connectionSelectedOne.connectionName; this.isEdit = true; - + return this.model.connectionSelectedOne; } - private getPluginConnection():Connection { + private getPluginConnection(): Connection { if (!this.model.datebaseTypeSelected) { this.connectionName = this.model.connectionSelectedOne.connectionName; this.isEdit = true; - + return this.model.connectionSelectedOne; } - + return { connectionId: '', connectionType: this.model.datebaseTypeSelectedOne.databaseType, @@ -174,27 +176,27 @@ export class MaintainForm extends BI.Widget { }; } - private testValue():boolean { + private testValue(): boolean { const value = this.form.getSubmitValue(); if (!value.connectionName) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); - + return false; } if (this.connectionName !== value.connectionName) { const hasNamed = this.model.connections.some(item => item.connectionName === value.connectionName); if (hasNamed) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Is_Existence')); - + return false; } } if (getChartLength(value.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); - + return false; } - + return true; } @@ -204,7 +206,7 @@ export class MaintainForm extends BI.Widget { BI.Msg.toast(BI.i18nText(result.errorMsg), { level: 'error', }); - + return; } @@ -220,12 +222,12 @@ export class MaintainForm extends BI.Widget { const formValue = this.form.getSubmitValue(); if (!formValue.connectionName) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); - + return; } if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); - + return false; } if (this.isEdit || this.model.isCopy) { @@ -256,7 +258,7 @@ export class MaintainForm extends BI.Widget { level: 'error', }); } - + return; } this.store.goFirstPage();