Skip to content

Commit ceb1f4d

Browse files
committed
syz-cluster: add filtering by series and patch name
Update SeriesFilter in pkg/db to include PatchName and SeriesName fields, implement the SQL logic to filter by these fields case-insensitively, and expose these filters in the dashboard UI.
1 parent cee4cb1 commit ceb1f4d

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

syz-cluster/dashboard/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ func (h *dashboardHandler) seriesList(w http.ResponseWriter, r *http.Request) er
112112
baseURL := r.URL.RequestURI()
113113
data := MainPageData{
114114
Filter: db.SeriesFilter{
115+
PatchName: r.FormValue("patch_name"),
116+
SeriesName: r.FormValue("series_name"),
115117
Cc: r.FormValue("cc"),
116118
Status: db.SessionStatus(r.FormValue("status")),
117119
WithFindings: r.FormValue("with_findings") != "",

syz-cluster/dashboard/templates/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<input type="text" name="cc" class="form-control mb-3" value="{{.Filter.Cc}}" id="inputCc">
88
</div>
99
<div class="col-auto col-sm-3">
10+
<label for="inputSeriesName">Series Name</label>
11+
<input type="text" name="series_name" class="form-control mb-3" value="{{.Filter.SeriesName}}" id="inputSeriesName">
12+
</div>
13+
<div class="col-auto col-sm-3">
14+
<label for="inputPatchName">Patch Name</label>
15+
<input type="text" name="patch_name" class="form-control mb-3" value="{{.Filter.PatchName}}" id="inputPatchName">
16+
</div>
17+
<div class="col-auto">
1018
<label for="inputStatus">Status</label>
1119
<select id="inputStatus" class="form-control mb-3" name="status">
1220
{{$filter := .Filter}}

syz-cluster/pkg/db/series_repo.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ type SeriesFilter struct {
132132
WithFindings bool
133133
Limit int
134134
Offset int
135+
PatchName string
136+
SeriesName string
135137
}
136138

137139
// ListLatest() returns the list of series ordered by the decreasing PublishedAt value.
@@ -152,6 +154,15 @@ func (repo *SeriesRepository) ListLatest(ctx context.Context, filter SeriesFilte
152154
stmt.SQL += " AND @cc IN UNNEST(Cc)"
153155
stmt.Params["cc"] = filter.Cc
154156
}
157+
if filter.SeriesName != "" {
158+
stmt.SQL += " AND LOWER(title) LIKE '%' || LOWER(@series_name) || '%'"
159+
stmt.Params["series_name"] = filter.SeriesName
160+
}
161+
if filter.PatchName != "" {
162+
stmt.SQL += " AND EXISTS(SELECT 1 FROM Patches WHERE Patches.SeriesID = Series.ID" +
163+
" AND LOWER(Title) LIKE '%' || LOWER(@patch_name) || '%')"
164+
stmt.Params["patch_name"] = filter.PatchName
165+
}
155166
if filter.Status != SessionStatusAny {
156167
// It could have been an INNER JOIN in the main query, but let's favor the simpler code
157168
// in this function.

0 commit comments

Comments
 (0)