cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [23/43] git commit: updated refs/heads/master to 5ce2890
Date Thu, 25 Apr 2013 18:08:41 GMT
CLOUDSTACK-2074: cloudstack UI - Affinity - Affinity Group page - details tab - implement "View
Instances" on right top corner.


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

Branch: refs/heads/master
Commit: 030235ba5203ddc78be88adba6da95b0534df656
Parents: 3390f01
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Thu Apr 18 14:04:31 2013 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Thu Apr 18 14:04:31 2013 -0700

----------------------------------------------------------------------
 ui/scripts/affinity.js  |    7 +----
 ui/scripts/instances.js |   52 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/030235ba/ui/scripts/affinity.js
----------------------------------------------------------------------
diff --git a/ui/scripts/affinity.js b/ui/scripts/affinity.js
index daa8fb7..d59d129 100644
--- a/ui/scripts/affinity.js
+++ b/ui/scripts/affinity.js
@@ -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];														
 													}
 												});
                       }											

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/030235ba/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 95f23ed..7976ee6 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -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,


Mime
View raw message