feat(xo-server/rest-api): /backups → /backup
This commit is contained in:
parent
f0da94081b
commit
037e1c1dfa
@ -8,6 +8,7 @@
|
||||
> Users must be able to say: “Nice enhancement, I'm eager to test it”
|
||||
|
||||
- [Forget SR] Changed the modal message and added a confirmation text to be sure the action is understood by the user [#7148](https://github.com/vatesfr/xen-orchestra/issues/7148) (PR [#7155](https://github.com/vatesfr/xen-orchestra/pull/7155))
|
||||
- [REST API] `/backups` has been renamed to `/backup` (redirections are in place for compatibility)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
@ -29,4 +30,6 @@
|
||||
|
||||
<!--packages-start-->
|
||||
|
||||
- xo-server minor
|
||||
|
||||
<!--packages-end-->
|
||||
|
@ -175,7 +175,7 @@ export default class RestApi {
|
||||
})
|
||||
)
|
||||
|
||||
collections.backups = { id: 'backups' }
|
||||
collections.backup = { id: 'backup' }
|
||||
collections.restore = { id: 'restore' }
|
||||
collections.tasks = { id: 'tasks' }
|
||||
collections.users = { id: 'users' }
|
||||
@ -280,23 +280,28 @@ export default class RestApi {
|
||||
wrap((req, res) => sendObjects(collections, req, res))
|
||||
)
|
||||
|
||||
// For compatibility redirect from /backups* to /backup
|
||||
api.get('/backups*', (req, res) => {
|
||||
res.redirect(308, req.baseUrl + '/backup' + req.params[0])
|
||||
})
|
||||
|
||||
api
|
||||
.get(
|
||||
'/backups',
|
||||
'/backup',
|
||||
wrap((req, res) => sendObjects([{ id: 'jobs' }, { id: 'logs' }], req, res))
|
||||
)
|
||||
.get(
|
||||
'/backups/jobs',
|
||||
'/backup/jobs',
|
||||
wrap(async (req, res) => sendObjects(await app.getAllJobs('backup'), req, res))
|
||||
)
|
||||
.get(
|
||||
'/backups/jobs/:id',
|
||||
'/backup/jobs/:id',
|
||||
wrap(async (req, res) => {
|
||||
res.json(await app.getJob(req.params.id, 'backup'))
|
||||
})
|
||||
)
|
||||
.get(
|
||||
'/backups/logs',
|
||||
'/backup/logs',
|
||||
wrap(async (req, res) => {
|
||||
const { filter, limit } = req.query
|
||||
const logs = await app.getBackupNgLogsSorted({
|
||||
|
Loading…
Reference in New Issue
Block a user