From 9e7dfbda5a825560d99deef039ee4c107b58108c Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 18 Mar 2026 14:05:22 +0000 Subject: [PATCH] Fix satellite dashboard TARGET dropdown not reflecting enabled satellites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add auto-refresh on window focus so the dropdown updates automatically when switching back from the sidebar, plus a manual ↺ refresh button next to the dropdown. Also preserves the current selection across refreshes. Co-Authored-By: Claude Sonnet 4.6 --- static/css/satellite_dashboard.css | 27 +++++++++++++++++++++++++++ templates/satellite_dashboard.html | 19 +++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/static/css/satellite_dashboard.css b/static/css/satellite_dashboard.css index d2814cf..de204a3 100644 --- a/static/css/satellite_dashboard.css +++ b/static/css/satellite_dashboard.css @@ -405,6 +405,33 @@ body { box-shadow: 0 0 15px rgba(0, 212, 255, 0.3); } +#satRefreshBtn { + background: transparent; + border: 1px solid rgba(0, 212, 255, 0.4); + border-radius: 4px; + color: var(--text-secondary); + cursor: pointer; + font-size: 14px; + line-height: 1; + padding: 6px 8px; + transition: color 0.2s, border-color 0.2s; + flex-shrink: 0; +} + +#satRefreshBtn:hover { + color: var(--accent-cyan); + border-color: var(--accent-cyan); +} + +#satRefreshBtn.spinning { + animation: spin 0.6s linear; +} + +@keyframes spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} + /* Countdown panel */ .countdown-panel { flex-shrink: 0; diff --git a/templates/satellite_dashboard.html b/templates/satellite_dashboard.html index 250c091..0ed8dbf 100644 --- a/templates/satellite_dashboard.html +++ b/templates/satellite_dashboard.html @@ -112,6 +112,7 @@ + @@ -375,10 +376,17 @@ const satColors = ['#00ffff', '#9370DB', '#ff00ff', '#00ff00', '#ff6600', '#ffff00', '#ff69b4', '#7b68ee']; function loadDashboardSatellites() { + const btn = document.getElementById('satRefreshBtn'); + if (btn) { + btn.classList.remove('spinning'); + void btn.offsetWidth; // force reflow to restart animation + btn.classList.add('spinning'); + } fetch('/satellite/tracked?enabled=true') .then(r => r.json()) .then(data => { if (data.status === 'success' && data.satellites && data.satellites.length > 0) { + const prevSelected = selectedSatellite; const newSats = {}; const select = document.getElementById('satSelect'); select.innerHTML = ''; @@ -394,8 +402,12 @@ select.appendChild(opt); }); satellites = newSats; - // Default to ISS if available - if (newSats[25544]) select.value = '25544'; + // Restore previous selection if still available, else default to ISS + if (newSats[prevSelected]) { + select.value = prevSelected; + } else if (newSats[25544]) { + select.value = '25544'; + } selectedSatellite = parseInt(select.value); } }) @@ -567,6 +579,9 @@ } }); + // Refresh satellite list when the window regains focus (e.g. after enabling sats in the sidebar) + window.addEventListener('focus', loadDashboardSatellites); + document.addEventListener('DOMContentLoaded', () => { loadDashboardSatellites(); setupEmbeddedMode();