From e4f4d188e56d3de99287dc517704b01d96e774bd Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 22 Aug 2019 16:03:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-9068=20=E6=A0=B9=E6=8D=AEui=E5=8F=98?= =?UTF-8?q?=E5=8A=A8=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E9=87=8D=E5=91=BD=E5=90=8D=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 3 + private/i18n.ts | 3 + src/less/font.less | 6 +- src/less/lib/font.less | 5 +- src/modules/constants/env.ts | 2 +- src/modules/crud/crud.typings.d.ts | 2 +- .../connection_jdbc/connection_jdbc.ts | 28 +- .../connection/list/list_item/icon_text.ts | 33 ++ .../list/list_item/list_item.model.ts | 31 +- .../connection/list/list_item/list_item.ts | 299 +++++++++++------- src/modules/pages/database/database.ts | 4 +- .../maintain/forms/components/form.jdbc.ts | 35 +- src/modules/pages/maintain/forms/form.ts | 2 +- webpack/webpack.common.js | 1 - webpack/webpack.dev.js | 2 +- webpack/webpack.prod.js | 3 +- 16 files changed, 311 insertions(+), 148 deletions(-) create mode 100644 src/modules/pages/connection/list/list_item/icon_text.ts diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 627410d..f436552 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -98,6 +98,9 @@ Dec-Dcm_Connection_Is_Using= 该连接正在被{R1}编辑,请稍后再试 Dec-Dcm_Connection_Check_Integer= 只允许为正整数 Dec-Dcm_Connection_Check_Number= 只允许为数字 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_Month_Begin= 月初 diff --git a/private/i18n.ts b/private/i18n.ts index 8177324..8a5abbb 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -97,6 +97,9 @@ export default { 'Dec-Dcm_Connection_Check_Integer': '只允许为正整数', 'Dec-Dcm_Connection_Check_Number': '只允许为数字', '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_Month_Begin': '月初', 'BI-Multi_Date_YMD': '年月日', diff --git a/src/less/font.less b/src/less/font.less index 5d864ff..832beb8 100644 --- a/src/less/font.less +++ b/src/less/font.less @@ -5,4 +5,8 @@ .font(dcm-info-font, @font-link-info); .font(dcm-test-font, @font-link-test); .font(dcm-delete-font, @font-link-delete); -.font(dcm-back-font, @font-arrow-left); \ No newline at end of file +.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); \ No newline at end of file diff --git a/src/less/lib/font.less b/src/less/lib/font.less index 8007a5c..f053c74 100644 --- a/src/less/lib/font.less +++ b/src/less/lib/font.less @@ -3,4 +3,7 @@ @font-link: "e759"; @font-link-test: "e763"; @font-link-info: "e63c"; -@font-link-delete: "e6c4"; \ No newline at end of file +@font-link-delete: "e6c4"; +@font-link-other: "e796"; +@font-change-name: "e6cc"; +@font-link-edit: "e6ba"; \ No newline at end of file diff --git a/src/modules/constants/env.ts b/src/modules/constants/env.ts index 5f267f7..71785e6 100644 --- a/src/modules/constants/env.ts +++ b/src/modules/constants/env.ts @@ -1,5 +1,5 @@ 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 connectionType = DecCst ? DecCst.Connect.ConnectionType : { diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 5f51438..2f21b0c 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -100,7 +100,7 @@ export interface ConnectionJDBC { */ keyPath?: string; - connectionPool: ConnectionPoolJDBC; + connectionPoolAttr: ConnectionPoolJDBC; } export interface ConnectionPoolJDBC { diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 59c5221..40a2ae8 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -16,7 +16,7 @@ export class ConnectionJdbc extends BI.Widget { render () { 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); return { @@ -32,7 +32,7 @@ export class ConnectionJdbc extends BI.Widget { { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - value: databaseType.databaseType, + value: '', // TODO: 数据库名称待适配, }, { type: FormItemXtype, @@ -47,7 +47,7 @@ export class ConnectionJdbc extends BI.Widget { { type: FormItemXtype, 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, @@ -94,57 +94,57 @@ export class ConnectionJdbc extends BI.Widget { { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - value: connectionPool.initialSize, + value: connectionPoolAttr.initialSize, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), - value: connectionPool.maxActive, + value: connectionPoolAttr.maxActive, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - value: connectionPool.maxIdle, + value: connectionPoolAttr.maxIdle, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), - value: connectionPool.maxWait, + value: connectionPoolAttr.maxWait, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), - value: connectionPool.validationQuery, + value: connectionPoolAttr.validationQuery, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), - value: connectionPool.testOnBorrow, + value: connectionPoolAttr.testOnBorrow, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - value: connectionPool.testOnReturn, + value: connectionPoolAttr.testOnReturn, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - value: connectionPool.testWhileIdle, + value: connectionPoolAttr.testWhileIdle, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - value: connectionPool.timeBetweenEvictionRunsMillis, + value: connectionPoolAttr.timeBetweenEvictionRunsMillis, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - value: connectionPool.numTestsPerEvictionRun, + value: connectionPoolAttr.numTestsPerEvictionRun, }, { type: FormItemXtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - value: connectionPool.minEvictableIdleTimeMillis, + value: connectionPoolAttr.minEvictableIdleTimeMillis, }, ], }, diff --git a/src/modules/pages/connection/list/list_item/icon_text.ts b/src/modules/pages/connection/list/list_item/icon_text.ts new file mode 100644 index 0000000..07161e4 --- /dev/null +++ b/src/modules/pages/connection/list/list_item/icon_text.ts @@ -0,0 +1,33 @@ +import { shortcut } from '@core/core'; +import { IconButton, Left, Label } from 'ui'; + +export const IconTextXtype = 'dec.dcm.connection.list_item.icon_text'; +@shortcut(IconTextXtype) +export class IconText extends BI.BasicButton { + props = { + iconCls: '', + text: '', + height: 25, + } + + render() { + const { iconCls, text } = this.options; + + return { + type: Left, + items: [ + { + type: IconButton, + cls: `${iconCls} icon-size-16`, + title: text, + stopPropagation: true, + }, + { + type: Label, + text, + }, + ], + }; + } +} + diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index 82c3f87..946d63e 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/src/modules/pages/connection/list/list_item/list_item.model.ts @@ -12,9 +12,16 @@ export class ListItemModel extends Model<{ datebaseTypeSelectedOne: ConnectionModel['$$childContext']['datebaseTypeSelectedOne']; connections: ConnectionModel['$$childContext']['connections']; 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 = { setConnectionSelected: (name: string) => { @@ -35,7 +42,27 @@ export class ListItemModel extends Model<{ 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) { api.deleteConnection(name).then(re => api.getConnectionlist()) diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index a0a0156..c83ef09 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -1,10 +1,11 @@ import { shortcut, store } from '@core/core'; -import { Label, LeftRightVerticalAdapt, IconLabel, Left, IconButton, BubbleCombo, TextBubblePopupBarView } from 'ui'; +import { Label, LeftRightVerticalAdapt, IconLabel, Left, IconButton, BubbleCombo, TextBubblePopupBarView, DownListCombo, Vertical, ButtonGroup, SignEditor } from 'ui'; import './list_item.less'; import { ListItemModel, ListItemModelXtype } from './list_item.model'; import { PAGE_INDEX } from '@constants/constant'; import { TestStatusXtype, TestStatus, EVENT_CLOSE, EVENT_RELOAD } from 'src/modules/components/test_status/test_status'; import { hasRegistered } from '../list.service'; +import { IconTextXtype } from './icon_text'; export const ListItemXtype = 'dec.dcm.connection.list_item'; @shortcut(ListItemXtype) @store(ListItemModelXtype) @@ -21,11 +22,22 @@ export class ListItem extends BI.BasicButton { model: ListItemModel['model']; comboWidget: any; + nameLabel: any; + nameEditor: any; testStatus: TestStatus; + watch = { + isEdit: (isEdit: boolean) => { + this.nameLabel.setVisible(!isEdit); + this.nameEditor.setVisible(isEdit); + if (isEdit) { + this.nameEditor.focus(); + } + }, + } + render() { - const { name, creator, databaseType } = this.options; - const isRegistered = hasRegistered(databaseType); + const { name } = this.options; return { type: LeftRightVerticalAdapt, @@ -40,126 +52,195 @@ export class ListItem extends BI.BasicButton { { type: Label, 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: [ { - type: Left, - cls: 'link-item-icon bi-background', + type: DownListCombo, + cls: 'link-item-icon', + stopPropagation: true, hgap: 8, - items: [ - { - type: IconButton, - cls: 'dcm-test-font icon-size-16', - title: BI.i18nText('Dec-Dcm_Test_Connection'), - stopPropagation: true, - invisible: !isRegistered, - handler: () => { - this.store.setConnectionSelected(name); - 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); - } - }, - }], - }, + el: { + type: IconButton, + cls: 'dcm-link-other-font icon-size-16', + }, + items: this.renderDownList(), + listeners: [{ + eventName: BI.DownListCombo.EVENT_CHANGE, + action: (value: string) => { + this.itemActionCalculate().actionClac(value); }, - ], + }], + }, ], }, }; } + 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() { const { name } = this.options; 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](), + }; + } } diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index 8202c99..2561a37 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -141,7 +141,7 @@ export class Datebase extends BI.Widget { { el: { type: VerticalAdapt, - hgap: 5, + hgap: 20, invisible: true, items: [ { @@ -186,7 +186,7 @@ export class Datebase extends BI.Widget { }, { type: ButtonGroup, - hgap: 5, + hgap: 15, layouts: [{ type: Left, scrolly: true, diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 57a8347..1e46471 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -23,6 +23,7 @@ export class FormJdbc extends BI.Widget { formPassword: any; formPrincipal: any; formKeyPath: any; + labelTips: any; form = { connectionName: null, @@ -53,9 +54,9 @@ export class FormJdbc extends BI.Widget { render() { 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 暂未使用 - 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); this.oldPassword = password; @@ -111,9 +112,8 @@ export class FormJdbc extends BI.Widget { type: TextEditor, width: 300, allowBlank: true, - disabled: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - value: databaseType.databaseType, + value: '', // TODO: 数据库名称待适配 ref: (_ref: any) => { this.form.database = _ref; }, @@ -172,7 +172,7 @@ export class FormJdbc extends BI.Widget { }, items: [ { - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName_Password'), value: '', }, { @@ -189,6 +189,7 @@ export class FormJdbc extends BI.Widget { this.formKeyPath.setVisible(!!type); this.formUser.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, name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), @@ -590,16 +601,16 @@ export class FormJdbc extends BI.Widget { public getSubmitValue():Connection { const connectionData = this.options.formData.connectionData as ConnectionJDBC; - const connectionPool = connectionData.connectionPool; + const connectionPoolAttr = connectionData.connectionPoolAttr; return { connectionType: connectionType.JDBC, connectionId: this.form.connectionName.getValue(), connectionName: this.form.connectionName.getValue(), connectionData: { - database: this.form.database.getValue(), + database: connectionData.database, connectionName: this.form.connectionName.getValue(), - driver: this.form.driver.getValue()[0], + driver: this.form.driver.getValue(), url: this.form.url.getValue(), user: this.form.user.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 : '', principal: this.form.principal.getValue(), keyPath: this.form.principal.getValue(), - connectionPool: { + connectionPoolAttr: { initialSize: this.form.initialSize.getValue(), maxActive: this.form.maxActive.getValue(), maxIdle: this.form.maxIdle.getValue(), maxWait: this.form.maxWait.getValue(), validationQuery: this.form.validationQuery.getValue(), - testOnBorrow: this.form.testOnBorrow.getValue()[0] || connectionPool.testOnBorrow, - testOnReturn: this.form.testOnReturn.getValue()[0] || connectionPool.testOnReturn, - testWhileIdle: this.form.testWhileIdle.getValue()[0] || connectionPool.testWhileIdle, + testOnBorrow: this.form.testOnBorrow.getValue()[0] || connectionPoolAttr.testOnBorrow, + testOnReturn: this.form.testOnReturn.getValue()[0] || connectionPoolAttr.testOnReturn, + testWhileIdle: this.form.testWhileIdle.getValue()[0] || connectionPoolAttr.testWhileIdle, timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index eebbbf6..2f7323b 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -134,7 +134,7 @@ export class MaintainForm extends BI.Widget { url: this.model.datebaseTypeSelectedOne.url, database: this.model.datebaseTypeSelectedOne.databaseType, connectionName, - connectionPool: DEFAULT_JDBC_POOL, + connectionPoolAttr: DEFAULT_JDBC_POOL, port:'', host: 'localhost', }; diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index 0d9443a..ef583b9 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -50,7 +50,6 @@ module.exports = { plugins: [vars({ variables: { fontUrl: '../node_modules/fineui/dist/font/', - fontReportUrl: '../assets/font', imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x', image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x', } diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index e0f236e..2120e40 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -47,7 +47,7 @@ module.exports = merge(common, { port: 10002, liveReload: true, proxy: { - '/webroot/decision/V10': { + '/webroot/decision/v10': { target: 'http://api.fanruan.design/mock/135/', secure: false, }, diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index 0d3e082..4bb3786 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -38,8 +38,7 @@ module.exports = merge.smart(common, { options: { plugins: [vars({ variables: { - fontUrl: '../node_modules/fineui/dist/font/', - fontReportUrl: '../assets/font', + fontUrl: '/webroot/decision/resources?path=/com/fr/web/ui/font', imageUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/1x', image2xUrl: '/webroot/decision/resources?path=/com/fr/web/resources/dist/images/2x', }