Fix Overview layout: stats panel, filter panel, then tables (in that order)
Placing the filter form outside the polled div (so the poll can't wipe out typed/selected values) put it before the stat-grid, since both used to live inside that same polled block — stats ended up after the filter instead of before it, as it always was. Splits the stat-grid out into its own #overview-stats div, positioned before the filter form; the actual poll target is now #overview-tables (just the two tables). Since #overview-stats no longer polls directly, /overview/fragment now also renders it as an out-of-band swap alongside the main #overview-tables response — the same hx-swap-oob idiom already used for the shared error banner — so the stat counts still refresh every tick even though they're outside the polled element. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
281c9188a2
commit
3e33841ada
9 files changed
+72
-15
No files matched your search
@@ -50,9 +50,19 @@ func (s *Server) handleOverview(w http.ResponseWriter, r *http.Request) {
|
||||
s.renderPage(w, "overview_page", data)
|
||||
}
|
||||
|
||||
// handleOverviewFragment serves both the recurring poll and every
|
||||
// filter-triggered request. Its hx-target is #overview-tables, but the
|
||||
// stat-grid (#overview-stats) needs to stay in sync too — it lives outside
|
||||
// #overview-tables in the DOM (see overview.html) so the filter form can
|
||||
// sit between them, so it's refreshed via an out-of-band swap appended
|
||||
// after the main content, the same idiom templates/layout.html's
|
||||
// error_banner already uses for the shared error banner.
|
||||
func (s *Server) handleOverviewFragment(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := s.loadOverview(r)
|
||||
s.renderFragment(w, "overview_fragment", data, err)
|
||||
s.renderFragment(w, "overview_tables", data, err)
|
||||
if tplErr := s.tmpl.ExecuteTemplate(w, "overview_stats_oob", data); tplErr != nil {
|
||||
s.Log.Error("render overview stats oob", "err", tplErr)
|
||||
}
|
||||
}
|
||||
|
||||
// currentlyChecking is every IP not yet in a terminal state, ordered by
|
||||
|
||||
Reference in new issue
Block a user