Hide acquire new IP button if in advanced SG zone

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

Branch: refs/heads/master
Commit: 4bab97be3e23bceea70dff5977172593e2fe8dac
Parents: 2514b92
Author: Brian Federle <[email protected]>
Authored: Tue Dec 4 11:06:35 2012 -0800
Committer: Brian Federle <[email protected]>
Committed: Tue Dec 4 11:06:35 2012 -0800

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


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4bab97be/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 6bd38a3..1363154 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1440,28 +1440,34 @@
               addRow: 'true',
               preFilter: function(args) {                
                                                                var zoneObj;
-                                                                var dataObj = 
{};
-                                                                if('vpc' in 
args.context) { //from VPC section
-                                                                
$.extend(dataObj, {
-                                                                    id: 
args.context.vpc[0].zoneid
-                                                                   });
-                                                                 }
-                                                               else 
if('networks' in args.context) { //from Guest Network section
-                                                                  
$.extend(dataObj, {
-                                                                    id: 
args.context.networks[0].zoneid
-                                                                   });
-                                                                 }
+                                                               var dataObj = 
{};
+                
+                if ('vpc' in args.context) { //from VPC section
+                  $.extend(dataObj, {
+                    id: args.context.vpc[0].zoneid
+                  });
+                } else if ('networks' in args.context) { //from Guest Network 
section
+                  $.extend(dataObj, {
+                    id: args.context.networks[0].zoneid
+                  });
+                }
 
                                                                $.ajax({
                                                                  url: 
createURL('listZones'),
                                                                        data: 
dataObj,
+                                                                 //      id: 
args.context.networks[0].zoneid
+                                                                 //    },
                                                                        async: 
false,
                                                                        
success: function(json) {                                                       
                  
                                                                                
zoneObj = json.listzonesresponse.zone[0];                                       
                                        
                                                                        }
                                                                });
+
+                if (zoneObj.networktype == 'Advanced' && 
zoneObj.securitygroupsenabled) {
+                  return false;
+                }
                                                                                
                                                                                
                        
-                                                               
if(zoneObj.networktype == 'Basic') { 
+                                                               if 
(zoneObj.networktype == 'Basic') {
                                                                  var havingEIP 
= false, havingELB = false;
                                                                  $.ajax({
                                                                          url: 
createURL('listNetworkOfferings'),
@@ -1469,20 +1475,19 @@
                                                                                
  id: args.context.networks[0].networkofferingid
                                                                                
},
                                                                                
async: false,
-                                                                               
success: function(json) {                                                       
                          
+                                                                               
success: function(json) {                                                       
                  
                                                                                
        
$(json.listnetworkofferingsresponse.networkoffering[0].service).each(function(){
                                                                                
         
                                                                                
                var thisService = this;                                         
                                                                
-                                                                               
                if(thisService.name == "StaticNat") {
+                                                                               
                if (thisService.name == "StaticNat") {
                                                                                
                        $(thisService.capability).each(function(){
-                                                                               
                                if(this.name == "ElasticIp" && this.value == 
"true") {
+                                                                               
                                if (this.name == "ElasticIp" && this.value == 
"true") {
                                                                                
                                        havingEIP = true;
                                                                                
                                        return false; //break $.each() loop
                                                                                
                                }
                                                                                
                        });
-                                                                               
                }
-                                                                               
                else if(thisService.name == "Lb") {
+                                                                               
                } else if (thisService.name == "Lb") {
                                                                                
                        $(thisService.capability).each(function(){
-                                                                               
                                if(this.name == "ElasticLb" && this.value == 
"true") {
+                                                                               
                                if (this.name == "ElasticLb" && this.value == 
"true") {
                                                                                
                                        havingELB = true;
                                                                                
                                        return false; //break $.each() loop
                                                                                
                                }

Reply via email to