mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-20 13:58:45 -06:00
feat(xo-server/rest-api/dashboard): add backup repositories info (#7882)
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [REST API] Add backup repository information in the `/rest/v0/dashboard` endpoint (PR [#7882](https://github.com/vatesfr/xen-orchestra/pull/7882))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
@@ -208,6 +208,28 @@ async function _getDashboardStats(app) {
|
||||
dashboard.missingPatches = missingPatches
|
||||
}
|
||||
|
||||
try {
|
||||
const backupRepositoriesSize = Object.values(await app.getAllRemotesInfo()).reduce(
|
||||
(prev, remoteInfo) => ({
|
||||
available: prev.available + remoteInfo.available,
|
||||
backups: 0, // @TODO: compute the space used by backups
|
||||
other: 0, // @TODO: compute the space used by everything that is not a backup
|
||||
total: prev.total + remoteInfo.size,
|
||||
used: prev.used + remoteInfo.used,
|
||||
}),
|
||||
{
|
||||
available: 0,
|
||||
backups: 0,
|
||||
other: 0,
|
||||
total: 0,
|
||||
used: 0,
|
||||
}
|
||||
)
|
||||
dashboard.backupRepositories = { size: backupRepositoriesSize }
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
return dashboard
|
||||
}
|
||||
const getDashboardStats = throttle(_getDashboardStats, 6e4, { trailing: false, leading: true })
|
||||
|
||||
Reference in New Issue
Block a user