hub: operator actions for a box (D1, R-314/R-279/R-177, decision 185)
Host page "Operator Actions" card: run off-site backup now, run a check now
(fixed job list), stop / extend (1-30 days) a deletion countdown. POST
/hosts/{id}/operator-action validates against the CLOSED list before
storing (unknown -> 400, no row), stores operator_actions(id, customer_id,
action, arg, requested_at, requested_by, done_at, outcome, message), logs
who pressed (channel + address) and bumps the box's intent. The report ACK
lists pending rows as operator_actions until the box's
operator_action_results closes them (matched on id AND reporting
customer); each closed row becomes a hub-minted operator_action event
(stored, never dispatched). Unanswered after 24 h: expired. A customer
RESET cancels pending rows. Wire gate: new root + field-by-field mirror
(controller report.OperatorAction) — needs the controller commit first.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
d604e624a3
commit
87af859fc3
14 files changed
+850
-2
No files matched your search
@@ -283,6 +283,80 @@
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
<!-- Operator actions (decision 185, R-314/R-279/R-177): a CLOSED list. None deletes data, starts a
|
||||
countdown or shortens one; the box acts on its next report reply (seconds, at most one cycle). -->
|
||||
<section class="card" id="operator-actions">
|
||||
<h2>Operator Actions</h2>
|
||||
{{if .CustomerID}}
|
||||
<p class="hint" style="color: var(--text-muted); font-size: 0.85rem;">
|
||||
The box acts on its next report reply (usually seconds, at most one report interval) and answers on the
|
||||
report after that. Each press runs once. Recorded in the box's own log and in Events. Unanswered after a day: expired.
|
||||
</p>
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0;">
|
||||
<form method="POST" action="/hosts/{{.HostID}}/operator-action" style="display: inline;">
|
||||
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
|
||||
<input type="hidden" name="action" value="offsite_backup_now">
|
||||
<button type="submit" class="btn btn-sm">Run off-site backup now</button>
|
||||
</form>
|
||||
<form method="POST" action="/hosts/{{.HostID}}/operator-action" style="display: inline;">
|
||||
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
|
||||
<input type="hidden" name="action" value="run_job">
|
||||
<select name="arg">{{range .OperatorJobNames}}<option value="{{.}}">{{.}}</option>{{end}}</select>
|
||||
<button type="submit" class="btn btn-sm">Run check now</button>
|
||||
</form>
|
||||
<form method="POST" action="/hosts/{{.HostID}}/operator-action" style="display: inline;">
|
||||
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
|
||||
<input type="hidden" name="action" value="abandon_stop">
|
||||
<button type="submit" class="btn btn-sm btn-outline">Stop deletion countdown</button>
|
||||
</form>
|
||||
<form method="POST" action="/hosts/{{.HostID}}/operator-action" style="display: inline;">
|
||||
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
|
||||
<input type="hidden" name="action" value="abandon_extend">
|
||||
<input type="number" name="arg" min="1" max="{{.OperatorExtendMaxDay}}" value="7" style="width: 4.5em; padding: 0.3em 0.5em;" aria-label="days">
|
||||
<button type="submit" class="btn btn-sm btn-outline">Extend countdown (days from now)</button>
|
||||
</form>
|
||||
</div>
|
||||
{{if .OperatorActions}}
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Action</th>
|
||||
<th>Requested</th>
|
||||
<th>By</th>
|
||||
<th>Outcome</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .OperatorActions}}
|
||||
<tr>
|
||||
<td>{{.ID}}</td>
|
||||
<td>{{.Action}}{{if .Arg}} {{.Arg}}{{end}}</td>
|
||||
<td>{{timeAgo .RequestedAt}}</td>
|
||||
<td>{{.RequestedBy}}</td>
|
||||
<td>
|
||||
{{if not .DoneAt}}<span class="badge badge-neutral">pending</span>
|
||||
{{else if eq .Outcome "done"}}<span class="badge badge-ok">done</span>
|
||||
{{else if eq .Outcome "failed"}}<span class="badge badge-error">failed</span>
|
||||
{{else}}<span class="badge badge-warn">{{.Outcome}}</span>{{end}}
|
||||
{{if .Message}}<span style="color: var(--text-muted); font-size: 0.85rem;">{{.Message}}</span>{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<div class="empty-state" style="border: none;">
|
||||
<p>No operator actions for this box yet.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="empty-state" style="border: none;">
|
||||
<p>This host has no customer, so there is no controller to act.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
<!-- Network (v0.85.0): where this box actually is. Addresses come from the agent's
|
||||
addresses[] (agent >= 0.119.0); the WireGuard row pairs the HUB's allocation with
|
||||
whether the box confirms holding it, because an allocation alone cannot tell a live
|
||||
|
||||
Reference in new issue
Block a user