{# status/rows.html — what is wrong first (down monitors, active alerts), then every monitor; refreshed on poll #} {% from "_macros.html" import status_badge, status_dot, stat_tile, empty_state %} {% macro uptime_cell(pct) -%} {%- if pct is none -%}— {%- else -%}{{ "%.2f"|format(pct) }}%{%- endif -%} {%- endmacro %} {% macro since(e) -%} {%- if e.since -%}{{ "for at least " if e.since_at_least else "since " }}{{ e.since|ago }}{%- endif -%} {%- endmacro %} {# ── What is wrong ───────────────────────────────────────────────────────── #} {% if problems or alerts %}

Needs attention

{% endif %} {# ── Counts ──────────────────────────────────────────────────────────────── #}
{{ stat_tile("Down", down, state="down" if down else "inactive") }} {{ stat_tile("Active alerts", alerts|length, state="firing" if alerts else "inactive", href="/alerts/") }} {{ stat_tile("Pending", pending, state="pending" if pending else "inactive") }} {{ stat_tile("Up", up, state="up") }}
{% if not entries %}
{{ empty_state("No monitors yet. Add a host (ping or DNS) or an HTTP monitor to fill the board.", "Add a monitor", "/monitors/new") }}
{% else %}
{# header row #}
Monitor Recent checks Latest 24h 7d 30d TLS
{% for e in entries %}
{# name + kind #}
{{ status_dot(e.status) }} {% if e.detail_url %}{{ e.name }} {% else %}{{ e.name }}{% endif %}
{{ e.kind }} · {{ e.target }}
{# heartbeat bar #}
{% set pad = 30 - e.heartbeat|length %} {% if pad > 0 %}{% for _ in range(pad) %}{% endfor %}{% endif %} {% for hb in e.heartbeat %} {% endfor %}
{# latest latency + sparkline #}
{% if e.status == 'down' %}{{ status_badge('down') }} {% elif e.latency_ms is not none %} {% if e.spark_svg %}{{ e.spark_svg|safe }}
{% endif %} {{ "%.0f"|format(e.latency_ms) }} ms {% elif e.status == 'up' %}{{ status_badge('up') }} {% else %}—{% endif %}
{# uptime windows #} {{ uptime_cell(e.uptime.get('24h')) }} {{ uptime_cell(e.uptime.get('7d')) }} {{ uptime_cell(e.uptime.get('30d')) }} {# TLS expiry countdown #} {% if e.tls_days is none %}— {% elif e.tls_days < 0 %}expired {% else %}{{ e.tls_days|round|int }}d{% endif %}
{% endfor %}

Heartbeat shows the last 30 checks (newest on the right). Uptime % is over the rolling window. TLS countdown applies to HTTPS monitors.

{% endif %}