[pve-devel] [PATCH manager] fix BandwidthSelector return value

Stefan Reiter s.reiter at proxmox.com
Mon Dec 16 11:23:26 CET 2019


Was about to send pretty much the same patch after my restore broke, but 
you were quicker ;)
Compared and tried yours too, so for the sake of it:

Tested-by: Stefan Reiter <s.reiter at proxmox.com>

On 12/16/19 11:07 AM, Dominik Csapak wrote:
> if we do not want to return a value for submitting, we have to return
> 'null', every other value will get returned by getSubmitValue,
> including 'undefined' and '' (empty string)
> 
> this fixes an issue when the user did not enter any bwlimit
> on restore (the user would get an api error that bwlimit expects
> an integer and not '')
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>   www/manager6/form/BandwidthSelector.js | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/form/BandwidthSelector.js b/www/manager6/form/BandwidthSelector.js
> index fa27e560..dab7c6be 100644
> --- a/www/manager6/form/BandwidthSelector.js
> +++ b/www/manager6/form/BandwidthSelector.js
> @@ -69,9 +69,9 @@ Ext.define('PVE.form.BandwidthField', {
>   		let v = this.processRawValue(this.getRawValue());
>   		v = v.replace(this.decimalSeparator, '.')
>   
> -		if (v === undefined) return v;
> +		if (v === undefined) return null;
>   		// FIXME: make it configurable, as this only works if 0 === default
> -		if (v == 0 || v == 0.0) return '';
> +		if (v == 0 || v == 0.0) return null;
>   
>   		let fieldct = this.up('pveBandwidthField');
>   		let vm = fieldct.getViewModel();
> 




More information about the pve-devel mailing list