[feat](trx-frontend-http): add satellite scheduler UI in web frontend

Add HTML, JS, and CSS for the satellite pass scheduling overlay in the
scheduler settings panel.  The satellite section is always visible
regardless of the base scheduler mode (Grayline/TimeSpan) since it
operates as a preemption overlay.

UI features:
- Enable/disable toggle for satellite pass preemption
- Configurable pre-tune seconds (time before AOS to start tuning)
- Satellite entry table with add/edit/remove (satellite name, NORAD ID,
  bookmark, min elevation, priority)
- Preset dropdown for common weather satellites (NOAA 15/18/19,
  Meteor-M2 3/4) that auto-fills name and NORAD ID
- Bookmark selector for each satellite (sets freq, mode, decoders)
- Live pass status badge showing active satellite from scheduler status
- Status card shows "[SAT: name]" label when satellite pass triggers
- Scheduler control row visible when satellites enabled (even with
  base mode disabled)

https://claude.ai/code/session_01WzWvhFVhEP9Fqn4u6pXs3T
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-28 19:14:18 +00:00
committed by Stan Grams
parent 8e700fb98a
commit 3e3fdbcb30
3 changed files with 358 additions and 3 deletions
@@ -1052,6 +1052,76 @@
</table>
</div>
<!-- Satellite Overlay section -->
<div id="scheduler-sat-section" class="sch-section">
<div class="sch-section-title">Satellite Pass Scheduling</div>
<div class="sch-row" style="margin-bottom:0.5rem;">
<label class="sch-label" style="min-width:auto;">
<span class="sch-sat-toggle-row">
<input type="checkbox" id="scheduler-sat-enabled" />
<span>Enable satellite pass preemption</span>
</span>
</label>
</div>
<div id="scheduler-sat-body" style="display:none;">
<div class="sch-row" style="margin-bottom:0.75rem;">
<label class="sch-label">Pre-tune (seconds before AOS)
<input type="number" id="scheduler-sat-pretune" class="status-input" min="0" max="300" value="60" style="width:7rem;" />
</label>
<small style="color:var(--text-muted);align-self:flex-end;padding-bottom:0.35rem;">Tune to the satellite bookmark this many seconds before acquisition. Gives decoders time to lock.</small>
</div>
<button id="scheduler-sat-add-btn" class="sch-write" type="button" style="margin-bottom:0.75rem;">+ Add Satellite</button>
<table class="sch-ts-table">
<thead>
<tr><th>Satellite</th><th>NORAD ID</th><th>Bookmark</th><th>Min elev.</th><th>Priority</th><th></th></tr>
</thead>
<tbody id="scheduler-sat-tbody"></tbody>
</table>
<div id="scheduler-sat-pass-status" class="sch-sat-pass-status" style="margin-top:0.5rem;"></div>
</div>
</div>
<!-- Satellite entry form modal -->
<div id="sch-sat-form-wrap" style="display:none;">
<form id="sch-sat-form" class="bm-form">
<div class="bm-form-title" id="sch-sat-form-title">Add Satellite</div>
<div class="bm-form-grid">
<label class="bm-label">Satellite preset
<select id="scheduler-sat-preset" class="status-input" aria-label="Satellite preset">
<option value="">— custom —</option>
<option value="NOAA 15|25338">NOAA 15 (137.620 MHz APT)</option>
<option value="NOAA 18|28654">NOAA 18 (137.9125 MHz APT)</option>
<option value="NOAA 19|33591">NOAA 19 (137.100 MHz APT)</option>
<option value="METEOR-M2 3|57166">Meteor-M2 3 (137.900 MHz LRPT)</option>
<option value="METEOR-M2-4|59051">Meteor-M2-4 (137.900 MHz LRPT)</option>
</select>
</label>
<label class="bm-label">Satellite name
<input type="text" id="scheduler-sat-name" class="status-input" placeholder="e.g. NOAA 19" required />
</label>
<label class="bm-label">NORAD catalog number
<input type="number" id="scheduler-sat-norad" class="status-input" min="1" placeholder="e.g. 33591" required />
</label>
<label class="bm-label bm-label-wide">Bookmark (sets freq, mode, decoders)
<select id="scheduler-sat-bookmark" class="status-input" aria-label="Satellite bookmark"></select>
</label>
<label class="bm-label">Min elevation (°)
<input type="number" id="scheduler-sat-min-el" class="status-input" min="0" max="90" step="1" value="5" />
</label>
<label class="bm-label">Priority (lower = higher)
<input type="number" id="scheduler-sat-priority" class="status-input" min="0" value="0" />
</label>
<label class="bm-label" title="SDR only — sets center frequency before tuning">Center freq (Hz, SDR)
<input type="number" id="scheduler-sat-center-hz" class="status-input" min="0" placeholder="optional" />
</label>
</div>
<div class="bm-form-actions">
<button type="submit" class="bm-save-btn">Save</button>
<button type="button" id="sch-sat-form-cancel">Cancel</button>
</div>
</form>
</div>
<div id="sch-entry-form-wrap" style="display:none;">
<form id="sch-entry-form" class="bm-form">
<div class="bm-form-title" id="sch-entry-form-title">Add Entry</div>
@@ -19,6 +19,7 @@
let interleaveTicker = null;
let schedulerStepPending = false;
let schEntryEditIdx = null; // null = adding, number = editing that index
let schSatEditIdx = null; // null = adding, number = editing satellite entry
// -------------------------------------------------------------------------
// Init
@@ -315,6 +316,7 @@
currentSchedulerStatus = st || null;
renderStatus(st);
renderSchedulerInterleaveStatus();
renderSatPassStatus();
})
.catch(function () {});
}
@@ -338,7 +340,10 @@
const d = new Date(st.last_applied_utc * 1000);
ts = " at " + d.toUTCString();
}
el.textContent = "Last applied: " + name + ts;
const satLabel = st.active_satellite
? " [SAT: " + st.active_satellite + "]"
: "";
el.textContent = "Last applied: " + name + satLabel + ts;
}
// -------------------------------------------------------------------------
@@ -354,9 +359,10 @@
// Mode selector
setSelected("scheduler-mode-select", mode);
// Show/hide main-view scheduler controls
// Show/hide main-view scheduler controls (visible when base mode active OR satellites enabled)
const satEnabled = currentConfig && currentConfig.satellites && currentConfig.satellites.enabled;
const controlRow = document.querySelector(".scheduler-control-row");
if (controlRow) controlRow.style.display = mode !== "disabled" ? "" : "none";
if (controlRow) controlRow.style.display = (mode !== "disabled" || satEnabled) ? "" : "none";
// Show/hide sections
const glSection = document.getElementById("scheduler-grayline-section");
@@ -364,6 +370,9 @@
if (glSection) glSection.style.display = mode === "grayline" ? "" : "none";
if (tsSection) tsSection.style.display = mode === "time_span" ? "" : "none";
// Satellite overlay (always visible — independent of mode)
renderSatelliteSection();
// Grayline inputs
if (mode === "grayline" && currentConfig && currentConfig.grayline) {
const gl = currentConfig.grayline;
@@ -697,6 +706,9 @@
config.interleave_min = isNaN(ilVal) || ilVal <= 0 ? null : ilVal;
}
// Satellite overlay — saved regardless of base mode.
config.satellites = collectSatelliteConfig();
const btn = document.getElementById("scheduler-save-btn");
if (btn) btn.disabled = true;
@@ -793,6 +805,7 @@
});
wireExtraBmAdd();
wireSatelliteEvents();
}
function populateTsBookmarkSelect() {
@@ -852,6 +865,228 @@
});
}
// -------------------------------------------------------------------------
// Satellite overlay
// -------------------------------------------------------------------------
function getSatelliteEntries() {
return (currentConfig && currentConfig.satellites && Array.isArray(currentConfig.satellites.entries))
? currentConfig.satellites.entries
: [];
}
function ensureSatelliteConfig() {
if (!currentConfig) currentConfig = { remote: currentRigId, mode: "disabled", entries: [] };
if (!currentConfig.satellites) currentConfig.satellites = { enabled: false, pretune_secs: 60, entries: [] };
if (!currentConfig.satellites.entries) currentConfig.satellites.entries = [];
return currentConfig.satellites;
}
function collectSatelliteConfig() {
const enabledEl = document.getElementById("scheduler-sat-enabled");
const pretuneEl = document.getElementById("scheduler-sat-pretune");
const enabled = enabledEl ? enabledEl.checked : false;
const pretune = pretuneEl ? parseInt(pretuneEl.value, 10) : 60;
return {
enabled: enabled,
pretune_secs: isNaN(pretune) || pretune < 0 ? 60 : pretune,
entries: getSatelliteEntries(),
};
}
function renderSatelliteSection() {
const satCfg = (currentConfig && currentConfig.satellites) || {};
const enabled = !!satCfg.enabled;
const enabledEl = document.getElementById("scheduler-sat-enabled");
if (enabledEl) enabledEl.checked = enabled;
const pretuneEl = document.getElementById("scheduler-sat-pretune");
if (pretuneEl) pretuneEl.value = satCfg.pretune_secs != null ? satCfg.pretune_secs : 60;
const bodyEl = document.getElementById("scheduler-sat-body");
if (bodyEl) bodyEl.style.display = enabled ? "" : "none";
renderSatelliteEntries();
renderSatPassStatus();
}
function renderSatelliteEntries() {
const tbody = document.getElementById("scheduler-sat-tbody");
if (!tbody) return;
tbody.innerHTML = "";
const entries = getSatelliteEntries();
entries.forEach(function (entry, idx) {
const tr = document.createElement("tr");
tr.innerHTML =
"<td>" + escHtml(entry.satellite || "") + "</td>" +
"<td>" + (entry.norad_id || "") + "</td>" +
"<td>" + escHtml(bmName(entry.bookmark_id)) + "</td>" +
"<td>" + (entry.min_elevation_deg != null ? entry.min_elevation_deg + "\u00B0" : "5\u00B0") + "</td>" +
"<td>" + (entry.priority || 0) + "</td>" +
'<td>' +
'<button class="sch-write sch-sat-edit-btn" data-idx="' + idx + '" type="button">Edit</button>' +
'<button class="sch-write sch-sat-remove-btn" data-idx="' + idx + '" type="button">Remove</button>' +
'</td>';
tbody.appendChild(tr);
});
tbody.querySelectorAll(".sch-sat-edit-btn").forEach(function (btn) {
btn.addEventListener("click", function () {
const i = parseInt(btn.dataset.idx, 10);
const entry = getSatelliteEntries()[i];
if (entry) schOpenSatForm(entry, i);
});
});
tbody.querySelectorAll(".sch-sat-remove-btn").forEach(function (btn) {
btn.addEventListener("click", function () {
removeSatEntry(parseInt(btn.dataset.idx, 10));
});
});
}
function removeSatEntry(idx) {
const sat = ensureSatelliteConfig();
sat.entries.splice(idx, 1);
renderSatelliteEntries();
}
function schOpenSatForm(entry, idx) {
schSatEditIdx = (idx != null) ? idx : null;
const titleEl = document.getElementById("sch-sat-form-title");
if (titleEl) titleEl.textContent = entry ? "Edit Satellite" : "Add Satellite";
const presetEl = document.getElementById("scheduler-sat-preset");
const nameEl = document.getElementById("scheduler-sat-name");
const noradEl = document.getElementById("scheduler-sat-norad");
const bmEl = document.getElementById("scheduler-sat-bookmark");
const minElEl = document.getElementById("scheduler-sat-min-el");
const prioEl = document.getElementById("scheduler-sat-priority");
const centerHzEl = document.getElementById("scheduler-sat-center-hz");
if (presetEl) presetEl.value = "";
if (nameEl) nameEl.value = entry ? (entry.satellite || "") : "";
if (noradEl) noradEl.value = entry ? (entry.norad_id || "") : "";
if (bmEl) bmEl.value = entry ? (entry.bookmark_id || "") : "";
if (minElEl) minElEl.value = entry && entry.min_elevation_deg != null ? entry.min_elevation_deg : 5;
if (prioEl) prioEl.value = entry && entry.priority != null ? entry.priority : 0;
if (centerHzEl) centerHzEl.value = entry && entry.center_hz ? entry.center_hz : "";
// Populate bookmark dropdown
renderBookmarkSelect("scheduler-sat-bookmark", entry ? entry.bookmark_id : null);
const wrap = document.getElementById("sch-sat-form-wrap");
if (wrap) {
wrap.style.display = "flex";
if (nameEl) nameEl.focus();
}
}
function schCloseSatForm() {
const wrap = document.getElementById("sch-sat-form-wrap");
if (wrap) wrap.style.display = "none";
schSatEditIdx = null;
}
function schSatFormSubmit(e) {
e.preventDefault();
const nameEl = document.getElementById("scheduler-sat-name");
const noradEl = document.getElementById("scheduler-sat-norad");
const bmEl = document.getElementById("scheduler-sat-bookmark");
const minElEl = document.getElementById("scheduler-sat-min-el");
const prioEl = document.getElementById("scheduler-sat-priority");
const centerHzEl = document.getElementById("scheduler-sat-center-hz");
const satellite = nameEl ? nameEl.value.trim() : "";
const noradId = noradEl ? parseInt(noradEl.value, 10) : NaN;
const bmId = bmEl ? bmEl.value : "";
if (!satellite) { alert("Please enter a satellite name."); return; }
if (isNaN(noradId) || noradId <= 0) { alert("Please enter a valid NORAD catalog number."); return; }
if (!bmId) { alert("Please select a bookmark."); return; }
const minEl = minElEl ? parseFloat(minElEl.value) : 5;
const prio = prioEl ? parseInt(prioEl.value, 10) : 0;
const centerHzRaw = centerHzEl ? parseInt(centerHzEl.value, 10) : NaN;
const sat = ensureSatelliteConfig();
const entryData = {
satellite: satellite,
norad_id: noradId,
bookmark_id: bmId,
min_elevation_deg: isNaN(minEl) ? 5 : minEl,
priority: isNaN(prio) ? 0 : prio,
center_hz: !isNaN(centerHzRaw) && centerHzRaw > 0 ? centerHzRaw : null,
bookmark_ids: [],
};
if (schSatEditIdx !== null) {
const existing = sat.entries[schSatEditIdx];
entryData.id = existing ? existing.id : ("sat_" + Date.now().toString(36));
sat.entries[schSatEditIdx] = entryData;
} else {
entryData.id = "sat_" + Date.now().toString(36);
sat.entries.push(entryData);
}
schCloseSatForm();
renderSatelliteEntries();
}
function wireSatPresetChange() {
const presetEl = document.getElementById("scheduler-sat-preset");
if (!presetEl || presetEl._wired) return;
presetEl._wired = true;
presetEl.addEventListener("change", function () {
if (!presetEl.value) return;
const parts = presetEl.value.split("|");
const nameEl = document.getElementById("scheduler-sat-name");
const noradEl = document.getElementById("scheduler-sat-norad");
if (nameEl) nameEl.value = parts[0] || "";
if (noradEl) noradEl.value = parts[1] || "";
});
}
function renderSatPassStatus() {
const el = document.getElementById("scheduler-sat-pass-status");
if (!el) return;
const entries = getSatelliteEntries();
if (entries.length === 0) {
el.innerHTML = "";
return;
}
// Show active satellite from status if available.
if (currentSchedulerStatus && currentSchedulerStatus.active_satellite) {
el.innerHTML =
'<span class="sch-sat-active-badge">PASS ACTIVE: ' +
escHtml(currentSchedulerStatus.active_satellite) +
'</span>';
} else {
el.innerHTML = '<span style="color:var(--text-muted);font-size:0.8rem;">No satellite pass active. Predictions available in the SAT tab.</span>';
}
}
function wireSatelliteEvents() {
const enabledEl = document.getElementById("scheduler-sat-enabled");
if (enabledEl) {
enabledEl.addEventListener("change", function () {
const bodyEl = document.getElementById("scheduler-sat-body");
if (bodyEl) bodyEl.style.display = enabledEl.checked ? "" : "none";
});
}
const addBtn = document.getElementById("scheduler-sat-add-btn");
if (addBtn) addBtn.addEventListener("click", function () { schOpenSatForm(null, null); });
const satForm = document.getElementById("sch-sat-form");
if (satForm) satForm.addEventListener("submit", schSatFormSubmit);
const cancelBtn = document.getElementById("sch-sat-form-cancel");
if (cancelBtn) cancelBtn.addEventListener("click", schCloseSatForm);
wireSatPresetChange();
}
// -------------------------------------------------------------------------
// Public API
// -------------------------------------------------------------------------
@@ -4412,6 +4412,56 @@ button:focus-visible, input:focus-visible, select:focus-visible {
line-height: 1;
}
.sch-extra-bm-rm:hover { opacity: 1; }
/* Satellite scheduler overlay */
.sch-sat-toggle-row {
display: inline-flex;
align-items: center;
gap: 0.55rem;
min-height: var(--control-height);
color: var(--text);
font-weight: 500;
}
.sch-sat-pass-status {
font-size: 0.82rem;
}
.sch-sat-active-badge {
display: inline-block;
background: var(--accent-green, #1a7);
color: #fff;
font-size: 0.78rem;
font-weight: 600;
padding: 0.2rem 0.6rem;
border-radius: 3px;
letter-spacing: 0.03em;
}
#sch-sat-form-wrap {
position: fixed;
inset: 0;
z-index: 200;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.55);
}
#sch-sat-form .bm-form-grid {
gap: 0.75rem;
}
#sch-sat-form .bm-label {
min-width: 12rem;
flex: 1 1 12rem;
}
#sch-sat-form-cancel {
cursor: pointer;
border: 1px solid var(--border);
background: var(--bg-muted);
color: var(--text);
border-radius: var(--radius);
padding: 0.55rem 1rem;
font-size: 0.88rem;
}
#sch-sat-form-cancel:hover {
background: var(--border);
}
.bgd-toggle-wrap {
min-width: 18rem;
flex: 1 1 20rem;