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.

475 lines
18 KiB

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