Working with Horizon Dashboards

Hey everyone!!

In my last post, I mentioned that I was working on getting Solum Horizon plugin working again. During the time that I have been working on this project, I have learned a few things about Horizon, its dashboards and their panels which I would like to share with you guys.

Firstly, what is Horizon? Horizon is basically just the implementation of the OpenStack Dashboard which allows you to access OpenStack services such as Nova, Glance, Swift etc through a web interface.

In order to access Solum’s dashboard in the Horizon interface, it needs to be manually loaded into the horizon setup you have (to know more about how to manually load Solum into your Horizon server, check this out, or to setup a devstack environment with Solum running on it, look here).

My work till this now involved setting up a new panel for languagepacks in the already existing Solum dashboard plugin.

The very first thing that needs to be done when creating a new panel is adding it to the panels attribute of the dashboard.py file in the plugin. After that, you need to create a new directory for your panel, which will contain all your python files (most of the backend) for your panel. The files that come in the directory for your panel are:

panel.py:

This file is the one that is used to discover the code for the corresponding panel for a panel listed in the panels attribute of the dashboard.

tables.py:

Horizon simplifies the majority of displaying data to the user. It provides the options of using tables (the different types it provides and their attributes and methods are listed here). Within a table definition, there is also the option of adding row_actions and table_actions. When creating an action for a table (whether it be a row action or a table action), it is important to create a class for it within the tables.py file. Now this class that you create can inherit from the LinkAction table of horizon (or one of the other action types provided in Horizon as listed here).

views.py:

All of the code that has been written so far is tied together in a view through the views.py file. Here too, Horizon provides a few different views that can be used (the simplest ones related to tables are listed here).

urls.py:

This files lists the urls for the different views you have created.

Now, in the templates folder of the dashboard, we need to create a directory corresponding to our panel. All the html files corresponding to your panel go into this folder. With this, you can create a pretty basic panel in Horizon 😀 (for more details about the code, you can look here).

This post just scratches the surface of what can be done in a dashboard for Horizon. Stay tuned for more updates regarding horizon and some of the other cool stuff that can be done in a dashboard! 🙂

 

Advertisements

One thought on “Working with Horizon Dashboards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s