CLOUDSTACK-2074: cloudstack UI - Affinity - Affinity Group page - details tab - implement "View Instances" on right top corner.

This commit is contained in:
Jessica Wang 2013-04-18 14:04:31 -07:00
parent 3390f0114b
commit 030235ba52
2 changed files with 53 additions and 6 deletions

View File

@ -201,8 +201,7 @@
for(var k = 0; k < firstPageVms.length; k++) {
if(firstPageVms[k].id == vmIds[i]) {
matchFound = true;
item.displayname = firstPageVms[k].displayname;
item.state = firstPageVms[k].state;
item = firstPageVms[k];
break; //break for looup
}
}
@ -213,9 +212,7 @@
async: false,
data: {id: vmIds[i]},
success: function(json) {
var vmObj = json.listvirtualmachinesresponse.virtualmachine[0];
item.displayname = vmObj.displayname;
item.state = vmObj.state;
item = json.listvirtualmachinesresponse.virtualmachine[0];
}
});
}

View File

@ -197,7 +197,57 @@
hostid: args.context.hosts[0].id
});
}
if("affinityGroups" in args.context) {
var vmIds = args.context.affinityGroups[0].virtualmachineIds;
if(vmIds == null || vmIds.length == 0) {
args.response.success({data: null});
return;
}
$.ajax({
url: createURL('listVirtualMachines'),
data: data,
success: function(json) {
var firstPageVms = json.listvirtualmachinesresponse.virtualmachine;
var items = [];
if(vmIds != null) {
for(var i = 0; i < vmIds.length; i++) {
var item = null;
var matchFound = false;
if(firstPageVms != null) {
for(var k = 0; k < firstPageVms.length; k++) {
if(firstPageVms[k].id == vmIds[i]) {
matchFound = true;
item = firstPageVms[k];
break; //break for looup
}
}
}
/*
if(matchFound == false) { //Either the VM is not in API response of "listVirtualMachines&page=1&pagesize=500" OR its state doesn't match value in state filter on top in instance listView
$.ajax({
url: createURL('listVirtualMachines'),
async: false,
data: {id: vmIds[i]},
success: function(json) {
item = json.listvirtualmachinesresponse.virtualmachine[0];
}
});
}
*/
if(item != null)
items.push(item);
}
}
args.response.success({
actionFilter: vmActionfilter,
data: items
});
}
});
return;
}
$.ajax({
url: createURL('listVirtualMachines'),
data: data,