Chapter 2. Customizing the Dashboard
By default, the Red Hat OpenStack Services on Openshift (RHOSO) Dashboard (horizon) uses the Red Hat Common User Experience (RCUE) theme. But you can create your theme based on this RCUE theme and change the following Dashboard elements:
- Logo
- Site colors
- Stylesheets
- HTML title
- Site branding link
- Help URL
You must perform the following actions to configure the RHOSO Dashboard to use your theme:
-
Download the
openstack-dashboard-themeRed Hat package that contains the RCUE theme. For more information, see Downloading the openstack-dashboard-theme package. -
Copy this
openstack-dashboard-themeRed Hat package to your RHOSO deployment environment and extract it. For more information, see Extracting the RCUE theme from the RPM package. - Create your theme by customizing the necessary files to change the Dashboard elements that you require. For more information, see Creating your Dashboard theme.
- Create a configuration file for your theme to replace the default RCUE theme and you can further customize the appearance of your theme. For more information, see Creating your Dashboard theme configuration file.
- Add your Dashboard theme to the RHOSO control plane. For more information, see Adding your Dashboard theme to the control plane.
If you update or upgrade your RHOSO, then you must reapply your Dashboard theme.
This chapter assumes that you have the necessary administrative privileges and experience for using RHOSO and the Linux file system and commands.
2.1. Downloading the openstack-dashboard-theme package Copy linkLink copied to clipboard!
You must download the openstack-dashboard-theme Red Hat package from the customer portal to create a new Red Hat OpenStack Services on Openshift (RHOSO) Dashboard (horizon) theme.
Procedure
- Open the Red Hat Package Browser.
Search for
openstack-dashboard-themepackage.If more than one
openstack-dashboard-themepackage is listed in thePackagecolumn of the search results, then select theRed Hat OpenStack Services on OpenShiftproduct from theBrowse packages for all of my listed productslist that is adjacent to the search box to refine the search results.-
Click the
NOARCHin theArchitecturescolumn of the search results to display theopenstack-dashboard-themepage. -
Download the latest
Versionof this package. The latest version is automatically selected for you. -
Check that the
Product (Variant, Version, Architecture)column specifiesRed Hat OpenStack Services on OpenShift 18.0 x86_64. Click the
Download Nowbutton for thePackagedownload, for example,Package - openstack-dashboard-theme-23.0.2-0.el9ost.noarch.rpm.NoteIf you download the
Source Packagefile instead, then you must extract the files from this tar archive file before continuing.
2.2. Extracting the RCUE theme from the RPM package Copy linkLink copied to clipboard!
You must copy the downloaded openstack-dashboard-theme RPM package file to your Red Hat OpenStack Services on Openshift (RHOSO) deployment environment and then extract the files of the default Dashboard (horizon) Red Hat Common User Experience (RCUE) theme.
Procedure
Copy the downloaded
openstack-dashboard-themeRPM file to a directory for the Dashboard themes in your RHOSO deployment environment:rsync -avz <package_download_path> <user>@<deployment_host>:<deployment_themes_path>
$ rsync -avz <package_download_path> <user>@<deployment_host>:<deployment_themes_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<package_download_path>with the local path of the Openstack Dashboard theme package that you downloaded, for example,/home/Downloads/openstack-dashboard-theme-23.0.2-0.el9ost.noarch.rpm. -
Replace
<user>@<deployment_host>with the remote user and address of your deployment server, for example,root@lenovo-15. -
Replace
<deployment_themes_path>with the path of directory for the Dashboard themes on your deployment server, for example,~/horizon-themes/.
-
Replace
Extract the files and directories of the RCUE theme:
cd <deployment_themes_path> rpm2cpio <theme_rpm_name> | cpio -idmv
$ cd <deployment_themes_path> $ rpm2cpio <theme_rpm_name> | cpio -idmvCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<deployment_themes_path>with the path of directory you created to store your Dashboard themes on your deployment server, for example,~/horizon-themes/. -
Replace
<theme_rpm_name>with the name of your RPM file, for example,openstack-dashboard-theme-23.0.2-0.el9ost.noarch.rpm.
-
Replace
2.3. Creating your Dashboard theme Copy linkLink copied to clipboard!
You must create your Dashboard theme in your Red Hat OpenStack Services on Openshift (RHOSO) deployment environment by copying and then editing the files of the usr directory of the RCUE theme. Then you must create a tarball of your edited theme files.
Procedure
Copy the extracted
usrdirectory of the RCUE theme in your RHOSO deployment to a new subdirectory, for example,mytheme:cp -r <rcue_themes_usr_directory_path> <your_dashboard_theme_path>
$ cp -r <rcue_themes_usr_directory_path> <your_dashboard_theme_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<rcue_themes_usr_directory_path>with the path in your RHOSO deployment of theusrdirectory of the RCUE theme, for example,~/horizon-themes/usr/share/openstack-dashboard/openstack_dashboard/themes/rcue/. -
Replace
<your_dashboard_theme_path>with the path of your Dashboard theme, for example,~/horizon-themes/mytheme.
-
Replace
Replace all the instances of
rcuein your Dashboard theme directory, for example~/horizon-themes/mytheme, with the name of your Dashboard theme, for example,mytheme. You must include the paths, files, and subdirectories.The following command highlights all the instances of
rcuethat you must replace in your Dashboard theme directory:grep -r 'rcue'
$ grep -r 'rcue'Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the required files in your Dashboard theme directory to change the colors, graphics, fonts, and other elements of your theme.
Navigate to the Dashboard themes directory on your deployment server:
cd <dashboard_themes_path>
$ cd <dashboard_themes_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<dashboard_themes_path>with the path of the Dashboard (horizon) themes directory, for example,~/horizon-themes/.
-
Replace
Create a tarball of your theme directory:
NoteOnly the tar.gz format is supported.
tar -cvzf <your_dashboard_theme_name>.tar.gz <your_dashboard_theme_path>
$ tar -cvzf <your_dashboard_theme_name>.tar.gz <your_dashboard_theme_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<your_dashboard_theme_name>with the name of your Dashboard theme, for example,mytheme. -
Replace
<your_dashboard_theme_path>with the path in your RHOSO deployment of your Dashboard theme, for example,~/horizon-themes/mytheme/.
-
Replace
2.4. Creating your Dashboard theme configuration file Copy linkLink copied to clipboard!
You must create a theme configuration file to replace the default Red Hat Common User Experience (RCUE) theme and you can further customize the appearance of your theme.
Procedure
Open the Dashboard themes directory on your deployment server:
cd <dashboard_themes_path>
$ cd <dashboard_themes_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<dashboard_themes_path>with the path of the Dashboard themes directory on your deployment server, for example,~/horizon-themes/.
-
Replace
Use your preferred text editor to create a new configuration file called
_12_<theme_name>_theme.py.Replace
<theme_name>with the name of your theme, for example,mytheme.NoteThe prefix of this file must have a number greater than
_11_. This ensures that your theme configuration file is loaded after the default RCUE theme configuration file to override its settings.
Edit this file to specify the following mandatory parameter:
AVAILABLE_THEMES = [('<theme_name>', '<theme_description>', 'themes/<theme_name>')]AVAILABLE_THEMES = [('<theme_name>', '<theme_description>', 'themes/<theme_name>')]Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<theme_name>with the name of your theme, for example,mytheme. Replace
<theme_description>with a brief description of your theme, for example,My theme.ImportantWhen you specify the third argument of the
AVAILABLE_THEMESparameter, the parent directory must always bethemes, for example,themes/mytheme.
-
Replace
Optional: You can specify the following parameters to further customize the appearance of your theme:
-
SITE_BRANDING: Specify the HTML title that appears at the top of the browser window. For example,SITE_BRANDING = "Example, Inc. Cloud". -
SITE_BRANDING_LINK: Specify the hyperlink of the theme logo, which redirects tohorizon:user_home, by default. For example,SITE_BRANDING_LINK = "http://example.com".
-
2.5. Adding your Dashboard theme to the control plane Copy linkLink copied to clipboard!
You must do the following to apply your theme to the RHOSO Dashboard:
- Create a ConfigMap file that specifies the location of the tarball and the configuration file that you have created for your theme on your deployment server.
-
Add an
extramountssection to the.spec.horizon.templatesection of the RHOSOOpenStackControlPlanecustom resource (CR) file to specify the paths in thehorizonservice pod for these files. -
Apply the changes that you have made to the
OpenStackControlPlaneCR file and then wait for the newhorizonservice pod to be deployed, which extracts and uses your theme files.
Procedure
Create the ConfigMap file called
horizon-themethat specifies the location in your RHOSO deployment of the tarball and the configuration file that you have created for your theme:oc create cm horizon-theme \ --from-file=<your_theme_tarball_path> \ --from-file=<your_theme_configuration_file_path>
$ oc create cm horizon-theme \ --from-file=<your_theme_tarball_path> \ --from-file=<your_theme_configuration_file_path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<your_theme_tarball_path>with the location in your RHOSO deployment of the tarball containing your theme files, for example,$HOME/horizon-themes/mytheme.tar.gz. -
Replace
<your_theme_configuration_file_path>with the location in your RHOSO deployment of the configuration file of your theme, for example,$HOME/horizon-themes/_12_mytheme_theme.py.
-
Replace
-
Open your
OpenStackControlPlaneCR file,openstack_control_plane.yaml, on your workstation. Add the
.spec.horizon.template.extramountssection:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<your_theme_configuration_filename>with the file name and extension of your Dashboard theme configuration file, for example,_12_mytheme_theme.py. Replace
<your_theme_tarball>with the file name and extension of the tarball you created to contain your Dashboard theme files, for example,mytheme.tar.gz.NoteAll the other settings of the
.spec.horizon.template.extramountssection are mandatory.
-
Replace
Apply the changes made to the
OpenStackControlPlaneCR file:oc apply -f openstack_control_plane.yaml -n openstack
$ oc apply -f openstack_control_plane.yaml -n openstackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Wait for the new horizon service pod to be deployed by running the following command and waiting for the
Messagefield to displaySetup complete:oc get horizon -w
$ oc get horizon -w NAME NETWORKATTACHMENTS STATUS MESSAGE horizon True Setup completeCopy to Clipboard Copied! Toggle word wrap Toggle overflow The RHOSO Dashboard uses your theme.