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/templates/overview.html +30−16

@@ -79,23 +79,16 @@ git push -u origin {{.Ref}}</pre>
79 79 {{end}}
80 80 </section>
81 81
82 <section>
82 {{/* The recent runs are the page's only live region. A queued or running
83 job is the one thing on the overview that changes on its own, and the
84 poll refreshes the rows in place so the README and the rest of the
85 sidebar stay put. */}}
86 <section id="overview-runs" data-live
87 hx-get="/{{.Name}}/overview/runs"
88 hx-trigger="every 30s, vole-refresh from:body"
89 hx-target="#overview-runs-body" hx-swap="innerHTML" hx-sync="this:replace">
83 90 <h2 class="with-more"><span>{{icon "play"}}Recent runs</span> <a class="more" href="/{{.Name}}/runs">all</a></h2>
84 {{if .Runs}}
85 <div class="side-list">
86 {{range .Runs}}
87 <a class="side-run" href="/{{$.Name}}/runs/{{.ID}}">
88 <span class="side-run-top">
89 <span class="status {{.Status}}">{{.Status}}</span>
90 <span class="side-subject">{{.JobTitle}}</span>
91 </span>
92 <span class="side-meta">{{if .Tag}}<span class="side-ellipsis" title="tag {{.Tag}}">tag {{.Tag}}</span>{{else if .Branch}}<span class="side-ellipsis" title="{{.Branch}}">{{.Branch}}</span>{{end}}{{template "run_times" .}}</span>
93 </a>
94 {{end}}
95 </div>
96 {{else}}
97 <p class="muted">No runs yet.</p>
98 {{end}}
91 <div id="overview-runs-body">{{template "overview_runs" .}}</div>
99 92 </section>
100 93
101 94 <section>
@@ -149,3 +142,24 @@ git push -u origin {{.Ref}}</pre>
149 142 </div>
150 143 {{template "footer" .}}
151 144 {{end}}
145
146 {{/* The rows alone, so the poll can replace them without touching the section
147 heading or the links around it. It is also what a page without scripts
148 renders inside the section above. */}}
149 {{define "overview_runs"}}
150 {{if .Runs}}
151 <div class="side-list">
152 {{range .Runs}}
153 <a class="side-run" href="/{{$.Name}}/runs/{{.ID}}">
154 <span class="side-run-top">
155 <span class="status {{.Status}}">{{.Status}}</span>
156 <span class="side-subject">{{.JobTitle}}</span>
157 </span>
158 <span class="side-meta">{{if .Tag}}<span class="side-ellipsis" title="tag {{.Tag}}">tag {{.Tag}}</span>{{else if .Branch}}<span class="side-ellipsis" title="{{.Branch}}">{{.Branch}}</span>{{end}}{{template "run_times" .}}</span>
159 </a>
160 {{end}}
161 </div>
162 {{else}}
163 <p class="muted">No runs yet.</p>
164 {{end}}
165 {{end}}