renderReminders: re-indent body inside paintAtomic callback
argus 🟡 nit on #480 — the `if (!rows.length)` block sat at +6 inside the paintAtomic callback, but the `const ul` + for loop underneath stayed at the pre-wrap +4. Code was correct, just visually inconsistent. Re-indented the whole callback body uniformly. renderScheduleNewForm has the same cosmetic mis-indent but its body is ~100 lines; leaving that for a separate sweep so the diff stays focused.
This commit is contained in:
parent
d4a53d83d3
commit
062e2d3055
1 changed files with 57 additions and 57 deletions
|
|
@ -1875,66 +1875,66 @@ window.marked = marked;
|
||||||
root.append(el('p', { class: 'empty' }, 'no queued reminders'));
|
root.append(el('p', { class: 'empty' }, 'no queued reminders'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ul = el('ul', { class: 'reminders' });
|
const ul = el('ul', { class: 'reminders' });
|
||||||
for (const r of rows) {
|
for (const r of rows) {
|
||||||
const failed = (r.attempt_count || 0) > 0;
|
const failed = (r.attempt_count || 0) > 0;
|
||||||
const li = el('li', { class: 'reminder-row' + (failed ? ' reminder-failed' : '') });
|
const li = el('li', { class: 'reminder-row' + (failed ? ' reminder-failed' : '') });
|
||||||
const dueIn = r.due_at - Math.floor(Date.now() / 1000);
|
const dueIn = r.due_at - Math.floor(Date.now() / 1000);
|
||||||
const dueLabel = dueIn <= 0
|
const dueLabel = dueIn <= 0
|
||||||
? `overdue ${fmtAgo(r.due_at)}`
|
? `overdue ${fmtAgo(r.due_at)}`
|
||||||
: `in ${fmtDuration(dueIn)}`;
|
: `in ${fmtDuration(dueIn)}`;
|
||||||
const head = el('div', { class: 'reminder-head' },
|
const head = el('div', { class: 'reminder-head' },
|
||||||
el('span', { class: 'agent' }, r.agent), ' ',
|
el('span', { class: 'agent' }, r.agent), ' ',
|
||||||
el('span', { class: 'meta', title: new Date(r.due_at * 1000).toISOString() }, dueLabel),
|
el('span', { class: 'meta', title: new Date(r.due_at * 1000).toISOString() }, dueLabel),
|
||||||
' ',
|
' ',
|
||||||
el('span', { class: 'meta' }, `· id ${r.id}`),
|
el('span', { class: 'meta' }, `· id ${r.id}`),
|
||||||
);
|
);
|
||||||
if (r.file_path) {
|
if (r.file_path) {
|
||||||
head.append(' ', el('span', { class: 'meta' }, '· payload → '));
|
head.append(' ', el('span', { class: 'meta' }, '· payload → '));
|
||||||
appendLinkified(head, r.file_path);
|
appendLinkified(head, r.file_path);
|
||||||
}
|
}
|
||||||
if (failed) {
|
if (failed) {
|
||||||
head.append(' ', el('span',
|
head.append(' ', el('span',
|
||||||
{
|
{
|
||||||
class: 'badge badge-warn',
|
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)',
|
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`));
|
`⚠ ${r.attempt_count} failed`));
|
||||||
}
|
}
|
||||||
const body = el('div', { class: 'reminder-body' });
|
const body = el('div', { class: 'reminder-body' });
|
||||||
appendLinkified(body, r.message);
|
appendLinkified(body, r.message);
|
||||||
li.append(head, body);
|
li.append(head, body);
|
||||||
if (r.last_error) {
|
if (r.last_error) {
|
||||||
li.append(el('div', { class: 'reminder-error' },
|
li.append(el('div', { class: 'reminder-error' },
|
||||||
el('span', { class: 'msg-sep' }, 'error: '),
|
el('span', { class: 'msg-sep' }, 'error: '),
|
||||||
r.last_error,
|
r.last_error,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
const actions = el('div', { class: 'reminder-actions' });
|
const actions = el('div', { class: 'reminder-actions' });
|
||||||
if (failed) {
|
if (failed) {
|
||||||
// Retry resets the failure counters so the scheduler picks
|
// Retry resets the failure counters so the scheduler picks
|
||||||
// the row up again on its next 5s tick. No data-no-refresh
|
// the row up again on its next 5s tick. No data-no-refresh
|
||||||
// — the resulting refreshState re-fires refreshReminders.
|
// — the resulting refreshState re-fires refreshReminders.
|
||||||
const retryForm = el('form', {
|
const retryForm = el('form', {
|
||||||
method: 'POST', action: '/retry-reminder/' + r.id,
|
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': '',
|
class: 'inline', 'data-async': '',
|
||||||
|
'data-confirm': `cancel reminder ${r.id} for ${r.agent}? this drops the queued delivery; no undo.`,
|
||||||
});
|
});
|
||||||
retryForm.append(el('button',
|
cancelForm.append(el('button', { type: 'submit', class: 'btn btn-deny' }, '✗ C4NC3L'));
|
||||||
{ type: 'submit', class: 'btn btn-restart' }, '↻ R3TRY'));
|
actions.append(cancelForm);
|
||||||
actions.append(retryForm);
|
li.append(actions);
|
||||||
|
ul.append(li);
|
||||||
}
|
}
|
||||||
const cancelForm = el('form', {
|
root.append(ul);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
function fmtDuration(secs) {
|
function fmtDuration(secs) {
|
||||||
if (secs < 60) return secs + 's';
|
if (secs < 60) return secs + 's';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue