Browse Source

Merge pull request #6193 in DEC/decision-webui-dcm from release/11.0 to bugfix/11.0

* commit '03654614c4e3f0c3dd18158ed24973acde360f05':
  REPORT-82479 feat:添加数据连接超时设置页面
bugfix/11.0
superman 2 years ago
parent
commit
d59d7fcd8c
  1. 4
      i18n/zh_cn.properties
  2. 24
      src/modules/app.ts
  3. 8
      src/modules/crud/decision.api.ts
  4. 94
      src/modules/pages/setting/setting.ts
  5. 8
      src/modules/title/title.ts

4
i18n/zh_cn.properties

@ -311,4 +311,6 @@ Dec-Dcm_Connection_Value_Out_Range=数值超出范围
Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突
Dec-Dcm_Connection_File_Upload_ErrorTip1= 参考 Dec-Dcm_Connection_File_Upload_ErrorTip1= 参考
Dec-Dcm_Connection_File_Upload_ErrorTip2= kerberos配置 Dec-Dcm_Connection_File_Upload_ErrorTip2= kerberos配置
Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持
Dec-Dcm_Connection_Timeout_Detection=数据连接超时检测
Dec-Dcm_Connection_Timeout_Millisecond=毫秒(ms)

24
src/modules/app.ts

@ -7,6 +7,7 @@ import { Tab } from '@fui/core';
import { Datebase } from './pages/database/database'; import { Datebase } from './pages/database/database';
import { Maintain } from './pages/maintain/maintain'; import { Maintain } from './pages/maintain/maintain';
import { ConnectionPool } from './pages/connection_pool/connection_pool'; import { ConnectionPool } from './pages/connection_pool/connection_pool';
import { TimeOutSetting } from './pages/setting/setting';
import './app.provider'; import './app.provider';
import '../less/index.less'; import '../less/index.less';
@ -38,6 +39,12 @@ export class App extends BI.Widget {
el: { el: {
type: Title.xtype, type: Title.xtype,
cls: 'bi-border-bottom', cls: 'bi-border-bottom',
listeners: [{
eventName: 'EVENT_CLICK_SETTING',
action:() => {
this._setting();
},
}]
}, },
height: 40, 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);
}
} }

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

@ -128,6 +128,14 @@ export class DecisionApi implements Api {
return requestGet(`/principals?keytabPath=${keytab}`, {}); 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<SocketResult> { private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => { return new Promise(resolve => {
if (Dec && Dec.socket.connected) { if (Dec && Dec.socket.connected) {

94
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;
},
};
}
}

8
src/modules/title/title.ts

@ -31,6 +31,14 @@ export class Title extends BI.Widget {
type: BI.LeftRightVerticalAdaptLayout.xtype, type: BI.LeftRightVerticalAdaptLayout.xtype,
items: { items: {
left: [ left: [
{
type: 'bi.icon_button',
cls: 'setting-font',
_lgap: 15,
handler: () => {
this.fireEvent('EVENT_CLICK_SETTING');
},
},
{ {
type: BI.LinearSegment.xtype, type: BI.LinearSegment.xtype,
cls: 'bi-font-bold', cls: 'bi-font-bold',

Loading…
Cancel
Save