Browse Source

In hc.front.views.ping_details, if a ping does not exist, return a friendly message

pull/328/head
Pēteris Caune 5 years ago
parent
commit
c8ccd89af2
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
4 changed files with 7 additions and 3 deletions
  1. +1
    -1
      CHANGELOG.md
  2. +1
    -1
      hc/front/tests/test_ping_details.py
  3. +1
    -1
      hc/front/views.py
  4. +4
    -0
      templates/front/ping_details_not_found.html

+ 1
- 1
CHANGELOG.md View File

@ -21,7 +21,7 @@ All notable changes to this project will be documented in this file.
- Don't trigger "down" notifications when changing schedule interactively in web UI
- Fix sendalerts crash loop when encountering a bad cron schedule
- Stricter cron validation, reject schedules like "At midnight of February 31"
- In hc.front.views.ping_details, if a ping does not exist, return 404 instead of 500
- In hc.front.views.ping_details, if a ping does not exist, return a friendly message
## v1.12.0 - 2020-01-02


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

@ -58,4 +58,4 @@ class LastPingTestCase(BaseTestCase):
self.client.login(username="[email protected]", password="password")
r = self.client.get("/checks/%s/pings/123/" % check.code)
self.assertEqual(r.status_code, 404)
self.assertContains(r, "No additional information is", status_code=200)

+ 1
- 1
hc/front/views.py View File

@ -427,7 +427,7 @@ def ping_details(request, code, n=None):
try:
ping = q.latest("created")
except Ping.DoesNotExist:
raise Http404("not found")
return render(request, "front/ping_details_not_found.html")
ctx = {"check": check, "ping": ping}


+ 4
- 0
templates/front/ping_details_not_found.html View File

@ -0,0 +1,4 @@
<div class="modal-body">
<h3>Not Found</h3>
<p>No additional information is available for this event.</p>
</div>

Loading…
Cancel
Save