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.

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