From 707c28ce80b5008f5af4207a897e3caae7f5758d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 5 Sep 2017 14:59:46 +0200 Subject: [PATCH] add showProgress to SafeDestroy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit modeled after the mechanism used in window/Edit.js Signed-off-by: Fabian Grünbichler --- www/manager6/window/SafeDestroy.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js index a7ecf5fd..451ab046 100644 --- a/www/manager6/window/SafeDestroy.js +++ b/www/manager6/window/SafeDestroy.js @@ -13,6 +13,7 @@ Ext.define('PVE.window.SafeDestroy', { width: 450, layout: { type:'hbox' }, defaultFocus: 'confirmField', + showProgress: false, config: { item: { @@ -61,10 +62,31 @@ Ext.define('PVE.window.SafeDestroy', { method: 'DELETE', waitMsgTarget: view, failure: function(response, opts) { + view.close(); Ext.Msg.alert('Error', response.htmlStatus); }, - callback: function() { - view.close(); + success: function(response, options) { + var hasProgressBar = view.showProgress && + response.result.data ? true : false; + + if (hasProgressBar) { + // stay around so we can trigger our close events + // when background action is completed + view.hide(); + + var upid = response.result.data; + var win = Ext.create('PVE.window.TaskProgress', { + upid: upid, + listeners: { + destroy: function () { + view.close(); + } + } + }); + win.show(); + } else { + view.close(); + } } }); }