cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [22/50] [abbrv] git commit: updated refs/heads/marvin_refactor to 7c439fe
Date Mon, 29 Apr 2013 13:14:00 GMT
CLOUDSTACK-2120: mixed zone management - (1) extend listRouters API to to take in zonetype.
(2) UI: populate Routers list page with ones whose networktype matches selected option in
zone type dropdown on top menu. (3) UI: count total number of Routers based on selected option
in zone type dropdown on top menu.


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

Branch: refs/heads/marvin_refactor
Commit: 6f60833f9321bb1639372900bb625dd657006229
Parents: 232d44b
Author: Jessica Wang <jessicawang@apache.org>
Authored: Thu Apr 25 15:09:45 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Thu Apr 25 15:10:33 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/router/ListRoutersCmd.java   |    7 +
 .../src/com/cloud/api/query/QueryManagerImpl.java  |   12 ++-
 ui/scripts/system.js                               |   93 ++++++++++-----
 3 files changed, 78 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f60833f/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
index d2b26c0..9fbc940 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
@@ -64,6 +64,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd
{
             description="the Zone ID of the router")
     private Long zoneId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network
type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
             description="list by network id")
     private Long networkId;
@@ -103,6 +106,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd
{
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Long getNetworkId() {
         return networkId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f60833f/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 67af7e4..2c003d3 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -994,7 +994,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         Long id = cmd.getId();
         String name = cmd.getRouterName();
         String state = cmd.getState();
-        Long zone = cmd.getZoneId();
+        Long zoneId = cmd.getZoneId();
+        String zoneType = cmd.getZoneType();
         Long pod = cmd.getPodId();
         Long hostId = cmd.getHostId();
         String keyword = cmd.getKeyword();
@@ -1027,6 +1028,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.IN);
         sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
         sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
         sb.and("hostId", sb.entity().getHostId(), SearchCriteria.Op.EQ);
         sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
@@ -1067,10 +1069,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sc.setParameters("state", state);
         }
 
