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.

410 lines
15 KiB

8 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize static hc_extras %}
  3. {% block title %}Integrations - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. {% if messages %}
  7. <div class="col-sm-12">
  8. {% for message in messages %}
  9. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  10. {% endfor %}
  11. </div>
  12. {% endif %}
  13. <div class="col-sm-12">
  14. <table class="table channels-table">
  15. {% if channels %}
  16. <tr>
  17. <th></th>
  18. <th class="th-name">Name, Details</th>
  19. <th class="th-checks">Assigned Checks</th>
  20. <th>Status</th>
  21. <th>Last Notification</th>
  22. <th></th>
  23. </tr>
  24. {% for ch in channels %}
  25. {% with n=ch.latest_notification %}
  26. <tr class="channel-row">
  27. <td class="icon-cell">
  28. <img src="{% static ch.icon_path %}"
  29. class="icon"
  30. alt="{{ ch.get_kind_display }} icon" />
  31. </td>
  32. <td>
  33. <div class="edit-name" data-toggle="modal" data-target="#name-{{ ch.code }}">
  34. {% if ch.name %}
  35. {{ ch.name }}
  36. {% else %}
  37. <div class="unnamed">unnamed</div>
  38. {% endif %}
  39. <div class="channel-details-mini">
  40. {% if ch.kind == "email" %}
  41. Email to <span>{{ ch.value }}</span>
  42. {% elif ch.kind == "pd" %}
  43. PagerDuty account <span>{{ ch.pd_account }}</span>
  44. {% elif ch.kind == "pagertree" %}
  45. PagerTree
  46. {% elif ch.kind == "opsgenie" %}
  47. OpsGenie
  48. {% elif ch.kind == "victorops" %}
  49. VictorOps
  50. {% elif ch.kind == "po" %}
  51. Pushover ({{ ch.po_priority }} priority)
  52. {% elif ch.kind == "slack" %}
  53. Slack
  54. {% if ch.slack_team %}
  55. team <span>{{ ch.slack_team }}</span>,
  56. channel <span>{{ ch.slack_channel }}</span>
  57. {% endif %}
  58. {% elif ch.kind == "webhook" %}
  59. Webhook
  60. {% elif ch.kind == "pushbullet" %}
  61. Pushbullet
  62. {% elif ch.kind == "discord" %}
  63. Discord
  64. {% elif ch.kind == "telegram" %}
  65. Telegram
  66. {% if ch.telegram_type == "group" %}
  67. chat <span>{{ ch.telegram_name }}</span>
  68. {% elif ch.telegram_type == "private" %}
  69. user <span>{{ ch.telegram_name }}</span>
  70. {% endif %}
  71. {% elif ch.kind == "hipchat" %}
  72. HipChat
  73. {% elif ch.kind == "sms" %}
  74. SMS to <span>{{ ch.sms_number }}</span>
  75. {% elif ch.kind == "trello" %}
  76. Trello
  77. board <span>{{ ch.trello_board_list|first }}</span>,
  78. list <span>{{ ch.trello_board_list|last }}</span>
  79. {% else %}
  80. {{ ch.kind }}
  81. {% endif %}
  82. </div>
  83. </div>
  84. </td>
  85. <td>
  86. <div class="edit-checks"
  87. data-url="{% url 'hc-channel-checks' ch.code %}">
  88. {{ ch.n_checks }} checks
  89. </div>
  90. </td>
  91. <td>
  92. {% if ch.kind == "email" and not ch.email_verified %}
  93. {% if n and n.error %}
  94. <span class="label label-danger">Disabled</span>
  95. {% else %}
  96. <span class="label label-default">Unconfirmed</span>
  97. {% endif %}
  98. {% else %}
  99. Ready to deliver
  100. {% endif %}
  101. </td>
  102. <td>
  103. {% if n %}
  104. {% if n.error %}
  105. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  106. <strong>Failed</strong>, {{ n.created|naturaltime }}
  107. </span>
  108. {% else %}
  109. Delivered, {{ n.created|naturaltime }}
  110. {% endif %}
  111. {% else %}
  112. Never
  113. {% endif %}
  114. {% if ch.kind == "sms" %}
  115. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  116. {% endif %}
  117. </td>
  118. <td>
  119. <button
  120. data-kind="{{ ch.get_kind_display }}"
  121. data-url="{% url 'hc-remove-channel' ch.code %}"
  122. class="btn btn-sm btn-default channel-remove"
  123. type="button">
  124. <span class="icon-delete"></span>
  125. </button>
  126. </td>
  127. <td>
  128. </td>
  129. </tr>
  130. {% endwith %}
  131. {% endfor %}
  132. {% endif %}
  133. </table>
  134. <h1 class="ai-title">Add More</h1>
  135. <ul class="add-integration">
  136. <li>
  137. <img src="{% static 'img/integrations/slack.png' %}"
  138. class="icon" alt="Slack icon" />
  139. <h2>Slack</h2>
  140. <p>A messaging app for teams.</p>
  141. <a href="{% url 'hc-add-slack' %}" class="btn btn-primary">Add Integration</a>
  142. </li>
  143. <li>
  144. <img src="{% static 'img/integrations/email.png' %}"
  145. class="icon" alt="Email icon" />
  146. <h2>Email</h2>
  147. <p>Get an email message when a check goes up or down.</p>
  148. <a href="{% url 'hc-add-email' %}" class="btn btn-primary">Add Integration</a>
  149. </li>
  150. {% if enable_sms %}
  151. <li>
  152. <img src="{% static 'img/integrations/sms.png' %}"
  153. class="icon" alt="SMS icon" />
  154. <h2>SMS {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
  155. <p>Get a text message to your phone when a check goes down.</p>
  156. <a href="{% url 'hc-add-sms' %}" class="btn btn-primary">Add Integration</a>
  157. </li>
  158. {% endif %}
  159. <li>
  160. <img src="{% static 'img/integrations/webhook.png' %}"
  161. class="icon" alt="Webhook icon" />
  162. <h2>Webhook</h2>
  163. <p>Receive a HTTP callback when a check goes down.</p>
  164. <a href="{% url 'hc-add-webhook' %}" class="btn btn-primary">Add Integration</a>
  165. </li>
  166. {% if enable_pushover %}
  167. <li>
  168. <img src="{% static 'img/integrations/po.png' %}"
  169. class="icon" alt="Pushover icon" />
  170. <h2>Pushover</h2>
  171. <p>Receive instant push notifications on your phone or tablet.</p>
  172. <a href="{% url 'hc-add-pushover' %}" class="btn btn-primary">Add Integration</a>
  173. </li>
  174. {% endif %}
  175. {% if enable_pushbullet %}
  176. <li>
  177. <img src="{% static 'img/integrations/pushbullet.png' %}"
  178. class="icon" alt="Pushbullet icon" />
  179. <h2>Pushbullet</h2>
  180. <p>Pushbullet connects your devices, making them feel like one.</p>
  181. <a href="{% url 'hc-add-pushbullet' %}" class="btn btn-primary">Add Integration</a>
  182. </li>
  183. {% endif %}
  184. {% if enable_telegram %}
  185. <li>
  186. <img src="{% static 'img/integrations/telegram.png' %}"
  187. class="icon" alt="Telegram icon" />
  188. <h2>Telegram</h2>
  189. <p>A messaging app with a focus on speed and security.</p>
  190. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  191. </li>
  192. {% endif %}
  193. {% if enable_pd %}
  194. <li>
  195. <img src="{% static 'img/integrations/pd.png' %}"
  196. class="icon" alt="PagerDuty icon" />
  197. <h2>PagerDuty</h2>
  198. <p>On-call scheduling, alerting, and incident tracking.</p>
  199. <a href="{% url 'hc-add-pd' %}" class="btn btn-primary">Add Integration</a>
  200. </li>
  201. {% endif %}
  202. <li>
  203. <img src="{% static 'img/integrations/pagertree.png' %}"
  204. class="icon" alt="PagerTree icon" />
  205. <h2>PagerTree</h2>
  206. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications</p>
  207. <a href="{% url 'hc-add-pagertree' %}" class="btn btn-primary">Add Integration</a>
  208. </li>
  209. <li>
  210. <img src="{% static 'img/integrations/hipchat.png' %}"
  211. class="icon" alt="HipChat icon" />
  212. <h2>HipChat</h2>
  213. <p>Group and private chat, file sharing, and integrations.</p>
  214. <a href="{% url 'hc-add-hipchat' %}" class="btn btn-primary">Add Integration</a>
  215. </li>
  216. <li>
  217. <img src="{% static 'img/integrations/victorops.png' %}"
  218. class="icon" alt="VictorOps icon" />
  219. <h2>VictorOps</h2>
  220. <p>On-call scheduling, alerting, and incident tracking.</p>
  221. <a href="{% url 'hc-add-victorops' %}" class="btn btn-primary">Add Integration</a>
  222. </li>
  223. {% if enable_discord %}
  224. <li>
  225. <img src="{% static 'img/integrations/discord.png' %}"
  226. class="icon" alt="Discord icon" />
  227. <h2>Discord</h2>
  228. <p>Cross-platform voice and text chat app designed for gamers.</p>
  229. <a href="{% url 'hc-add-discord' %}" class="btn btn-primary">Add Integration</a>
  230. </li>
  231. {% endif %}
  232. <li>
  233. <img src="{% static 'img/integrations/opsgenie.png' %}"
  234. class="icon" alt="OpsGenie icon" />
  235. <h2>OpsGenie</h2>
  236. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  237. <a href="{% url 'hc-add-opsgenie' %}" class="btn btn-primary">Add Integration</a>
  238. </li>
  239. {% if enable_trello %}
  240. <li>
  241. <img src="{% static 'img/integrations/trello.png' %}"
  242. class="icon" alt="Trello icon" />
  243. <h2>Trello</h2>
  244. <p>Create a Trello card when a check goes down.</p>
  245. <a href="{% url 'hc-add-trello' %}" class="btn btn-primary">Add Integration</a>
  246. </li>
  247. {% endif %}
  248. <li class="link-to-github">
  249. <img src="{% static 'img/integrations/missing.png' %}"
  250. class="icon" alt="Suggest New Integration" />
  251. <p>
  252. Your favorite service or notification method not listed? <br />
  253. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  254. </p>
  255. </li>
  256. </ul>
  257. </div>
  258. </div>
  259. <div id="checks-modal" class="modal">
  260. <div class="modal-dialog">
  261. <div class="modal-content">
  262. </div>
  263. </div>
  264. </div>
  265. <div id="remove-channel-modal" class="modal">
  266. <div class="modal-dialog">
  267. <form id="remove-channel-form" method="post">
  268. {% csrf_token %}
  269. <div class="modal-content">
  270. <div class="modal-header">
  271. <button type="button" class="close" data-dismiss="modal">&times;</button>
  272. <h4 class="remove-check-title">
  273. Remove this
  274. <span class="remove-channel-kind">---</span>
  275. Integration?
  276. </h4>
  277. </div>
  278. <div class="modal-body">
  279. <p>You are about to remove this
  280. <span class="remove-channel-kind">---</span>
  281. integration.
  282. </p>
  283. <p>Once it's gone it's gone. But, if you change your
  284. mind later, you can create a similar channel again.
  285. Do you want to continue?</p>
  286. </div>
  287. <div class="modal-footer">
  288. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  289. <button type="submit" class="btn btn-danger">Remove</button>
  290. </div>
  291. </div>
  292. </form>
  293. </div>
  294. </div>
  295. {% for ch in channels %}
  296. <div id="name-{{ ch.code }}" class="modal channel-modal">
  297. <div class="modal-dialog">
  298. <form
  299. action="{% url 'hc-channel-name' ch.code %}"
  300. class="form-horizontal"
  301. method="post">
  302. {% csrf_token %}
  303. <div class="modal-content">
  304. <div class="modal-header">
  305. <button type="button" class="close" data-dismiss="modal">&times;</button>
  306. <h4 class="update-timeout-title">Integration Details</h4>
  307. </div>
  308. <div class="modal-body">
  309. <div class="form-group">
  310. <label for="update-name-input" class="col-sm-2 control-label">
  311. Name
  312. </label>
  313. <div class="col-sm-10">
  314. <input
  315. name="name"
  316. type="text"
  317. value="{{ ch.name }}"
  318. placeholder="{{ ch }}"
  319. class="input-name form-control" />
  320. <span class="help-block">
  321. Give this integration a human-friendly name,
  322. so you can easily recognize it later.
  323. </span>
  324. </div>
  325. </div>
  326. {% if ch.kind == "webhook" %}
  327. {% if ch.url_down %}
  328. <p><strong>URL for "down" events</strong></p>
  329. <pre>{{ ch.url_down }}</pre>
  330. {% endif %}
  331. {% if ch.url_up %}
  332. <p><strong>URL for "up" events</strong></p>
  333. <pre>{{ ch.url_up }}</pre>
  334. {% endif %}
  335. {% if ch.post_data %}
  336. <p><strong>POST data</strong></p>
  337. <pre>{{ ch.post_data }}</pre>
  338. {% endif %}
  339. {% for k, v in ch.headers.items %}
  340. <p><strong>Header <code>{{ k }}</code></strong></p>
  341. <pre>{{ v }}</pre>
  342. {% endfor %}
  343. {% endif %}
  344. </div>
  345. <div class="modal-footer">
  346. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  347. <button type="submit" class="btn btn-primary">Save</button>
  348. </div>
  349. </div>
  350. </form>
  351. </div>
  352. </div>
  353. {% endfor %}
  354. {% endblock %}
  355. {% block scripts %}
  356. {% compress js %}
  357. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  358. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  359. <script src="{% static 'js/channels.js' %}"></script>
  360. {% endcompress %}
  361. {% endblock %}