[Kimchi-devel] [PATCH 1/2] Bug fix: Properly define kimchi.trackTask()
Aline Manera
alinefm at linux.vnet.ibm.com
Tue Nov 10 12:07:27 UTC 2015
While creating a new guest, it was not being displayed on UI due the
following error:
GET https://localhost:8001/plugins/kimchi/tasks?statu..._uri=%5E%2Fplugins%2Fkimchi%2Fvms%2F
TypeError: kimchi.trackTask is not a function
Fix it.
Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/ui/js/src/kimchi.api.js | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js b/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js
index b1acdb9..d01bed4 100644
--- a/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js
+++ b/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js
@@ -500,6 +500,32 @@ var kimchi = {
});
},
+ trackTask : function(taskID, suc, err, progress) {
+ var onTaskResponse = function(result) {
+ var taskStatus = result['status'];
+ switch(taskStatus) {
+ case 'running':
+ progress && progress(result);
+ setTimeout(function() {
+ kimchi.trackTask(taskID, suc, err, progress);
+ }, 2000);
+ break;
+ case 'finished':
+ suc && suc(result);
+ break;
+ case 'failed':
+ err && err(result);
+ break;
+ default:
+ break;
+ }
+ };
+
+ kimchi.getTask(taskID, onTaskResponse, err);
+ if(kimchi.trackingTasks.indexOf(taskID) < 0)
+ kimchi.trackingTasks.push(taskID);
+ },
+
deleteStoragePool : function(poolName, suc, err) {
$.ajax({
url : 'plugins/kimchi/storagepools/' + encodeURIComponent(poolName),
--
2.5.0
More information about the Kimchi-devel
mailing list