Edit Technitium zones: switch off and on, and their options

An Edit zone panel on the open zone of a Technitium provider switches the zone
off and on (its records stay) and edits who may ask it (query access), who may
copy it (zone transfer, with the TSIG keys the server has) and who is told when
it changes (notify). Only the groups that apply to the kind of zone are shown,
a mode that goes by a list needs it, and entries must be addresses or networks;
only groups that differ are sent, each whole, and the zone is read again
afterwards so anything else that moved is named on the page and in the audit
log. The server's own zones are not touched. Administrators only, audited.
Zones in the list show when they are off and what kind they are.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-01 23:20:19 +01:00
1 parent 082c524125
commit 6f144b4e36
12 files changed
+1110 -10

No files matched your search

+28 -1
View File
@@ -14,6 +14,7 @@ import {
} from "../api/client";
import DnsProviderForm from "../components/DnsProviderForm";
import DnsNewZone from "../components/DnsNewZone";
import DnsZoneEditor from "../components/DnsZoneEditor";
import { formatDateTime } from "../utils/date";
import { useSortable } from "../hooks/useSortable";
import SortableTh from "../components/SortableTh";
@@ -89,6 +90,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
const [zonesError, setZonesError] = useState<string | null>(null);
const [selectedZone, setSelectedZone] = useState<DnsZone | null>(null);
const [creatingZone, setCreatingZone] = useState(false);
const [editingZone, setEditingZone] = useState(false);
const [records, setRecords] = useState<DnsRecord[] | null>(null);
const [syncedAt, setSyncedAt] = useState<string | null>(null);
@@ -137,6 +139,17 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
if (selectedProviderId && !managingProviders) loadZones(selectedProviderId);
}, [selectedProviderId, managingProviders]);
/** Reads the zones again without closing anything: the open zone is kept, with what the provider now says of it (switched off, say). */
function refreshZones(providerId: number) {
api.dns.zones
.list(providerId)
.then((res) => {
setZones(res.zones);
setSelectedZone((current) => (current ? (res.zones.find((z) => z.id === current.id) ?? current) : current));
})
.catch(() => {});
}
function loadRecords(providerId: number, zone: DnsZone) {
api.dns.records
.list(providerId, zone.id)
@@ -160,6 +173,7 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
function selectZone(zone: DnsZone) {
setSelectedZone(zone);
setEditingZone(false);
setRecordForm(null);
setEditingRecordId(null);
if (selectedProviderId) loadRecords(selectedProviderId, zone);
@@ -516,7 +530,11 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
className={selectedZone?.id === z.id ? "table-active" : ""}
onClick={() => selectZone(z)}
>
<td>{z.name}</td>
<td>
{z.name}
{z.disabled && <span className="badge bg-yellow-lt text-yellow ms-2">off</span>}
{z.type && z.type !== "Primary" && <span className="badge bg-secondary-lt text-secondary ms-1">{z.type}</span>}
</td>
<td>{z.recordCount}</td>
<td className="text-secondary">
{z.syncedAt ? <TimeAgo value={z.syncedAt} /> : "never"}
@@ -556,6 +574,11 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
Add record
</button>
)}
{isAdmin && selectedProvider?.canEditZones && selectedProvider.enabled && (
<button className="btn btn-sm btn-outline-secondary ms-2" onClick={() => setEditingZone((v) => !v)} aria-expanded={editingZone}>
Edit zone
</button>
)}
{isAdmin && selectedProvider?.canDeleteZones && selectedProvider.enabled && (
<button className="btn btn-sm btn-outline-danger ms-2" onClick={() => void deleteZone()}>
Delete zone
@@ -564,6 +587,10 @@ function DnsRecords({ user, tabs }: { user: CurrentUser; tabs: ReactNode }) {
</div>
</div>
{editingZone && selectedProviderId && (
<DnsZoneEditor providerId={selectedProviderId} zone={selectedZone} onChanged={() => refreshZones(selectedProviderId)} onClose={() => setEditingZone(false)} />
)}
{recordForm && (
<form onSubmit={submitRecord}>
<div className="card-body row g-2">