From 99e56cfbc20592aa8bc1bd010d73eba241351b8d Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Tue, 18 Jun 2024 11:43:54 +0200 Subject: dashboard/app/graph: generalize histogram --- dashboard/app/graph_found_bugs.html | 44 ------------------------------------- dashboard/app/graph_histogram.html | 44 +++++++++++++++++++++++++++++++++++++ dashboard/app/graphs.go | 8 ++++--- 3 files changed, 49 insertions(+), 47 deletions(-) delete mode 100644 dashboard/app/graph_found_bugs.html create mode 100644 dashboard/app/graph_histogram.html diff --git a/dashboard/app/graph_found_bugs.html b/dashboard/app/graph_found_bugs.html deleted file mode 100644 index 4bf29434b..000000000 --- a/dashboard/app/graph_found_bugs.html +++ /dev/null @@ -1,44 +0,0 @@ -{{/* -Copyright 2024 syzkaller project authors. All rights reserved. -Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - -Number of found bugs per month. -*/}} - - - - - {{.Header.Namespace}} bugs found per month - {{template "head" .Header}} - - - - - - {{template "header" .Header}} -
- - diff --git a/dashboard/app/graph_histogram.html b/dashboard/app/graph_histogram.html new file mode 100644 index 000000000..930d7b912 --- /dev/null +++ b/dashboard/app/graph_histogram.html @@ -0,0 +1,44 @@ +{{/* +Copyright 2024 syzkaller project authors. All rights reserved. +Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +Number of found bugs per month. +*/}} + + + + + {{.Title}} + {{template "head" .Header}} + + + + + + {{template "header" .Header}} +
+ + diff --git a/dashboard/app/graphs.go b/dashboard/app/graphs.go index e5d9412f8..f2c991db7 100644 --- a/dashboard/app/graphs.go +++ b/dashboard/app/graphs.go @@ -26,7 +26,8 @@ type uiBugLifetimesPage struct { Lifetimes []uiBugLifetime } -type uiReportedBugsPage struct { +type uiHistogramPage struct { + Title string Header *uiHeader Graph *uiGraph } @@ -178,11 +179,12 @@ func handleFoundBugsGraph(c context.Context, w http.ResponseWriter, r *http.Requ if err != nil { return err } - data := &uiReportedBugsPage{ + data := &uiHistogramPage{ + Title: hdr.Namespace + " bugs found per month", Header: hdr, Graph: createFoundBugs(c, bugs), } - return serveTemplate(w, "graph_found_bugs.html", data) + return serveTemplate(w, "graph_histogram.html", data) } func loadGraphBugs(c context.Context, ns string) ([]*Bug, error) { -- cgit mrf-deployment