all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager v2 0/2] ui: fix #6209: create snapshots and backups from context menu
@ 2025-10-02 15:16 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
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Nicolas Frey @ 2025-10-02 15:16 UTC (permalink / raw)
  To: pve-devel

This patch series adds functionality to take snapshots and create
manual backups of VMs and CTs through the right-click context menu.

The original feature request [0] only specified the ability to take
snapshots. I added the manual backup shortcut as well, since
navigating through the menu for this action felt unnecessarily
cumbersome when performing just a quick backup. LMK if that is a
useful addition.

changes since v1, thanks @Fiona Ebner
* clarified commit message
* addressed several issues in the added menu options, namely:
  * correctly handle disabled state with async
  * fixed negation logic and cleaned up minor nits

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6209

Nicolas Frey (2):
  ui: guest snapshot: remove excess '}' at the end of window title
  ui: fix #6209: create snapshots and backups from context menu

 www/manager6/lxc/CmdMenu.js     | 47 +++++++++++++++++++++++++++++++++
 www/manager6/qemu/CmdMenu.js    | 47 +++++++++++++++++++++++++++++++++
 www/manager6/window/Snapshot.js |  2 +-
 3 files changed, 95 insertions(+), 1 deletion(-)

-- 
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] 7+ messages in thread

* [pve-devel] [PATCH pve-manager v2 1/2] ui: guest snapshot: remove excess '}' at the end of window title
  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 ` Nicolas Frey
  2025-10-03 17:31   ` [pve-devel] applied: " Thomas Lamprecht
  2025-10-02 15:16 ` [pve-devel] [PATCH pve-manager v2 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Nicolas Frey @ 2025-10-02 15:16 UTC (permalink / raw)
  To: pve-devel

Noticed one too many curly braces in the Snapshot window title.

Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
 www/manager6/window/Snapshot.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/window/Snapshot.js b/www/manager6/window/Snapshot.js
index 80eaa251..a2134bd3 100644
--- a/www/manager6/window/Snapshot.js
+++ b/www/manager6/window/Snapshot.js
@@ -146,7 +146,7 @@ Ext.define('PVE.window.Snapshot', {
                 me.vmid,
                 me.vmname,
             );
-            subject = `${guestTypeStr} ${formattedGuestIdentifier} ${gettext('Snapshot')}}`;
+            subject = `${guestTypeStr} ${formattedGuestIdentifier} ${gettext('Snapshot')}`;
             me.method = 'POST';
             me.showTaskViewer = true;
         } else {
-- 
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] 7+ messages in thread

* [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
  2025-10-03 14:01 ` [pve-devel] [PATCH pve-manager v2 0/2] " Shan Shaji
  2025-10-07  8:56 ` Nicolas Frey
  3 siblings, 0 replies; 7+ 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>
---
 www/manager6/lxc/CmdMenu.js  | 47 ++++++++++++++++++++++++++++++++++++
 www/manager6/qemu/CmdMenu.js | 47 ++++++++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+)

diff --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));
+                }
+            },
+        });
     },
 });
diff --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] 7+ messages in thread

* Re: [pve-devel] [PATCH pve-manager v2 0/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 ` [pve-devel] [PATCH pve-manager v2 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
@ 2025-10-03 14:01 ` Shan Shaji
  2025-10-07  8:56 ` Nicolas Frey
  3 siblings, 0 replies; 7+ messages in thread
From: Shan Shaji @ 2025-10-03 14:01 UTC (permalink / raw)
  To: Proxmox VE development discussion; +Cc: pve-devel

Applied this patch series and tested the changes. 

Verfied The Following:
- Confirmed the right-click context menu now shows both "Take
  Snapshot" and "Backup now" options. 
- Clicking on the options show the backup and snapshots dialog. 
- Took snapshots for VMs and CTs
- Ran manual PBS backups for a VM and a CT. 
- The snapshot window extra curly brace is also not visible anymore. 

Tested-by: Shan Shaji <s.shaji@proxmox.com>

On Thu Oct 2, 2025 at 5:16 PM CEST, Nicolas Frey wrote:
> This patch series adds functionality to take snapshots and create
> manual backups of VMs and CTs through the right-click context menu.
>
> The original feature request [0] only specified the ability to take
> snapshots. I added the manual backup shortcut as well, since
> navigating through the menu for this action felt unnecessarily
> cumbersome when performing just a quick backup. LMK if that is a
> useful addition.
>
> changes since v1, thanks @Fiona Ebner
> * clarified commit message
> * addressed several issues in the added menu options, namely:
>   * correctly handle disabled state with async
>   * fixed negation logic and cleaned up minor nits
>
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=6209
>
> Nicolas Frey (2):
>   ui: guest snapshot: remove excess '}' at the end of window title
>   ui: fix #6209: create snapshots and backups from context menu
>
>  www/manager6/lxc/CmdMenu.js     | 47 +++++++++++++++++++++++++++++++++
>  www/manager6/qemu/CmdMenu.js    | 47 +++++++++++++++++++++++++++++++++
>  www/manager6/window/Snapshot.js |  2 +-
>  3 files changed, 95 insertions(+), 1 deletion(-)



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] applied: [PATCH pve-manager v2 1/2] ui: guest snapshot: remove excess '}' at the end of window title
  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-03 17:31   ` Thomas Lamprecht
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Lamprecht @ 2025-10-03 17:31 UTC (permalink / raw)
  To: Proxmox VE development discussion, Nicolas Frey

Am 02.10.25 um 17:15 schrieb Nicolas Frey:
> Noticed one too many curly braces in the Snapshot window title.
> 
> Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
> ---
>  www/manager6/window/Snapshot.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied this one already, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH pve-manager v2 0/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
                   ` (2 preceding siblings ...)
  2025-10-03 14:01 ` [pve-devel] [PATCH pve-manager v2 0/2] " Shan Shaji
@ 2025-10-07  8:56 ` Nicolas Frey
  3 siblings, 0 replies; 7+ messages in thread
