cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [46/51] [abbrv] git commit: updated refs/heads/object_store to 9aec9c6
Date Thu, 20 Jun 2013 01:18:07 GMT
CLOUDSTACK-3016: UI - (1) remove obsolete code that pass zonetype to API calls. (2) network
menu: use listZones&networktype=Advanced to determine which section to show.


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

Branch: refs/heads/object_store
Commit: 2d10ae7580018611919be070bc51818f476bc1e4
Parents: 928d942
Author: Jessica Wang <jessicawang@apache.org>
Authored: Wed Jun 19 11:49:05 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Wed Jun 19 11:52:18 2013 -0700

----------------------------------------------------------------------
 ui/scripts/network.js         | 61 +++++++++++++++++++++++---------------
 ui/scripts/sharedFunctions.js |  6 +---
 2 files changed, 38 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d10ae75/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index ddde9c9..d18e796 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -274,40 +274,46 @@
     }
   };
 
-	var networkOfferingObjs = [];
-        var checkVpc=0; 	
+	var networkOfferingObjs = [];  	        
+  var advZoneObjs;
+  
   cloudStack.sections.network = {
     title: 'label.network',
     id: 'network',
     sectionSelect: {
       preFilter: function(args) {
-        var havingSecurityGroupNetwork = false;           
-        
+        var sectionsToShow = ['networks'];
+
+        $.ajax({
+          url: createURL('listZones'),
+          data: {
+            networktype: 'Advanced'
+          },
+          async: false,
+          success: function(json) {            
+            advZoneObjs = json.listzonesresponse.zone;
+            if(advZoneObjs != null && advZoneObjs.length > 0) {
+              sectionsToShow.push('vpc');
+              sectionsToShow.push('vpnCustomerGateway');
+            }
+          }
+        });
+                           
         $.ajax({
           url: createURL('listNetworks', { ignoreProject: true }),
           data: {
             supportedServices: 'SecurityGroup',
             listAll: true,
-						details: 'min'
+            details: 'min'
           },
           async: false,
-          success: function(data) {
-            if (data.listnetworksresponse.network != null && data.listnetworksresponse.network.length
> 0) {
-              havingSecurityGroupNetwork = true;
+          success: function(json) {
+            if(json.listnetworksresponse.network != null && json.listnetworksresponse.network.length
> 0) {
+              sectionsToShow.push('securityGroups');
             }
           }
         });
-
-        var sectionsToShow = ['networks'];
-
-        if(args.context.zoneType != 'Basic') { //Advanced type or all types				
-          sectionsToShow.push('vpc');
-          sectionsToShow.push('vpnCustomerGateway');
-        }
-        
-        if(havingSecurityGroupNetwork == true)
-          sectionsToShow.push('securityGroups');
-
+       
         return sectionsToShow;
       },
 
@@ -323,11 +329,18 @@
             add: { 
               label: 'Add Isolated Guest Network with SourceNat',
 
-              preFilter: function(args) { //Isolated networks is only supported in Advanced
(SG-disabled) zone 
-                if(args.context.zoneType != 'Basic') 
-								  return true;
-								else
-								  return false;								
+              preFilter: function(args) { 
+                if(advZoneObjs != null && advZoneObjs.length > 0) {
+                  for(var i = 0; i < advZoneObjs.length; i++) {
+                    if(advZoneObjs[i].securitygroupsenabled != true) { //'Add Isolated Guest
Network with SourceNat' is only supported in Advanced SG-disabled zone 
+                      return true;
+                    }
+                  }   
+                  return false;
+                }
+                else{
+                  return false;     
+                }  			
               },
 
               createForm: {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d10ae75/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index d87f0dc..86dc68e 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -114,11 +114,7 @@ function createURL(apiName, options) {
   if (cloudStack.context && cloudStack.context.projects && !options.ignoreProject)
{
     urlString = urlString + '&projectid=' + cloudStack.context.projects[0].id;
   }
-    
-  if(cloudStack.context != null && cloudStack.context.zoneType != null &&
cloudStack.context.zoneType.length > 0) { //Basic type or Advanced type
-    urlString = urlString + '&zonetype=' + cloudStack.context.zoneType;    
-  }    
-  
+   
   return urlString;
 }
 


Mime
View raw message