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.

338 lines
12 KiB

6 years ago
6 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize static hc_extras %}
  3. {% block title %}{{ check|down_title }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. {% if is_new %}
  7. <div class="col-sm-12">
  8. <p id="new-check-alert" class="alert alert-success">
  9. <strong>Your new check is ready!</strong>
  10. You can now
  11. <a data-target="edit-name" href="#" >give it a name</a>
  12. or
  13. <a data-target="edit-timeout" href="#" >set its schedule</a>.
  14. </p>
  15. </div>
  16. {% endif %}
  17. {% if is_copied %}
  18. <div class="col-sm-12">
  19. <p id="new-check-alert" class="alert alert-success">
  20. <strong>Copy created!</strong>
  21. This is a brand new check, with details copied over from your existing check.
  22. You might now want to
  23. <a data-target="edit-name" href="#">update its name and tags</a>.
  24. </p>
  25. </div>
  26. {% endif %}
  27. {% if messages %}
  28. <div class="col-sm-12">
  29. {% for message in messages %}
  30. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  31. {% endfor %}
  32. </div>
  33. {% endif %}
  34. <div id="details-head" class="col-sm-12">
  35. <h1>
  36. {{ check.name_then_code }}
  37. {% if rw %}
  38. <small><a id="edit-name" href="#">(edit&hellip;)</a></small>
  39. {% endif %}
  40. </h1>
  41. {% for tag in check.tags_list %}
  42. <span class="label label-tag">{{ tag }}</span>
  43. {% endfor %}
  44. </div>
  45. <div class="col-sm-5">
  46. {% if rw %}
  47. <div class="details-block">
  48. <h2>Description</h2>
  49. {% if check.desc %}
  50. {{ check.desc|linebreaks|urlize }}
  51. <div class="text-right">
  52. <button id="edit-desc" class="btn btn-sm btn-default">
  53. Edit Description&hellip;
  54. </button>
  55. </div>
  56. {% else %}
  57. <small><a id="edit-desc" href="#">Add description&hellip;</a></small>
  58. {% endif %}
  59. </div>
  60. {% elif check.desc %}
  61. <div class="details-block">
  62. <h2>Description</h2>
  63. {{ check.desc|linebreaks|urlize }}
  64. </div>
  65. {% endif %}
  66. <div id="how-to-ping" class="details-block">
  67. <h2>How To Ping</h2>
  68. <div>
  69. <p>
  70. Keep this check up by making HTTP
  71. {% if check.methods == "POST" %}POST{% endif %}
  72. requests to this URL:
  73. </p>
  74. <code>{{ check.url }}</code>
  75. <p>
  76. Or by sending emails to this address:
  77. </p>
  78. <code>{{ check.email }}</code>
  79. <p>You can also explicitly
  80. <a href="{% url 'hc-serve-doc' 'signaling_failures' %}">
  81. signal a failure</a>
  82. and
  83. <a href="{% url 'hc-serve-doc' 'measuring_script_run_time' %}">
  84. measure job execution time</a>.
  85. </p>
  86. </div>
  87. <div class="text-right">
  88. {% if rw %}
  89. <button
  90. data-toggle="modal"
  91. data-target="#filtering-rules-modal"
  92. class="btn btn-sm btn-default">Filtering Rules&hellip;</button>
  93. {% endif %}
  94. <button
  95. data-toggle="modal"
  96. data-target="#show-usage-modal"
  97. class="btn btn-sm btn-default">Usage Examples</button>
  98. <button
  99. data-label="Copy URL"
  100. data-clipboard-text="{{ check.url }}"
  101. class="btn btn-sm btn-default copy-btn">Copy URL</button>
  102. </div>
  103. </div>
  104. <div class="details-block">
  105. <h2>Current Status</h2>
  106. <table>
  107. <tr>
  108. <td>
  109. <span id="log-status-icon" class="status ic-{{ check.get_status }}"></span>
  110. </td>
  111. <td >
  112. <p id="log-status-text">{% include "front/log_status_text.html" %}</p>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td></td>
  117. <td id="downtimes">
  118. {% include "front/details_downtimes.html" %}
  119. </td>
  120. </tr>
  121. </table>
  122. <div class="text-right">
  123. {% if rw %}
  124. <form action="{% url 'hc-pause' check.code %}" method="post">
  125. {% csrf_token %}
  126. <input
  127. id="pause-btn"
  128. type="submit"
  129. {% if check.status == "paused" %}disabled{% endif %}
  130. class="btn btn-sm btn-default" value="Pause" />
  131. </form>
  132. {% endif %}
  133. <button
  134. id="ping-now"
  135. data-url="{{ check.url }}"
  136. class="btn btn-sm btn-default">Ping Now!</button>
  137. </div>
  138. </div>
  139. <div class="details-block">
  140. <h2>Schedule</h2>
  141. <table id="details-schedule">
  142. <tr>
  143. {% if check.kind == "simple" %}
  144. <th>Period</th>
  145. <td>
  146. <span class="value">{{ check.timeout|hc_duration }}</span>
  147. <div class="subtitle">
  148. (Expected time between pings)
  149. </div>
  150. </td>
  151. {% elif check.kind == "cron" %}
  152. <th>Cron Expression</th>
  153. <td>
  154. <span class="value">{{ check.schedule }}</span>
  155. </td>
  156. {% endif %}
  157. </tr>
  158. {% if check.kind == "cron" %}
  159. <tr>
  160. <th>Time Zone</th>
  161. <td>
  162. <span class="value">{{ check.tz }}</span>
  163. </td>
  164. </tr>
  165. {% endif %}
  166. <tr>
  167. <th>Grace Time</th>
  168. <td>
  169. <span class="value">{{ check.grace|hc_duration }}</span>
  170. <div class="subtitle">
  171. (When a check is late, how long to wait until an alert is sent)
  172. </div>
  173. </td>
  174. </tr>
  175. </table>
  176. {% if rw %}
  177. <div class="text-right rw">
  178. <button
  179. id="edit-timeout"
  180. class="btn btn-sm btn-default timeout-grace"
  181. data-code="{{ check.code }}"
  182. data-status-url="{% url 'hc-status-single' check.code %}"
  183. data-kind="{{ check.kind }}"
  184. data-timeout="{{ check.timeout.total_seconds }}"
  185. data-grace="{{ check.grace.total_seconds }}"
  186. data-schedule="{{ check.schedule }}"
  187. data-tz="{{ check.tz }}">
  188. Change Schedule&hellip;</button>
  189. </div>
  190. {% endif %}
  191. </div>
  192. <div class="details-block">
  193. <h2>Notification Methods</h2>
  194. {% if channels %}
  195. <table id="details-integrations" class="table {% if rw %}rw{% endif %}">
  196. {% for channel in channels %}
  197. <tr data-url="{% url 'hc-switch-channel' check.code channel.code %}" {% if channel in enabled_channels %}class="on"{% endif %}>
  198. <th>
  199. <span class="label">
  200. {% if channel in enabled_channels %}ON{% else %}OFF{% endif %}
  201. </span>
  202. </th>
  203. <td>
  204. <span class="ic-{{ channel.kind }}"></span>
  205. {{ channel }}
  206. </td>
  207. </tr>
  208. {% endfor %}
  209. </table>
  210. {% else %}
  211. <div class="alert no-channels">
  212. No notification methods set up yet.
  213. <br />
  214. Set up your preferred methods of notification in the
  215. <a href="{% url 'hc-channels' project.code %}">Integrations</a>
  216. page.
  217. </div>
  218. {% endif %}
  219. </div>
  220. {% if rw %}
  221. <div class="details-block">
  222. <h2>Danger Zone</h2>
  223. <p>Copy, Transfer, or permanently remove this check.</p>
  224. <div class="text-right">
  225. {% if project.num_checks_available > 0 %}
  226. <button
  227. data-toggle="modal"
  228. data-target="#copy-modal"
  229. class="btn btn-sm btn-default">Create a Copy&hellip;</button>
  230. {% endif %}
  231. <button
  232. id="transfer-btn"
  233. data-toggle="modal"
  234. data-target="#transfer-modal"
  235. data-url="{% url 'hc-transfer' check.code %}"
  236. class="btn btn-sm btn-default">
  237. Transfer<span class="hidden-sm hidden-xs"> to Another Project</span>&hellip;
  238. </button>
  239. &nbsp;
  240. <button
  241. id="details-remove-check"
  242. data-toggle="modal"
  243. data-target="#remove-check-modal"
  244. class="btn btn-sm btn-default">Remove</button>
  245. </div>
  246. </div>
  247. {% endif %}
  248. </div>
  249. <div id="events" class="col-sm-7" data-status-url="{% url 'hc-status-single' check.code %}">
  250. <h2>
  251. Log
  252. <small class="hidden-xs">Click on individual items for details</small>
  253. <div id="format-switcher" class="btn-group pull-right" data-toggle="buttons">
  254. <label class="btn btn-default btn-xs" data-format="UTC">
  255. <input type="radio" name="date-format">
  256. UTC
  257. </label>
  258. {% if check.kind == "cron" and check.tz != "UTC" %}
  259. <label class="btn btn-default btn-xs" data-format="{{ check.tz }}">
  260. <input type="radio" name="date-format">
  261. {{ check.tz }}
  262. </label>
  263. {% endif %}
  264. <label class="btn btn-default btn-xs active" data-format="local">
  265. <input type="radio" name="date-format">
  266. Browser's time zone
  267. </label>
  268. </div>
  269. </h2>
  270. <div id="log-container"></div>
  271. </div>
  272. </div>
  273. <div id="ping-details-modal" class="modal">
  274. <div class="modal-dialog">
  275. <div class="modal-content">
  276. <div id="ping-details-body">Loading</div>
  277. <div class="modal-footer">
  278. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  279. </div>
  280. </div>
  281. </div>
  282. </div>
  283. <div id="transfer-modal" class="modal"></div>
  284. <form id="resume-form" action="{% url 'hc-resume' check.code %}" method="post">
  285. {% csrf_token %}
  286. </form>
  287. {% include "front/update_name_modal.html" %}
  288. {% include "front/update_timeout_modal.html" %}
  289. {% include "front/show_usage_modal.html" %}
  290. {% include "front/remove_check_modal.html" %}
  291. {% include "front/filtering_rules_modal.html" %}
  292. {% include "front/copy_modal.html" %}
  293. {% endblock %}
  294. {% block scripts %}
  295. {% compress js %}
  296. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  297. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  298. <script src="{% static 'js/selectize.min.js' %}"></script>
  299. <script src="{% static 'js/clipboard.min.js' %}"></script>
  300. <script src="{% static 'js/bootstrap-select.min.js' %}"></script>
  301. <script src="{% static 'js/nouislider.min.js' %}"></script>
  302. <script src="{% static 'js/snippet-copy.js' %}"></script>
  303. <script src="{% static 'js/moment.min.js' %}"></script>
  304. <script src="{% static 'js/moment-timezone-with-data-10-year-range.min.js' %}"></script>
  305. <script src="{% static 'js/purify.min.js' %}"></script>
  306. <script src="{% static 'js/update-timeout-modal.js' %}"></script>
  307. <script src="{% static 'js/adaptive-setinterval.js' %}"></script>
  308. <script src="{% static 'js/details.js' %}"></script>
  309. {% endcompress %}
  310. {% endblock %}