forked from GithubBackups/healthchecks
Improve alert summaries in ping log
This commit is contained in:
parent
84bc6e7b2c
commit
494fd9ffb7
@ -61,7 +61,7 @@ class LogTestCase(BaseTestCase):
|
|||||||
|
|
||||||
self.client.login(username="alice@example.org", password="password")
|
self.client.login(username="alice@example.org", password="password")
|
||||||
r = self.client.get(self.url)
|
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):
|
def test_it_shows_pushover_notification(self):
|
||||||
ch = Channel.objects.create(kind="po", project=self.project)
|
ch = Channel.objects.create(kind="po", project=self.project)
|
||||||
|
@ -53,34 +53,7 @@
|
|||||||
<td class="date"></td>
|
<td class="date"></td>
|
||||||
<td class="time"></td>
|
<td class="time"></td>
|
||||||
<td class="alert-info" colspan="2">
|
<td class="alert-info" colspan="2">
|
||||||
{% if event.channel.kind == "email" %}
|
{% include "front/event_summary.html" %}
|
||||||
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 %}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
46
templates/front/event_summary.html
Normal file
46
templates/front/event_summary.html
Normal 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 %}
|
@ -103,34 +103,7 @@
|
|||||||
<td class="date"></td>
|
<td class="date"></td>
|
||||||
<td class="time"></td>
|
<td class="time"></td>
|
||||||
<td class="alert-info" colspan="2">
|
<td class="alert-info" colspan="2">
|
||||||
{% if event.channel.kind == "email" %}
|
{% include "front/event_summary.html" %}
|
||||||
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 %}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user