[pve-devel] [PATCH 2/2] firewall autodisable GUI patch v2

Alen Grizonic a.grizonic at proxmox.com
Tue Jun 30 16:49:39 CEST 2015


Hi Dietmar.


On 06/30/2015 04:41 PM, Dietmar Maurer wrote:
> Hi Alen,
>
> first, thanks for the cleanup.
>
>> ! the patch needs the keepalive feature disabled to work correctly !
> OK, but we don't want to do that ;-) Any other suggestions?

Yes, I am still trying to find a better solution, that's why I pointed 
out the keepalive feature as a non-permanent one.

>
>> Signed-off-by: Alen Grizonic <a.grizonic at proxmox.com>
>> ---
>>   www/manager/grid/FirewallOptions.js | 60
>> ++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 59 insertions(+), 1 deletion(-)
>>
>> diff --git a/www/manager/grid/FirewallOptions.js
>> b/www/manager/grid/FirewallOptions.js
>> index f94be6c..9c70e6b 100644
>> --- a/www/manager/grid/FirewallOptions.js
>> +++ b/www/manager/grid/FirewallOptions.js
>> @@ -25,6 +25,63 @@ Ext.define('PVE.FirewallOptions', {
>>   
>>   	var rows = {};
>>   
>> +	var submit_first = function() {
>> +	    var me = this;
>> +	    var form = me.formPanel.getForm();
>> +	    var form_values = me.getValues();
>> +	    submit_twice.call(me, form_values.enable ? 2 : 0);
>> +	}
>> +
>> +	var submit_twice = function(enable) {
>> +	    var me = this;
>> +	    var form = me.formPanel.getForm();
>> +	    var values = me.getValues();
>> +
>> +	    if (enable == 2) {
>> +		values.enable = 2;
>> +	    } else if (enable == 1) {
>> +		values.enable = 1;
>> +	    }
>> +
>> +	    if (me.digest) {
>> +		if (values.enable == 2) {
>> +		    me.digest = "";
> delete me.digest

Much better. Thanks.

>
>> +		} else {
>> +		    values.digest = me.digest;
>> +		}
>> +	    }
>> +
>> +	    PVE.Utils.API2Request({
>> +		url: me.url,
>> +		waitMsgTarget: me,
>> +		method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
>> +		params: values,
>> +		failure: function(response, options) {
>> +		    if (response.result && response.result.errors) {
>> +			form.markInvalid(response.result.errors);
>> +		    }
> unsure -  I guess we need different error messages for first and second call.
>
> I also think we do not need that markInvalid() code here.

OK. I'll check it out.

>
>> +		    confirm ("Connection lost: Disabling firewall (in 60 seconds).");
>> +		},
>> +		success: function(response, options) {
>> +		    if ((enable == 2) || (enable == 0)) {
>> +			me.close();
>> +		    }
>> +		    if ((me.backgroundDelay || me.showProgress) &&
>> +			response.result.data) {
>> +			var upid = response.result.data;
>> +			var win = Ext.create('PVE.window.TaskProgress', {
>> +			    upid: upid
>> +			});
>> +			win.show();
>> +		    }
> also remove above if statement (we do not use me.backgroundDelay here)

True. Consider it done.





More information about the pve-devel mailing list