Network as a regular resources cell next to Disk, with two stacked bar-sized graphs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
neil 2026-10-26 10:41:58 -07:00
parent 3ae03160e8
commit a963dc1bf4
No known key found for this signature in database
3 changed files with 12 additions and 11 deletions

View file

@ -89,8 +89,8 @@ function renderHost() {
setBar('#b-swap', h.swap_total ? (100 * h.swap_used) / h.swap_total : 0);
$('#m-disk').textContent = `${fmtBytes(h.disk_used)} / ${fmtBytes(h.disk_total)}`;
setBar('#b-disk', (100 * h.disk_used) / h.disk_total);
$('#m-rx').textContent = fmtRate(h.net_rx_rate);
$('#m-tx').textContent = fmtRate(h.net_tx_rate);
$('#m-rx').textContent = `↓ ${fmtRate(h.net_rx_rate)}`;
$('#m-tx').textContent = `↑ ${fmtRate(h.net_tx_rate)}`;
const hist = h.net_history || [];
drawGraph('#g-rx', hist.map((x) => x[0]));
drawGraph('#g-tx', hist.map((x) => x[1]));
@ -110,7 +110,7 @@ function drawGraph(id, vals) {
svg.querySelector('.area').setAttribute('d', line && `${line}L100,24L${x0.toFixed(2)},24Z`);
let title = svg.querySelector('title');
if (!title) title = svg.appendChild(document.createElementNS('http://www.w3.org/2000/svg', 'title'));
title.textContent = `Peak ${fmtRate(peak)} in the last ${(GRAPH_POINTS * 3) / 60} minutes`;
title.textContent = `${id === '#g-rx' ? 'Download' : 'Upload'}: peak ${fmtRate(peak)} in the last ${(GRAPH_POINTS * 3) / 60} minutes`;
}
function fmtDuration(sec) {