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

Layout: unified · split

internal/httpd/buildpages_test.go +9 −10
@@ -30,17 +30,16 @@ func TestBuildsPageRendersCommandOutput(t *testing.T) {
30 filter := buildFilter{} 30 filter := buildFilter{}
31 err := web.Render(&sb, "builds.html", struct { 31 err := web.Render(&sb, "builds.html", struct {
32 repoPage 32 repoPage
33 Builds []control.BuildOut 33 Builds []control.BuildOut
34 Jobs []control.JobOut 34 Jobs []control.JobOut
35 Runs []buildRun 35 Runs []buildRun
36 Filter buildFilter 36 Filter buildFilter
37 FilterLinks []buildFilterLink 37 Facets []facetGroup
38 Facets []facetGroup 38 Refs []string
39 Refs []string 39 CanWrite bool
40 CanWrite bool 40 Notice string
41 Notice string
42 }{ 41 }{
43 testRepoPage(), builds, jobs, groupRuns(builds), filter, filterLinks(filter, jobs), nil, 42 testRepoPage(), builds, jobs, groupRuns(builds), filter, nil,
44 distinctRefs(builds, filter.Ref), true, "", 43 distinctRefs(builds, filter.Ref), true, "",
45 }) 44 })
46 if err != nil { 45 if err != nil {
internal/httpd/builds.go +17 −18
@@ -16,9 +16,9 @@ type buildFilter struct {
16 Job string 16 Job string
17} 17}
18 18
19// buildFilterLink is one entry in the nav.filters row above the build 19// buildFilterLink is one of the links buildFacets splits into the side
20// list: a status or a job, with the other two parameters carried along so 20// column's Status and Jobs groups: a status or a job, with the other two
21// clicking one never drops another. 21// parameters carried along so clicking one never drops another.
22type buildFilterLink struct { 22type buildFilterLink struct {
23 Label string 23 Label string
24 Href string 24 Href string
@@ -26,12 +26,13 @@ type buildFilterLink struct {
26} 26}
27 27
28// buildStatuses is the fixed vocabulary a build's status takes, in the 28// 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.
30var buildStatuses = []string{"pending", "running", "success", "failure", "cancelled"} 31var buildStatuses = []string{"pending", "running", "success", "failure", "cancelled"}
31 32
32// filterLinks builds the nav.filters row: "all" (clears status and job), 33// filterLinks builds the status and job rows: "all" (clears status and
33// one link per status, and one per job the repository's CI config names. 34// job), one link per status, and one per job the repository's CI config
34// Each link keeps the filter's other two parameters and net/url encodes 35// names. Each link keeps the filter's other two parameters and net/url encodes
35// them, so a branch name or job name with an odd character does not break 36// them, so a branch name or job name with an odd character does not break
36// the query string it lands in. 37// the query string it lands in.
37func filterLinks(f buildFilter, jobs []control.JobOut) []buildFilterLink { 38func filterLinks(f buildFilter, jobs []control.JobOut) []buildFilterLink {
@@ -207,17 +208,15 @@ func (s *Server) builds(w http.ResponseWriter, r *http.Request) {
207 208
208 s.render(w, "builds.html", struct { 209 s.render(w, "builds.html", struct {
209 repoPage 210 repoPage
210 Builds []control.BuildOut 211 Builds []control.BuildOut
211 Jobs []control.JobOut 212 Jobs []control.JobOut
212 Runs []buildRun 213 Runs []buildRun
213 Filter buildFilter 214 Filter buildFilter
214 FilterLinks []buildFilterLink 215 Facets []facetGroup
215 Facets []facetGroup 216 Refs []string
216 Refs []string 217 CanWrite bool
217 CanWrite bool 218 Notice string
218 Notice string 219 }{p, builds, jobs, groupRuns(builds), filter, buildFacets(filter, jobs, refs), refs,
219 }{p, builds, jobs, groupRuns(builds), filter, filterLinks(filter, jobs),
220 buildFacets(filter, jobs, refs), refs,
221 s.canWriteRepo(r, p.Repo), s.takeFlash(w, r)}) 220 s.canWriteRepo(r, p.Repo), s.takeFlash(w, r)})
222} 221}
223 222
internal/httpd/repohead_test.go +9 −10
@@ -20,16 +20,15 @@ func TestRepoHeaderTwoRows(t *testing.T) {
20 p.Tab = "files" 20 p.Tab = "files"
21 err := web.Render(&sb, "builds.html", struct { 21 err := web.Render(&sb, "builds.html", struct {
22 repoPage 22 repoPage
23 Builds []control.BuildOut 23 Builds []control.BuildOut
24 Jobs []control.JobOut 24 Jobs []control.JobOut
25 Runs []buildRun 25 Runs []buildRun
26 Filter buildFilter 26 Filter buildFilter
27 FilterLinks []buildFilterLink 27 Facets []facetGroup
28 Facets []facetGroup 28 Refs []string
29 Refs []string 29 CanWrite bool
30 CanWrite bool 30 Notice string
31 Notice string 31 }{p, nil, nil, nil, buildFilter{}, nil, nil, true, ""})
32 }{p, nil, nil, nil, buildFilter{}, nil, nil, nil, true, ""})
33 if err != nil { 32 if err != nil {
34 t.Fatal(err) 33 t.Fatal(err)
35 } 34 }