Este conteúdo não está disponível no idioma selecionado.
Customizing Red Hat Developer Hub
Customize Red Hat Developer Hub appearance and features, such as templates, Learning Paths, Tech Radar, Home page, and quick access cards.
Abstract
Preface Copiar o linkLink copiado para a área de transferência!
Authorized users can customize Red Hat Developer Hub appearance and features, such as templates, Learning Paths, Tech Radar, Home page, and quick access cards.
Chapter 1. Customizing your Red Hat Developer Hub title Copiar o linkLink copiado para a área de transferência!
You can change the default Red Hat Developer Hub display name.
Prerequisites
Procedure
In your custom
app-config.yaml
file, enter your Developer Hub instance display name, such as <Red Hat Developer Hub>.app-config.yaml
excerptapp: title: My custom Red Hat Developer Hub title
app: title: My custom Red Hat Developer Hub title
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 2. Customizing your Red Hat Developer Hub base URL Copiar o linkLink copiado para a área de transferência!
You can change the default Red Hat Developer Hub base URL.
Prerequisites
- You know your desired Developer Hub external URL: https://<my_developer_hub_url>, and have configured DNS to point to your Red Hat OpenShift Container Platform cluster.
- Custom Developer Hub configuration.
Procedure
In your custom
app-config.yaml
file, enter your Developer Hub external URL, such as https://<my_developer_hub_url>.app-config.yaml
excerptCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 3. Customizing Red Hat Developer Hub backend secret Copiar o linkLink copiado para a área de transferência!
The default Red Hat Developer Hub configuration defines the Developer Hub backend secret for service to service authentication.
You can define your custom Developer Hub backend secret.
Prerequisites
- You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
Procedure
To define the Developer Hub backend secret, add to your custom
<my_product_secrets>.txt
file theBACKEND_SECRET
environment variable with a base64 encoded string. Use a unique value for each Developer Hub instance.$ echo > <my_product_secrets>.txt "BACKEND_SECRET=$(node -p 'require("crypto").randomBytes(24).toString("base64")')"
$ echo > <my_product_secrets>.txt<my_product_secrets>.txt "BACKEND_SECRET=$(node -p 'require("crypto").randomBytes(24).toString("base64")')"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <my_product_secrets>.txt
exampleBACKEND_SECRET=3E2/rIPuZNFCtYHoxVP8wjriffnN1q/z
BACKEND_SECRET=3E2/rIPuZNFCtYHoxVP8wjriffnN1q/z
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add your backend secret to your custom
app-config.yaml
file.app-config.yaml
excerpt defining the backend secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Configuring templates Copiar o linkLink copiado para a área de transferência!
Configure templates to create software components, and publish these components to different locations, such as the Red Hat Developer Hub software catalog, or Git repositories.
A template is a form composed of different UI fields that is defined in a YAML file. Templates include actions, which are steps that are executed in sequential order and can be executed conditionally.
4.1. Creating a Software Template by using the Template Editor Copiar o linkLink copiado para a área de transferência!
Use the Red Hat Developer Hub Template Editor to create a Software Template.
Alternately, you can use the Template Editor to do any of the following actions:
- File > Open template directory
- File > Create template directory
- File > Close template editor
-
Use the Custom Fields Explorer button to test custom fields in your
templates.yaml
file - View Installed Actions Documentation
Procedure
To create a Software Template by using the Template Editor templates, complete the following steps:
- In your Red Hat Developer Hub navigation menu, click Create….
Click the overview menu and select Manage Templates.
NoteThe following options on the Managed Templates page do not create a software component in your Red Hat Developer Hub instance:
-
Template Form Playground: Use to create and test the
templates.yaml
file - Custom Field Explorer: Use to test custom fields
-
Template Form Playground: Use to create and test the
On the Managed Templates page, select any of the following options:
Load Template Directory: Use to load an existing
templates.yaml
file-
In your local file manager, navigate to the folder where your
templates.yaml
file is stored and click Select.
-
In your local file manager, navigate to the folder where your
Create New Template: Use to create a
templates.yaml
file-
In your local file manager, navigate to the folder where you want the Template Editor to create a
templates.yaml
file and click Select. -
On the Template Editor page, select the
templates.yaml
file. (Optional) You can preview and test your template specifications.
- On the Fill in some steps tab, enter text into the required fields and click Next.
- On the Repository Location tab, enter text into the required fields and click Review.
- Modify the YAML definition for the parameters of your template. For more information about these parameters, see Section 4.2, “Creating a Software Template as a YAML file”.
- Review the information for accuracy, then click Create.
-
In your local file manager, navigate to the folder where you want the Template Editor to create a
Verification
- Click the Catalog tab in the navigation panel.
- In the Kind drop-down menu, select Template.
- Confirm that your Software Template is shown in the list of existing templates.
4.2. Creating a Software Template as a YAML file Copiar o linkLink copiado para a área de transferência!
You can create a Software Template by defining a Template
object as a YAML file.
The Template
object describes the template and its metadata. It also contains required input variables and a list of actions that are executed by the scaffolding service.
Template
object example
- 1
- Specify a name for the Software Template.
- 2
- Specify a title for the Software Template. This is the title that is visible on the Software Template tile in the Create… view.
- 3
- Specify a description for the Software Template. This is the description that is visible on the Software Template tile in the Create… view.
- 4
- Specify the ownership of the Software Template. The
owner
field provides information about who is responsible for maintaining or overseeing the Software Template within the system or organization. In the provided example, theowner
field is set tobackstage/techdocs-core
. This means that this Software Template belongs to thetechdocs-core
project in thebackstage
namespace. - 5
- Specify the component type. Any string value is accepted for this required field, but your organization should establish a proper taxonomy for these. Red Hat Developer Hub instances may read this field and behave differently depending on its value. For example, a
website
type component may present tooling in the Red Hat Developer Hub interface that is specific to just websites.The following values are common for this field:
service
- A backend service, typically exposing an API.
website
- A website.
library
- A software library, such as an npm module or a Java library.
- 6
- Use the
parameters
section to specify parameters for user input that are shown in a form view when a user creates a component by using the Software Template in the Red Hat Developer Hub console. Eachparameters
subsection, defined by a title and properties, creates a new form page with that definition. - 7
- Use the
steps
section to specify steps that are executed in the backend. These steps must be defined by using a unique step ID, a name, and an action. You can view actions that are available on your Red Hat Developer Hub instance by visiting the URLhttps://<rhdh_url>/create/actions
. - 8
- Use the
output
section to specify the structure of output data that is created when the Software Template is used. Theoutput
section, particularly thelinks
subsection, provides valuable references and URLs that users can utilize to access and interact with components that are created from the Software Template. - 9
- Provides a reference or URL to the repository associated with the generated component.
- 10
- Provides a reference or URL that allows users to open the generated component in a catalog or directory where various components are listed.
4.3. Importing an existing Software Template to Red Hat Developer Hub Copiar o linkLink copiado para a área de transferência!
You can add an existing Software Template to your Red Hat Developer Hub instance by using the Catalog Processor.
Prerequisites
- You have created a directory or repository that contains at least one Software Template YAML file.
- If you want to use a Software Template that is stored in a repository such as GitHub or GitLab, you must configure a Red Hat Developer Hub integration for your provider.
Procedure
In the
app-config.yaml
configuration file, modify thecatalog.rules
section to include a rule for templates, and configure thecatalog.locations
section to point to the Software Template that you want to add, as shown in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- Click the Catalog tab in the navigation panel.
- In the Kind drop-down menu, select Template.
- Confirm that your Software Template is shown in the list of existing Software Templates.
Chapter 5. Customizing the Learning Paths in Red Hat Developer Hub Copiar o linkLink copiado para a área de transferência!
In Red Hat Developer Hub, you can configure Learning Paths by passing the data into the app-config.yaml
file as a proxy. The base URL must include the /developer-hub/learning-paths
proxy.
Due to the use of overlapping pathRewrites
for both the learning-path
and homepage
quick access proxies, you must create the learning-paths
configuration (^api/proxy/developer-hub/learning-paths
) before you create the homepage
configuration (^/api/proxy/developer-hub
).
For more information about customizing the Home page in Red Hat Developer Hub, see Customizing the Home page in Red Hat Developer Hub.
You can provide data to the Learning Path from the following sources:
- JSON files hosted on GitHub or GitLab.
- A dedicated service that provides the Learning Path data in JSON format using an API.
5.1. Using hosted JSON files to provide data to the Learning Paths Copiar o linkLink copiado para a área de transferência!
Prerequisites
You have installed Red Hat Developer Hub by using either the Operator or Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform.
Procedure
To access the data from the JSON files, complete the following step:
Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2. Using a dedicated service to provide data to the Learning Paths Copiar o linkLink copiado para a área de transferência!
When using a dedicated service, you can do the following:
- Use the same service to provide the data to all configurable Developer Hub pages or use a different service for each page.
-
Use the
red-hat-developer-hub-customization-provider
as an example service, which provides data for both the Home and Tech Radar pages. Thered-hat-developer-hub-customization-provider
service provides the same data as default Developer Hub data. You can fork thered-hat-developer-hub-customization-provider
service repository from GitHub and modify it with your own data, if required. -
Deploy the
red-hat-developer-hub-customization-provider
service and the Developer Hub Helm chart on the same cluster.
Prerequisites
- You have installed the Red Hat Developer Hub using Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform.
Procedure
To use a dedicated service to provide the Learning Path data, complete the following steps:
Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where the
LEARNING_PATH_DATA_URL
is defined ashttp://<SERVICE_NAME>/learning-paths
, for example,http://rhdh-customization-provider/learning-paths
.NoteYou can define the
LEARNING_PATH_DATA_URL
by adding it torhdh-secrets
or by directly replacing it with its value in your custom ConfigMap.- Delete the Developer Hub pod to ensure that the new configurations are loaded correctly.
Chapter 6. Configuring the global header in Red Hat Developer Hub Copiar o linkLink copiado para a área de transferência!
As an administrator, you can configure the Red Hat Developer Hub global header to create a consistent and flexible navigation bar across your Developer Hub instance. By default, the Developer Hub global header includes the following components:
- Create button provides quick access to a variety of templates, enabling users to efficiently set up services, backend and front-end plugins within Developer Hub
- Support button that can link an internal or external support page
- Notifications button displays alerts and updates from plugins and external services
- Search input field allows users to find services, components, documentation, and other resources within Developer Hub
- Plugin extension capabilities provide a preinstalled and enabled catalog of available plugins in Developer Hub
- User profile drop-down menu provides access to profile settings, appearance customization, Developer Hub metadata, and a logout button
6.1. Customizing your Red Hat Developer Hub global header Copiar o linkLink copiado para a área de transferência!
You can use the red-hat-developer-hub.backstage-plugin-global-header
dynamic plugin to extend the global header with additional buttons and customize the order and position of icons and features. Additionally, you can create and integrate your custom dynamic header plugins using the mount points provided by this new header feature, allowing you to further tailor to suit your needs. For more information on enabling dynamic plugins, see Installing and viewing plugins in Red Hat Developer Hub.
Default global header configuration
- 1
- search: Hides the Search modal in the sidebar menu. Change it to
true
to display the Search modal in the sidebar. - 2
- settings: Hides the Settings button in the sidebar menu. Change it to
true
to display the Settings button in the sidebar. - 3
default.main-menu-items
: Hides the Create button from the sidebar menu. Remove this field to display the Create button in the sidebar.- 4
- position: Defines the position of the header. Options:
above-main-content
orabove-sidebar
.
To extend the functionality of the default global header, include any the following attributes in your global header entry:
mountPoint
-
Specifies the location of the header. Use
application/header
to specify it as a global header. You can configure several global headers at different positions by adding entries to themountPoints
field. importName
Specifies the component exported by the global header plugin.
The
red-hat-developer-hub.backstage-plugin-global-header
package (enabled by default) offers the following header components as possible mount point values:-
SearchComponent
: Adds a search bar (enabled by default). -
Spacer
: Adds spacing in the header to position buttons at the end. Useful when you disableSearchComponent
. -
HeaderIconButton
: Adds an icon button. By default, the Create icon button remains enabled. -
SupportButton
: Adds a Support icon button, allowing users to configure a link to an internal or external page. Enabled by default but requires additional configuration to display. -
NotificationButton
: Adds a Notifications icon button to display unread notifications in real time and navigate to the Notifications page. Enabled by default (requires the notifications plugin). -
Divider
: Adds a vertical divider. By default, a divider appears between the profile dropdown and other header components. -
ProfileDropdown
: Adds a profile dropdown showing the logged-in user’s name. By default, it contains two menu items. -
MenuItemLink
: Adds a link item in a dropdown menu. By default, the profile dropdown includes a link to the Settings page. -
LogoutButton
: Adds a logout button in the profile dropdown (enabled by default). -
CreateDropdown
: Adds a Create dropdown button (disabled by default). The menu items are configurable. -
SoftwareTemplatesSection
: Adds a list of software template links to the Create dropdown menu (disabled by default). You must enableCreateDropdown
. -
RegisterAComponentSection
: Adds a link to the Register a Component page in the Create dropdown menu (disabled by default). You must enableCreateDropdown
.
-
config.position
-
Specifies the position of the header. Supported values are
above-main-content
andabove-sidebar
.
Prerequisites
-
You must configure the support URL in the
app-config.yaml
file to display the Support button in the header. - You must install the notifications plugin to display the Notifications button in the header.
Procedure
Copy the default configuration and modify the field values to suit your needs. You can adjust the
priority
value of each header component to control its position. Additionally, you can enable or disable components by adding or removing them from the configuration. To ensure that the remaining header buttons align with the end of the header before the profile dropdown button, setconfig.props.growFactor
to1
in theSpacer
mount point to enable theSpacer
component. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To use your custom header, you must install it as a dynamic plugin by adding your plugin configuration to your
app-config-dynamic.yaml
file. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <npm_or_oci_package-reference>
- Specifies the package name.
- <application_header_name>
-
Specifies the name of the application header. For example:
MyHeader
- <header_component_name>
Specifies the name of the header component. For example:
MyHeaderComponent
NoteimportName
is an optional name referencing the value returned by the scaffolder field extension API.
Optional: To disable the global header, set the value of the
disabled
field totrue
in yourdynamic-plugins.yaml
file. For example:- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header disabled: true
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-global-header disabled: true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2. Mount points for dynamic plugin integration Copiar o linkLink copiado para a área de transferência!
You can customize the application header in Developer Hub using mount points for dynamic plugins. These mount points give flexibility in configuring the position of the header, its components and dropdown menus. You can create a customized experience with the following enhancements:
- application/header
-
Controls the header position. Use
config.position
to set placement as eitherabove-main-content
orabove-sidebar
. - global.header/component
Configures header components. Use
config.priority
to set the order of components, and pass properties (including CSS styles) viaconfig.props
.Example adding a Self-service button
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example adding a spacer element
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example adding a divider element
mountPoints: - mountPoint: global.header/component importName: Divider config: priority: 150
mountPoints: - mountPoint: global.header/component importName: Divider config: priority: 150
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - global.header/profile
Configures the profile dropdown list when the
ProfileDropdown
component is enabled.Example adding a settings link to the profile dropdown
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - global.header/create
Configures the create dropdown list when the
CreateDropdown
component is enabled.Example adding a section for registering a component
- mountPoint: global.header/create importName: RegisterAComponentSection config: props: growFactor: 0
- mountPoint: global.header/create importName: RegisterAComponentSection config: props: growFactor: 0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 7. Configuring a floating action button in Red Hat Developer Hub Copiar o linkLink copiado para a área de transferência!
You can use the floating action button plugin to configure any action as a floating button in the Developer Hub instance. The floating action button plugin is enabled by default. You can also configure floating action buttons to display as submenu options within the main floating action button by assigning the floating action buttons to the same slot
field of your dynamic-plugins.yaml
file.
7.1. Configuring a floating action button as a dynamic plugin Copiar o linkLink copiado para a área de transferência!
You can configure the floating action button as a dynamic plugin to perform actions or open an internal or external link.
Prerequisties
You must have sufficient permissions as a platform engineer.
Procedure
To configure a floating action button as a dynamic plugin, complete any of the following tasks:
Specify the
global.floatingactionbutton/config
mount point in yourapp-config-dynamic.yaml
file. For example:Example of a bulk-import plugin as a floating action button
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To configure an action as a floating action button that opens an external link, specify the
global.floatingactionbutton/config
mount point in yourdynamic-plugins.yaml
file within thebackstage-plugin-global-floating-action-button
plugin. For example:Example of a floating action button that opens GitHub
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To configure a floating action button that contains a submenu, define the
global.floatingactionbutton/config
mount point in the sameslot
field in yourdynamic-plugins.yaml
file for multiple actions. The default slot ispage-end
when not specified. For example:Example of a floating action button with submenu actions
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To configure a floating action button to display only on specific pages, configure the
global.floatingactionbutton/config
mount point in thebackstage-plugin-global-floating-action-button
plugin and set thevisibleOnPaths
property as shown in the following example:Example of a floating action button to display specific pages
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- (Required) The import name with an associated component to the mount point.
To hide a floating action button on specific pages, configure the
global.floatingactionbutton/config
mount point in thebackstage-plugin-global-floating-action-button
plugin and set theexcludeOnPaths
property as shown in the following example:Example of a floating action button to hide specific pages
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- (Required) The import name with an associated component to the mount point.
7.2. Floating action button parameters Copiar o linkLink copiado para a área de transferência!
Use the parameters as shown in the following table to configure your floating action button plugin.
Name | Description | Type | Default value | Required |
---|---|---|---|---|
|
Position of the floating action button. Valid values: |
|
| No |
| Name of the floating action button |
| Not applicable | Yes |
|
Icon of the floating action button. Recommended to use filled icons from the Material Design library. You can also use an svg icon. For example: |
| Not applicable | No |
| Display of the label next to your icon |
| Not applicable | No |
| Size of the floating action button |
|
| No |
| Color of the component. It supports both default and custom theme colors, that are added from the Palette Getting started guide. |
|
| No |
| Performed action when selecting a floating action button |
| Not applicable | No |
| Link that opens when selecting a floating action button |
| Not applicable | No |
| Text that appears when hovering over a floating action button |
| Not applicable | No |
| Order of the floating action buttons displayed in the submenu. A larger value means higher priority. |
| Not applicable | No |
| Display floating action button on the specified paths |
| Display floating action button on all paths | No |
| Hide floating action button on the specified paths |
| Display floating action button on all paths | No |
If multiple floating button actions are assigned to the same slot
value, the floating buttons are displayed as submenu options within the main floating action button.
Chapter 8. Customizing the Tech Radar page in Red Hat Developer Hub Copiar o linkLink copiado para a área de transferência!
In Red Hat Developer Hub, the Tech Radar page is provided by the tech-radar
dynamic plugin, which is disabled by default. For information about enabling dynamic plugins in Red Hat Developer Hub see Configuring dynamic plugins.
In Red Hat Developer Hub, you can configure Learning Paths by passing the data into the app-config.yaml
file as a proxy. The base Tech Radar URL must include the /developer-hub/tech-radar
proxy.
Due to the use of overlapping pathRewrites
for both the tech-radar
and homepage
quick access proxies, you must create the tech-radar
configuration (^api/proxy/developer-hub/tech-radar
) before you create the homepage
configuration (^/api/proxy/developer-hub
).
For more information about customizing the Home page in Red Hat Developer Hub, see Customizing the Home page in Red Hat Developer Hub.
You can provide data to the Tech Radar page from the following sources:
- JSON files hosted on GitHub or GitLab.
- A dedicated service that provides the Tech Radar data in JSON format using an API.
8.1. Customizing the Tech Radar page by using a JSON file Copiar o linkLink copiado para a área de transferência!
For ease of use and simplicity, you can configure the Tech Radar page by using a hosted JSON file.
Prerequisites
-
You have specified the data sources for the Tech Radar plugin in the
integrations
section of theapp-config.yaml
file. For example, to configure GitHub as an integration, see Authenticating with GitHub. -
You have enabled the
./dynamic-plugins/dist/backstage-community-plugin-tech-radar
and/dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
plugins.
Procedure
- Publish the JSON file containing your Tech Radar data to a web server, such as GitHub or Gitlab. You can find an example at https://raw.githubusercontent.com/redhat-developer/rhdh/release-1.5/packages/app/public/tech-radar/data-default.json.
Configure Developer Hub to access the Tech Radar data from the hosted JSON files, by adding the following to the
app-config.yaml
file:techRadar: url: <tech_radar_data_url>
techRadar: url: <tech_radar_data_url>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <tech_radar_data_url>
- Enter the Tech Radar data hosted JSON URL.
8.2. Customizing the Tech Radar page by using a customization service Copiar o linkLink copiado para a área de transferência!
For advanced scenarios, you can host your Red Hat Developer Hub customization service to provide data to all configurable Developer Hub pages, such as the Tech Radar page. You can even use a different service for each page.
Prerequisites
-
You have specified the data sources for the Tech Radar plugin in the
integrations
section of theapp-config.yaml
file. For example, to configure GitHub as an integration, see Authenticating with GitHub. -
You have enabled the
./dynamic-plugins/dist/backstage-community-plugin-tech-radar
and/dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
plugins.
Procedure
-
Deploy your Developer Hub customization service on the same OpenShift Container Platform cluster as your Developer Hub instance. You can find an example at
red-hat-developer-hub-customization-provider
, that provides the same data as default Developer Hub data. The customization service provides a Tech Radar data URL such as:http://<rhdh-customization-provider>/tech-radar
. Add the dedicated service as an allowed host by adding the following code to the
app-config.yaml
file:backend: reading: allow: - host: '<rhdh_customization_provider_base_url>'
backend: reading: allow: - host: '<rhdh_customization_provider_base_url>'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <rhdh_customization_provider_base_url>
-
Enter the base URL of your Tech Radar data URL, such as:
<rhdh-customization-provider>
.
Add the following to the
app-config.yaml
file:techRadar: url: <tech_radar_data_url>
techRadar: url: <tech_radar_data_url>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <tech_radar_data_url>
-
Enter your Tech Radar data URL, such as:
http://<rhdh-customization-provider>/tech-radar
.
Chapter 9. Customizing Red Hat Developer Hub appearance Copiar o linkLink copiado para a área de transferência!
The following default theme configurations are available for Red Hat Developer Hub:
- The Red Hat Developer Hub theme
- Default theme configurations to make your developer portal look like a standard Red Hat Developer Hub instance. For more information, see Section 9.9, “Default Red Hat Developer Hub theme”
- The Backstage theme
- Default theme configurations to make your developer portal look like a standard Backstage instance. For more information, see Section 9.10, “Default Backstage theme”
You can change or disable particular parameters in a default theme or create a fully customized theme by modifying the app-config-rhdh.yaml
file. From the app-config-rhdh.yaml
file, you can customize common theme components, including the following:
- Company name and logo
- Font color, size, and style of text in paragraphs, headings, headers, and buttons
- Header color, gradient, and shape
- Button color
- Navigation indicator color
You can also customize some components from the Developer Hub GUI, such as the theme mode (Light Theme, Dark Theme, or Auto).
9.1. Customizing the theme mode for your Developer Hub instance Copiar o linkLink copiado para a área de transferência!
In Developer Hub, theme configurations are used to change the look and feel of different UI components. So, you might notice changes in different UI components, such as buttons, tabs, sidebars, cards, and tables along with some changes in background color and font used on the RHDH pages.
You can choose one of the following theme modes for your Developer Hub instance:
- Light theme
- Dark theme
- Auto
The default theme mode is Auto, which automatically sets the light or dark theme based on your system preferences.
Prerequisites
- You are logged in to the Developer Hub web console.
Procedure
- From the Developer Hub web console, click Settings.
From the Appearance panel, click LIGHT THEME, DARK THEME, or AUTO to change the theme mode.
9.2. Customizing the branding logo of your Developer Hub instance Copiar o linkLink copiado para a área de transferência!
You can customize the branding logo of your Developer Hub instance by configuring the branding
section in the app-config.yaml
file, as shown in the following example:
app: branding: fullLogo: ${BASE64_EMBEDDED_FULL_LOGO} iconLogo: ${BASE64_EMBEDDED_ICON_LOGO}
app:
branding:
fullLogo: ${BASE64_EMBEDDED_FULL_LOGO}
iconLogo: ${BASE64_EMBEDDED_ICON_LOGO}
where:
- 1
fullLogo
is the logo on the expanded (pinned) sidebar and expects a base64 encoded image.- 2
iconLogo
is the logo on the collapsed (unpinned) sidebar and expects a base64 encoded image.You can format the
BASE64_EMBEDDED_FULL_LOGO
environment variable as follows:BASE64_EMBEDDED_FULL_LOGO: "data:_<media_type>_;base64,<base64_data>"
BASE64_EMBEDDED_FULL_LOGO: "data:_<media_type>_;base64,<base64_data>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example demonstrates how to customize the
BASE64_EMBEDDED_FULL_LOGO
using thedata:_<media_type>_;base64,<base64_data>
format:SVGLOGOBASE64=$(base64 -i logo.svg) BASE64_EMBEDDED_FULL_LOGO="data:image/svg+xml;base64,$SVGLOGOBASE64"
SVGLOGOBASE64=$(base64 -i logo.svg) BASE64_EMBEDDED_FULL_LOGO="data:image/svg+xml;base64,$SVGLOGOBASE64"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
image/svg+xml
with the correct media type for your image (for example,image/png
andimage/jpeg
), and adjust the file extension accordingly. As a result, you can embed the logo directly without referencing an external file.
You can also customize the width of the branding logo by setting a value for the fullLogoWidth
field in the branding
section, as shown in the following example:
app: branding: fullLogoWidth: 110px # ...
app:
branding:
fullLogoWidth: 110px
# ...
- 1
- The default value for the logo width is
110px
. The following units are supported:integer
,px
,em
,rem
, percentage.
9.4. Configuring entity tab titles Copiar o linkLink copiado para a área de transferência!
Red Hat Developer Hub provides a default opinionated tab set for catalog entity views. For consistency with your organization needs, you can rename, reorder, remove, and add tab titles.
Procedure
For each tab to modify, enter your desired values in the
entityTabs
section in yourapp-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow <plugin_name>
-
Enter the plugin name, such as
backstage-community.plugin-topology
. mountPoint
-
Enter the tab mountpoint, such as
entity.page.topology
. path
-
Enter the tab path, such as
/topology
. title
-
Enter the tab title, such as
Topology
. priority
Optional.
To reorder tabs, enter the tab priority, such as
42
. Higher priority appears first.To remove a tab, enter a negative value, such as
-1
.
9.5. Configuring entity detail tab layout Copiar o linkLink copiado para a área de transferência!
Each Red Hat Developer Hub entity detail tab has a default opinionated layout. For consistency with your organization needs, you can change the entity detail tab content when the plugin that contributes the tab content allows a configuration.
Prerequisites
-
The plugin that contributes the tab content allows a configuration, such as Developer Hub plugins defining a default configuration in a
config
section.
Procedure
Copy the plugin default configuration in your
app-config.yaml
file, and change thelayout
properties.Copy to Clipboard Copied! Toggle word wrap Toggle overflow package
-
Enter your package location, such as
./dynamic-plugins/dist/backstage-community-plugin-tekton
. <plugin_name>
-
Enter your plugin name, such as:
backstage-community.plugin-tekton
. mountPoint
-
Copy the mount point defined in the plugin default configuration, such as:
entity.page.ci/cards
. importName
-
Copy the import name defined in the plugin default configuration, such as:
TektonCI
. layout
-
Enter your layout configuration. The tab content is displayed in a responsive grid that uses a 12 column-grid and supports different breakpoints (
xs
,sm
,md
,lg
,xl
) that can be specified for a CSS property, such asgridColumn
. The example uses 6 of the 12 columns to show two Tekton CI cards side-by-side on large (lg
) screens (span 6
columns) and show them among themselves (xs
and abovespan 12
columns).
9.6. Customizing the theme mode color palettes for your Developer Hub instance Copiar o linkLink copiado para a área de transferência!
You can customize the color palettes of the light and dark theme modes in your Developer Hub instance by configuring the light.palette
and dark.palette
parameters in the branding.theme
section of the app-config.yaml
file, as shown in the following example:
- 1
- The main primary color for the light color palette, for example,
#ffffff
orwhite
- 2
- The color of the navigation indicator for the light color palette, which is a vertical bar that indicates the selected tab in the navigation panel, for example,
#FF0000
orred
- 3
- The background color for the default page theme for the light color palette, for example,
#ffffff
orwhite
- 4
- The main primary color for the dark color palette, for example,
#000000
orblack
- 5
- The color of the navigation indicator for the dark color palette, which is a vertical bar that indicates the selected tab in the navigation panel, for example,
#FF0000
orred
- 6
- The background color for the default page theme for the dark color palette, for example,
#000000
orblack
Additional resources
9.7. Customizing the page theme header for your Developer Hub instance Copiar o linkLink copiado para a área de transferência!
You can customize the header color for the light and dark theme modes in your Developer Hub instance by modifying the branding.theme
section of the app-config.yaml
file. You can also customize the page headers for additional Developer Hub pages, such as the Home, Catalog, and APIs pages.
- 1
- The theme mode, for example,
light
ordark
- 2
- The
yaml
header for the default page theme configuration - 3
- The color of the page header background, for example,
#ffffff
orwhite
- 4
- The color of the text in the page header, for example,
#000000
orblack
- 5
- The pattern on the page header, for example,
wave
,round
, ornone
- 6
- The
yaml
header for a specific page theme configuration, for example,apis
,home
9.8. Customizing the font for your Developer Hub instance Copiar o linkLink copiado para a área de transferência!
You can configure the typography
section of the app-config.yaml
file to change the default font family and size of the page text, as well as the font family and size of each heading level, as shown in the following example:
9.9. Default Red Hat Developer Hub theme Copiar o linkLink copiado para a área de transferência!
You can use the default Red Hat Developer Hub theme configurations to make your Developer Hub instance look like a standard Red Hat Developer Hub instance. You can also modify the app-config.yaml
file to customize or disable particular parameters.
9.9.1. Default Red Hat Developer Hub theme color palette Copiar o linkLink copiado para a área de transferência!
The app-config.yaml
file uses the following configurations for the default Red Hat Developer Hub color palette:
Alternatively, you can use the following variant
and mode
values in the app-config.yaml
file to apply the previous default configuration:
9.9.2. Default Red Hat Developer Hub page themes Copiar o linkLink copiado para a área de transferência!
The default Developer Hub header color is white in light mode and black in dark mode, as shown in the following app-config.yaml
file configuration:
9.10. Default Backstage theme Copiar o linkLink copiado para a área de transferência!
You can use the default Backstage theme configurations to make your Developer Hub instance look like a standard Backstage instance. You can also modify the app-config.yaml
file to customize or disable particular parameters.
9.10.1. Default Backstage theme color palette Copiar o linkLink copiado para a área de transferência!
The app-config.yaml
file uses the following configurations for the default Backstage color palette:
Alternatively, you can use the following variant
and mode
values in the app-config.yaml
file to apply the previous default configuration:
9.10.2. Default Backstage page themes Copiar o linkLink copiado para a área de transferência!
The default Backstage header color is white in light mode and black in dark mode, as shown in the following app-config.yaml
file configuration:
9.11. Loading a custom Developer Hub theme by using a dynamic plugin Copiar o linkLink copiado para a área de transferência!
You can load a custom Developer Hub theme from a dynamic plugin.
Procedure
Export a theme provider function in your dynamic plugin, for example:
Sample
myTheme.ts
fragmentimport { lightTheme } from './lightTheme'; // some custom theme import { UnifiedThemeProvider } from '@backstage/theme'; export const lightThemeProvider = ({ children }: { children: ReactNode }) => ( <UnifiedThemeProvider theme={lightTheme} children={children} /> );
import { lightTheme } from './lightTheme'; // some custom theme import { UnifiedThemeProvider } from '@backstage/theme'; export const lightThemeProvider = ({ children }: { children: ReactNode }) => ( <UnifiedThemeProvider theme={lightTheme} children={children} /> );
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about creating a custom theme, see Backstage documentation - Creating a Custom Theme.
Configure Developer Hub to load the theme in the UI by using the
themes
configuration field:app-config.yaml
fragmentCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Set your theme ID by specifying the desired value. Optionally, override the default Developer Hub themes by using the following ID values:
light
to replace the default light theme, ordark
to replace the default dark theme.
Verification
- The theme is available in the Developer Hub Settings page.
9.12. Custom component options for your Developer Hub instance Copiar o linkLink copiado para a área de transferência!
There are two component variants that you can use to customize various components of your Developer Hub theme:
- Patternfly
- MUI
In addition to assigning a component variant to each parameter in the light or dark theme mode configurations, you can toggle the rippleEffect
on
or off
.
The following code shows the options that you can use in the app-config.yaml
file to configure the theme components for your Developer Hub instance:
Chapter 10. Customizing the Home page Copiar o linkLink copiado para a área de transferência!
When using the app-config
, you can do the following:
- Customize and extend the default Home page layout with additional cards that appear based on the plugins you have installed and enabled.
- Change quick access links.
Add, reorganize, and remove the following available cards:
- Search bar
- Quick access
- Headline
- Markdown
- Placeholder
- Catalog starred entities
- Featured docs
10.1. Customizing the Home page cards Copiar o linkLink copiado para a área de transferência!
Administrators can change the fixed height of cards that are in a 12-column grid.
The default Home page is as shown in the following app-config.yaml
file configuration:
Prerequisites
-
You have administrative access and can modify the
app-config.yaml
file for dynamic plugin configurations.
Procedure
Configure different cards for your Home page in Red Hat Developer Hub as follows:
- Search
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 10.1. Available props Prop Default Description path
/search
Override the linked search path if needed
queryParam
query
Override the search query parameter name if needed
- Quick access
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 10.2. Available props Prop Default Description title
Quick Access
Override the linked search path if needed
path
none
Override the search query parameter name if needed
- Headline
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 10.3. Available props Prop Default Description title
none
Title
- Markdown
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Placeholder
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Catalog starred entities
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Featured docs
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Defining the layout of the Red Hat Developer Hub Home page Copiar o linkLink copiado para a área de transferência!
The Home page uses a 12-column grid to position your cards. You can use the optimal parameters to define the layout of your Developer Hub Home page.
Prerequisites
Include the following optimal parameters in each of your breakpoints:
- width (w)
- height (h)
- position (x and y)
Procedure
Configure your Developer Hub
app-config.yaml
configuration file by choosing one of the following options:- Use the full space on smaller windows and half of the space on larger windows as follows:
-
Show the cards side by side by defining the
x
parameter as shown in the following example:
However, you can see a second card below this card by default.
-
Show the cards in three columns by defining the
x
parameter as shown in the following example:
Chapter 11. Customizing the Quick access card Copiar o linkLink copiado para a área de transferência!
To access the Home page in Red Hat Developer Hub, the base URL must include the /developer-hub
proxy. You can configure the Home page by passing the data into the app-config.yaml
file as a proxy. You can provide data to the Home page from the following sources:
- JSON files hosted on GitHub or GitLab.
- A dedicated service that provides the Home page data in JSON format using an API.
11.1. Using hosted JSON files to provide data to the Quick access card Copiar o linkLink copiado para a área de transferência!
Prerequisites
- You have installed Red Hat Developer Hub by using either the Operator or Helm chart. See Installing Red Hat Developer Hub on OpenShift Container Platform.
Procedure
-
To access the data from the JSON files, add the following code to the
app-config.yaml
Developer Hub configuration file: Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.2. Using a dedicated service to provide data to the Quick access card Copiar o linkLink copiado para a área de transferência!
When using a dedicated service, you can do the following tasks:
- Use the same service to provide the data to all configurable Developer Hub pages or use a different service for each page.
-
Use the
red-hat-developer-hub-customization-provider
as an example service, which provides data for both the Home and Tech Radar pages. Thered-hat-developer-hub-customization-provider
service provides the same data as default Developer Hub data. You can fork thered-hat-developer-hub-customization-provider
service repository from GitHub and modify it with your own data, if required. -
Deploy the
red-hat-developer-hub-customization-provider
service and the Developer Hub Helm chart on the same cluster.
Prerequisites
- You have installed the Red Hat Developer Hub using Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform with the Helm chart.
Procedure
To use a separate service to provide the Home page data, complete the following steps:
- From the Developer perspective in the Red Hat OpenShift Container Platform web console, click +Add > Import from Git.
Enter the URL of your Git repository into the Git Repo URL field.
To use the
red-hat-developer-hub-customization-provider
service, add the URL for the red-hat-developer-hub-customization-provider repository or your fork of the repository containing your customizations.-
On the General tab, enter
red-hat-developer-hub-customization-provider
in the Name field and click Create. On the Advanced Options tab, copy the value from Target Port.
NoteTarget Port automatically generates a Kubernetes or OpenShift Container Platform service to communicate with.
Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
http://<SERVICE_NAME>:8080
, for example,http://rhdh-customization-provider:8080
.
NoteThe
red-hat-developer-hub-customization-provider
service contains the 8080 port by default. If you are using a custom port, you can specify it with the 'PORT' environmental variable in theapp-config.yaml
file.-
Replace the
HOMEPAGE_DATA_URL
by adding the URL torhdh-secrets
or by directly replacing it in your custom ConfigMap. - Delete the Developer Hub pod to ensure that the new configurations are loaded correctly.
Verification
To view the service, go to the Administrator perspective in the OpenShift Container Platform web console and click Networking > Service.
NoteYou can also view Service Resources in the Topology view.
Ensure that the provided API URL for the Home page returns the data in JSON format as shown in the following example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf the request call fails or is not configured, the Developer Hub instance falls back to the default local data.
-
If the images or icons do not load, then allowlist them by adding your image or icon host URLs to the content security policy (csp)
img-src
in your custom ConfigMap as shown in the following example: