Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
chore: update to html-gen API changes
Lars Wirzenius committed 2 years ago
commit 9085ada0db9fa277230ba306f7ee1c750b1f9497
parent 5ea5baa1cb1746ada00188e7f8cf1938eec0226e
3 files changed +28 -28
modified Cargo.lock
@@ -674,9 +674,9 @@ dependencies = [

[[package]]
name = "html-page"
-
version = "0.1.0"
+
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "3f8314b0ea57e9e3fc648213a02315e8a16154bb86da7516fec7a09ec4d7417c"
+
checksum = "dc5c97d0f1c30289fd33861d5dac9259b039b3c4e6d718a63806b04287329809"
dependencies = [
 "html-escape",
 "line-col",
modified Cargo.toml
@@ -11,6 +11,7 @@ repository = "https://app.radicle.xyz/nodes/radicle.liw.fi/rad:zwTxygwuz5LDGBq25
categories = ["development-tools::build-utils"]

[dependencies]
+
html-page = "0.2.0"
log = "0.4.20"
pretty_env_logger = "0.5.0"
radicle-git-ext = "0.7.0"
@@ -21,7 +22,6 @@ thiserror = "1.0.50"
radicle-surf = { version = "0.18.0", default-features = false, features = ["serde"] }
uuid = { version = "1.7.0", features = ["v4"] }
time = { version = "0.3.34", features = ["formatting", "macros"] }
-
html-page = "0.1.0"
sqlite = "0.32.0"

[dependencies.radicle]
modified src/pages.rs
@@ -103,28 +103,28 @@ impl PageData {
        let mut doc = Document::default();

        doc.push_to_head(
-
            &Element::new(Tag::Title)
+
            Element::new(Tag::Title)
                .with_text("CI for Radicle node ")
                .with_text(&self.node_alias),
        );

-
        doc.push_to_head(&Element::new(Tag::Style).with_text(CSS));
+
        doc.push_to_head(Element::new(Tag::Style).with_text(CSS));

        doc.push_to_head(
-
            &Element::new(Tag::Meta)
+
            Element::new(Tag::Meta)
                .with_attribute("http-equiv", "refresh")
                .with_attribute("content", REFERESH_INTERVAL),
        );

        doc.push_to_body(
-
            &Element::new(Tag::H1)
+
            Element::new(Tag::H1)
                .with_text("CI for Radicle node ")
                .with_text(&self.node_alias),
        );

-
        doc.push_to_body(&Element::new(Tag::H2).with_text("Broker status"));
+
        doc.push_to_body(Element::new(Tag::H2).with_text("Broker status"));
        doc.push_to_body(
-
            &Element::new(Tag::P)
+
            Element::new(Tag::P)
                .with_text("Last updated: ")
                .with_text(&self.timestamp)
                .with_child(Element::new(Tag::Br))
@@ -137,19 +137,19 @@ impl PageData {

        let status = StatusData::from(self).as_json();
        doc.push_to_body(
-
            &Element::new(Tag::P).with_child(
+
            Element::new(Tag::P).with_child(
                Element::new(Tag::A)
                    .with_attribute("href", "status.json")
                    .with_text("status.json:"),
            ),
        );
        doc.push_to_body(
-
            &Element::new(Tag::Blockquote).with_child(Element::new(Tag::Pre).with_text(&status)),
+
            Element::new(Tag::Blockquote).with_child(Element::new(Tag::Pre).with_text(&status)),
        );

-
        doc.push_to_body(&Element::new(Tag::H2).with_text("Repositories"));
+
        doc.push_to_body(Element::new(Tag::H2).with_text("Repositories"));

-
        doc.push_to_body(&Element::new(Tag::P).with_text("Latest CI run for each repository."));
+
        doc.push_to_body(Element::new(Tag::P).with_text("Latest CI run for each repository."));

        let mut list = Element::new(Tag::Ul).with_attribute("class", "repolist");
        for (alias, rid) in self.repos() {
@@ -157,7 +157,7 @@ impl PageData {

            let runs = self.runs(rid);
            item.push_child(
-
                &Element::new(Tag::Span).with_child(
+
                Element::new(Tag::Span).with_child(
                    Element::new(Tag::A)
                        .with_attribute("href", &format!("{}.html", rid_to_basename(rid)))
                        .with_text("Repository ")
@@ -177,19 +177,19 @@ impl PageData {
            );

            if let Some(run) = self.latest_run(rid) {
-
                item.push_child(&Element::new(Tag::Br));
+
                item.push_child(Element::new(Tag::Br));
                item.push_child(
-
                    &Element::new(Tag::Span)
+
                    Element::new(Tag::Span)
                        .with_text(run.timestamp())
                        .with_child(Element::new(Tag::Br))
                        .with_text(" ")
                        .with_child(Self::whence_as_html(run.whence())),
                );
-
                item.push_child(&Element::new(Tag::Br));
+
                item.push_child(Element::new(Tag::Br));

                let state = run.state().to_string();
                item.push_child(
-
                    &Element::new(Tag::Span)
+
                    Element::new(Tag::Span)
                        .with_attribute("class", &state)
                        .with_text(&state),
                );
@@ -209,12 +209,12 @@ impl PageData {
                        .with_text("failure"),
                };

-
                item.push_child(&result);
+
                item.push_child(result);
            }

-
            list.push_child(&item);
+
            list.push_child(item);
        }
-
        doc.push_to_body(&list);
+
        doc.push_to_body(list);

        doc
    }
@@ -291,27 +291,27 @@ impl PageData {
        let mut doc = Document::default();

        doc.push_to_head(
-
            &Element::new(Tag::Title)
+
            Element::new(Tag::Title)
                .with_text("CI runs for repository ")
                .with_text(alias),
        );

-
        doc.push_to_head(&Element::new(Tag::Style).with_text(CSS));
+
        doc.push_to_head(Element::new(Tag::Style).with_text(CSS));

        doc.push_to_body(
-
            &Element::new(Tag::H1)
+
            Element::new(Tag::H1)
                .with_text("CI runs for repository ")
                .with_text(alias),
        );

        doc.push_to_body(
-
            &Element::new(Tag::P)
+
            Element::new(Tag::P)
                .with_text("Last updated: ")
                .with_text(timestamp),
        );

        doc.push_to_body(
-
            &Element::new(Tag::P)
+
            Element::new(Tag::P)
                .with_text("Repository ID ")
                .with_child(Element::new(Tag::Code).with_text(&rid.to_string())),
        );
@@ -351,7 +351,7 @@ impl PageData {
            };

            list.push_child(
-
                &Element::new(Tag::Li)
+
                Element::new(Tag::Li)
                    .with_text(run.timestamp())
                    .with_text(" ")
                    .with_child(current)
@@ -362,7 +362,7 @@ impl PageData {
            );
        }

-
        doc.push_to_body(&list);
+
        doc.push_to_body(list);

        doc
    }