Improve alert summaries in ping log

This commit is contained in:
Pēteris Caune 2019-11-19 15:29:38 +02:00
parent 84bc6e7b2c
commit 494fd9ffb7
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
4 changed files with 49 additions and 57 deletions

View File

@ -61,7 +61,7 @@ class LogTestCase(BaseTestCase):
self.client.login(username="alice@example.org", password="password")
r = self.client.get(self.url)
self.assertContains(r, "Sent email alert to alice@example.org", status_code=200)
self.assertContains(r, "Sent email to alice@example.org", status_code=200)
def test_it_shows_pushover_notification(self):
ch = Channel.objects.create(kind="po", project=self.project)

View File

@ -53,34 +53,7 @@
<td class="date"></td>
<td class="time"></td>
<td class="alert-info" colspan="2">
{% if event.channel.kind == "email" %}
Sent email alert to {{ event.channel.email_value }}
{% elif event.channel.kind == "slack" %}
Sent Slack alert
{% if event.channel.slack_channel %}
to {{ event.channel.slack_channel }}
{% endif %}
{% elif event.channel.kind == "pd" %}
Sent alert to PagerDuty
{% elif event.channel.kind == "pagertree" %}
Sent alert to PagerTree
{% elif event.channel.kind == "pagerteam" %}
Sent alert to Pager Team
{% elif event.channel.kind == "opsgenie" %}
Sent alert to OpsGenie
{% elif event.channel.kind == "hipchat" %}
Sent alert to HipChat
{% elif event.channel.kind == "po" %}
Sent a Pushover notification
{% elif event.channel.kind == "webhook" %}
Called webhook {{ event.channel.url_down }}
{% else %}
Sent alert to {{ event.channel.kind|capfirst }}
{% endif %}
{% if event.error %}
<br />
<strong>Error: {{ event.error }}</strong>
{% endif %}
{% include "front/event_summary.html" %}
</td>
</tr>
{% endif %}

View File

@ -0,0 +1,46 @@
{% if event.channel.kind == "email" %}
Sent email to {{ event.channel.email_value }}
{% elif event.channel.kind == "slack" %}
Sent Slack alert
{% if event.channel.slack_channel %}
to {{ event.channel.slack_channel }}
{% endif %}
{% elif event.channel.kind == "pd" %}
Sent alert to PagerDuty
{% elif event.channel.kind == "pagertree" %}
Sent alert to PagerTree
{% elif event.channel.kind == "pagerteam" %}
Sent alert to Pager Team
{% elif event.channel.kind == "opsgenie" %}
Sent alert to OpsGenie
{% elif event.channel.kind == "hipchat" %}
Sent alert to HipChat
{% elif event.channel.kind == "po" %}
Sent a Pushover notification
{% elif event.channel.kind == "webhook" %}
Called webhook {{ event.channel.url_down }}
{% elif event.channel.kind == "msteams" %}
Sent alert to Microsoft Teams
{% if event.channel.name %}
({{ event.channel.name }})
{% endif %}
{% elif event.channel.kind == "sms" %}
Sent SMS to {{ event.channel.sms_number }}
{% if event.channel.name %}
({{ event.channel.name }})
{% endif %}
{% elif event.channel.kind == "whatsapp" %}
Sent WhatsApp message to {{ event.channel.sms_number }}
{% if event.channel.name %}
({{ event.channel.name }})
{% endif %}
{% elif event.channel.kind == "trello" %}
Added Trello card in
board "{{ event.channel.trello_board_list|first }}"
{% else %}
Sent alert to {{ event.channel.kind|capfirst }}
{% endif %}
{% if event.error %}
<br />
<strong>Error: {{ event.error }}</strong>
{% endif %}

View File

@ -103,34 +103,7 @@
<td class="date"></td>
<td class="time"></td>
<td class="alert-info" colspan="2">
{% if event.channel.kind == "email" %}
Sent email alert to {{ event.channel.email_value }}
{% elif event.channel.kind == "slack" %}
Sent Slack alert
{% if event.channel.slack_channel %}
to {{ event.channel.slack_channel }}
{% endif %}
{% elif event.channel.kind == "pd" %}
Sent alert to PagerDuty
{% elif event.channel.kind == "pagertree" %}
Sent alert to PagerTree
{% elif event.channel.kind == "pagerteam" %}
Sent alert to Pager Team
{% elif event.channel.kind == "opsgenie" %}
Sent alert to OpsGenie
{% elif event.channel.kind == "hipchat" %}
Sent alert to HipChat
{% elif event.channel.kind == "po" %}
Sent a Pushover notification
{% elif event.channel.kind == "webhook" %}
Called webhook {{ event.channel.url_down }}
{% else %}
Sent alert to {{ event.channel.kind|capfirst }}
{% endif %}
{% if event.error %}
<br />
<strong>Error: {{ event.error }}</strong>
{% endif %}
{% include "front/event_summary.html" %}
</td>
</tr>
{% endif %}