From c4fa5c0f170bfb8fe6dbb385b8c87d890e2f97f1 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 19 Apr 2013 14:05:58 -0700 Subject: [PATCH] CLOUDSTACK-2074: cloudstack UI - Affinity - "View Instances" drilldown - new parameter "affinitygroupid" has been added to listVirtualMachines API. Here is related UI change. --- ui/scripts/instances.js | 50 +++-------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index cb20124e6ff..8699b4d3c68 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -199,53 +199,9 @@ } 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; + $.extend(data, { + affinitygroupid: args.context.affinityGroups[0].id + }); } $.ajax({