]> git.proxmox.com Git - pmg-gui.git/commitdiff
use defaults for resources in dashboard
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 21 Feb 2018 14:15:39 +0000 (15:15 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Mar 2018 05:48:54 +0000 (06:48 +0100)
else we get an error if a node is not available

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/Dashboard.js

index 805d796672c9827ff7d033b52778cac2807b6ca3..4684a58786fd59b4c3dabaeb88098450f183ab66 100644 (file)
@@ -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');