-        if (zone != null) {
-            sc.setParameters("dataCenterId", zone);
+        if (zoneId != null) {
+            sc.setParameters("dataCenterId", zoneId);
         }
 
+        if (zoneType != null) {
+            sc.setParameters("dataCenterType", zoneType);
+        }
+        
         if (pod != null) {
             sc.setParameters("podId", pod);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f60833f/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index fea7669..8c962fc 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -329,22 +329,35 @@
           },
 
           virtualRouterCount: function(data) {
+            var data2 = {
+              projectid: -1,
+              page: 1,
+              pagesize: 1  //specifying pagesize as 1 because we don't need any embedded
objects to be returned here. The only thing we need from API response is "count" property.
+            };
+            if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length
> 0) { //Basic type or Advanced type
+              $.extend(data2, {
+                zonetype: cloudStack.context.zoneType
+              });
+            }  
             $.ajax({
               url: createURL('listRouters'),
-              data: {
-                projectid: -1,
-								page: 1,
-								pagesize: 1  //specifying pagesize as 1 because we don't need any embedded objects
to be returned here. The only thing we need from API response is "count" property.
-              },
+              data: data2,
               success: function(json) {
-                var total1 = json.listroutersresponse.count ? json.listroutersresponse.count
: 0;								
+                var total1 = json.listroutersresponse.count ? json.listroutersresponse.count
: 0;		
+                
+                var data3 = {
+                  listAll: true,
+                  page: 1,
+                  pagesize: 1  //specifying pagesize as 1 because we don't need any embedded
objects to be returned here. The only thing we need from API response is "count" property.
+                };
+                if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length
> 0) { //Basic type or Advanced type
+                  $.extend(data3, {
+                    zonetype: cloudStack.context.zoneType
+                  });
+                }  
 								$.ajax({
 								  url: createURL('listRouters'),
-									data: {
-									  listAll: true,
-										page: 1,
-								    pagesize: 1  //specifying pagesize as 1 because we don't need any embedded objects
to be returned here. The only thing we need from API response is "count" property.
-									},
+									data: data3,
 									success: function(json) {
 									  var total2 = json.listroutersresponse.count ? json.listroutersresponse.count :
0;		
 										dataFns.capacity($.extend(data, {
@@ -2317,12 +2330,18 @@
 											}
 										}
 
+										var data2 = {
+                      forvpc: false
+                    };
+										if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length
> 0) { //Basic type or Advanced type
+					            $.extend(data2, {
+					              zonetype: cloudStack.context.zoneType
+					            });
+					          }  										
                     var routers = [];
                     $.ajax({
                       url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page="
+ args.page + "&pagesize=" + pageSize + array1.join("")),
-                      data: {
-											  forvpc: false
-											},
+                      data: data2,
                       success: function(json) {
                         var items = json.listroutersresponse.router ?
                               json.listroutersresponse.router : [];
@@ -2334,9 +2353,7 @@
                         // Get project routers
                         $.ajax({
                           url: createURL("listRouters&zoneid=" + selectedZoneObj.id +
"&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")
+ "&projectid=-1"),
-                          data: {
-														forvpc: false
-													},
+                          data: data2,
                           success: function(json) {
                             var items = json.listroutersresponse.router ?
                                   json.listroutersresponse.router : [];
@@ -2798,13 +2815,19 @@
 											}
 										}
 
+										var data2 = {
+                      forvpc: true
+                    };
+				            if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length
> 0) { //Basic type or Advanced type
+				              $.extend(data2, {
+				                zonetype: cloudStack.context.zoneType
+				              });
+				            }    
 										var routers = [];
                     $.ajax({
                       url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page="
+ args.page + "&pagesize=" + pageSize + array1.join("")),
                       dataType: 'json',
-											data: {
-											  forvpc: true
-											},
+											data: data2,
                       async: true,
                       success: function(json) {
                         var items = json.listroutersresponse.router;												
@@ -2816,9 +2839,7 @@
 												$.ajax({
 													url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page="
+ args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"),
 													dataType: 'json',
-													data: {
-														forvpc: true
-													},
+													data: data2,
 													async: true,
 													success: function(json) {
 														var items = json.listroutersresponse.router;														
@@ -5754,10 +5775,16 @@
                   var searchByArgs = args.filterBy.search.value.length ?
                     '&name=' + args.filterBy.search.value : '';
 
+                  var data2 = {};                  
+                  if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length
> 0) { //Basic type or Advanced type
+                    $.extend(data2, {
+                      zonetype: cloudStack.context.zoneType
+                    });
+                  }                      
                   var routers = [];
                   $.ajax({
                     url: createURL("listRouters&listAll=true&page=" + args.page +
"&pagesize=" + pageSize + searchByArgs),
-                    dataType: 'json',
+                    data: data2,
                     async: true,
                     success: function(json) {
                       var items = json.listroutersresponse.router ?
@@ -5770,7 +5797,7 @@
                       // Get project routers
                       $.ajax({
                         url: createURL("listRouters&listAll=true&page=" + args.page
+ "&pagesize=" + pageSize + "&projectid=-1"),
-                        dataType: 'json',
+                        data: data2,
                         async: true,
                         success: function(json) {
                           var items = json.listroutersresponse.router ?
@@ -5854,12 +5881,18 @@
               }
             }
 
+            var data2 = {
+              forvpc: false
+            };
+            if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length
> 0) { //Basic type or Advanced type
+              $.extend(data2, {
+                zonetype: cloudStack.context.zoneType
+              });
+            }    
             var routers = [];
             $.ajax({
               url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page="
+ args.page + "&pagesize=" + pageSize + array1.join("")),
-              data: {
-							  forvpc: false
-							},
+              data: data2,
               success: function(json) {
                 var items = json.listroutersresponse.router ?
                       json.listroutersresponse.router : [];
@@ -5870,9 +5903,7 @@
                 // Get project routers
                 $.ajax({
                   url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page="
+ args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"),
-                  data: {
-										forvpc: false
-									},
+                  data: data2,
                   success: function(json) {
                     var items = json.listroutersresponse.router ?
                           json.listroutersresponse.router : [];


Mime
View raw message