Skip to content

Commit 09b898a

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2760: UI > Infrastructure menu > System VMs > fix a bug that Agent State was not mapped correctly between systemVMs and hosts.
1 parent 6826528 commit 09b898a

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7420,34 +7420,29 @@
74207420
listAll: true
74217421
},
74227422
success: function(json) {
7423-
var items = json.listsystemvmsresponse.systemvm;
7424-
if (items != null) {
7423+
var systemvmObjs = json.listsystemvmsresponse.systemvm;
7424+
if (systemvmObjs != null) {
74257425
$.ajax({
7426-
url: createURL("listHosts&listAll=true"),
7427-
async: false,
7426+
url: createURL("listHosts&listAll=true"),
74287427
success: function(json) {
7429-
7430-
var hostObj = json.listhostsresponse.host;
7431-
7432-
$(hostObj).each(function(index) {
7433-
7434-
$.extend(items[index], {
7435-
agentstate: hostObj[index].state
7436-
});
7437-
7438-
});
7428+
var hostObjs = json.listhostsresponse.host;
7429+
for (var i = 0; i < systemvmObjs.length; i++) {
7430+
for (var k = 0; k < hostObjs.length; k++) {
7431+
if (hostObjs[k].name == systemvmObjs[i].name) {
7432+
systemvmObjs[i].agentstate = hostObjs[k].state;
7433+
break;
7434+
}
7435+
}
7436+
}
74397437
args.response.success({
7440-
data: items
7438+
data: systemvmObjs
74417439
});
74427440
},
74437441
error: function(json) {
74447442
args.response.error(parseXMLHttpResponse(json));
7445-
74467443
}
74477444
});
74487445
}
7449-
7450-
// args.response.success({ data: json.listsystemvmsresponse.systemvm });
74517446
},
74527447
error: function(json) {
74537448
args.response.error(parseXMLHttpResponse(json));

0 commit comments

Comments
 (0)