fix(xo-web/vms/import): various fixes (#4118)
- dont swallow `importVm` error - `importVms`: display errors on console - dont redirect on failure
This commit is contained in:
parent
f900a5ef4f
commit
95bcf0c080
@ -1388,8 +1388,9 @@ export const importVm = (file, type = 'xva', data = undefined, sr) => {
|
||||
success(_('vmImportSuccess'), name)
|
||||
return res.json().then(body => body.result)
|
||||
})
|
||||
.catch(() => {
|
||||
.catch(err => {
|
||||
error(_('vmImportFailed'), name)
|
||||
throw err
|
||||
})
|
||||
)
|
||||
}
|
||||
@ -1429,9 +1430,11 @@ export const importVdi = async vdi => {
|
||||
export const importVms = (vms, sr) =>
|
||||
Promise.all(
|
||||
map(vms, ({ file, type, data }) =>
|
||||
importVm(file, type, data, sr).catch(noop)
|
||||
)
|
||||
importVm(file, type, data, sr).catch(error => {
|
||||
console.warn('importVms', file.name, error)
|
||||
})
|
||||
)
|
||||
).then(ids => ids.filter(_ => _ !== undefined))
|
||||
|
||||
import ExportVmModalBody from './export-vm-modal' // eslint-disable-line import/first
|
||||
export const exportVm = vm =>
|
||||
|
@ -237,7 +237,9 @@ const parseFile = async (file, type, func) => {
|
||||
}
|
||||
|
||||
const getRedirectionUrl = vms =>
|
||||
vms.length === 1
|
||||
vms.length === 0
|
||||
? undefined // no redirect
|
||||
: vms.length === 1
|
||||
? `/vms/${vms[0]}`
|
||||
: `/home?s=${encodeURIComponent(`id:|(${vms.join(' ')})`)}&t=VM`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user