organize the recent checks
This commit is contained in:
18
app/main.py
18
app/main.py
@@ -140,10 +140,22 @@ def report(service_id):
|
||||
from_ts, to_ts, from_display, to_display = _parse_report_dates(from_ts, to_ts, preset)
|
||||
status_filter = request.args.get("status")
|
||||
search = request.args.get("search", "").strip() or None
|
||||
page = max(1, int(request.args.get("page", 1)))
|
||||
per_page = min(100, max(10, int(request.args.get("per_page", 25))))
|
||||
stats = models.get_report_stats(service_id, from_ts=from_ts, to_ts=to_ts)
|
||||
checks = models.get_checks(service_id, limit=100, from_ts=from_ts, to_ts=to_ts, status_filter=status_filter, search=search)
|
||||
checks_total = models.get_checks_count(service_id, from_ts=from_ts, to_ts=to_ts, status_filter=status_filter, search=search)
|
||||
checks = models.get_checks(
|
||||
service_id,
|
||||
limit=per_page,
|
||||
offset=(page - 1) * per_page,
|
||||
from_ts=from_ts,
|
||||
to_ts=to_ts,
|
||||
status_filter=status_filter,
|
||||
search=search,
|
||||
)
|
||||
chart_checks = models.get_checks(service_id, limit=200, from_ts=from_ts, to_ts=to_ts)
|
||||
period_label = _format_period_label(from_display, to_display) if (from_ts or to_ts) else None
|
||||
total_pages = (checks_total + per_page - 1) // per_page if checks_total else 1
|
||||
return render_template(
|
||||
"report.html",
|
||||
service=dict(svc),
|
||||
@@ -157,6 +169,10 @@ def report(service_id):
|
||||
preset=preset,
|
||||
status_filter=status_filter or "",
|
||||
search=search or "",
|
||||
page=page,
|
||||
per_page=per_page,
|
||||
checks_total=checks_total,
|
||||
total_pages=total_pages,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user