Browse Source

Look for load-balancer endpoints in catalog

Load-Blancer tabs should only be enabled when load-balancer endpoint is registered.
When you enable Octavia only on one region and switch to another region which don't have,
It will show you some infinite Error popup : "Error: Unable to retrieve load balancers."

Story 2008853
Task 42372

Change-Id: I1c69f34d70604db0de1e78e8c32716f8744b9e93
changes/50/788050/1
Quentin GROLLEAU 3 months ago
parent
commit
879135b993
  1. 5
      octavia_dashboard/api/rest/lbaasv2.py
  2. 5
      octavia_dashboard/dashboards/project/load_balancer/panel.py

5
octavia_dashboard/api/rest/lbaasv2.py

@ -28,6 +28,7 @@ try:
except ImportError:
from os_client_config import config as occ
from openstack_dashboard.api import base
from openstack_dashboard.api import neutron
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils
@ -675,6 +676,10 @@ def add_floating_ip_info(request, loadbalancers):
lb['floating_ip'] = floating_ip
def is_load_balancer_service_enabled(request):
return base.is_service_enabled(request, 'load-balancer')
@urls.register
class LoadBalancers(generic.View):
"""API for load balancers.

5
octavia_dashboard/dashboards/project/load_balancer/panel.py

@ -13,6 +13,7 @@
# under the License.
from django.utils.translation import ugettext_lazy as _
from octavia_dashboard.api.rest import lbaasv2
import horizon
@ -21,3 +22,7 @@ class NGLoadBalancers(horizon.Panel):
name = _("Load Balancers")
slug = 'load_balancer'
permissions = ('openstack.services.load-balancer',)
def allowed(self, context):
request = context['request']
return lbaasv2.is_load_balancer_service_enabled(request)
Loading…
Cancel
Save