public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [RFC manager 0/3] add bulk actions cmdmenu with multi select in resource tree
@ 2026-10-27 14:30 Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 1/3] ui: bulk action window: allow restricting the guest list by VMIDs Nicolas Frey
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-10-27 14:30 UTC (permalink / raw)
  To: pve-devel

sending this as an RFC as I'm unsure if this is wanted, especially
since there is already a CmdMenu for the TagView.

explicitly disallows multi-select on any other resouces that is not
a VM/CT (guest). can be useful for managing unrelated guests on the
fly, without creating a common tag between them.

pve-manager:

Nicolas Frey (3):
  ui: bulk action window: allow restricting the guest list by VMIDs
  ui: bulk actions: add cmdmenu with guest selection
  ui: resource tree: allow selecting multiple guests for bulk actions

 www/manager6/Utils.js             | 17 ++++++++++++++++-
 www/manager6/Workspace.js         |  6 +++++-
 www/manager6/dc/CmdMenu.js        | 23 +++++++++++++++++++++++
 www/manager6/tree/ResourceTree.js | 10 +++++++++-
 www/manager6/window/BulkAction.js | 15 +++++++++++++--
 5 files changed, 66 insertions(+), 5 deletions(-)


Summary over all repositories:
  5 files changed, 66 insertions(+), 5 deletions(-)

--
Generated by murpp 0.12.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH pve-manager 1/3] ui: bulk action window: allow restricting the guest list by VMIDs
  2026-10-27 14:30 [RFC manager 0/3] add bulk actions cmdmenu with multi select in resource tree Nicolas Frey
@ 2026-10-27 14:30 ` Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 2/3] ui: bulk actions: add cmdmenu with guest selection Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 3/3] ui: resource tree: allow selecting multiple guests for bulk actions Nicolas Frey
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-10-27 14:30 UTC (permalink / raw)
  To: pve-devel

in preparation for making guests selectable in the resource tree

Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
 www/manager6/window/BulkAction.js | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/www/manager6/window/BulkAction.js b/www/manager6/window/BulkAction.js
index 2e3066a3..c1fc3474 100644
--- a/www/manager6/window/BulkAction.js
+++ b/www/manager6/window/BulkAction.js
@@ -17,6 +17,9 @@ Ext.define('PVE.window.BulkAction', {
     // necessary for the cluster-wide api call
     vmsAsArray: false,
 
+    // if set, only the guests with these VMIDs are offered for selection
+    vmids: undefined,
+
     submit: function (params) {
         let me = this;
 
@@ -310,8 +313,16 @@ Ext.define('PVE.window.BulkAction', {
                     !includeTags.length || tags.some((tag) => includeTags.indexOf(tag) !== -1);
                 let excludeFilter =
                     !excludeTags.length || tags.every((tag) => excludeTags.indexOf(tag) === -1);
-
-                return name && arrayFilters && singleFilters && includeFilter && excludeFilter;
+                let vmidFilter = !me.vmids || me.vmids.includes(value.data.vmid);
+
+                return (
+                    name &&
+                    arrayFilters &&
+                    singleFilters &&
+                    includeFilter &&
+                    excludeFilter &&
+                    vmidFilter
+                );
             };
             let vmselector = me.down('#vms');
             vmselector.getStore().setFilters({
-- 
2.47.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH pve-manager 2/3] ui: bulk actions: add cmdmenu with guest selection
  2026-10-27 14:30 [RFC manager 0/3] add bulk actions cmdmenu with multi select in resource tree Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 1/3] ui: bulk action window: allow restricting the guest list by VMIDs Nicolas Frey
@ 2026-10-27 14:30 ` Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 3/3] ui: resource tree: allow selecting multiple guests for bulk actions Nicolas Frey
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-10-27 14:30 UTC (permalink / raw)
  To: pve-devel

as the `TagCmdMenu` did before, but with an option to pass in a list of
VMIDs.

Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
 www/manager6/dc/CmdMenu.js | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/www/manager6/dc/CmdMenu.js b/www/manager6/dc/CmdMenu.js
index 87671adb..b6bc81f2 100644
--- a/www/manager6/dc/CmdMenu.js
+++ b/www/manager6/dc/CmdMenu.js
@@ -127,3 +127,26 @@ Ext.define('PVE.dc.TagCmdMenu', {
         me.callParent();
     },
 });
