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.

384 lines
14 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>
  68. How To Ping
  69. {% if rw %}
  70. <div class="btn-group pull-right">
  71. <a href="?urls=uuid" class="btn btn-default btn-xs {% if not project.show_slugs %}active{% endif %}">uuid</a>
  72. <a href="?urls=slug" class="btn btn-default btn-xs {% if project.show_slugs %}active{% endif %}">slug</a>
  73. </div>
  74. {% endif %}
  75. </h2>
  76. <div>
  77. <p>
  78. Keep this check up by making HTTP
  79. {% if check.methods == "POST" %}POST{% endif %}
  80. requests to this URL:
  81. </p>
  82. {% if check.url %}
  83. <code>{{ check.url }}</code>
  84. {% else %}
  85. <code>(unavailable, set name first)</code>
  86. {% endif %}
  87. <p>Ping by sending email:</p>
  88. <code>{{ check.email }}</code>
  89. <p>You can also explicitly
  90. <a href="{% url 'hc-serve-doc' 'signaling_failures' %}">
  91. signal a failure</a>
  92. and
  93. <a href="{% url 'hc-serve-doc' 'measuring_script_run_time' %}">
  94. measure job execution time</a>.
  95. </p>
  96. </div>
  97. <div class="text-right">
  98. {% if rw %}
  99. <button
  100. data-toggle="modal"
  101. data-target="#filtering-rules-modal"
  102. class="btn btn-sm btn-default">Filtering Rules&hellip;</button>
  103. {% endif %}
  104. {% if check.url %}
  105. <button
  106. data-toggle="modal"
  107. data-target="#show-usage-modal"
  108. class="btn btn-sm btn-default">Usage Examples</button>
  109. <button
  110. data-label="Copy URL"
  111. data-clipboard-text="{{ check.url }}"
  112. class="btn btn-sm btn-default copy-btn">Copy URL</button>
  113. {% endif %}
  114. </div>
  115. </div>
  116. <div class="details-block">
  117. <h2>Current Status</h2>
  118. <table>
  119. <tr>
  120. <td>
  121. <span id="log-status-icon" class="status ic-{{ check.get_status }}"></span>
  122. </td>
  123. <td >
  124. <p id="log-status-text">{% include "front/log_status_text.html" %}</p>
  125. </td>
  126. </tr>
  127. <tr>
  128. <td></td>
  129. <td id="downtimes">
  130. {% include "front/details_downtimes.html" %}
  131. </td>
  132. </tr>
  133. </table>
  134. <div class="text-right">
  135. {% if rw %}
  136. <form action="{% url 'hc-pause' check.code %}" method="post">
  137. {% csrf_token %}
  138. <input
  139. id="pause-btn"
  140. type="submit"
  141. {% if check.status == "paused" %}disabled{% endif %}
  142. class="btn btn-sm btn-default" value="Pause" />
  143. </form>
  144. {% endif %}
  145. {% if check.url %}
  146. {% if project.show_slugs and not project.ping_key %}
  147. {% if rw %}
  148. <button
  149. data-toggle="modal"
  150. data-target="#no-ping-key-modal"
  151. class="btn btn-sm btn-default">Ping Now!</button>
  152. {% endif %}
  153. {% else %}
  154. <button
  155. id="ping-now"
  156. data-url="{{ check.url }}"
  157. class="btn btn-sm btn-default">Ping Now!</button>
  158. {% endif %}
  159. {% endif %}
  160. </div>
  161. </div>
  162. <div class="details-block">
  163. <h2>Schedule</h2>
  164. <table id="details-schedule">
  165. <tr>
  166. {% if check.kind == "simple" %}
  167. <th>Period</th>
  168. <td>
  169. <span class="value">{{ check.timeout|hc_duration }}</span>
  170. <div class="subtitle">
  171. (The expected time between pings)
  172. </div>
  173. </td>
  174. {% elif check.kind == "cron" %}
  175. <th>Cron Expression</th>
  176. <td>
  177. <span class="value">{{ check.schedule }}</span>
  178. </td>
  179. {% endif %}
  180. </tr>
  181. {% if check.kind == "cron" %}
  182. <tr>
  183. <th>Time Zone</th>
  184. <td>
  185. <span class="value">{{ check.tz }}</span>
  186. </td>
  187. </tr>
  188. {% endif %}
  189. <tr>
  190. <th>Grace Time</th>
  191. <td>
  192. <span class="value">{{ check.grace|hc_duration }}</span>
  193. <div class="subtitle">
  194. (When a check is late, how long to wait to send an alert)
  195. </div>
  196. </td>
  197. </tr>
  198. </table>
  199. {% if rw %}
  200. <div class="text-right rw">
  201. <button
  202. id="edit-timeout"
  203. class="btn btn-sm btn-default timeout-grace"
  204. data-code="{{ check.code }}"
  205. data-status-url="{% url 'hc-status-single' check.code %}"
  206. data-kind="{{ check.kind }}"
  207. data-timeout="{{ check.timeout.total_seconds }}"
  208. data-grace="{{ check.grace.total_seconds }}"
  209. data-schedule="{{ check.schedule }}"
  210. data-tz="{{ check.tz }}">
  211. Change Schedule&hellip;</button>
  212. </div>
  213. {% endif %}
  214. </div>
  215. <div class="details-block">
  216. <h2>Notification Methods</h2>
  217. {% if channels %}
  218. <table id="details-integrations" class="table {% if rw %}rw{% endif %}">
  219. {% for channel in channels %}
  220. <tr data-url="{% url 'hc-switch-channel' check.code channel.code %}" {% if channel in enabled_channels %}class="on"{% endif %}>
  221. <th>
  222. <span class="label">
  223. {% if channel in enabled_channels %}ON{% else %}OFF{% endif %}
  224. </span>
  225. </th>
  226. <td>
  227. <span class="ic-{{ channel.kind }}"></span>
  228. {{ channel }}
  229. </td>
  230. </tr>
  231. {% endfor %}
  232. </table>
  233. {% else %}
  234. <div class="alert no-channels">
  235. No notification methods set up yet.
  236. <br />
  237. Set up your preferred methods of notification in the
  238. <a href="{% url 'hc-channels' project.code %}">Integrations</a>
  239. page.
  240. </div>
  241. {% endif %}
  242. </div>
  243. {% if rw %}
  244. <div class="details-block">
  245. <h2>Danger Zone</h2>
  246. <p>Copy, transfer, or permanently remove this check.</p>
  247. <div class="text-right">
  248. {% if project.num_checks_available > 0 %}
  249. <button
  250. data-toggle="modal"
  251. data-target="#copy-modal"
  252. class="btn btn-sm btn-default">Create a Copy&hellip;</button>
  253. {% endif %}
  254. <button
  255. id="transfer-btn"
  256. data-toggle="modal"
  257. data-target="#transfer-modal"
  258. data-url="{% url 'hc-transfer' check.code %}"
  259. class="btn btn-sm btn-default">
  260. Transfer<span class="hidden-sm hidden-xs"> to Another Project</span>&hellip;
  261. </button>
  262. &nbsp;
  263. <button
  264. id="details-remove-check"
  265. data-toggle="modal"
  266. data-target="#remove-check-modal"
  267. class="btn btn-sm btn-default">Remove</button>
  268. </div>
  269. </div>
  270. {% endif %}
  271. </div>
  272. <div id="events" class="col-sm-7" data-status-url="{% url 'hc-status-single' check.code %}">
  273. <h2>
  274. Log
  275. <small class="hidden-xs">Click on individual items for details</small>
  276. <div id="format-switcher" class="btn-group pull-right" data-toggle="buttons">
  277. <label class="btn btn-default btn-xs" data-format="UTC">
  278. <input type="radio" name="date-format">
  279. UTC
  280. </label>
  281. {% if check.kind == "cron" and check.tz != "UTC" %}
  282. <label class="btn btn-default btn-xs" data-format="{{ check.tz }}">
  283. <input type="radio" name="date-format">
  284. {{ check.tz }}
  285. </label>
  286. {% endif %}
  287. <label class="btn btn-default btn-xs active" data-format="local">
  288. <input type="radio" name="date-format">
  289. Browser's time zone
  290. </label>
  291. </div>
  292. </h2>
  293. <div id="log-container"></div>
  294. </div>
  295. </div>
  296. <div id="ping-details-modal" class="modal">
  297. <div class="modal-dialog">
  298. <div class="modal-content">
  299. <div id="ping-details-body">Loading</div>
  300. <div class="modal-footer">
  301. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  302. </div>
  303. </div>
  304. </div>
  305. </div>
  306. <div id="transfer-modal" class="modal"></div>
  307. <form id="resume-form" action="{% url 'hc-resume' check.code %}" method="post">
  308. {% csrf_token %}
  309. </form>
  310. {% include "front/update_name_modal.html" %}
  311. {% include "front/update_timeout_modal.html" %}
  312. {% include "front/show_usage_modal.html" %}
  313. {% include "front/remove_check_modal.html" %}
  314. {% include "front/filtering_rules_modal.html" %}
  315. {% include "front/copy_modal.html" %}
  316. {% if rw and project.show_slugs and not project.ping_key %}
  317. <div id="no-ping-key-modal" class="modal">
  318. <div class="modal-dialog">
  319. <div class="modal-content">
  320. <div class="modal-header">
  321. <button type="button" class="close" data-dismiss="modal">&times;</button>
  322. <h4>Ping Key Required</h4>
  323. </div>
  324. <div class="modal-body">
  325. <p>This project does not yet have a ping key.<br />
  326. To ping this check, please generate the
  327. ping key first.
  328. </p>
  329. </div>
  330. <div class="modal-footer">
  331. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  332. <a href="{% url 'hc-project-settings' project.code %}" class="btn btn-primary">Open Project Settings</a>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. {% endif %}
  338. {% endblock %}
  339. {% block scripts %}
  340. {% compress js %}
  341. <script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
  342. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  343. <script src="{% static 'js/selectize.min.js' %}"></script>
  344. <script src="{% static 'js/clipboard.min.js' %}"></script>
  345. <script src="{% static 'js/bootstrap-select.min.js' %}"></script>
  346. <script src="{% static 'js/nouislider.min.js' %}"></script>
  347. <script src="{% static 'js/snippet-copy.js' %}"></script>
  348. <script src="{% static 'js/moment.min.js' %}"></script>
  349. <script src="{% static 'js/moment-timezone-with-data-10-year-range.min.js' %}"></script>
  350. <script src="{% static 'js/purify.min.js' %}"></script>
  351. <script src="{% static 'js/update-timeout-modal.js' %}"></script>
  352. <script src="{% static 'js/adaptive-setinterval.js' %}"></script>
  353. <script src="{% static 'js/details.js' %}"></script>
  354. {% endcompress %}
  355. {% endblock %}