vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
|
f6f4b1db
Keenan Nemetz
15d ago
|
1 | package web |
| 2 | ||
| 3 | // The Runs tab shows the workflow results recorded for the commit under review. | |
| 4 | // It is the same queue history as the repository Runs page, narrowed to the | |
| 5 | // change's head so a reviewer does not have to search for the matching commits. | |
| 6 | ||
| 7 | import ( | |
| 8 | "net/http" | |
| 9 | "sort" | |
| 10 | ||
|
d37d301f
Keenan Nemetz
16h ago
|
11 | "rodent.software/vole/ci/runs" |
|
f6f4b1db
Keenan Nemetz
15d ago
|
12 | ) |
| 13 | ||
| 14 | type requestRunsView struct { | |
| 15 | requestSidebarView | |
|
d3dcf54d
Keenan Nemetz
11d ago
|
16 | Tab string |
| 17 | Runs []*runs.Run | |
|
f6f4b1db
Keenan Nemetz
15d ago
|
18 | } |
| 19 | ||
| 20 | // RequestRuns serves the Runs tab for one change. | |
| 21 | func (w *Web) RequestRuns(rw http.ResponseWriter, r *http.Request) { | |
| 22 | m, ok := w.open(rw, r) | |
| 23 | if !ok { | |
| 24 | return | |
| 25 | } | |
|
5d440e37
Keenan Nemetz
10d ago
|
26 | req, err := w.requestAt(memoOf(r), m, r.PathValue("id")) |
|
f6f4b1db
Keenan Nemetz
15d ago
|
27 | if err != nil { |
|
e84a66f5
Keenan Nemetz
15d ago
|
28 | w.notFound(rw, r) |
|
f6f4b1db
Keenan Nemetz
15d ago
|
29 | return |
| 30 | } | |
| 31 | ||
| 32 | var results []*runs.Run | |
| 33 | if w.Runs != nil && req.Head != "" { | |
| 34 | if byKey, err := w.Runs.ForSHA(m.Name, req.Head); err == nil { | |
| 35 | results = make([]*runs.Run, 0, len(byKey)) | |
| 36 | for _, run := range byKey { | |
| 37 | results = append(results, run) | |
| 38 | } | |
| 39 | sort.Slice(results, func(i, j int) bool { | |
| 40 | if results[i].Workflow != results[j].Workflow { | |
| 41 | return results[i].Workflow < results[j].Workflow | |
| 42 | } | |
| 43 | return results[i].Job < results[j].Job | |
| 44 | }) | |
| 45 | } else { | |
| 46 | w.Logger("request runs %s: %v", req.ID, err) | |
| 47 | } | |
| 48 | } | |
| 49 | w.render(rw, "request_runs", requestRunsView{ | |
|
de84c32b
Keenan Nemetz
5d ago
|
50 | requestSidebarView: w.requestSidebar(r, m, req, "runs", ""). |
|
f64c77e4
Keenan Nemetz
8d ago
|
51 | withLanding(w.landingFrom(m, req, w.reviewDiff(m, req))), |
|
ad4d9348
Keenan Nemetz
11d ago
|
52 | Tab: "runs", |
| 53 | Runs: results, | |
|
f6f4b1db
Keenan Nemetz
15d ago
|
54 | }, 0) |
| 55 | } |