diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst index f7aa9a3a9e..9009b18e1d 100644 --- a/doc/source/configuration/settings.rst +++ b/doc/source/configuration/settings.rst @@ -897,6 +897,45 @@ Default: ``"theme"`` This setting tells Horizon in which cookie key to store the currently set theme. The cookie expiration is currently set to a year. +USER_MENU_LINKS +----------------- + +.. versionadded:: 13.0.0(Queens) + +Default:: + + [ + {'name': _('OpenStack RC File v2'), + 'icon_classes': ['fa-download', ], + 'url': 'horizon:project:api_access:openrcv2', + 'external': False, + }, + {'name': _('OpenStack RC File v3'), + 'icon_classes': ['fa-download', ], + 'url': 'horizon:project:api_access:openrc', + 'external': False, + } + ] + +This setting controls the additional links on the user drop down menu. +A list of dictionaries defining all of the links should be provided. This +defaults to the standard OpenStack RC files. + +Each dictionary should contain these values: + +name + The name of the link + +url + Either the reversible Django url name or an absolute url + +external + True for absolute URLs, False for django urls. + +icon_classes + A list of classes for the icon next to the link. If 'None' or + an empty list is provided a download icon will show + WEBROOT ------- diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py index 1aa74e30ea..db43711846 100644 --- a/openstack_dashboard/context_processors.py +++ b/openstack_dashboard/context_processors.py @@ -86,6 +86,15 @@ def openstack(request): # Adding webroot access context['WEBROOT'] = getattr(settings, "WEBROOT", "/") + user_menu_links = getattr(settings, "USER_MENU_LINKS", []) + + if not getattr(settings, "SHOW_V2_KEYSTONE_RC", True): + user_menu_links = [ + link for link in user_menu_links + if 'horizon:project:api_access:openrcv2' != link['url']] + + context['USER_MENU_LINKS'] = user_menu_links + # Adding profiler support flag profiler_settings = getattr(settings, 'OPENSTACK_PROFILER', {}) profiler_enabled = profiler_settings.get('enabled', False) @@ -97,7 +106,6 @@ def openstack(request): hmac_keys, parent_id=index_view_id) context['JS_CATALOG'] = get_js_catalog(conf) - context['SHOW_KEYSTONE_V2_RC'] = settings.SHOW_KEYSTONE_V2_RC return context diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 6a469ccc41..c679ab67b0 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -291,6 +291,17 @@ SECURITY_GROUP_RULES = { ADD_INSTALLED_APPS = [] +USER_MENU_LINKS = [ + {'name': _('OpenStack RC File v2'), + 'icon_classes': ['fa-download', ], + 'url': 'horizon:project:api_access:openrcv2' + }, + {'name': _('OpenStack RC File v3'), + 'icon_classes': ['fa-download', ], + 'url': 'horizon:project:api_access:openrc' + } +] + # Deprecated Theme Settings CUSTOM_THEME_PATH = None DEFAULT_THEME_PATH = None diff --git a/openstack_dashboard/templates/header/_user_menu.html b/openstack_dashboard/templates/header/_user_menu.html index 4601f21017..ac66161b1f 100644 --- a/openstack_dashboard/templates/header/_user_menu.html +++ b/openstack_dashboard/templates/header/_user_menu.html @@ -34,20 +34,26 @@ {% endif %} - {% if SHOW_KEYSTONE_V2_RC %} + + {% for link in USER_MENU_LINKS %}