feat(xo-web/backup/logs): better resolution of last run log (#5141)

This commit is contained in:
Pierre Donias 2020-07-07 13:47:32 +02:00 committed by GitHub
parent dfdd0a0496
commit 9351b4a5bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -7,6 +7,8 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it”
- [Backup] Better resolution of the "last run log" quick access (PR [#5141](https://github.com/vatesfr/xen-orchestra/pull/5141))
### Bug fixes
> Users must be able to say: “I had this issue, happy to know it's fixed”
@ -32,4 +34,4 @@
> In case of conflict, the highest (lowest in previous list) `$version` wins.
- xo-server patch
- xo-web patch
- xo-web minor

View File

@ -117,11 +117,17 @@ const SchedulePreviewBody = decorate([
let lastRunLog
for (const runId in logs) {
const log = logs[runId]
if (
log.scheduleId === schedule.id &&
(lastRunLog === undefined || lastRunLog.start < log.start)
) {
lastRunLog = log
if (log.scheduleId === schedule.id) {
if (log.status === 'pending') {
lastRunLog = log
break
}
if (
lastRunLog === undefined ||
(lastRunLog.end || lastRunLog.start) < (log.end || log.start)
) {
lastRunLog = log
}
}
}
cb(lastRunLog)