diff --git a/hbd/server/templates/plugins.html b/hbd/server/templates/plugins.html index b7eb804..0bc946f 100644 --- a/hbd/server/templates/plugins.html +++ b/hbd/server/templates/plugins.html @@ -1305,9 +1305,12 @@ // ── Auto-refresh (30 s) ───────────────────────────────────────────────── setInterval(() => { + document.querySelectorAll('.host-card').forEach(card => { + fetchHostGlance(card.dataset.hostname); + }); + document.querySelectorAll('.host-card:not(.collapsed)').forEach(card => { const hostname = card.dataset.hostname; - fetchHostGlance(hostname); card.querySelectorAll('.plugin-accordion:not(.collapsed)').forEach(acc => { const pname = acc.dataset.plugin; @@ -1327,31 +1330,16 @@ // ── Init ──────────────────────────────────────────────────────────────── document.addEventListener('DOMContentLoaded', () => { - // If a host fragment is in the URL, expand and scroll to that host; - // otherwise expand the first host as before. - const hash = window.location.hash; - if (hash) { - const hostname = decodeURIComponent(hash.slice(1)); + // Fetch glance data for every host immediately so the strip is always populated. + document.querySelectorAll('.host-card').forEach(card => { + fetchHostGlance(card.dataset.hostname); + }); + + // Expand and load info for the target host (URL hash or first host). + function expandHost(hostname) { const card = document.querySelector(`.host-card[data-hostname="${hostname}"]`); - if (card) { - card.classList.remove('collapsed'); - fetchHostGlance(hostname); - fetchHostInfo(hostname).then(data => { - infoCache[hostname] = data; - renderInfoSection(hostname, data); - }).catch(() => { - const el = document.getElementById(`info-${hostname}`); - if (el) el.innerHTML = '
Could not load host info.
'; - }); - setTimeout(() => card.scrollIntoView({ behavior: 'smooth', block: 'start' }), 150); - return; - } - } - const first = document.querySelector('.host-card'); - if (first) { - const hostname = first.dataset.hostname; - first.classList.remove('collapsed'); - fetchHostGlance(hostname); + if (!card) return false; + card.classList.remove('collapsed'); fetchHostInfo(hostname).then(data => { infoCache[hostname] = data; renderInfoSection(hostname, data); @@ -1359,7 +1347,22 @@ const el = document.getElementById(`info-${hostname}`); if (el) el.innerHTML = '
Could not load host info.
'; }); + return true; } + + const hash = window.location.hash; + if (hash) { + const hostname = decodeURIComponent(hash.slice(1)); + if (expandHost(hostname)) { + setTimeout(() => { + const card = document.querySelector(`.host-card[data-hostname="${hostname}"]`); + if (card) card.scrollIntoView({ behavior: 'smooth', block: 'start' }); + }, 150); + return; + } + } + const first = document.querySelector('.host-card'); + if (first) expandHost(first.dataset.hostname); }); // ── Host action helpers ──────────────────────────────────────