Browse Source
Fix grouping and sorting in the text version of the report/nag emails
Fix grouping and sorting in the text version of the report/nag emails
Fixes: #679pull/680/head
Pēteris Caune
2 years ago
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
5 changed files with 54 additions and 15 deletions
-
1CHANGELOG.md
-
23hc/api/tests/test_sendreports.py
-
17hc/front/templatetags/hc_extras.py
-
7templates/emails/report-body-text.html
-
21templates/emails/summary-text.html
@ -1,14 +1,11 @@ |
|||||
{% load hc_extras %} |
|
||||
Hello, |
|
||||
|
{% load hc_extras %}Hello, |
||||
|
|
||||
{% if nag %}This is a {% if nag_period == 3600 %}hourly {% endif %}{% if nag_period == 86400 %}daily {% endif %}reminder sent by {% site_name %}. |
{% if nag %}This is a {% if nag_period == 3600 %}hourly {% endif %}{% if nag_period == 86400 %}daily {% endif %}reminder sent by {% site_name %}. |
||||
|
|
||||
{% if num_down == 1%}One check is currently DOWN.{% else %}{{ num_down }} checks are currently DOWN.{% endif %}{% else %}This is a {{ monthly_or_weekly }} report sent by {% site_name %}.{% endif %} |
{% if num_down == 1%}One check is currently DOWN.{% else %}{{ num_down }} checks are currently DOWN.{% endif %}{% else %}This is a {{ monthly_or_weekly }} report sent by {% site_name %}.{% endif %} |
||||
|
|
||||
|
|
||||
{% include 'emails/summary-text.html' %} |
{% include 'emails/summary-text.html' %} |
||||
|
|
||||
|
|
||||
-- |
-- |
||||
Cheers, |
Cheers, |
||||
{% site_name %} |
{% site_name %} |
||||
|
|
@ -1,5 +1,18 @@ |
|||||
{% load humanize hc_extras %} |
|
||||
Status | Name | Last Ping |
|
||||
--------+------------------------------------------+-----------------------{% for check in checks %} |
|
||||
{{ check.get_status|ljust:"6" }} | {{ check.name|default:'unnamed'|ljust:"40" }} | {% if check.last_ping %}{{ check.last_ping|naturaltime }}{% else %}Never{% endif %}{% endfor %} |
|
||||
|
{% load humanize hc_extras linemode %}{% linemode %} |
||||
|
{% regroup checks by project as groups %} |
||||
|
|
||||
|
{% for group in groups %} |
||||
|
{% line %}{% endline %} |
||||
|
{% line %}{% endline %} |
||||
|
{% line %}{{ group.grouper|safe }}{% endline %} |
||||
|
{% line %}{{ group.grouper|underline }}{% endline %} |
||||
|
{% line %}{% endline %} |
||||
|
{% line %}Status Name Last Ping{% endline %} |
||||
|
{% line %}------ ---------------------------------------- ----------------------{% endline %} |
||||
|
{% for check in group.list|sortchecks:sort %} |
||||
|
{% with check.get_status as status %} |
||||
|
{% line %}{% if status == "down" %}{{ status|upper|ljust:"6" }}{% else %}{{ status|ljust:"6" }}{% endif %} {{ check.name_then_code|safe|ljust:"40" }} {% if check.last_ping %}{{ check.last_ping|naturaltime }}{% else %}Never{% endif %}{% endline %} |
||||
|
{% endwith %} |
||||
|
{% endfor %} |
||||
|
{% endfor %} |
||||
|
{% endlinemode %} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue