From 36adad5b3bb0817cb58dd3f274e125a87295b5ce Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Fri, 10 Jul 2026 15:20:17 -0400 Subject: [PATCH] feat: dedicated /log page with journal-backed history and nav item Co-Authored-By: Claude Fable 5 --- hbd/server/http.py | 22 ++++ hbd/server/templates/log.html | 224 ++++++++++++++++++++++++++++++++++ hbd/server/templates/nav.html | 1 + 3 files changed, 247 insertions(+) create mode 100644 hbd/server/templates/log.html diff --git a/hbd/server/http.py b/hbd/server/http.py index 2407b2d..c246b7f 100644 --- a/hbd/server/http.py +++ b/hbd/server/http.py @@ -793,6 +793,27 @@ async def start( ) return web.Response(text=body, content_type="text/html") + async def log_page(request): + """Render the event log page.""" + current_user, _ = _require_auth_redirect(request) + pkg_dir = os.path.dirname(__file__) + templates_dir = config.get("templates_dir", os.path.join(pkg_dir, "templates")) + env = jinja2.Environment(loader=jinja2.FileSystemLoader(templates_dir), autoescape=True) + host = request.host # includes port if non-standard + forwarded_proto = request.headers.get("X-Forwarded-Proto", "") + is_secure = request.secure or forwarded_proto.lower() == "https" + scheme = "wss" if is_secure else "ws" + heartbeat_ws_url = f"{scheme}://{host}/ws" + tmpl = env.get_template("log.html") + body = tmpl.render( + title="Log - Heartbeat", + header="Log", + heartbeat_ws_url=heartbeat_ws_url, + current_user=current_user.to_dict() if current_user else None, + active_page="log", + ) + return web.Response(text=body, content_type="text/html") + # ------------------------------------------------------------------------- # Auth endpoints # ------------------------------------------------------------------------- @@ -1836,6 +1857,7 @@ async def start( web.get("/live", live), web.get("/plugins", plugins_page), web.get("/alerts", alerts_page), + web.get("/log", log_page), web.get("/about", about_page), web.get("/profile", profile_page), web.get("/settings", settings_page), diff --git a/hbd/server/templates/log.html b/hbd/server/templates/log.html new file mode 100644 index 0000000..af01b6f --- /dev/null +++ b/hbd/server/templates/log.html @@ -0,0 +1,224 @@ + + + {% include 'head.html' %} + + + + + + + {% include 'nav.html' %} + +
+ hbd·log + connectivity and alert events — full journal history + + + + + connecting… +
+ + +
+
+
+

log:

+ +
+
+
Loading events…
+
+ +
+
+ + + + diff --git a/hbd/server/templates/nav.html b/hbd/server/templates/nav.html index ee78ead..70c938e 100644 --- a/hbd/server/templates/nav.html +++ b/hbd/server/templates/nav.html @@ -6,6 +6,7 @@ Live Dashboard Host Overview Alerts + Log {% if current_user %} Settings {% endif %}