You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
4.5 KiB

5 years ago
5 years ago
  1. {% load humanize hc_extras %}
  2. {% regroup checks by project as groups %}
  3. <table style="margin: 0; width: 100%; font-size: 16px;" cellpadding="0" cellspacing="0">
  4. {% for group in groups %}
  5. <tr>
  6. <td colspan="2" style="font-weight: bold; padding: 32px 8px 8px 8px; color: #333;">
  7. {{ group.grouper|mangle_link }}
  8. </td>
  9. {% for dt in month_boundaries %}
  10. <td style="padding: 32px 8px 8px 8px; margin: 0; font-size: 12px; color: #9BA2AB; font-family: Helvetica, Arial, sans-serif;">
  11. {{ dt|date:"N Y"}}
  12. </td>
  13. {% endfor %}
  14. </tr>
  15. {% for check in group.list|sortchecks:sort %}
  16. <tr>
  17. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px;">
  18. <table cellpadding="0" cellspacing="0">
  19. <tr>
  20. {% with check.get_status_with_started as status %}
  21. {% if status == "new" %}
  22. <td style="background: #AAA; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 10px; line-height: 10px; color: white; padding: 6px; margin: 0; border-radius: 3px;">NEW</td>
  23. {% elif status == "paused" %}
  24. <td style="background: #AAA; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 10px; line-height: 10px; color: white; padding: 6px; border-radius: 3px;">PAUSED</td>
  25. {% elif status == "grace" %}
  26. <td style="background: #f0ad4e; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 10px; line-height: 10px; color: white; padding: 6px; border-radius: 3px;">LATE</td>
  27. {% elif status == "up" %}
  28. <td style="background: #5cb85c; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 10px; line-height: 10px; color: white; padding: 6px; border-radius: 3px;">UP</td>
  29. {% elif status == "started" %}
  30. <td style="background: #5cb85c; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 10px; line-height: 10px; color: white; padding: 6px; border-radius: 3px;">STARTED</td>
  31. {% elif status == "down" %}
  32. <td style="background: #d9534f; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 10px; line-height: 10px; color: white; padding: 6px; border-radius: 3px;">DOWN</td>
  33. {% endif %}
  34. {% endwith %}
  35. </tr>
  36. </table>
  37. </td>
  38. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif;">
  39. {% if check.name %}
  40. {{ check.name|mangle_link }}
  41. {% else %}
  42. <span style="color: #74787E; font-style: italic;">unnamed</span>
  43. {% endif %}
  44. {% if check.tags %}
  45. <br />
  46. <table cellpadding="0" cellspacing="0">
  47. <tr>
  48. {% for tag in check.tags_list %}
  49. <td style="padding-right: 4px">
  50. <table cellpadding="0" cellspacing="0">
  51. <tr>
  52. <td style="background: #eee; font-family: Helvetica, Arial, sans-serif; font-size: 10px; line-height: 10px; color: #555; padding: 4px; margin: 0; border-radius: 2px;">
  53. {{ tag|mangle_link }}
  54. </td>
  55. </tr>
  56. </table>
  57. </td>
  58. {% endfor %}
  59. </tr>
  60. </table>
  61. {% endif %}
  62. </td>
  63. {% for boundary, seconds, count in check.downtimes %}
  64. {% if count %}
  65. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif;">
  66. {{ count }}&nbsp;downtime{{ count|pluralize }},
  67. <br />
  68. {{ seconds|hc_approx_duration }} total
  69. </td>
  70. {% else %}
  71. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif; color: #9BA2AB;">
  72. {% if count is None %}
  73. {% comment %} The check didn't exist yet {% endcomment %}
  74. {% else %}
  75. All good!
  76. {% endif %}
  77. </td>
  78. {% endif %}
  79. {% endfor %}
  80. </tr>
  81. {% endfor %}
  82. {% endfor %}
  83. </table>
  84. <br />