fix(xo-web/new/network): correct type for vlan (#6829)

BREAKING CHANGE: API method `network.create` no longer accepts a `string` for `vlan` param.

Fixes https://xcp-ng.org/forum/post/62090

Either `number` or `undefined`, not an empty string.
This commit is contained in:
Julien Fontanet
2023-05-12 10:36:59 +02:00
committed by GitHub
parent 73d88cc5f1
commit 836db1b807
3 changed files with 6 additions and 4 deletions

View File

@@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [VM] Fix `VBD_IS_EMPTY` error when converting to template [Forum#61653](https://xcp-ng.org/forum/post/61653) (PR [#6808](https://github.com/vatesfr/xen-orchestra/pull/6808))
- -[New/Network] Fix `invalid parameter error` when not providing a VLAN [Forum#62090](https://xcp-ng.org/forum/post/62090) (PR [#6829](https://github.com/vatesfr/xen-orchestra/pull/6829))
### Packages to release
@@ -30,5 +31,6 @@
<!--packages-start-->
- xo-server patch
- xo-web patch
<!--packages-end-->

View File

@@ -10,7 +10,7 @@ export async function create({ pool, name, description, pif, mtu = 1500, vlan =
description,
pifId: pif && this.getObject(pif, 'PIF')._xapiId,
mtu: +mtu,
vlan: +vlan,
vlan,
})
if (nbd) {
@@ -27,7 +27,7 @@ create.params = {
description: { type: 'string', minLength: 0, optional: true },
pif: { type: 'string', optional: true },
mtu: { type: 'integer', optional: true },
vlan: { type: ['integer', 'string'], optional: true },
vlan: { type: 'integer', optional: true },
}
create.resolve = {

View File

@@ -197,11 +197,11 @@ const NewNetwork = decorate([
networks,
pif,
pifs,
vlan,
} = state
let { mtu } = state
let { mtu, vlan } = state
mtu = mtu === '' ? undefined : +mtu
vlan = vlan === '' ? undefined : +vlan
return bonded
? createBondedNetwork({