diff --git a/atst/routes/__init__.py b/atst/routes/__init__.py index 780ff0c3..1885f5c7 100644 --- a/atst/routes/__init__.py +++ b/atst/routes/__init__.py @@ -121,9 +121,17 @@ def logout(): return redirect(url_for(".root")) +def pagination_info(request, default_page=1, default_per_page=50): + return { + "page": int(request.args.get("page", default_page)), + "per_page": int(request.args.get("per_page", default_per_page)), + } + + @bp.route("/activity-history") def activity_history(): - audit_events = AuditLog.get_all_events(g.current_user) + pagination = pagination_info(request) + audit_events = AuditLog.get_all_events(g.current_user, pagination) return render_template("audit_log.html", audit_events=audit_events) diff --git a/templates/audit_log.html b/templates/audit_log.html index 7010c0ad..b5c8fc1d 100644 --- a/templates/audit_log.html +++ b/templates/audit_log.html @@ -40,5 +40,13 @@ + {% for i in range(1, audit_events.pages + 1) %} + {% if i == audit_events.page %} + {{ i }} + {% else %} + {{ i }} + {% endif %} + {% endfor %} + {% endblock %}