mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-05 06:45:09 +00:00
Merge remote-tracking branch 'origin/main' into HEAD
This commit is contained in:
@@ -1164,9 +1164,16 @@
|
||||
// The pull replaced files on disk; the running services still
|
||||
// hold the code they loaded at boot. Ask for the restart that
|
||||
// makes the update actually take effect.
|
||||
//
|
||||
// Both services, not just the display. The plugin store's
|
||||
// compatibility gate runs in the web process, so a web service
|
||||
// still holding the previous version refuses every plugin that
|
||||
// floors on the release just installed -- blaming a core
|
||||
// version that is already correct on disk.
|
||||
if (data.restart_required && typeof window.showRestartPending === 'function') {
|
||||
window.showRestartPending(
|
||||
'Update installed \u2014 restart the display to run the new code');
|
||||
'Update installed \u2014 restart the display and web ' +
|
||||
'services to run the new code');
|
||||
}
|
||||
}
|
||||
if (typeof showNotification === 'function') {
|
||||
|
||||
@@ -687,12 +687,35 @@
|
||||
const mUsedGb = d.memory_used_mb != null ? (d.memory_used_mb / 1024).toFixed(1) : null;
|
||||
const mTotGb = d.memory_total_mb != null ? (d.memory_total_mb / 1024).toFixed(1) : null;
|
||||
const temp = d.cpu_temp != null ? d.cpu_temp + '°C' : 'N/A';
|
||||
// Available memory is the number that predicts trouble. When it
|
||||
// runs out the board does not fail cleanly: fork() starts
|
||||
// returning ENOMEM, so sshd cannot spawn a session and systemd
|
||||
// cannot respawn the display, while the kernel keeps answering
|
||||
// pings. Thresholds are drawn from that failure -- it was
|
||||
// measured at 73MB free, and healthy running sits well above.
|
||||
// Round ONCE, then colour and label off the same number.
|
||||
// The API sends one decimal place, so classifying the raw
|
||||
// value and displaying the rounded one disagreed at the
|
||||
// boundaries: 149.6 rendered as "150 MB" in red, and 299.6 as
|
||||
// "300 MB" in amber, both contradicting the threshold the
|
||||
// colour claims to apply. Which side of the line a spare
|
||||
// 0.4MB falls on does not matter; the tile agreeing with
|
||||
// itself does.
|
||||
const availMb = d.memory_available_mb == null
|
||||
? null : Math.round(d.memory_available_mb);
|
||||
const availColor = availMb == null ? 'text-gray-400'
|
||||
: availMb < 150 ? 'text-red-600'
|
||||
: availMb < 300 ? 'text-amber-500'
|
||||
: 'text-green-600';
|
||||
panel.innerHTML =
|
||||
diagTile('fa-microchip', 'text-blue-600', 'CPU Usage',
|
||||
(d.cpu_percent != null ? d.cpu_percent : '--') + '%', null) +
|
||||
diagTile('fa-memory', 'text-green-600', 'Memory',
|
||||
(d.memory_used_percent != null ? d.memory_used_percent : '--') + '%',
|
||||
(mUsedGb && mTotGb) ? `${mUsedGb} / ${mTotGb} GB` : null) +
|
||||
diagTile('fa-memory', availColor, 'Available Memory',
|
||||
availMb != null ? `${availMb} MB` : '--',
|
||||
mTotGb ? `of ${mTotGb} GB total` : null) +
|
||||
diagTile('fa-thermometer-half', 'text-red-600', 'CPU Temp', temp, null) +
|
||||
diagTile('fa-hdd', 'text-indigo-600', 'Disk',
|
||||
(d.disk_used_percent != null ? d.disk_used_percent : '--') + '%',
|
||||
|
||||
Reference in New Issue
Block a user