From: Nicolas Frey @ 2025-10-07  8:56 UTC (permalink / raw)
  To: pve-devel

superseded-by: https://lore.proxmox.com/pve-devel/20251006133308.119141-1-n.frey@proxmox.com/T/#u

On 10/2/25 5:15 PM, Nicolas Frey wrote:
> This patch series adds functionality to take snapshots and create
> manual backups of VMs and CTs through the right-click context menu.
> 
> The original feature request [0] only specified the ability to take
> snapshots. I added the manual backup shortcut as well, since
> navigating through the menu for this action felt unnecessarily
> cumbersome when performing just a quick backup. LMK if that is a
> useful addition.
> 
> changes since v1, thanks @Fiona Ebner
> * clarified commit message
> * addressed several issues in the added menu options, namely:
>   * correctly handle disabled state with async
>   * fixed negation logic and cleaned up minor nits
> 
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=6209
> 
> Nicolas Frey (2):
>   ui: guest snapshot: remove excess '}' at the end of window title
>   ui: fix #6209: create snapshots and backups from context menu
> 
>  www/manager6/lxc/CmdMenu.js     | 47 +++++++++++++++++++++++++++++++++
>  www/manager6/qemu/CmdMenu.js    | 47 +++++++++++++++++++++++++++++++++
>  www/manager6/window/Snapshot.js |  2 +-
>  3 files changed, 95 insertions(+), 1 deletion(-)
> 



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH pve-manager v2 2/2] ui: fix #6209: create snapshots and backups from context menu
       [not found] <89366ef9-275a-46ef-b639-9b9d056f0d8e@proxmox.com>
@ 2025-10-07  9:03 ` Thomas Lamprecht
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Lamprecht @ 2025-10-07  9:03 UTC (permalink / raw)
  To: Proxmox VE development discussion

re-sending this previous review as I forgot to CC the list when I sent
this on 2025-10-03...

Am 02.10.25 um 17:15 schrieb Nicolas Frey:
> 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>
> ---
>  www/manager6/lxc/CmdMenu.js  | 47 ++++++++++++++++++++++++++++++++++++
>  www/manager6/qemu/CmdMenu.js | 47 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 94 insertions(+)
> 
> diff --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', {


You can use:

autoShow: true,

here and avoid the need for the extra call to .show() and thus the win
variable.

> +                        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', {

same w.r.t. using autoShow

> +                        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));

You could skip doing the API call if caps.vms['VM.Snapshot'] is false as optimization,
as no point in checking in that case.

And while right-click is something a user explicitly needs to do, I'm not sure
if it's really worth doing an extra API call every time the menu is opened though,
while this is mostly iterating all volumes in the config and checking the storage
plugin, it might have a noticeable delay on any non-local PVE, especially on
spotty connections.

It's a tiny bit worse UX, but as trade-off we could only check if one clicks
this menu entry and then show a message or the like. If users complain about
UX we can still think about something else. What do you think?

FYI, I can be fine with doing it your proposed way, but for these things I'd
like to have other potential options at least explored, and having some
rationale for why it's fine to do this api call on context menu open in the
encoded in the commit message would be definitively warranted.

> +                }
> +            },
> +        });
>      },
>  });
> diff --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();


same w.r.t. using autoShow

> +                },
> +            },
> +            {
> +                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();

same w.r.t. using autoShow

> +                },
> +            },
> +            { 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));
> +                }
> +            },
> +        });
>      },
>  });



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2025-10-07  9:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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-03 17:31   ` [pve-devel] applied: " Thomas Lamprecht
2025-10-02 15:16 ` [pve-devel] [PATCH pve-manager v2 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
2025-10-03 14:01 ` [pve-devel] [PATCH pve-manager v2 0/2] " Shan Shaji
2025-10-07  8:56 ` Nicolas Frey
     [not found] <89366ef9-275a-46ef-b639-9b9d056f0d8e@proxmox.com>
2025-10-07  9:03 ` [pve-devel] [PATCH pve-manager v2 2/2] " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal