aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/dashboard
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-04-02 19:05:40 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-04-08 10:15:40 +0000
commit9e5bf1f8e420b27de381ad20643abb794ea5900e (patch)
tree77578a29929c9eaf76128d1a0146fc2cc5725cfa /syz-cluster/dashboard
parent6e02d8c05f12b334bec32728356b6dd166866220 (diff)
syz-cluster: filter by the session status
Update the Web UI to have a filter form on top of the index page.
Diffstat (limited to 'syz-cluster/dashboard')
-rw-r--r--syz-cluster/dashboard/handler.go19
-rw-r--r--syz-cluster/dashboard/templates/index.html34
-rw-r--r--syz-cluster/dashboard/templates/series.html10
3 files changed, 40 insertions, 23 deletions
diff --git a/syz-cluster/dashboard/handler.go b/syz-cluster/dashboard/handler.go
index c20d2225f..50c1966f8 100644
--- a/syz-cluster/dashboard/handler.go
+++ b/syz-cluster/dashboard/handler.go
@@ -73,18 +73,29 @@ var (
errBadRequest = errors.New("bad request")
)
-// TODO: export a common method to get Series' status.
+type statusOption struct {
+ Key db.SessionStatus
+ Value string
+}
func (h *dashboardHandler) seriesList(w http.ResponseWriter, r *http.Request) error {
type MainPageData struct {
// It's probably not the best idea to expose db entities here,
// but so far redefining the entity would just duplicate the code.
- List []*db.SeriesWithSession
- Filter db.SeriesFilter
+ List []*db.SeriesWithSession
+ Filter db.SeriesFilter
+ Statuses []statusOption
}
data := MainPageData{
Filter: db.SeriesFilter{
- Cc: r.FormValue("cc"),
+ Cc: r.FormValue("cc"),
+ Status: db.SessionStatus(r.FormValue("status")),
+ },
+ Statuses: []statusOption{
+ {db.SessionStatusAny, "any"},
+ {db.SessionStatusWaiting, "waiting"},
+ {db.SessionStatusInProgress, "in progress"},
+ {db.SessionStatusFinished, "finished"},
},
}
var err error
diff --git a/syz-cluster/dashboard/templates/index.html b/syz-cluster/dashboard/templates/index.html
index fb8fde0f3..98d021a1b 100644
--- a/syz-cluster/dashboard/templates/index.html
+++ b/syz-cluster/dashboard/templates/index.html
@@ -1,5 +1,27 @@
{{define "content"}}
- {{if .Filter.Cc}}<div class="alert alert-dark"><b>Filter: Cc={{.Filter.Cc}}</b></div>{{end}}
+ <div class="mx-3">
+ <form>
+ <div class="row align-items-center">
+ <div class="col-auto col-sm-3">
+ <label for="inputCc">Cc'd</label>
+ <input type="text" name="cc" class="form-control mb-3" value="{{.Filter.Cc}}" id="inputCc">
+ </div>
+ <div class="col-auto col-sm-3">
+ <label for="inputStatus">Status</label>
+ <select id="inputStatus" class="form-control mb-3" name="status">
+ {{$filter := .Filter}}
+ {{range .Statuses}}
+ <option value="{{.Key}}" {{if eq .Key $filter.Status}} selected{{end}}>{{.Value}}</option>
+ {{end}}
+ </select>
+ </div>
+ <div class="col-auto">
+ <button type="submit" class="btn btn-primary">Submit</button>
+ </div>
+ </div>
+ </form>
+ </div>
+
<table class="table">
<thead class="thead-light">
<tr>
@@ -19,15 +41,7 @@
<td>{{.Series.AuthorEmail}}</td>
<td>
{{if .Session}}
- {{if .Session.StartedAt.IsNull}}
- waiting
- {{else if .Session.FinishedAt.IsNull}}
- in progress
- {{else if .Session.SkipReason.IsNull}}
- finished
- {{else}}
- skipped
- {{end}}
+ {{.Session.Status}}
{{else}}
-
{{end}}
diff --git a/syz-cluster/dashboard/templates/series.html b/syz-cluster/dashboard/templates/series.html
index 5d7ba6693..daaad8ae8 100644
--- a/syz-cluster/dashboard/templates/series.html
+++ b/syz-cluster/dashboard/templates/series.html
@@ -94,15 +94,7 @@
</tr>
<tr>
<th>Status</th>
- <td>
- {{if .StartedAt.IsNull}}
- waiting
- {{else if .FinishedAt.IsNull}}
- in progress
- {{else}}
- finished
- {{end}}
- </td>
+ <td>{{.Status}}</td>
</tr>
{{if not .SkipReason.IsNull}}
<tr>