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

View File

@@ -11,6 +11,8 @@
> 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
> When modifying a package, add it here with its release type.

View File

@@ -209,7 +209,7 @@ export default {
},
'start'
)
let j =
const j =
before === undefined
? logs.length
: sortedIndexBy(
@@ -220,11 +220,7 @@ export default {
'start'
)
limit += i
if (limit < j) {
j = limit
}
logs = logs.slice(i, j)
logs = logs.slice(Math.max(i, j - limit), j)
return logs
},