Show "The HipChat integration has been added!" message, tweaks to HipChat setup instructions.

This commit is contained in:
Pēteris Caune 2017-08-26 19:04:00 +03:00
parent 40bc11782e
commit 2a7a7e0272
5 changed files with 40 additions and 20 deletions

View File

@ -47,3 +47,10 @@ class ChannelsTestCase(BaseTestCase):
self.assertEqual(r.status_code, 200)
self.assertContains(r, "fake-key")
self.assertContains(r, "(normal priority)")
def test_it_shows_added_message(self):
self.client.login(username="alice@example.org", password="password")
r = self.client.get("/integrations/?added=hipchat")
self.assertEqual(r.status_code, 200)
self.assertContains(r, "The HipChat integration has been added!")

View File

@ -1,6 +1,5 @@
from collections import Counter
from datetime import datetime, timedelta as td
from itertools import tee
import json
from croniter import croniter
@ -11,7 +10,7 @@ from django.contrib.auth.decorators import login_required
from django.core import signing
from django.db.models import Count
from django.http import (Http404, HttpResponse, HttpResponseBadRequest,
HttpResponseForbidden, JsonResponse)
HttpResponseForbidden)
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.urls import reverse
@ -34,14 +33,6 @@ from pytz.exceptions import UnknownTimeZoneError
import requests
# from itertools recipes:
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return zip(a, b)
@login_required
def my_checks(request):
q = Check.objects.filter(user=request.team.user).order_by("created")
@ -140,6 +131,7 @@ def docs_api(request):
return render(request, "front/docs_api.html", ctx)
def docs_cron(request):
ctx = {"page": "docs", "section": "cron"}
return render(request, "front/docs_cron.html", ctx)
@ -358,8 +350,10 @@ def channels(request):
"enable_pushover": settings.PUSHOVER_API_TOKEN is not None,
"enable_discord": settings.DISCORD_CLIENT_ID is not None,
"enable_telegram": settings.TELEGRAM_TOKEN is not None,
"enable_sms": settings.TWILIO_AUTH is not None
"enable_sms": settings.TWILIO_AUTH is not None,
"added": request.GET.get("added")
}
return render(request, "front/channels.html", ctx)

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -6,11 +6,16 @@
{% block content %}
<div class="row">
{% if messages %}
{% if messages or added %}
<div class="col-sm-12">
{% for message in messages %}
<p class="alert alert-{{ message.tags }}">{{ message }}</p>
{% endfor %}
{% if added == "hipchat" %}
<p class="alert alert-info">
The HipChat integration has been added!
</p>
{% endif %}
</div>
{% endif %}

View File

@ -61,7 +61,7 @@
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no">2</span>
<span class="step-no">1</span>
<p>
After {% if request.user.is_authenticated %}{% else %}logging in and{% endif %}
clicking on "Install HipChat Integration", you will be
@ -78,7 +78,7 @@
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no">3</span>
<span class="step-no">2</span>
<p>
Next, HipChat will let you select the chat room
for receiving {% site_name %} notifications.
@ -94,14 +94,11 @@
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no">4</span>
<span class="step-no">3</span>
<p>
As the final step, HipChat will show you the permissions
Next, HipChat will show you the permissions
requested by {% site_name %}. There's only one permission
needed"Send Notification". After clicking on "Approve"
you will be redirected back to
"Integrations" page on {% site_name %} and see
the new integration!
needed: "Send Notification".
</p>
</div>
<div class="col-sm-6">
@ -112,6 +109,23 @@
</div>
</div>
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no">4</span>
<p>
That is all! You will now be redirected back to
"Integrations" page on {% site_name %} and see
the new integration!
</p>
</div>
<div class="col-sm-6">
<img
class="ai-guide-screenshot"
alt="Screenshot"
src="{% static 'img/integrations/setup_hipchat_4.png' %}">
</div>
</div>
</div>
</div>
{% endblock %}