Updated Branches:
  refs/heads/4.2 6e423784c -> 416130306

CLOUDSTACK-4142: UI > Network > VPC > configure > Router > Public IP Addresses 
> Configuration tab > use networkofferingconservemode to determine which action 
to show only when IP is attached to a tier(network).


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

Branch: refs/heads/4.2
Commit: 4161303060f473785da0842581fc402cf5ebb0e4
Parents: 6e42378
Author: Jessica Wang <[email protected]>
Authored: Tue Aug 13 18:18:01 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Tue Aug 13 18:18:01 2013 -0700

----------------------------------------------------------------------
 ui/scripts/network.js | 144 ++++++++++++++++++++++-----------------------
 1 file changed, 72 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41613030/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 5642995..ef891aa 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -2702,85 +2702,85 @@
                                                                 if 
(services[i].name == "Lb")
                                                                     
havingLbService = true;
                                                                }
-                                                        }                      
                          
-                                                    }
-                                                });
-                                            }
-                                        }
-                                        
-                                        if 
(args.context.networks[0].networkofferingconservemode == false) {
-                                            /*
-                                                               (1) If IP is 
SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added.
-                                                               */
-                                            if 
(args.context.ipAddresses[0].issourcenat) {
-                                                if (havingFirewallService == 
false) { //firewall is not supported in IP from VPC section (because ACL has 
already supported in tier from VPC section)
-                                                    
disallowedActions.push("firewall");
-                                                }
+                                                        }   
+                                                                               
                                 
+                                                        if 
(networkObj.networkofferingconservemode == false) {
+                                                            /*
+                                                                               
(1) If IP is SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be 
enabled/added.
+                                                                               
*/
+                                                            if 
(args.context.ipAddresses[0].issourcenat) {
+                                                                if 
(havingFirewallService == false) { //firewall is not supported in IP from VPC 
section (because ACL has already supported in tier from VPC section)
+                                                                    
disallowedActions.push("firewall");
+                                                                }
 
-                                                
disallowedActions.push("portForwarding");
-                                                
disallowedActions.push("loadBalancing");
-                                            }
+                                                                
disallowedActions.push("portForwarding");
+                                                                
disallowedActions.push("loadBalancing");
+                                                            }
 
