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.

178 lines
6.0 KiB

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