public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] fix #7108: ui: ipset: do not offer aliases that are already added
Date: Tue, 29 Sep 2026 16:23:31 +0200	[thread overview]
Message-ID: <20260929142331.2990690-1-me@dualfroz.com> (raw)

When adding an entry to an IPSet, the alias selector lists all aliases,
including those that are already part of the IPSet. Selecting one of
them only results in an "already exists" error from the API.

Pass the current entries of the IPSet to the add window and filter the
matching aliases out of the selector. Aliases are stored in the IPSet
with the same scoped reference the selector uses as value, so an exact
comparison is sufficient.

Signed-off-by: Michal Fox <me@dualfroz.com>
---
 www/manager6/form/IPRefSelector.js | 4 ++++
 www/manager6/panel/IPSet.js        | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/www/manager6/form/IPRefSelector.js b/www/manager6/form/IPRefSelector.js
index 08fafd9b..7be09b6b 100644
--- a/www/manager6/form/IPRefSelector.js
+++ b/www/manager6/form/IPRefSelector.js
@@ -8,6 +8,9 @@ Ext.define('PVE.form.IPRefSelector', {
 
     ref_type: undefined, // undefined = any [undefined, 'ipset' or 'alias']
 
+    // list of references that should not be offered, e.g. because they are already in use
+    excludeRefs: [],
+
     valueField: 'scopedref',
     displayField: 'ref',
     notFoundIsValid: true,
@@ -54,6 +57,7 @@ Ext.define('PVE.form.IPRefSelector', {
                 property: 'ref',
                 direction: 'ASC',
             },
+            filters: [(rec) => !me.excludeRefs.includes(rec.data.scopedref)],
         });
 
         var columns = [];
diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js
index 9e0203a0..d510ae6d 100644
--- a/www/manager6/panel/IPSet.js
+++ b/www/manager6/panel/IPSet.js
@@ -187,6 +187,9 @@ Ext.define('PVE.IPSetCidrEdit', {
 
     cidr: undefined,
 
+    // entries already in the IPSet, not offered again when adding a new one
+    existingCidrs: [],
+
     initComponent: function () {
         var me = this;
 
@@ -211,6 +214,7 @@ Ext.define('PVE.IPSetCidrEdit', {
                 xtype: 'pveIPRefSelector',
                 name: 'cidr',
                 ref_type: 'alias',
+                excludeRefs: me.existingCidrs,
                 autoSelect: false,
                 editable: true,
                 base_url: me.list_refs_url,
@@ -359,6 +363,7 @@ Ext.define(
                     var win = Ext.create('PVE.IPSetCidrEdit', {
                         base_url: me.base_url,
                         list_refs_url: me.list_refs_url,
+                        existingCidrs: store.collect('cidr'),
                     });
                     win.show();
                     win.on('destroy', reload);
-- 
2.43.0




             reply	other threads:[~2026-09-30  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 14:23 Michal Fox [this message]
2026-09-30  9:50 ` [PATCH manager] fix #7108: ui: ipset: do not offer aliases that are already added Arthur Bied-Charreton
2026-09-30 10:27 ` applied: " 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=20260929142331.2990690-1-me@dualfroz.com \
    --to=me@dualfroz.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal