From 566b8b9ed64372dcfb32c68bc2e33a2ae79495e7 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 24 Oct 2022 14:55:01 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-82479=20feat:=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=B6=85=E6=97=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 4 +- src/modules/app.ts | 24 +++++++ src/modules/crud/decision.api.ts | 8 +++ src/modules/pages/setting/setting.ts | 94 ++++++++++++++++++++++++++++ src/modules/title/title.ts | 8 +++ 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 src/modules/pages/setting/setting.ts 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.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/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',