cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject git commit: Networks section: Only show VPC dropdown for Advanced zones
Date Thu, 26 Jul 2012 22:22:30 GMT
Updated Branches:
  refs/heads/vpc ae45ed65c -> 21290ef8f


Networks section: Only show VPC dropdown for Advanced zones


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

Branch: refs/heads/vpc
Commit: 21290ef8f1e1f832859aa065ab9e3b8aa3bb3356
Parents: ae45ed6
Author: Brian Federle <brian.federle@citrix.com>
Authored: Thu Jul 26 15:21:52 2012 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Thu Jul 26 15:22:03 2012 -0700

----------------------------------------------------------------------
 ui/scripts/network.js |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/21290ef8/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index a16a7a4..3d10261 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -164,6 +164,23 @@
     sectionSelect: {
       preFilter: function(args) {
         var havingSecurityGroupNetwork = false;
+        var havingBasicZones = false;
+
+        // Get basic zones
+        $.ajax({
+          url: createURL('listZones'),
+          async: false,
+          success: function(json) {
+            var zones = json.listzonesresponse.zone ?
+                  json.listzonesresponse.zone : [];
+            var basicZones = $.grep(zones, function(zone) {
+              return zone.networktype == 'Basic';
+            });
+            
+            havingBasicZones = basicZones.length ? true : false;
+          }
+        });
+        
         $.ajax({
           url: createURL('listNetworks', { ignoreProject: true }),
           data: {
@@ -178,7 +195,12 @@
           }
         });
 
-        var sectionsToShow = ['networks', 'vpc', 'vpnCustomerGateway'];
+        var sectionsToShow = ['networks', 'vpnCustomerGateway'];
+
+        if (!havingBasicZones) {
+          sectionsToShow.push('vpc');
+        }
+        
         if(havingSecurityGroupNetwork == true)
           sectionsToShow.push('securityGroups');
 


Mime
View raw message