public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager 0/2] ui: fix #6209: create snapshots and backups from context menu
@ 2025-09-30 13:01 Nicolas Frey
  2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 1/2] ui: remove excess '}' at the end of snapshot subject Nicolas Frey
  2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Frey @ 2025-09-30 13:01 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.

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

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

 www/manager6/lxc/CmdMenu.js     | 45 +++++++++++++++++++++++++++++++++
 www/manager6/qemu/CmdMenu.js    | 45 +++++++++++++++++++++++++++++++++
 www/manager6/window/Snapshot.js |  2 +-
 3 files changed, 91 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] 6+ messages in thread

* [pve-devel] [PATCH pve-manager 1/2] ui: remove excess '}' at the end of snapshot subject
  2025-09-30 13:01 [pve-devel] [PATCH pve-manager 0/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
@ 2025-09-30 13:01 ` Nicolas Frey
  2025-10-02  8:35   ` Fiona Ebner
  2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Frey @ 2025-09-30 13:01 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] 6+ messages in thread

* [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu
  2025-09-30 13:01 [pve-devel] [PATCH pve-manager 0/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
  2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 1/2] ui: remove excess '}' at the end of snapshot subject Nicolas Frey
@ 2025-09-30 13:01 ` Nicolas Frey
  2025-10-02  8:36   ` Fiona Ebner
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Frey @ 2025-09-30 13:01 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  | 45 ++++++++++++++++++++++++++++++++++++
 www/manager6/qemu/CmdMenu.js | 45 ++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index cd60c967..6ab8b366 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -30,6 +30,17 @@ Ext.define('PVE.lxc.CmdMenu', {
             });
         };
 
+        let snapshotFeature;
+
+        Proxmox.Utils.API2Request({
+            url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
+            params: { feature: 'snapshot' },
+            method: 'GET',
+            success: function (response, _) {
+                snapshotFeature = !!response.result.data.hasFeature;
+            },
+        });
+
         let caps = Ext.state.Manager.get('GuiCap');
         let standalone = PVE.Utils.isStandaloneNode();
 
@@ -134,6 +145,40 @@ Ext.define('PVE.lxc.CmdMenu', {
                 },
             },
             { xtype: 'menuseparator' },
+            {
+                text: gettext('Take Snapshot'),
+                iconCls: 'fa fa-fw fa-history',
+                disabled: !!caps.vms['VM.Snapshot'] && snapshotFeature,
+                handler: function () {
+
+                    let win = Ext.create('PVE.window.Snapshot', {
+                        nodename: info.node,
+                        vmid: info.vmid,
+                        vmname: info.name,
+                        viewonly: !caps.vms['VM.Snapshot'],
+                        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.Snapshot'] && snapshotFeature,
+                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',
diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index 5fa9407d..5f9ba740 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -31,6 +31,17 @@ Ext.define('PVE.qemu.CmdMenu', {
             });
         };
 
+        let snapshotFeature;
+
+        Proxmox.Utils.API2Request({
+            url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
+            params: { feature: 'snapshot' },
+            method: 'GET',
+            success: function (response, _) {
+                snapshotFeature = !!response.result.data.hasFeature;
+            },
+        });
+
         let caps = Ext.state.Manager.get('GuiCap');
         let standalone = PVE.Utils.isStandaloneNode();
 
@@ -162,6 +173,40 @@ Ext.define('PVE.qemu.CmdMenu', {
                 },
             },
             { xtype: 'menuseparator' },
+            {
+                text: gettext('Take Snapshot'),
+                iconCls: 'fa fa-fw fa-history',
+                disabled: !!caps.vms['VM.Snapshot'] && snapshotFeature,
+                handler: function () {
+
+                    let win = Ext.create('PVE.window.Snapshot', {
+                        nodename: info.node,
+                        vmid: info.vmid,
+                        vmname: info.name,
+                        viewonly: !caps.vms['VM.Snapshot'],
+                        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.Snapshot'] && snapshotFeature,
+                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',
-- 
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] 6+ messages in thread

* Re: [pve-devel] [PATCH pve-manager 1/2] ui: remove excess '}' at the end of snapshot subject
  2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 1/2] ui: remove excess '}' at the end of snapshot subject Nicolas Frey
@ 2025-10-02  8:35   ` Fiona Ebner
  0 siblings, 0 replies; 6+ messages in thread
From: Fiona Ebner @ 2025-10-02  8:35 UTC (permalink / raw)
  To: Proxmox VE development discussion, Nicolas Frey

Minor nit: the commit title could be improved. I'd suggest adding a
second prefix like "ui: guest snapshot: ..." and "... of window title"
instead of the rather unclear "snapshot subject" at the end of the sentence.

Am 30.09.25 um 3:01 PM schrieb Nicolas Frey:
> Noticed one too many curly braces in the Snapshot window title.
> 
> Signed-off-by: Nicolas Frey <n.frey@proxmox.com>

Reviewed-by: Fiona Ebner <f.ebner@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 {



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


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

* Re: [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu
  2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
@ 2025-10-02  8:36   ` Fiona Ebner
  2025-10-02 13:03     ` Nicolas Frey
  0 siblings, 1 reply; 6+ messages in thread
From: Fiona Ebner @ 2025-10-02  8:36 UTC (permalink / raw)
  To: Proxmox VE development discussion, Nicolas Frey

Looks quite good already! And I like the addition of the entry for
backup too.

Am 30.09.25 um 3:01 PM 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
> 

Nit: please drop the blank line between the trailers

> Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
> ---
>  www/manager6/lxc/CmdMenu.js  | 45 ++++++++++++++++++++++++++++++++++++
>  www/manager6/qemu/CmdMenu.js | 45 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 90 insertions(+)
> 
> diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
> index cd60c967..6ab8b366 100644
> --- a/www/manager6/lxc/CmdMenu.js
> +++ b/www/manager6/lxc/CmdMenu.js
> @@ -30,6 +30,17 @@ Ext.define('PVE.lxc.CmdMenu', {
>              });
>          };
>  
> +        let snapshotFeature;
> +
> +        Proxmox.Utils.API2Request({
> +            url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
> +            params: { feature: 'snapshot' },
> +            method: 'GET',
> +            success: function (response, _) {
> +                snapshotFeature = !!response.result.data.hasFeature;

Since the API request is async, the success handler will only be called
after the snapshotFeature variable has already been read from in the
code below.

> +            },
> +        });
> +
>          let caps = Ext.state.Manager.get('GuiCap');
>          let standalone = PVE.Utils.isStandaloneNode();
>  
> @@ -134,6 +145,40 @@ Ext.define('PVE.lxc.CmdMenu', {
>                  },
>              },
>              { xtype: 'menuseparator' },
> +            {
> +                text: gettext('Take Snapshot'),
> +                iconCls: 'fa fa-fw fa-history',
> +                disabled: !!caps.vms['VM.Snapshot'] && snapshotFeature,

The condition should be negated

> +                handler: function () {
> +

Style nit: blank line here should be removed

> +                    let win = Ext.create('PVE.window.Snapshot', {
> +                        nodename: info.node,
> +                        vmid: info.vmid,
> +                        vmname: info.name,
> +                        viewonly: !caps.vms['VM.Snapshot'],

Nit: could also just be 'false' for easier readability (it's always an
isCreate, so it should never have viewonly)

> +                        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.Snapshot'] && snapshotFeature,

This should rather check only for the backup capability

> +                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',
> diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
> index 5fa9407d..5f9ba740 100644
> --- a/www/manager6/qemu/CmdMenu.js
> +++ b/www/manager6/qemu/CmdMenu.js
> @@ -31,6 +31,17 @@ Ext.define('PVE.qemu.CmdMenu', {

Same comments as for the lxc context menu apply for the VM context menu


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


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

* Re: [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu
  2025-10-02  8:36   ` Fiona Ebner
@ 2025-10-02 13:03     ` Nicolas Frey
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Frey @ 2025-10-02 13:03 UTC (permalink / raw)
  To: Fiona Ebner, Proxmox VE development discussion



On 10/2/25 10:35 AM, Fiona Ebner wrote:
> Looks quite good already! And I like the addition of the entry for
> backup too.
> 
> Am 30.09.25 um 3:01 PM 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
>>
> 
> Nit: please drop the blank line between the trailers
> 
>> Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
>> ---
>>  www/manager6/lxc/CmdMenu.js  | 45 ++++++++++++++++++++++++++++++++++++
>>  www/manager6/qemu/CmdMenu.js | 45 ++++++++++++++++++++++++++++++++++++
>>  2 files changed, 90 insertions(+)
>>
>> diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
>> index cd60c967..6ab8b366 100644
>> --- a/www/manager6/lxc/CmdMenu.js
>> +++ b/www/manager6/lxc/CmdMenu.js
>> @@ -30,6 +30,17 @@ Ext.define('PVE.lxc.CmdMenu', {
>>              });
>>          };
>>  
>> +        let snapshotFeature;
>> +
>> +        Proxmox.Utils.API2Request({
>> +            url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
>> +            params: { feature: 'snapshot' },
>> +            method: 'GET',
>> +            success: function (response, _) {
>> +                snapshotFeature = !!response.result.data.hasFeature;
> 
> Since the API request is async, the success handler will only be called
> after the snapshotFeature variable has already been read from in the
> code below.
> 
>> +            },
>> +        });
>> +
>>          let caps = Ext.state.Manager.get('GuiCap');
>>          let standalone = PVE.Utils.isStandaloneNode();
>>  
>> @@ -134,6 +145,40 @@ Ext.define('PVE.lxc.CmdMenu', {
>>                  },
>>              },
>>              { xtype: 'menuseparator' },
>> +            {
>> +                text: gettext('Take Snapshot'),
>> +                iconCls: 'fa fa-fw fa-history',
>> +                disabled: !!caps.vms['VM.Snapshot'] && snapshotFeature,
> 
> The condition should be negated
> 
>> +                handler: function () {
>> +
> 
> Style nit: blank line here should be removed
> 
>> +                    let win = Ext.create('PVE.window.Snapshot', {
>> +                        nodename: info.node,
>> +                        vmid: info.vmid,
>> +                        vmname: info.name,
>> +                        viewonly: !caps.vms['VM.Snapshot'],
> 
> Nit: could also just be 'false' for easier readability (it's always an
> isCreate, so it should never have viewonly)
> 

Good point, will change in a v2.

>> +                        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.Snapshot'] && snapshotFeature,
> 
> This should rather check only for the backup capability
> 

Ah thank you, I forgot to change this when reusing the code from snapshot

>> +                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',
>> diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
>> index 5fa9407d..5f9ba740 100644
>> --- a/www/manager6/qemu/CmdMenu.js
>> +++ b/www/manager6/qemu/CmdMenu.js
>> @@ -31,6 +31,17 @@ Ext.define('PVE.qemu.CmdMenu', {
> 
> Same comments as for the lxc context menu apply for the VM context menu
Will send a v2 soon, thanks for the review!



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


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-30 13:01 [pve-devel] [PATCH pve-manager 0/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 1/2] ui: remove excess '}' at the end of snapshot subject Nicolas Frey
2025-10-02  8:35   ` Fiona Ebner
2025-09-30 13:01 ` [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu Nicolas Frey
2025-10-02  8:36   ` Fiona Ebner
2025-10-02 13:03     ` 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