From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 3B1A01FF13B for ; Wed, 20 May 2026 15:17:38 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E7A0480D9; Wed, 20 May 2026 15:17:35 +0200 (CEST) Message-ID: Date: Wed, 20 May 2026 15:17:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH manager] ui: sdn: fabrics: node edit: prevent adding multiple ipv6 columns From: Dominik Csapak To: pve-devel@lists.proxmox.com References: <20260520131249.2975476-1-d.csapak@proxmox.com> Content-Language: en-US In-Reply-To: <20260520131249.2975476-1-d.csapak@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779283006171 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.050 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [data.name] Message-ID-Hash: QUMVIWFOIXWXBU5INKSZAW2GQGE7Z6QQ X-Message-ID-Hash: QUMVIWFOIXWXBU5INKSZAW2GQGE7Z6QQ X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: disregard this, we access the common columns from elsewhere too and that breaks with this patch. sending a v2 shortly On 5/20/26 3:13 PM, Dominik Csapak wrote: > modifying a class member is always dangerous, since it modifies the > object on the original class prototype, so pushing into it happens on > every instance creation. This means every time 'Add Node' is clicked > for a fabric with ipv6 support another ipv6 column is added. > > To prevent this, create the list of common columns in initComponent > and push into that instead. > > Slightly changes the handling of additionalColumns so we don't have to > copy the common columns with 'concat'. > > Signed-off-by: Dominik Csapak > --- > www/manager6/sdn/fabrics/InterfacePanel.js | 126 +++++++++++---------- > 1 file changed, 65 insertions(+), 61 deletions(-) > > diff --git a/www/manager6/sdn/fabrics/InterfacePanel.js b/www/manager6/sdn/fabrics/InterfacePanel.js > index 5632104a..30c43ddf 100644 > --- a/www/manager6/sdn/fabrics/InterfacePanel.js > +++ b/www/manager6/sdn/fabrics/InterfacePanel.js > @@ -15,65 +15,6 @@ Ext.define('PVE.sdn.Fabric.InterfacePanel', { > > maxHeight: 500, > > - commonColumns: [ > - { > - text: gettext('Status'), > - dataIndex: 'status', > - width: 30, > - renderer: function (value, metaData, record) { > - let me = this; > - > - let warning; > - let nodeInterface = me.nodeInterfaces[record.data.name]; > - > - if (!nodeInterface) { > - warning = gettext('Interface does not exist on node'); > - } else if ( > - (nodeInterface.ip && record.data.ip) || > - (nodeInterface.ip6 && record.data.ip6) > - ) { > - warning = gettext( > - 'Interface already has an address configured in /etc/network/interfaces', > - ); > - } else if (nodeInterface.ip || nodeInterface.ip6) { > - warning = gettext( > - 'Configure the IP in the fabric, instead of /etc/network/interfaces', > - ); > - } > - > - if (warning) { > - metaData.tdAttr = `data-qtip="${Ext.htmlEncode(Ext.htmlEncode(warning))}"`; > - return ``; > - } > - > - return ''; > - }, > - }, > - { > - text: gettext('Name'), > - dataIndex: 'name', > - flex: 2, > - }, > - { > - text: gettext('Type'), > - dataIndex: 'type', > - flex: 1, > - }, > - { > - text: gettext('IP'), > - xtype: 'widgetcolumn', > - dataIndex: 'ip', > - flex: 1, > - widget: { > - xtype: 'proxmoxtextfield', > - isFormField: false, > - bind: { > - disabled: '{record.isDisabled}', > - }, > - }, > - }, > - ], > - > additionalColumns: [], > > controller: { > @@ -110,8 +51,67 @@ Ext.define('PVE.sdn.Fabric.InterfacePanel', { > initComponent: function () { > let me = this; > > + let columns = [ > + { > + text: gettext('Status'), > + dataIndex: 'status', > + width: 30, > + renderer: function (value, metaData, record) { > + let me = this; > + > + let warning; > + let nodeInterface = me.nodeInterfaces[record.data.name]; > + > + if (!nodeInterface) { > + warning = gettext('Interface does not exist on node'); > + } else if ( > + (nodeInterface.ip && record.data.ip) || > + (nodeInterface.ip6 && record.data.ip6) > + ) { > + warning = gettext( > + 'Interface already has an address configured in /etc/network/interfaces', > + ); > + } else if (nodeInterface.ip || nodeInterface.ip6) { > + warning = gettext( > + 'Configure the IP in the fabric, instead of /etc/network/interfaces', > + ); > + } > + > + if (warning) { > + metaData.tdAttr = `data-qtip="${Ext.htmlEncode(Ext.htmlEncode(warning))}"`; > + return ``; > + } > + > + return ''; > + }, > + }, > + { > + text: gettext('Name'), > + dataIndex: 'name', > + flex: 2, > + }, > + { > + text: gettext('Type'), > + dataIndex: 'type', > + flex: 1, > + }, > + { > + text: gettext('IP'), > + xtype: 'widgetcolumn', > + dataIndex: 'ip', > + flex: 1, > + widget: { > + xtype: 'proxmoxtextfield', > + isFormField: false, > + bind: { > + disabled: '{record.isDisabled}', > + }, > + }, > + }, > + ]; > + > if (me.hasIpv6Support) { > - me.commonColumns.push({ > + columns.push({ > text: gettext('IPv6'), > xtype: 'widgetcolumn', > dataIndex: 'ip6', > @@ -126,6 +126,10 @@ Ext.define('PVE.sdn.Fabric.InterfacePanel', { > }); > } > > + if (me.additionalColumns.length > 0) { > + columns.push(...me.additionalColumns); > + } > + > Ext.apply(me, { > store: Ext.create('Ext.data.Store', { > model: 'Pve.sdn.Interface', > @@ -134,7 +138,7 @@ Ext.define('PVE.sdn.Fabric.InterfacePanel', { > direction: 'ASC', > }, > }), > - columns: me.commonColumns.concat(me.additionalColumns), > + columns, > }); > > me.callParent();