feat(monitors): Monitors absorbs the Status page; Status is removed (#5270)
Status repeated the Monitors page's counts, check strip and uptime. Monitors now has one header row and every column Status had: the last 30 checks, latest response with its trend, uptime over 24h / 7d / 30d (the range picker goes) and TLS days on every row. /status and /status/rows and the nav link are removed outright; the dashboard Overview (/status/widget) stays and its Details link goes to Monitors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,14 +3,12 @@
|
||||
{% block title %}Monitors — Steward{% endblock %}
|
||||
{% block content %}
|
||||
{% call page_header("Monitors", "Checked every " ~ poll_interval ~ "s. Problems first.") %}
|
||||
{% include "_time_range.html" %}
|
||||
{% if session.user_role in ['operator', 'admin'] %}<a class="btn btn-sm" href="/monitors/new">Add monitor</a>{% endif %}
|
||||
{% endcall %}
|
||||
|
||||
<div id="monitor-rows"
|
||||
hx-get="/monitors/rows"
|
||||
hx-trigger="load, every {{ poll_interval }}s, rangeChange from:body"
|
||||
hx-include="#time-range"
|
||||
hx-trigger="load, every {{ poll_interval }}s"
|
||||
hx-swap="innerHTML">
|
||||
<div class="card"><p class="field-hint">Loading…</p></div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{# HTMX fragment — the Monitors list: counts, then every monitor, problems first
|
||||
(service.problems_first). Colours come from Settings → Thresholds. #}
|
||||
(service.problems_first), under one header: the last 30 checks, latest
|
||||
response with its trend, uptime over 24h / 7d / 30d and TLS days. This is
|
||||
the one home for monitor state; the Status page it replaced is gone (#5270).
|
||||
Colours come from Settings → Thresholds. #}
|
||||
{% from "_macros.html" import stat_tile, status_badge, status_dot, icon_button, empty_state %}
|
||||
<div class="stat-strip">
|
||||
{{ stat_tile("Down", counts.down, state="down" if counts.down else "inactive") }}
|
||||
@@ -10,13 +13,21 @@
|
||||
</div>
|
||||
|
||||
{% if monitor_data %}
|
||||
<div class="card ping-card">
|
||||
{% set can_edit = session.user_role in ['operator', 'admin'] %}
|
||||
<div class="card ping-card">
|
||||
<div class="ping-row mon-head" aria-hidden="true">
|
||||
<span class="ping-meta mon-col-name">Monitor</span>
|
||||
<span class="ping-pills">Last 30 checks</span>
|
||||
<span class="mon-latest">Latest</span>
|
||||
<span class="mon-up">24h</span><span class="mon-up">7d</span><span class="mon-up">30d</span>
|
||||
<span class="mon-tls">TLS</span>
|
||||
{% if can_edit %}<span class="mon-act"></span>{% endif %}
|
||||
</div>
|
||||
{% for d in monitor_data %}
|
||||
{% set m = d.monitor %}
|
||||
{% set latest = d.latest %}
|
||||
<div class="ping-row{% if d.state == 'paused' %} ping-row-paused{% endif %}">
|
||||
<div class="ping-meta" style="min-width:160px;max-width:260px;">
|
||||
<div class="ping-meta mon-col-name">
|
||||
<div style="display:flex;align-items:baseline;gap:0.4rem;">
|
||||
{{ status_dot(d.state) }}
|
||||
<a class="ping-name" href="/monitors/{{ m.id }}">{{ m.name }}</a>
|
||||
@@ -34,28 +45,27 @@
|
||||
{% for h in d.heartbeat %}<span class="pill pill-{{ h.state }}" title="{{ h.title }}"></span>{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="ping-cur">
|
||||
<div class="mon-latest">
|
||||
{% if d.state in ('down', 'paused', 'pending') %}{{ status_badge(d.state) }}
|
||||
{% elif latest.response_ms is not none %}
|
||||
{% if d.spark %}<span class="mon-spark" title="Response time over the last 30 checks">{{ d.spark|safe }}</span>{% endif %}
|
||||
<span class="tone-{{ status_class(latest.response_ms, 'latency') }}">{{ "%.0f"|format(latest.response_ms) }} ms</span>
|
||||
{% elif m.type == 'dns' and latest.resolved_ip %}<span class="tone-ok">{{ latest.resolved_ip }}</span>
|
||||
{% else %}{{ status_badge('up') }}{% endif %}
|
||||
</div>
|
||||
|
||||
<div style="min-width:4.5rem;text-align:right;font-size:0.78rem;font-variant-numeric:tabular-nums;">
|
||||
{% if d.uptime_pct is not none %}<span class="tone-{{ status_class(d.uptime_pct, 'uptime') }}">{{ "%.1f"|format(d.uptime_pct) }}%</span>{% else %}<span class="tone-unknown">—</span>{% endif %}
|
||||
<span class="tone-dim" style="font-size:0.7rem;margin-left:0.15rem;">{{ range_key }}</span>
|
||||
</div>
|
||||
{% for k in ("24h", "7d", "30d") %}{% set u = d.uptime.get(k) %}
|
||||
<div class="mon-up">{% if u is none %}<span class="tone-unknown">—</span>{% else %}<span class="tone-{{ status_class(u, 'uptime') }}">{{ "%.2f"|format(u) }}%</span>{% endif %}</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if d.tls_days is not none %}
|
||||
<div style="min-width:4rem;text-align:right;font-size:0.72rem;">
|
||||
{% if d.tls_days < 0 %}<span class="tone-crit" title="Certificate expired">cert expired</span>
|
||||
{% else %}<span class="tone-{{ status_class(d.tls_days, 'tls_days') }}" title="TLS certificate expires in {{ d.tls_days|round|int }} days">cert {{ d.tls_days|round|int }}d</span>{% endif %}
|
||||
<div class="mon-tls">
|
||||
{% if d.tls_days is none %}<span class="tone-unknown">—</span>
|
||||
{% elif d.tls_days < 0 %}<span class="tone-crit" title="Certificate expired">expired</span>
|
||||
{% else %}<span class="tone-{{ status_class(d.tls_days, 'tls_days') }}" title="TLS certificate expires in {{ d.tls_days|round|int }} days">{{ d.tls_days|round|int }}d</span>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if can_edit %}
|
||||
<div class="row-actions">
|
||||
<div class="row-actions mon-act">
|
||||
{{ icon_button("✎", "Edit " ~ m.name, href="/monitors/" ~ m.id ~ "/edit") }}
|
||||
<form method="post" action="/monitors/{{ m.id }}/toggle">{{ csrf_field() }}
|
||||
{{ icon_button("⏸" if m.enabled else "▶", ("Pause " if m.enabled else "Resume ") ~ m.name, type="submit") }}
|
||||
@@ -68,6 +78,7 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p class="field-hint" style="margin-top:0.6rem;">Last 30 checks: newest on the right; hover one for its result. Uptime is over the rolling window. TLS is days until the certificate expires (HTTPS monitors).</p>
|
||||
{% else %}
|
||||
<div class="card">{{ empty_state("No monitors yet. Add one, or attach checks to a host from its page.",
|
||||
"Add monitor" if session.user_role in ['operator', 'admin'] else none, "/monitors/new") }}</div>
|
||||
|
||||
Reference in New Issue
Block a user