[pve-devel] [PATCH pve-storage] Avoid JavaScript gets a string 0.

Wolfgang Link w.link at proxmox.com
Mon Sep 26 12:12:47 CEST 2016


If the JavaScript gets a "0" it convents it to a boolean false.
So to ensure the GUI always get valid int we cast the values.
---
 PVE/Storage.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index adaa380..5664b76 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1053,9 +1053,9 @@ sub storage_info {
 	eval { ($total, $avail, $used, $active) = $plugin->status($storeid, $scfg, $cache); };
 	warn $@ if $@;
 	next if !$active;
-	$info->{$storeid}->{total} = $total;
-	$info->{$storeid}->{avail} = $avail;
-	$info->{$storeid}->{used} = $used;
+	$info->{$storeid}->{total} = int ($total);
+	$info->{$storeid}->{avail} = int ($avail);
+	$info->{$storeid}->{used} = int ($used);
 	$info->{$storeid}->{active} = $active;
     }
 
-- 
2.1.4




More information about the pve-devel mailing list