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.

170 lines
6.1 KiB

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