Hide panel if 'baremetal' service not present
Don't show the ironic panel unless the service is present in the service catalog. Also, restrict the panel to admin permission. Change-Id: I413d50133e743a7bdc45378e3ed0454974b7b3c7 Closes-Bug: 1609005
This commit is contained in:
parent
04973a788d
commit
31c70d9562
@ -17,7 +17,27 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
import horizon
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.dashboards.admin import dashboard
|
||||
|
||||
|
||||
class Ironic(horizon.Panel):
|
||||
name = _("Ironic Bare Metal Provisioning")
|
||||
slug = 'ironic'
|
||||
permissions = ('openstack.roles.admin',)
|
||||
|
||||
def allowed(self, context):
|
||||
request = context['request']
|
||||
if not base.is_service_enabled(request, 'baremetal'):
|
||||
return False
|
||||
else:
|
||||
return super(Ironic, self).allowed(context)
|
||||
|
||||
def nav(self, context):
|
||||
request = context['request']
|
||||
if not base.is_service_enabled(request, 'baremetal'):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
dashboard.Admin.register(Ironic)
|
||||
|
Loading…
Reference in New Issue
Block a user