Commit 1aafa85cd1

1aafa85cd13a97cb280d412db0c1726fc7e0ea7e

parent: 09bc1d3bb9

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-19 21:48 UTC

httpd: drop the builds page's dead filter-link field

Ref #226
internal/httpd/buildpages_test.go +9 −10
@@ -30,17 +30,16 @@ func TestBuildsPageRendersCommandOutput(t *testing.T) {
3030 filter := buildFilter{}
3131 err := web.Render(&sb, "builds.html", struct {
3232 repoPage
33 Builds []control.BuildOut
34 Jobs []control.JobOut
35 Runs []buildRun
36 Filter buildFilter
37 FilterLinks []buildFilterLink
38 Facets []facetGroup
39 Refs []string
40 CanWrite bool
41 Notice string
33 Builds []control.BuildOut
34 Jobs []control.JobOut
35 Runs []buildRun
36 Filter buildFilter
37 Facets []facetGroup
38 Refs []string
39 CanWrite bool
40 Notice string
4241 }{
43 testRepoPage(), builds, jobs, groupRuns(builds), filter, filterLinks(filter, jobs), nil,
42 testRepoPage(), builds, jobs, groupRuns(builds), filter, nil,
4443 distinctRefs(builds, filter.Ref), true, "",
4544 })
4645 if err != nil {
internal/httpd/builds.go +17 −18
@@ -16,9 +16,9 @@ type buildFilter struct {
1616 Job string
1717}
1818
19// buildFilterLink is one entry in the nav.filters row above the build
20// list: a status or a job, with the other two parameters carried along so
21// clicking one never drops another.
19// buildFilterLink is one of the links buildFacets splits into the side
20// column's Status and Jobs groups: a status or a job, with the other two
21// parameters carried along so clicking one never drops another.
2222type buildFilterLink struct {
2323 Label string
2424 Href string
@@ -26,12 +26,13 @@ type buildFilterLink struct {
2626}
2727
2828// buildStatuses is the fixed vocabulary a build's status takes, in the
29// order the nav.filters row offers them.
29// order the Status group offers them. Its length is also where buildFacets
30// cuts filterLinks' rows apart.
3031var buildStatuses = []string{"pending", "running", "success", "failure", "cancelled"}
3132
32// filterLinks builds the nav.filters row: "all" (clears status and job),
33// one link per status, and one per job the repository's CI config names.
34// Each link keeps the filter's other two parameters and net/url encodes
33// filterLinks builds the status and job rows: "all" (clears status and
34// job), one link per status, and one per job the repository's CI config
35// names. Each link keeps the filter's other two parameters and net/url encodes
3536// them, so a branch name or job name with an odd character does not break
3637// the query string it lands in.
3738func filterLinks(f buildFilter, jobs []control.JobOut) []buildFilterLink {
@@ -207,17 +208,15 @@ func (s *Server) builds(w http.ResponseWriter, r *http.Request) {
207208
208209 s.render(w, "builds.html", struct {
209210 repoPage
210 Builds []control.BuildOut
211 Jobs []control.JobOut
212 Runs []buildRun
213 Filter buildFilter
214 FilterLinks []buildFilterLink
215 Facets []facetGroup
216 Refs []string
217 CanWrite bool
218 Notice string
219 }{p, builds, jobs, groupRuns(builds), filter, filterLinks(filter, jobs),
220 buildFacets(filter, jobs, refs), refs,
211 Builds []control.BuildOut
212 Jobs []control.JobOut
213 Runs []buildRun
214 Filter buildFilter
215 Facets []facetGroup
216 Refs []string
217 CanWrite bool
218 Notice string
219 }{p, builds, jobs, groupRuns(builds), filter, buildFacets(filter, jobs, refs), refs,
221220 s.canWriteRepo(r, p.Repo), s.takeFlash(w, r)})
222221}
223222
internal/httpd/repohead_test.go +9 −10
@@ -20,16 +20,15 @@ func TestRepoHeaderTwoRows(t *testing.T) {
2020 p.Tab = "files"
2121 err := web.Render(&sb, "builds.html", struct {
2222 repoPage
23 Builds []control.BuildOut
24 Jobs []control.JobOut
25 Runs []buildRun
26 Filter buildFilter
27 FilterLinks []buildFilterLink
28 Facets []facetGroup
29 Refs []string
30 CanWrite bool
31 Notice string
32 }{p, nil, nil, nil, buildFilter{}, nil, nil, nil, true, ""})
23 Builds []control.BuildOut
24 Jobs []control.JobOut
25 Runs []buildRun
26 Filter buildFilter
27 Facets []facetGroup
28 Refs []string
29 CanWrite bool
30 Notice string
31 }{p, nil, nil, nil, buildFilter{}, nil, nil, true, ""})
3332 if err != nil {
3433 t.Fatal(err)
3534 }