Add ANGULAR_FEATURES setting dict

We should unify the angular features (new panels, workflows, etc.) in a
single setting. This also makes it a little cleaner to read, simply
using the 'truthiness' of a key rather than string comparisons.

I haven't moved the 'swift_panel' setting, as that panel will be removed
in the O cycle anway, so it seems pointless to move a setting causing
potential issues for a single cycle.

Change-Id: Ia5702ff523355ae895e14cc3d49c895128478944
This commit is contained in:
Rob Cresswell 2016-08-10 11:30:20 +01:00
parent 75427ad7f9
commit 1050755d05
9 changed files with 39 additions and 23 deletions

View File

@ -180,18 +180,6 @@ A dictionary containing classes of exceptions which Horizon's centralized
exception handling should be aware of. Based on these exception categories, exception handling should be aware of. Based on these exception categories,
Horizon will handle the exception and display a message to the user. Horizon will handle the exception and display a message to the user.
``images_panel``
-----------
.. versionadded:: 10.0.0(Newton)
Default: ``legacy``
There are currently two panel types that may be specified: ``legacy`` and
``angular``. ``legacy`` will display the Python-based (server-side) Images
panel and ``angular`` will display the Angular-based (client-side) Images
panel.
``modal_backdrop`` ``modal_backdrop``
------------------ ------------------
@ -434,6 +422,23 @@ This example sorts flavors by vcpus in descending order::
'reverse': True, 'reverse': True,
} }
.. _angular_features:
``ANGULAR_FEATURES``
--------------------
.. versionadded:: 10.0.0(Newton)
Default::
{
'images_panel': False
}
A dictionary of currently available AngularJS features. This allows simple
toggling of legacy or rewritten features, such as new panels, workflows etc.
.. _available_themes: .. _available_themes:
``AVAILABLE_THEMES`` ``AVAILABLE_THEMES``

View File

@ -21,7 +21,7 @@ from django.conf.urls import url
from openstack_dashboard.dashboards.admin.images import views from openstack_dashboard.dashboards.admin.images import views
if settings.HORIZON_CONFIG['images_panel'] == 'angular': if settings.ANGULAR_FEATURES['images_panel']:
# New angular images # New angular images
urlpatterns = [ urlpatterns = [
url(r'^$', views.AngularIndexView.as_view(), name='index'), url(r'^$', views.AngularIndexView.as_view(), name='index'),

View File

@ -23,7 +23,7 @@ from openstack_dashboard.dashboards.project.images.images import views
from openstack_dashboard.dashboards.project.images import views as imgviews from openstack_dashboard.dashboards.project.images import views as imgviews
if settings.HORIZON_CONFIG['images_panel'] == 'angular': if settings.ANGULAR_FEATURES['images_panel']:
urlpatterns = [ urlpatterns = [
url(r'^(?P<image_id>[^/]+)/$', imgviews.AngularIndexView.as_view(), url(r'^(?P<image_id>[^/]+)/$', imgviews.AngularIndexView.as_view(),
name='detail'), name='detail'),

View File

@ -27,7 +27,7 @@ from openstack_dashboard.dashboards.project.images.snapshots \
from openstack_dashboard.dashboards.project.images import views from openstack_dashboard.dashboards.project.images import views
if settings.HORIZON_CONFIG['images_panel'] == 'angular': if settings.ANGULAR_FEATURES['images_panel']:
# New angular images # New angular images
urlpatterns = [ urlpatterns = [
url(r'^$', views.AngularIndexView.as_view(), name='index'), url(r'^$', views.AngularIndexView.as_view(), name='index'),

View File

@ -2,5 +2,4 @@
# wanting to only test legacy panels. Since 'local' modules are evaluated # wanting to only test legacy panels. Since 'local' modules are evaluated
# after settings.py, these configurations will override the default settings. # after settings.py, these configurations will override the default settings.
HORIZON_CONFIG.update({"images_panel": "legacy"}) ANGULAR_FEATURES.update({"images_panel": False})
HORIZON_CONFIG.update({"flavors_panel": "legacy"})

View File

@ -79,7 +79,6 @@ HORIZON_CONFIG = {
'js_spec_files': [], 'js_spec_files': [],
'external_templates': [], 'external_templates': [],
'plugins': [], 'plugins': [],
'images_panel': 'legacy',
'integration_tests_support': INTEGRATION_TESTS_SUPPORT 'integration_tests_support': INTEGRATION_TESTS_SUPPORT
} }
@ -298,6 +297,11 @@ CSRF_COOKIE_AGE = None
COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context' COMPRESS_OFFLINE_CONTEXT = 'horizon.themes.offline_context'
# Dictionary of currently available angular features
ANGULAR_FEATURES = {
'images_panel': False,
}
# Notice all customizable configurations should be above this line # Notice all customizable configurations should be above this line
try: try:
from local.local_settings import * # noqa from local.local_settings import * # noqa

View File

@ -96,7 +96,10 @@ HORIZON_CONFIG = {
'unauthorized': exceptions.UNAUTHORIZED}, 'unauthorized': exceptions.UNAUTHORIZED},
'angular_modules': [], 'angular_modules': [],
'js_files': [], 'js_files': [],
'images_panel': 'legacy', }
ANGULAR_FEATURES = {
'images_panel': False # Use the legacy panel so unit tests are still run
} }
# Load the pluggable dashboard settings # Load the pluggable dashboard settings

View File

@ -0,0 +1,4 @@
---
features:
- Added a new ``ANGULAR FEATURES`` dictionary to the settings.
This allows simple toggling of new AngularJS features.

View File

@ -1,11 +1,12 @@
--- ---
prelude: > prelude: >
The Image panel now may be configured to use The Images panel now may be configured to use
either the legacy or Angular code. either the legacy or Angular code.
features: features:
- HORIZON_CONFIG now allows for a key 'images_panel' to be - the ``ANGULAR_FEATURES`` setting now allows for a key
specified as 'legacy' or 'angular' indicating the type of ``images_panel``. If set to ``True``, then the Angular
panel to use. Images panel will be used, while the Python version will
be used if set to ``False``.
- Integration tests for Image features may also be toggled - Integration tests for Image features may also be toggled
in openstack_dashboard/test/integration_tests/horizon.conf in openstack_dashboard/test/integration_tests/horizon.conf
using the 'panel_type' feature, either set to 'legacy' or using the 'panel_type' feature, either set to 'legacy' or