Skip to content

Commit f7cfc62

Browse files
pimyn-girgisa-nogikh
authored andcommitted
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 06ac10d commit f7cfc62

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

syz-cluster/dashboard/handler.go

Lines changed: 6 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,11 @@ 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+
data.Versions, err = h.seriesRepo.ListAllVersions(ctx, data.Series.Title)
194+
if err != nil {
195+
return fmt.Errorf("failed to query all series versions: %w", err)
196+
}
191197
sessions, err := h.sessionRepo.ListForSeries(ctx, data.Series)
192198
if err != nil {
193199
return fmt.Errorf("failed to query sessions: %w", err)

syz-cluster/dashboard/templates/series.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ <h2>Patch Series</h2>
5353
</tr>
5454
<tr>
5555
<th>Version</th>
56-
<td>{{.Version}}</td>
56+
<td>
57+
<select class="form-select" onchange="window.location.href=this.value;">
58+
{{$currentSeriesVersion := .Version}}
59+
{{range .Versions}}
60+
<option value="/series/{{.ID}}" {{if eq .Version $currentSeriesVersion}}selected{{end}}>
61+
Version {{.Version}}
62+
</option>
63+
{{end}}
64+
</select>
65+
</td>
5766
</tr>
5867
<tr>
5968
<th>Cc</th>

syz-cluster/pkg/db/series_repo.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,17 @@ WHERE SEARCH(Patches.TitleTokens, @name)
226226
return ret, nil
227227
}
228228

229+
func (repo *SeriesRepository) ListAllVersions(ctx context.Context, title string) ([]*Series, error) {
230+
ro := repo.client.ReadOnlyTransaction()
231+
defer ro.Close()
232+
return readEntities[Series](ctx, ro, spanner.Statement{
233+
SQL: "SELECT ID, Version FROM SERIES where Title = @title ORDER BY Version",
234+
Params: map[string]any{
235+
"title": title,
236+
},
237+
})
238+
}
239+
229240
func (repo *SeriesRepository) querySessions(ctx context.Context, ro *spanner.ReadOnlyTransaction,
230241
seriesList []*SeriesWithSession) error {
231242
idToSeries := map[string]*SeriesWithSession{}

0 commit comments

Comments
 (0)