hub(R-1299): the window grant/cancel event is really stored (0.174.0 wrote no row); the block moves to the Backup & DR tab
gates / gates (push) Successful in 1m59s

This commit is contained in:
admin committed 2026-10-27 20:12:43 +01:00
1 parent 1796112508
commit de57c090bf
4 files changed
+113 -67

No files matched your search

@@ -344,61 +344,8 @@
claim the repository is empty and that is not what is known. They fill in after the next
off-site run reads the repository.</p>
{{end}}
<p class="text-muted">The one-time clean-up window is on the <a href="#tab=backup">Backup &amp; DR</a> tab.</p>
<!-- R-1299: the one-shot clean-up window. Same route and rule as the script address
(POST /offsite/window-grant/<customer>, offsite:write); the confirm step is a GET that stores nothing. -->
{{with $.WindowCard}}
<h3 id="offsite-window">Clean-up window</h3>
<div class="info-grid">
<div class="info-item">
<span class="label">Weekly windows</span>
<span class="value">{{if .WeeklyOn}}On{{else}}Off (fleet-wide){{end}}</span>
</div>
<div class="info-item">
<span class="label">Normal cap per window</span>
<span class="value">{{if .CapKnown}}{{.NormalCap}} (half the snapshots, at least 5){{else}}&mdash; (half the snapshots; count not measured){{end}}</span>
</div>
<div class="info-item">
<span class="label">One-time window</span>
<span class="value">{{if .Pending}}<strong>waiting</strong> &mdash; {{if .PendingMax}}limit {{.PendingMax}}{{else}}the normal cap{{end}}{{else}}none waiting{{end}}</span>
</div>
<div class="info-item">
<span class="label">Last window</span>
<span class="value">{{with .Last}}#{{.ID}} {{.OpenedAt.UTC.Format "2006-01-02 15:04"}} UTC &mdash; {{if .ClosedAt.IsZero}}open{{else}}{{.BoxResult}}, {{.CountBefore}} &rarr; {{.CountAfter}}{{end}}{{if .MaxRemove}} (cap {{.MaxRemove}}){{end}}{{else}}never{{end}}</span>
</div>
</div>
{{if .Pending}}
<form method="POST" action="/offsite/window-grant/{{$.CustomerID}}" class="inline-confirm">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="from" value="page">
<input type="hidden" name="cancel" value="1">
<button type="submit" class="btn btn-outline btn-sm">Cancel the waiting window</button>
</form>
{{else if .Confirm}}
<div class="flash flash-warn" id="window-confirm">
Open <strong>one</strong> clean-up window for <strong>{{$.CustomerID}}</strong> with
<strong>{{if .ConfirmLimit}}a limit of {{.ConfirmLimit}}{{else}}the normal cap{{end}}</strong>?
The box uses it on its next off-site run; it removes only what its keep rule selects, and the
fake-snapshot guard still runs. One use, then it is gone.
<form method="POST" action="/offsite/window-grant/{{$.CustomerID}}" class="inline-confirm">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="from" value="page">
<input type="hidden" name="confirm" value="1">
<input type="hidden" name="max_remove" value="{{.ConfirmLimit}}">
<button type="submit" class="btn btn-danger btn-sm">Open the window</button>
<a href="/customers/{{$.CustomerID}}#offsite-window" class="btn btn-outline btn-sm">Back</a>
</form>
</div>
{{else}}
{{if .LimitError}}<p class="flash flash-error">Not granted: {{.LimitError}}.</p>{{end}}
<form method="GET" action="/customers/{{$.CustomerID}}" class="inline-confirm" id="window-form">
<input type="hidden" name="window" value="confirm">
<label for="window_max">Limit for this window (empty = the normal cap; at most {{.Bound}})</label>
<input type="number" id="window_max" name="window_max" min="1" max="{{.Bound}}">
<button type="submit" class="btn btn-outline btn-sm">Open one clean-up window&hellip;</button>
</form>
{{end}}
{{end}}
{{end}}
{{end}}
</section>
@@ -1091,6 +1038,64 @@
<div class="tab-panel" data-tab="backup">
{{if .HasReports}}
{{if and .BackupCard.OffsiteReported .BackupCard.OffsiteEnabled}}
<section class="card" id="offsite-window">
<h2>Off-site clean-up window</h2>
<!-- R-1299: the one-shot clean-up window. Same route and rule as the script address
(POST /offsite/window-grant/<customer>, offsite:write); the confirm step is a GET that stores nothing. -->
{{with $.WindowCard}}
<div class="info-grid">
<div class="info-item">
<span class="label">Weekly windows</span>
<span class="value">{{if .WeeklyOn}}On{{else}}Off (fleet-wide){{end}}</span>
</div>
<div class="info-item">
<span class="label">Normal cap per window</span>
<span class="value">{{if .CapKnown}}{{.NormalCap}} (half the snapshots, at least 5){{else}}&mdash; (half the snapshots; count not measured){{end}}</span>
</div>
<div class="info-item">
<span class="label">One-time window</span>
<span class="value">{{if .Pending}}<strong>waiting</strong> &mdash; {{if .PendingMax}}limit {{.PendingMax}}{{else}}the normal cap{{end}}{{else}}none waiting{{end}}</span>
</div>
<div class="info-item">
<span class="label">Last window</span>
<span class="value">{{with .Last}}#{{.ID}} {{.OpenedAt.UTC.Format "2006-01-02 15:04"}} UTC &mdash; {{if .ClosedAt.IsZero}}open{{else}}{{.BoxResult}}, {{.CountBefore}} &rarr; {{.CountAfter}}{{end}}{{if .MaxRemove}} (cap {{.MaxRemove}}){{end}}{{else}}never{{end}}</span>
</div>
</div>
{{if .Pending}}
<form method="POST" action="/offsite/window-grant/{{$.CustomerID}}" class="inline-confirm">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="from" value="page">
<input type="hidden" name="cancel" value="1">
<button type="submit" class="btn btn-outline btn-sm">Cancel the waiting window</button>
</form>
{{else if .Confirm}}
<div class="flash flash-warn" id="window-confirm">
Open <strong>one</strong> clean-up window for <strong>{{$.CustomerID}}</strong> with
<strong>{{if .ConfirmLimit}}a limit of {{.ConfirmLimit}}{{else}}the normal cap{{end}}</strong>?
The box uses it on its next off-site run; it removes only what its keep rule selects, and the
fake-snapshot guard still runs. One use, then it is gone.
<form method="POST" action="/offsite/window-grant/{{$.CustomerID}}" class="inline-confirm">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="from" value="page">
<input type="hidden" name="confirm" value="1">
<input type="hidden" name="max_remove" value="{{.ConfirmLimit}}">
<button type="submit" class="btn btn-danger btn-sm">Open the window</button>
<a href="/customers/{{$.CustomerID}}#tab=backup" class="btn btn-outline btn-sm">Back</a>
</form>
</div>
{{else}}
{{if .LimitError}}<p class="flash flash-error">Not granted: {{.LimitError}}.</p>{{end}}
<form method="GET" action="/customers/{{$.CustomerID}}#tab=backup" class="inline-confirm" id="window-form">
<input type="hidden" name="window" value="confirm">
<label for="window_max">Limit for this window (empty = the normal cap; at most {{.Bound}})</label>
<input type="number" id="window_max" name="window_max" min="1" max="{{.Bound}}">
<button type="submit" class="btn btn-outline btn-sm">Open one clean-up window&hellip;</button>
</form>
{{end}}
{{end}}
</section>
{{end}}
{{if .HasDRRecipe}}
<!-- DR recipe (secret-free reconstruction recipe) -->
<section class="card">