Show collapsible IP check cycles in the registry

This commit is contained in:
ayurishchev committed 2026-11-23 11:53:08 +03:00
1 parent 94124747ce
commit b58d5f5b82
16 files changed
+332 -36

No files matched your search

+24 -4
View File
@@ -1,6 +1,8 @@
package httpapi
import (
"database/sql"
"errors"
"fmt"
"net/http"
"net/netip"
@@ -111,11 +113,29 @@ func (s *Server) handleAdminRegistryHistory(w http.ResponseWriter, r *http.Reque
writeError(w, http.StatusInternalServerError, err.Error())
return
}
events, err := s.DB.ListEventsForRegistry(r.Context(), summary.ID)
if err != nil {
writeDBError(w, err)
return
}
cycles, err := s.DB.ListRegistryCycles(r.Context(), summary.ID)
if err != nil {
writeDBError(w, err)
return
}
currentIP, err := s.DB.GetIPByAddress(r.Context(), summary.IPAddress)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
writeDBError(w, err)
return
}
writeJSON(w, http.StatusOK, struct {
Registry registryDTO `json:"registry"`
Checks []db.Check `json:"checks"`
SelfCheckFailedOn []string `json:"self_check_failed_on"`
}{registrySummaryToDTO(*summary), checks, failedOn})
Registry registryDTO `json:"registry"`
Checks []db.Check `json:"checks"`
SelfCheckFailedOn []string `json:"self_check_failed_on"`
Events []db.Event `json:"events"`
Cycles []db.RegistryCycle `json:"cycles"`
CurrentIP *db.IPQueueItem `json:"current_ip,omitempty"`
}{registrySummaryToDTO(*summary), checks, failedOn, events, cycles, currentIP})
}
func registrySummaryToDTO(s db.RegistrySummary) registryDTO {