mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-10-18 19:30:29 +08:00
feat: shorten commit ID in per-repo report page
This commit is contained in:
+19
-16
@@ -399,7 +399,7 @@ impl PageData {
|
||||
let mut table = Element::new(Tag::Table).with_class("run-list").with_child(
|
||||
Element::new(Tag::Tr)
|
||||
.with_child(Element::new(Tag::Th).with_text("Run ID"))
|
||||
.with_child(Element::new(Tag::Th).with_text("Whence"))
|
||||
.with_child(Element::new(Tag::Th).with_text("Triggered by"))
|
||||
.with_child(Element::new(Tag::Th).with_text("Status"))
|
||||
.with_child(Element::new(Tag::Th).with_text("Info")),
|
||||
);
|
||||
@@ -547,18 +547,14 @@ impl PageData {
|
||||
name,
|
||||
commit,
|
||||
who: _,
|
||||
} => Element::new(Tag::Span)
|
||||
} => Element::span()
|
||||
.with_text("branch ")
|
||||
.with_child(Element::new(Tag::Code).with_class("branch").with_text(name))
|
||||
.with_text(", commit ")
|
||||
.with_child(
|
||||
Element::new(Tag::Code)
|
||||
.with_class("commit")
|
||||
.with_text(commit.to_string()),
|
||||
)
|
||||
.with_child(Self::commit_element(commit))
|
||||
.with_child(Element::new(Tag::Br))
|
||||
.with_child(
|
||||
Element::new(Tag::Span)
|
||||
Element::span()
|
||||
.with_class("who")
|
||||
.with_text(whence.who().unwrap_or("<commit author not known>")),
|
||||
),
|
||||
@@ -567,16 +563,16 @@ impl PageData {
|
||||
commit,
|
||||
revision,
|
||||
who: _,
|
||||
} => Element::new(Tag::Span)
|
||||
} => Element::span()
|
||||
.with_text("patch ")
|
||||
.with_child(
|
||||
Element::new(Tag::Code)
|
||||
Element::code()
|
||||
.with_class("patch")
|
||||
.with_text(patch.to_string()),
|
||||
)
|
||||
.with_child(Element::new(Tag::Br))
|
||||
.with_text("revision ")
|
||||
.with_child(Element::new(Tag::Code).with_class("revision)").with_text(&{
|
||||
.with_child(Element::code().with_class("revision)").with_text(&{
|
||||
if let Some(rev) = &revision {
|
||||
rev.to_string()
|
||||
} else {
|
||||
@@ -585,11 +581,7 @@ impl PageData {
|
||||
}))
|
||||
.with_child(Element::new(Tag::Br))
|
||||
.with_text("commit ")
|
||||
.with_child(
|
||||
Element::new(Tag::Code)
|
||||
.with_class("commit)")
|
||||
.with_text(commit.to_string()),
|
||||
)
|
||||
.with_child(Self::commit_element(commit))
|
||||
.with_child(Element::new(Tag::Br))
|
||||
.with_text("from ")
|
||||
.with_child(
|
||||
@@ -600,6 +592,17 @@ impl PageData {
|
||||
}
|
||||
}
|
||||
|
||||
fn commit_element(oid: &Oid) -> Element {
|
||||
let commit = if let Some((prefix, _)) = oid.to_string().split_at_checked(7) {
|
||||
prefix.to_string()
|
||||
} else {
|
||||
oid.to_string()
|
||||
};
|
||||
Element::span()
|
||||
.with_class("commit-id-prefix")
|
||||
.with_text(commit)
|
||||
}
|
||||
|
||||
fn repos(&self) -> Vec<(String, RepoId)> {
|
||||
let rids: HashSet<(String, RepoId)> = self
|
||||
.runs
|
||||
|
||||
@@ -50,6 +50,10 @@ code.repo-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.commit-id-prefix {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.broker-run-id {
|
||||
font-style: monospace;
|
||||
font-size: 80%;
|
||||
|
||||
Reference in New Issue
Block a user