[pve-devel] [PATCH pve-manager 2/2] sdn: ipam: fix editing custom mappings

Stefan Hanreich s.hanreich at proxmox.com
Wed Jul 17 15:06:03 CEST 2024


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.hanreich at 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




More information about the pve-devel mailing list