* [pve-devel] [PATCH pve-manager v2 2/2] ui: fix #6209: create snapshots and backups from context menu
2025-10-02 15:16 [pve-devel] [PATCH pve-manager v2 0/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
2025-10-02 15:16 ` [pve-devel] [PATCH pve-manager v2 1/2] ui: guest snapshot: remove excess '}' at the end of window title Nicolas Frey
@ 2025-10-02 15:16 ` Nicolas Frey
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Frey @ 2025-10-02 15:16 UTC (permalink / raw)
To: pve-devel
Adds snapshot and manual backup shortcut to VM/CT right-click context
menu.
Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=6209
Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
| 47 ++++++++++++++++++++++++++++++++++++
| 47 ++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+)
--git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index cd60c967..bd5fe164 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -134,6 +134,40 @@ Ext.define('PVE.lxc.CmdMenu', {
},
},
{ xtype: 'menuseparator' },
+ {
+ text: gettext('Take Snapshot'),
+ iconCls: 'fa fa-fw fa-history',
+ itemId: 'takeSnapshotBtn',
+ disabled: true, // default until async check finishes
+ handler: function () {
+ let win = 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'),
+ running: running,
+ });
+ win.show();
+ },
+ },
+ {
+ text: gettext('Backup now'),
+ iconCls: 'fa fa-fw fa-floppy-o',
+ disabled: !caps.vms['VM.Backup'],
+ handler: function () {
+ var win = Ext.create('PVE.window.Backup', {
+ nodename: info.node,
+ vmid: info.vmid,
+ vmtype: info.type,
+ vmname: info.name,
+ });
+ win.show();
+ },
+ },
+ { xtype: 'menuseparator' },
{
text: gettext('Console'),
iconCls: 'fa fa-fw fa-terminal',
@@ -149,5 +183,18 @@ Ext.define('PVE.lxc.CmdMenu', {
];
me.callParent();
+
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
+ params: { feature: 'snapshot' },
+ method: 'GET',
+ success: function (response) {
+ let hasFeature = !!response.result.data.hasFeature;
+ let btn = me.down('#takeSnapshotBtn');
+ if (btn) {
+ btn.setDisabled(!(caps.vms['VM.Snapshot'] && hasFeature));
+ }
+ },
+ });
},
});
--git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index adf64672..7c9080c5 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -169,6 +169,40 @@ Ext.define('PVE.qemu.CmdMenu', {
},
},
{ xtype: 'menuseparator' },
+ {
+ text: gettext('Take Snapshot'),
+ iconCls: 'fa fa-fw fa-history',
+ itemId: 'takeSnapshotBtn',
+ disabled: true,
+ handler: function () {
+ let win = 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'),
+ running: running,
+ });
+ win.show();
+ },
+ },
+ {
+ text: gettext('Backup now'),
+ iconCls: 'fa fa-fw fa-floppy-o',
+ disabled: !caps.vms['VM.Backup'],
+ handler: function () {
+ var win = Ext.create('PVE.window.Backup', {
+ nodename: info.node,
+ vmid: info.vmid,
+ vmtype: info.type,
+ vmname: info.name,
+ });
+ win.show();
+ },
+ },
+ { xtype: 'menuseparator' },
{
text: gettext('Console'),
iconCls: 'fa fa-fw fa-terminal',
@@ -194,5 +228,18 @@ Ext.define('PVE.qemu.CmdMenu', {
];
me.callParent();
+
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
+ params: { feature: 'snapshot' },
+ method: 'GET',
+ success: function (response) {
+ let hasFeature = !!response.result.data.hasFeature;
+ let btn = me.down('#takeSnapshotBtn');
+ if (btn) {
+ btn.setDisabled(!(caps.vms['VM.Snapshot'] && hasFeature));
+ }
+ },
+ });
},
});
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 3+ messages in thread