Skip to content

Commit a50d5dd

Browse files
committed
syz-cluster: show series versions in the dashboard
Display a list of other versions of the same series on the series details page. Fetch all series sharing the same title and render them in a new "Series Versions" table, allowing navigation between different versions of a patch series.
1 parent c5944b3 commit a50d5dd

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

syz-cluster/dashboard/handler.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func (h *dashboardHandler) seriesInfo(w http.ResponseWriter, r *http.Request) er
172172
*db.Series
173173
Patches []*db.Patch
174174
Sessions []SessionData
175+
Versions []*db.Series
175176
TotalPatches int
176177
}
177178
var data SeriesData
@@ -188,6 +189,19 @@ func (h *dashboardHandler) seriesInfo(w http.ResponseWriter, r *http.Request) er
188189
return fmt.Errorf("failed to query patches: %w", err)
189190
}
190191
data.TotalPatches = len(data.Patches)
192+
// Note: There may be some false positives, but there's no straightforward way to filter them out.
193+
seriesFilter := db.SeriesFilter{
194+
Name: data.Series.Title,
195+
Limit: 50, // A large enough number to get all versions.
196+
Offset: 0,
197+
}
198+
allVersions, err := h.seriesRepo.ListLatest(ctx, seriesFilter, time.Time{})
199+
if err != nil {
200+
return fmt.Errorf("failed to query all series versions: %w", err)
201+
}
202+
for _, v := range allVersions {
203+
data.Versions = append(data.Versions, v.Series)
204+
}
191205
sessions, err := h.sessionRepo.ListForSeries(ctx, data.Series)
192206
if err != nil {
193207
return fmt.Errorf("failed to query sessions: %w", err)

syz-cluster/dashboard/templates/series.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,30 @@ <h3>Session {{.CreatedAt.Format "2006-01-02"}}</h3>
171171
</tbody>
172172
</table>
173173
{{end}}
174+
175+
<h3>Series Versions</h3>
176+
<table class="table table-striped">
177+
<thead>
178+
<tr>
179+
<th>Version</th>
180+
<th>Date</th>
181+
</tr>
182+
</thead>
183+
<tbody>
184+
{{$currentSeriesVersion := .Version}}
185+
{{range .Versions}}
186+
<tr>
187+
<td>
188+
{{if eq .Version $currentSeriesVersion}}
189+
<b>{{.Version}}</b>
190+
{{else}}
191+
<a href="/series/{{.ID}}">{{.Version}}</a>
192+
{{end}}
193+
</td>
194+
<td>{{.PublishedAt}}</td>
195+
</tr>
196+
{{end}}
197+
</tbody>
198+
</table>
174199
</div>
175200
{{end}}

0 commit comments

Comments
 (0)