From ab258bbc3831f0cb0e2fd01192f6fbc6152cb1da Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 25 Sep 2019 13:52:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-10009=20=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=90=8D=E7=A7=B0=E6=97=81=E8=BE=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 15 +++++++++++++-- src/modules/pages/maintain/maintain.ts | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 9ea3055..8efc1be 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -7,7 +7,8 @@ import { ConnectionJdbcXtype } from './connection_jdbc/connection_jdbc'; import { ConnectionJndiXtype } from './connection_jndi/connection_jndi'; import { ConnectionPluginXtype } from './connection_plugin/connection_plugin'; import { connectionType } from '@constants/env'; -import { getAllDatabaseTypes, connectionCanEdit } from '../../app.service'; +import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType } from '../../app.service'; +import { ConnectionJDBC } from '../../crud/crud.typings'; export const ConnectionXtype = 'dec.dcm.connection'; @shortcut(ConnectionXtype) @@ -24,7 +25,7 @@ export class Connection extends BI.Widget { watch = { connectionSelected:(name: string) => { const canEdit = connectionCanEdit(this.model.connectionSelectedOne); - this.connectionTitleWidget.setText(`${name}`); + this.connectionTitleWidget.setText(`${name}(${this.getSelectConnectionType()})`); this.connectionEditWidget.setVisible(!!name && canEdit); if (name) { const hasRegistered = this.hasRegistered(); @@ -184,4 +185,14 @@ export class Connection extends BI.Widget { return allDatabaseTypes.some(item => item.databaseType === this.model.connectionSelectedOne.connectionType); } } + + private getSelectConnectionType() { + let databaseType = this.model.connectionSelectedOne.connectionType; + if (databaseType === connectionType.JDBC) { + const connectionJDBC = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; + databaseType = getJdbcDatabaseType(connectionJDBC.database, connectionJDBC.driver).databaseType; + } + + return databaseType; + } } diff --git a/src/modules/pages/maintain/maintain.ts b/src/modules/pages/maintain/maintain.ts index fd941de..d920dc1 100644 --- a/src/modules/pages/maintain/maintain.ts +++ b/src/modules/pages/maintain/maintain.ts @@ -6,6 +6,9 @@ import { PAGE_INDEX } from '@constants/constant'; import { ApiFactory } from 'src/modules/crud/apiFactory'; const api = new ApiFactory().create(); import './maintain.less'; +import { connectionType } from '@constants/env'; +import { getJdbcDatabaseType } from '../../app.service'; +import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; export const MaintainXtype = 'dec.dcm.maintain'; @shortcut(MaintainXtype) @@ -17,7 +20,8 @@ export class Maintain extends BI.Widget { listView: any; render() { - const { text, isEdit } = this.getEditConnection(); + const { text, isEdit, databaseType } = this.getEditConnection(); + const titleText = this.model.isCopy ? `${text}-${BI.i18nText('Dec-Dcm_Copy')}` : text; return { type: Vtape, @@ -39,7 +43,7 @@ export class Maintain extends BI.Widget { }, { type: Label, - text: this.model.isCopy ? `${text}-${BI.i18nText('Dec-Dcm_Copy')}` : text, + text: `${titleText}(${databaseType})`, }, ], height: 40, @@ -78,13 +82,20 @@ export class Maintain extends BI.Widget { type: this.model.datebaseTypeSelectedOne.type, text: this.model.datebaseTypeSelectedOne.text, isEdit: false, + databaseType: this.model.datebaseTypeSelectedOne.databaseType, }; } + let databaseType = this.model.connectionSelectedOne.connectionType; + if (databaseType === connectionType.JDBC) { + const connectionJDBC = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; + databaseType = getJdbcDatabaseType(connectionJDBC.database, connectionJDBC.driver).databaseType; + } return { type: this.model.connectionSelectedOne.connectionType, text: this.model.connectionSelectedOne.connectionName, isEdit: true, + databaseType, }; } }