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.

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