diff --git a/hc/front/tests/test_log.py b/hc/front/tests/test_log.py index f798d579..76e47a90 100644 --- a/hc/front/tests/test_log.py +++ b/hc/front/tests/test_log.py @@ -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) diff --git a/templates/front/details_events.html b/templates/front/details_events.html index e02c8820..4ada94f4 100644 --- a/templates/front/details_events.html +++ b/templates/front/details_events.html @@ -53,34 +53,7 @@ - {% 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 %} -
- Error: {{ event.error }} - {% endif %} + {% include "front/event_summary.html" %} {% endif %} diff --git a/templates/front/event_summary.html b/templates/front/event_summary.html new file mode 100644 index 00000000..450196df --- /dev/null +++ b/templates/front/event_summary.html @@ -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 %} +
+ Error: {{ event.error }} +{% endif %} \ No newline at end of file diff --git a/templates/front/log.html b/templates/front/log.html index 26dd9ac8..aa0e93ef 100644 --- a/templates/front/log.html +++ b/templates/front/log.html @@ -103,34 +103,7 @@ - {% 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 %} -
- Error: {{ event.error }} - {% endif %} + {% include "front/event_summary.html" %} {% endif %}