CLOUDSTACK-2760: UI > Infrastructure menu > System VMs > fix a bug that Agent State was not mapped correctly between systemVMs and hosts.

This commit is contained in:
Jessica Wang 2013-07-23 11:34:22 -07:00
parent 3962f117ac
commit c02e802170
1 changed files with 13 additions and 18 deletions

View File

@ -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));