Browse Source

Improve alert summaries in ping log

pull/307/head
Pēteris Caune 5 years ago
parent
commit
494fd9ffb7
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
4 changed files with 49 additions and 57 deletions
  1. +1
    -1
      hc/front/tests/test_log.py
  2. +1
    -28
      templates/front/details_events.html
  3. +46
    -0
      templates/front/event_summary.html
  4. +1
    -28
      templates/front/log.html

+ 1
- 1
hc/front/tests/test_log.py View File

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


+ 1
- 28
templates/front/details_events.html 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 %}


+ 46
- 0
templates/front/event_summary.html 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 %}

+ 1
- 28
templates/front/log.html 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 %}


Loading…
Cancel
Save