fix(xo-server/rest-api): limit applies at the end for {backups,restore}/logs

Fixes https://xcp-ng.org/forum/post/64880
This commit is contained in:
Julien Fontanet
2023-08-30 16:02:42 +02:00
parent 8cdae83150
commit 9c7fd94a9b
2 changed files with 4 additions and 6 deletions
+2
View File
@@ -11,6 +11,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed” > Users must be able to say: “I had this issue, happy to know it's fixed”
- [REST API] `limit` parameter now applies at the end of the `backups/logs` and `restore/logs` collections, i.e. it selects the last entries [Forum#64880](https://xcp-ng.org/forum/post/64880)
### Packages to release ### Packages to release
> When modifying a package, add it here with its release type. > When modifying a package, add it here with its release type.
@@ -209,7 +209,7 @@ export default {
}, },
'start' 'start'
) )
let j = const j =
before === undefined before === undefined
? logs.length ? logs.length
: sortedIndexBy( : sortedIndexBy(
@@ -220,11 +220,7 @@ export default {
'start' 'start'
) )
limit += i logs = logs.slice(Math.max(i, j - limit), j)
if (limit < j) {
j = limit
}
logs = logs.slice(i, j)
return logs return logs
}, },