[pmg-devel] [PATCH pmg-gui 1/2] use defaults for resources in dashboard

Dominik Csapak d.csapak at proxmox.com
Wed Feb 21 15:15:39 CET 2018


else we get an error if a node is not available

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/Dashboard.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/js/Dashboard.js b/js/Dashboard.js
index 805d796..4684a58 100644
--- a/js/Dashboard.js
+++ b/js/Dashboard.js
@@ -127,9 +127,14 @@ Ext.define('PMG.Dashboard', {
 		}
 
 		// resources count
-		cpu += item.data.cpu;
-		mem += (item.data.memory.used/item.data.memory.total);
-		hd += (item.data.rootfs.used/item.data.rootfs.total);
+		cpu += item.data.cpu || 0;
+
+		var memory = item.data.memory || { used: 0, total: 1 };
+		mem += (memory.used/memory.total);
+
+		var rootfs = item.data.rootfs || { used: 0, total: 1 };
+		hd += (rootfs.used/rootfs.total);
+
 	    });
 
 	    var subscriptionPanel = me.lookup('subscription');
-- 
2.11.0




More information about the pmg-devel mailing list