{% extends "base.html" %} {% from "_macros.html" import crumbs, page_header, status_badge, empty_state %} {% block title %}Maintenance Windows — Steward{% endblock %} {% block breadcrumb %}{{ crumbs([("Alerts", "/alerts/"), ("Maintenance", "")]) }}{% endblock %} {% block content %} {% set can_edit = session.user_role in ('operator', 'admin') %} {% call page_header("Maintenance windows", "During an active window, alerts in its scope still change state and show on the Alerts page, but send no notifications and run no Ansible actions. Each event a window mutes says so in the alert's history. An alert that is still firing when the window ends notifies then, and runs its action.") %} {% if can_edit %}New window{% endif %} {% endcall %} {% macro window_table(rows, kind) %}
{% for w in rows %} {% endfor %}
Name Scope Start End Status
{{ w.name }} {% if w.scope_source is none %} All alerts {% elif w.scope_resource is none %} Every alert on {{ source_label(w.scope_source) }} {% else %} {{ w.scope_resource }} {{ source_label(w.scope_source) }} {% endif %} {{ w.start_at.strftime("%Y-%m-%d %H:%M") }} UTC {{ w.end_at.strftime("%Y-%m-%d %H:%M") }} UTC {% if kind == 'active' %}{{ status_badge('warn', 'Active') }}
ends {{ w.end_at|ago }}
{% elif kind == 'upcoming' %}{{ status_badge('pending', 'Upcoming') }}
starts {{ w.start_at|ago }}
{% else %}{{ status_badge('inactive', 'Expired') }}
ended {{ w.end_at|ago }}
{% endif %}
{% if session.user_role in ('operator', 'admin') %}
{{ csrf_field() }}
{% endif %}
{% endmacro %} {% if windows %} {% if active %}

Active now

{{ window_table(active, 'active') }} {% endif %} {% if upcoming %}

Upcoming

{{ window_table(upcoming, 'upcoming') }} {% endif %} {% if not active and not upcoming %}
{{ empty_state("No window is active or scheduled. Every alert notifies as usual.") }}
{% endif %} {% if expired %}
Expired ({{ expired|length }}) {{ window_table(expired, 'expired') }}
{% endif %} {% else %}
{% if can_edit %}{{ empty_state("No maintenance windows yet.", "New window", "/alerts/maintenance/new") }}{% else %}{{ empty_state("No maintenance windows yet.") }}{% endif %}
{% endif %} {% endblock %}