The "Scan Floating IP" button failed with a client timeout: the project now holds ~6.4k floating IPs and the scan listed them all in one unpaginated, timeout-less Neutron request on the HTTP request context. openstack: ListFreeFloatingIPs reads marker-based pages (fields= keeps them small) with per-page retry/backoff on transport errors, 5xx and 429, and every request now has a timeout (also ends hangs inside the orchestrator tick). orchestrator: the scan is a single-flight background job on the process context with progress (clearing/listing/enqueuing/done/error), dry_run, full discovery before anything is enqueued, then SubmitIPs in chunks of 500 in ascending IP order; a failed read leaves the queue untouched. The auto-cycle gets a "scanning" phase that polls the job, so the control loop and autoCycleMu are never held across OpenStack/DB work; it recovers after a restart and waits for (instead of adopting) a scan started by someone else. db: migration 0009 (indexes), paged ListIPsPage/ListRegistryPage, GROUP BY counters, EXISTS completion check, set-based ClearAllIPs. API: POST /admin/ips/scan -> 202 (dry_run, wait), GET /admin/ips/scan, paging and filters on /admin/ips and /admin/registry (bare arrays without limit), results_by_overall in /admin/status. dashboard: scan progress panel and dry-run button, paginated /ips and /registry with server-side filters, Overview on counters and capped lists with progress/ETA, "select all N by filter", hx-params fix for per-row buttons, real counts in confirmations. Also: docs (API, USAGE, DASHBOARD, README), plan and review under docs/changes/, bin/ rebuilt with new SHA256SUMS. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
65 lines
2.8 KiB
Go
65 lines
2.8 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 /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/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)
|
|
}
|