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.

325 lines
12 KiB

8 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize staticfiles 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>Type</th>
  18. <th>Value</th>
  19. <th>Assigned Checks</th>
  20. <th>Last Notification</th>
  21. <th></th>
  22. </tr>
  23. {% for ch in channels %}
  24. <tr class="channel-row">
  25. <td>{{ ch.get_kind_display }}</td>
  26. <td class="value-cell">
  27. {% if ch.kind == "email" %}
  28. <span class="preposition">to</span>
  29. {{ ch.value }}
  30. {% if not ch.email_verified %}
  31. <span class="channel-unconfirmed">(unconfirmed)</span>
  32. {% endif %}
  33. {% elif ch.kind == "pd" %}
  34. {% if ch.pd_account %}
  35. <span class="preposition">account</span>
  36. {{ ch.pd_account}},
  37. {% endif %}
  38. <span class="preposition">service key</span>
  39. {{ ch.pd_service_key }}
  40. {% elif ch.kind == "opsgenie" %}
  41. <span class="preposition">API key</span>
  42. {{ ch.value }}
  43. {% elif ch.kind == "victorops" %}
  44. <span class="preposition">Post URL</span>
  45. {{ ch.value }}
  46. {% elif ch.kind == "po" %}
  47. <span class="preposition">user key</span>
  48. {{ ch.po_value|first }}
  49. ({{ ch.po_value|last }} priority)
  50. {% elif ch.kind == "slack" %}
  51. {% if ch.slack_team %}
  52. <span class="preposition">team</span>
  53. {{ ch.slack_team }},
  54. <span class="preposition">channel</span>
  55. {{ ch.slack_channel }}
  56. {% else %}
  57. {{ ch.value }}
  58. {% endif %}
  59. {% elif ch.kind == "webhook" %}
  60. <table>
  61. {% if ch.value_down %}
  62. <tr>
  63. <td class="preposition">down&nbsp;</td>
  64. <td>{{ ch.value_down }}</td>
  65. </tr>
  66. {% endif %}
  67. {% if ch.value_up %}
  68. <tr>
  69. <td class="preposition">up&nbsp;</td>
  70. <td>{{ ch.value_up }}</td>
  71. </tr>
  72. {% endif %}
  73. {% if ch.post_data %}
  74. <tr>
  75. <td class="preposition">body&nbsp;</td>
  76. <td>{{ ch.post_data }}</td>
  77. </tr>
  78. {% endif %}
  79. </table>
  80. {% elif ch.kind == "pushbullet" %}
  81. <span class="preposition">API key</span>
  82. {{ ch.value }}
  83. {% elif ch.kind == "discord" %}
  84. {{ ch.discord_webhook_id }}
  85. {% elif ch.kind == "telegram" %}
  86. {% if ch.telegram_type == "group" %}
  87. <span class="preposition">chat</span>
  88. {% elif ch.telegram_type == "private" %}
  89. <span class="preposition">user</span>
  90. {% endif %}
  91. {{ ch.telegram_name }}
  92. {% elif ch.kind == "hipchat" %}
  93. {{ ch.hipchat_webhook_url }}
  94. {% else %}
  95. {{ ch.value }}
  96. {% endif %}
  97. </td>
  98. <td class="channels-num-checks">
  99. <a
  100. class="edit-checks"
  101. href="{% url 'hc-channel-checks' ch.code %}">
  102. {{ ch.n_checks }} of {{ num_checks }}
  103. </a>
  104. </td>
  105. <td>
  106. {% with n=ch.latest_notification %}
  107. {% if n %}
  108. {% if n.error %}
  109. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  110. <strong>Failed</strong>, {{ n.created|naturaltime }}
  111. </span>
  112. {% else %}
  113. Delivered, {{ n.created|naturaltime }}
  114. {% endif %}
  115. {% else %}
  116. Never
  117. {% endif %}
  118. {% if ch.kind == "sms" %}
  119. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  120. {% endif %}
  121. {% endwith %}
  122. </td>
  123. <td>
  124. <button
  125. data-kind="{{ ch.get_kind_display }}"
  126. data-url="{% url 'hc-remove-channel' ch.code %}"
  127. class="btn btn-sm btn-default channel-remove"
  128. type="button">
  129. <span class="icon-delete"></span>
  130. </button>
  131. </td>
  132. <td>
  133. </td>
  134. </tr>
  135. {% endfor %}
  136. {% endif %}
  137. </table>
  138. <h1 class="ai-title">Add More</h1>
  139. <ul class="add-integration">
  140. <li>
  141. <img src="{% static 'img/integrations/slack.png' %}"
  142. class="icon" alt="Slack icon" />
  143. <h2>Slack</h2>
  144. <p>A messaging app for teams.</p>
  145. <a href="{% url 'hc-add-slack' %}" class="btn btn-primary">Add Integration</a>
  146. </li>
  147. <li>
  148. <img src="{% static 'img/integrations/email.png' %}"
  149. class="icon" alt="Email icon" />
  150. <h2>Email</h2>
  151. <p>Get an email message when a check goes up or down.</p>
  152. <a href="{% url 'hc-add-email' %}" class="btn btn-primary">Add Integration</a>
  153. </li>
  154. {% if enable_sms %}
  155. <li>
  156. <img src="{% static 'img/integrations/sms.png' %}"
  157. class="icon" alt="SMS icon" />
  158. <h2>SMS {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
  159. <p>Get a text message to your phone when a check goes down.</p>
  160. <a href="{% url 'hc-add-sms' %}" class="btn btn-primary">Add Integration</a>
  161. </li>
  162. {% endif %}
  163. <li>
  164. <img src="{% static 'img/integrations/webhook.png' %}"
  165. class="icon" alt="Webhook icon" />
  166. <h2>Webhook</h2>
  167. <p>Receive a HTTP callback when a check goes down.</p>
  168. <a href="{% url 'hc-add-webhook' %}" class="btn btn-primary">Add Integration</a>
  169. </li>
  170. {% if enable_pushover %}
  171. <li>
  172. <img src="{% static 'img/integrations/pushover.png' %}"
  173. class="icon" alt="Pushover icon" />
  174. <h2>Pushover</h2>
  175. <p>Receive instant push notifications on your phone or tablet.</p>
  176. <a href="{% url 'hc-add-pushover' %}" class="btn btn-primary">Add Integration</a>
  177. </li>
  178. {% endif %}
  179. {% if enable_pushbullet %}
  180. <li>
  181. <img src="{% static 'img/integrations/pushbullet.png' %}"
  182. class="icon" alt="Pushbullet icon" />
  183. <h2>Pushbullet</h2>
  184. <p>Pushbullet connects your devices, making them feel like one.</p>
  185. <a href="{% url 'hc-add-pushbullet' %}" class="btn btn-primary">Add Integration</a>
  186. </li>
  187. {% endif %}
  188. {% if enable_telegram %}
  189. <li>
  190. <img src="{% static 'img/integrations/telegram.png' %}"
  191. class="icon" alt="Telegram icon" />
  192. <h2>Telegram</h2>
  193. <p>A messaging app with a focus on speed and security.</p>
  194. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  195. </li>
  196. {% endif %}
  197. {% if enable_pd %}
  198. <li>
  199. <img src="{% static 'img/integrations/pd.png' %}"
  200. class="icon" alt="PagerDuty icon" />
  201. <h2>PagerDuty</h2>
  202. <p>On-call scheduling, alerting, and incident tracking.</p>
  203. <a href="{% url 'hc-add-pd' %}" class="btn btn-primary">Add Integration</a>
  204. </li>
  205. {% endif %}
  206. <li>
  207. <img src="{% static 'img/integrations/hipchat.png' %}"
  208. class="icon" alt="HipChat icon" />
  209. <h2>HipChat</h2>
  210. <p>Group and private chat, file sharing, and integrations.</p>
  211. <a href="{% url 'hc-add-hipchat' %}" class="btn btn-primary">Add Integration</a>
  212. </li>
  213. <li>
  214. <img src="{% static 'img/integrations/victorops.png' %}"
  215. class="icon" alt="VictorOps icon" />
  216. <h2>VictorOps</h2>
  217. <p>On-call scheduling, alerting, and incident tracking.</p>
  218. <a href="{% url 'hc-add-victorops' %}" class="btn btn-primary">Add Integration</a>
  219. </li>
  220. {% if enable_discord %}
  221. <li>
  222. <img src="{% static 'img/integrations/discord.png' %}"
  223. class="icon" alt="Discord icon" />
  224. <h2>Discord</h2>
  225. <p>Cross-platform voice and text chat app designed for gamers.</p>
  226. <a href="{% url 'hc-add-discord' %}" class="btn btn-primary">Add Integration</a>
  227. </li>
  228. {% endif %}
  229. <li>
  230. <img src="{% static 'img/integrations/opsgenie.png' %}"
  231. class="icon" alt="OpsGenie icon" />
  232. <h2>OpsGenie</h2>
  233. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  234. <a href="{% url 'hc-add-opsgenie' %}" class="btn btn-primary">Add Integration</a>
  235. </li>
  236. <li class="link-to-github">
  237. <img src="{% static 'img/integrations/missing.png' %}"
  238. class="icon" alt="Suggest New Integration" />
  239. <p>
  240. Your favorite service or notification method not listed? <br />
  241. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  242. </p>
  243. </li>
  244. </ul>
  245. </div>
  246. </div>
  247. <div id="checks-modal" class="modal">
  248. <div class="modal-dialog">
  249. <div class="modal-content">
  250. </div>
  251. </div>
  252. </div>
  253. <div id="remove-channel-modal" class="modal">
  254. <div class="modal-dialog">
  255. <form id="remove-channel-form" method="post">
  256. {% csrf_token %}
  257. <div class="modal-content">
  258. <div class="modal-header">
  259. <button type="button" class="close" data-dismiss="modal">&times;</button>
  260. <h4 class="remove-check-title">
  261. Remove this
  262. <span class="remove-channel-kind">---</span>
  263. Integration?
  264. </h4>
  265. </div>
  266. <div class="modal-body">
  267. <p>You are about to remove this
  268. <span class="remove-channel-kind">---</span>
  269. integration.
  270. </p>
  271. <p>Once it's gone it's gone. But, if you change your
  272. mind later, you can create a similar channel again.
  273. Do you want to continue?</p>
  274. </div>
  275. <div class="modal-footer">
  276. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  277. <button type="submit" class="btn btn-danger">Remove</button>
  278. </div>
  279. </div>
  280. </form>
  281. </div>
  282. </div>
  283. {% endblock %}
  284. {% block scripts %}
  285. {% compress js %}
  286. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  287. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  288. <script src="{% static 'js/channels.js' %}"></script>
  289. {% endcompress %}
  290. {% endblock %}