]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/window/FirewallLograteEdit.js
ui: eslint: fix trailing comma and comma related whitespaces errors
[pve-manager.git] / www / manager6 / window / FirewallLograteEdit.js
CommitLineData
40120a31
CE
1Ext.define('PVE.FirewallLograteInputPanel', {
2 extend: 'Proxmox.panel.InputPanel',
3 xtype: 'pveFirewallLograteInputPanel',
4
5 viewModel: {},
6
7 items: [
8 {
9 xtype: 'proxmoxcheckbox',
10 name: 'enable',
11 reference: 'enable',
12 fieldLabel: gettext('Enable'),
f6710aac 13 value: true,
40120a31
CE
14 },
15 {
16 layout: 'hbox',
17 border: false,
18 items: [
19 {
20 xtype: 'numberfield',
21 name: 'rate',
22 fieldLabel: gettext('Log rate limit'),
23 minValue: 1,
24 maxValue: 99,
25 allowBlank: false,
26 flex: 2,
f6710aac 27 value: 1,
40120a31
CE
28 },
29 {
df93368f 30 xtype: 'box',
f6710aac 31 html: '<div style="margin: auto; padding: 2.5px;"><b>/</b></div>',
40120a31
CE
32 },
33 {
34 xtype: 'proxmoxKVComboBox',
35 name: 'unit',
36 comboItems: [['second', 'second'], ['minute', 'minute'],
37 ['hour', 'hour'], ['day', 'day']],
38 allowBlank: false,
39 flex: 1,
f6710aac
TL
40 value: 'second',
41 },
42 ],
40120a31
CE
43 },
44 {
45 xtype: 'numberfield',
46 name: 'burst',
47 fieldLabel: gettext('Log burst limit'),
48 minValue: 1,
49 maxValue: 99,
f6710aac
TL
50 value: 5,
51 },
40120a31
CE
52 ],
53
54 onGetValues: function(values) {
55 var me = this;
56
57 var vals = {};
58 vals.enable = values.enable !== undefined ? 1 : 0;
59 vals.rate = values.rate + '/' + values.unit;
60 vals.burst = values.burst;
61 var properties = PVE.Parser.printPropertyString(vals, undefined);
62 if (properties == '') {
63 return { 'delete': 'log_ratelimit' };
64 }
65 return { log_ratelimit: properties };
66 },
67
68 setValues: function(values) {
69 var me = this;
70
71 var properties = {};
72 if (values.log_ratelimit !== undefined) {
f6632d26
TL
73 properties = PVE.Parser.parsePropertyString(values.log_ratelimit, 'enable');
74 if (properties.rate) {
75 var matches = properties.rate.match(/^(\d+)\/(second|minute|hour|day)$/);
76 if (matches) {
77 properties.rate = matches[1];
78 properties.unit = matches[2];
79 }
40120a31
CE
80 }
81 }
82 me.callParent([properties]);
f6710aac 83 },
40120a31
CE
84});
85
86Ext.define('PVE.FirewallLograteEdit', {
87 extend: 'Proxmox.window.Edit',
88 xtype: 'pveFirewallLograteEdit',
89
90 subject: gettext('Log rate limit'),
91
92 items: [{
f6710aac 93 xtype: 'pveFirewallLograteInputPanel',
40120a31 94 }],
f6710aac 95 autoLoad: true,
40120a31 96});