diff options
author | Lars Wirzenius <liw@liw.fi> | 2024-01-10 18:20:04 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2024-01-10 18:20:04 +0200 |
commit | 30e297a725594983ca3632f284f783f704915b3c (patch) | |
tree | 47256b72b7b542dcb6169a3a467c0a7cd1ca971d | |
parent | ed2678e2bbcbecd88204f509aa376428758ce7a8 (diff) | |
download | radicle-native-ci-30e297a725594983ca3632f284f783f704915b3c.tar.gz |
feat: add a "last update" time stamp to the report page
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rw-r--r-- | src/report.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/report.rs b/src/report.rs index 5ab7d4c..7b970df 100644 --- a/src/report.rs +++ b/src/report.rs @@ -5,6 +5,7 @@ use std::{ use html_page::{Document, Element, Tag}; use radicle_ci_broker::msg::RunResult; +use time::{macros::format_description, OffsetDateTime}; use walkdir::WalkDir; use crate::{logfile::LogFile, runinfo::RunInfo}; @@ -115,6 +116,14 @@ fn list_runs(repos: &[&str], run_infos: &[RunInfo]) -> Document { doc.push_to_body(&list); } + let fmt = format_description!( + "[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour]:[offset_minute]" + ); + let now = OffsetDateTime::now_utc().format(fmt).expect("time format"); + + let timestamp = Element::new(Tag::Div).with_text(&format!("Last updated {}.", now)); + doc.push_to_body(×tamp); + doc } |