| @@ -16,9 +16,9 @@ type buildFilter struct { |
| 16 | 16 | Job string |
| 17 | 17 | } |
| 18 | 18 | |
| 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. |
| 22 | 22 | type buildFilterLink struct { |
| 23 | 23 | Label string |
| 24 | 24 | Href string |
| @@ -26,12 +26,13 @@ type buildFilterLink struct { |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 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 | 31 | var buildStatuses = []string{"pending", "running", "success", "failure", "cancelled"} |
| 31 | 32 | |
| 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 |
| 35 | 36 | // them, so a branch name or job name with an odd character does not break |
| 36 | 37 | // the query string it lands in. |
| 37 | 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 | 209 | s.render(w, "builds.html", struct { |
| 209 | 210 | 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, |
| 221 | 220 | s.canWriteRepo(r, p.Repo), s.takeFlash(w, r)}) |
| 222 | 221 | } |
| 223 | 222 | |