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.

412 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="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_priority }} 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_trello %}
  242. <li>
  243. <img src="{% static 'img/integrations/trello.png' %}"
  244. class="icon" alt="Trello icon" />
  245. <h2>Trello</h2>
  246. <p>Create a Trello card when a check goes down.</p>
  247. <a href="{% url 'hc-add-trello' %}" class="btn btn-primary">Add Integration</a>
  248. </li>
  249. {% endif %}
  250. <li class="link-to-github">
  251. <img src="{% static 'img/integrations/missing.png' %}"
  252. class="icon" alt="Suggest New Integration" />
  253. <p>
  254. Your favorite service or notification method not listed? <br />
  255. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  256. </p>
  257. </li>
  258. </ul>
  259. </div>
  260. </div>
  261. <div id="checks-modal" class="modal">
  262. <div class="modal-dialog">
  263. <div class="modal-content">
  264. </div>
  265. </div>
  266. </div>
  267. <div id="remove-channel-modal" class="modal">
  268. <div class="modal-dialog">
  269. <form id="remove-channel-form" method="post">
  270. {% csrf_token %}
  271. <div class="modal-content">
  272. <div class="modal-header">
  273. <button type="button" class="close" data-dismiss="modal">&times;</button>
  274. <h4 class="remove-check-title">
  275. Remove this
  276. <span class="remove-channel-kind">---</span>
  277. Integration?
  278. </h4>
  279. </div>
  280. <div class="modal-body">
  281. <p>You are about to remove this
  282. <span class="remove-channel-kind">---</span>
  283. integration.
  284. </p>
  285. <p>Once it's gone it's gone. But, if you change your
  286. mind later, you can create a similar channel again.
  287. Do you want to continue?</p>
  288. </div>
  289. <div class="modal-footer">
  290. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  291. <button type="submit" class="btn btn-danger">Remove</button>
  292. </div>
  293. </div>
  294. </form>
  295. </div>
  296. </div>
  297. {% for ch in channels %}
  298. <div id="name-{{ ch.code }}" class="modal channel-modal">
  299. <div class="modal-dialog">
  300. <form
  301. action="{% url 'hc-channel-name' ch.code %}"
  302. class="form-horizontal"
  303. method="post">
  304. {% csrf_token %}
  305. <div class="modal-content">
  306. <div class="modal-header">
  307. <button type="button" class="close" data-dismiss="modal">&times;</button>
  308. <h4 class="update-timeout-title">Integration Details</h4>
  309. </div>
  310. <div class="modal-body">
  311. <div class="form-group">
  312. <label for="update-name-input" class="col-sm-2 control-label">
  313. Name
  314. </label>
  315. <div class="col-sm-10">
  316. <input
  317. name="name"
  318. type="text"
  319. value="{{ ch.name }}"
  320. placeholder="{{ ch }}"
  321. class="input-name form-control" />
  322. <span class="help-block">
  323. Give this integration a human-friendly name,
  324. so you can easily recognize it later.
  325. </span>
  326. </div>
  327. </div>
  328. {% if ch.kind == "webhook" %}
  329. {% if ch.url_down %}
  330. <p><strong>URL for "down" events</strong></p>
  331. <pre>{{ ch.url_down }}</pre>
  332. {% endif %}
  333. {% if ch.url_up %}
  334. <p><strong>URL for "up" events</strong></p>
  335. <pre>{{ ch.url_up }}</pre>
  336. {% endif %}
  337. {% if ch.post_data %}
  338. <p><strong>POST data</strong></p>
  339. <pre>{{ ch.post_data }}</pre>
  340. {% endif %}
  341. {% for k, v in ch.headers.items %}
  342. <p><strong>Header <code>{{ k }}</code></strong></p>
  343. <pre>{{ v }}</pre>
  344. {% endfor %}
  345. {% endif %}
  346. </div>
  347. <div class="modal-footer">
  348. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  349. <button type="submit" class="btn btn-primary">Save</button>
  350. </div>
  351. </div>
  352. </form>
  353. </div>
  354. </div>
  355. {% endfor %}
  356. {% endblock %}
  357. {% block scripts %}
  358. {% compress js %}
  359. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  360. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  361. <script src="{% static 'js/channels.js' %}"></script>
  362. {% endcompress %}
  363. {% endblock %}