{% 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') %} {% call page_header("Alerts", "What is breaching now, in a sentence each, then every rule.") %} History Maintenance {% if can_edit %}New rule{% endif %} {% endcall %} {# The Active section re-reads itself, so an alert that clears or starts shows without a reload. #}
{% include "alerts/_active.html" %}

Rules

{% if rules %}
{% for rule in rules %} {% endfor %}
Name Now Condition Fire / clear
{{ rule.name }} {% if not rule.enabled %} disabled {% endif %} {%- 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 -%} {{ rule.resource_name }} {{ rule_condition(rule) }}
{{ source_label(rule.source_module) }}
{{ rule.consecutive_failures_required }} / {{ rule.consecutive_ok_required }} History {% if can_edit %} Edit
{{ csrf_field() }}
{% endif %} {% if session.user_role == 'admin' %}
{{ 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 %}