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.

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