diff options
Diffstat (limited to 'src/web.rs')
-rw-r--r-- | src/web.rs | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -14,7 +14,11 @@ pub async fn make_html_page(config: Arc<Config>) -> String { let css = include_str!("style.css"); #[cfg(debug_assertions)] let css = tokio::fs::read_to_string("src/style.css").await.unwrap(); - + + + let total_err = status.values().map(|s|s.status.is_err() as usize).sum::<usize>(); + let total_ok = status.values().map(|s|s.status.is_ok() as usize).sum::<usize>(); + markup::new! { @doctype() html { @@ -27,6 +31,13 @@ pub async fn make_html_page(config: Arc<Config>) -> String { body { main { h1 { @config.title } + @if total_err == 0 { + div.summary.ok { "All services operational." } + } else if total_ok == 0 { + div.summary.error { "All services are broken." } + } else { + div.summary.degraded { "Degraded service. (" @total_ok " working, " @total_err " broken)" } + } @for (i, service) in config.services.iter().enumerate() { @ServiceCard { i, status, service } } |