fix: populate nav instance count on direct detail page load/refresh
All checks were successful
CI / test (pull_request) Successful in 13s
CI / build-dev (pull_request) Has been skipped

nav-count was only set in renderDashboard, so loading /instance/:vmid
directly left it showing "—". Add getInstances() to the parallel fetch
in renderDetailPage and set the count there too.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-28 15:15:55 -04:00
parent 0e1e9b6699
commit 8ead7687e5

View File

@@ -156,9 +156,10 @@ function fmtHistVal(field, val) {
} }
async function renderDetailPage(vmid) { async function renderDetailPage(vmid) {
const [inst, history] = await Promise.all([getInstance(vmid), getInstanceHistory(vmid)]); const [inst, history, all] = await Promise.all([getInstance(vmid), getInstanceHistory(vmid), getInstances()]);
if (!inst) { navigate('dashboard'); return; } if (!inst) { navigate('dashboard'); return; }
currentVmid = vmid; currentVmid = vmid;
document.getElementById('nav-count').textContent = `${all.length} instance${all.length !== 1 ? 's' : ''}`;
document.getElementById('detail-vmid-crumb').textContent = vmid; document.getElementById('detail-vmid-crumb').textContent = vmid;
document.getElementById('detail-name').textContent = inst.name; document.getElementById('detail-name').textContent = inst.name;