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.

87 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. {% if not forloop.last %}
  11. <td style="padding: 32px 8px 8px 8px; margin: 0; font-size: 12px; color: #9BA2AB; font-family: Helvetica, Arial, sans-serif;">
  12. {{ dt|date:"N Y"}}
  13. </td>
  14. {% endif %}
  15. {% endfor %}
  16. </tr>
  17. {% for check in group.list|sortchecks:sort %}
  18. <tr>
  19. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px;">
  20. <table cellpadding="0" cellspacing="0">
  21. <tr>
  22. {% with check.get_status_with_started as status %}
  23. {% if status == "new" %}
  24. <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>
  25. {% elif status == "paused" %}
  26. <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>
  27. {% elif status == "grace" %}
  28. <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>
  29. {% elif status == "up" %}
  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;">UP</td>
  31. {% elif status == "started" %}
  32. <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>
  33. {% elif status == "down" %}
  34. <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>
  35. {% endif %}
  36. {% endwith %}
  37. </tr>
  38. </table>
  39. </td>
  40. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif;">
  41. {% if check.name %}
  42. {% if check.name|length > 20 %}
  43. <small>{{ check.name|mangle_link }}</small>
  44. {% else %}
  45. {{ check.name|mangle_link }}
  46. {% endif %}
  47. {% else %}
  48. <span style="color: #74787E; font-style: italic;">unnamed</span>
  49. {% endif %}
  50. {% if check.tags %}
  51. <br />
  52. <table cellpadding="0" cellspacing="0">
  53. <tr>
  54. {% for tag in check.tags_list %}
  55. <td style="padding-right: 4px">
  56. <table cellpadding="0" cellspacing="0">
  57. <tr>
  58. <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;">
  59. {{ tag|mangle_link }}
  60. </td>
  61. </tr>
  62. </table>
  63. </td>
  64. {% endfor %}
  65. </tr>
  66. </table>
  67. {% endif %}
  68. </td>
  69. {% for boundary, seconds, count in check.downtimes %}
  70. {% if not forloop.last %}
  71. {% if count %}
  72. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif;">
  73. {{ count }} downtime{{ count|pluralize }},
  74. <br />
  75. {{ seconds|hc_approx_duration }} total
  76. </td>
  77. {% else %}
  78. <td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif; color: #9BA2AB;">
  79. All good!
  80. </td>
  81. {% endif %}
  82. {% endif %}
  83. {% endfor %}
  84. </tr>
  85. {% endfor %}
  86. {% endfor %}
  87. </table>
  88. <br />