CLOUDSTACK-2074: cloudstack UI - Affinity - "View Instances" drilldown - new 
parameter "affinitygroupid" has been added to listVirtualMachines API. Here is 
related UI change.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c4fa5c0f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c4fa5c0f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c4fa5c0f

Branch: refs/heads/master
Commit: c4fa5c0f170bfb8fe6dbb385b8c87d890e2f97f1
Parents: ef4ed01
Author: Jessica Wang <jessica.w...@citrix.com>
Authored: Fri Apr 19 14:05:58 2013 -0700
Committer: Jessica Wang <jessica.w...@citrix.com>
Committed: Fri Apr 19 14:06:25 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js |   50 ++---------------------------------------
 1 files changed, 3 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c4fa5c0f/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index cb20124..8699b4d 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({

Reply via email to