portal: add alarms to home page

This commit is contained in:
Iain Learmonth 2022-05-12 14:48:33 +01:00
parent 1c505ea41d
commit 35fed09205
2 changed files with 20 additions and 10 deletions

View file

@ -51,8 +51,12 @@ def portal_home():
last24 = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=1))).all())
last72 = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=3))).all())
lastweek = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=7))).all())
alarms = {
s: len(Alarm.query.filter(Alarm.alarm_state == s.upper(), Alarm.last_updated > (now - timedelta(days=1))).all())
for s in ["critical", "warning", "ok", "unknown"]
}
return render_template("home.html.j2", section="home", groups=groups, last24=last24, last72=last72,
lastweek=lastweek, proxies=proxies)
lastweek=lastweek, proxies=proxies, **alarms)
@portal.route("/search")