fix(xo-web/new-vm): list VIFs ordered by device (#6944)

Fixes zammad#15920
This commit is contained in:
Gabriel Gunullu 2023-07-28 18:51:48 +02:00 committed by GitHub
parent 6b936d8a8c
commit 6ae19b0640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -11,6 +11,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [New VM] Order interfaces by device as done on a VM Network tab (PR [#6944](https://github.com/vatesfr/xen-orchestra/pull/6944))
### Packages to release
> When modifying a package, add it here with its release type.
@ -27,4 +29,6 @@
<!--packages-start-->
- xo-web patch
<!--packages-end-->

View File

@ -549,9 +549,12 @@ export default class NewVm extends BaseComponent {
forEach(template.VIFs, vifId => {
const vif = getObject(storeState, vifId, resourceSet)
VIFs.push({
device: vif.device,
network: pool || isInResourceSet(vif.$network) ? vif.$network : defaultNetworkIds[0],
})
})
// sort the array so it corresponds to the order chosen by the user when creating the VM
VIFs.sort((a, b) => Number(a.device) - Number(b.device))
if (VIFs.length === 0) {
VIFs = defaultNetworkIds.map(id => ({ network: id }))
}