|
|
@ -1,4 +1,5 @@ |
|
|
|
import { CONSTANT_PLUGIN_TYPES } from './app.constant'; |
|
|
|
import { CONSTANT_PLUGIN_TYPES } from './app.constant'; |
|
|
|
|
|
|
|
import { DATA_BASE_TYPES } from '@constants/constant'; |
|
|
|
|
|
|
|
|
|
|
|
BI.provider('dec.connection.provider.datebase', function () { |
|
|
|
BI.provider('dec.connection.provider.datebase', function () { |
|
|
|
this.resolves = {}; |
|
|
|
this.resolves = {}; |
|
|
@ -68,14 +69,35 @@ BI.provider('dec.connection.provider.datebase', function() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function coverBaseDatabase(config) { |
|
|
|
|
|
|
|
const baseDataBase = DATA_BASE_TYPES.find(item => item.text === config.text); |
|
|
|
|
|
|
|
if (BI.isNotNull(baseDataBase)) { |
|
|
|
|
|
|
|
// 覆盖基础配置
|
|
|
|
|
|
|
|
Object.assign(baseDataBase, config); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.registerDatabaseType = (config: any) => { |
|
|
|
this.registerDatabaseType = (config: any) => { |
|
|
|
|
|
|
|
if (coverBaseDatabase(config)) return; |
|
|
|
|
|
|
|
|
|
|
|
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' })); |
|
|
|
config = { |
|
|
|
|
|
|
|
...config, |
|
|
|
|
|
|
|
type: 'jdbc', |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); |
|
|
|
BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (coverBaseDatabase(config)) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.$get = () => BI.inherit(BI.OB, { |
|
|
|
this.$get = () => BI.inherit(BI.OB, { |
|
|
|