Reset persisted Meteor state on satellite switch

This commit is contained in:
James Smith
2026-03-18 22:24:12 +00:00
parent a995fceb8c
commit badf587be6

View File

@@ -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';