public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] ui: guest cmd menu: don't close it when error dialog is clicked
Date: Mon,  2 Nov 2026 16:25:32 +0100	[thread overview]
Message-ID: <20261102152540.3397919-1-d.csapak@proxmox.com> (raw)

If for some reason the API call fails (wrongly cached permissions,
invalid storage configuration in the guest, etc.) interacting with the
error popup normally steals focus from the context menu and closes it.

Even in such an 'invalid' configuration state, we should not deny
users access to the cmd menu in this way, so prevent the context menu
from hiding until the error message is closed.

The take snapshot button is disabled by default, so without the result
of the API call it simply does not get enabled.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/lxc/CmdMenu.js  | 8 ++++++++
 www/manager6/qemu/CmdMenu.js | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index a7940e04..3997f515 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -185,6 +185,8 @@ Ext.define('PVE.lxc.CmdMenu', {
         me.callParent();
 
         if (caps.vms['VM.Snapshot']) {
+            let errorShown = false;
+            me.on('beforehide', () => !errorShown);
             Proxmox.Utils.API2Request({
                 url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
                 params: { feature: 'snapshot' },
@@ -196,6 +198,12 @@ Ext.define('PVE.lxc.CmdMenu', {
                         btn.setDisabled(!hasFeature);
                     }
                 },
+                failure: (response) => {
+                    errorShown = true;
+                    Ext.Msg.alert(gettext('Error'), response.htmlStatus, () => {
+                        errorShown = false;
+                    });
+                },
             });
         }
     },
diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index df6045bf..1699881b 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -230,6 +230,8 @@ Ext.define('PVE.qemu.CmdMenu', {
         me.callParent();
 
         if (caps.vms['VM.Snapshot']) {
+            let errorShown = false;
+            me.on('beforehide', () => !errorShown);
             Proxmox.Utils.API2Request({
                 url: `/nodes/${info.node}/${info.type}/${info.vmid}/feature`,
                 params: { feature: 'snapshot' },
@@ -241,6 +243,12 @@ Ext.define('PVE.qemu.CmdMenu', {
                         btn.setDisabled(!hasFeature);
                     }
                 },
+                failure: (response) => {
+                    errorShown = true;
+                    Ext.Msg.alert(gettext('Error'), response.htmlStatus, () => {
+                        errorShown = false;
+                    });
+                },
             });
         }
     },
-- 
2.47.3





                 reply	other threads:[~2026-11-02 15:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102152540.3397919-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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