Updating tutorial doc for dashboard loading

Changing tutorial to use the newer method for loading dashboards.

The tutorial needs a new revision in general, but that is beyond
the scope of this change.

Closes-bug: #1277325
Change-Id: Ie197b5ad9aafa125235a839fbcc7cd95e352e96a
This commit is contained in:
David Lyle 2014-02-08 19:57:02 -07:00
parent 9fb09db90a
commit 5bd6658672

View File

@ -471,44 +471,40 @@ overrides.
Specifying dashboards Specifying dashboards
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
The most basic thing to do is to add your own custom dashboard using the Adding your own dashboard is as simple as creating a file in the
``HORIZON_CONFIG`` dictionary in the settings file:: ``openstack_dashboard/local/enabled`` directory named ``_50_visualizations.py``.
The contents of this file should resemble::
HORIZON_CONFIG = { DASHBOARD = 'visualizations'
'dashboards': ('project', 'admin', 'settings',), DEFAULT = True
} ADD_EXCEPTIONS = {}
ADD_INSTALLED_APPS = ['openstack_dashboard.dashboards.visualizations']
Please note, the dashboards also must be added to settings.py:: .. seealso::
INSTALLED_APPS = ( For more information on the significance of the file naming and an
'openstack_dashboard', explanation of the contents, check out
... :doc:`Pluggable Settings for Dashboards </topics/settings>`
'horizon',
'openstack_dashboard.dashboards.project',
'openstack_dashboard.dashboards.admin',
'openstack_dashboard.dashboards.settings',
...
)
In this case, we've taken the default Horizon ``'dashboards'`` config and In this case, we've added our ``visualizations`` dashboard to the list of
added our ``visualizations`` dashboard to it. Note that the name here is the dashboards to load. Note that the name here is the name of the dashboard's
name of the dashboard's module on the python path. It will find our module on the python path. It will find our ``dashboard.py`` file inside of
``dashboard.py`` file inside of it and load both the dashboard and its panels it and load both the dashboard and its panels automatically from there.
automatically from there.
Error handling Error handling
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Adding custom error handler for your API client is quite easy. While it's not Adding custom error handler for your API client is quite easy. While it's not
necessary for this example, it would be done by customizing the necessary for this example, it would be done by customizing the ``ADD_EXCEPTIONS``
``'exceptions'`` value in the ``HORIZON_CONFIG`` dictionary:: dictionary in the file added to ``openstack/local/enabled``::
import my_api.exceptions as my_api import my_api.exceptions as my_api
'exceptions': {'recoverable': [my_api.Error, ADD_EXCEPTIONS: {
my_api.ClientConnectionError], 'recoverable': [my_api.Error, my_api.ClientConnectionError],
'not_found': [my_api.NotFound], 'not_found': [my_api.NotFound],
'unauthorized': [my_api.NotAuthorized]}, 'unauthorized': [my_api.NotAuthorized]
}
.. _overrides: .. _overrides: