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.

200 lines
6.7 KiB

9 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize staticfiles hc_extras %}
  3. {% block title %}Add Slack - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. {% if slack_client_id %}
  8. <div class="jumbotron">
  9. {% if request.user.is_authenticated %}
  10. <p>If your team uses <a href="http://slack.com/">Slack</a>, you can set
  11. up {% site_name %} to post status updates directly to an appropriate
  12. Slack channel.</p>
  13. <div class="text-center">
  14. <a href="https://slack.com/oauth/authorize?scope=incoming-webhook&client_id={{ slack_client_id }}&state={{ state }}">
  15. <img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/[email protected] 2x" />
  16. </a>
  17. </div>
  18. {% else %}
  19. <p>
  20. healthchecks.io is a <strong>free</strong> and
  21. <a href="https://github.com/healthchecks/healthchecks">open source</a>
  22. service for monitoring your cron jobs, background processes and
  23. scheduled tasks. Before adding Slack integration, please log into
  24. {% site_root %}:</p>
  25. <div class="text-center">
  26. <form class="form-inline" action="{% url 'hc-login' %}" method="post">
  27. {% csrf_token %}
  28. <div class="form-group">
  29. <div class="input-group input-group-lg">
  30. <div class="input-group-addon">@</div>
  31. <input
  32. type="email"
  33. class="form-control"
  34. name="email"
  35. autocomplete="email"
  36. placeholder="Email">
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <button type="submit" class="btn btn-lg btn-primary pull-right">
  41. Log In
  42. </button>
  43. </div>
  44. </form>
  45. </div>
  46. {% endif %}
  47. </div>
  48. <h2>Setup Guide</h2>
  49. <div class="row ai-step">
  50. <div class="col-sm-6">
  51. <span class="step-no">2</span>
  52. <p>
  53. After {% if request.user.is_authenticated %}{% else %}logging in and{% endif %}
  54. clicking on "Add to Slack", you should
  55. be on a page that says "healthchecks.io would like access to
  56. your Slack team". Select the team you want to add the
  57. healthchecks.io integration app to.
  58. </p>
  59. </div>
  60. <div class="col-sm-6">
  61. <img
  62. class="ai-guide-screenshot"
  63. alt="Screenshot"
  64. src="{% static 'img/integrations/setup_slack_btn_1.png' %}">
  65. </div>
  66. </div>
  67. <div class="row ai-step">
  68. <div class="col-sm-6">
  69. <span class="step-no">3</span>
  70. <p>
  71. You should now be on a page that says "healthchecks.io would
  72. like access to <i>TEAM NAME</i>". Select the channel you want to
  73. post healthchecks.io notifications to.
  74. </p>
  75. </div>
  76. <div class="col-sm-6">
  77. <img
  78. class="ai-guide-screenshot"
  79. alt="Screenshot"
  80. src="{% static 'img/integrations/setup_slack_btn_2.png' %}">
  81. </div>
  82. </div>
  83. <div class="row ai-step">
  84. <div class="col-sm-6">
  85. <span class="step-no">4</span>
  86. <p>
  87. That is all! You will now be redirected back to
  88. "Integrations" page on {% site_name %} and see
  89. the new integration!
  90. </p>
  91. </div>
  92. <div class="col-sm-6">
  93. <img
  94. class="ai-guide-screenshot"
  95. alt="Screenshot"
  96. src="{% static 'img/integrations/setup_slack_btn_3.png' %}">
  97. </div>
  98. </div>
  99. {% else %}
  100. <h1>Slack</h1>
  101. <p>If your team uses <a href="http://slack.com/">Slack</a>, you can set
  102. up {% site_name %} to post status updates directly to an appropriate
  103. Slack channel.</p>
  104. <h2>Setup Guide</h2>
  105. <div class="row ai-step">
  106. <div class="col-sm-6">
  107. <span class="step-no">1</span>
  108. Log into your Slack account and
  109. pick an appropriate Slack channel. From the dropdown next to
  110. channel's name, pick <strong>Add a service integration...</strong>
  111. </div>
  112. <div class="col-sm-6">
  113. <img
  114. class="ai-guide-screenshot"
  115. alt="Screenshot"
  116. src="{% static 'img/integrations/setup_slack_1.png' %}">
  117. </div>
  118. </div>
  119. <div class="row ai-step">
  120. <div class="col-sm-6">
  121. <span class="step-no">2</span>
  122. From the list of available integrations, select
  123. <strong>Incoming WebHooks</strong>, and click on
  124. <strong>Add Incoming WebHooks Integration</strong>.
  125. </div>
  126. </div>
  127. <div class="row ai-step">
  128. <div class="col-sm-6">
  129. <span class="step-no">3</span>
  130. <p>Copy the displayed <strong>WebHook URL</strong> and paste it down below.</p>
  131. <p>Save the integration, and it's done!</p>
  132. </div>
  133. <div class="col-sm-6">
  134. <img
  135. class="ai-guide-screenshot"
  136. alt="Screenshot"
  137. src="{% static 'img/integrations/setup_slack_2.png' %}">
  138. </div>
  139. </div>
  140. <h2>Integration Settings</h2>
  141. <form method="post" class="form-horizontal" action="{% url 'hc-add-slack' %}">
  142. {% csrf_token %}
  143. <div class="form-group {{ form.value.css_classes }}">
  144. <label for="callback-url" class="col-sm-2 control-label">
  145. Callback URL
  146. </label>
  147. <div class="col-sm-10">
  148. <input
  149. id="callback-url"
  150. type="text"
  151. class="form-control"
  152. name="value"
  153. placeholder="https://"
  154. value="{{ form.value.value|default:"" }}">
  155. {% if form.value.errors %}
  156. <div class="help-block">
  157. {{ form.value.errors|join:"" }}
  158. </div>
  159. {% endif %}
  160. </div>
  161. </div>
  162. <div class="form-group">
  163. <div class="col-sm-offset-2 col-sm-10">
  164. <button type="submit" class="btn btn-primary">Save Integration</button>
  165. </div>
  166. </div>
  167. </form>
  168. {% endif %}
  169. </div>
  170. </div>
  171. {% endblock %}
  172. {% block scripts %}
  173. {% compress js %}
  174. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  175. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  176. {% endcompress %}
  177. {% endblock %}