From 44b1e39faee03d3a5f496f66157a41f939e74286 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 7 Nov 2024 16:01:06 +0100 Subject: pkg/manager: wrap stats page with the common header Add common manager HTML header to the stats page as well. --- pkg/html/pages/stats.go | 89 ++++++++++++++++++++++++-------------------- pkg/html/pages/stats_test.go | 7 +--- 2 files changed, 51 insertions(+), 45 deletions(-) (limited to 'pkg/html') diff --git a/pkg/html/pages/stats.go b/pkg/html/pages/stats.go index 2682d28e9..3bc60cc5d 100644 --- a/pkg/html/pages/stats.go +++ b/pkg/html/pages/stats.go @@ -3,48 +3,57 @@ package pages -var StatsTemplate = Create(` - - - - syzkaller stats - - + - {{/* Preserve vertical scroll position after page reloads. Otherwise it's random. */}} - window.scroll(0, window.location.hash.substring(1)); - document.onscroll = function(e) { window.location.hash = Math.round(window.scrollY); }; - }); - - {{HEAD}} - - {{range $g := .}}
{{end}} - - `) diff --git a/pkg/html/pages/stats_test.go b/pkg/html/pages/stats_test.go index a5dcce01d..141651188 100644 --- a/pkg/html/pages/stats_test.go +++ b/pkg/html/pages/stats_test.go @@ -4,14 +4,11 @@ package pages import ( - "io" "testing" - - "github.com/google/syzkaller/pkg/stat" ) -func TestStatsTemplate(t *testing.T) { - if err := StatsTemplate.Execute(io.Discard, stat.RenderGraphs()); err != nil { +func TestStatsHTML(t *testing.T) { + if _, err := StatsHTML(); err != nil { t.Fatal(err) } } -- cgit mrf-deployment