mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] allow to limit to number of journals per categories
This commit is contained in:
parent
278f692a2f
commit
5dcf0b782f
2 changed files with 9 additions and 1 deletions
|
@ -1600,3 +1600,8 @@ journals:
|
||||||
list:
|
list:
|
||||||
action_help: List journals
|
action_help: List journals
|
||||||
api: GET /journals
|
api: GET /journals
|
||||||
|
arguments:
|
||||||
|
-l:
|
||||||
|
full: --limit
|
||||||
|
help: Maximum number of journals per categories
|
||||||
|
type: int
|
||||||
|
|
|
@ -36,7 +36,7 @@ JOURNALS_PATH = '/var/log/journals/'
|
||||||
logger = getActionLogger('yunohost.journals')
|
logger = getActionLogger('yunohost.journals')
|
||||||
|
|
||||||
|
|
||||||
def journals_list():
|
def journals_list(limit=None):
|
||||||
"""
|
"""
|
||||||
List domains
|
List domains
|
||||||
|
|
||||||
|
@ -66,6 +66,9 @@ def journals_list():
|
||||||
|
|
||||||
result[category] = list(reversed(sorted(result[category], key=lambda x: x["started_at"])))
|
result[category] = list(reversed(sorted(result[category], key=lambda x: x["started_at"])))
|
||||||
|
|
||||||
|
if limit is not None:
|
||||||
|
result[category] = result[category][:limit]
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue