From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D3A941FF17E for ; Thu, 2 Oct 2025 15:04:14 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 312C0F7BC; Thu, 2 Oct 2025 15:04:21 +0200 (CEST) Message-ID: Date: Thu, 2 Oct 2025 15:03:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Fiona Ebner , Proxmox VE development discussion References: <20250930130134.101875-1-n.frey@proxmox.com> <20250930130134.101875-3-n.frey@proxmox.com> <3838714d-14b8-4c47-af8e-6ed7d6ce5723@proxmox.com> From: Nicolas Frey Content-Language: en-US In-Reply-To: <3838714d-14b8-4c47-af8e-6ed7d6ce5723@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759410203027 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.059 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: Re: [pve-devel] [PATCH pve-manager 2/2] ui: fix #6209: create snapshots and backups from context menu X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 >> --- >> 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