
Asynchronized tasks need continuously tracking until they are finished to allow API consumer register a listener to take actions accordingly. One of the common case is file uploading. When the user uploads a file he expects there is a progress bar showing upload percentage. In our case, after we submit the generate debug report form, we will close the generate window and add a "generating" line in the grid when we receive the first response with HTTP status code 200. If the status code is 4xx, we will not close the window because HTTP 4xx means there is something wrong with user's input and we will keep the window there to allow the user do some correction. Signed-off-by: Hongliang Wang <hlwang@linux.vnet.ibm.com> --- ui/js/src/kimchi.api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 0d96d07..c28a080 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -655,7 +655,7 @@ var kimchi = { }); }, - createReport: function(settings, suc, err) { + createReport: function(settings, suc, err, progress) { var taskID = -1; var onTaskResponse = function(result) { var taskStatus = result['status']; @@ -664,6 +664,7 @@ var kimchi = { if(kimchi.stopTrackingReport === true) { return; } + progress && progress(result); setTimeout(function() { trackTask(); }, 200); -- 1.8.1.4