Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
feat: add per-repository run count (total, failed) to report
Lars Wirzenius committed 1 year ago
commit 331caf78ff38db072a38a75d78944dbe697b9c18
parent b8027442ca13b5eafc188a4b9493017729c0fbdb
1 file changed +24 -7
modified src/pages.rs
@@ -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 {