fix(hud): hide vessel and FIRMS rows when those feeds are unset
Read feeds.vessels.configured and feeds.fires.configured from /api/stats. A missing feeds object leaves both rows visible. WFIGS and trains stay.
This commit is contained in:
parent
d04ddc9afa
commit
c572f0ee60
2 changed files with 170 additions and 0 deletions
|
|
@ -1508,6 +1508,23 @@ function setLayerCount(id, value) {
|
|||
}
|
||||
}
|
||||
|
||||
function applyFeedConfig(s) {
|
||||
// Hide only when /api/stats says the key is unset. Missing feeds (old image)
|
||||
// leaves both rows visible. Never infer from a zero count. Never touch WFIGS or trains.
|
||||
const feeds = (s && typeof s.feeds === 'object' && s.feeds) ? s.feeds : null;
|
||||
setFeedRow('lp-vessels-on', feeds && feeds.vessels);
|
||||
setFeedRow('lp-fires-on', feeds && feeds.fires);
|
||||
}
|
||||
function setFeedRow(id, flag) {
|
||||
const el = document.getElementById(id);
|
||||
const row = el && el.closest ? el.closest('.lp-layer') : null;
|
||||
if (!row) return;
|
||||
const hide = !!(flag && flag.configured === false);
|
||||
row.hidden = hide;
|
||||
// .lp-layer { display:flex } beats the UA [hidden] rule — inline display is what hides it.
|
||||
row.style.display = hide ? 'none' : '';
|
||||
}
|
||||
|
||||
async function pollLayerStats() {
|
||||
if (statsPollDisabled) return;
|
||||
try {
|
||||
|
|
@ -1516,6 +1533,7 @@ async function pollLayerStats() {
|
|||
if (!r.ok) return;
|
||||
const s = await r.json();
|
||||
if (!s || typeof s !== 'object') return;
|
||||
applyFeedConfig(s);
|
||||
statsRailActive = true;
|
||||
const skipIfOn = {
|
||||
fires: firesOn,
|
||||
|
|
|
|||
Loading…
Reference in a new issue