Zone page: links to the same zone in the other views

The header says "also in VIEW" for every zone of the same name in
another view, linked or not, in the view's colour, keeping the open tab
where the other zone has it. The zone API gains in_views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-18 15:45:41 +01:00
1 parent a36c54ce60
commit 4cc2ab2287
7 files changed
+58 -2

No files matched your search

+14
View File
@@ -35,3 +35,17 @@ func TestDNSSECWhereDSGoes(t *testing.T) {
}
}
}
// A zone lists the zones of its name in the other views.
func TestZoneInViews(t *testing.T) {
e := newAPIEnv(t)
e.do("POST", "/views", e.token, map[string]any{"name": "internal", "match_clients": []string{"10.0.0.0/8"}}, 201)
e.do("POST", "/views", e.token, map[string]any{"name": "external"}, 201)
e.do("POST", "/zones", e.token, map[string]any{"name": "adbraun.lol", "view": "internal", "nameservers": []string{"ns1.example.net."}}, 201)
e.do("POST", "/zones", e.token, map[string]any{"name": "adbraun.lol", "view": "external", "nameservers": []string{"ns1.example.net."}}, 201)
z := e.do("GET", "/zones/adbraun.lol?view=internal", e.token, nil, 200)
in, _ := z["in_views"].([]any)
if len(in) != 1 || in[0].(map[string]any)["view"] != "external" || in[0].(map[string]any)["type"] != "primary" {
t.Errorf("in_views = %v", z["in_views"])
}
}