fix(web): job log polls while active, one service history limit (#7)

This commit is contained in:
2026-10-12 19:13:01 +02:00
parent 88d5507217
commit 8b2c10cc05
3 changed files with 22 additions and 5 deletions
+4 -3
View File
@@ -1,12 +1,12 @@
{{define "content"}}
<h1>Job #{{.Job.ID}}</h1>
<p><a href="/services/{{.Job.ServiceID}}">{{.Job.ServiceName}}</a></p>
<div id="job" hx-get="/fragments/jobs/{{.Job.ID}}" hx-trigger="sse:job-{{.Job.ID}}" hx-swap="innerHTML">
{{template "job" .}}
</div>
{{template "job" .}}
{{end}}
{{/* The wrapper is part of the fragment and swapped as outerHTML, so a finished job drops the polling timer. The timer recovers from a dropped SSE signal. */}}
{{define "job"}}
<div id="job" hx-get="/fragments/jobs/{{.Job.ID}}" hx-trigger="sse:job-{{.Job.ID}}{{if .Job.Active}}, every 2s{{end}}" hx-swap="outerHTML">
<table class="details">
<tr><th>Status</th><td class="status status-job-{{.Job.Status}}">{{.Job.Status}}</td></tr>
<tr><th>From</th><td><code>{{shortRef .Job.FromRef}}</code></td></tr>
@@ -18,4 +18,5 @@
{{if .Job.Error}}<p class="error">{{.Job.Error}}</p>{{end}}
{{if .Job.OutputTruncated}}<p class="muted">Earlier output truncated.</p>{{end}}
<pre class="log">{{.Job.Output}}</pre>
</div>
{{end}}