Files
mcias/web/templates/fragments/policy_row.html
Kyle Isom 22158824bd Checkpoint: password reset, rule expiry, migrations
- Self-service and admin password-change endpoints
  (PUT /v1/auth/password, PUT /v1/accounts/{id}/password)
- Policy rule time-scoped expiry (not_before / expires_at)
  with migration 000006 and engine filtering
- golang-migrate integration; embedded SQL migrations
- PolicyRecord fieldalignment lint fix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 14:38:38 -07:00

52 lines
2.1 KiB
HTML

{{define "policy_row"}}
<tr id="policy-row-{{.ID}}">
<td class="text-small text-muted">{{.ID}}</td>
<td class="text-small">{{.Priority}}</td>
<td>
<strong>{{.Description}}</strong>
{{if .IsExpired}}<span class="badge" style="background:#dc2626;color:#fff;margin-left:.4rem">expired</span>{{end}}
{{if .IsPending}}<span class="badge" style="background:#d97706;color:#fff;margin-left:.4rem">scheduled</span>{{end}}
{{if or .NotBefore .ExpiresAt}}
<div class="text-small text-muted" style="margin-top:.2rem">
{{if .NotBefore}}Not before: {{.NotBefore}}{{end}}
{{if and .NotBefore .ExpiresAt}} · {{end}}
{{if .ExpiresAt}}Expires: {{.ExpiresAt}}{{end}}
</div>
{{end}}
<details style="margin-top:.25rem">
<summary class="text-small text-muted" style="cursor:pointer">Show rule JSON</summary>
<pre style="font-size:.75rem;background:#f8fafc;padding:.5rem;border-radius:4px;overflow:auto;margin-top:.25rem">{{.RuleJSON}}</pre>
</details>
</td>
<td class="text-small">
{{/* Extract effect from RuleJSON via prettyJSON — displayed separately */}}
<span class="badge {{if .Enabled}}badge-active{{else}}badge-inactive{{end}}">
{{if .Enabled}}enabled{{else}}disabled{{end}}
</span>
</td>
<td>
{{if .Enabled}}
<button class="btn btn-sm btn-secondary"
hx-patch="/policies/{{.ID}}/enabled"
hx-vals='{"enabled":"0"}'
hx-target="#policy-row-{{.ID}}"
hx-swap="outerHTML">Disable</button>
{{else}}
<button class="btn btn-sm btn-secondary"
hx-patch="/policies/{{.ID}}/enabled"
hx-vals='{"enabled":"1"}'
hx-target="#policy-row-{{.ID}}"
hx-swap="outerHTML">Enable</button>
{{end}}
</td>
<td class="text-small text-muted">{{.UpdatedAt}}</td>
<td>
<button class="btn btn-sm btn-danger"
hx-delete="/policies/{{.ID}}"
hx-target="#policy-row-{{.ID}}"
hx-swap="outerHTML"
hx-confirm="Delete policy rule {{.ID}}? This cannot be undone.">Delete</button>
</td>
</tr>
{{end}}