ui: embed reanimator chart viewer

This commit is contained in:
Mikhail Chusavitin
2026-03-16 00:20:11 +03:00
parent f11a43f690
commit 057a222288
12 changed files with 361 additions and 167 deletions

View File

@@ -11,6 +11,7 @@ import (
"git.mchus.pro/mchus/logpile/internal/collector"
"git.mchus.pro/mchus/logpile/internal/models"
chartviewer "reanimator/chart/viewer"
)
// WebFS holds embedded web files (set by main package)
@@ -64,9 +65,13 @@ func (s *Server) setupRoutes() {
panic(err)
}
s.mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticContent))))
s.mux.Handle("/chart/", http.StripPrefix("/chart", chartviewer.NewHandler(chartviewer.HandlerOptions{
Title: "LOGPile Reanimator Viewer",
})))
// Pages
s.mux.HandleFunc("/", s.handleIndex)
s.mux.HandleFunc("GET /chart/current", s.handleChartCurrent)
// API endpoints
s.mux.HandleFunc("POST /api/upload", s.handleUpload)