Files
vibedns/web/templates/pages/records_all.html
T
2026-08-16 21:18:45 -05:00

108 lines
4.9 KiB
HTML

{{define "content"}}
{{$csrf := .CSRF}}{{$f := .Data.Filter}}
<div class="d-flex flex-wrap justify-content-between align-items-start gap-3 mb-4">
<div>
<h1 class="page-title">Records</h1>
<p class="text-body-secondary mb-0">Search every record across all zones.</p>
</div>
</div>
<div class="card">
<div class="card-body">
<form method="get" data-autosubmit class="row g-2 align-items-center mb-3">
<div class="col-12 col-md-5 col-lg-4">
<div class="input-group input-group-sm">
<span class="input-group-text"><i class="bi bi-search"></i></span>
<input type="search" class="form-control" name="q" value="{{$f.Search}}"
placeholder="Search names, values and comments..." aria-label="Search records">
</div>
</div>
<div class="col-6 col-md-3 col-lg-3">
<select class="form-select form-select-sm" name="zone" aria-label="Filter by zone">
<option value="">All zones</option>
{{range .Data.Zones}}
<option value="{{.ID}}" {{if eq .ID $f.ZoneID}}selected{{end}}>{{trimDot .Name}}</option>
{{end}}
</select>
</div>
<div class="col-6 col-md-2 col-lg-2">
<select class="form-select form-select-sm" name="type" aria-label="Filter by type">
<option value="">All types</option>
{{range .Data.TypesInUse}}
<option value="{{.}}" {{if eq . $f.Type}}selected{{end}}>{{.}}</option>
{{end}}
</select>
</div>
<div class="col-6 col-md-2 col-lg-2">
<select class="form-select form-select-sm" name="status" aria-label="Filter by status">
<option value="">All statuses</option>
<option value="enabled" {{if eq $f.Enabled "enabled"}}selected{{end}}>Enabled</option>
<option value="disabled" {{if eq $f.Enabled "disabled"}}selected{{end}}>Disabled</option>
</select>
</div>
<div class="col-auto">
<noscript><button class="btn btn-sm btn-outline-secondary" type="submit">Apply</button></noscript>
{{if or $f.Search $f.Type $f.Enabled $f.ZoneID}}
<a href="/records" class="btn btn-sm btn-link">Clear</a>
{{end}}
</div>
</form>
{{if .Data.Records}}
<div class="table-responsive">
<table class="table table-hover align-middle table-compact">
<thead>
<tr>
<th>Zone</th><th>Name</th><th>Type</th><th>Value</th>
<th class="text-end">TTL</th><th>Status</th><th class="row-actions">Actions</th>
</tr>
</thead>
<tbody>
{{range .Data.Records}}
<tr {{if not .Enabled}}class="is-disabled"{{end}}>
<td>
<a href="/zones/{{.ZoneID}}" class="text-decoration-none mono small">{{trimDot .ZoneName}}</a>
</td>
<td class="mono fw-semibold">{{.Name}}</td>
<td><span class="type-chip {{typeBadge .Type}}">{{.Type}}</span></td>
<td class="mono truncate-cell" title="{{.Data}}">{{.Data}}</td>
<td class="text-end">{{if .TTL}}{{.TTL}}{{else}}<span class="text-body-secondary"></span>{{end}}</td>
<td><span class="badge {{badgeFor .Enabled}}">{{statusWord .Enabled}}</span></td>
<td class="row-actions">
<div class="btn-group">
<a href="/zones/{{.ZoneID}}?q={{.Name}}" class="btn btn-sm btn-outline-secondary" title="Open in zone">
<i class="bi bi-box-arrow-up-right"></i>
</a>
{{template "postform" dict
"Action" (printf "/records/%d/toggle" .ID) "CSRF" $csrf "ReturnTo" "/records"
"Fields" (dict "enabled" (boolstr (not .Enabled)))
"Icon" (toggleIcon .Enabled)
"Class" "btn btn-sm btn-outline-secondary"
"Title" (printf "%s this record" (toggleVerb .Enabled))}}
{{template "confirmform" dict
"Action" (printf "/records/%d/delete" .ID) "CSRF" $csrf "ReturnTo" "/records"
"Icon" "bi-trash"
"Message" (printf "Delete the %s record for %s in %s?" .Type .Name (trimDot .ZoneName))}}
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{template "pagination" dict "P" .Data.Pagination "Q" .Query}}
{{else if or $f.Search $f.Type $f.Enabled $f.ZoneID}}
{{template "empty" dict "Icon" "bi-search" "Title" "No records match those filters"
"Message" "Adjust or clear the filters above."}}
{{else}}
{{template "empty" dict "Icon" "bi-list-columns-reverse" "Title" "No records yet"
"Message" "Create a zone and add records to it, and they will all be searchable from here."}}
<div class="text-center pb-3">
<a href="/zones" class="btn btn-primary"><i class="bi bi-diagram-3 me-1"></i>Go to zones</a>
</div>
{{end}}
</div>
</div>
{{end}}