fix(xo-web/home/VMs): do not delete VMs when confirm modal has been cancelled (#6435)

See Zammad#9735
Introduced by 11e09e1f87
This commit is contained in:
Pierre Donias 2022-09-26 15:27:01 +02:00 committed by GitHub
parent 74c8d56046
commit 4f9636b4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -24,6 +24,7 @@
- [Tasks] Fix tasks being displayed for all users (PR [#6422](https://github.com/vatesfr/xen-orchestra/pull/6422)) - [Tasks] Fix tasks being displayed for all users (PR [#6422](https://github.com/vatesfr/xen-orchestra/pull/6422))
- [Storage/advanced] Fix the display of VDI to coalesce [#6334](https://xcp-ng.org/forum/topic/6334/coalesce-not-showing-anymore) (PR [#6429](https://github.com/vatesfr/xen-orchestra/pull/6429)) - [Storage/advanced] Fix the display of VDI to coalesce [#6334](https://xcp-ng.org/forum/topic/6334/coalesce-not-showing-anymore) (PR [#6429](https://github.com/vatesfr/xen-orchestra/pull/6429))
- [Backup] Ignore disabled remotes instead of failing the execution [#6347](https://github.com/vatesfr/xen-orchestra/issues/6374) (PR [#6430](https://github.com/vatesfr/xen-orchestra/pull/6430)) - [Backup] Ignore disabled remotes instead of failing the execution [#6347](https://github.com/vatesfr/xen-orchestra/issues/6374) (PR [#6430](https://github.com/vatesfr/xen-orchestra/pull/6430))
- [Home/VMs] Fix VMs being deleted despite clicking on Cancel in the bulk deletion modal (PR [#6435](https://github.com/vatesfr/xen-orchestra/pull/6435))
### Packages to release ### Packages to release

View File

@ -1618,14 +1618,18 @@ export const deleteVms = async vms => {
if (vms.length === 1) { if (vms.length === 1) {
return deleteVm(vms[0]) return deleteVm(vms[0])
} }
await confirm({ try {
title: _('deleteVmsModalTitle', { vms: vms.length }), await confirm({
body: _('deleteVmsModalMessage', { vms: vms.length }), title: _('deleteVmsModalTitle', { vms: vms.length }),
strongConfirm: vms.length > 1 && { body: _('deleteVmsModalMessage', { vms: vms.length }),
messageId: 'deleteVmsConfirmText', strongConfirm: vms.length > 1 && {
values: { nVms: vms.length }, messageId: 'deleteVmsConfirmText',
}, values: { nVms: vms.length },
}).catch(noop) },
})
} catch (err) {
return
}
let nErrors = 0 let nErrors = 0
await Promise.all( await Promise.all(