#5335 "Emails Steward sends read as designed messages: an HTML alert email and weekly report, with a plain-text twin". - core/mail.py renders each email as multipart/alternative from templates/email/: a table-and-inline-style HTML part and a plain-text twin carrying the same facts. Colours are the design system's light theme, resolved from theme.css; nothing is fetched when a mail opens. - Alert email: state badge, a headline sentence ("Disk used on web01 is 94%."), rule, resource, reading, the condition in words, and the time in the zone Notifications was saved in with UTC beside it; "View in Steward" when Steward's address is set. Subject "[Steward] Firing: <rule> — <resource> 94%". Alerts now carry their operator. - Weekly report: monitors down, active alerts, the week's alert events, uptime and busiest Traefik routers as small tables with links. Sent from the configured From address; the "Generated … UTC" line and the stale repo footer are gone. - condition_text() states a condition from a rule's parts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
2.0 KiB
HTML
45 lines
2.0 KiB
HTML
{# Pieces the email HTML parts share; import "with context" so c is there. #}
|
|
|
|
{% macro badge(tone, text) -%}
|
|
<span style="display:inline-block;padding:2px 10px;border:1px solid {{ c[tone] }};border-radius:9999px;font:600 12px/1.6 {{ c.font }};color:{{ c[tone] }};">{{ text }}</span>
|
|
{%- endmacro %}
|
|
|
|
{% macro button(href, text) -%}
|
|
<table role="presentation" cellpadding="0" cellspacing="0" border="0"><tr>
|
|
<td style="border-radius:8px;background:{{ c.action }};">
|
|
<a href="{{ href }}" style="display:inline-block;padding:10px 18px;font:600 14px/1.2 {{ c.font }};color:{{ c.on_action }};text-decoration:none;border-radius:8px;">{{ text }}</a>
|
|
</td></tr></table>
|
|
{%- endmacro %}
|
|
|
|
{% macro fact(label, value) -%}
|
|
<tr>
|
|
<td valign="top" style="padding:6px 16px 6px 0;width:110px;font:13px/1.5 {{ c.font }};color:{{ c.muted }};">{{ label }}</td>
|
|
<td valign="top" style="padding:6px 0;font:14px/1.5 {{ c.font }};color:{{ c.text }};">{{ caller() if caller else value }}</td>
|
|
</tr>
|
|
{%- endmacro %}
|
|
|
|
{% macro section(title, href="", more="") -%}
|
|
<tr><td style="padding:20px 24px 6px 24px;">
|
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
|
|
<td style="font:600 15px/1.4 {{ c.font }};color:{{ c.text }};">{{ title }}</td>
|
|
{% if href %}<td align="right" style="font:13px/1.4 {{ c.font }};"><a href="{{ href }}" style="color:{{ c.action }};">{{ more or "Open in Steward" }}</a></td>{% endif %}
|
|
</tr></table>
|
|
</td></tr>
|
|
{%- endmacro %}
|
|
|
|
{% macro rows() -%}
|
|
<tr><td style="padding:0 24px;">
|
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="border-top:1px solid {{ c.border }};">
|
|
{{ caller() }}
|
|
</table>
|
|
</td></tr>
|
|
{%- endmacro %}
|
|
|
|
{% macro row(cells, last_right=True) -%}
|
|
<tr>
|
|
{% for cell in cells %}
|
|
<td valign="top" {% if last_right and loop.last and not loop.first %}align="right" {% endif %}style="padding:7px {{ '0' if loop.last else '12px' }} 7px 0;border-bottom:1px solid {{ c.border }};font:14px/1.45 {{ c.font }};color:{{ c.text }};">{{ cell }}</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{%- endmacro %}
|