Browse Source

Merge pull request #19 in DEC/decision-webui-dcm from ~ALAN/decision-webui-dcm:feature/10.0 to feature/10.0

* commit '526233429c79cc27a2b862a73af29d611e34e80c':
  fix: 删除无用的代码
  fix: DEC-9068 根据ui变动调整代码,加入重命名功能。
  fix: socket连接的时候才进行panda是你
qufenxi
alan 5 years ago
parent
commit
f0ad005d4d
  1. 3
      i18n/zh_cn.properties
  2. 3
      private/i18n.ts
  3. 4
      src/less/font.less
  4. 3
      src/less/lib/font.less
  5. 2
      src/modules/constants/env.ts
  6. 2
      src/modules/crud/crud.typings.d.ts
  7. 2
      src/modules/crud/decision.api.ts
  8. 28
      src/modules/pages/connection/connection_jdbc/connection_jdbc.ts
  9. 31
      src/modules/pages/connection/list/list_item/list_item.model.ts
  10. 298
      src/modules/pages/connection/list/list_item/list_item.ts
  11. 4
      src/modules/pages/database/database.ts
  12. 35
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  13. 2
      src/modules/pages/maintain/forms/form.ts
  14. 1
      webpack/webpack.common.js
  15. 2
      webpack/webpack.dev.js
  16. 3
      webpack/webpack.prod.js

3
i18n/zh_cn.properties

@ -98,6 +98,9 @@ Dec-Dcm_Connection_Is_Using= 该连接正在被{R1}编辑,请稍后再试
Dec-Dcm_Connection_Check_Integer= 只允许为正整数 Dec-Dcm_Connection_Check_Integer= 只允许为正整数
Dec-Dcm_Connection_Check_Number= 只允许为数字 Dec-Dcm_Connection_Check_Number= 只允许为数字
Dec-Dcm_Connection_JDBC_Other=其他JDBC Dec-Dcm_Connection_JDBC_Other=其他JDBC
Dec-Dcm_Connection_JDBC_Warning= 请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录
Dec-Dcm_Connection_Form_UserName_Password= 用户名密码
Dec-Dcm_Change_Name= 重命名
BI-Multi_Date_Quarter_End= 季度末 BI-Multi_Date_Quarter_End= 季度末
BI-Multi_Date_Month_Begin= 月初 BI-Multi_Date_Month_Begin= 月初

3
private/i18n.ts

