From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E43991FF38D for ; Fri, 3 May 2024 13:20:32 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5AA5A36820; Fri, 3 May 2024 13:20:05 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Fri, 3 May 2024 13:19:55 +0200 Message-Id: <20240503111956.46543-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240503111956.46543-1-f.ebner@proxmox.com> References: <20240503111956.46543-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.065 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager 1/2] ui: qemu: hardware: use background delay for asynchronous remove tasks 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" Avoids spawning a progress window for tasks that do complete more quickly than the background delay. Currently, the remove task is only asynchronous (i.e. using POST) when it's for an unused disk, but this might change in the future (e.g. for hot-unplug). When adding a disk, a background delay of 5 seconds is already used. Signed-off-by: Fiona Ebner --- www/manager6/qemu/HardwareView.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js index 672a7e1a..6dcba071 100644 --- a/www/manager6/qemu/HardwareView.js +++ b/www/manager6/qemu/HardwareView.js @@ -486,17 +486,19 @@ Ext.define('PVE.qemu.HardwareView', { return msg; }, handler: function(btn, e, rec) { + let params = { 'delete': rec.data.key }; + if (btn.RESTMethod === 'POST') { + params.background_delay = 5; + } Proxmox.Utils.API2Request({ url: '/api2/extjs/' + baseurl, waitMsgTarget: me, method: btn.RESTMethod, - params: { - 'delete': rec.data.key, - }, + params: params, callback: () => me.reload(), failure: response => Ext.Msg.alert('Error', response.htmlStatus), success: function(response, options) { - if (btn.RESTMethod === 'POST') { + if (btn.RESTMethod === 'POST' && response.result.data !== null) { Ext.create('Proxmox.window.TaskProgress', { autoShow: true, upid: response.result.data, -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel