Browse Source

Update Mattermost setup instructions

pull/733/head
Pēteris Caune 1 year ago
parent
commit
ccfcf26e65
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
  1. 1
      CHANGELOG.md
  2. 3
      hc/front/tests/test_add_mattermost.py
  3. 20
      hc/front/tests/test_mattermost_help.py
  4. 1
      hc/front/urls.py
  5. 5
      hc/front/views.py
  6. BIN
      static/img/integrations/setup_mattermost_1.png
  7. BIN
      static/img/integrations/setup_mattermost_2.png
  8. BIN
      static/img/integrations/setup_mattermost_3.png
  9. BIN
      static/img/integrations/setup_mattermost_4.png
  10. BIN
      static/img/integrations/setup_mattermost_5.png
  11. 76
      templates/integrations/add_mattermost.html

1
CHANGELOG.md

@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- Add handling for ipv4address:port values in the X-Forwarded-For header (#714)
- Add a form for submitting Signal CAPTCHA solutions
- Add Duration field in the Ping Details dialog (#720)
- Update Mattermost setup instructions
### Bug Fixes
- Fix the most recent ping lookup in the "Ping Details" dialog

3
hc/front/tests/test_add_mattermost.py

@ -15,6 +15,9 @@ class AddMattermostTestCase(BaseTestCase):
self.client.login(username="alice@example.org", password="password")
r = self.client.get(self.url)
self.assertContains(r, "Integration Settings", status_code=200)
self.assertNotContains(
r, "click on <strong>Add Integration</strong>", status_code=200
)
def test_it_works(self):
form = {"value": "http://example.org"}

20
hc/front/tests/test_mattermost_help.py

@ -0,0 +1,20 @@
from __future__ import annotations
from django.test.utils import override_settings
from hc.test import BaseTestCase
@override_settings(MATTERMOST_ENABLED=True)
class AddSlackHelpTestCase(BaseTestCase):
def test_instructions_work(self):
r = self.client.get("/integrations/mattermost/")
self.assertContains(r, "please sign into Mychecks", status_code=200)
self.assertContains(
r, "click on <strong>Add Integration</strong>", status_code=200
)
@override_settings(MATTERMOST_ENABLED=False)
def test_it_requires_mattermost_enabled(self):
r = self.client.get("/integrations/mattermost/")
self.assertEqual(r.status_code, 404)

1
hc/front/urls.py

@ -36,6 +36,7 @@ channel_urls = [
path("telegram/", views.telegram_help, name="hc-telegram-help"),
path("telegram/bot/", views.telegram_bot, name="hc-telegram-webhook"),
path("pagerduty/", views.pd_help, name="hc-pagerduty-help"),
path("mattermost/", views.mattermost_help, name="hc-mattermost-help"),
path("add_slack/", views.slack_help, name="hc-slack-help"),
path("add_slack_btn/", views.add_slack_complete),
path("add_telegram/", views.add_telegram, name="hc-add-telegram"),

5
hc/front/views.py

@ -1463,6 +1463,11 @@ def add_slack_complete(request: HttpRequest) -> HttpResponse:
return redirect("hc-channels", project.code)
@require_setting("MATTERMOST_ENABLED")
def mattermost_help(request):
return render(request, "integrations/add_mattermost.html")
@require_setting("MATTERMOST_ENABLED")
@login_required
def add_mattermost(request, code):

BIN
static/img/integrations/setup_mattermost_1.png

Before

Width: 523  |  Height: 401  |  Size: 19 KiB

After

Width: 1475  |  Height: 1055  |  Size: 32 KiB

BIN
static/img/integrations/setup_mattermost_2.png

Before

Width: 959  |  Height: 747  |  Size: 31 KiB

After

Width: 1627  |  Height: 1387  |  Size: 38 KiB

BIN
static/img/integrations/setup_mattermost_3.png

Before

Width: 965  |  Height: 443  |  Size: 22 KiB

After

Width: 1634  |  Height: 705  |  Size: 21 KiB

BIN
static/img/integrations/setup_mattermost_4.png

After

Width: 2090  |  Height: 1484  |  Size: 63 KiB

BIN
static/img/integrations/setup_mattermost_5.png

After

Width: 2045  |  Height: 401  |  Size: 7.7 KiB

76
templates/integrations/add_mattermost.html

@ -2,17 +2,39 @@
{% load humanize static hc_extras %}
{% block title %}Mattermost Integration for {{ site_name }}{% endblock %}
{% block description %}
<meta name="description" content="If your team uses Mattermost, you can set up {{ site_name }} to post alerts directly to an appropriate Mattermost channel when a check goes up or down.">
{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-12">
<h1>Mattermost</h1>
<div class="jumbotron">
{% if request.user.is_authenticated %}
<p>
If your team uses <a href="https://mattermost.com/">Mattermost</a>,
you can set up {{ site_name }} to post alerts directly to an
appropriate Mattermost channel when a check goes <strong>up</strong>
or <strong>down</strong>.
</p>
{% else %}
<p>
{{ site_name }} is a free and
<a href="https://github.com/healthchecks/healthchecks">open source</a>
service for monitoring <strong>cron jobs</strong>, <strong>background processes</strong> and
<strong>scheduled tasks</strong>. When {% site_name %} detects a problem, it can notify
you by posting to a Mattermost channel. To set up the Mattermost
integration, please sign into {{ site_name }}:
</p>
<p>If your team uses <a href="https://mattermost.com/">Mattermost</a>, you can set
up {{ site_name }} to post status updates directly to an appropriate
Mattermost channel.</p>
<div class="text-center">
<a href="{% url 'hc-login' %}"
class="btn btn-primary btn-lg">Sign In</a>
</div>
{% endif %}
</div>
<h2>Setup Guide</h2>
@ -21,7 +43,7 @@
<span class="step-no"></span>
Log into your Mattermost account and
select <strong>Integrations</strong> in the
hamburger menu.
top left menu.
</div>
<div class="col-sm-6">
<img
@ -50,8 +72,12 @@
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no"></span>
<p>Copy the displayed <strong>URL</strong> and paste it down below.</p>
<p>Save the integration, and it's done!</p>
{% if project %}
<p>Copy the displayed <strong>URL</strong> and paste it in the form below.</p>
<p>Save the integration, and you are all set!</p>
{% else %}
<p>Copy the displayed <strong>URL</strong>.</p>
{% endif %}
</div>
<div class="col-sm-6">
<img
@ -61,8 +87,40 @@
</div>
</div>
<h2>Integration Settings</h2>
{% if not project %}
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no"></span>
<p>Sign into {% site_name %}, then go to the <strong>Integrations</strong>
page and click on <strong>Add Integration</strong> next to the
Mattermost integration.
</p>
</div>
<div class="col-sm-6">
<img
class="ai-guide-screenshot"
alt="Screenshot"
src="{% static 'img/integrations/setup_mattermost_4.png' %}">
</div>
</div>
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no"></span>
<p>Paste the copied <strong>URL</strong> in the form.</p>
<p>Save the integration, and you are all set!</p>
</div>
<div class="col-sm-6">
<img
class="ai-guide-screenshot"
alt="Screenshot"
src="{% static 'img/integrations/setup_mattermost_5.png' %}">
</div>
</div>
{% endif %}
{% if project %}
<h2>Integration Settings</h2>
<form method="post" class="form-horizontal">
{% csrf_token %}
<div class="form-group {{ form.value.css_classes }}">
@ -91,7 +149,7 @@
</div>
</div>
</form>
{% endif %}
</div>
</div>
{% endblock %}
Loading…
Cancel
Save