Browse Source

Merge pull request #130 in DEC/decision-webui-dcm from release/10.0 to feature/10.0

* commit 'b435fcf8e0a4fe568680ddf785af12f8671acf99':
  fix: DEC-10944 修复修改工程servlet后,图片无法显示的问题
  fix: 修改插件接口,使用providew
  fix: DEC-10883 修改其他JDBC的类型为otherJDBC以区别旧版
  fix: DEC-10872 修复兼容旧版数据连接时产生的bug
research/11.0
alan 5 years ago
parent
commit
da6a1f9f34
  1. 2
      src/modules/app.constant.ts
  2. 9
      src/modules/app.provider.ts
  3. 11
      src/modules/app.service.ts
  4. 1
      src/modules/app.ts
  5. 19
      src/modules/constants/constant.ts
  6. 3
      src/modules/constants/plugin.ts
  7. 2
      src/modules/pages/connection/connection_plugin/connection_plugin.ts
  8. 8
      src/modules/pages/database/database.ts
  9. 4
      src/modules/pages/maintain/forms/components/form.plugin.ts
  10. 6
      webpack/webpack.prod.js

2
src/modules/app.constant.ts

@ -0,0 +1,2 @@
export const CONSTANT_PLUGIN_TYPES = 'dec.constant.database.conf.connect.types';
BI.constant(CONSTANT_PLUGIN_TYPES, []);

9
src/modules/app.provider.ts

@ -0,0 +1,9 @@
import { CONSTANT_PLUGIN_TYPES } from './app.constant';
BI.provider('dec.connection.provider.datebase', function() {
this.registerDatabaseType = (config: any) => {
BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config));
};
this.$get = () => BI.inherit(BI.OB, {
});
});

11
src/modules/app.service.ts

