Files
EasyDNS-Web/internal/server/web/templates/pages/zone.gohtml
T
Mateusz Gruszczyński a28362b82c
Go quality gates / test (push) Waiting to run
v0.1.2
2026-12-01 00:16:15 +01:00

72 lines
11 KiB
Go Template

{{define "content"}}
<div class="status-strip panel zone-strip">
<div class="strip-cell"><span>ZONE STATE</span><strong><span class="dot {{statusclass .Data.Zone.StateText}}"></span>{{.Data.Zone.StateText}}</strong></div>
<div class="strip-cell"><span>SERIAL</span><strong class="mono">{{.Data.Zone.SerialText}}</strong></div>
<div class="strip-cell"><span>TYPE</span><strong>{{.Data.Zone.Kind}}</strong></div>
<div class="strip-cell"><span>RECORDS</span><strong>{{.Data.Zone.Records}}</strong></div>
<div class="strip-cell"><span>TRANSFER / SYNC</span><strong>{{if .Data.Zone.IsSecondary}}{{.Data.Zone.SyncText}}{{else}}—{{end}}</strong></div>
<div class="strip-cell"><span>LAST SYNC</span><strong class="small-text">{{.Data.Zone.LastSync}}</strong></div>
</div>
<div class="tabs" role="navigation" aria-label="Zone views">
<a {{if eq .Data.Tab "overview"}}class="tab active" aria-current="page"{{else}}class="tab"{{end}} href="{{.Data.ZoneURL}}">Overview</a>
<a {{if eq .Data.Tab "records"}}class="tab active" aria-current="page"{{else}}class="tab"{{end}} href="{{.Data.ZoneURL}}/records">Records</a>
<a {{if eq .Data.Tab "transfers"}}class="tab active" aria-current="page"{{else}}class="tab"{{end}} href="{{.Data.ZoneURL}}/transfers">Transfers / History</a>
<a {{if eq .Data.Tab "dnssec"}}class="tab active" aria-current="page"{{else}}class="tab"{{end}} href="{{.Data.ZoneURL}}/dnssec">DNSSEC</a>
<a {{if eq .Data.Tab "operations"}}class="tab active" aria-current="page"{{else}}class="tab"{{end}} href="{{.Data.ZoneURL}}/operations">Operations</a>
</div>
{{if eq .Data.Tab "overview"}}
<div class="dashboard-lower three-cards">
<section class="panel"><div class="panel-head"><div><h2>Zone status</h2><p>Live authoritative store state</p></div></div><div class="panel-body compact"><div class="data-row"><span>Zone name</span><strong class="mono">{{.Data.Zone.Name}}</strong></div><div class="data-row"><span>Loaded</span><strong>{{if .Data.Zone.Loaded}}Yes{{else}}No{{end}}</strong></div><div class="data-row"><span>Expired</span><strong class="{{if .Data.Zone.Expired}}danger{{else}}success{{end}}">{{if .Data.Zone.Expired}}Yes{{else}}No{{end}}</strong></div><div class="data-row"><span>Journal entries</span><strong>{{.Data.Zone.JournalEntries}}</strong></div><div class="data-row"><span>View associations</span><strong>{{if .Data.Zone.Views}}{{join .Data.Zone.Views ", "}}{{else}}Default{{end}}</strong></div></div></section>
<section class="panel"><div class="panel-head"><div><h2>Transfer &amp; notification</h2><p>Configured values from zone detail</p></div></div><div class="panel-body compact"><div class="data-row"><span>NOTIFY targets</span><strong>{{len .Data.Zone.Config.Notify}}</strong></div><div class="data-row"><span>Transfer ACL entries</span><strong>{{len .Data.Zone.Config.TransferACL}}</strong></div><div class="data-row"><span>Primaries</span><strong>{{len .Data.Zone.Config.Primaries}}</strong></div><div class="data-row"><span>NOTIFY sent</span><strong>{{int .Data.Zone.Status.NotifiesSent}}</strong></div><div class="data-row"><span>NOTIFY failed</span><strong>{{int .Data.Zone.Status.NotifiesFailed}}</strong></div></div></section>
<section class="panel"><div class="panel-head"><div><h2>Secondary refresh</h2><p>Only applicable to secondary zones</p></div></div><div class="panel-body compact"><div class="data-row"><span>Last successful</span><strong class="small-text">{{.Data.Zone.LastSync}}</strong></div><div class="data-row"><span>Last error</span><strong class="danger">{{if .Data.Zone.Status.LastError}}{{.Data.Zone.Status.LastError}}{{else}}—{{end}}</strong></div><div class="data-row"><span>Serial</span><strong>{{.Data.Zone.SerialText}}</strong></div></div></section>
</div>
<div class="section-actions"><a class="btn-ui btn-primary-ui" href="{{.Data.ZoneURL}}/records">View DNS records</a><a class="btn-ui" href="{{.Data.ZoneURL}}/transfers">Transfer history</a><a class="btn-ui" href="{{.Data.ZoneURL}}/operations">Zone operations</a></div>
{{else if eq .Data.Tab "records"}}
<section class="panel">
<div class="toolbar">
<form class="toolbar-form" method="get" action="{{.Data.ZoneURL}}/records" aria-label="Record filters">
<input class="field field-search" name="name" placeholder="Record name begins with..." aria-label="Filter record names" value="{{selectval .Data.Filter "name"}}">
<select class="field field-select" aria-label="Record type" name="type">
<option value="">All types</option>
{{range $type := filterRecordTypes}}<option value="{{$type}}" {{if eq (selectval $.Data.Filter "type") $type}}selected{{end}}>{{$type}}</option>{{end}}
</select>
<label class="record-dnssec-toggle" title="Exclude RRSIG, DNSKEY, NSEC/NSEC3, DS, CDS and other DNSSEC records from the record list">
<input type="checkbox" name="hide_dnssec" value="1" data-record-filter-toggle {{if .Data.HideDNSSEC}}checked{{end}}>
<span>Hide DNSSEC records</span>
</label>
<button type="submit" class="btn-ui"><svg class="ico"><use href="{{asset "icons.svg"}}#search"/></svg>Filter</button>
</form>
<div class="toolbar-end">
<span class="subtle desktop-only">{{if .Data.HideDNSSEC}}DNSSEC records hidden{{else}}{{int .Data.Pagination.Total}} records{{end}}</span>
{{if .Data.IsPrimary}}<a class="btn-ui btn-primary-ui" href="{{.Data.ZoneURL}}/records/new"><svg class="ico"><use href="{{asset "icons.svg"}}#plus"/></svg>Add record</a>{{else}}<span class="tag muted-tag">Secondary · read-only</span>{{end}}
</div>
</div>
<div class="table-scroll"><table class="data-table"><thead><tr><th>NAME</th><th>TYPE</th><th>RDATA</th><th>TTL</th>{{if .Data.IsPrimary}}<th class="right">ACTIONS</th>{{end}}</tr></thead><tbody>
{{range .Data.Records}}
<tr><td class="mono entity">{{.Name}}</td><td><span class="tag green">{{.Type}}</span></td><td class="mono rdata">{{.Data}}</td><td class="mono">{{.TTL}}</td>{{if $.Data.IsPrimary}}<td class="right">{{if ne .Type "SOA"}}<div class="row-actions"><a href="{{$.Data.ZoneURL}}/records/{{.ID}}/edit" class="icon-button" aria-label="Edit record {{.Name}}" title="Edit"><svg class="ico"><use href="{{asset "icons.svg"}}#edit"/></svg></a><a href="{{$.Data.ZoneURL}}/records/{{.ID}}/delete" class="icon-button danger-hover" aria-label="Delete record {{.Name}}" title="Delete"><svg class="ico"><use href="{{asset "icons.svg"}}#trash"/></svg></a></div>{{else}}<span class="subtle" title="SOA is managed by zone replacement">Managed</span>{{end}}</td>{{end}}</tr>
{{else}}<tr><td class="empty" colspan="{{if .Data.IsPrimary}}5{{else}}4{{end}}">{{if .Data.HideDNSSEC}}No non-DNSSEC records match these filters. Uncheck the box to show all records.{{else}}No records returned for this filter.{{end}}</td></tr>{{end}}
</tbody></table></div>
<div class="table-footer">
<span>{{if .Data.HideDNSSEC}}{{len .Data.Records}} matching records · page {{.Data.Pagination.Page}} · {{int .Data.Pagination.Total}} total before DNSSEC filtering{{else}}{{len .Data.Records}} / {{int .Data.Pagination.Total}} records · page {{.Data.Pagination.Page}}{{end}}</span>
<div class="pagination-ui">
{{if .Data.RecordsPrevURL}}<a class="btn-ui btn-small" href="{{.Data.RecordsPrevURL}}">Previous</a>{{end}}
{{if .Data.RecordsNextURL}}<a class="btn-ui btn-small" href="{{.Data.RecordsNextURL}}">Next</a>{{end}}
</div>
</div>
</section>
<div class="notice-inline mt-panel">Writes are protected with the zone serial ETag. SOA records are managed through whole-zone replacement; secondaries are read-only.</div>
{{else if eq .Data.Tab "transfers"}}
<section class="panel"><div class="panel-head"><div><h2>Zone transfer history</h2><p>Recorded inbound and outbound AXFR / IXFR events</p></div></div><div class="table-scroll"><table class="data-table"><thead><tr><th>TIME</th><th>DIRECTION</th><th>TYPE</th><th>PEER</th><th>SERIAL</th><th>RECORDS</th><th>DURATION</th><th>RESULT</th></tr></thead><tbody>{{range .Data.Transfers}}<tr><td class="mono subtle">{{when .TimeUnix}}</td><td>{{.Direction}}</td><td><span class="tag green">{{.Kind}}</span></td><td class="mono">{{.Peer}}</td><td class="mono">{{if .Serial}}{{.Serial}}{{else}}—{{end}}</td><td>{{.Records}}</td><td class="mono">{{.DurationMS}} ms</td><td><span class="dot {{if .OK}}ok{{else}}danger{{end}}"></span>{{if .OK}}Completed{{else}}{{if .Error}}{{.Error}}{{else}}Failed{{end}}{{end}}</td></tr>{{else}}<tr><td class="empty" colspan="8">No recorded transfers. This API provides history, not a live transfer queue.</td></tr>{{end}}</tbody></table></div></section>
{{else if eq .Data.Tab "dnssec"}}
<section class="panel"><div class="panel-head"><div><h2>DNSSEC status</h2><p>Inspection only. Key lifecycle and signing changes are not exposed through REST.</p></div></div><div class="panel-body">{{if .Data.Zone.DNSSEC}}<div class="code-block"><pre>{{asjson .Data.Zone.DNSSEC}}</pre></div>{{else}}<div class="empty">No DNSSEC status returned for this zone.</div>{{end}}</div></section>
{{else if eq .Data.Tab "operations"}}
<div class="operations-grid"><section class="panel"><div class="panel-head"><div><h2>Supported zone actions</h2><p>Available operations depend on the zone role and configuration</p></div></div><div class="panel-body">
{{if .Data.Zone.IsSecondary}}<form method="post" action="{{.Data.ZoneURL}}/sync" class="operation"><input type="hidden" name="_csrf" value="{{.CSRF}}"><input type="hidden" name="confirm" value="yes"><div><strong>Synchronize secondary</strong><small>Request an immediate refresh from its primary.</small></div><button class="btn-ui" type="submit"><svg class="ico"><use href="{{asset "icons.svg"}}#refresh"/></svg>Sync now</button></form>{{end}}
{{if .Data.Zone.Config.Notify}}<form method="post" action="{{.Data.ZoneURL}}/notify" class="operation"><input type="hidden" name="_csrf" value="{{.CSRF}}"><input type="hidden" name="confirm" value="yes"><div><strong>Send DNS NOTIFY</strong><small>{{len .Data.Zone.Config.Notify}} configured targets · HTTP 202 means accepted, not delivered</small></div><button class="btn-ui" type="submit"><svg class="ico"><use href="{{asset "icons.svg"}}#bell"/></svg>Send NOTIFY</button></form>{{end}}
{{if .Data.Zone.IsPrimary}}<div class="operation"><div><strong>Replace zone contents</strong><small>Submit a complete operator-provided zone file. No original file download.</small></div><a href="{{.Data.ZoneURL}}/replace" class="btn-ui">Replace zone</a></div>{{end}}
<div class="operation"><div><strong>Delete API-created zone</strong><small>Only zones created in the API overlay are deletable; others return HTTP 409.</small></div><a href="{{.Data.ZoneURL}}/delete" class="btn-ui btn-danger-ui">Delete zone</a></div>
{{if and (not .Data.Zone.IsSecondary) (not .Data.Zone.IsPrimary)}}<div class="empty">Zone operations require a loaded zone.</div>{{end}}
</div></section><section class="panel"><div class="panel-head"><div><h2>Configured transfer access</h2><p>Read-only zone configuration</p></div></div><div class="panel-body"><h3>Transfer ACL</h3>{{range .Data.Zone.Config.TransferACL}}<div class="data-row mono">{{.}}</div>{{else}}<p class="muted">No transfer ACL entries.</p>{{end}}<h3 class="mt-4">NOTIFY targets</h3>{{range .Data.Zone.Config.Notify}}<div class="data-row mono">{{.}}</div>{{else}}<p class="muted">No NOTIFY targets.</p>{{end}}<h3 class="mt-4">Primary servers</h3>{{range .Data.Zone.Config.Primaries}}<div class="data-row mono">{{.}}</div>{{else}}<p class="muted">No primary servers in this zone configuration.</p>{{end}}</div></section></div>
{{end}}
{{end}}