all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] sdn: fabrics: show node address fields only for configured prefixes
Date: Wed, 20 May 2026 17:12:22 +0200	[thread overview]
Message-ID: <20260520151236.395956-1-g.goller@proxmox.com> (raw)

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





             reply	other threads:[~2026-05-20 15:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 15:12 Gabriel Goller [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260520151236.395956-1-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal