Files
bvandeusenandClaude Opus 5.5 22090b02d8
CI / lint (push) Successful in 3s
CI / integration (push) Successful in 1m0s
CI / unit (push) Successful in 1m24s
CI / publish (push) Successful in 1m32s
feat(email): each account gets its own email, in its own zone (milestone 495)
Milestone 495 "Email goes to each account, in its own time zone", on the
operator's ruling (System 156): notifications go to each user, times in
their zone, defaults on, toggled per user or per role.

- users.notify_alerts / notify_report (migration 0036): None follows the
  role's default, notify.<kind>.<role> in settings, all on to start.
- mail.pick_recipients: active accounts that want the email and have an
  address mail can reach (an SSO placeholder like name@oidc is skipped and
  flagged), each in its own zone with no UTC beside it, then the Also send
  to addresses in their chosen zone with UTC beside. One copy per address,
  all over one SMTP connection.
- Alerts, the weekly report and the test email (to you, in your zone, plus
  the typed addresses) send that way. The save-time smtp.tz capture is gone.
- Notifications: a role × email table of defaults, who each email reaches
  and who can't be reached, and Also send to with its own zone, which starts
  as the first admin's to open the page.
- Account page: your address and your two switches. Users: an Emailed
  column, and an admin sets an account's switches on its page.
- The Alerts page counts the accounts it emails. zone_select macro and
  formatting.zones_by_region shared by Account and Notifications.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:16:17 -04:00

93 lines
4.6 KiB
HTML

{# steward/templates/settings/reports.html #}
{% extends "base.html" %}
{% from "_macros.html" import crumbs %}
{% block title %}Settings — Reports — Steward{% endblock %}
{% from "settings/_tabs.html" import settings_tabs %}
{% block section_tabs %}{{ settings_tabs("reports") }}{% endblock %}
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Reports", "")]) }}{% endblock %}
{% block content %}
{% if flash %}
<div style="padding:0.75rem 1rem;border-radius:6px;margin-bottom:1.25rem;
background:{% if flash.ok %}var(--green-dim){% else %}var(--red-dim){% endif %};
border:1px solid {% if flash.ok %}var(--green){% else %}var(--red){% endif %};
color:{% if flash.ok %}var(--green){% else %}var(--red){% endif %};
font-size:0.88rem;">
{{ flash.message }}
</div>
{% endif %}
<div style="max-width:560px;">
{# ── Schedule ─────────────────────────────────────────────────────────────── #}
<form method="post" action="/settings/reports/">{{ csrf_field() }}
<div class="card" style="margin-bottom:1.25rem;">
<h2 class="section-title" style="margin-bottom:1.25rem;">Weekly Digest</h2>
<div class="form-group" style="display:flex;align-items:center;gap:0.75rem;">
<input type="checkbox" name="reports.enabled" id="reports-enabled"
{% if settings['reports.enabled'] %}checked{% endif %}>
<label for="reports-enabled" style="margin:0;">Enable weekly email digest</label>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-top:0.5rem;">
<div class="form-group">
<label>Send on day</label>
<select name="reports.schedule_day">
{% for i, day in [(0,"Monday"),(1,"Tuesday"),(2,"Wednesday"),(3,"Thursday"),(4,"Friday"),(5,"Saturday"),(6,"Sunday")] %}
<option value="{{ i }}" {% if shown_day == i %}selected{% endif %}>
{{ day }}
</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label>At hour ({{ tz_label() }})</label>
<select name="reports.schedule_hour">
{% for h in range(24) %}
<option value="{{ h }}" {% if shown_hour == h %}selected{% endif %}>
{{ "%02d:00"|format(h) }}
</option>
{% endfor %}
</select>
</div>
</div>
<p style="font-size:0.78rem;color:var(--text-muted);margin-top:0.25rem;">
It goes to each account that has the weekly report on, in that account's own zone, and to the
Also send to addresses; who that is, and the mail server, are in <a href="/settings/notifications/">Notifications</a>.
{% if last_sent %}Last sent {{ last_sent|when }}.{% endif %}
</p>
<div style="margin-top:1rem;">
<button type="submit" class="btn">Save</button>
</div>
</div>
</form>
{# ── Report contents ─────────────────────────────────────────────────────── #}
<div class="card" style="margin-bottom:1.25rem;">
<h2 class="section-title" style="margin-bottom:0.75rem;">Report contents</h2>
<div style="display:grid;gap:0.35rem;font-size:0.85rem;color:var(--text-muted);">
<div>• <strong style="color:var(--text);">Monitors down now</strong> — named at the top, when any are</div>
<div>• <strong style="color:var(--text);">Uptime</strong> — each enabled monitor's share of checks up over 7 days</div>
<div>• <strong style="color:var(--text);">Active alerts</strong> — firing, acknowledged and pending rules</div>
<div>• <strong style="color:var(--text);">Alert events</strong> — how many fired and resolved over 7 days</div>
<div>• <strong style="color:var(--text);">Busiest Traefik routers</strong> — average requests per second over 24 hours, while Traefik is on</div>
</div>
</div>
{# ── Send now ─────────────────────────────────────────────────────────────── #}
<div class="card">
<h2 class="section-title" style="margin-bottom:0.75rem;">Send Now</h2>
<p style="font-size:0.85rem;color:var(--text-muted);margin-bottom:1rem;">
Send a report immediately regardless of schedule. Useful for testing.
</p>
<form method="post" action="/settings/reports/send-now/">{{ csrf_field() }}
<button type="submit" class="btn btn-ghost">Send report now</button>
</form>
</div>
</div>
{% endblock %}