public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager] sdn: fabrics: show node address fields only for configured prefixes
@ 2026-05-20 15:12 Gabriel Goller
  2026-05-20 15:12 ` [PATCH manager] sdn: fabrics: disable prefix editing when nodes exist Gabriel Goller
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Gabriel Goller @ 2026-05-20 15:12 UTC (permalink / raw)
  To: pve-devel

Only show the IPv4 or IPv6 address field for a fabric node when the
fabric has the matching prefix configured.

Suggested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 www/manager6/sdn/FabricsView.js      | 13 +++++++++++--
 www/manager6/sdn/fabrics/NodeEdit.js |  9 +++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/www/manager6/sdn/FabricsView.js b/www/manager6/sdn/FabricsView.js
index 4676266d0413..f2b8456a7720 100644
--- a/www/manager6/sdn/FabricsView.js
+++ b/www/manager6/sdn/FabricsView.js
@@ -305,6 +305,11 @@ Ext.define('PVE.sdn.Fabric.View', {
             return NODE_PANELS[protocol];
         },
 
+        getFabricPrefix: function (fabric, prefixKey) {
+            let prefix = fabric?.[prefixKey];
+            return prefix === 'deleted' ? undefined : prefix;
+        },
+
         addWireGuard: function () {
             let me = this;
             me.openFabricAddWindow('wireguard');
@@ -370,6 +375,8 @@ Ext.define('PVE.sdn.Fabric.View', {
                 autoShow: true,
                 fabricId: fabric.id,
                 protocol: fabric.protocol,
+                fabricIpPrefix: me.getFabricPrefix(fabric, 'ip_prefix'),
+                fabricIp6Prefix: me.getFabricPrefix(fabric, 'ip6_prefix'),
                 disallowedNodes,
                 addAnotherCallback: () => {
                     let successCallback = () => {
@@ -404,7 +411,7 @@ Ext.define('PVE.sdn.Fabric.View', {
             window.on('destroy', () => me.reload());
         },
 
-        openNodeEditWindow: function (node) {
+        openNodeEditWindow: function (node, fabric) {
             let me = this;
 
             let component = me.getNodeEditPanel(node.protocol);
@@ -414,6 +421,8 @@ Ext.define('PVE.sdn.Fabric.View', {
                 fabricId: node.fabric_id,
                 nodeId: node.node_id,
                 protocol: node.protocol,
+                fabricIpPrefix: me.getFabricPrefix(fabric, 'ip_prefix'),
+                fabricIp6Prefix: me.getFabricPrefix(fabric, 'ip6_prefix'),
             });
 
             window.on('destroy', () => me.reload());
@@ -425,7 +434,7 @@ Ext.define('PVE.sdn.Fabric.View', {
             if (rec.data.type === 'fabric') {
                 me.openFabricEditWindow(rec.data);
             } else if (rec.data.type === 'node') {
-                me.openNodeEditWindow(rec.data);
+                me.openNodeEditWindow(rec.data, rec.parentNode.data);
             } else {
                 console.warn(`unknown type ${rec.data.type}`);
             }
diff --git a/www/manager6/sdn/fabrics/NodeEdit.js b/www/manager6/sdn/fabrics/NodeEdit.js
index 2ed5336b3b49..ef4577cb67ba 100644
--- a/www/manager6/sdn/fabrics/NodeEdit.js
+++ b/www/manager6/sdn/fabrics/NodeEdit.js
@@ -14,6 +14,9 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', {
     hasIpv4Support: true,
     hasIpv6Support: true,
 
+    fabricIpPrefix: undefined,
+    fabricIp6Prefix: undefined,
+
     disallowedNodes: [],
 
     baseUrl: '/cluster/sdn/fabrics/node',
@@ -45,12 +48,13 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', {
             me.url = `${me.baseUrl}/${me.fabricId}`;
         }
 
-        if (me.hasIpv4Support) {
+        if (me.hasIpv4Support && me.fabricIpPrefix) {
             me.items.push({
                 xtype: 'proxmoxtextfield',
                 fieldLabel: gettext('IPv4'),
                 labelWidth: 120,
                 name: 'ip',
+                vtype: 'IPAddress',
                 allowBlank: true,
                 skipEmptyText: true,
                 cbind: {
@@ -59,12 +63,13 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', {
             });
         }
 
-        if (me.hasIpv6Support) {
+        if (me.hasIpv6Support && me.fabricIp6Prefix) {
             me.items.push({
                 xtype: 'proxmoxtextfield',
                 fieldLabel: gettext('IPv6'),
                 labelWidth: 120,
                 name: 'ip6',
+                vtype: 'IP6Address',
                 allowBlank: true,
                 skipEmptyText: true,
                 cbind: {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-21  9:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20 15:12 [PATCH manager] sdn: fabrics: show node address fields only for configured prefixes Gabriel Goller
2026-05-20 15:12 ` [PATCH manager] sdn: fabrics: disable prefix editing when nodes exist Gabriel Goller
2026-05-20 15:45   ` Hannes Laimer
2026-05-20 15:12 ` [PATCH manager] sdn: fabrics: require at least one prefix Gabriel Goller
2026-05-20 15:45   ` Hannes Laimer
2026-05-20 15:45 ` [PATCH manager] sdn: fabrics: show node address fields only for configured prefixes Hannes Laimer
2026-05-21  9:24 ` applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal