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

Dominik Csapak d.csapak at proxmox.com
Mon Dec 16 11:07:30 CET 2019


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();
-- 
2.20.1




More information about the pve-devel mailing list