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.

361 lines
15 KiB

10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. {% extends "base.html" %}
  2. {% load compress 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. <h1>
  8. {% if request.team == request.user.profile %}
  9. My Checks
  10. {% else %}
  11. {{ request.team.team_name }}
  12. {% endif %}
  13. </h1>
  14. </div>
  15. {% if tags %}
  16. <div id="my-checks-tags" class="col-sm-12">
  17. {% for tag, count in tags %}
  18. {% if tag in down_tags %}
  19. <button class="btn btn-danger btn-xs" data-toggle="button">{{ tag }}</button>
  20. {% elif tag in grace_tags %}
  21. <button class="btn btn-warning btn-xs" data-toggle="button">{{ tag }}</button>
  22. {% else %}
  23. <button class="btn btn-default btn-xs" data-toggle="button">{{ tag }}</button>
  24. {% endif %}
  25. {% endfor %}
  26. </div>
  27. {% endif %}
  28. </div>
  29. <div class="row">
  30. <div class="col-sm-12">
  31. {% if checks %}
  32. {% include "front/my_checks_mobile.html" %}
  33. {% include "front/my_checks_desktop.html" %}
  34. {% else %}
  35. <div class="alert alert-info">You don't have any checks yet.</div>
  36. {% endif %}
  37. </div>
  38. </div>
  39. <div class="row">
  40. <div class="col-sm-12">
  41. <form method="post" action="{% url 'hc-add-check' %}" class="text-center">
  42. {% csrf_token %}
  43. <input type="submit" class="btn btn-primary btn-lg" value="Add Check">
  44. </form>
  45. </div>
  46. </div>
  47. <div id="update-name-modal" class="modal">
  48. <div class="modal-dialog">
  49. <form id="update-name-form" class="form-horizontal" method="post">
  50. {% csrf_token %}
  51. <div class="modal-content">
  52. <div class="modal-header">
  53. <button type="button" class="close" data-dismiss="modal">&times;</button>
  54. <h4 class="update-timeout-title">Name and Tags</h4>
  55. </div>
  56. <div class="modal-body">
  57. <div class="form-group">
  58. <label for="update-name-input" class="col-sm-2 control-label">
  59. Name
  60. </label>
  61. <div class="col-sm-9">
  62. <input
  63. id="update-name-input"
  64. name="name"
  65. type="text"
  66. value="---"
  67. placeholder="unnamed"
  68. class="input-name form-control" />
  69. <span class="help-block">
  70. Give this check a human-friendly name,
  71. so you can easily recognize it later.
  72. </span>
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <label for="update-tags-input" class="col-sm-2 control-label">
  77. Tags
  78. </label>
  79. <div class="col-sm-9">
  80. <input
  81. id="update-tags-input"
  82. name="tags"
  83. type="text"
  84. value=""
  85. placeholder="production www"
  86. class="form-control" />
  87. <span class="help-block">
  88. Optionally, assign tags for easy filtering.
  89. Separate multiple tags with spaces.
  90. </span>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="modal-footer">
  95. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  96. <button type="submit" class="btn btn-primary">Save</button>
  97. </div>
  98. </div>
  99. </form>
  100. </div>
  101. </div>
  102. <div id="update-timeout-modal" class="modal">
  103. <div class="modal-dialog">
  104. <div class="modal-content">
  105. <form id="update-timeout-form" method="post">
  106. {% csrf_token %}
  107. <input type="hidden" name="kind" value="simple" />
  108. <input type="hidden" name="timeout" id="update-timeout-timeout" />
  109. <input type="hidden" name="grace" id="update-timeout-grace" />
  110. <div class="modal-body">
  111. <div class="update-timeout-info text-center">
  112. <span
  113. class="update-timeout-label"
  114. data-toggle="tooltip"
  115. title="Expected time between pings.">
  116. Period
  117. </span>
  118. <span
  119. id="period-slider-value"
  120. class="update-timeout-value">
  121. 1 day
  122. </span>
  123. </div>
  124. <div id="period-slider"></div>
  125. <div class="update-timeout-info text-center">
  126. <span
  127. class="update-timeout-label"
  128. data-toggle="tooltip"
  129. title="When check is late, how much time to wait until alert is sent">
  130. Grace Time
  131. </span>
  132. <span
  133. id="grace-slider-value"
  134. class="update-timeout-value">
  135. 1 day
  136. </span>
  137. </div>
  138. <div id="grace-slider"></div>
  139. <div class="update-timeout-terms">
  140. <p>
  141. <span>Period</span>
  142. Expected time between pings.
  143. </p>
  144. <p>
  145. <span>Grace Time</span>
  146. When a check is late, how much time to wait until alert is sent.
  147. </p>
  148. </div>
  149. </div>
  150. <div class="modal-footer">
  151. <div class="btn-group pull-left">
  152. <label class="btn btn-default kind-simple active">Simple</label>
  153. <label class="btn btn-default kind-cron">Cron</label>
  154. </div>
  155. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  156. <button type="submit" class="btn btn-primary">Save</button>
  157. </div>
  158. </form>
  159. <form id="update-cron-form" method="post">
  160. {% csrf_token %}
  161. <input type="hidden" name="kind" value="cron" />
  162. <div class="modal-body">
  163. <div class="row">
  164. <div class="col-md-4">
  165. <div class="form-group">
  166. <label for="schedule">Cron Expression</label>
  167. <input
  168. type="text"
  169. class="form-control"
  170. id="schedule"
  171. name="schedule"
  172. placeholder="* * * * *">
  173. </div>
  174. </div>
  175. <div class="col-md-4">
  176. <div class="form-group">
  177. <label for="tz">Server's Timezone</label>
  178. <br />
  179. <select id="tz" name="tz" class="form-control">
  180. <option>UTC</option>
  181. {% for tz in timezones %}
  182. <option>{{ tz }}</option>{% endfor %}
  183. </select>
  184. </div>
  185. </div>
  186. <div class="col-md-4">
  187. <div class="form-group">
  188. <label for="cron-grace">Grace Time</label>
  189. <div class="input-group">
  190. <input
  191. type="number"
  192. min="1"
  193. max="43200"
  194. class="form-control"
  195. id="update-timeout-grace-cron"
  196. name="grace">
  197. <div class="input-group-addon">minutes</div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="row">
  203. <div class="col-sm-12">
  204. <div id="cron-preview"></div>
  205. </div>
  206. </div>
  207. </div>
  208. <div class="modal-footer">
  209. <div class="btn-group pull-left">
  210. <label class="btn btn-default kind-simple">Simple</label>
  211. <label class="btn btn-default active kind-cron">Cron</label>
  212. </div>
  213. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  214. <button id="update-cron-submit" type="submit" class="btn btn-primary">
  215. Save
  216. </button>
  217. </div>
  218. </form>
  219. </div>
  220. </div>
  221. </div>
  222. <div id="remove-check-modal" class="modal">
  223. <div class="modal-dialog">
  224. <form id="remove-check-form" method="post">
  225. {% csrf_token %}
  226. <div class="modal-content">
  227. <div class="modal-header">
  228. <button type="button" class="close" data-dismiss="modal">&times;</button>
  229. <h4 class="remove-check-title">Remove Check <span class="remove-check-name"></span></h4>
  230. </div>
  231. <div class="modal-body">
  232. <p>You are about to remove check
  233. <strong class="remove-check-name">---</strong>.
  234. </p>
  235. <p>Once it's gone there is no "undo" and you cannot get
  236. the old ping URL back.</p>
  237. <p>Are you sure?</p>
  238. </div>
  239. <div class="modal-footer">
  240. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  241. <button type="submit" class="btn btn-danger">Remove</button>
  242. </div>
  243. </div>
  244. </form>
  245. </div>
  246. </div>
  247. <div id="show-usage-modal" class="modal">
  248. <div class="modal-dialog">
  249. <div class="modal-content">
  250. <div class="modal-header">
  251. <button type="button" class="close" data-dismiss="modal">&times;</button>
  252. <ul class="nav nav-pills" role="tablist">
  253. <li class="active">
  254. <a href="#crontab" data-toggle="tab">Crontab</a>
  255. </li>
  256. <li>
  257. <a href="#bash" data-toggle="tab">Bash</a>
  258. </li>
  259. <li>
  260. <a href="#python" data-toggle="tab">Python</a>
  261. </li>
  262. <li class="hidden-xs">
  263. <a href="#node" data-toggle="tab">Node.js</a>
  264. </li>
  265. <li class="hidden-xs">
  266. <a href="#php" data-toggle="tab">PHP</a>
  267. </li>
  268. <li class="hidden-xs">
  269. <a href="#browser" data-toggle="tab">Browser</a>
  270. </li>
  271. <li class="hidden-xs">
  272. <a href="#powershell" data-toggle="tab">PowerShell</a>
  273. </li>
  274. <li class="hidden-xs">
  275. <a href="#email" data-toggle="tab">Email</a>
  276. </li>
  277. </ul>
  278. </div>
  279. <div class="modal-body">
  280. <div class="tab-content">
  281. {% with ping_url="<span class='ex'></span>" %}
  282. <div role="tabpanel" class="tab-pane active" id="crontab">
  283. {% include "front/snippets/crontab.html" %}
  284. </div>
  285. <div role="tabpanel" class="tab-pane" id="bash">
  286. {% include "front/snippets/bash_curl.html" %}
  287. {% include "front/snippets/bash_wget.html" %}
  288. </div>
  289. <div role="tabpanel" class="tab-pane" id="python">
  290. {% include "front/snippets/python_urllib2.html" %}
  291. {% include "front/snippets/python_requests.html" %}
  292. </div>
  293. <div role="tabpanel" class="tab-pane" id="node">
  294. {% include "front/snippets/node.html" %}
  295. </div>
  296. <div role="tabpanel" class="tab-pane" id="php">
  297. {% include "front/snippets/php.html" %}
  298. </div>
  299. <div class="tab-pane" id="browser">
  300. {% include "front/snippets/browser.html" %}
  301. </div>
  302. <div class="tab-pane" id="powershell">
  303. {% include "front/snippets/powershell.html" %}
  304. </div>
  305. <div class="tab-pane" id="email">
  306. <p>
  307. As an alternative to HTTP/HTTPS requests,
  308. you can "ping" this check by sending an
  309. email message to <code class="em"></code>
  310. </p>
  311. </div>
  312. {% endwith %}
  313. </div>
  314. </div>
  315. <div class="modal-footer">
  316. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  317. </div>
  318. </div>
  319. </div>
  320. </div>
  321. <form id="pause-form" method="post">
  322. {% csrf_token %}
  323. </form>
  324. {% endblock %}
  325. {% block scripts %}
  326. {% compress js %}
  327. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  328. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  329. <script src="{% static 'js/selectize.min.js' %}"></script>
  330. <script src="{% static 'js/nouislider.min.js' %}"></script>
  331. <script src="{% static 'js/clipboard.min.js' %}"></script>
  332. <script src="{% static 'js/snippet-copy.js' %}"></script>
  333. <script src="{% static 'js/checks.js' %}"></script>
  334. {% endcompress %}
  335. {% endblock %}