Skip to content

Commit

Permalink
added check for nodes without disks
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswynn committed Dec 9, 2022
1 parent ec08535 commit 51ff424
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/pages/api/widgets/longhorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ function parseLonghornData(data) {
let maximum = 0;
let reserved = 0;
let scheduled = 0;
Object.keys(node.disks).forEach((diskKey) => {
const disk = node.disks[diskKey];
available += disk.storageAvailable;
maximum += disk.storageMaximum;
reserved += disk.storageReserved;
scheduled += disk.storageScheduled;
});
if (node.disks) {
Object.keys(node.disks).forEach((diskKey) => {
const disk = node.disks[diskKey];
available += disk.storageAvailable;
maximum += disk.storageMaximum;
reserved += disk.storageReserved;
scheduled += disk.storageScheduled;
});
}
return {
id: node.id,
available,
Expand Down

0 comments on commit 51ff424

Please sign in to comment.