You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
3.1 KiB
94 lines
3.1 KiB
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; |
|
}, |
|
}; |
|
} |
|
} |