fix: # 2123 Logging of user defined firewall rules

This patch relies on the corresponding patch to pve-firewall, adding the user
defined log levels for firewall rules.

By this, the user can select a per-rule log level for self defined rules. These
are independent of the global log level, which is defined in the firewall options.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-03-19 17:16:22 +01:00 committed by Thomas Lamprecht
parent fda04dd4e1
commit aa56e96eac
2 changed files with 30 additions and 7 deletions

View File

@ -53,12 +53,9 @@ Ext.define('PVE.FirewallOptions', {
subject: name,
fieldDefaults: { labelWidth: labelWidth || 100 },
items: {
xtype: 'proxmoxKVComboBox',
xtype: 'pveFirewallLogLevels',
name: name,
fieldLabel: name,
comboItems: [['nolog', 'nolog'], ['info', 'info'], ['err', 'err'],
['warning', 'warning'], ['crit', 'crit'], ['alert', 'alert'],
['emerg', 'emerg'], ['debug', 'debug']]
fieldLabel: name
}
}
};
@ -179,3 +176,16 @@ Ext.define('PVE.FirewallOptions', {
me.on('deactivate', me.rstore.stopUpdate);
}
});
Ext.define('PVE.FirewallLogLevels', {
extend: 'Proxmox.form.KVComboBox',
alias: ['widget.pveFirewallLogLevels'],
name: 'log',
fieldLabel: gettext('Log level'),
value: 'nolog',
comboItems: [['nolog', 'nolog'], ['emerg', 'emerg'], ['alert', 'alert'],
['crit', 'crit'], ['err', 'err'], ['warning', 'warning'],
['notice', 'notice'], ['info', 'info'], ['debug', 'debug']]
});

View File

@ -59,7 +59,7 @@ Ext.define('PVE.FirewallRulePanel', {
// hack: editable ComboGrid returns nothing when empty, so we need to set ''
// Also, disabled text fields return nothing, so we need to set ''
Ext.Array.each(['source', 'dest', 'macro', 'proto', 'sport', 'dport'], function(key) {
Ext.Array.each(['source', 'dest', 'macro', 'proto', 'sport', 'dport', 'log'], function(key) {
if (values[key] === undefined) {
values[key] = '';
}
@ -205,9 +205,14 @@ Ext.define('PVE.FirewallRulePanel', {
name: 'dport',
value: '',
fieldLabel: gettext('Dest. port')
},
{
xtype: 'pveFirewallLogLevels',
name: 'log',
fieldLabel: gettext('Log level')
}
];
me.columnB = [
{
xtype: 'textfield',
@ -735,6 +740,14 @@ Ext.define('PVE.FirewallRules', {
},
width: 100
},
{
header: gettext('Log level'),
dataIndex: 'log',
renderer: function(value, metaData, record) {
return render_errors('log', value, metaData, record);
},
width: 100
},
{
header: gettext('Comment'),
dataIndex: 'comment',