diff --git a/app/portal/__init__.py b/app/portal/__init__.py index 6e24a31..18bc1d7 100644 --- a/app/portal/__init__.py +++ b/app/portal/__init__.py @@ -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") diff --git a/app/portal/templates/home.html.j2 b/app/portal/templates/home.html.j2 index 2734428..4f629c9 100644 --- a/app/portal/templates/home.html.j2 +++ b/app/portal/templates/home.html.j2 @@ -28,14 +28,20 @@ -
-
-

More stats

-
-
Future dev goal
-

This is a longer card with supporting text below as a natural lead-in to additional content.

-
+
+
+

Alarms

+
+
Current status
+
    +
  • Critical: {{ critical }}
  • +
  • Warning: {{ warning }}
  • +
  • OK: {{ ok }}
  • +
  • Unknown: {{ unknown }}
  • +
+ View alarms +
+
+
-
- {% endblock %} \ No newline at end of file