public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Leo Nunner <l.nunner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 manager] firewall: add scope field to IPRefSelector
Date: Tue, 13 Jun 2023 14:06:34 +0200	[thread overview]
Message-ID: <20230613120634.155490-4-l.nunner@proxmox.com> (raw)
In-Reply-To: <20230613120634.155490-1-l.nunner@proxmox.com>

and send the scoped value to the firewall when choosing new values.
This happens for both IPSets and aliases.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
---
 www/manager6/form/IPRefSelector.js | 35 +++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/www/manager6/form/IPRefSelector.js b/www/manager6/form/IPRefSelector.js
index 9ccc2fe10..b50ac1e10 100644
--- a/www/manager6/form/IPRefSelector.js
+++ b/www/manager6/form/IPRefSelector.js
@@ -8,7 +8,7 @@ Ext.define('PVE.form.IPRefSelector', {
 
     ref_type: undefined, // undefined = any [undefined, 'ipset' or 'alias']
 
-    valueField: 'ref',
+    valueField: 'scopedref',
     displayField: 'ref',
     notFoundIsValid: true,
 
@@ -26,7 +26,23 @@ Ext.define('PVE.form.IPRefSelector', {
 
 	var store = Ext.create('Ext.data.Store', {
 	    autoLoad: true,
-	    fields: ['type', 'name', 'ref', 'comment'],
+	    fields: [
+		'type',
+		'name',
+		'ref',
+		'comment',
+		'scope',
+		{
+		    name: 'scopedref',
+		    calculate: function(v) {
+			if (v.type === 'alias') {
+			    return `${v.scope}/${v.name}`;
+			} else {
+			    return `+${v.scope}/${v.name}`;
+			}
+		    },
+		},
+	    ],
 	    idProperty: 'ref',
 	    proxy: {
 		type: 'proxmox',
@@ -65,17 +81,30 @@ Ext.define('PVE.form.IPRefSelector', {
 		hideable: false,
 		width: 140,
 	    },
+	    {
+		header: gettext('Scope'),
+		dataIndex: 'scope',
+		hideable: false,
+		width: 140,
+		renderer: function(value) {
+		    return value === 'dc' ? gettext("Datacenter") : gettext("Guest");
+		},
+	    },
 	    {
 		header: gettext('Comment'),
 		dataIndex: 'comment',
 		renderer: Ext.String.htmlEncode,
+		minWidth: 60,
 		flex: 1,
 	    },
 	);
 
 	Ext.apply(me, {
 	    store: store,
-            listConfig: { columns: columns },
+            listConfig: {
+		columns: columns,
+		width: 500,
+	    },
 	});
 
 	me.on('change', disable_query_for_ips);
-- 
2.30.2





  parent reply	other threads:[~2023-06-13 12:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 12:06 [pve-devel] [PATCH v2 firewall manager] firewall: introduce scoping for ipsets/aliases Leo Nunner
2023-06-13 12:06 ` [pve-devel] [PATCH v2 firewall 1/2] api: fix scoping for ipset endpoint Leo Nunner
2023-06-15  7:42   ` Wolfgang Bumiller
2023-06-13 12:06 ` [pve-devel] [PATCH v2 firewall 2/2] fix #4556: api: return scoped IPSets and aliases Leo Nunner
2023-06-13 12:06 ` Leo Nunner [this message]
2023-06-15  7:41 ` [pve-devel] applied-series: [PATCH v2 firewall manager] firewall: introduce scoping for ipsets/aliases Wolfgang Bumiller

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=20230613120634.155490-4-l.nunner@proxmox.com \
    --to=l.nunner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal