[pve-devel] [PATCH pve-manager v3 1/1] ui: fix #6209: create snapshots and backups from context menu

Nicolas Frey n.frey at proxmox.com
Mon Oct 6 15:33:07 CEST 2025


Adds snapshot and manual backup shortcut to VM/CT right-click context
menu.

On the previous iteration (v2), the snapshot feature availablity was
checked on menu load. It is now called only when the snapshot button
is clicked, preventing delays in loading the context menu. Testing
with simulated latency (with setTimeout) showed better UX by
displaying an error on click rather than preloading the check.

Previously, users couldn't distinguish between a slow API and the
feature being disabled. The explicit check provides clear feedback.
The 'disabled' property remains bound to VM.Snapshot to disable
the option when snapshots aren't allowed anyway.

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=6209
Signed-off-by: Nicolas Frey <n.frey at proxmox.com>
---
 www/manager6/lxc/CmdMenu.js  | 46 ++++++++++++++++++++++++++++++++++++
 www/manager6/qemu/CmdMenu.js | 46 ++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)

diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index cd60c967..f0e8f700 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -134,6 +134,52 @@ Ext.define('PVE.lxc.CmdMenu', {
                 },
             },
             { xtype: 'menuseparator' },
+            {
+                text: gettext('Take Snapshot'),
+                iconCls: 'fa fa-fw fa-history',
+                disabled: !caps.vms['VM.Snapshot'],
+                handler: function () {
+                    Proxmox.Utils.API2Request({
+                        url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
+                        params: { feature: 'snapshot' },
+                        method: 'GET',
+                        success: function (response) {
+                            if (!response.result.data.hasFeature) {
+                                Ext.Msg.alert(gettext('Error'), 'Cannot take snapshot: Feature not enabled.')
+                                return;
+                            }
+                            Ext.create('PVE.window.Snapshot', {
+                                nodename: info.node,
+                                vmid: info.vmid,
+                                vmname: info.name,
+                                viewonly: false,
+                                type: info.type,
+                                isCreate: true,
+                                submitText: gettext('Take Snapshot'),
+                                autoShow: true,
+                                running: running,
+                            });
+                        },
+                        failure: (response, opts) =>
+                            Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+                    });
+                },
+            },
+            {
+                text: gettext('Backup now'),
+                iconCls: 'fa fa-fw fa-floppy-o',
+                disabled: !caps.vms['VM.Backup'],
+                handler: function () {
+                    Ext.create('PVE.window.Backup', {
+                        nodename: info.node,
+                        vmid: info.vmid,
+                        vmtype: info.type,
+                        vmname: info.name,
+                        autoShow: true,
+                    });
+                },
+            },
+            { xtype: 'menuseparator' },
             {
                 text: gettext('Console'),
                 iconCls: 'fa fa-fw fa-terminal',
diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index adf64672..3e51be8f 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -169,6 +169,52 @@ Ext.define('PVE.qemu.CmdMenu', {
                 },
             },
             { xtype: 'menuseparator' },
+            {
+                text: gettext('Take Snapshot'),
+                iconCls: 'fa fa-fw fa-history',
+                disabled: !caps.vms['VM.Snapshot'],
+                handler: function () {
+                    Proxmox.Utils.API2Request({
+                        url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
+                        params: { feature: 'snapshot' },
+                        method: 'GET',
+                        success: function (response) {
+                            if (!response.result.data.hasFeature) {
+                                Ext.Msg.alert(gettext('Error'), 'Cannot take snapshot: Feature not enabled.')
+                                return;
+                            }
+                            Ext.create('PVE.window.Snapshot', {
+                                nodename: info.node,
+                                vmid: info.vmid,
+                                vmname: info.name,
+                                viewonly: false,
+                                type: info.type,
+                                isCreate: true,
+                                submitText: gettext('Take Snapshot'),
+                                autoShow: true,
+                                running: running,
+                            });
+                        },
+                        failure: (response, opts) =>
+                            Ext.Msg.alert(gettext('Error'), response.htmlStatus),
+                    });
+                },
+            },
+            {
+                text: gettext('Backup now'),
+                iconCls: 'fa fa-fw fa-floppy-o',
+                disabled: !caps.vms['VM.Backup'],
+                handler: function () {
+                    Ext.create('PVE.window.Backup', {
+                        nodename: info.node,
+                        vmid: info.vmid,
+                        vmtype: info.type,
+                        vmname: info.name,
+                        autoShow: true,
+                    });
+                },
+            },
+            { xtype: 'menuseparator' },
             {
                 text: gettext('Console'),
                 iconCls: 'fa fa-fw fa-terminal',
-- 
2.47.3




More information about the pve-devel mailing list