public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v2 24/27] ui: sdn: microseg: add tag matcher
Date: Thu,  9 Jul 2026 11:18:49 +0200	[thread overview]
Message-ID: <20260709091852.538885-25-h.laimer@proxmox.com> (raw)
In-Reply-To: <20260709091852.538885-1-h.laimer@proxmox.com>

Register the tag assignment type with its own input panel (tags
multi-select, tag match, interface, groups, comment) and label it in
the microseg tree. The add-assignment menu and tree filter pick it up
from the schema registry.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 www/manager6/Utils.js                       |   5 +
 www/manager6/sdn/microseg/AssignmentEdit.js | 113 ++++++++++++++++++++
 www/manager6/sdn/microseg/Base.js           |   2 +
 www/manager6/sdn/microseg/Tree.js           |  13 ++-
 4 files changed, 132 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 6d7ac5e3..52022a6a 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -980,6 +980,11 @@ Ext.define('PVE.Utils', {
                 ipanel: 'GuestAssignmentInputPanel',
                 urlType: 'assignment',
             },
+            tagassignment: {
+                name: gettext('Tag Assignment'),
+                ipanel: 'TagAssignmentInputPanel',
+                urlType: 'assignment',
+            },
         },
 
         format_sdnmicroseg_type: function (value, md, record) {
diff --git a/www/manager6/sdn/microseg/AssignmentEdit.js b/www/manager6/sdn/microseg/AssignmentEdit.js
index 2a9c5cce..9fca4685 100644
--- a/www/manager6/sdn/microseg/AssignmentEdit.js
+++ b/www/manager6/sdn/microseg/AssignmentEdit.js
@@ -57,3 +57,116 @@ Ext.define('PVE.sdn.microseg.GuestAssignmentInputPanel', {
         me.callParent();
     },
 });
