From 7581aca8cdff0ebcb68975cccc49ca12a4d34e84 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 2 Dec 2020 13:39:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-16169=20=E6=94=B9=E7=94=A8provider?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8F=92=E4=BB=B6=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 5 +++-- src/modules/app.service.ts | 5 ++--- src/modules/constants/constant.ts | 9 --------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 97f6753..af2db61 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -60,14 +60,15 @@ BI.provider('dec.connection.provider.datebase', function() { this.registerDatabaseType = (config: any) => { BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); }; - + this.registerJdbcDatabase = (config: any, resolve?: Function) => { BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' })); - + BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); }; this.$get = () => BI.inherit(BI.OB, { getJdbcResolveByType: (type: string) => this.resolves[type] || jdbcResolve, + customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES), }); }); diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index d8a0a2c..145b807 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -1,11 +1,10 @@ import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant'; -import { CONSTANT_PLUGIN_TYPES } from './app.constant'; import { DatabaseType } from './app.typings'; import { Connection } from './crud/crud.typings'; export function getAllDatabaseTypes():DatabaseType[] { return [ ...DATA_BASE_TYPES, - ...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).map(item => { + ...BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.map(item => { return { ...item, internal: false, @@ -15,7 +14,7 @@ export function getAllDatabaseTypes():DatabaseType[] { ]; } function getPlugin(type: string) { - return BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).find(item => item.databaseType === type); + return BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.find(item => item.databaseType === type); } export function getPluginWidgetShow(plugin: string) { return BI.get(getPlugin(plugin), 'show'); diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 0c7549f..d7519ec 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -1,5 +1,3 @@ -import { CONSTANT_PLUGIN_TYPES } from '../app.constant'; - export const PAGE_INDEX = { CONNECTION: 'connection', DATEBASE: 'datebase', @@ -619,13 +617,6 @@ export const DATA_BASE_TYPES = [ 'org.sqlite.JDBC': 'jdbc:sqlite:[PATH_TO_DB_FILES]', }, }, - ...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).map(item => { - return { - ...item, - internal: false, - commonly: false, - }; - }), ];