| @@ -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. |
| 22 | type buildFilterLink struct { |
22 | type 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. |
| 30 | var buildStatuses = []string{"pending", "running", "success", "failure", "cancelled"} |
31 | var 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. |
| 37 | func filterLinks(f buildFilter, jobs []control.JobOut) []buildFilterLink { |
38 | func 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 | |