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.

178 lines
6.5 KiB

8 years ago
6 years ago
9 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize static hc_extras %}
  3. {% block title %}My Checks - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <ol class="breadcrumb">
  8. <li><a href="{% url 'hc-checks' check.project.code %}">{{ check.project }}</a></li>
  9. <li>
  10. <a href="{% url 'hc-details' check.code %}">
  11. {{ check.name_then_code }}
  12. </a>
  13. </li>
  14. <li class="active">Log</li>
  15. <li id="format-switcher-container" class="pull-right">
  16. <div id="format-switcher" class="btn-group" data-toggle="buttons">
  17. <label class="btn btn-default btn-xs" data-format="UTC">
  18. <input type="radio" name="date-format" checked>
  19. UTC
  20. </label>
  21. {% if check.kind == "cron" and check.tz != "UTC" %}
  22. <label class="btn btn-default btn-xs" data-format="{{ check.tz }}">
  23. <input type="radio" name="date-format">
  24. {{ check.tz }}
  25. </label>
  26. {% endif %}
  27. <label class="btn btn-default btn-xs active" data-format="local">
  28. <input type="radio" name="date-format">
  29. Browser's time zone
  30. </label>
  31. </div>
  32. </li>
  33. </ol>
  34. {% if events %}
  35. <div class="table-responsive">
  36. <table class="table" id="log">
  37. {% for event in events %}
  38. {% if event.n %}
  39. <tr class="ok" data-dt="{{ event.created.isoformat }}" data-url="{% url 'hc-ping-details' check.code event.n %}">
  40. <td class="n-cell">
  41. <span class="hash">#</span>{{ event.n }}
  42. </td>
  43. <td class="date"></td>
  44. <td class="time"></td>
  45. <td class="text-right">
  46. {% if event.kind == "fail" %}
  47. <span class="label label-danger">Failure</span>
  48. {% elif event.kind == "start" %}
  49. <span class="label label-start">Started</span>
  50. {% elif event.kind == "ign" %}
  51. <span class="label label-ign">Ignored</span>
  52. {% else %}
  53. <span class="label label-success">OK</span>
  54. {% endif %}
  55. </td>
  56. <td class="details">
  57. {% if event.delta %}
  58. <div class="delta">
  59. <span class="icon-timer"></span>
  60. {{ event.delta|hms }}
  61. </div>
  62. {% endif %}
  63. {% if event.scheme == "email" %}
  64. {{ event.ua }}
  65. <span class="ua-body">
  66. {% if event.body %}
  67. - {{ event.body|truncatechars:150 }}
  68. {% endif %}
  69. </span>
  70. {% else %}
  71. {{ event.scheme|upper }}
  72. {{ event.method }}
  73. {% if event.remote_addr %}
  74. from {{ event.remote_addr }}
  75. {% endif %}
  76. <span class="ua-body">
  77. {% if event.ua %}
  78. - {{ event.ua }}
  79. {% endif %}
  80. {% if event.body %}
  81. - {{ event.body|truncatechars:150 }}
  82. {% endif %}
  83. </span>
  84. {% endif %}
  85. </td>
  86. </tr>
  87. {% endif %}
  88. {% if event.check_status %}
  89. <tr class="missing" data-dt="{{ event.created.isoformat }}">
  90. <td class="n-cell">
  91. <span class="icon-missing"></span>
  92. </td>
  93. <td class="date"></td>
  94. <td class="time"></td>
  95. <td class="alert-info" colspan="2">
  96. {% if event.channel.kind == "email" %}
  97. Sent email alert to {{ event.channel.email_value }}
  98. {% elif event.channel.kind == "slack" %}
  99. Sent Slack alert
  100. {% if event.channel.slack_channel %}
  101. to {{ event.channel.slack_channel }}
  102. {% endif %}
  103. {% elif event.channel.kind == "pd" %}
  104. Sent alert to PagerDuty
  105. {% elif event.channel.kind == "pagertree" %}
  106. Sent alert to PagerTree
  107. {% elif event.channel.kind == "pagerteam" %}
  108. Sent alert to Pager Team
  109. {% elif event.channel.kind == "opsgenie" %}
  110. Sent alert to OpsGenie
  111. {% elif event.channel.kind == "hipchat" %}
  112. Sent alert to HipChat
  113. {% elif event.channel.kind == "po" %}
  114. Sent a Pushover notification
  115. {% elif event.channel.kind == "webhook" %}
  116. Called webhook {{ event.channel.url_down }}
  117. {% else %}
  118. Sent alert to {{ event.channel.kind|capfirst }}
  119. {% endif %}
  120. {% if event.error %}
  121. <br />
  122. <strong>Error: {{ event.error }}</strong>
  123. {% endif %}
  124. </td>
  125. </tr>
  126. {% endif %}
  127. {% endfor %}
  128. </table>
  129. {% if show_limit_notice and limit < 1000 %}
  130. <p class="alert alert-info">
  131. <strong>Showing last {{ limit }} pings.</strong>
  132. Want to see more?
  133. <a href="{% url 'hc-pricing' %}">
  134. Upgrade your account!
  135. </a>
  136. </p>
  137. {% endif %}
  138. </div>
  139. {% else %}
  140. <div class="alert alert-info">Log is empty. This check has not received any pings yet.</div>
  141. {% endif %}
  142. </div>
  143. </div>
  144. <div id="ping-details-modal" class="modal">
  145. <div class="modal-dialog">
  146. <div class="modal-content">
  147. <div id="ping-details-body">Loading</div>
  148. <div class="modal-footer">
  149. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. {% endblock %}
  155. {% block scripts %}
  156. {% compress js %}
  157. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  158. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  159. <script src="{% static 'js/moment.min.js' %}"></script>
  160. <script src="{% static 'js/moment-timezone-with-data-10-year-range.min.js' %}"></script>
  161. <script src="{% static 'js/log.js' %}"></script>
  162. {% endcompress %}
  163. {% endblock %}