chore(ui): add module file and main stub

- chore(ui): add module file and main stub
- feat(ui): add layout, pages and partials
- feat(ui): add stylesheet and scripts
- feat(ui): add page renderer and static file handler
- test(ui): cover rendering, escaping and static serving
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 7089a6f408
commit 5ac8f98f10
26 files changed
+3921

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "layout"}}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<title>{{template "title" .}} - {{.AppName}}</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="{{.Static}}css/app.css">
{{if .Script}}<script type="module" src="{{.Static}}js/{{.Script}}.js"></script>
{{end}}</head>
<body>
<a class="skip" href="#app">Skip to content</a>
<header class="topbar">
<a class="brand" href="/">{{.AppName}}</a>
{{if .Username}}<nav class="nav" aria-label="Main">
<a href="/"{{if eq .Section "zones"}} aria-current="page"{{end}}>Zones</a>
<a href="/audit"{{if eq .Section "audit"}} aria-current="page"{{end}}>Audit</a>
<a href="/account"{{if eq .Section "account"}} aria-current="page"{{end}}>Account</a>
{{if .IsAdmin}}<a href="/users"{{if eq .Section "users"}} aria-current="page"{{end}}>Users</a>
{{end}}</nav>
<form class="logout" method="post" action="/logout">
<span class="who"><span class="who-name">{{.Username}}</span> <span class="badge badge-muted">{{.Role}}</span></span>
<button type="submit" class="btn btn-small">Log out</button>
</form>
{{end}}</header>
<main id="app" class="page page-{{.Page}}" tabindex="-1" data-page="{{.Page}}" data-username="{{.Username}}" data-role="{{.Role}}" data-zone="{{.Zone}}" data-target-user="{{.TargetUser}}">
{{template "content" .}}
</main>
<div id="toasts" class="toasts" role="status" aria-live="polite" aria-atomic="false"></div>
</body>
</html>{{end}}
+42
View File
@@ -0,0 +1,42 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Account{{end}}
{{define "content"}}<div class="page-head">
<h1>Account</h1>
</div>
<section class="card" aria-labelledby="account-title">
<h2 id="account-title">Profile</h2>
<dl class="dl">
<dt>Username</dt><dd id="account-username">{{.Username}}</dd>
<dt>Role</dt><dd id="account-role">{{.Role}}</dd>
</dl>
</section>
{{if not .IsAdmin}}
<section class="card" aria-labelledby="account-zones-title">
<h2 id="account-zones-title">Delegated zones</h2>
<ul class="list" id="account-zones"></ul>
<p class="muted" id="account-zones-status" role="status">Loading...</p>
</section>
{{end}}
<section class="card" aria-labelledby="password-title">
<h2 id="password-title">Change password</h2>
<form class="form" id="password-form" novalidate>
<div class="field">
<label for="pw-current">Current password</label>
<input id="pw-current" name="current" type="password" autocomplete="current-password" maxlength="256">
</div>
<div class="field">
<label for="pw-new">New password</label>
<input id="pw-new" name="password" type="password" autocomplete="new-password" maxlength="256">
<p class="hint">12 to 256 characters.</p>
</div>
<div class="field">
<label for="pw-repeat">Repeat the new password</label>
<input id="pw-repeat" name="repeat" type="password" autocomplete="new-password" maxlength="256">
</div>
<div class="actions">
<button type="submit" class="btn btn-primary">Change password</button>
</div>
</form>
</section>
{{end}}
+66
View File
@@ -0,0 +1,66 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Audit{{end}}
{{define "content"}}<div class="page-head">
<h1>Audit</h1>
</div>
<section class="card" aria-labelledby="audit-filter-title">
<h2 id="audit-filter-title" class="visually-hidden">Filters</h2>
<form class="filters" id="audit-filters" novalidate>
<div class="field">
<label for="af-zone">Zone</label>
<input id="af-zone" name="zone" type="text" autocomplete="off" autocapitalize="none" spellcheck="false">
</div>
<div class="field">
<label for="af-actor">Actor</label>
<input id="af-actor" name="actor" type="text" autocomplete="off" autocapitalize="none" spellcheck="false">
</div>
<div class="field">
<label for="af-operation">Operation</label>
<select id="af-operation" name="operation">
<option value="">Any operation</option>
<option>account_read</option><option>login</option><option>logout</option><option>password_change</option>
<option>zone_list</option><option>zone_read</option><option>zone_create</option><option>zone_delete</option>
<option>record_list</option><option>record_create</option><option>record_update</option><option>record_delete</option><option>record_bulk_delete</option><option>soa_update</option>
<option>zone_check</option><option>check_all</option>
<option>zone_export</option><option>zone_import_preview</option><option>zone_import</option>
<option>delegation_list</option><option>delegation_grant</option><option>delegation_revoke</option>
<option>user_list</option><option>user_read</option><option>user_create</option><option>user_role</option><option>user_password</option><option>user_delete</option>
<option>audit_read</option>
</select>
</div>
<div class="field">
<label for="af-kind">Kind</label>
<select id="af-kind" name="kind">
<option value="">Reads and changes</option>
<option value="read">Reads</option>
<option value="change">Changes</option>
</select>
</div>
<div class="field">
<label for="af-outcome">Outcome</label>
<select id="af-outcome" name="outcome">
<option value="">Any outcome</option>
<option value="success">Success</option>
<option value="error">Error</option>
</select>
</div>
<div class="actions">
<button type="submit" class="btn btn-primary">Apply filters</button>
<button type="reset" class="btn" id="af-reset">Reset</button>
</div>
</form>
</section>
<div class="table-wrap">
<table class="table" id="audit-table">
<thead>
<tr><th scope="col">Time (UTC)</th><th scope="col">Actor</th><th scope="col">Origin</th><th scope="col">Operation</th><th scope="col">Status</th><th scope="col">Target</th><th scope="col">Details</th></tr>
</thead>
<tbody id="audit-body"></tbody>
</table>
</div>
<p class="muted" id="audit-status" role="status">Loading...</p>
<div class="actions">
<button type="button" class="btn" id="audit-more" hidden>Load older rows</button>
</div>
{{end}}
+8
View File
@@ -0,0 +1,8 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Forbidden{{end}}
{{define "content"}}<section class="card narrow">
<h1>Forbidden</h1>
<p>Your account is not allowed to open this page.</p>
<p><a href="/">Back to the zones</a></p>
</section>{{end}}
+39
View File
@@ -0,0 +1,39 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Import {{.Zone}}{{end}}
{{define "content"}}<p class="crumbs"><a href="/">Zones</a> / <a id="zone-link" href="/">{{.Zone}}</a></p>
<div class="page-head">
<h1>Import into {{.Zone}}</h1>
</div>
<section class="card" aria-labelledby="import-source-title">
<h2 id="import-source-title">Zone file</h2>
<form class="form" id="import-form" novalidate>
<fieldset class="field">
<legend>Mode</legend>
<label class="choice"><input type="radio" name="mode" value="merge" checked> Merge: add missing records and update TTLs</label>
<label class="choice"><input type="radio" name="mode" value="replace"> Replace: also delete records that are not in the file</label>
</fieldset>
<div class="field">
<label for="import-file">Load a file</label>
<input id="import-file" type="file" accept=".zone,.txt,text/plain">
</div>
<div class="field">
<label for="import-content">Zone file contents</label>
<textarea id="import-content" name="content" rows="14" class="mono" spellcheck="false" autocomplete="off" autocapitalize="none"></textarea>
</div>
<div class="actions">
<button type="submit" class="btn btn-primary" id="import-preview">Preview</button>
</div>
</form>
</section>
<section class="card" id="import-result" aria-labelledby="import-result-title" hidden>
<h2 id="import-result-title">Preview</h2>
<div id="import-errors" hidden></div>
<div id="import-summary"></div>
<div id="import-tables"></div>
<div class="actions">
<button type="button" class="btn btn-primary" id="import-apply" hidden>Apply import</button>
</div>
</section>
{{end}}
+25
View File
@@ -0,0 +1,25 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Sign in{{end}}
{{define "content"}}<section class="card narrow">
<h1>Sign in</h1>
{{if .Error}}<p class="alert alert-error" role="alert">{{.Error}}</p>
{{end}}{{if .NoActiveAdmin}}<div class="alert alert-info">
<p>No administrator exists yet. Create the first one by running this command on the host that runs the container:</p>
<pre class="code"><code>{{.BootstrapCommand}}</code></pre>
</div>
{{end}}<form class="form" method="post" action="/login">
<div class="field">
<label for="login-username">Username</label>
<input id="login-username" name="username" type="text" autocomplete="username" autocapitalize="none" spellcheck="false" maxlength="64" required autofocus>
</div>
<div class="field">
<label for="login-password">Password</label>
<input id="login-password" name="password" type="password" autocomplete="current-password" maxlength="256" required>
</div>
<input type="hidden" name="next" value="{{.Next}}">
<div class="actions">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</form>
</section>{{end}}
+8
View File
@@ -0,0 +1,8 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Not found{{end}}
{{define "content"}}<section class="card narrow">
<h1>Not found</h1>
<p>The page you asked for does not exist.</p>
<p><a href="/">Back to the zones</a></p>
</section>{{end}}
+82
View File
@@ -0,0 +1,82 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}User {{.TargetUser}}{{end}}
{{define "content"}}<p class="crumbs"><a href="/users">Users</a></p>
<div class="page-head">
<h1 id="user-title">{{.TargetUser}}</h1>
<span class="badge badge-muted" id="user-state" hidden></span>
</div>
<section class="card" aria-labelledby="user-info-title">
<h2 id="user-info-title">Details</h2>
<dl class="dl" id="user-summary"></dl>
<p class="muted" id="user-status" role="status">Loading...</p>
</section>
{{if eq .Username .TargetUser}}
<section class="card" id="user-self">
<p>This is your own account. Role, password and deletion are not available here. <a href="/account">Open your account page</a> to change your password.</p>
</section>
{{else}}
<div id="user-controls" hidden>
<section class="card" aria-labelledby="user-role-title">
<h2 id="user-role-title">Role</h2>
<form class="inline-form" id="role-form" novalidate>
<div class="field">
<label for="user-role">Role</label>
<select id="user-role" name="role">
<option value="user">user</option>
<option value="admin">admin</option>
</select>
</div>
<button type="submit" class="btn btn-small">Save role</button>
</form>
</section>
<section class="card" aria-labelledby="user-password-title">
<h2 id="user-password-title">Password</h2>
<p class="muted">Setting a password ends every session of this user.</p>
<form class="form" id="password-form" novalidate>
<div class="field">
<label for="up-password">New password</label>
<input id="up-password" name="password" type="password" autocomplete="new-password" maxlength="256">
<p class="hint">12 to 256 characters.</p>
</div>
<div class="field">
<label for="up-repeat">Repeat the new password</label>
<input id="up-repeat" name="repeat" type="password" autocomplete="new-password" maxlength="256">
</div>
<div class="actions">
<button type="submit" class="btn btn-small">Set password</button>
</div>
</form>
</section>
<section class="card" aria-labelledby="user-zones-title">
<h2 id="user-zones-title">Delegated zones</h2>
<ul class="list" id="user-zones"></ul>
<p class="muted" id="user-zones-status" role="status"></p>
<form class="inline-form" id="zone-add-form" novalidate>
<div class="field">
<label for="user-zone-pick">Delegate a zone</label>
<select id="user-zone-pick" name="zone"></select>
</div>
<button type="submit" class="btn btn-small">Add zone</button>
</form>
</section>
<section class="card danger-zone" aria-labelledby="user-danger-title">
<h2 id="user-danger-title">Danger zone</h2>
<p>Deleting the user ends their sessions and prevents them from signing in. The username stays taken and the history of the user stays in the audit.</p>
<form class="inline-form" id="user-delete-form" novalidate>
<div class="field">
<label for="user-delete-confirm">Type the username to confirm</label>
<input id="user-delete-confirm" name="confirm" type="text" autocomplete="off" autocapitalize="none" spellcheck="false">
</div>
<button type="submit" class="btn btn-danger" id="user-delete" disabled>Delete user</button>
</form>
</section>
</div>
<section class="card" id="user-readonly" hidden>
<h2>Delegated zones</h2>
<ul class="list" id="user-zones-readonly"></ul>
</section>
{{end}}{{end}}
+56
View File
@@ -0,0 +1,56 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Users{{end}}
{{define "content"}}<div class="page-head">
<h1>Users</h1>
<button type="button" class="btn btn-primary" id="new-user">New user</button>
</div>
<div class="toolbar">
<label class="choice" for="show-deleted"><input type="checkbox" id="show-deleted"> Show deleted users</label>
</div>
<div class="table-wrap">
<table class="table" id="users-table">
<thead>
<tr><th scope="col">Username</th><th scope="col">Role</th><th scope="col" class="num">Zones</th><th scope="col">Created (UTC)</th><th scope="col">Last login (UTC)</th><th scope="col">State</th></tr>
</thead>
<tbody id="users-body"></tbody>
</table>
</div>
<p class="muted" id="users-status" role="status">Loading users...</p>
<dialog id="user-dialog" class="dialog" aria-labelledby="user-dialog-title">
<form id="user-form" class="form" novalidate>
<div class="dialog-head">
<h2 id="user-dialog-title">New user</h2>
<button type="button" class="btn btn-icon" data-close aria-label="Close">&times;</button>
</div>
<div class="dialog-body">
<div class="field">
<label for="nu-username">Username</label>
<input id="nu-username" name="username" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" maxlength="64" required>
<p class="hint">Lowercase letters, digits, dot, underscore and hyphen. A username can never be reused.</p>
</div>
<div class="field">
<label for="nu-role">Role</label>
<select id="nu-role" name="role">
<option value="user">user</option>
<option value="admin">admin</option>
</select>
</div>
<div class="field">
<label for="nu-password">Password</label>
<input id="nu-password" name="password" type="password" autocomplete="new-password" maxlength="256" required>
<p class="hint">12 to 256 characters.</p>
</div>
<div class="field">
<label for="nu-repeat">Repeat the password</label>
<input id="nu-repeat" name="repeat" type="password" autocomplete="new-password" maxlength="256" required>
</div>
</div>
<div class="dialog-actions">
<button type="button" class="btn" data-close>Cancel</button>
<button type="submit" class="btn btn-primary">Create user</button>
</div>
</form>
</dialog>
{{end}}
+94
View File
@@ -0,0 +1,94 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}{{.Zone}}{{end}}
{{define "content"}}<p class="crumbs"><a href="/">Zones</a></p>
<div class="page-head">
<h1 id="zone-title">{{.Zone}}</h1>
<div class="actions">
<a class="btn" id="export-link" href="/">Export zone file</a>
<a class="btn" id="import-link" href="/">Import zone file</a>
</div>
</div>
<section class="card" aria-labelledby="soa-title">
<div class="section-head">
<h2 id="soa-title">SOA</h2>
<div class="actions">
<button type="button" class="btn btn-small" id="soa-managed" hidden>Use managed serial</button>
<button type="button" class="btn btn-small" id="soa-edit" disabled>Edit SOA</button>
</div>
</div>
<dl class="dl" id="soa-summary"></dl>
<p class="muted" id="soa-status" role="status">Loading...</p>
</section>
<section class="card" id="problems-panel" aria-labelledby="problems-title" hidden>
<h2 id="problems-title">Problems</h2>
<ul class="problems" id="problems-list"></ul>
</section>
<section class="card" aria-labelledby="records-title">
<div class="section-head">
<h2 id="records-title">Records</h2>
<div class="actions">
<button type="button" class="btn btn-danger btn-small" id="bulk-delete" disabled>Delete selected</button>
<button type="button" class="btn btn-primary btn-small" id="record-add">Add record</button>
</div>
</div>
<div class="toolbar">
<div class="field">
<label for="filter-type">Type</label>
<select id="filter-type"><option value="">All types</option></select>
</div>
<div class="field grow">
<label for="filter-text">Search records</label>
<input id="filter-text" type="search" autocomplete="off" spellcheck="false">
</div>
</div>
<div class="table-wrap">
<table class="table" id="records-table">
<thead>
<tr>
<th scope="col" class="check"><input type="checkbox" id="select-all" aria-label="Select all records on this page"></th>
<th scope="col">Name</th><th scope="col">Type</th><th scope="col">TTL</th><th scope="col">Value</th><th scope="col">Actions</th>
</tr>
</thead>
<tbody id="records-body"></tbody>
</table>
</div>
<p class="muted" id="records-status" role="status">Loading records...</p>
<div class="pager" id="pager" hidden>
<button type="button" class="btn btn-small" id="page-prev">Previous</button>
<span id="page-info"></span>
<button type="button" class="btn btn-small" id="page-next">Next</button>
</div>
</section>
{{if .IsAdmin}}
<section class="card" id="users-panel" aria-labelledby="users-title">
<h2 id="users-title">Users</h2>
<p class="muted">Users who can see and change this zone. Administrators always can.</p>
<ul class="list" id="zone-users"></ul>
<p class="muted" id="zone-users-status" role="status">Loading...</p>
<form class="inline-form" id="zone-user-form" novalidate>
<div class="field">
<label for="zone-user-pick">Delegate this zone to</label>
<select id="zone-user-pick" name="username"></select>
</div>
<button type="submit" class="btn btn-small" id="zone-user-add">Add user</button>
</form>
</section>
<section class="card danger-zone" id="danger" aria-labelledby="danger-title">
<h2 id="danger-title">Danger zone</h2>
<p>Deleting the zone removes every record and every delegation of this zone. This cannot be undone.</p>
<form class="inline-form" id="zone-delete-form" novalidate>
<div class="field">
<label for="zone-delete-confirm">Type the zone name to confirm</label>
<input id="zone-delete-confirm" name="confirm" type="text" autocomplete="off" autocapitalize="none" spellcheck="false">
</div>
<button type="submit" class="btn btn-danger" id="zone-delete" disabled>Delete zone</button>
</form>
</section>
{{end}}
{{template "soa_dialog" .}}
{{template "record_dialog" .}}{{end}}
+23
View File
@@ -0,0 +1,23 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "title"}}Zones{{end}}
{{define "content"}}<div class="page-head">
<h1>Zones</h1>
{{if .IsAdmin}}<button type="button" class="btn btn-primary" id="new-zone">New zone</button>
{{end}}</div>
<div class="toolbar">
<div class="field">
<label for="zone-search">Search zones</label>
<input id="zone-search" type="search" autocomplete="off" spellcheck="false">
</div>
</div>
<div class="table-wrap">
<table class="table" id="zones-table">
<thead>
<tr><th scope="col">Zone</th><th scope="col" class="num">Records</th><th scope="col">SOA serial</th><th scope="col">Problems</th></tr>
</thead>
<tbody id="zones-body"></tbody>
</table>
</div>
<p class="muted" id="zones-status" role="status">Loading zones...</p>
{{if .IsAdmin}}{{template "zone_create_dialog" .}}{{end}}{{end}}
@@ -0,0 +1,35 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "record_dialog"}}<dialog id="record-dialog" class="dialog" aria-labelledby="record-dialog-title">
<form id="record-form" class="form" novalidate>
<div class="dialog-head">
<h2 id="record-dialog-title">Add record</h2>
<button type="button" class="btn btn-icon" data-close aria-label="Close">&times;</button>
</div>
<div class="dialog-body">
<div class="alert alert-warn" id="record-broken" hidden>
<p>The stored row cannot be served correctly. Saving replaces it with the values below.</p>
<p>Stored content: <code class="mono" id="record-raw"></code></p>
</div>
<div class="field">
<label for="rec-name">Name</label>
<input id="rec-name" name="name" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" placeholder="@" aria-describedby="rec-fqdn">
<p class="hint" id="rec-fqdn" aria-live="polite"></p>
</div>
<div class="field">
<label for="rec-type">Type</label>
<select id="rec-type" name="type"></select>
</div>
<div class="field">
<label for="rec-ttl">TTL (seconds)</label>
<input id="rec-ttl" name="ttl" type="text" inputmode="numeric" value="3600">
<p class="hint">0 means default (360 s).</p>
</div>
<div id="rec-fields"></div>
</div>
<div class="dialog-actions">
<button type="button" class="btn" data-close>Cancel</button>
<button type="submit" class="btn btn-primary" id="rec-submit">Save record</button>
</div>
</form>
</dialog>{{end}}
+49
View File
@@ -0,0 +1,49 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "soa_dialog"}}<dialog id="soa-dialog" class="dialog" aria-labelledby="soa-dialog-title">
<form id="soa-form" class="form" novalidate>
<div class="dialog-head">
<h2 id="soa-dialog-title">Edit SOA</h2>
<button type="button" class="btn btn-icon" data-close aria-label="Close">&times;</button>
</div>
<div class="dialog-body">
<p class="alert alert-warn" id="soa-broken" hidden>The stored SOA cannot be read. Saving replaces it with the values below.</p>
<div class="field">
<label for="soa-ns">Primary name server</label>
<input id="soa-ns" name="ns" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" required>
</div>
<div class="field">
<label for="soa-mbox">Hostmaster mailbox</label>
<input id="soa-mbox" name="mbox" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" required>
</div>
<div class="grid-2">
<div class="field">
<label for="soa-refresh">Refresh</label>
<input id="soa-refresh" name="refresh" type="text" inputmode="numeric">
</div>
<div class="field">
<label for="soa-retry">Retry</label>
<input id="soa-retry" name="retry" type="text" inputmode="numeric">
</div>
<div class="field">
<label for="soa-expire">Expire</label>
<input id="soa-expire" name="expire" type="text" inputmode="numeric">
</div>
<div class="field">
<label for="soa-minttl">Minimum TTL</label>
<input id="soa-minttl" name="minttl" type="text" inputmode="numeric">
</div>
</div>
<div class="field">
<label for="soa-ttl">TTL of the SOA record</label>
<input id="soa-ttl" name="ttl" type="text" inputmode="numeric">
<p class="hint">0 means default (360 s).</p>
</div>
<p class="hint">The serial is managed by the application and increases with every change.</p>
</div>
<div class="dialog-actions">
<button type="button" class="btn" data-close>Cancel</button>
<button type="submit" class="btn btn-primary">Save SOA</button>
</div>
</form>
</dialog>{{end}}
@@ -0,0 +1,54 @@
{{- /* SPDX-License-Identifier: GPL-2.0-or-later */ -}}
{{- /* Copyright (C) 2026 Bryan Joshua Pedini */ -}}
{{define "zone_create_dialog"}}<dialog id="zone-dialog" class="dialog" aria-labelledby="zone-dialog-title">
<form id="zone-form" class="form" novalidate>
<div class="dialog-head">
<h2 id="zone-dialog-title">New zone</h2>
<button type="button" class="btn btn-icon" data-close aria-label="Close">&times;</button>
</div>
<div class="dialog-body">
<div class="field">
<label for="nz-name">Zone name</label>
<input id="nz-name" name="name" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" placeholder="example.org" required>
</div>
<div class="field">
<label for="nz-ns">Primary name server</label>
<input id="nz-ns" name="ns" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" placeholder="ns1.example.org" required>
</div>
<div class="field">
<label for="nz-mbox">Hostmaster mailbox</label>
<input id="nz-mbox" name="mbox" type="text" autocomplete="off" autocapitalize="none" spellcheck="false" placeholder="hostmaster@example.org" required>
</div>
<div class="field">
<label for="nz-extra">Additional name servers, one per line</label>
<textarea id="nz-extra" name="extra_ns" rows="3" autocomplete="off" autocapitalize="none" spellcheck="false"></textarea>
</div>
<div class="grid-2">
<div class="field">
<label for="nz-refresh">SOA refresh</label>
<input id="nz-refresh" name="refresh" type="text" inputmode="numeric" value="3600">
</div>
<div class="field">
<label for="nz-retry">SOA retry</label>
<input id="nz-retry" name="retry" type="text" inputmode="numeric" value="600">
</div>
<div class="field">
<label for="nz-expire">SOA expire</label>
<input id="nz-expire" name="expire" type="text" inputmode="numeric" value="604800">
</div>
<div class="field">
<label for="nz-minttl">SOA minimum TTL</label>
<input id="nz-minttl" name="minttl" type="text" inputmode="numeric" value="300">
</div>
</div>
<div class="field">
<label for="nz-ttl">TTL of the SOA and NS records</label>
<input id="nz-ttl" name="ttl" type="text" inputmode="numeric" value="3600">
</div>
</div>
<div class="dialog-actions">
<button type="button" class="btn" data-close>Cancel</button>
<button type="submit" class="btn btn-primary">Create zone</button>
</div>
</form>
</dialog>{{end}}