[pve-devel] [RFC v2 manager 1/1] fix: # 2123 Logging of user defined firewall rules
Christian Ebner
c.ebner at proxmox.com
Mon Mar 18 17:05:54 CET 2019
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 at proxmox.com>
---
Version 2:
* Introduced PVE.FirewallLogLevel to share it between FirewallOptions.js and
FirewallRules.js
* Reordered elements of the array to be in order of the corresponding numeric
value from the log_level_hash as defined in pve-firewall/src/PVE/Firewall.pm
www/manager6/grid/FirewallOptions.js | 20 +++++++++++++++-----
www/manager6/grid/FirewallRules.js | 17 +++++++++++++++--
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/www/manager6/grid/FirewallOptions.js b/www/manager6/grid/FirewallOptions.js
index 1d56ecc0..f2e65fbc 100644
--- a/www/manager6/grid/FirewallOptions.js
+++ b/www/manager6/grid/FirewallOptions.js
@@ -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: name,
+ fieldName: name,
+ value: 'nolog',
+ comboItems: [['nolog', 'nolog'], ['emerg', 'emerg'], ['alert', 'alert'],
+ ['crit', 'crit'], ['err', 'err'], ['warning', 'warning'],
+ ['notice', 'notice'], ['info', 'info'], ['debug', 'debug']]
+});
diff --git a/www/manager6/grid/FirewallRules.js b/www/manager6/grid/FirewallRules.js
index 85b30371..1a6b2002 100644
--- a/www/manager6/grid/FirewallRules.js
+++ b/www/manager6/grid/FirewallRules.js
@@ -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',
@@ -736,6 +741,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',
flex: 1,
--
2.11.0
More information about the pve-devel
mailing list