dashboard and status API list a port's domains apart from its hostnames (closes #245)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A port entry in the state saves the apex domains that resolve to its address with its hostnames. The dashboard's Ports table now has a Domains column next to Hostnames, and a port entry in /api/v1/status has a `domains` list, with `hostnames` no longer holding a domain. A name is taken as a domain when it has a domain entry, as the dashboard and API already tell a domain's own records from a hostname's. Both read the split from one function, buildPorts. The state file is unchanged; README says its port `hostnames` include domains. Model: opus-5-5
This commit was merged in pull request #247.
This commit is contained in:
@@ -45,11 +45,14 @@ func newDashboardTemplate() *template.Template {
|
||||
|
||||
// dashboardData is the data passed to the dashboard template. Hostnames
|
||||
// and DomainRecords split the records in Snapshot.Hostnames, which also
|
||||
// holds the apex domains' own (see splitHostnames).
|
||||
// holds the apex domains' own (see splitHostnames). Ports holds
|
||||
// Snapshot.Ports with each port's names split into domains and
|
||||
// hostnames, as /api/v1/status gives them (see buildPorts).
|
||||
type dashboardData struct {
|
||||
Snapshot state.Snapshot
|
||||
Hostnames map[string]*state.HostnameState
|
||||
DomainRecords map[string]*state.HostnameState
|
||||
Ports map[string]*statusPortInfo
|
||||
Alerts []notify.AlertEntry
|
||||
StateAge string
|
||||
GeneratedAt string
|
||||
@@ -71,6 +74,7 @@ func (h *Handlers) HandleDashboard() http.HandlerFunc {
|
||||
Snapshot: snap,
|
||||
Hostnames: hostnames,
|
||||
DomainRecords: domainRecords,
|
||||
Ports: buildPorts(snap),
|
||||
Alerts: alerts,
|
||||
StateAge: relTime(snap.LastUpdated),
|
||||
GeneratedAt: time.Now().UTC().Format("2006-01-02 15:04:05"),
|
||||
|
||||
Reference in New Issue
Block a user