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 the `pruneflips` management command
|
||||||
- Add Mattermost integration (#276)
|
- Add Mattermost integration (#276)
|
||||||
- Three choices in timezone switcher (UTC / check's timezone / browser's timezone) (#278)
|
- 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
|
## Bug Fixes
|
||||||
- Fix javascript code to construct correct URLs when running from a subdirectory (#273)
|
- 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):
|
def test_it_works(self):
|
||||||
self.client.login(username="alice@example.org", password="password")
|
self.client.login(username="alice@example.org", password="password")
|
||||||
r = self.client.post(self.url)
|
r = self.client.post(self.url)
|
||||||
self.assertRedirects(r, self.redirect_url)
|
|
||||||
check = Check.objects.get()
|
check = Check.objects.get()
|
||||||
self.assertEqual(check.project, self.project)
|
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):
|
def test_it_handles_unset_current_project(self):
|
||||||
self.profile.current_project = None
|
self.profile.current_project = None
|
||||||
self.profile.save()
|
self.profile.save()
|
||||||
|
|
||||||
self.client.login(username="alice@example.org", password="password")
|
self.client.login(username="alice@example.org", password="password")
|
||||||
r = self.client.post(self.url)
|
r = self.client.post(self.url)
|
||||||
self.assertRedirects(r, self.redirect_url)
|
|
||||||
check = Check.objects.get()
|
check = Check.objects.get()
|
||||||
self.assertEqual(check.project, self.project)
|
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):
|
def test_team_access_works(self):
|
||||||
self.client.login(username="bob@example.org", password="password")
|
self.client.login(username="bob@example.org", password="password")
|
||||||
self.client.post(self.url)
|
self.client.post(self.url)
|
||||||
|
@ -43,3 +43,8 @@ class DetailsTestCase(BaseTestCase):
|
|||||||
self.client.login(username="bob@example.org", password="password")
|
self.client.login(username="bob@example.org", password="password")
|
||||||
r = self.client.get(self.url)
|
r = self.client.get(self.url)
|
||||||
self.assertEqual(r.status_code, 200)
|
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()
|
check.assign_all_channels()
|
||||||
|
|
||||||
return redirect("hc-checks", code)
|
url = reverse("hc-details", args=[check.code])
|
||||||
|
return redirect(url + "?new")
|
||||||
|
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
@ -478,6 +479,7 @@ def details(request, code):
|
|||||||
"channels": channels,
|
"channels": channels,
|
||||||
"timezones": pytz.all_timezones,
|
"timezones": pytz.all_timezones,
|
||||||
"downtimes": check.downtimes(months=3),
|
"downtimes": check.downtimes(months=3),
|
||||||
|
"is_new": "new" in request.GET,
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(request, "front/details.html", ctx)
|
return render(request, "front/details.html", ctx)
|
||||||
|
@ -95,3 +95,11 @@
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert.no-events {
|
||||||
|
border: #ddd;
|
||||||
|
background: #F5F5F5;
|
||||||
|
color: #444;
|
||||||
|
text-align: center;
|
||||||
|
padding: 32px;
|
||||||
|
}
|
||||||
|
@ -6,6 +6,11 @@ $(function () {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#new-check-alert a").click(function() {
|
||||||
|
$("#" + this.dataset.target).click();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
$("#edit-desc").click(function() {
|
$("#edit-desc").click(function() {
|
||||||
$('#update-name-modal').modal("show");
|
$('#update-name-modal').modal("show");
|
||||||
$("#update-desc-input").focus();
|
$("#update-desc-input").focus();
|
||||||
|
@ -7,6 +7,26 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="row">
|
<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">
|
<div id="details-head" class="col-sm-12">
|
||||||
<h1>
|
<h1>
|
||||||
{{ check.name_then_code }}
|
{{ check.name_then_code }}
|
||||||
@ -18,14 +38,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</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="col-sm-5">
|
||||||
<div class="details-block">
|
<div class="details-block">
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
|
@ -91,5 +91,8 @@
|
|||||||
<a href="{% url 'hc-log' check.code %}">Show More…</a>
|
<a href="{% url 'hc-log' check.code %}">Show More…</a>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user