1 parent 93cd279 commit 82d76daCopy full SHA for 82d76da
1 file changed
ui/scripts/dashboard.js
@@ -76,9 +76,14 @@
76
var capacities = json.listcapacityresponse.capacity;
77
78
var capacity = function(id, converter) {
79
- return $.grep(capacities, function(capacity) {
+ var result = $.grep(capacities, function(capacity) {
80
return capacity.type == id;
81
- })[0];
+ });
82
+ return result[0] ? result[0] : {
83
+ capacityused: 0,
84
+ capacitytotal: 0,
85
+ percentused: 0
86
+ };
87
};
88
89
dataFns.alerts($.extend(data, {
0 commit comments