You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/10/06 10:38:21 UTC

[cloudstack-primate] branch master updated: Load balancing and Port forwarding are not displayed properly (#768)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git


The following commit(s) were added to refs/heads/master by this push:
     new dd8fab3  Load balancing and Port forwarding are not displayed properly (#768)
dd8fab3 is described below

commit dd8fab31f96fd45be925a79a712f7db0df92c015
Author: Rakesh <ra...@gmail.com>
AuthorDate: Tue Oct 6 12:38:13 2020 +0200

    Load balancing and Port forwarding are not displayed properly (#768)
    
    Fixes #766
    
    For isolated networks, load balancing, port forwarding and firewall
    options are not displayed.
    For source nat ip of vpc, all options are displayed but it should not be
    
    Below are the expected actions according to legacy UI
    
    for isolated networks
    
    if static nat is disabled then display all options
    if static nat is enabled then display only firewall tab
    
    for VPC networks
    
    for source nat IP, dont display any option
    for other ip's firewall is always disabled.
    Load balancing and port forwarding options are mutually exclusive
    
    Co-authored-by: Rakesh Venkatesh <r....@global.leaseweb.com>
---
 src/components/view/ResourceView.vue   | 11 ++++++++++-
 src/views/network/PublicIpResource.vue |  9 +++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/components/view/ResourceView.vue b/src/components/view/ResourceView.vue
index 582dfc4..2147f0b 100644
--- a/src/components/view/ResourceView.vue
+++ b/src/components/view/ResourceView.vue
@@ -120,9 +120,18 @@ export default {
         if (this.resource && this.resource.virtualmachineid && this.resource.vpcid) {
           return false
         }
-        if (this.resource && this.resource.vpcid && tab.name !== 'firewall') {
+        // dont display any option for source NAT IP of VPC
+        if (this.resource && this.resource.vpcid && !this.resource.issourcenat && tab.name !== 'firewall') {
           return true
         }
+        // display LB and PF options for isolated networks if static nat is disabled
+        if (this.resource && !this.resource.vpcid) {
+          if (!this.resource.isstaticnat) {
+            return true
+          } else if (tab.name === 'firewall') {
+            return true
+          }
+        }
         return this.networkService && this.networkService.service &&
           tab.networkServiceFilter(this.networkService.service)
       } else if ('show' in tab) {
diff --git a/src/views/network/PublicIpResource.vue b/src/views/network/PublicIpResource.vue
index 0831f18..84c62eb 100644
--- a/src/views/network/PublicIpResource.vue
+++ b/src/views/network/PublicIpResource.vue
@@ -99,13 +99,18 @@ export default {
       this.loading = true
       this.portFWRuleCount = await this.fetchPortFWRule()
 
-      if (this.portFWRuleCount > 0) {
+      // disable load balancing rules only if port forwarding is enabled and
+      // network belongs to VPC
+      if (this.portFWRuleCount > 0 && this.resource.vpcid) {
         this.tabs = this.$route.meta.tabs.filter(tab => tab.name !== 'loadbalancing')
       } else {
         this.loadBalancerRuleCount = await this.fetchLoadBalancerRule()
 
+        // for isolated networks, display both LB and PF
+        // for VPC they are mutually exclusive
         if (this.loadBalancerRuleCount > 0) {
-          this.tabs = this.$route.meta.tabs.filter(tab => tab.name !== 'portforwarding')
+          this.tabs =
+            this.resource.vpcid ? this.$route.meta.tabs.filter(tab => tab.name !== 'portforwarding') : this.$route.meta.tabs
           this.loading = false
         } else {
           this.tabs = this.$route.meta.tabs