[pve-devel] applied: [PATCH v6 manager] 1145 Warn if datacenter firewall is disabled

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 13 10:14:41 CET 2019


On 3/13/19 9:57 AM, Christian Ebner wrote:
> This warns the user that the datacenter firewall is disabled when editing the
> host or the VM/CT firewall status.
> 

applied, thanks! Please try to use the "fix #XYZ: ..." format in the commit
subject for such fixes, just the number alone without anything almost looks
like it got there by mistake.

> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> Version 6:
>     * moved FirewallEnableEdit from grid to window folder
>     * use cbind to set the checkbox
>     * use fixed width of 350 for the window
>     * Changed warning text
> 
>  www/manager6/Makefile                     |  1 +
>  www/manager6/grid/FirewallOptions.js      | 23 ++++++++++++--
>  www/manager6/window/FirewallEnableEdit.js | 50 +++++++++++++++++++++++++++++++
>  3 files changed, 71 insertions(+), 3 deletions(-)
>  create mode 100644 www/manager6/window/FirewallEnableEdit.js
> 
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index e75f0de6..922451b9 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -83,6 +83,7 @@ JSSRC= 				                 	\
>  	window/BackupConfig.js				\
>  	window/Settings.js				\
>  	window/StartupEdit.js				\
> +	window/FirewallEnableEdit.js		    	\
>  	panel/NotesView.js				\
>  	grid/ResourceGrid.js				\
>  	grid/PoolMembers.js				\
> diff --git a/www/manager6/grid/FirewallOptions.js b/www/manager6/grid/FirewallOptions.js
> index cddbdbbf..1d56ecc0 100644
> --- a/www/manager6/grid/FirewallOptions.js
> +++ b/www/manager6/grid/FirewallOptions.js
> @@ -64,9 +64,17 @@ Ext.define('PVE.FirewallOptions', {
>  	    };
>  	};
>  
> -
>  	if (me.fwtype === 'node') {
> -	    add_boolean_row('enable', gettext('Firewall'), 1);
> +	    me.rows.enable = {
> +		required: true,
> +		defaultValue: 1,
> +		header: gettext('Firewall'),
> +		renderer: Proxmox.Utils.format_boolean,
> +		editor: {
> +		    xtype: 'pveFirewallEnableEdit',
> +		    defaultValue: 1
> +		}
> +	    };
>  	    add_boolean_row('nosmurfs', gettext('SMURFS filter'), 1);
>  	    add_boolean_row('tcpflags', gettext('TCP flags filter'), 0);
>  	    add_boolean_row('ndp', 'NDP', 1);
> @@ -78,7 +86,16 @@ Ext.define('PVE.FirewallOptions', {
>  	    add_log_row('tcp_flags_log_level', 120);
>  	    add_log_row('smurf_log_level');
>  	} else if (me.fwtype === 'vm') {
> -	    add_boolean_row('enable', gettext('Firewall'), 0);
> +	    me.rows.enable = {
> +		required: true,
> +		defaultValue: 0,
> +		header: gettext('Firewall'),
> +		renderer: Proxmox.Utils.format_boolean,
> +		editor: {
> +		    xtype: 'pveFirewallEnableEdit',
> +		    defaultValue: 0
> +		}
> +	    };
>  	    add_boolean_row('dhcp', 'DHCP', 1);
>  	    add_boolean_row('ndp', 'NDP', 1);
>  	    add_boolean_row('radv', gettext('Router Advertisement'), 0);
> diff --git a/www/manager6/window/FirewallEnableEdit.js b/www/manager6/window/FirewallEnableEdit.js
> new file mode 100644
> index 00000000..075bc462
> --- /dev/null
> +++ b/www/manager6/window/FirewallEnableEdit.js
> @@ -0,0 +1,50 @@
> +/*jslint confusion: true*/
> +Ext.define('PVE.FirewallEnableEdit', {
> +    extend: 'Proxmox.window.Edit',
> +    alias: ['widget.pveFirewallEnableEdit'],
> +    mixins: ['Proxmox.Mixin.CBind'],
> +
> +    subject: gettext('Firewall'),
> +    cbindData: {
> +	defaultValue: 0
> +    },
> +    width: 350,
> +
> +    items: [
> +	{
> +	    xtype: 'proxmoxcheckbox',
> +	    name: 'enable',
> +	    uncheckedValue: 0,
> +	    cbind: {
> +		defaultValue: '{defaultValue}',
> +		checked: '{defaultValue}'
> +	    },
> +	    deleteDefaultValue: false,
> +	    fieldLabel: gettext('Firewall')
> +	},
> +	{
> +	    xtype: 'displayfield',
> +	    name: 'warning',
> +	    userCls: 'pve-hint',
> +	    value: gettext('Warning: Firewall still disabled at datacenter level!'),
> +	    hidden: true
> +	}
> +    ],
> +
> +    beforeShow: function() {
> +	var me = this;
> +
> +	Proxmox.Utils.API2Request({
> +	    url: '/api2/extjs/cluster/firewall/options',
> +	    method: 'GET',
> +	    failure: function(response, opts) {
> +		Ext.Msg.alert(gettext('Error'), response.htmlStatus);
> +	    },
> +	    success: function(response, opts) {
> +		if (!response.result.data.enable) {
> +		    me.down('displayfield[name=warning]').setVisible(true);
> +		}
> +	    }
> +	});
> +    }
> +});
> 




More information about the pve-devel mailing list