@ -97,6 +97,9 @@ export default {
'Dec-Dcm_Connection_Check_Integer': '只允许为正整数', 'Dec-Dcm_Connection_Check_Integer': '只允许为正整数',
'Dec-Dcm_Connection_Check_Number': '只允许为数字', 'Dec-Dcm_Connection_Check_Number': '只允许为数字',
'Dec-Dcm_Connection_JDBC_Other': '其他JDBC', 'Dec-Dcm_Connection_JDBC_Other': '其他JDBC',
'Dec-Dcm_Connection_JDBC_Warning': '请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录',
'Dec-Dcm_Connection_Form_UserName_Password': '用户名密码',
'Dec-Dcm_Change_Name': '重命名',
'BI-Multi_Date_Quarter_End': '季度末', 'BI-Multi_Date_Quarter_End': '季度末',
'BI-Multi_Date_Month_Begin': '月初', 'BI-Multi_Date_Month_Begin': '月初',
'BI-Multi_Date_YMD': '年月日', 'BI-Multi_Date_YMD': '年月日',

4
src/less/font.less

@ -6,3 +6,7 @@
.font(dcm-test-font, @font-link-test); .font(dcm-test-font, @font-link-test);
.font(dcm-delete-font, @font-link-delete); .font(dcm-delete-font, @font-link-delete);
.font(dcm-back-font, @font-arrow-left); .font(dcm-back-font, @font-arrow-left);
.font(dcm-cross-font, @font-cross);
.font(dcm-link-other-font, @font-link-other);
.font(dcm-change-name-font, @font-change-name);
.font(dcm-link-edit-font, @font-link-edit);

3
src/less/lib/font.less

@ -4,3 +4,6 @@
@font-link-test: "e763"; @font-link-test: "e763";
@font-link-info: "e63c"; @font-link-info: "e63c";
@font-link-delete: "e6c4"; @font-link-delete: "e6c4";
@font-link-other: "e796";
@font-change-name: "e6cc";
@font-link-edit: "e6ba";

2
src/modules/constants/env.ts

@ -1,5 +1,5 @@
const fineServletURL = Dec ? Dec.fineServletURL : '/webroot/decision'; const fineServletURL = Dec ? Dec.fineServletURL : '/webroot/decision';
export const ReqPrefix = `${fineServletURL}/V10/config/connection`; export const ReqPrefix = `${fineServletURL}/v10/config/connection`;
export const ImgPrefix = `${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x/icon/database/`; export const ImgPrefix = `${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x/icon/database/`;
export const connectionType = DecCst ? DecCst.Connect.ConnectionType : { export const connectionType = DecCst ? DecCst.Connect.ConnectionType : {

2
src/modules/crud/crud.typings.d.ts vendored

@ -100,7 +100,7 @@ export interface ConnectionJDBC {
*/ */
keyPath?: string; keyPath?: string;
connectionPool: ConnectionPoolJDBC; connectionPoolAttr: ConnectionPoolJDBC;
} }
export interface ConnectionPoolJDBC { export interface ConnectionPoolJDBC {

2
src/modules/crud/decision.api.ts

@ -59,7 +59,7 @@ export class DecisionApi implements Api {
private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> { private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => { return new Promise(resolve => {
if (Dec) { if (Dec && Dec.socket.connected) {
Dec.socket.emit(type, name, (re: any) => { Dec.socket.emit(type, name, (re: any) => {
resolve(re); resolve(re);
}); });

28
src/modules/pages/connection/connection_jdbc/connection_jdbc.ts

@ -16,7 +16,7 @@ export class ConnectionJdbc extends BI.Widget {
render () { render () {
const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC;
const { driver, database, host, user, newCharsetName, schema, connectionPool, port, authType, principal, keyPath, url } = connectionData; const { driver, database, host, user, newCharsetName, schema, connectionPoolAttr, port, authType, principal, keyPath, url } = connectionData;
const databaseType = getJdbcDatabaseType(database, driver); const databaseType = getJdbcDatabaseType(database, driver);
return { return {
@ -32,7 +32,7 @@ export class ConnectionJdbc extends BI.Widget {
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
value: databaseType.databaseType, value: '', // TODO: 数据库名称待适配,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
@ -47,7 +47,7 @@ export class ConnectionJdbc extends BI.Widget {
{ {
type: FormItemXtype, type: FormItemXtype,
name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'),
value: authType ? user : principal, value: authType ? principal : user,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
@ -94,57 +94,57 @@ export class ConnectionJdbc extends BI.Widget {
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'),
value: connectionPool.initialSize, value: connectionPoolAttr.initialSize,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'),
value: connectionPool.maxActive, value: connectionPoolAttr.maxActive,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'),
value: connectionPool.maxIdle, value: connectionPoolAttr.maxIdle,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'),
value: connectionPool.maxWait, value: connectionPoolAttr.maxWait,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'),
value: connectionPool.validationQuery, value: connectionPoolAttr.validationQuery,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'),
value: connectionPool.testOnBorrow, value: connectionPoolAttr.testOnBorrow,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'),
value: connectionPool.testOnReturn, value: connectionPoolAttr.testOnReturn,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'),
value: connectionPool.testWhileIdle, value: connectionPoolAttr.testWhileIdle,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'),
value: connectionPool.timeBetweenEvictionRunsMillis, value: connectionPoolAttr.timeBetweenEvictionRunsMillis,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'),
value: connectionPool.numTestsPerEvictionRun, value: connectionPoolAttr.numTestsPerEvictionRun,
}, },
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'),
value: connectionPool.minEvictableIdleTimeMillis, value: connectionPoolAttr.minEvictableIdleTimeMillis,
}, },
], ],
}, },

31
src/modules/pages/connection/list/list_item/list_item.model.ts

@ -12,9 +12,16 @@ export class ListItemModel extends Model<{
datebaseTypeSelectedOne: ConnectionModel['$$childContext']['datebaseTypeSelectedOne']; datebaseTypeSelectedOne: ConnectionModel['$$childContext']['datebaseTypeSelectedOne'];
connections: ConnectionModel['$$childContext']['connections']; connections: ConnectionModel['$$childContext']['connections'];
pageIndex: ConnectionModel['$$childContext']['pageIndex']; pageIndex: ConnectionModel['$$childContext']['pageIndex'];
datebaseTypeSelected: ConnectionModel['$$childContext']['datebaseTypeSelected'];
} }
}> { }> {
context = ['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne']; context = ['connectionSelected', 'connections', 'pageIndex', 'datebaseTypeSelectedOne', 'connectionSelectedOne', 'datebaseTypeSelected'];
state() {
return {
isEdit: false,
};
}
actions = { actions = {
setConnectionSelected: (name: string) => { setConnectionSelected: (name: string) => {
@ -35,7 +42,27 @@ export class ListItemModel extends Model<{
this.model.pageIndex = pageIndex; this.model.pageIndex = pageIndex;
}, },
testConnection: () => api.testConnection(this.model.connectionSelectedOne), testConnection: (name: string) => api.testConnection(this.model.connections.find(item => item.connectionName === name)),
getConnectionStatus() {
return api.getConnectionStatus(this.model.connectionSelected);
},
setDatebaseTypeSelected(name: string) {
this.model.datebaseTypeSelected = name;
},
setIsEdit(isEdit: boolean) {
this.model.isEdit = isEdit;
},
changeName(oldName: string, newName: string) {
const connections = this.model.connections.map(item => {
return {
...item,
connectionName: item.connectionName === oldName ? newName : item.connectionName,
connectionId: oldName,
};
});
return api.updateConnection(connections);
},
} }
removeConnection(name: string) { removeConnection(name: string) {
api.deleteConnection(name).then(re => api.getConnectionlist()) api.deleteConnection(name).then(re => api.getConnectionlist())

298
src/modules/pages/connection/list/list_item/list_item.ts

@ -1,5 +1,5 @@
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { Label, LeftRightVerticalAdapt, IconLabel, Left, IconButton, BubbleCombo, TextBubblePopupBarView } from 'ui'; import { Label, LeftRightVerticalAdapt, IconLabel, IconButton, DownListCombo, SignEditor } from 'ui';
import './list_item.less'; import './list_item.less';
import { ListItemModel, ListItemModelXtype } from './list_item.model'; import { ListItemModel, ListItemModelXtype } from './list_item.model';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
@ -21,11 +21,22 @@ export class ListItem extends BI.BasicButton {
model: ListItemModel['model']; model: ListItemModel['model'];
comboWidget: any; comboWidget: any;
nameLabel: any;
nameEditor: any;
testStatus: TestStatus; testStatus: TestStatus;
watch = {
isEdit: (isEdit: boolean) => {
this.nameLabel.setVisible(!isEdit);
this.nameEditor.setVisible(isEdit);
if (isEdit) {
this.nameEditor.focus();
}
},
}
render() { render() {
const { name, creator, databaseType } = this.options; const { name } = this.options;
const isRegistered = hasRegistered(databaseType);
return { return {
type: LeftRightVerticalAdapt, type: LeftRightVerticalAdapt,
@ -40,126 +51,195 @@ export class ListItem extends BI.BasicButton {
{ {
type: Label, type: Label,
text: name, text: name,
ref: (_ref: any) => {
this.nameLabel = _ref;
},
},
{
type: SignEditor,
value: name,
width: 100,
invisible: !this.model.isEdit,
ref: (_ref: any) => {
this.nameEditor = _ref;
},
listeners: [{
eventName: BI.SignEditor.EVENT_BLUR,
action: () => {
const newName = this.nameEditor.getValue();
this.store.changeName(name, newName).then(() => {
this.store.setIsEdit(false);
this.nameLabel.setText(newName);
});
},
}],
}, },
], ],
right: [ right: [
{ {
type: Left, type: DownListCombo,
cls: 'link-item-icon bi-background', cls: 'link-item-icon',
stopPropagation: true,
hgap: 8, hgap: 8,
items: [ el: {
{ type: IconButton,
type: IconButton, cls: 'dcm-link-other-font icon-size-16',
cls: 'dcm-test-font icon-size-16', },
title: BI.i18nText('Dec-Dcm_Test_Connection'), items: this.renderDownList(),
stopPropagation: true, listeners: [{
invisible: !isRegistered, eventName: BI.DownListCombo.EVENT_CHANGE,
handler: () => { action: (value: string) => {
this.store.setConnectionSelected(name); this.itemActionCalculate().actionClac(value);
const id = BI.UUID();
const testConnection = () => {
this.store.testConnection().then(re => {
if (re && re.errorCode) {
this.testStatus.setFail(re.errorMsg);
} else if (re.data) {
this.testStatus.setSuccess();
setTimeout(() => {
BI.Maskers.remove(id);
}, 1000 * 2);
} else {
BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_Error'), {
level: 'error',
});
BI.Maskers.remove(id);
}
});
};
BI.Maskers.create(id, null, {
render: {
type: TestStatusXtype,
loadingText: BI.i18nText('Dec-Dcm_Connection_Testing'),
loadingCls: 'upload-loading-icon',
successText: BI.i18nText('Dec-Dcm_Connection_Test_Success'),
successCls: 'upload-success-icon',
failText: BI.i18nText('Dec-Dcm_Connection_Test_Fail', name),
failCls: 'upload-fail-icon',
retryText: BI.i18nText('Dec-Dcm_Connection_ReConnect'),
ref: (_ref: any) => {
this.testStatus = _ref;
},
listeners: [
{
eventName: EVENT_RELOAD,
action: () => {
this.testStatus.setLoading();
testConnection();
},
},
{
eventName: EVENT_CLOSE,
action: () => {
BI.Maskers.remove(id);
},
},
],
},
});
BI.Maskers.show(id);
testConnection();
},
},
{
type: IconButton,
cls: 'copy-font icon-size-16',
title: BI.i18nText('Dec-Dcm_Copy'),
stopPropagation: true,
invisible: !isRegistered,
handler: () => {
this.store.setConnectionSelected(name);
this.store.setPageIndex(PAGE_INDEX.MAINTAIN);
},
},
{
type: IconButton,
cls: 'dcm-info-font icon-size-16',
title: `${BI.i18nText('Dec-Dcm_Type', databaseType)}\r\n${BI.i18nText('Dec-Dcm_Creator', creator)}`,
stopPropagation: true,
},
{
type: BubbleCombo,
stopPropagation: true,
direction: 'bottom',
ref: _ref => {
this.comboWidget = _ref;
},
el: {
type: IconLabel,
cls: 'dcm-delete-font icon-size-16',
title: BI.i18nText('Dec-Dcm_Delete'),
},
popup: {
type: TextBubblePopupBarView,
text: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'),
listeners: [{
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,
action: (ok: boolean) => {
this.comboWidget.hideView();
if (ok) {
this.store.deleteConnection(name);
}
},
}],
},
}, },
], }],
}, },
], ],
}, },
}; };
} }
private renderDownList() {
const { creator, databaseType } = this.options;
const isRegistered = hasRegistered(databaseType);
const otherIcons = [
{
text: BI.i18nText('Dec-Dcm_Type', databaseType),
cls: 'dcm-info-font',
value: 12,
},
{
text: BI.i18nText('Dec-Dcm_Creator', creator),
value: 12,
},
];
if (!isRegistered) {
return [otherIcons];
}
return [
[
{
text: BI.i18nText('Dec-Dcm_Test_Connection'),
cls: 'dcm-test-font',
value: 'test',
},
{
text: BI.i18nText('Dec-Dcm_Edit'),
cls: 'dcm-link-edit-font',
value: 'edit',
},
{
text: BI.i18nText('Dec-Dcm_Change_Name'),
cls: 'dcm-change-name-font',
value: 'changeName',
},
{
text: BI.i18nText('Dec-Dcm_Copy'),
cls: 'copy-font',
value: 'copy',
},
{
text: BI.i18nText('Dec-Dcm_Delete'),
cls: 'dcm-delete-font',
value: 'delete',
bubble: BI.i18nText('Dec-Dcm_Connection_Make_Sure_Delete'),
},
],
otherIcons,
];
}
doClick() { doClick() {
const { name } = this.options; const { name } = this.options;
this.store.setConnectionSelected(name); this.store.setConnectionSelected(name);
} }
private testConnectionAction() {
const { name } = this.options;
const id = BI.UUID();
const testConnection = () => {
this.store.testConnection(name).then(re => {
if (re && re.errorCode) {
this.testStatus.setFail(re.errorMsg);
} else if (re.data) {
this.testStatus.setSuccess();
setTimeout(() => {
BI.Maskers.remove(id);
}, 1000 * 2);
} else {
BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_Error'), {
level: 'error',
});
BI.Maskers.remove(id);
}
});
};
BI.Maskers.create(id, null, {
render: {
type: TestStatusXtype,
loadingText: BI.i18nText('Dec-Dcm_Connection_Testing'),
loadingCls: 'upload-loading-icon',
successText: BI.i18nText('Dec-Dcm_Connection_Test_Success'),
successCls: 'upload-success-icon',
failText: BI.i18nText('Dec-Dcm_Connection_Test_Fail', name),
failCls: 'upload-fail-icon',
retryText: BI.i18nText('Dec-Dcm_Connection_ReConnect'),
ref: (_ref: any) => {
this.testStatus = _ref;
},
listeners: [
{
eventName: EVENT_RELOAD,
action: () => {
this.testStatus.setLoading();
testConnection();
},
},
{
eventName: EVENT_CLOSE,
action: () => {
BI.Maskers.remove(id);
},
},
],
},
});
BI.Maskers.show(id);
testConnection();
}
private itemActionCalculate() {
const { name } = this.options;
const actionsMap = {
test: this.testConnectionAction.bind(this),
edit: () => {
this.store.setConnectionSelected(name);
this.store.getConnectionStatus().then(re => {
if (re.data && re.data === 'success') {
this.store.setPageIndex(PAGE_INDEX.MAINTAIN);
this.store.setDatebaseTypeSelected('');
} else {
BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_Is_Using', re.errorMsg), {
level: 'error',
});
}
});
},
changeName: () => {
this.store.setIsEdit(true);
},
copy: () => {
this.store.setConnectionSelected(name);
this.store.setPageIndex(PAGE_INDEX.MAINTAIN);
},
delete: () => {
this.store.deleteConnection(name);
},
};
return {
actionClac: (name: string) => actionsMap[name] && actionsMap[name](),
};
}
} }

4
src/modules/pages/database/database.ts

@ -141,7 +141,7 @@ export class Datebase extends BI.Widget {
{ {
el: { el: {
type: VerticalAdapt, type: VerticalAdapt,
hgap: 5, hgap: 20,
invisible: true, invisible: true,
items: [ items: [
{ {
@ -186,7 +186,7 @@ export class Datebase extends BI.Widget {
}, },
{ {
type: ButtonGroup, type: ButtonGroup,
hgap: 5, hgap: 15,
layouts: [{ layouts: [{
type: Left, type: Left,
scrolly: true, scrolly: true,

35
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -23,6 +23,7 @@ export class FormJdbc extends BI.Widget {
formPassword: any; formPassword: any;
formPrincipal: any; formPrincipal: any;
formKeyPath: any; formKeyPath: any;
labelTips: any;
form = { form = {
connectionName: null, connectionName: null,
@ -53,9 +54,9 @@ export class FormJdbc extends BI.Widget {
render() { render() {
const { connectionName, connectionData } = this.options.formData; const { connectionName, connectionData } = this.options.formData;
const { driver, host, port, user, password, newCharsetName, schema, url, connectionPool, database, authType, principal, keyPath } = connectionData as ConnectionJDBC; const { driver, host, port, user, password, newCharsetName, schema, url, connectionPoolAttr, database, authType, principal, keyPath } = connectionData as ConnectionJDBC;
// minIdle 暂未使用 // minIdle 暂未使用
const { initialSize, maxActive, maxIdle, maxWait, validationQuery, testOnBorrow, testOnReturn, testWhileIdle, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis } = connectionPool as ConnectionPoolJDBC; const { initialSize, maxActive, maxIdle, maxWait, validationQuery, testOnBorrow, testOnReturn, testWhileIdle, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis } = connectionPoolAttr as ConnectionPoolJDBC;
const databaseType = getJdbcDatabaseType(database, driver); const databaseType = getJdbcDatabaseType(database, driver);
this.oldPassword = password; this.oldPassword = password;
@ -111,9 +112,8 @@ export class FormJdbc extends BI.Widget {
type: TextEditor, type: TextEditor,
width: 300, width: 300,
allowBlank: true, allowBlank: true,
disabled: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'),
value: databaseType.databaseType, value: '', // TODO: 数据库名称待适配
ref: (_ref: any) => { ref: (_ref: any) => {
this.form.database = _ref; this.form.database = _ref;
}, },
@ -172,7 +172,7 @@ export class FormJdbc extends BI.Widget {
}, },
items: [ items: [
{ {
text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), text: BI.i18nText('Dec-Dcm_Connection_Form_UserName_Password'),
value: '', value: '',
}, },
{ {
@ -189,6 +189,7 @@ export class FormJdbc extends BI.Widget {
this.formKeyPath.setVisible(!!type); this.formKeyPath.setVisible(!!type);
this.formUser.setVisible(!type); this.formUser.setVisible(!type);
this.formPassword.setVisible(!type); this.formPassword.setVisible(!type);
this.labelTips.setVisible(!!type);
}, },
}, },
], ],
@ -269,6 +270,16 @@ export class FormJdbc extends BI.Widget {
}, },
}], }],
}, },
{
type: Label,
cls: 'bi-tips',
textAlign: 'left',
invisible: true,
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Warning'),
ref: (_ref: any) => {
this.labelTips = _ref;
},
},
{ {
type: FormItemXtype, type: FormItemXtype,
name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
@ -590,16 +601,16 @@ export class FormJdbc extends BI.Widget {
public getSubmitValue():Connection { public getSubmitValue():Connection {
const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionData = this.options.formData.connectionData as ConnectionJDBC;
const connectionPool = connectionData.connectionPool; const connectionPoolAttr = connectionData.connectionPoolAttr;
return { return {
connectionType: connectionType.JDBC, connectionType: connectionType.JDBC,
connectionId: this.form.connectionName.getValue(), connectionId: this.form.connectionName.getValue(),
connectionName: this.form.connectionName.getValue(), connectionName: this.form.connectionName.getValue(),
connectionData: { connectionData: {
database: this.form.database.getValue(), database: connectionData.database,
connectionName: this.form.connectionName.getValue(), connectionName: this.form.connectionName.getValue(),
driver: this.form.driver.getValue()[0], driver: this.form.driver.getValue(),
url: this.form.url.getValue(), url: this.form.url.getValue(),
user: this.form.user.getValue(), user: this.form.user.getValue(),
password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.encode(this.form.password.getValue()), password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.encode(this.form.password.getValue()),
@ -613,15 +624,15 @@ export class FormJdbc extends BI.Widget {
creator: Dec ? Dec.personal.username : '', creator: Dec ? Dec.personal.username : '',
principal: this.form.principal.getValue(), principal: this.form.principal.getValue(),
keyPath: this.form.principal.getValue(), keyPath: this.form.principal.getValue(),
connectionPool: { connectionPoolAttr: {
initialSize: this.form.initialSize.getValue(), initialSize: this.form.initialSize.getValue(),
maxActive: this.form.maxActive.getValue(), maxActive: this.form.maxActive.getValue(),
maxIdle: this.form.maxIdle.getValue(), maxIdle: this.form.maxIdle.getValue(),
maxWait: this.form.maxWait.getValue(), maxWait: this.form.maxWait.getValue(),
validationQuery: this.form.validationQuery.getValue(), validationQuery: this.form.validationQuery.getValue(),
testOnBorrow: this.form.testOnBorrow.getValue()[0] || connectionPool.testOnBorrow, testOnBorrow: this.form.testOnBorrow.getValue()[0] || connectionPoolAttr.testOnBorrow,
testOnReturn: this.form.testOnReturn.getValue()[0] || connectionPool.testOnReturn, testOnReturn: this.form.testOnReturn.getValue()[0] || connectionPoolAttr.testOnReturn,
testWhileIdle: this.form.testWhileIdle.getValue()[0] || connectionPool.testWhileIdle, testWhileIdle: this.form.testWhileIdle.getValue()[0] || connectionPoolAttr.testWhileIdle,
timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(),
numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(),
minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(),

2
src/modules/pages/maintain/forms/form.ts

@ -134,7 +134,7 @@ export class MaintainForm extends BI.Widget {
url: this.model.datebaseTypeSelectedOne.url, url: this.model.datebaseTypeSelectedOne.url,
database: this.model.datebaseTypeSelectedOne.databaseType, database: this.model.datebaseTypeSelectedOne.databaseType,
connectionName, connectionName,
connectionPool: DEFAULT_JDBC_POOL, connectionPoolAttr: DEFAULT_JDBC_POOL,
port:'', port:'',
host: 'localhost', host: 'localhost',
}; };

1
webpack/webpack.common.js

@ -50,7 +50,6 @@ module.exports = {
plugins: [vars({ plugins: [vars({
variables: { variables: {
fontUrl: '../node_modules/fineui/dist/font/', fontUrl: '../node_modules/fineui/dist/font/',
fontReportUrl: '../assets/font',
imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x', imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x',
image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x', image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x',
} }

2
webpack/webpack.dev.js

@ -47,7 +47,7 @@ module.exports = merge(common, {
port: 10002, port: 10002,
liveReload: true, liveReload: true,
proxy: { proxy: {
'/webroot/decision/V10': { '/webroot/decision/v10': {
target: 'http://api.fanruan.design/mock/135/', target: 'http://api.fanruan.design/mock/135/',
secure: false, secure: false,
}, },

3
webpack/webpack.prod.js

@ -38,8 +38,7 @@ module.exports = merge.smart(common, {
options: { options: {
plugins: [vars({ plugins: [vars({
variables: { variables: {
fontUrl: '../node_modules/fineui/dist/font/', fontUrl: '/webroot/decision/resources?path=/com/fr/web/ui/font',
fontReportUrl: '../assets/font',
imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x', imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x',
image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x', image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x',
} }

Loading…
Cancel
Save