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 <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2024-05-03 13:19:55 +02:00 committed by Fabian Grünbichler
parent faa83925c9
commit 3dba293d78

View File

@ -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,