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.

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