ui: P2R-09 auto-init UX — init line in chrome + danger-zone re-init

Latest 'init' job status surfaced under the host-detail vitals strip
(succeeded/failed/running/queued, with link to the live job log on
non-success). New POST /hosts/{id}/repo/reinit handler dispatches a
fresh init job after the operator types the host name to confirm;
audit row records 'host.repo_reinit'.
This commit is contained in:
2026-05-04 10:49:57 +01:00
parent 93ab0ae84f
commit cce3cd8384
6 changed files with 374 additions and 2 deletions
+10 -2
View File
@@ -238,8 +238,16 @@
<span class="mono text-ink-mid">secrets.enc</span> is reused.
</p>
</div>
<button class="btn btn-danger btn-lg flex-none" disabled
title="re-init flow lands in P2R-09">Re-init repo…</button>
<form method="post" action="/hosts/{{$host.ID}}/repo/reinit"
class="flex-none flex flex-col items-end" style="gap: 8px;"
onsubmit="return confirm('Re-initialise the repo on host &quot;{{$host.Name}}&quot;? Existing snapshots are lost if the rest-server allows the wipe; restic refuses if it sees a config file already there.');">
<input type="text" name="confirm_hostname" required autocomplete="off"
placeholder="type hostname to confirm"
class="input mono"
style="width: 240px; height: 30px; padding: 0 8px; font-size: 12px;">
<button type="submit" class="btn btn-danger btn-lg whitespace-nowrap"
{{if eq $host.Status "online"}}{{else}}disabled title="host is offline"{{end}}>Re-init repo…</button>
</form>
</div>
</div>
</div>
+16
View File
@@ -105,6 +105,22 @@
</div>
</div>
{{/* ---------- repo init line (P2R-09) ---------- */}}
{{if $page.InitStatus}}
<div class="text-[11.5px] text-ink-mute mt-2.5 leading-[1.5]">
{{if eq $page.InitStatus "succeeded"}}
repo ready · initialised <span class="mono text-ink-mid" {{if $page.InitAt}}title="{{$page.InitAt.Format "2006-01-02 15:04:05 MST"}}"{{end}}>{{relTime $page.InitAt}}</span>
{{else if eq $page.InitStatus "failed"}}
<span class="text-bad font-medium">init failed</span> ·
<a href="/jobs/{{$page.InitJobID}}" class="link mono">job {{$page.InitJobID}}</a> · retry from the Repo tab's danger zone
{{else if eq $page.InitStatus "running"}}
<span class="text-accent">init running…</span> · <a href="/jobs/{{$page.InitJobID}}" class="link mono">live log →</a>
{{else if eq $page.InitStatus "queued"}}
<span class="text-ink-fade">init queued</span> · <a href="/jobs/{{$page.InitJobID}}" class="link mono">job {{$page.InitJobID}}</a>
{{end}}
</div>
{{end}}
{{/* ---------- secondary tabs ---------- */}}
<div class="flex items-end mt-1.5">
<a class="sub-tab {{if eq $page.SubTab "snapshots"}}active{{end}}" href="/hosts/{{$host.ID}}">Snapshots <span class="mono text-ink-fade text-[11px] ml-1">{{comma $host.SnapshotCount}}</span></a>