+
+Ext.define('PVE.dc.GuestSelectionCmdMenu', {
+    extend: 'PVE.dc.CmdMenu',
+    xtype: 'guestSelectionCmdMenu',
+
+    minWidth: 220,
+
+    initComponent: function () {
+        let me = this;
+
+        if (!me.vmids?.length) {
+            throw 'no vmids specified';
+        }
+
+        me.title = `${gettext('Selected Guests')}`;
+
+        me.extraHandlerArgs = {
+            vmids: me.vmids,
+        };
+
+        me.callParent();
+    },
+});
-- 
2.47.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH pve-manager 3/3] ui: resource tree: allow selecting multiple guests for bulk actions
  2026-10-27 14:30 [RFC manager 0/3] add bulk actions cmdmenu with multi select in resource tree Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 1/3] ui: bulk action window: allow restricting the guest list by VMIDs Nicolas Frey
  2026-10-27 14:30 ` [PATCH pve-manager 2/3] ui: bulk actions: add cmdmenu with guest selection Nicolas Frey
@ 2026-10-27 14:30 ` Nicolas Frey
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Frey @ 2026-10-27 14:30 UTC (permalink / raw)
  To: pve-devel

by switching the selmModel mode to 'MULTI' and restricting those selects
to guest resources only. now opens `PVE.dc.GuestSelectionCmdMenu` as the
context menu on right click, instead of the one for that resource.

Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
 www/manager6/Utils.js             | 17 ++++++++++++++++-
 www/manager6/Workspace.js         |  6 +++++-
 www/manager6/tree/ResourceTree.js | 10 +++++++++-
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 8b99371d..1efce1a4 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1615,7 +1615,22 @@ Ext.define('PVE.Utils', {
             let menu;
             let type = record.data.type;
 
-            if (record.data.template) {
+            let selModel = v.getSelectionModel();
+            let selection = selModel.isSelected(record) ? selModel.getSelection() : [];
+            let vmids =
+                    selection
+                        .filter(
+                            (rec) =>
+                                (rec.data.type === 'qemu' || rec.data.type === 'lxc') &&
+                                !rec.data.template,
+                        )
+                        .map((rec) => rec.data.vmid);
+
+            if (selection.length > 1 && vmids.length) {
+                menu = Ext.create('PVE.dc.GuestSelectionCmdMenu', {
+                    vmids,
+                });
+            } else if (record.data.template) {
                 if (type === 'qemu' || type === 'lxc') {
                     menu = Ext.create('PVE.menu.TemplateMenu', {
                         pveSelNode: record,
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 189d3373..f1b0c90a 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -232,9 +232,13 @@ Ext.define('PVE.StdWorkspace', {
             flex: 1,
             selModel: {
                 selType: 'treemodel',
+                mode: 'MULTI',
+                allowDeselect: true,
                 listeners: {
                     selectionchange: function (sm, selected) {
-                        if (selected.length <= 0) {
+                        // when selecting multiple guests, another selection (in multi-select)
+                        // should not switch the view
+                        if (selected.length !== 1) {
                             return;
                         }
                         let treeNode = selected[0];
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index e2acc431..971c1140 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -547,7 +547,15 @@ Ext.define('PVE.tree.ResourceTree', {
                 beforeselect: function (tree, record, index, eopts) {
                     let allow = me.allowSelection;
                     me.allowSelection = true;
-                    return allow;
+                    if (!allow) {
+                        return false;
+                    }
+                    // only guests can be part of a selection of multiple entries, as they're the
+                    // only resources with bulk actions
+                    let isGuest = (rec) =>
+                        (rec.data.type === 'qemu' || rec.data.type === 'lxc') && !rec.data.template;
+                    let others = tree.getSelection().filter((rec) => rec !== record);
+                    return !others.length || (isGuest(record) && others.every(isGuest));
                 },
                 itemdblclick: PVE.Utils.openTreeConsole,
                 afterrender: function () {
-- 
2.47.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-27 14:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 14:30 [RFC manager 0/3] add bulk actions cmdmenu with multi select in resource tree Nicolas Frey
2026-10-27 14:30 ` [PATCH pve-manager 1/3] ui: bulk action window: allow restricting the guest list by VMIDs Nicolas Frey
2026-10-27 14:30 ` [PATCH pve-manager 2/3] ui: bulk actions: add cmdmenu with guest selection Nicolas Frey
2026-10-27 14:30 ` [PATCH pve-manager 3/3] ui: resource tree: allow selecting multiple guests for bulk actions Nicolas Frey

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