Confirm dialog (#5314): - Every data-confirm form now asks in one native <dialog> (base.html + static/confirm.js) instead of window.confirm. - The question becomes the heading and what follows it the detail; the act's button is named after the form's own button; Cancel has the focus and Esc backs out. Optional data-confirm-title/-detail/-action/-dismiss attributes. - All 27 existing uses work as they are. Cancelling a run says 'Keep running'. Alerts list (#5315): - A verdict line (what is firing, how many rules, where notifications go, or 'notifies nobody yet' with a link) replaces the empty Active card. - Each rule's name opens it; rows show 'last fired' and fold fire/clear into the condition; History and Disable stay; Delete leaves the list. - .docker-verdict becomes the shared .page-verdict. Rule page (#5317): - Named for the rule (title and crumb), with when it last fired and how many changes of state it holds. - Three sections: what it watches, when it fires (checks side by side, seconds echoed as a duration), what happens (where notifications go, no-data, the playbook, whose fields stay folded until ticked). - Delete at the foot, behind the dialog, saying its history goes with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
3.8 KiB
HTML
78 lines
3.8 KiB
HTML
{# 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. A rule's
|
|
name opens it; 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") %}
|
|
<a class="btn btn-ghost" href="/alerts/history">History</a>
|
|
<a class="btn btn-ghost" href="/alerts/maintenance">Maintenance</a>
|
|
{% if can_edit %}<a class="btn" href="/alerts/rules/new">New rule</a>{% endif %}
|
|
{% endcall %}
|
|
|
|
{# The verdict and Active section re-read themselves, so an alert that clears
|
|
or starts shows without a reload. #}
|
|
<div id="alerts-active" hx-get="/alerts/active" hx-trigger="every {{ poll_interval or 60 }}s" hx-swap="innerHTML">
|
|
{% include "alerts/_active.html" %}
|
|
</div>
|
|
|
|
<h2 class="section-title" style="margin:1.5rem 0 1rem;">Rules</h2>
|
|
{% if rules %}
|
|
<div class="card-flush">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Now</th>
|
|
<th>Fires when</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for rule in rules %}
|
|
{% set fired = (last_fired or {}).get(rule.id) %}
|
|
<tr{% if not rule.enabled %} class="row-off"{% endif %}>
|
|
<td class="cell-name">
|
|
<a href="{{ ('/alerts/rules/' ~ rule.id ~ '/edit') if can_edit else ('/alerts/history?rule=' ~ rule.id) }}" title="{{ rule.name }}">{{ rule.name }}</a>
|
|
<div class="cell-sub">{{ source_label(rule.source_module) }}</div>
|
|
</td>
|
|
<td>
|
|
{%- set now_label = (rule_state or {}).get(rule.id) %}
|
|
{%- if not rule.enabled %}<span class="tone-dim">off</span>
|
|
{%- elif now_label and now_label not in ('inactive', 'resolved') %}{{ status_badge(now_label) }}
|
|
{%- else %}<span class="tone-ok" title="Within its threshold">quiet</span>{% endif -%}
|
|
<div class="cell-sub">{% if fired %}last fired {{ fired|ago }}{% else %}never fired{% endif %}</div>
|
|
</td>
|
|
<td>
|
|
{{ rule.resource_name }} · {{ rule_condition(rule) }}
|
|
<div class="cell-sub">
|
|
{%- 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 -%}
|
|
</div>
|
|
</td>
|
|
<td class="td-actions">
|
|
<a href="/alerts/history?rule={{ rule.id }}" class="btn btn-sm btn-ghost">History</a>
|
|
{% if can_edit %}
|
|
<form method="post" action="/alerts/rules/{{ rule.id }}/toggle" style="display:inline;">{{ csrf_field() }}
|
|
<button type="submit" class="btn btn-sm btn-ghost">
|
|
{% if rule.enabled %}Disable{% else %}Enable{% endif %}
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="card">{{ empty_state("No alert rules yet.", "New rule" if can_edit else none, "/alerts/rules/new" if can_edit else none) }}</div>
|
|
{% endif %}
|
|
{% endblock %}
|