Currently custom mappings cannot be edited, due to them having no VMID
value. The VMID parameter was always sent by the frontend to the
update call - even if it was empty - leading to validation failure on
the backend. Fix this by only sending the vmid parameter when it is
actually set.

Signed-off-by: Stefan Hanreich <s.hanre...@proxmox.com>
---
 www/manager6/tree/DhcpTree.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/www/manager6/tree/DhcpTree.js b/www/manager6/tree/DhcpTree.js
index d0b80803..6868bb60 100644
--- a/www/manager6/tree/DhcpTree.js
+++ b/www/manager6/tree/DhcpTree.js
@@ -156,15 +156,20 @@ Ext.define('PVE.sdn.DhcpTree', {
        openEditWindow: function(data) {
            let me = this;
 
+           let extraRequestParams = {
+               mac: data.mac,
+               zone: data.zone,
+               vnet: data.vnet,
+           };
+
+           if (data.vmid) {
+               extraRequestParams.vmid = data.vmid;
+           }
+
            Ext.create('PVE.sdn.IpamEdit', {
                autoShow: true,
                mapping: data,
-               extraRequestParams: {
-                   vmid: data.vmid,
-                   mac: data.mac,
-                   zone: data.zone,
-                   vnet: data.vnet,
-               },
+               extraRequestParams,
                listeners: {
                    destroy: () => me.reload(),
                },
-- 
2.39.2


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to