{# alerts/list.html — the Alerts page (#5315): the verdict and what is active (alerts/_active.html, polled), then every rule: what it is doing now and when it last fired, what it fires on, and its History and Disable. The whole row opens the rule (.row-link, its name is the link); deleting one is on its own page, behind the confirm dialog. #} {% extends "base.html" %} {% block title %}Alerts — Steward{% endblock %} {% from "_macros.html" import page_header, status_badge, empty_state %} {% block content %} {% set can_edit = session.user_role in ('operator', 'admin') %} {% set rules_total = rules|length %} {% set rules_off = rules|rejectattr("enabled")|list|length %} {% call page_header("Alerts") %} History Maintenance {% if can_edit %}New rule{% endif %} {% endcall %} {# The verdict and Active section re-read themselves, so an alert that clears or starts shows without a reload. #}
{% include "alerts/_active.html" %}

Rules

{% if rules %}
{% for rule in rules %} {% set fired = (last_fired or {}).get(rule.id) %} {% endfor %}
Name Now Fires when
{{ rule.name }}
{{ source_label(rule.source_module) }}
{%- set now_label = (rule_state or {}).get(rule.id) %} {%- if not rule.enabled %}off {%- elif now_label and now_label not in ('inactive', 'resolved') %}{{ status_badge(now_label) }} {%- else %}quiet{% endif -%}
{% if fired %}last fired {{ fired|ago }}{% else %}never fired{% endif %}
{{ rule.resource_name }} · {{ rule_condition(rule) }}
{%- set n_fire, n_ok = rule.consecutive_failures_required, rule.consecutive_ok_required %} {%- if n_fire > 1 %}after {{ n_fire }} checks in a row{% else %}on the first check{% endif %} {%- if n_ok > 1 %}; clears after {{ n_ok }} good ones{% endif -%}
History {% if can_edit %}
{{ csrf_field() }}
{% endif %}
{% else %}
{{ empty_state("No alert rules yet.", "New rule" if can_edit else none, "/alerts/rules/new" if can_edit else none) }}
{% endif %} {% endblock %}