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.

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