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

112 lines
5.0 KiB
HTML

{{define "content"}}
{{$csrf := .CSRF}}{{$reverse := .Data.Reverse}}
<div class="d-flex flex-wrap justify-content-between align-items-start gap-3 mb-4">
<div>
<h1 class="page-title">{{.Title}}</h1>
<p class="text-body-secondary mb-0">
{{if $reverse}}PTR zones for IPv4 and IPv6 address space.
{{else}}Zones this server answers authoritatively.{{end}}
</p>
</div>
<div class="d-flex flex-wrap gap-2">
<a href="/zones/new?kind={{if $reverse}}reverse4{{else}}forward{{end}}" class="btn btn-primary btn-sm">
<i class="bi bi-plus-lg me-1"></i>Add Zone
</a>
</div>
</div>
<div class="card">
<div class="card-body pb-2">
<form method="get" data-autosubmit class="row g-2 align-items-center mb-3">
<div class="col-12 col-md-6 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="{{.Data.Search}}"
placeholder="Search zones..." aria-label="Search zones">
</div>
</div>
<div class="col-auto">
<noscript><button class="btn btn-sm btn-outline-secondary" type="submit">Search</button></noscript>
</div>
</form>
{{if .Data.Zones}}
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Zone</th>
{{if $reverse}}<th>Kind</th>{{end}}
<th class="text-end">Records</th>
<th class="text-end">Serial</th>
<th class="text-end">TTL</th>
<th>Status</th>
<th>Updated</th>
<th class="row-actions">Actions</th>
</tr>
</thead>
<tbody>
{{range .Data.Zones}}
<tr {{if not .Enabled}}class="is-disabled"{{end}}>
<td>
<a href="/zones/{{.ID}}" class="fw-semibold text-decoration-none mono">{{trimDot .Name}}</a>
{{if .Description}}<div class="small text-body-secondary">{{truncate 80 .Description}}</div>{{end}}
</td>
{{if $reverse}}<td><span class="badge text-bg-light text-dark">{{.Kind.Label}}</span></td>{{end}}
<td class="text-end">{{num .RecordCount}}</td>
<td class="text-end mono small">{{.Serial}}</td>
<td class="text-end">{{.DefaultTTL}}</td>
<td>
<span class="badge {{badgeFor .Enabled}}">{{statusWord .Enabled}}</span>
</td>
<td class="text-body-secondary small">{{timeAgo .UpdatedAt}}</td>
<td class="row-actions">
<div class="btn-group">
<a href="/zones/{{.ID}}" class="btn btn-sm btn-outline-secondary" title="Records">
<i class="bi bi-list-ul"></i>
</a>
<a href="/zones/{{.ID}}/edit" class="btn btn-sm btn-outline-secondary" title="Edit zone">
<i class="bi bi-pencil"></i>
</a>
<a href="/zones/{{.ID}}/export" class="btn btn-sm btn-outline-secondary" title="Export zone file">
<i class="bi bi-download"></i>
</a>
{{template "postform" dict
"Action" (printf "/zones/%d/toggle" .ID) "CSRF" $csrf
"Fields" (dict "enabled" (boolstr (not .Enabled)))
"Icon" (toggleIcon .Enabled)
"Class" "btn btn-sm btn-outline-secondary"
"Title" (printf "%s this zone" (toggleVerb .Enabled))}}
{{template "confirmform" dict
"Action" (printf "/zones/%d/delete" .ID) "CSRF" $csrf
"Icon" "bi-trash"
"Message" (printf "Delete zone %s and all %d of its records? This cannot be undone." (trimDot .Name) .RecordCount)}}
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{else if .Data.Search}}
{{template "empty" dict "Icon" "bi-search" "Title" "No zones match that search"
"Message" "Try a different term, or clear the search box to see every zone."}}
{{else}}
{{if $reverse}}
{{template "empty" dict "Icon" "bi-arrow-left-right" "Title" "No reverse zones yet"
"Message" "Reverse zones answer PTR lookups that turn an IP address back into a host name. Enter a subnet such as 192.168.1.0/24 and the correct in-addr.arpa zone name is worked out for you."}}
{{else}}
{{template "empty" dict "Icon" "bi-diagram-3" "Title" "No forward zones yet"
"Message" "A forward zone lets this server answer authoritatively for a domain such as internal.example.com, independently of the public DNS."}}
{{end}}
<div class="text-center pb-4">
<a href="/zones/new?kind={{if $reverse}}reverse4{{else}}forward{{end}}" class="btn btn-primary">
<i class="bi bi-plus-lg me-1"></i>Create the first zone
</a>
</div>
{{end}}
</div>
</div>
{{end}}