feat: Enhance logs view with support for displaying all entries and improved pagination

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Ross
2026-04-29 22:37:13 +01:00
co-authored by Copilot
parent 7479b44f53
commit 2478de6b98
2 changed files with 34 additions and 30 deletions
+10 -2
View File
@@ -243,10 +243,12 @@ def logs_view(request):
Scope: superusers only.
Functionality: reads log.txt, displays entries with optional text search filter.
Supports ?all=1 to show all entries without pagination limit.
"""
log_file_path = os.path.join(settings.BASE_DIR, "log.txt")
entries = []
search_query = request.GET.get("q", "").strip()
show_all = request.GET.get("all") == "1"
if os.path.exists(log_file_path):
try:
@@ -267,14 +269,20 @@ def logs_view(request):
else:
entries = [f"Log file not found at {log_file_path}"]
total = len(entries)
limit = None if show_all else 500
displayed_entries = entries[:limit] if limit else entries
return render(
request,
"logs_viewer.html",
{
"entries": entries[:500],
"total_entries": len(entries),
"entries": displayed_entries,
"total_entries": total,
"search_query": search_query,
"log_file_path": log_file_path,
"show_all": show_all,
"limit": limit,
},
)