all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 1/4] ui: form: list field: don't modify the class definition
Date: Thu,  5 Nov 2026 13:53:18 +0100	[thread overview]
Message-ID: <20261105125423.3788112-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261105125423.3788112-1-d.csapak@proxmox.com>

Modifying a property defined on the class level modifies the prototype
of that class. This can have unintended consequences when only part of
the config is used in some widgets.

This can be seen here with the `Registered Tags` and `User Tag Access`
lists: One has no emptytext while the other does. Opening them in an
alternating fashion adds the empty text from one to the other.

Fix it by constructing the initial items list in initComponent, and let
the widget modify that instead.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/form/ListField.js | 46 +++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/www/manager6/form/ListField.js b/www/manager6/form/ListField.js
index 49651bc5..6fcbdfd8 100644
--- a/www/manager6/form/ListField.js
+++ b/www/manager6/form/ListField.js
@@ -124,34 +124,34 @@ Ext.define('PVE.form.ListField', {
         },
     },
 
-    items: [
-        {
-            xtype: 'grid',
-            reference: 'grid',
+    initComponent: function () {
+        let me = this;
 
-            viewConfig: {
-                deferEmptyText: false,
-            },
+        me.items = [
+            {
+                xtype: 'grid',
+                reference: 'grid',
 
-            store: {
-                listeners: {
-                    update: function () {
-                        this.commitChanges();
+                viewConfig: {
+                    deferEmptyText: false,
+                },
+
+                store: {
+                    listeners: {
+                        update: function () {
+                            this.commitChanges();
+                        },
                     },
                 },
             },
-        },
-        {
-            xtype: 'button',
-            text: gettext('Add'),
-            iconCls: 'fa fa-plus-circle',
-            handler: 'addLine',
-            margin: '5 0 0 0',
-        },
-    ],
-
-    initComponent: function () {
-        let me = this;
+            {
+                xtype: 'button',
+                text: gettext('Add'),
+                iconCls: 'fa fa-plus-circle',
+                handler: 'addLine',
+                margin: '5 0 0 0',
+            },
+        ];
 
         for (const [key, value] of Object.entries(me.gridConfig ?? {})) {
             me.items[0][key] = value;
-- 
2.47.3





  reply	other threads:[~2026-11-05 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 12:53 [PATCH manager 0/4] ui: small fixes for tag editing Dominik Csapak
2026-11-05 12:53 ` Dominik Csapak [this message]
2026-11-05 12:53 ` [PATCH manager 2/4] ui: form: list field: fix type for header text assignment Dominik Csapak
2026-11-05 12:53 ` [PATCH manager 3/4] ui: dc: options: add emptytext to user tag access edit grid Dominik Csapak
2026-11-05 12:53 ` [PATCH manager 4/4] ui: dc options: add missing field title to registered tag " 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=20261105125423.3788112-2-d.csapak@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 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