[feat](trx-frontend-http): hide decoder tabs not present in server registry
After fetching /decoders, hide sub-tab buttons, panels, overview descriptions, about-status rows, and settings clear-history buttons for decoders the server doesn't advertise. This makes feature-gated decoders like FT2 fully invisible in the UI when disabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -18,12 +18,50 @@ window.onDecoderRegistryReady = function (fn) {
|
|||||||
window.decoderRegistry = decoderRegistry;
|
window.decoderRegistry = decoderRegistry;
|
||||||
for (const fn of _decoderRegistryReadyCallbacks) fn();
|
for (const fn of _decoderRegistryReadyCallbacks) fn();
|
||||||
_decoderRegistryReadyCallbacks.length = 0;
|
_decoderRegistryReadyCallbacks.length = 0;
|
||||||
|
hideUnsupportedDecoderTabs();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to fetch decoder registry:", e);
|
console.error("Failed to fetch decoder registry:", e);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
/** Hide decoder sub-tabs, panels, about rows, and settings buttons
|
||||||
|
* for decoders not present in the server's registry. */
|
||||||
|
function hideUnsupportedDecoderTabs() {
|
||||||
|
const knownIds = new Set(decoderRegistry.map(function (d) { return d.id; }));
|
||||||
|
// Sub-tabs that are not decoders and should always be visible.
|
||||||
|
const alwaysShow = new Set(["overview", "rds", "sat"]);
|
||||||
|
document.querySelectorAll("#tab-digital-modes > .sub-tab-bar > .sub-tab[data-subtab]").forEach(function (btn) {
|
||||||
|
const id = btn.dataset.subtab;
|
||||||
|
if (alwaysShow.has(id) || knownIds.has(id)) return;
|
||||||
|
btn.style.display = "none";
|
||||||
|
var panel = document.getElementById("subtab-" + id);
|
||||||
|
if (panel) panel.style.display = "none";
|
||||||
|
});
|
||||||
|
// About-tab decoder status rows: <td>LABEL</td><td id="about-dec-ID">
|
||||||
|
document.querySelectorAll('[id^="about-dec-"]').forEach(function (el) {
|
||||||
|
var id = el.id.replace("about-dec-", "");
|
||||||
|
if (!alwaysShow.has(id) && !knownIds.has(id)) {
|
||||||
|
var row = el.closest("tr");
|
||||||
|
if (row) row.style.display = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Settings clear-history buttons
|
||||||
|
document.querySelectorAll('[id^="settings-clear-"][id$="-history"]').forEach(function (el) {
|
||||||
|
var m = el.id.match(/^settings-clear-(.+)-history$/);
|
||||||
|
if (m && !alwaysShow.has(m[1]) && !knownIds.has(m[1])) {
|
||||||
|
el.style.display = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Overview decoder descriptions
|
||||||
|
document.querySelectorAll("#subtab-overview .plugin-item[data-decoder]").forEach(function (el) {
|
||||||
|
var id = el.dataset.decoder;
|
||||||
|
if (!alwaysShow.has(id) && !knownIds.has(id)) {
|
||||||
|
el.style.display = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// --- Persistent settings (localStorage) ---
|
// --- Persistent settings (localStorage) ---
|
||||||
const STORAGE_PREFIX = "trx_";
|
const STORAGE_PREFIX = "trx_";
|
||||||
function saveSetting(key, value) {
|
function saveSetting(key, value) {
|
||||||
|
|||||||
@@ -539,61 +539,61 @@
|
|||||||
<button class="sub-tab" data-subtab="sat">SAT</button>
|
<button class="sub-tab" data-subtab="sat">SAT</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="subtab-overview" class="sub-tab-panel">
|
<div id="subtab-overview" class="sub-tab-panel">
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="ais">
|
||||||
<strong>AIS Decoder</strong>
|
<strong>AIS Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes dual-channel AIS traffic from RX audio using 9.6 kbit/s GMSK and HDLC.
|
Decodes dual-channel AIS traffic from RX audio using 9.6 kbit/s GMSK and HDLC.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="vdes">
|
||||||
<strong>VDES Decoder</strong>
|
<strong>VDES Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes single-channel 100 kHz VDES bursts from SDR IQ using the dedicated VDES path.
|
Decodes single-channel 100 kHz VDES bursts from SDR IQ using the dedicated VDES path.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="aprs">
|
||||||
<strong>APRS Decoder</strong>
|
<strong>APRS Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes APRS packets from RX audio using Bell 202 AFSK (1200 baud).
|
Decodes APRS packets from RX audio using Bell 202 AFSK (1200 baud).
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="cw">
|
||||||
<strong>CW Decoder</strong>
|
<strong>CW Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes CW (Morse code) from RX audio.
|
Decodes CW (Morse code) from RX audio.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="ft8">
|
||||||
<strong>FT8 Decoder</strong>
|
<strong>FT8 Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes FT8 messages from RX audio (DIG/USB only, toggle required).
|
Decodes FT8 messages from RX audio (DIG/USB only, toggle required).
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="ft4">
|
||||||
<strong>FT4 Decoder</strong>
|
<strong>FT4 Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes FT4 messages from RX audio (DIG/USB only, toggle required). 7.5-second slots.
|
Decodes FT4 messages from RX audio (DIG/USB only, toggle required). 7.5-second slots.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="ft2">
|
||||||
<strong>FT2 Decoder</strong>
|
<strong>FT2 Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes FT2 messages from RX audio (DIG/USB only, toggle required). 3.75-second slots.
|
Decodes FT2 messages from RX audio (DIG/USB only, toggle required). 3.75-second slots.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="wspr">
|
||||||
<strong>WSPR Decoder</strong>
|
<strong>WSPR Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes WSPR messages from RX audio (DIG/USB only, toggle required).
|
Decodes WSPR messages from RX audio (DIG/USB only, toggle required).
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="rds">
|
||||||
<strong>RDS Decoder</strong>
|
<strong>RDS Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes Radio Data System (RDS) metadata from WFM broadcasts (57 kHz subcarrier).
|
Decodes Radio Data System (RDS) metadata from WFM broadcasts (57 kHz subcarrier).
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="plugin-item">
|
<div class="plugin-item" data-decoder="lrpt">
|
||||||
<strong>Weather Satellite Decoder</strong>
|
<strong>Weather Satellite Decoder</strong>
|
||||||
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
<div style="color:var(--text-muted); font-size:0.85rem; margin-top:0.2rem;">
|
||||||
Decodes Meteor-M LRPT (137 MHz QPSK) weather satellite imagery.
|
Decodes Meteor-M LRPT (137 MHz QPSK) weather satellite imagery.
|
||||||
|
|||||||
Reference in New Issue
Block a user