log: log list was displaying much less entries than required on webadmin

This commit is contained in:
Alexandre Aubin 2021-09-16 20:46:36 +02:00
parent 2181bc1bab
commit c4fe991701

View file

@ -69,7 +69,13 @@ def log_list(limit=None, with_details=False, with_suboperations=False):
logs = list(reversed(sorted(logs)))
if limit is not None:
logs = logs[:limit]
if with_suboperations:
logs = logs[:limit]
else:
# If we displaying only parent, we are still gonna load up to limit * 5 logs
# because many of them are suboperations which are not gonna be kept
# Yet we still want to obtain ~limit number of logs
logs = logs[:limit * 5]
for log in logs:
@ -122,6 +128,9 @@ def log_list(limit=None, with_details=False, with_suboperations=False):
else:
operations = [o for o in operations.values()]
if limit:
operations = operations[:limit]
operations = list(reversed(sorted(operations, key=lambda o: o["name"])))
# Reverse the order of log when in cli, more comfortable to read (avoid
# unecessary scrolling)