On 08/29/2017 01:04 PM, Fabian Grünbichler wrote:
modeled after the mechanism used in window/Edit.js

Signed-off-by: Fabian Grünbichler <[email protected]>
---
new in v2

  www/manager6/window/SafeDestroy.js | 28 +++++++++++++++++++++++++---
  1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/www/manager6/window/SafeDestroy.js 
b/www/manager6/window/SafeDestroy.js
index a7ecf5fd..f1941e9e 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: {
@@ -62,10 +63,31 @@ Ext.define('PVE.window.SafeDestroy', {
                        waitMsgTarget: view,
                        failure: function(response, opts) {
                            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();
+                           }
+                       },

www/manager6's `make lint` complains about the trailing comma above.
besides that: looks good for me

                    });
                }
              }




_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to