|
2702 | 2702 | if (services[i].name == "Lb") |
2703 | 2703 | havingLbService = true; |
2704 | 2704 | } |
2705 | | - } |
2706 | | - } |
2707 | | - }); |
2708 | | - } |
2709 | | - } |
2710 | | - |
2711 | | - if (args.context.networks[0].networkofferingconservemode == false) { |
2712 | | - /* |
2713 | | - (1) If IP is SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added. |
2714 | | - */ |
2715 | | - if (args.context.ipAddresses[0].issourcenat) { |
2716 | | - if (havingFirewallService == false) { //firewall is not supported in IP from VPC section (because ACL has already supported in tier from VPC section) |
2717 | | - disallowedActions.push("firewall"); |
2718 | | - } |
| 2705 | + } |
| 2706 | + |
| 2707 | + if (networkObj.networkofferingconservemode == false) { |
| 2708 | + /* |
| 2709 | + (1) If IP is SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added. |
| 2710 | + */ |
| 2711 | + if (args.context.ipAddresses[0].issourcenat) { |
| 2712 | + if (havingFirewallService == false) { //firewall is not supported in IP from VPC section (because ACL has already supported in tier from VPC section) |
| 2713 | + disallowedActions.push("firewall"); |
| 2714 | + } |
2719 | 2715 |
|
2720 | | - disallowedActions.push("portForwarding"); |
2721 | | - disallowedActions.push("loadBalancing"); |
2722 | | - } |
| 2716 | + disallowedActions.push("portForwarding"); |
| 2717 | + disallowedActions.push("loadBalancing"); |
| 2718 | + } |
2723 | 2719 |
|
2724 | | - /* |
2725 | | - (2) If IP is non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at first. |
2726 | | - 1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer. |
2727 | | - 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. |
2728 | | - 3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. |
2729 | | - 4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. |
2730 | | - */ |
2731 | | - else { //args.context.ipAddresses[0].issourcenat == false |
2732 | | - if (havingFirewallService == false) |
2733 | | - disallowedActions.push("firewall"); |
2734 | | - if (havingPortForwardingService == false) |
2735 | | - disallowedActions.push("portForwarding"); |
2736 | | - if (havingLbService == false) |
2737 | | - disallowedActions.push("loadBalancing"); |
2738 | | - |
2739 | | - if (args.context.ipAddresses[0].isstaticnat) { //1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer. |
2740 | | - disallowedActions.push("portForwarding"); |
2741 | | - disallowedActions.push("loadBalancing"); |
2742 | | - } |
2743 | | - 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. |
2744 | | - disallowedActions.push("portForwarding"); |
2745 | | - disallowedActions.push("loadBalancing"); |
2746 | | - } |
| 2720 | + /* |
| 2721 | + (2) If IP is non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at first. |
| 2722 | + 1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer. |
| 2723 | + 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. |
| 2724 | + 3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. |
| 2725 | + 4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. |
| 2726 | + */ |
| 2727 | + else { //args.context.ipAddresses[0].issourcenat == false |
| 2728 | + if (havingFirewallService == false) |
| 2729 | + disallowedActions.push("firewall"); |
| 2730 | + if (havingPortForwardingService == false) |
| 2731 | + disallowedActions.push("portForwarding"); |
| 2732 | + if (havingLbService == false) |
| 2733 | + disallowedActions.push("loadBalancing"); |
| 2734 | + |
| 2735 | + if (args.context.ipAddresses[0].isstaticnat) { //1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer. |
| 2736 | + disallowedActions.push("portForwarding"); |
| 2737 | + disallowedActions.push("loadBalancing"); |
| 2738 | + } |
| 2739 | + 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. |
| 2740 | + disallowedActions.push("portForwarding"); |
| 2741 | + disallowedActions.push("loadBalancing"); |
| 2742 | + } |
2747 | 2743 |
|
2748 | | - //3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. |
2749 | | - $.ajax({ |
2750 | | - url: createURL('listPortForwardingRules'), |
2751 | | - data: { |
2752 | | - ipaddressid: args.context.ipAddresses[0].id, |
2753 | | - listAll: true |
2754 | | - }, |
2755 | | - dataType: 'json', |
2756 | | - async: false, |
2757 | | - success: function(json) { |
2758 | | - // Get instance |
2759 | | - var rules = json.listportforwardingrulesresponse.portforwardingrule; |
2760 | | - if (rules != null && rules.length > 0) { |
2761 | | - disallowedActions.push("loadBalancing"); |
2762 | | - } |
2763 | | - } |
2764 | | - }); |
| 2744 | + //3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. |
| 2745 | + $.ajax({ |
| 2746 | + url: createURL('listPortForwardingRules'), |
| 2747 | + data: { |
| 2748 | + ipaddressid: args.context.ipAddresses[0].id, |
| 2749 | + listAll: true |
| 2750 | + }, |
| 2751 | + dataType: 'json', |
| 2752 | + async: false, |
| 2753 | + success: function(json) { |
| 2754 | + // Get instance |
| 2755 | + var rules = json.listportforwardingrulesresponse.portforwardingrule; |
| 2756 | + if (rules != null && rules.length > 0) { |
| 2757 | + disallowedActions.push("loadBalancing"); |
| 2758 | + } |
| 2759 | + } |
| 2760 | + }); |
2765 | 2761 |
|
2766 | | - //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. |
2767 | | - $.ajax({ |
2768 | | - url: createURL('listLoadBalancerRules'), |
2769 | | - data: { |
2770 | | - publicipid: args.context.ipAddresses[0].id, |
2771 | | - listAll: true |
2772 | | - }, |
2773 | | - dataType: 'json', |
2774 | | - async: false, |
2775 | | - success: function(json) { |
2776 | | - var rules = json.listloadbalancerrulesresponse.loadbalancerrule; |
2777 | | - if (rules != null && rules.length > 0) { |
2778 | | - disallowedActions.push("portForwarding"); |
2779 | | - } |
| 2762 | + //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. |
| 2763 | + $.ajax({ |
| 2764 | + url: createURL('listLoadBalancerRules'), |
| 2765 | + data: { |
| 2766 | + publicipid: args.context.ipAddresses[0].id, |
| 2767 | + listAll: true |
| 2768 | + }, |
| 2769 | + dataType: 'json', |
| 2770 | + async: false, |
| 2771 | + success: function(json) { |
| 2772 | + var rules = json.listloadbalancerrulesresponse.loadbalancerrule; |
| 2773 | + if (rules != null && rules.length > 0) { |
| 2774 | + disallowedActions.push("portForwarding"); |
| 2775 | + } |
| 2776 | + } |
| 2777 | + }); |
| 2778 | + } |
| 2779 | + } |
2780 | 2780 | } |
2781 | 2781 | }); |
2782 | 2782 | } |
2783 | | - } |
| 2783 | + } |
2784 | 2784 |
|
2785 | 2785 | return disallowedActions; |
2786 | 2786 | }, |
|
0 commit comments