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.

380 lines
16 KiB

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