-                                            /*
-                                                               (2) If IP is 
non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at first.
-                                                               1. Once 
StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer.
-                                                               2. If VPN 
service is supported (i.e. IP comes from Guest Network section, not from VPC 
section), once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
-                                                               3. Once a 
PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
-                                                               4. Once a 
LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
-                                                               */
-                                            else { 
//args.context.ipAddresses[0].issourcenat == false
-                                                if (havingFirewallService == 
false)
-                                                    
disallowedActions.push("firewall");
-                                                if 
(havingPortForwardingService == false)
-                                                    
disallowedActions.push("portForwarding");
-                                                if (havingLbService == false)
-                                                    
disallowedActions.push("loadBalancing");
-
-                                                if 
(args.context.ipAddresses[0].isstaticnat) { //1. Once StaticNat is enabled, 
hide VPN/PortForwarding/LoadBalancer.
-                                                    
disallowedActions.push("portForwarding");
-                                                    
disallowedActions.push("loadBalancing");
-                                                }
-                                                if (havingVpnService && 
args.context.ipAddresses[0].vpnenabled) { //2. If VPN service is supported 
(i.e. IP comes from Guest Network section, not from VPC section), once VPN is 
enabled, hide StaticNat/PortForwarding/LoadBalancer.
-                                                    
disallowedActions.push("portForwarding");
-                                                    
disallowedActions.push("loadBalancing");
-                                                }
+                                                            /*
+                                                                               
(2) If IP is non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at 
first.
+                                                                               
1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer.
+                                                                               
2. If VPN service is supported (i.e. IP comes from Guest Network section, not 
from VPC section), once VPN is enabled, hide 
StaticNat/PortForwarding/LoadBalancer.
+                                                                               
3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
+                                                                               
4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
+                                                                               
*/
+                                                            else { 
//args.context.ipAddresses[0].issourcenat == false
+                                                                if 
(havingFirewallService == false)
+                                                                    
disallowedActions.push("firewall");
+                                                                if 
(havingPortForwardingService == false)
+                                                                    
disallowedActions.push("portForwarding");
+                                                                if 
(havingLbService == false)
+                                                                    
disallowedActions.push("loadBalancing");
+
+                                                                if 
(args.context.ipAddresses[0].isstaticnat) { //1. Once StaticNat is enabled, 
hide VPN/PortForwarding/LoadBalancer.
+                                                                    
disallowedActions.push("portForwarding");
+                                                                    
disallowedActions.push("loadBalancing");
+                                                                }
+                                                                if 
(havingVpnService && args.context.ipAddresses[0].vpnenabled) { //2. If VPN 
service is supported (i.e. IP comes from Guest Network section, not from VPC 
section), once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
+                                                                    
disallowedActions.push("portForwarding");
+                                                                    
disallowedActions.push("loadBalancing");
+                                                                }
 
-                                                //3. Once a PortForwarding 
rule is added, hide StaticNat/VPN/LoadBalancer.
-                                                $.ajax({
-                                                    url: 
createURL('listPortForwardingRules'),
-                                                    data: {
-                                                        ipaddressid: 
args.context.ipAddresses[0].id,
-                                                        listAll: true
-                                                    },
-                                                    dataType: 'json',
-                                                    async: false,
-                                                    success: function(json) {
-                                                        // Get instance
-                                                        var rules = 
json.listportforwardingrulesresponse.portforwardingrule;
-                                                        if (rules != null && 
rules.length > 0) {
-                                                            
disallowedActions.push("loadBalancing");
-                                                        }
-                                                    }
-                                                });
+                                                                //3. Once a 
PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
+                                                                $.ajax({
+                                                                    url: 
createURL('listPortForwardingRules'),
+                                                                    data: {
+                                                                        
ipaddressid: args.context.ipAddresses[0].id,
+                                                                        
listAll: true
+                                                                    },
+                                                                    dataType: 
'json',
+                                                                    async: 
false,
+                                                                    success: 
function(json) {
+                                                                        // Get 
instance
+                                                                        var 
rules = json.listportforwardingrulesresponse.portforwardingrule;
+                                                                        if 
(rules != null && rules.length > 0) {
+                                                                            
disallowedActions.push("loadBalancing");
+                                                                        }
+                                                                    }
+                                                                });
 
-                                                //4. Once a LoadBalancer rule 
is added, hide StaticNat/VPN/PortForwarding.
-                                                $.ajax({
-                                                    url: 
createURL('listLoadBalancerRules'),
-                                                    data: {
-                                                        publicipid: 
args.context.ipAddresses[0].id,
-                                                        listAll: true
-                                                    },
-                                                    dataType: 'json',
-                                                    async: false,
-                                                    success: function(json) {
-                                                        var rules = 
json.listloadbalancerrulesresponse.loadbalancerrule;
-                                                        if (rules != null && 
rules.length > 0) {
-                                                            
disallowedActions.push("portForwarding");
-                                                        }
+                                                                //4. Once a 
LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
+                                                                $.ajax({
+                                                                    url: 
createURL('listLoadBalancerRules'),
+                                                                    data: {
+                                                                        
publicipid: args.context.ipAddresses[0].id,
+                                                                        
listAll: true
+                                                                    },
+                                                                    dataType: 
'json',
+                                                                    async: 
false,
+                                                                    success: 
function(json) {
+                                                                        var 
rules = json.listloadbalancerrulesresponse.loadbalancerrule;
+                                                                        if 
(rules != null && rules.length > 0) {
+                                                                            
disallowedActions.push("portForwarding");
+                                                                        }
+                                                                    }
+                                                                });
+                                                            }
+                                                        }                      
                                 
                                                     }
                                                 });
                                             }
-                                        }
+                                        }     
 
                                         return disallowedActions;
                                     },

Reply via email to