Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Refresh run status on focus and show one clock per job

aa38f6b2428795995009fbe14a0b5a82b83006c6 · Keenan Nemetz · 9d ago · parent 8ca8bbe0

Refresh run status on focus and show one clock per job

A page in an unfocused window kept its durations moving while its status
stopped changing. The clock is arithmetic from a start timestamp, so it jumps
to the right value when the reader returns; the status is server-rendered HTML
that only moves when something re-fetches it. The result was a page minutes
behind that looked current.

Hidden and unfocused windows are not being read, so the answer is not to keep
polling them. The polls now skip a tick while the window is unfocused and mark
their region stale; the repository header says how old the last answer is, and
queued or running dots go hollow and stop pulsing. Returning to the window
dispatches vole-refresh, which every poll answers immediately instead of
waiting out its interval. The stale mark is cleared only by a refresh that
succeeded. Finished statuses are never marked, because they cannot change.

The overview's recent runs and the runs tab now poll too, and the run page
keeps itself current while a run is queued as well as running, so a queued
page picks up the start it was waiting for. A run row shows one clock: the
queue wait while queued, the run time while running, and the total it took once
finished. The run page keeps its separate duration and queue-wait cards, which
is where both numbers belong.

A running job's status dot pulses while the page is live.

Fixes #367.

server/web/static/vole.css +41

@@ -540,9 +540,30 @@ img { max-width: 100%; }
540 540 /* ---------- repository header ---------- */
541 541
542 542 .repohead {
543 position: relative;
543 544 margin-bottom: 16px;
544 545 border-bottom: 1px solid var(--border);
545 546 }
547 /* How old a paused page's answer is. It sits in the tab row instead of in the
548 flow so gaining and losing focus does not move the page under the reader. */
549 .live-note {
550 position: absolute;
551 right: 0;
552 bottom: 12px;
553 margin: 0;
554 padding: 2px 8px;
555 border-radius: 999px;
556 background: var(--bg-panel);
557 color: var(--fg-muted);
558 font-size: calc(11.55px * var(--font-scale));
559 white-space: nowrap;
560 pointer-events: none;
561 }
562 /* Below the desktop widths the tab strip can reach the right edge, so the note
563 takes its own line instead of sitting on top of a tab. */
564 @media (max-width: 1040px) {
565 .live-note { position: static; margin: 0 0 8px; }
566 }
546 567 .repo-title { padding: 26px 0 12px; }
547 568 /* The repository actions sit on the title line, at the far right of the header. */
548 569 .repo-title-row {
@@ -1399,6 +1420,25 @@ pre code { background: none; border: 0; padding: 0; font-size: inherit; }
1399 1420 .status.error { color: var(--warn); }
1400 1421 .status.canceled { color: var(--fg-faint); }
1401 1422
1423 /* A running job's dot breathes while the page is live. The word and the colour
1424 carry the meaning; the movement only says the row is being refreshed. */
1425 .status.running::before { animation: status-pulse 2.4s ease-in-out infinite; }
1426 @keyframes status-pulse {
1427 0%, 100% { opacity: 1; }
1428 50% { opacity: 0.35; }
1429 }
1430
1431 /* An unfocused window is not being refreshed, and a queued or running word is
1432 the only kind that can go out of date. Their dots go hollow and still; the
1433 repository header says how old the answer is. A finished run never changes. */
1434 .is-stale .status.running::before,
1435 .is-stale .status.queued::before {
1436 background: transparent;
1437 border: 1px solid currentColor;
1438 }
1439 .is-stale .status.running::before { animation: none; }
1440 .is-stale .live-only { display: none; }
1441
1402 1442 .chip {
1403 1443 display: inline-flex;
1404 1444 align-items: center;
@@ -2863,6 +2903,7 @@ textarea:focus-visible {
2863 2903 *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
2864 2904 /* The ring still marks the waiting button, but it does not turn. */
2865 2905 .spinner { animation: none; }
2906 .status.running::before { animation: none; }
2866 2907 }
2867 2908
2868 2909 @media (max-width: 720px) {