Browse Source

Merge pull request #1013 in DEC/decision-webui-dcm from release/10.0 to bugfix/10.0

* commit '77cb87ab7bbaadabe624d660798ce6e9644869b5':
  fix: DEC-16169 改用provider获取插件数据连接
bugfix/10.0
superman 4 years ago
parent
commit
97a7569889
  1. 5
      src/modules/app.provider.ts
  2. 5
      src/modules/app.service.ts
  3. 9
      src/modules/constants/constant.ts

5
src/modules/app.provider.ts

@ -60,14 +60,15 @@ BI.provider('dec.connection.provider.datebase', function() {
this.registerDatabaseType = (config: any) => { this.registerDatabaseType = (config: any) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config));
}; };
this.registerJdbcDatabase = (config: any, resolve?: Function) => { this.registerJdbcDatabase = (config: any, resolve?: Function) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' })); BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' }));
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve);
}; };
this.$get = () => BI.inherit(BI.OB, { this.$get = () => BI.inherit(BI.OB, {
getJdbcResolveByType: (type: string) => this.resolves[type] || jdbcResolve, getJdbcResolveByType: (type: string) => this.resolves[type] || jdbcResolve,
customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES),
}); });
}); });

5
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 { 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 { DatabaseType } from './app.typings';
import { Connection } from './crud/crud.typings'; import { Connection } from './crud/crud.typings';
export function getAllDatabaseTypes():DatabaseType[] { export function getAllDatabaseTypes():DatabaseType[] {
return [ return [
...DATA_BASE_TYPES, ...DATA_BASE_TYPES,
...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).map(item => { ...BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.map(item => {
return { return {
...item, ...item,
internal: false, internal: false,
@ -15,7 +14,7 @@ export function getAllDatabaseTypes():DatabaseType[] {
]; ];
} }
function getPlugin(type: string) { 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) { export function getPluginWidgetShow(plugin: string) {
return BI.get(getPlugin(plugin), 'show'); return BI.get(getPlugin(plugin), 'show');

9
src/modules/constants/constant.ts

@ -1,5 +1,3 @@
import { CONSTANT_PLUGIN_TYPES } from '../app.constant';
export const PAGE_INDEX = { export const PAGE_INDEX = {
CONNECTION: 'connection', CONNECTION: 'connection',
DATEBASE: 'datebase', DATEBASE: 'datebase',
@ -619,13 +617,6 @@ export const DATA_BASE_TYPES = [
'org.sqlite.JDBC': 'jdbc:sqlite:[PATH_TO_DB_FILES]', 'org.sqlite.JDBC': 'jdbc:sqlite:[PATH_TO_DB_FILES]',
}, },
}, },
...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).map(item => {
return {
...item,
internal: false,
commonly: false,
};
}),
]; ];

Loading…
Cancel
Save