[pve-devel] [PATCH manager 1/5] Add a "Run task in background" button to make users feel safer

Emmanuel Kasper e.kasper at proxmox.com
Thu Jul 6 14:01:27 CEST 2017


It is not oobvious when closing a Task Window, especially
one than popped up from itself ( template download, or backup), that
closing will not interrupt the action.

Instead of leaving the user in doubt, a "Run task in background button"
let the user work with the rest of the UI while the task runs.

Idea taken from the Eclipse IDE update manager, and multiple Video/Music
encoders which have similar buttons.
---
 www/manager6/window/TaskViewer.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/www/manager6/window/TaskViewer.js b/www/manager6/window/TaskViewer.js
index 0750ffdf..c27bffff 100644
--- a/www/manager6/window/TaskViewer.js
+++ b/www/manager6/window/TaskViewer.js
@@ -170,6 +170,15 @@ Ext.define('PVE.window.TaskViewer', {
 	    handler: stop_task
 	});
 
+	var background_btn = Ext.create({
+	    xtype: 'button',
+	    disabled: true,
+	    text: gettext('Run in background'),
+	    handler: function() {
+		me.close();
+	    }
+	});
+
 	statgrid = Ext.create('PVE.grid.ObjectGrid', {
 	    title: gettext('Status'),
 	    layout: 'fit',
@@ -181,7 +190,7 @@ Ext.define('PVE.window.TaskViewer', {
 
 	var logView = Ext.create('PVE.panel.LogView', {
 	    title: gettext('Output'),
-	    tbar: [ stop_btn2 ],
+	    tbar: [ stop_btn2, '->', background_btn ],
 	    border: false,
 	    url: "/api2/extjs/nodes/" + task.node + "/tasks/" + me.upid + "/log"
 	});
@@ -197,6 +206,7 @@ Ext.define('PVE.window.TaskViewer', {
 
 	    stop_btn1.setDisabled(status !== 'running');
 	    stop_btn2.setDisabled(status !== 'running');
+	    background_btn.setDisabled(status !== 'running');
 	});
 
 	statstore.startUpdate();
-- 
2.11.0





More information about the pve-devel mailing list