From dac2515602fd9533896a3fc336b0ab0a0014b2ef Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 8 Nov 2019 14:18:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-10883=20=E4=BF=AE=E6=94=B9=E5=85=B6?= =?UTF-8?q?=E4=BB=96JDBC=E7=9A=84=E7=B1=BB=E5=9E=8B=E4=B8=BAotherJDBC?= =?UTF-8?q?=E4=BB=A5=E5=8C=BA=E5=88=AB=E6=97=A7=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 2 +- src/modules/constants/constant.ts | 15 +++++++++------ src/modules/pages/database/database.ts | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 55b8621..d37c088 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -28,7 +28,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT let databaseType = null; // KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driber来判断数据类型 // DEC-10872 不能过滤other,因为新版数据连接创建的其他jdbc也是other类型,会混淆,需要和后端讨论一个最佳的解决方案。 - if (database && DATA_BASE_TYPES.some(item => item.databaseType === database)) { + if (database && database !== 'other' && DATA_BASE_TYPES.some(item => item.databaseType === database)) { databaseType = DATA_BASE_TYPES.find(item => item.databaseType === database); } else { const designDatabase = DESIGN_DRIVER_TYPE.find(item => item.driver === driver); diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 20f0200..019cf43 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -7,19 +7,22 @@ export const PAGE_INDEX = { POOL: 'pool', }; +export const OTHER_JDBC = 'otherJDBC'; + export const DATEBASE_FILTER_TYPE = { COMMONLY: 'commonly', ALL: 'all', - OTHER: 'other', + OTHER: OTHER_JDBC, }; BI.constant(CONSTANT_PLUGIN_TYPES, [ ]); + export const DATA_BASE_TYPES_OTHER = { - text: 'other', - databaseType: 'other', + text: OTHER_JDBC, + databaseType: OTHER_JDBC, driver: '', url: '', commonly: false, @@ -162,7 +165,7 @@ export const DATA_BASE_DRIVER_LINK = DecCst && DecCst.Hyperlink ? [ link: DecCst.Hyperlink.Database.INCEPTOR, }, { - databaseType: 'other', + databaseType: OTHER_JDBC, link: DecCst.Hyperlink.Database.OTHER, }, ] : []; @@ -570,13 +573,13 @@ export const DATA_BASE_TYPES = [ }, { text: BI.i18nText('Dec-Dcm_Connection_JDBC_Other'), - databaseType: 'other', + databaseType: OTHER_JDBC, driver: 'org.h2.Driver', drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], url: 'jdbc:h2://${ENV_HOME}/../database', commonly: false, internal: true, - type: 'other', + type: OTHER_JDBC, hasSchema: true, kerberos: false, urls: { diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index 9eb3bd8..a13921e 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -2,7 +2,7 @@ import { SearchEditor, Vtape, Right, Htape, Vertical, ButtonGroup, Left, Vertica import { shortcut, store } from '@core/core'; import { FilterXtype } from './filter/filter'; import { DatebaseModel, DatebaseModelXtype } from './database.model'; -import { DATEBASE_FILTER_TYPE } from '@constants/constant'; +import { DATEBASE_FILTER_TYPE, OTHER_JDBC } from '@constants/constant'; import { connectionType } from '@constants/env'; import { DatebaseTypeXtype } from './database_type/database_type'; import { getAllDatabaseTypes } from '../../app.service'; @@ -56,7 +56,7 @@ export class Datebase extends BI.Widget { if (this.model.isPlugin) { datebaseTypes = [...datebaseTypes, ...this.allDatabaseTypes.filter(item => !item.internal)]; } - this.store.setDatebaseTypes(datebaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== 'other')); + this.store.setDatebaseTypes(datebaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC)); } }, } @@ -241,10 +241,10 @@ export class Datebase extends BI.Widget { this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.commonly)); break; case DATEBASE_FILTER_TYPE.OTHER: - this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type === connectionType.JNDI || item.type === 'other')); + this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type === connectionType.JNDI || item.type === OTHER_JDBC)); break; default: - this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== 'other')); + this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC)); break; } }