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

Commit f1a1462

Browse files
author
Phuntsok Drak-pa
authored
Merge pull request #2 from GitSquared/master
Update code from original repo
2 parents 2bf477f + 71ce048 commit f1a1462

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
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
}

src/classes/terminal.class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Terminal {
108108
}
109109
}, 200);
110110
};
111-
this.socket.onerror = (e) => {throw e};
111+
this.socket.onerror = (e) => {throw JSON.stringify(e)};
112112

113113
let parent = document.getElementById(opts.parentId);
114114
parent.addEventListener("wheel", e => {

0 commit comments

Comments
 (0)