add sbot stats to home template and set inner circle colour accordingly

This commit is contained in:
glyph 2022-01-27 10:55:44 +02:00
parent 00554706cb
commit 8e5c29ca6d
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,4 @@
use peach_stats::sbot;
use rocket::{get, request::FlashMessage, State};
use rocket_dyn_templates::{tera::Context, Template};
@ -8,7 +9,11 @@ use crate::RocketConfig;
#[get("/")]
pub fn home(_auth: Authenticated, config: &State<RocketConfig>) -> Template {
// retrieve go-sbot systemd process stats
let sbot_stats = sbot::sbot_stats().ok();
let mut context = Context::new();
context.insert("sbot_stats", &sbot_stats);
context.insert("flash_name", &None::<()>);
context.insert("flash_msg", &None::<()>);
context.insert("title", &None::<()>);

View File

@ -25,7 +25,7 @@
</a>
<!-- middle -->
<a class="middle">
<div class="circle circle-large"></div>
<div class="circle circle-large {% if sbot_stats.state == "active" %}circle-success{% else %}circle-error{% endif %}"></div>
</a>
<!-- bottom-left -->
<!-- SYSTEM STATUS LINK AND ICON -->