fix: populate nav instance count on direct detail page load/refresh
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:
3
js/ui.js
3
js/ui.js
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user