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.

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