forked from GithubBackups/healthchecks
After adding a new check redirect to the "Check Details" page.
This commit is contained in:
parent
dfee69584b
commit
339ac5e9d9
@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Add the `pruneflips` management command
|
||||
- Add Mattermost integration (#276)
|
||||
- Three choices in timezone switcher (UTC / check's timezone / browser's timezone) (#278)
|
||||
- After adding a new check redirect to the "Check Details" page
|
||||
|
||||
## Bug Fixes
|
||||
- Fix javascript code to construct correct URLs when running from a subdirectory (#273)
|
||||
|
@ -12,20 +12,26 @@ class AddCheckTestCase(BaseTestCase):
|
||||
def test_it_works(self):
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.post(self.url)
|
||||
self.assertRedirects(r, self.redirect_url)
|
||||
|
||||
check = Check.objects.get()
|
||||
self.assertEqual(check.project, self.project)
|
||||
|
||||
redirect_url = "/checks/%s/details/?new" % check.code
|
||||
self.assertRedirects(r, redirect_url)
|
||||
|
||||
def test_it_handles_unset_current_project(self):
|
||||
self.profile.current_project = None
|
||||
self.profile.save()
|
||||
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.post(self.url)
|
||||
self.assertRedirects(r, self.redirect_url)
|
||||
|
||||
check = Check.objects.get()
|
||||
self.assertEqual(check.project, self.project)
|
||||
|
||||
redirect_url = "/checks/%s/details/?new" % check.code
|
||||
self.assertRedirects(r, redirect_url)
|
||||
|
||||
def test_team_access_works(self):
|
||||
self.client.login(username="bob@example.org", password="password")
|
||||
self.client.post(self.url)
|
||||
|
@ -43,3 +43,8 @@ class DetailsTestCase(BaseTestCase):
|
||||
self.client.login(username="bob@example.org", password="password")
|
||||
r = self.client.get(self.url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
def test_it_shows_new_check_notice(self):
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.get(self.url + "?new")
|
||||
self.assertContains(r, "Your new check is ready!", status_code=200)
|
||||
|
@ -292,7 +292,8 @@ def add_check(request, code):
|
||||
|
||||
check.assign_all_channels()
|
||||
|
||||
return redirect("hc-checks", code)
|
||||
url = reverse("hc-details", args=[check.code])
|
||||
return redirect(url + "?new")
|
||||
|
||||
|
||||
@require_POST
|
||||
@ -478,6 +479,7 @@ def details(request, code):
|
||||
"channels": channels,
|
||||
"timezones": pytz.all_timezones,
|
||||
"downtimes": check.downtimes(months=3),
|
||||
"is_new": "new" in request.GET,
|
||||
}
|
||||
|
||||
return render(request, "front/details.html", ctx)
|
||||
|
@ -95,3 +95,11 @@
|
||||
font-weight: normal;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.alert.no-events {
|
||||
border: #ddd;
|
||||
background: #F5F5F5;
|
||||
color: #444;
|
||||
text-align: center;
|
||||
padding: 32px;
|
||||
}
|
||||
|
@ -6,6 +6,11 @@ $(function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#new-check-alert a").click(function() {
|
||||
$("#" + this.dataset.target).click();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#edit-desc").click(function() {
|
||||
$('#update-name-modal').modal("show");
|
||||
$("#update-desc-input").focus();
|
||||
|
@ -7,6 +7,26 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
{% if is_new %}
|
||||
<div class="col-sm-12">
|
||||
<p id="new-check-alert" class="alert alert-success">
|
||||
<strong>Your new check is ready!</strong>
|
||||
You can now
|
||||
<a data-target="edit-name" href="#" >give it a name</a>
|
||||
or
|
||||
<a data-target="edit-timeout" href="#" >set its schedule</a>.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if messages %}
|
||||
<div class="col-sm-12">
|
||||
{% for message in messages %}
|
||||
<p class="alert alert-{{ message.tags }}">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="details-head" class="col-sm-12">
|
||||
<h1>
|
||||
{{ check.name_then_code }}
|
||||
@ -18,14 +38,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if messages %}
|
||||
<div class="col-sm-12">
|
||||
{% for message in messages %}
|
||||
<p class="alert alert-{{ message.tags }}">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col-sm-5">
|
||||
<div class="details-block">
|
||||
<h2>Description</h2>
|
||||
|
@ -91,5 +91,8 @@
|
||||
<a href="{% url 'hc-log' check.code %}">Show More…</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<div class="alert alert-info">This check has not received any pings yet.</div>
|
||||
<div class="alert no-events">
|
||||
You will see a live-updating log of received pings here. <br />
|
||||
This check has not received any pings yet.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user