From 3dba293d781e8894a9cd87201b72382b3d0b9681 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Fri, 3 May 2024 13:19:55 +0200 Subject: [PATCH] ui: qemu: hardware: use background delay for asynchronous remove tasks 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,