Skip to content

Commit 82d76da

Browse files
committed
Fix condition where capacity is not present (i.e., fresh install)
1 parent 93cd279 commit 82d76da

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ui/scripts/dashboard.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@
7676
var capacities = json.listcapacityresponse.capacity;
7777

7878
var capacity = function(id, converter) {
79-
return $.grep(capacities, function(capacity) {
79+
var result = $.grep(capacities, function(capacity) {
8080
return capacity.type == id;
81-
})[0];
81+
});
82+
return result[0] ? result[0] : {
83+
capacityused: 0,
84+
capacitytotal: 0,
85+
percentused: 0
86+
};
8287
};
8388

8489
dataFns.alerts($.extend(data, {

0 commit comments

Comments
 (0)