dashboard: show when an approval was requested (closes #272)
This commit is contained in:
parent
908cadb151
commit
a9a10b631f
4 changed files with 40 additions and 2 deletions
|
|
@ -1193,6 +1193,12 @@
|
|||
sha_short: ev.sha_short || null,
|
||||
diff: ev.diff || null,
|
||||
description: ev.description || null,
|
||||
// The ApprovalAdded event carries no requested_at; a live-added
|
||||
// approval was queued just now, so client-now is accurate — and
|
||||
// consistent with how fmtAgo compares everything to client-now.
|
||||
// A later /api/state cold-load swaps in the server value. (#272)
|
||||
requested_at: ev.requested_at != null
|
||||
? ev.requested_at : Math.floor(Date.now() / 1000),
|
||||
};
|
||||
if (existing >= 0) approvalsState.pending[existing] = row;
|
||||
else approvalsState.pending.push(row);
|
||||
|
|
@ -1364,6 +1370,16 @@
|
|||
isApply ? 'apply' : isInit ? 'init' : 'spawn'),
|
||||
);
|
||||
if (isApply && a.sha_short) head.append(el('code', {}, a.sha_short));
|
||||
// When the approval was requested — relative time, right-aligned.
|
||||
// Goes amber once it's been pending an hour so a stale request is
|
||||
// obvious at a glance. (issue #272)
|
||||
if (a.requested_at != null) {
|
||||
const ageSec = Math.max(0, Math.floor(Date.now() / 1000 - a.requested_at));
|
||||
head.append(el('span', {
|
||||
class: 'approval-ts' + (ageSec >= 3600 ? ' stale' : ''),
|
||||
title: 'requested ' + new Date(a.requested_at * 1000).toLocaleString(),
|
||||
}, 'requested ' + fmtAgo(a.requested_at)));
|
||||
}
|
||||
li.append(head);
|
||||
|
||||
// ── what-changed body ────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -299,6 +299,18 @@ code {
|
|||
flex-wrap: wrap;
|
||||
gap: 0.3em;
|
||||
}
|
||||
/* When the approval was requested — right-aligned in the head row;
|
||||
goes amber once it has been pending ≥ 1h so a stale request stands
|
||||
out at a glance (issue #272). */
|
||||
.approval-ts {
|
||||
margin-left: auto;
|
||||
color: var(--muted);
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.approval-ts.stale {
|
||||
color: var(--amber);
|
||||
text-shadow: 0 0 6px rgba(250, 179, 135, 0.5);
|
||||
}
|
||||
.approval-body {
|
||||
margin: 0.45em 0;
|
||||
padding-left: 1.3em;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue