Merge pull request #444 from dod-ccpo/paginate-audit-log

Paginate audit log
This commit is contained in:
richard-dds
2018-11-19 10:58:07 -05:00
committed by GitHub
8 changed files with 133 additions and 6 deletions

View File

@@ -121,9 +121,17 @@ def logout():
return redirect(url_for(".root"))
def get_pagination_opts(request, default_page=1, default_per_page=100):
return {
"page": int(request.args.get("page", default_page)),
"per_page": int(request.args.get("perPage", default_per_page)),
}
@bp.route("/activity-history")
def activity_history():
audit_events = AuditLog.get_all_events(g.current_user)
pagination_opts = get_pagination_opts(request)
audit_events = AuditLog.get_all_events(g.current_user, pagination_opts)
return render_template("audit_log.html", audit_events=audit_events)