diff --git a/static/js/modes/weather-satellite.js b/static/js/modes/weather-satellite.js index 9427f5d..20adc73 100644 --- a/static/js/modes/weather-satellite.js +++ b/static/js/modes/weather-satellite.js @@ -35,6 +35,7 @@ const WeatherSat = (function() { let initialized = false; let imageRefreshInterval = null; let lastDecodeJobSignature = null; + let lastDecodeSatellite = null; /** * Initialize the Weather Satellite mode @@ -149,6 +150,7 @@ const WeatherSat = (function() { const satSelect = document.getElementById('weatherSatSelect'); if (satSelect) { satSelect.addEventListener('change', () => { + resetDecodeJobDisplay(); applyPassFilter(); loadImages(); loadLatestDecodeJob(); @@ -1808,11 +1810,21 @@ const WeatherSat = (function() { async function loadLatestDecodeJob() { const norad = getSelectedMeteorNorad(); if (!norad) return; + const satSelect = document.getElementById('weatherSatSelect'); + const satellite = satSelect?.value || null; + + if (satellite !== lastDecodeSatellite) { + lastDecodeSatellite = satellite; + lastDecodeJobSignature = null; + } try { const response = await fetch(`/ground_station/decode-jobs?norad_id=${encodeURIComponent(norad)}&backend=meteor_lrpt&limit=1`); const jobs = await response.json(); - if (!Array.isArray(jobs) || !jobs.length) return; + if (!Array.isArray(jobs) || !jobs.length) { + resetDecodeJobDisplay(); + return; + } const job = jobs[0]; const details = job.details || {}; @@ -1865,6 +1877,17 @@ const WeatherSat = (function() { } } + function resetDecodeJobDisplay() { + if (isRunning) return; + const captureStatus = document.getElementById('wxsatCaptureStatus'); + const captureMsg = document.getElementById('wxsatCaptureMsg'); + const captureElapsed = document.getElementById('wxsatCaptureElapsed'); + if (captureStatus) captureStatus.classList.remove('active'); + if (captureMsg) captureMsg.textContent = '--'; + if (captureElapsed) captureElapsed.textContent = '--'; + updateStatusUI('idle', 'Idle'); + } + function formatDecodeJobSummary(job, details) { if (job.status === 'queued') return 'Ground-station decode queued'; if (job.status === 'decoding') return details.message || 'Ground-station decode in progress';