Runs (migration 0011): a run groups the cycles of one launch. It opens when an address enters an idle queue, takes everything submitted or re-checked while it is open and is finalized when all its addresses are done; a re-check after that opens a new run, so results of different runs never mix. check_runs, run_results (one result per address and run, with the verdict and the expected and stored check counts), subnets, run_id on ip_queue and checks. Existing data is split into runs at pauses of more than an hour; ingress checks get the validator that held the address (also at write time from now on). Analytics (internal/analytics): figures computed from the stored checks of the latest cycle of each address in the run, as facts next to the verdict: summary, reasons of partial, data quality, subnets, targets and the subnet x target matrix by check type, ingress by site, error classes, validators, and the address lists behind the indicators and error classes. API: analytics runs, report, lists (JSON or CSV), subnet list; run and subnet filters for the registry. Dashboard: /analytics matching the approved mockup (run selector, indicators with address lists and CSV, error-class dialogs, drill-down to the registry), subnet list on /settings. Sidebar: the control-api link state, theme toggle and logout moved to the top, the three dots next to the logo removed, sections grouped. Rebuilt bin/control-api and bin/admin-dashboard to match. Plan, summary and the updated README, API, USAGE, DASHBOARD and ADMIN_CLEANUP docs are in docs/. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
70 lines
3.0 KiB
Go
70 lines
3.0 KiB
Go
package dashboard
|
|
|
|
import "net/http"
|
|
|
|
func (s *Server) routes(mux *http.ServeMux) {
|
|
// /login, /logout and /static/ are the only routes reachable without a
|
|
// session — see authMiddleware in auth.go.
|
|
mux.HandleFunc("GET /login", s.handleLoginPage)
|
|
mux.HandleFunc("POST /login", s.handleLoginSubmit)
|
|
mux.HandleFunc("POST /logout", s.handleLogout)
|
|
|
|
mux.HandleFunc("GET /{$}", s.handleIndex)
|
|
|
|
mux.HandleFunc("GET /overview", s.handleOverview)
|
|
mux.HandleFunc("GET /overview/fragment", s.handleOverviewFragment)
|
|
|
|
mux.HandleFunc("GET /ips", s.handleIPsPage)
|
|
mux.HandleFunc("GET /ips/{ip}", s.handleIPDetail)
|
|
mux.HandleFunc("POST /ips", s.handleIPsSubmit)
|
|
mux.HandleFunc("POST /ips/scan", s.handleIPsScan)
|
|
mux.HandleFunc("GET /ips/scan/status", s.handleIPsScanStatus)
|
|
mux.HandleFunc("POST /ips/{ip}/recheck", s.handleIPRecheck)
|
|
mux.HandleFunc("POST /ips/{ip}/cancel", s.handleIPCancel)
|
|
mux.HandleFunc("DELETE /ips/{ip}", s.handleIPDelete)
|
|
mux.HandleFunc("POST /ips/delete", s.handleIPsDeleteSelected)
|
|
mux.HandleFunc("POST /ips/recheck", s.handleIPsRecheckSelected)
|
|
mux.HandleFunc("POST /ips/clear", s.handleIPsClear)
|
|
|
|
mux.HandleFunc("GET /registry", s.handleRegistryPage)
|
|
mux.HandleFunc("GET /registry/{ip}", s.handleRegistryDetail)
|
|
|
|
mux.HandleFunc("GET /analytics", s.handleAnalyticsPage)
|
|
mux.HandleFunc("GET /analytics/lists/{kind}", s.handleAnalyticsList)
|
|
mux.HandleFunc("GET /analytics/csv/{kind}", s.handleAnalyticsCSV)
|
|
|
|
mux.HandleFunc("GET /validators", s.handleValidatorsPage)
|
|
mux.HandleFunc("POST /validators", s.handleValidatorCreate)
|
|
mux.HandleFunc("PUT /validators/{id}", s.handleValidatorUpdate)
|
|
mux.HandleFunc("DELETE /validators/{id}", s.handleValidatorDelete)
|
|
|
|
mux.HandleFunc("GET /sites", s.handleSitesPage)
|
|
mux.HandleFunc("POST /sites", s.handleSiteCreate)
|
|
mux.HandleFunc("PUT /sites/{index}", s.handleSitePut)
|
|
mux.HandleFunc("DELETE /sites/{index}", s.handleSiteDelete)
|
|
|
|
mux.HandleFunc("GET /targets", s.handleTargetsPage)
|
|
mux.HandleFunc("POST /targets", s.handleTargetCreate)
|
|
mux.HandleFunc("PUT /targets/{group}", s.handleTargetUpdate)
|
|
mux.HandleFunc("DELETE /targets/{group}", s.handleTargetDelete)
|
|
|
|
mux.HandleFunc("GET /check-types", s.handleCheckTypesPage)
|
|
mux.HandleFunc("POST /check-types", s.handleCheckTypeCreate)
|
|
mux.HandleFunc("PUT /check-types/{name}", s.handleCheckTypeUpdate)
|
|
mux.HandleFunc("DELETE /check-types/{name}", s.handleCheckTypeDelete)
|
|
|
|
mux.HandleFunc("GET /settings", s.handleSettingsPage)
|
|
mux.HandleFunc("PUT /settings", s.handleSettingsPut)
|
|
mux.HandleFunc("PUT /settings/inbound-checks", s.handleInboundChecksPut)
|
|
mux.HandleFunc("PUT /settings/subnets", s.handleSubnetsPut)
|
|
mux.HandleFunc("PUT /settings/auto-cycle", s.handleAutoCyclePut)
|
|
mux.HandleFunc("POST /settings/auto-cycle/start", s.handleAutoCycleStart)
|
|
mux.HandleFunc("POST /settings/auto-cycle/stop", s.handleAutoCycleStop)
|
|
|
|
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServerFS(staticSubFS())))
|
|
}
|
|
|
|
func (s *Server) handleIndex(w http.ResponseWriter, r *http.Request) {
|
|
http.Redirect(w, r, "/overview", http.StatusFound)
|
|
}
|