Chapter 5. Customizing the Dashboard
After you have the OpenStack dashboard installed, you can customize its look and feel to suit your own needs. The customization options here focuses on the settings included in the local_settings.py file, stored in /openstack-dashboard/openstack_dashboard/local/.
The OpenStack dashboard by default installs the openstack-dashboard-theme package.
If you do not want to use this theme you can remove it and its dependencies using the following command:
rpm -e --nodeps openstack-dashboard-theme
# rpm -e --nodeps openstack-dashboard-theme
You can customize the following elements of the dashboard. Note that for a Director deployment, you will need to log in to each controller node as heat-admin to make the changes.
- Logo
- Site colors
- HTML title
- Site branding link
- Help URL
- Stylesheets
Logo and Site Colors:
Create two logo files in png format with transparent backgrounds of the following sizes:
- Login screen (Example: login_logo.png): 365 x 50
- Logged in banner (Example: banner_logo.png): 216 x 35
-
Upload your new images to the following location:
/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/img/ -
Create a SCSS style sheet in the following directory:
/usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/scss/ Change the colors and image file names as appropriate. Note that the relative directory paths should be the same. The following example file demonstrates how to customize your SCSS file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Open the following HTML template in an editor of your choice:
/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html Add a line to include your newly created style sheet. For example,
custom.scssfile:<link href='bootstrap/css/bootstrap.min.scss' media='screen' rel='stylesheet' /> <link href='dashboard/css/{% choose_scss %}' media='screen' rel='stylesheet' /> <link href='dashboard/css/custom.scss' media='screen' rel='stylesheet' /><link href='bootstrap/css/bootstrap.min.scss' media='screen' rel='stylesheet' /> <link href='dashboard/css/{% choose_scss %}' media='screen' rel='stylesheet' /> <link href='dashboard/css/custom.scss' media='screen' rel='stylesheet' />Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the Apache server:
# systemctl restart httpd
# # systemctl restart httpd
- To view your changes simply reload your dashboard. If necessary, go back and modify your SCSS file as appropriate.
HTML Title:
To set the HTML title that appears at the top of the browser window, add the following line to
local_settings.py.SITE_BRANDING = "Example, Inc. Cloud"
SITE_BRANDING = "Example, Inc. Cloud"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the Apache server.
Site Branding Link:
The logo also acts as a hyperlink. The default behavior is to redirect to
horizon:user_home. To change this, add the following attribute with the desired URL target tolocal_settings.py.SITE_BRANDING_LINK = "http://example.com"
SITE_BRANDING_LINK = "http://example.com"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the Apache server.
Help URL:
By default the help URL points to https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/index.html. You can change the help URL by editing the following attribute to the URL of your choice in
local_settings.py.'help_url': "http://openstack.mycompany.org",
'help_url': "http://openstack.mycompany.org",Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the Apache server.
Custom Stylesheets:
It is possible to define custom stylesheets for your dashboard. Dashboard’s base template, openstack_dashboard/templates/base.html, defines multiple blocks that can be overridden. To define custom SCSS files that apply only to a specific dashboard, create a base template in your dashboard’s templates folder, which extends the dashboard’s base template.
Example: openstack_dashboard/dashboards/my_custom_dashboard/templates/my_custom_dashboard/base.html. In this template, you can redefine block CSS:
Don’t forget to include _stylesheets.html which includes all default stylesheets for the dashboard.