ui: window/FW Log Rate: eslint fixes and code cleanup/refactoring/modernize

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-05-19 16:10:04 +02:00
parent 3fb9e6f9df
commit 75728a889b

View File

@ -33,8 +33,12 @@ Ext.define('PVE.FirewallLograteInputPanel', {
{ {
xtype: 'proxmoxKVComboBox', xtype: 'proxmoxKVComboBox',
name: 'unit', name: 'unit',
comboItems: [['second', 'second'], ['minute', 'minute'], comboItems: [
['hour', 'hour'], ['day', 'day']], ['second', 'second'],
['minute', 'minute'],
['hour', 'hour'],
['day', 'day'],
],
allowBlank: false, allowBlank: false,
flex: 1, flex: 1,
value: 'second', value: 'second',
@ -52,23 +56,24 @@ Ext.define('PVE.FirewallLograteInputPanel', {
], ],
onGetValues: function(values) { onGetValues: function(values) {
var me = this; let me = this;
var vals = {}; let cfg = {
vals.enable = values.enable !== undefined ? 1 : 0; enable: values.enable !== undefined ? 1 : 0,
vals.rate = values.rate + '/' + values.unit; rate: values.rate + '/' + values.unit,
vals.burst = values.burst; burst: values.burst,
var properties = PVE.Parser.printPropertyString(vals, undefined); };
if (properties == '') { let properties = PVE.Parser.printPropertyString(cfg, undefined);
if (properties === '') {
return { 'delete': 'log_ratelimit' }; return { 'delete': 'log_ratelimit' };
} }
return { log_ratelimit: properties }; return { log_ratelimit: properties };
}, },
setValues: function(values) { setValues: function(values) {
var me = this; let me = this;
var properties = {}; let properties = {};
if (values.log_ratelimit !== undefined) { if (values.log_ratelimit !== undefined) {
properties = PVE.Parser.parsePropertyString(values.log_ratelimit, 'enable'); properties = PVE.Parser.parsePropertyString(values.log_ratelimit, 'enable');
if (properties.rate) { if (properties.rate) {