]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - window/TaskViewer.js
task view, progress: add taskDone callback
[proxmox-widget-toolkit.git] / window / TaskViewer.js
index c6bb370ff050529a9251d703da5141d454b79095..39f42ad39b5b1aab618d20a1b45c252877ba5d68 100644 (file)
@@ -2,6 +2,8 @@ Ext.define('Proxmox.window.TaskProgress', {
     extend: 'Ext.window.Window',
     alias: 'widget.proxmoxTaskProgress',
 
+    taskDone: Ext.emptyFn,
+
     initComponent: function() {
         var me = this;
 
@@ -44,6 +46,7 @@ Ext.define('Proxmox.window.TaskProgress', {
                    me.close();
                    Ext.Msg.alert('Task failed', exitstatus);
                }
+               me.taskDone(exitstatus == 'OK');
            }
        });
 
@@ -61,6 +64,7 @@ Ext.define('Proxmox.window.TaskProgress', {
                    text: gettext('Details'),
                    handler: function() {                       
                        var win = Ext.create('Proxmox.window.TaskViewer', { 
+                           taskDone: me.taskDone,
                            upid: me.upid
                        });
                        win.show();
@@ -87,6 +91,8 @@ Ext.define('Proxmox.window.TaskViewer', {
 
     extraTitle: '', // string to prepend after the generic task title
 
+    taskDone: Ext.emptyFn,
+
     initComponent: function() {
         var me = this;
 
@@ -195,6 +201,7 @@ Ext.define('Proxmox.window.TaskViewer', {
                logView.requestUpdate(undefined, true);
                logView.scrollToEnd = false;
                statstore.stopUpdate();
+               me.taskDone(statgrid.getObjectValue('exitstatus') == 'OK');
            }
 
            stop_btn1.setDisabled(status !== 'running');