diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 3170f13..7e5e8a1 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -311,4 +311,6 @@ Dec-Dcm_Connection_Value_Out_Range=数值超出范围 Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 Dec-Dcm_Connection_File_Upload_ErrorTip1= 参考 Dec-Dcm_Connection_File_Upload_ErrorTip2= kerberos配置 -Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 \ No newline at end of file +Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 +Dec-Dcm_Connection_Timeout_Detection=数据连接超时检测 +Dec-Dcm_Connection_Timeout_Millisecond=毫秒(ms) \ No newline at end of file diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index e888267..f3e9a60 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -35,6 +35,17 @@ BI.provider('dec.connection.provider.datebase', function() { }; } + // 处理SAP HANA数据连接url + const sapHanaUrl = url.match(/^jdbc:(sap):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?([^]+)?(.*)/i); + if (sapHanaUrl) { + return { + host: sapHanaUrl[5], + port: sapHanaUrl[7] === 'port' ? '' : sapHanaUrl[7], + databaseName: '', + urlInfo: sapHanaUrl[9], + }; + } + // 处理oracle的RAC方式 if (/^jdbc:oracle:thin:([0-9a-zA-Z/]*)?@\(DESCRIPTION/i.test(url)) { const host = url.match(/\(HOST\s*=\s*([0-9a-zA-Z_\\.-]+)\)/i); diff --git a/src/modules/app.ts b/src/modules/app.ts index c347927..5155f5b 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -7,6 +7,7 @@ import { Tab } from '@fui/core'; import { Datebase } from './pages/database/database'; import { Maintain } from './pages/maintain/maintain'; import { ConnectionPool } from './pages/connection_pool/connection_pool'; +import { TimeOutSetting } from './pages/setting/setting'; import './app.provider'; import '../less/index.less'; @@ -38,6 +39,12 @@ export class App extends BI.Widget { el: { type: Title.xtype, cls: 'bi-border-bottom', + listeners: [{ + eventName: 'EVENT_CLICK_SETTING', + action:() => { + this._setting(); + }, + }] }, height: 40, }, @@ -84,4 +91,21 @@ export class App extends BI.Widget { ], }; } + + private _setting() { + const settingLayerId = BI.UUID(); + BI.Layers.create(settingLayerId, null, { + container: this, + render: { + type: TimeOutSetting.xtype, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + BI.Layers.remove(settingLayerId); + }, + }], + }, + }, this); + BI.Layers.show(settingLayerId); + } } diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 9a6b406..01892c0 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -157,8 +157,6 @@ export class FileUpload extends BI.Widget { handler: function () { NProgress.set(0.0); self.xhr.abort(); - self.uploadButton.setEnable(true); - self.fileInfo.setVisible(false); self.store.setFileName(''); self.clearInfo(); self.fireEvent(FileUpload.EVENT_CLEAR_FILE); @@ -308,6 +306,7 @@ export class FileUpload extends BI.Widget { public clearInfo() { this.uploadButton.setEnable(true); this.fileInfo.setVisible(false); + this.errorInfo.setVisible(false); this.textEditor.setValue(''); this.options.attachId = ''; } diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index d399399..3ad6470 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -128,6 +128,14 @@ export class DecisionApi implements Api { return requestGet(`/principals?keytabPath=${keytab}`, {}); } + getTimeOut(): Promise<{ data?: any }> { + return requestGet('kdc/timeout', {}); + } + + putTimeOut(value: number) { + return requestPut(`kdc/timeout?timeout=${value}`, {}) + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts new file mode 100644 index 0000000..eaddc96 --- /dev/null +++ b/src/modules/pages/setting/setting.ts @@ -0,0 +1,94 @@ +import { shortcut } from '@core/core'; +import { ApiFactory } from 'src/modules/crud/apiFactory'; + +const api = new ApiFactory().create(); + +@shortcut() +export class TimeOutSetting extends BI.Widget { + public static xtype = 'dec.dcm.page.timeout.setting'; + + public props = { + value: 0, + }; + + beforeRender(cb: Function) { + const self = this; + api.getTimeOut().then(res => { + self.props.value = res.data.count; + cb(); + }); + } + + public render() { + const { value } = this.props; + const self = this; + + return { + type: 'bi.vtape', + cls: 'bi-background', + items: [{ + type: 'dec.setting.header', + height: 40, + listeners: [{ + eventName: 'EVENT_CANCEL', + action: function () { + self.fireEvent('EVENT_CHANGE'); + }, + }, { + eventName: 'EVENT_SAVE', + action: function () { + api.putTimeOut(Number(self.editor.getValue())); + self.fireEvent('EVENT_CHANGE'); + }, + }], + }, { + type: 'bi.vertical', + cls: 'bi-card', + hgap: 10, + vgap: 10, + items: [ + { + type: 'bi.vertical_adapt', + cls: 'bi-border-bottom', + height: 32, + items: [{ + type: 'bi.label', + textAlign: 'left', + width: 120, + cls: 'dec-font-weight-bold', + text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), + }] + }, + { + type: 'bi.vertical_adapt', + items: [{ + type: 'dec.label.editor.item', + text: BI.i18nText('Dec-Over_Time'), + textWidth: 100, + editorWidth: 80, + allowBlank: false, + value: value, + validationChecker: function(v) { + return BI.isPositiveInteger(v); + }, + errorText: BI.i18nText('BI-Please_Input_Positive_Integer'), + ref: function (_ref) { + self.editor = _ref; + }, + }, { + el: { + type: 'bi.label', + text: BI.i18nText('Dec-Dcm_Connection_Timeout_Millisecond'), + }, + lgap: 10, + }] + + }, + ] + }], + ref: function (_ref) { + self.setting = _ref; + }, + }; + } +} \ No newline at end of file diff --git a/src/modules/title/title.ts b/src/modules/title/title.ts index dc85b0f..73d936b 100644 --- a/src/modules/title/title.ts +++ b/src/modules/title/title.ts @@ -31,6 +31,14 @@ export class Title extends BI.Widget { type: BI.LeftRightVerticalAdaptLayout.xtype, items: { left: [ + { + type: 'bi.icon_button', + cls: 'setting-font', + _lgap: 15, + handler: () => { + this.fireEvent('EVENT_CLICK_SETTING'); + }, + }, { type: BI.LinearSegment.xtype, cls: 'bi-font-bold',