+
+Ext.define('PVE.sdn.microseg.TagAssignmentInputPanel', {
+    extend: 'PVE.panel.SDNMicrosegBase',
+
+    onlineHelp: 'pvesdn_microseg_assignment',
+
+    autoId: true,
+
+    onGetValues: function (values) {
+        let me = this;
+        if (me.isCreate) {
+            values.type = me.type;
+        }
+        if (values.iface === '' || values.iface === null || values.iface === undefined) {
+            delete values.iface;
+        }
+        return me.callParent([values]);
+    },
+
+    setValues: function (values) {
+        let me = this;
+        if (Ext.isArray(values.tags) && values.tags.length) {
+            let store = me.tagSelector.getStore();
+            let known = {};
+            store.each((rec) => {
+                known[rec.get('value')] = true;
+            });
+            let missing = values.tags.filter((tag) => !known[tag]).map((tag) => ({ value: tag }));
+            if (missing.length) {
+                store.add(missing);
+            }
+        }
+        return me.callParent([values]);
+    },
+
+    initComponent: function () {
+        let me = this;
+
+        let tagList = (PVE.UIOptions.tagList ?? []).map((tag) => ({ value: tag }));
+
+        me.tagSelector = Ext.create({
+            xtype: 'proxmoxComboGrid',
+            name: 'tags',
+            fieldLabel: gettext('Tags'),
+            emptyText: gettext('Select guest tags'),
+            editable: false,
+            multiSelect: true,
+            allowBlank: false,
+            disabled: !me.isCreate,
+            valueField: 'value',
+            displayField: 'value',
+            store: {
+                fields: ['value'],
+                data: tagList,
+                sorters: 'value',
+            },
+            listConfig: {
+                userCls: 'proxmox-tags-full',
+                columns: [
+                    {
+                        dataIndex: 'value',
+                        flex: 1,
+                        renderer: (value) =>
+                            PVE.Utils.renderTags(value, PVE.UIOptions.tagOverrides),
+                    },
+                ],
+            },
+        });
+
+        me.items = [
+            me.tagSelector,
+            {
+                xtype: 'proxmoxKVComboBox',
+                name: 'tag_match',
+                fieldLabel: gettext('Tag match'),
+                value: 'any',
+                disabled: !me.isCreate,
+                comboItems: [
+                    ['any', gettext('Any (shares a tag)')],
+                    ['all', gettext('All (has every tag)')],
+                    ['exact', gettext('Exact (equals)')],
+                ],
+            },
+            {
+                xtype: 'proxmoxintegerfield',
+                name: 'iface',
+                fieldLabel: gettext('Network interface'),
+                minValue: 0,
+                maxValue: 31,
+                allowBlank: true,
+                emptyText: gettext('All NICs'),
+                disabled: !me.isCreate,
+            },
+            {
+                xtype: 'pveMicrosegGroupSelector',
+                name: 'groups',
+                fieldLabel: gettext('Groups'),
+                multiSelect: true,
+                allowBlank: false,
+            },
+            {
+                xtype: 'proxmoxtextfield',
+                name: 'comment',
+                fieldLabel: gettext('Comment'),
+                allowBlank: true,
+                maxLength: 256,
+                deleteEmpty: !me.isCreate,
+            },
+        ];
+
+        me.callParent();
+    },
+});
diff --git a/www/manager6/sdn/microseg/Base.js b/www/manager6/sdn/microseg/Base.js
index 6e226ce2..a2c263f9 100644
--- a/www/manager6/sdn/microseg/Base.js
+++ b/www/manager6/sdn/microseg/Base.js
@@ -17,6 +17,8 @@ Ext.define('pve-sdn-microseg', {
         'vmid',
         'iface',
         'groups',
+        'tags',
+        'tag_match',
         'direction',
     ],
     idProperty: 'id',
diff --git a/www/manager6/sdn/microseg/Tree.js b/www/manager6/sdn/microseg/Tree.js
index 9bfa7608..47c13dfa 100644
--- a/www/manager6/sdn/microseg/Tree.js
+++ b/www/manager6/sdn/microseg/Tree.js
@@ -18,9 +18,20 @@ Ext.define('PVE.sdn.MicrosegTree', {
                 ifaceVal === undefined || ifaceVal === null || ifaceVal === ''
                     ? ''
                     : ` net${ifaceVal}`;
+            if (a.type === 'tagassignment') {
+                let match = pv(a, 'tag_match') || 'any';
+                return `${match}{${(pv(a, 'tags') || []).join(', ')}}${iface}`;
+            }
             return `vm${pv(a, 'vmid')}${iface}`;
         };
 
+        let assignmentIcon = (a) => {
+            if (a.type === 'tagassignment') {
+                return 'fa fa-fw fa-tag';
+            }
+            return 'fa fa-fw fa-link';
+        };
+
         let buildNodes = (objects, identities) => {
             let groups = (objects || [])
                 .filter((o) => o.type === 'group')
@@ -102,7 +113,7 @@ Ext.define('PVE.sdn.MicrosegTree', {
                         return {
                             id: assignId,
                             text: assignmentLabel(a),
-                            iconCls: 'fa fa-fw fa-link',
+                            iconCls: assignmentIcon(a),
                             microsegEditType: a.type,
                             microsegId: a.id,
                             microsegMode: 'membership',
-- 
2.47.3





  parent reply	other threads:[~2026-07-09  9:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  9:18 SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ve-rs v2 01/27] ve-config: sdn: add microseg signature-identity engine Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ve-rs v2 02/27] ve-config: sdn: add microseg config types Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ve-rs v2 03/27] ve-config: sdn: microseg: add tag matcher Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ve-rs v2 04/27] ve-config: sdn: microseg: add name regex matcher Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ve-rs v2 05/27] ve-config: sdn: microseg: add carrier bridge section Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ebpf v2 06/27] agent: add userspace coordinator and stateless policy subsystem Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ebpf v2 07/27] bpf: add bridge subsystem Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-ebpf v2 08/27] debian: add packaging and boot-time oneshot unit Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-cluster v2 09/27] cfs: add 'sdn/microseg.cfg' to observed files Hannes Laimer
2026-07-09  9:18 ` [PATCH proxmox-perl-rs v2 10/27] pve-rs: sdn: add microseg config binding Hannes Laimer
2026-07-09  9:18 ` [PATCH ifupdown2 v2 11/27] d/patches: add support for VXLAN-GBP flag Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 12/27] sdn: microseg: add config, API and guest inventory Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 13/27] sdn: dry-run: surface pending microseg changes Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 14/27] sdn: zones: trigger microseg apply on tap_plug Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 15/27] sdn: zones: add vxlan-gbp option to vxlan and evpn zones Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 16/27] evpn: disable vxlan-learning on create if GBP is enabled Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 17/27] sdn: microseg: add tag matcher Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 18/27] sdn: microseg: add name regex matcher Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-network v2 19/27] sdn: microseg: add carrier bridge API Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-manager v2 20/27] ui: sdn: add microsegmentation panel Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-manager v2 21/27] ui: sdn: dry-run: show pending microseg diff Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-manager v2 22/27] network: apply microseg state on reload Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-manager v2 23/27] ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn Hannes Laimer
2026-07-09  9:18 ` Hannes Laimer [this message]
2026-07-09  9:18 ` [PATCH pve-manager v2 25/27] ui: sdn: microseg: add name regex matcher Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-docs v2 26/27] sdn: add microsegmentation section Hannes Laimer
2026-07-09  9:18 ` [PATCH pve-docs v2 27/27] sdn: add VXLAN-GBP flag to evpn/vxlan zone sections Hannes Laimer

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=20260709091852.538885-25-h.laimer@proxmox.com \
    --to=h.laimer@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