From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [PATCH manager] ui: sdn: fabrics: node edit: prevent adding multiple ipv6 columns
Date: Wed, 20 May 2026 15:17:01 +0200 [thread overview]
Message-ID: <e7f95473-027e-487d-9f96-fc8c266ee9c7@proxmox.com> (raw)
In-Reply-To: <20260520131249.2975476-1-d.csapak@proxmox.com>
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 <d.csapak@proxmox.com>
> ---
> 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 `<i class="fa warning fa-warning"></i>`;
> - }
> -
> - 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 `<i class="fa warning fa-warning"></i>`;
> + }
> +
> + 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();
next prev parent reply other threads:[~2026-05-20 13:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 13:12 [PATCH manager] ui: sdn: fabrics: node edit: prevent adding multiple ipv6 columns Dominik Csapak
2026-05-20 13:17 ` Dominik Csapak [this message]
2026-05-20 13:26 ` superseded: " Dominik Csapak
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=e7f95473-027e-487d-9f96-fc8c266ee9c7@proxmox.com \
--to=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox