{# hosts/uptime_widget.html — dashboard widget: SLA uptime summary #}
{% if not hosts %}
No ping-enabled hosts configured.
{% else %}
Host24h7d30d
{% for host in hosts %}
{% set ut = uptime.get(host.id, {}) %}
{% if session.user_id %}
{{ host.name }}
{% else %}
{{ host.name }}
{% endif %}
{% for window in ["24h", "7d", "30d"] %}
{% set pct = ut.get(window) %}
{% if pct is none %}
—
{% else %}
{# Configurable uptime thresholds (Settings → Thresholds); a normal value
(no degraded style) stays green to read as healthy at a glance. #}
{% set us = threshold_style(pct, 'uptime') %}
{{ "%.1f"|format(pct) }}%
{% endif %}
{% endfor %}