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.

150 lines
5.2 KiB

9 years ago
8 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' %}">Checks</a></li>
  9. <li>{{ check.name_then_code }}</li>
  10. <li class="active">Log</li>
  11. <li id="format-switcher-container" class="pull-right">
  12. <div id="format-switcher" class="btn-group" data-toggle="buttons">
  13. <label class="btn btn-default btn-xs" data-format="utc">
  14. <input type="radio" name="date-format" checked>
  15. UTC
  16. </label>
  17. <label class="btn btn-default btn-xs active" data-format="local">
  18. <input type="radio" name="date-format">
  19. Local Time
  20. </label>
  21. </div>
  22. </li>
  23. </ol>
  24. {% if events %}
  25. <div class="table-responsive">
  26. <table class="table" id="log">
  27. {% for event in events %}
  28. {% if event.n %}
  29. <tr class="ok" data-dt="{{ event.created.isoformat }}" data-url="{% url 'hc-ping-details' check.code event.n %}">
  30. <td class="n-cell">
  31. <span class="hash">#</span>{{ event.n }}
  32. </td>
  33. <td class="date"></td>
  34. <td class="time"></td>
  35. <td class="details">
  36. <div>
  37. {% if event.scheme == "email" %}
  38. {{ event.ua }}
  39. <span>
  40. {% if event.body %}
  41. - {{ event.body|trunc }}
  42. {% endif %}
  43. </span>
  44. {% else %}
  45. {{ event.scheme|upper }}
  46. {{ event.method }}
  47. {% if event.remote_addr %}
  48. from {{ event.remote_addr }}
  49. {% endif %}
  50. <span>
  51. {% if event.ua %}
  52. - {{ event.ua }}
  53. {% endif %}
  54. {% if event.body %}
  55. - {{ event.body|trunc }}
  56. {% endif %}
  57. </span>
  58. {% endif %}
  59. </div>
  60. </td>
  61. </tr>
  62. {% endif %}
  63. {% if event.check_status %}
  64. <tr class="missing" data-dt="{{ event.created.isoformat }}">
  65. <td class="n-cell">
  66. <span class="icon-missing"></span>
  67. </td>
  68. <td class="date"></td>
  69. <td class="time"></td>
  70. <td class="alert-info">
  71. {% if event.channel.kind == "email" %}
  72. Sent email alert to {{ event.channel.value }}
  73. {% elif event.channel.kind == "slack" %}
  74. Sent Slack alert
  75. {% if event.channel.slack_channel %}
  76. to {{ event.channel.slack_channel }}
  77. {% endif %}
  78. {% elif event.channel.kind == "pd" %}
  79. Sent alert to PagerDuty
  80. {% elif event.channel.kind == "pagertree" %}
  81. Sent alert to PagerTree
  82. {% elif event.channel.kind == "opsgenie" %}
  83. Sent alert to OpsGenie
  84. {% elif event.channel.kind == "hipchat" %}
  85. Sent alert to HipChat
  86. {% elif event.channel.kind == "po" %}
  87. Sent a Pushover notification
  88. {% elif event.channel.kind == "webhook" %}
  89. Called webhook {{ event.channel.url_down }}
  90. {% else %}
  91. Sent alert to {{ event.channel.kind|capfirst }}
  92. {% endif %}
  93. {% if event.error %}
  94. <br />
  95. <strong>Error: {{ event.error }}</strong>
  96. {% endif %}
  97. </td>
  98. </tr>
  99. {% endif %}
  100. {% endfor %}
  101. </table>
  102. {% if show_limit_notice and limit < 1000 %}
  103. <p class="alert alert-info">
  104. <strong>Showing last {{ limit }} pings.</strong>
  105. Want to see more?
  106. <a href="{% url 'hc-pricing' %}">
  107. Upgrade your account!
  108. </a>
  109. </p>
  110. {% endif %}
  111. </div>
  112. {% else %}
  113. <div class="alert alert-info">Log is empty. This check has not received any pings yet.</div>
  114. {% endif %}
  115. </div>
  116. </div>
  117. <div id="ping-details-modal" class="modal">
  118. <div class="modal-dialog">
  119. <div class="modal-content">
  120. <div id="ping-details-body">Loading</div>
  121. <div class="modal-footer">
  122. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  123. </div>
  124. </div>
  125. </div>
  126. <form>
  127. {% csrf_token %}
  128. </form>
  129. </div>
  130. {% endblock %}
  131. {% block scripts %}
  132. {% compress js %}
  133. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  134. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  135. <script src="{% static 'js/moment.min.js' %}"></script>
  136. <script src="{% static 'js/log.js' %}"></script>
  137. {% endcompress %}
  138. {% endblock %}