Updated Branches: refs/heads/master 3962f117a -> c02e80217
CLOUDSTACK-2760: UI > Infrastructure menu > System VMs > fix a bug that Agent State was not mapped correctly between systemVMs and hosts. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c02e8021 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c02e8021 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c02e8021 Branch: refs/heads/master Commit: c02e802170369477548cb71209b4942ad1ecec04 Parents: 3962f11 Author: Jessica Wang <[email protected]> Authored: Tue Jul 23 11:34:22 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Tue Jul 23 11:34:22 2013 -0700 ---------------------------------------------------------------------- ui/scripts/system.js | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c02e8021/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index a56397e..e339230 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -7420,34 +7420,29 @@ listAll: true }, success: function(json) { - var items = json.listsystemvmsresponse.systemvm; - if (items != null) { + var systemvmObjs = json.listsystemvmsresponse.systemvm; + if (systemvmObjs != null) { $.ajax({ - url: createURL("listHosts&listAll=true"), - async: false, + url: createURL("listHosts&listAll=true"), success: function(json) { - - var hostObj = json.listhostsresponse.host; - - $(hostObj).each(function(index) { - - $.extend(items[index], { - agentstate: hostObj[index].state - }); - - }); + var hostObjs = json.listhostsresponse.host; + for (var i = 0; i < systemvmObjs.length; i++) { + for (var k = 0; k < hostObjs.length; k++) { + if (hostObjs[k].name == systemvmObjs[i].name) { + systemvmObjs[i].agentstate = hostObjs[k].state; + break; + } + } + } args.response.success({ - data: items + data: systemvmObjs }); }, error: function(json) { args.response.error(parseXMLHttpResponse(json)); - } }); } - - // args.response.success({ data: json.listsystemvmsresponse.systemvm }); }, error: function(json) { args.response.error(parseXMLHttpResponse(json));