@ -1,5 +1,5 @@
import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE } from '@constants/constant'; import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE } from '@constants/constant';
import { CONSTANT_PLUGIN_TYPES, CONSTANT_PLUGIN_SHOW, CONSTANT_PLUGIN_EDIT } from '@constants/plugin'; 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[] {
@ -14,19 +14,22 @@ export function getAllDatabaseTypes():DatabaseType[] {
}), }),
]; ];
} }
function getPlugin(type: string) {
return BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES).find(item => item.databaseType === type);
}
export function getPluginWidgetShow(plugin: string) { export function getPluginWidgetShow(plugin: string) {
return BI.Constants.getConstant(CONSTANT_PLUGIN_SHOW.replace('${databaseType}', plugin)); return BI.get(getPlugin(plugin), 'show');
} }
export function getPluginWidgetEdit(plugin: string) { export function getPluginWidgetEdit(plugin: string) {
return BI.Constants.getConstant(CONSTANT_PLUGIN_EDIT.replace('${databaseType}', plugin)); return BI.get(getPlugin(plugin), 'edit');
} }
// 由于database可能为空,所以为了兼容平台和设计器,需要根据driver来判断数据库类型 // 由于database可能为空,所以为了兼容平台和设计器,需要根据driver来判断数据库类型
export function getJdbcDatabaseType(database: string, driver: string): DatabaseType { export function getJdbcDatabaseType(database: string, driver: string): DatabaseType {
let databaseType = null; let databaseType = null;
// KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driber来判断数据类型 // KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driber来判断数据类型
// DEC-10872 不能过滤other,因为新版数据连接创建的其他jdbc也是other类型,会混淆,需要和后端讨论一个最佳的解决方案。
if (database && database !== 'other' && 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); databaseType = DATA_BASE_TYPES.find(item => item.databaseType === database);
} else { } else {

1
src/modules/app.ts

@ -4,6 +4,7 @@ import { TitleXtype } from './title/title';
import { PAGE_INDEX } from './constants/constant'; import { PAGE_INDEX } from './constants/constant';
import { ConnectionXtype, DatebaseXtype, MaintainXtype, ConnectionPoolXtype } from './pages'; import { ConnectionXtype, DatebaseXtype, MaintainXtype, ConnectionPoolXtype } from './pages';
import { AppModel, AppModelXtype } from './app.model'; import { AppModel, AppModelXtype } from './app.model';
import './app.provider';
import '../less/index.less'; import '../less/index.less';
export const AppXtype = 'dec.dcm.main'; export const AppXtype = 'dec.dcm.main';

19
src/modules/constants/constant.ts

@ -1,4 +1,4 @@
import { CONSTANT_PLUGIN_TYPES } from './plugin'; import { CONSTANT_PLUGIN_TYPES } from '../app.constant';
export const PAGE_INDEX = { export const PAGE_INDEX = {
CONNECTION: 'connection', CONNECTION: 'connection',
@ -7,19 +7,18 @@ export const PAGE_INDEX = {
POOL: 'pool', POOL: 'pool',
}; };
export const OTHER_JDBC = 'otherJDBC';
export const DATEBASE_FILTER_TYPE = { export const DATEBASE_FILTER_TYPE = {
COMMONLY: 'commonly', COMMONLY: 'commonly',
ALL: 'all', ALL: 'all',
OTHER: 'other', OTHER: OTHER_JDBC,
}; };
BI.constant(CONSTANT_PLUGIN_TYPES, [
]);
export const DATA_BASE_TYPES_OTHER = export const DATA_BASE_TYPES_OTHER =
{ {
text: 'other', text: OTHER_JDBC,
databaseType: 'other', databaseType: OTHER_JDBC,
driver: '', driver: '',
url: '', url: '',
commonly: false, commonly: false,
@ -162,7 +161,7 @@ export const DATA_BASE_DRIVER_LINK = DecCst && DecCst.Hyperlink ? [
link: DecCst.Hyperlink.Database.INCEPTOR, link: DecCst.Hyperlink.Database.INCEPTOR,
}, },
{ {
databaseType: 'other', databaseType: OTHER_JDBC,
link: DecCst.Hyperlink.Database.OTHER, link: DecCst.Hyperlink.Database.OTHER,
}, },
] : []; ] : [];
@ -570,13 +569,13 @@ export const DATA_BASE_TYPES = [
}, },
{ {
text: BI.i18nText('Dec-Dcm_Connection_JDBC_Other'), text: BI.i18nText('Dec-Dcm_Connection_JDBC_Other'),
databaseType: 'other', databaseType: OTHER_JDBC,
driver: 'org.h2.Driver', driver: 'org.h2.Driver',
drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'], drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'],
url: 'jdbc:h2://${ENV_HOME}/../database', url: 'jdbc:h2://${ENV_HOME}/../database',
commonly: false, commonly: false,
internal: true, internal: true,
type: 'other', type: OTHER_JDBC,
hasSchema: true, hasSchema: true,
kerberos: false, kerberos: false,
urls: { urls: {

3
src/modules/constants/plugin.ts

@ -1,3 +0,0 @@
export const CONSTANT_PLUGIN_TYPES = 'dec.constant.database.conf.connect.types';
export const CONSTANT_PLUGIN_SHOW = 'dec.constant.database.conf.connect.form.${databaseType}.show';
export const CONSTANT_PLUGIN_EDIT = 'dec.constant.database.conf.connect.form.${databaseType}.edit';

2
src/modules/pages/connection/connection_plugin/connection_plugin.ts

@ -12,7 +12,7 @@ export class ConnectionPlugin extends BI.Widget {
return { return {
type: getPluginWidgetShow(databaseType), type: getPluginWidgetShow(databaseType),
formData: this.model.connectionSelectedOne.connectionData, value: this.model.connectionSelectedOne.connectionData,
}; };
} }
} }

8
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 { shortcut, store } from '@core/core';
import { FilterXtype } from './filter/filter'; import { FilterXtype } from './filter/filter';
import { DatebaseModel, DatebaseModelXtype } from './database.model'; 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 { connectionType } from '@constants/env';
import { DatebaseTypeXtype } from './database_type/database_type'; import { DatebaseTypeXtype } from './database_type/database_type';
import { getAllDatabaseTypes } from '../../app.service'; import { getAllDatabaseTypes } from '../../app.service';
@ -56,7 +56,7 @@ export class Datebase extends BI.Widget {
if (this.model.isPlugin) { if (this.model.isPlugin) {
datebaseTypes = [...datebaseTypes, ...this.allDatabaseTypes.filter(item => !item.internal)]; 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)); this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.commonly));
break; break;
case DATEBASE_FILTER_TYPE.OTHER: 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; break;
default: 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; break;
} }
} }

4
src/modules/pages/maintain/forms/components/form.plugin.ts

@ -18,7 +18,7 @@ export class FormPlugin extends BI.Widget {
ref: (_ref: any) => { ref: (_ref: any) => {
this.plugin = _ref; this.plugin = _ref;
}, },
formData: this.options.formData.connectionData, value: this.options.formData.connectionData,
}; };
} }
@ -29,7 +29,7 @@ export class FormPlugin extends BI.Widget {
connectionId, connectionId,
connectionType, connectionType,
connectionName, connectionName,
connectionData: this.plugin.getSubmitValue(), connectionData: this.plugin.getValue(),
}; };
} }
} }

6
webpack/webpack.prod.js

@ -51,9 +51,9 @@ module.exports = merge.smart(common, {
options: { options: {
plugins: [vars({ plugins: [vars({
variables: { variables: {
fontUrl: '/webroot/decision/resources?path=/com/fr/web/ui/font', fontUrl: '${fineServletURL}/resources?path=/com/fr/web/ui/font',
imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x', imageUrl: '${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/1x',
image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x', image2xUrl: '${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x',
} }
})] })]
}, },

Loading…
Cancel
Save