fix: BUG-11 — Dashboard GPS now shows lat/lon from API when stale, Status page uses same 30s staleness threshold

This commit is contained in:
Mathieu Moran
2026-08-11 14:36:58 -04:00
parent 7a6de8b589
commit 9733036510
3 changed files with 28 additions and 2 deletions
+4 -1
View File
@@ -215,7 +215,10 @@ function renderHealth(health) {
function renderGpsAndCellular(gps, cellularHat) {
const liveFix = gps.thread_alive && gps.has_fix;
if (liveFix) {
const staleFix = liveFix && gps.fix_age_seconds != null && gps.fix_age_seconds > 30;
if (staleFix) {
setBadge('gps-badge', 'Stale fix', 'text-bg-warning');
} else if (liveFix) {
setBadge('gps-badge', 'Live fix', 'text-bg-success');
} else if (gps.thread_alive) {
setBadge('gps-badge', 'No fix', 'text-bg-warning');
+5 -1
View File
@@ -221,7 +221,8 @@ function formatGpsAge(seconds) {
function renderGpsStatus(status) {
const liveBadge = document.getElementById('gps-live-badge');
const fixDetail = document.getElementById('gps-fix-detail');
if (!liveBadge || !fixDetail) return;
const locX = document.getElementById('gpsLocationX');
const locY = document.getElementById('gpsLocationY');
let label = 'Unavailable';
let badgeClass = 'text-bg-secondary';
@@ -233,6 +234,9 @@ function renderGpsStatus(status) {
label = stale ? 'Stale fix' : 'Live fix';
badgeClass = stale ? 'text-bg-warning' : 'text-bg-success';
detail = formatGpsAge(status.fix_age_seconds);
// Show lat/lon from API response (not just socket events)
if (locX) locX.textContent = status.latitude != null ? status.latitude.toFixed(6) : '—';
if (locY) locY.textContent = status.longitude != null ? status.longitude.toFixed(6) : '—';
} else {
label = 'No fix';
badgeClass = 'text-bg-warning';