fix(web): Started toggle survives the Executions card's 5s poll

The card's own htmx poll re-renders the whole table from the server every
5s, always starting fresh at "relative" -- so a toggled-to-absolute cell
snapped back on the next poll. Each button now has a stable id
(started-{run_id}-{attempt}, or started-vm-{vmx} on an unmatched-VM row);
app.js remembers which format was showing per id and re-applies it to the
fresh button after every swap, rather than freezing the node itself (which
would also freeze its relative-time text, badge, duration, everything else
in that row).
This commit is contained in:
2026-07-26 00:25:33 +02:00
parent 0d9c5ab353
commit bfa90190ea
4 changed files with 60 additions and 20 deletions
+8 -4
View File
@@ -362,10 +362,14 @@ card's own `.table-wrap` rather than the page, same as the other wide tables
**Started is click-to-toggle.** It renders relative ("2h ago") by default;
clicking swaps to the absolute local timestamp, and clicking again swaps
back. Both strings are pre-rendered server-side into the button's
`data-relative`/`data-absolute` attributes, so the swap (`app.js`, delegated
on `document.body`) is instant and needs no request — and keeps working
after the card's own 5s poll replaces the row, since the listener isn't on
the button itself.
`data-relative`/`data-absolute` attributes, so the swap (`app.js`) is
instant and needs no request. The card's own 5s poll re-renders the whole
table from the server, always starting back at relative — so which format
was showing is remembered client-side, keyed by the button's stable `id`
(`started-{run_id}-{attempt}`, or `started-vm-{vmx}` for an unmatched VM
row), and re-applied to the fresh button after every poll rather than
frozen onto the old node (which would also freeze its relative-time text,
badge, duration — everything else in that row).
Runs come from Gitea's Actions API: `/api/v1/admin/actions/runs` (every repo
on the instance, admin token) with `/api/v1/user/actions/runs` as the