|
|
|
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',
|
|
|
|
vgap: 10,
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
el: {
|
|
|
|
type: 'bi.vertical_adapt',
|
|
|
|
cls: 'bi-border-bottom',
|
|
|
|
height: 40,
|
|
|
|
items: [{
|
|
|
|
type: 'bi.label',
|
|
|
|
textAlign: 'left',
|
|
|
|
width: 120,
|
|
|
|
cls: 'dec-font-weight-bold',
|
|
|
|
text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'),
|
|
|
|
}]
|
|
|
|
}, tgap: -10, hgap: 16,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'bi.vertical_adapt',
|
|
|
|
hgap: 16,
|
|
|
|
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;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|