diff --git a/frontend/packages/dashboard/src/app.js b/frontend/packages/dashboard/src/app.js index a9847d3f..231b0e44 100644 --- a/frontend/packages/dashboard/src/app.js +++ b/frontend/packages/dashboard/src/app.js @@ -1875,66 +1875,66 @@ window.marked = marked; root.append(el('p', { class: 'empty' }, 'no queued reminders')); return; } - const ul = el('ul', { class: 'reminders' }); - for (const r of rows) { - const failed = (r.attempt_count || 0) > 0; - const li = el('li', { class: 'reminder-row' + (failed ? ' reminder-failed' : '') }); - const dueIn = r.due_at - Math.floor(Date.now() / 1000); - const dueLabel = dueIn <= 0 - ? `overdue ${fmtAgo(r.due_at)}` - : `in ${fmtDuration(dueIn)}`; - const head = el('div', { class: 'reminder-head' }, - el('span', { class: 'agent' }, r.agent), ' ', - el('span', { class: 'meta', title: new Date(r.due_at * 1000).toISOString() }, dueLabel), - ' ', - el('span', { class: 'meta' }, `· id ${r.id}`), - ); - if (r.file_path) { - head.append(' ', el('span', { class: 'meta' }, '· payload → ')); - appendLinkified(head, r.file_path); - } - if (failed) { - head.append(' ', el('span', - { - class: 'badge badge-warn', - title: 'consecutive failed delivery attempts (capped at 5; over the cap the scheduler stops retrying until you click R3TRY or cancel)', - }, - `⚠ ${r.attempt_count} failed`)); - } - const body = el('div', { class: 'reminder-body' }); - appendLinkified(body, r.message); - li.append(head, body); - if (r.last_error) { - li.append(el('div', { class: 'reminder-error' }, - el('span', { class: 'msg-sep' }, 'error: '), - r.last_error, - )); - } - const actions = el('div', { class: 'reminder-actions' }); - if (failed) { - // Retry resets the failure counters so the scheduler picks - // the row up again on its next 5s tick. No data-no-refresh - // — the resulting refreshState re-fires refreshReminders. - const retryForm = el('form', { - method: 'POST', action: '/retry-reminder/' + r.id, + const ul = el('ul', { class: 'reminders' }); + for (const r of rows) { + const failed = (r.attempt_count || 0) > 0; + const li = el('li', { class: 'reminder-row' + (failed ? ' reminder-failed' : '') }); + const dueIn = r.due_at - Math.floor(Date.now() / 1000); + const dueLabel = dueIn <= 0 + ? `overdue ${fmtAgo(r.due_at)}` + : `in ${fmtDuration(dueIn)}`; + const head = el('div', { class: 'reminder-head' }, + el('span', { class: 'agent' }, r.agent), ' ', + el('span', { class: 'meta', title: new Date(r.due_at * 1000).toISOString() }, dueLabel), + ' ', + el('span', { class: 'meta' }, `· id ${r.id}`), + ); + if (r.file_path) { + head.append(' ', el('span', { class: 'meta' }, '· payload → ')); + appendLinkified(head, r.file_path); + } + if (failed) { + head.append(' ', el('span', + { + class: 'badge badge-warn', + title: 'consecutive failed delivery attempts (capped at 5; over the cap the scheduler stops retrying until you click R3TRY or cancel)', + }, + `⚠ ${r.attempt_count} failed`)); + } + const body = el('div', { class: 'reminder-body' }); + appendLinkified(body, r.message); + li.append(head, body); + if (r.last_error) { + li.append(el('div', { class: 'reminder-error' }, + el('span', { class: 'msg-sep' }, 'error: '), + r.last_error, + )); + } + const actions = el('div', { class: 'reminder-actions' }); + if (failed) { + // Retry resets the failure counters so the scheduler picks + // the row up again on its next 5s tick. No data-no-refresh + // — the resulting refreshState re-fires refreshReminders. + const retryForm = el('form', { + method: 'POST', action: '/retry-reminder/' + r.id, + class: 'inline', 'data-async': '', + }); + retryForm.append(el('button', + { type: 'submit', class: 'btn btn-restart' }, '↻ R3TRY')); + actions.append(retryForm); + } + const cancelForm = el('form', { + method: 'POST', action: '/cancel-reminder/' + r.id, class: 'inline', 'data-async': '', + 'data-confirm': `cancel reminder ${r.id} for ${r.agent}? this drops the queued delivery; no undo.`, }); - retryForm.append(el('button', - { type: 'submit', class: 'btn btn-restart' }, '↻ R3TRY')); - actions.append(retryForm); + cancelForm.append(el('button', { type: 'submit', class: 'btn btn-deny' }, '✗ C4NC3L')); + actions.append(cancelForm); + li.append(actions); + ul.append(li); } - const cancelForm = el('form', { - method: 'POST', action: '/cancel-reminder/' + r.id, - class: 'inline', 'data-async': '', - 'data-confirm': `cancel reminder ${r.id} for ${r.agent}? this drops the queued delivery; no undo.`, - }); - cancelForm.append(el('button', { type: 'submit', class: 'btn btn-deny' }, '✗ C4NC3L')); - actions.append(cancelForm); - li.append(actions); - ul.append(li); - } - root.append(ul); - }); // paintAtomic + root.append(ul); + }); } function fmtDuration(secs) { if (secs < 60) return secs + 's';