diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index f3e9a60..791d2be 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -1,10 +1,11 @@ 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 = {}; // 原service中resolveUrlInfo方法 - function jdbcResolve (url: string) { + function jdbcResolve(url: string) { if (BI.isNull(url)) return {}; const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/)([^]+)(.*)/i); if (oracleUlr) { @@ -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) => { + if (coverBaseDatabase(config)) return; + 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' })); + config = { + ...config, + type: 'jdbc', + }; 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, { diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 48b7ded..9f5f5b0 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -279,7 +279,7 @@ export const DATA_BASE_TYPES = [ text: 'ClickHouse', databaseType: 'clickhouse', driver: 'ru.yandex.clickhouse.ClickHouseDriver', - url: 'jdbc:clickhouse://hostname:port', + url: 'jdbc:clickhouse://hostname:port/database', commonly: false, internal: true, type: 'jdbc', diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 277f1a7..90ea1b2 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1001,7 +1001,8 @@ export class FormJdbc extends BI.Widget { { el: { type: BI.VerticalLayout.xtype, - bgap: vgap, + vgap: vgap, + top: -15, invisible: true, ref: (_ref: VerticalLayout) => { this.advancedSet = _ref; diff --git a/src/modules/title/title.ts b/src/modules/title/title.ts index 73d936b..687e2e8 100644 --- a/src/modules/title/title.ts +++ b/src/modules/title/title.ts @@ -78,6 +78,7 @@ export class Title extends BI.Widget { type: BI.Tab.xtype, height: 40, showIndex: this.model.pageIndex, + width:200, ref: (_ref: Tab) => { this.tab = _ref; },