Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit d3f9af3

Browse files
authored
🐛 Fix #226
1 parent 06ee133 commit d3f9af3

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/classes/filesystem.class.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,20 @@ class FilesystemDisplay {
265265
</div>`;
266266
});
267267
this.filesContainer.innerHTML = filesDOM;
268-
269-
this.space_bar.text.innerHTML = `Mount <strong>${this.fsBlock.mount}</strong> used <strong>${Math.round(this.fsBlock.use)}%</strong>`;
270-
this.space_bar.bar.value = Math.round(this.fsBlock.use);
268+
269+
// See #226
270+
if (!isNaN(this.fsBlock.use)) {
271+
this.space_bar.text.innerHTML = `Mount <strong>${this.fsBlock.mount}</strong> used <strong>${Math.round(this.fsBlock.use)}%</strong>`;
272+
this.space_bar.bar.value = Math.round(this.fsBlock.use);
273+
} else if (!isNaN((this.fsBlock.size / this.fsBlock.used) * 100)) {
274+
let usage = Math.round(this.fsBlock.size / this.fsBlock.used) * 100);
275+
276+
this.space_bar.text.innerHTML = `Mount <strong>${this.fsBlock.mount}</strong> used <strong>${usage}%</strong>`;
277+
this.space_bar.bar.value = usage;
278+
} else {
279+
this.space_bar.text.innerHTML = `Could not calculate mountpoint usage.`;
280+
this.space_bar.bar.value = 100;
281+
}
271282
};
272283
}
273284
}

0 commit comments

Comments
 (0)