fix(dashboard): init_config kind label in approval history + remove dead ticker loop

Two small fixes in tabs.js:

1. renderApprovalHistory showed 'spawn' for init_config approvals.
   The pending-approvals path already handles the three kinds correctly
   (apply / init / spawn); history used a two-branch ternary that fell
   through to 'spawn' for init_config. Fixed to match the pending path.

2. The 1s interval that ticks rebuild-queue elapsed badges contained a
   second loop polling '.build-logs-runtime[data-bl-elapsed]'. No code
   in tabs.js ever sets that attribute — the logs page manages its own
   elapsed timers inside logs.js. Removed the dead loop.
This commit is contained in:
iris 2026-06-05 10:55:30 +02:00 committed by mara
commit 435be4302e

View file

@ -2087,7 +2087,7 @@ window.marked = marked;
el('span', { class: 'glyph glyph-' + a.status }, glyph), ' ',
el('span', { class: 'id' }, '#' + a.id), ' ',
el('span', { class: 'agent' }, a.agent), ' ',
el('span', { class: 'kind' }, a.kind === 'apply_commit' ? 'apply' : 'spawn'), ' ',
el('span', { class: 'kind' }, a.kind === 'apply_commit' ? 'apply' : a.kind === 'init_config' ? 'init' : 'spawn'), ' ',
);
if (a.sha_short) row.append(el('code', {}, a.sha_short), ' ');
row.append(
@ -2374,6 +2374,10 @@ window.marked = marked;
// Tick once per second to refresh "running Xs" badges in place
// (mirrors the question-TTL ticker pattern above).
// Tick rebuild-queue elapsed-time badges once per second.
// `.rqe-when[data-rqe-elapsed]` is set on running queue entries by
// `renderQueueEntry`; the ticker avoids a full re-render just for the
// wall-clock update.
setInterval(() => {
for (const span of document.querySelectorAll('.rqe-when[data-rqe-elapsed]')) {
const started = parseInt(span.dataset.rqeElapsed, 10);
@ -2381,12 +2385,6 @@ window.marked = marked;
const elapsed = Math.max(0, Math.floor(Date.now() / 1000 - started));
span.textContent = '· ' + fmtElapsed(elapsed);
}
for (const span of document.querySelectorAll('.build-logs-runtime[data-bl-elapsed]')) {
const started = parseInt(span.dataset.blElapsed, 10);
if (!started) continue;
const elapsed = Math.max(0, Math.floor(Date.now() / 1000 - started));
span.textContent = fmtElapsed(elapsed);
}
}, 1000);
// ─── reminders ──────────────────────────────────────────────────────────