mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-11-29 14:50:35 +08:00
feat: add per-repository run count (total, failed) to report
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+24
-7
@@ -161,9 +161,13 @@ impl PageData {
|
||||
}
|
||||
};
|
||||
|
||||
let runs = self.runs(rid);
|
||||
|
||||
table.push_child(
|
||||
Element::new(Tag::Tr)
|
||||
.with_child(Element::new(Tag::Td).with_child(Self::repository(rid, &alias)))
|
||||
.with_child(
|
||||
Element::new(Tag::Td).with_child(Self::repository(rid, &alias, runs)),
|
||||
)
|
||||
.with_child(Element::new(Tag::Td).with_child(run_ids))
|
||||
.with_child(
|
||||
Element::new(Tag::Td).with_child(
|
||||
@@ -377,14 +381,27 @@ impl PageData {
|
||||
page.push_to_body(Element::new(Tag::P).with_text(text));
|
||||
}
|
||||
|
||||
fn repository(repo_id: RepoId, alias: &str) -> Element {
|
||||
Element::new(Tag::A)
|
||||
fn repository(repo_id: RepoId, alias: &str, runs: Vec<&Run>) -> Element {
|
||||
let failed = runs
|
||||
.iter()
|
||||
.filter(|run| run.result() == Some(&RunResult::Failure))
|
||||
.count();
|
||||
let total = runs.len();
|
||||
|
||||
Element::new(Tag::Span)
|
||||
.with_child(
|
||||
Element::new(Tag::Code)
|
||||
.with_class("alias)")
|
||||
.with_text(alias),
|
||||
Element::new(Tag::A)
|
||||
.with_child(
|
||||
Element::new(Tag::Code)
|
||||
.with_class("alias)")
|
||||
.with_text(alias),
|
||||
)
|
||||
.with_attribute("href", &format!("{}.html", rid_to_basename(repo_id))),
|
||||
)
|
||||
.with_attribute("href", &format!("{}.html", rid_to_basename(repo_id)))
|
||||
.with_child(Element::new(Tag::Br))
|
||||
.with_child(Element::new(Tag::Span).with_text(&format!("{failed} failed runs")))
|
||||
.with_child(Element::new(Tag::Br))
|
||||
.with_child(Element::new(Tag::Span).with_text(&format!("{total} total runs")))
|
||||
}
|
||||
|
||||
fn run_ids(run: Option<&Run>) -> Element {
|
||||
|
||||
Reference in New Issue
Block a user