forked from GithubBackups/healthchecks
Show 20 most recent pings by default.
This commit is contained in:
parent
8e7b05f96e
commit
8b01acefe2
@ -208,7 +208,7 @@ def update_name(request, code):
|
|||||||
check.tags = form.cleaned_data["tags"]
|
check.tags = form.cleaned_data["tags"]
|
||||||
check.save()
|
check.save()
|
||||||
|
|
||||||
if request.META.get("HTTP_REFERER", "").endswith("/log/"):
|
if "/log/" in request.META.get("HTTP_REFERER", ""):
|
||||||
return redirect("hc-log", code)
|
return redirect("hc-log", code)
|
||||||
|
|
||||||
return redirect("hc-checks")
|
return redirect("hc-checks")
|
||||||
@ -245,7 +245,7 @@ def update_timeout(request, code):
|
|||||||
|
|
||||||
check.save()
|
check.save()
|
||||||
|
|
||||||
if request.META.get("HTTP_REFERER", "").endswith("/log/"):
|
if "/log/" in request.META.get("HTTP_REFERER", ""):
|
||||||
return redirect("hc-log", code)
|
return redirect("hc-log", code)
|
||||||
|
|
||||||
return redirect("hc-checks")
|
return redirect("hc-checks")
|
||||||
@ -305,7 +305,7 @@ def pause(request, code):
|
|||||||
check.status = "paused"
|
check.status = "paused"
|
||||||
check.save()
|
check.save()
|
||||||
|
|
||||||
if request.META.get("HTTP_REFERER", "").endswith("/log/"):
|
if "/log/" in request.META.get("HTTP_REFERER", ""):
|
||||||
return redirect("hc-log", code)
|
return redirect("hc-log", code)
|
||||||
|
|
||||||
return redirect("hc-checks")
|
return redirect("hc-checks")
|
||||||
@ -329,11 +329,15 @@ def log(request, code):
|
|||||||
if check.user != request.team.user:
|
if check.user != request.team.user:
|
||||||
return HttpResponseForbidden()
|
return HttpResponseForbidden()
|
||||||
|
|
||||||
limit = request.team.ping_log_limit
|
limit = 20
|
||||||
|
team_limit = request.team.ping_log_limit
|
||||||
|
if "full_log" in request.GET:
|
||||||
|
limit = team_limit
|
||||||
|
|
||||||
pings = Ping.objects.filter(owner=check).order_by("-id")[:limit + 1]
|
pings = Ping.objects.filter(owner=check).order_by("-id")[:limit + 1]
|
||||||
pings = list(pings)
|
pings = list(pings)
|
||||||
|
|
||||||
num_pings = len(pings)
|
can_load_more = len(pings) > limit
|
||||||
pings = pings[:limit]
|
pings = pings[:limit]
|
||||||
|
|
||||||
alerts = []
|
alerts = []
|
||||||
@ -355,9 +359,8 @@ def log(request, code):
|
|||||||
"ping_endpoint": settings.PING_ENDPOINT,
|
"ping_endpoint": settings.PING_ENDPOINT,
|
||||||
"channels": channels,
|
"channels": channels,
|
||||||
"events": events,
|
"events": events,
|
||||||
"num_pings": min(num_pings, limit),
|
"num_showing": len(pings),
|
||||||
"limit": limit,
|
"can_load_more": can_load_more
|
||||||
"show_limit_notice": num_pings > limit and settings.USE_PAYMENTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(request, "front/log.html", ctx)
|
return render(request, "front/log.html", ctx)
|
||||||
|
@ -259,13 +259,10 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% if show_limit_notice and limit < 1000 %}
|
{% if can_load_more %}
|
||||||
<p class="alert alert-info">
|
<p class="text-center">
|
||||||
<strong>Showing last {{ limit }} pings.</strong>
|
Showing {{ num_showing }} most recent pings.
|
||||||
Want to see more?
|
<a href="?full_log=1">Load More…</a>
|
||||||
<a href="{% url 'hc-pricing' %}">
|
|
||||||
Upgrade your account!
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user