Skip to content

Commit 3e4e1fd

Browse files
GitHub Actionsjmagak
authored andcommitted
Add frontend plugn wiring section
1 parent be15fef commit 3e4e1fd

17 files changed

+145
-192
lines changed

assemblies/dynamic-plugins/assembly-front-end-plugin-wiring.adoc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
[id="assembly-front-end-plugin-wiring_{context}"]
1+
[id="assembly-front-end-plugin-wiring.adoc_{context}"]
22
= Front-end plugin wiring
33
:context: assembly-front-end-plugin-wiring
44

5-
You can configure front-end plugins to do the following:
6-
7-
* Extend the internal library of available icons
8-
* Declare a new full page by defining a new route
9-
* Extend to an existing page using router bindings
10-
* Use mount points within the application
11-
* Provide additional utility APIs or replace existing ones
5+
You can configure front-end plugins to customize icons, integrate components at mount points, and provide or replace utility APIs.
126

137
// Extending the internal icon catalog
148
include::../modules/dynamic-plugins/proc-extending-internal-icon-catalog.adoc[leveloffset=+1]
159

1610
// Defining dynamic routes for new plugin pages
17-
include::../modules/dynamic-plugins/proc-defining-dynamic-routes.adoc[leveloffset=+1]
11+
include::../modules/dynamic-plugins/proc-defining-dynamic-routes-for-new-plugin-pages.adoc[leveloffset=+1]
1812

1913
// Customizing menu items in the sidebar navigation
2014
include::../modules/dynamic-plugins/proc-customizing-sidebar-menu-items.adoc[leveloffset=+1]

modules/dynamic-plugins/con-providing-custom-scaffolder-field-extensions.adoc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[id="con-providing-custom-scaffolder-field-extensions"]
2-
1+
[id="con-providing-custom-scaffolder-field-extensions.adoc_{context}"]
32
= Providing custom Scaffolder field extensions
43

54
The Scaffolder component in {product} ({product-very-short}) enables users to create software components using templates through a guided wizard. You can extend the functionality of the Scaffolder by providing custom form fields as dynamic plugins using the `scaffolderFieldExtensions` configuration.
@@ -10,18 +9,16 @@ When you configure custom scaffolder field extensions:
109

1110
* The dynamic plugin exposes the field extension component using `createScaffolderFieldExtension`.
1211
* Each field extension requires a unique `importName` for registration.
13-
* Multiple field extensions can be registered by listing each in the configuration.
12+
* You register multiple field extensions by listing each in the configuration.
1413

1514
[source,yaml]
1615
----
1716
dynamicPlugins:
1817
frontend:
19-
my-plugin: # <1>
18+
my-plugin: # The plugin package name
2019
scaffolderFieldExtensions:
21-
- importName: MyNewFieldExtension # <2>
20+
- importName: MyNewFieldExtension # References the exported scaffolder field extension component from your plugin
2221
----
23-
<1> Specify the plugin package name.
24-
<2> The `importName` references the exported scaffolder field extension component from your plugin.
2522

2623
[NOTE]
2724
====

modules/dynamic-plugins/con-using-custom-signinpage-component.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
[id="con-using-custom-signinpage-component"]
1+
[id="con-using-custom-signinpage-component.adoc_{context}"]
22
= Using a custom SignInPage component
33

4-
In {product} ({product-very-short}), the `SignInPage` component manages the application's authentication flow. The `SignInPage` connects one or more authentication providers to the sign-in process. By default, {product-short} uses a static `SignInPage` that supports all built-in authentication providers.
4+
In {product} ({product-very-short}), the `SignInPage` component manages the application's authentication flow. This component connects one or more authentication providers to the sign-in process. By default, {product-short} uses a static `SignInPage` that supports all built-in authentication providers.
55

66
When you configure a custom `SignInPage`:
77

88
* The system loads the specified `importName` component from your dynamic plugin.
99
* The component returns a configured `SignInPage` that connects the desired authentication provider factories.
10-
* Only one `signInPage` can be specified for the application at a time.
10+
* Only one `signInPage` is specified for the application at a time.
1111

1212
[source,yaml]
1313
----
1414
dynamicPlugins:
1515
frontend:
16-
my-plugin: # <1>
16+
my-plugin: # The plugin package name
1717
signInPage:
1818
importName: CustomSignInPage
1919
----
20-
<1> Specify the plugin package name.
2120

2221
[NOTE]
2322
====

modules/dynamic-plugins/proc-adding-application-header.adoc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[id="proc-adding-application-header.adoc-catalog"]
2-
1+
[id="proc-adding-application-header.adoc_{context}"]
32
= Adding application header
43

54
You can customize global headers by specifying configurations in the `app-config.yaml` file as shown in the following example:
@@ -9,20 +8,14 @@ You can customize global headers by specifying configurations in the `app-config
98
# app-config.yaml
109
dynamicPlugins:
1110
frontend:
12-
my-plugin: # <1>
11+
my-plugin: # The plugin package name
1312
mountPoints:
14-
- mountPoint: application/header # <2>
15-
importName: <header_component> # <3>
13+
- mountPoint: application/header # Adds the header as a global header
14+
importName: <header_component> # Specifies the component exported by the global header plugin
1615
config:
17-
position: above-main-content # <4>
16+
position: above-main-content # Supported values: (`above-main-content`| above-sidebar`)
1817
----
19-
<1> Specify the plugin package name.
20-
<2> Specify where to add the header. To specify it as a global header, use `application/header`.
21-
<3> Specify the component exported by the global header plugin (for example, `GlobalHeader` for `red-hat-developer-hub.backstage-plugin-global-header).
22-
<4> Specify the header's position. The supported values include:
23-
* `above-main-content`: Positions the header above the main content area.
24-
* `above-sidebar`: Positions the header above the sidebar.
25-
+
18+
2619
[NOTE]
2720
====
2821
To configure multiple global headers at different positions, add entries to the `mountPoints` field.

modules/dynamic-plugins/proc-adding-application-listeners.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[id="proc-adding-application-listeners"]
2-
1+
[id="proc-adding-application-listeners.adoc_{context}"]
32
= Adding application listeners
43

54
You can add application listeners using the `application/listener` mount point as shown in the following example:
@@ -9,12 +8,11 @@ You can add application listeners using the `application/listener` mount point a
98
# app-config.yaml
109
dynamicPlugins:
1110
frontend:
12-
my-plugin: # <1>
11+
my-plugin: # The plugin package name
1312
mountPoints:
1413
- mountPoint: application/listener
1514
importName: <exported listener component>
1615
----
17-
<1> Specify the plugin package name.
1816

1917
[NOTE]
2018
====

modules/dynamic-plugins/proc-adding-application-providers.adoc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[id="proc-adding-application-providers"]
1+
[id="proc-adding-application-providers.adoc_{context}"]
22

33
= Adding application providers
44

@@ -9,16 +9,14 @@ You can add application providers using the `application/provider` mount point.
99
# app-config.yaml
1010
dynamicPlugins:
1111
frontend:
12-
my-plugin: # <1>
12+
my-plugin: # The plugin package name
1313
dynamicRoutes:
1414
- path: /<route>
15-
importName: Component # <2>
15+
importName: Component # The component to load on the route
1616
mountPoints:
1717
- mountPoint: application/provider
1818
importName: <exported provider component>
1919
----
20-
<1> Specify the plugin package name.
21-
<2> Specify the component you want to load on the route.
2220

2321
[NOTE]
2422
====
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[id="proc-adding-custom-authentication-provider-settings"]
2-
1+
[id="proc-adding-custom-authentication-provider-settings.adoc_{context}"]
32
= Adding custom authentication provider settings
43

54
You can install new authentication providers from a dynamic plugin that either adds additional configuration support for an existing provider or adds a new authentication provider. These providers are listed in the user settings section under the *Authentication Providers* tab.
@@ -10,13 +9,17 @@ You can use the `providerSettings` configuration to add entries for an authentic
109
----
1110
dynamicPlugins:
1211
frontend:
13-
my-plugin: # <1>
12+
my-plugin: # The plugin package name
1413
providerSettings:
15-
- title: My Custom Auth Provider # <2>
16-
description: Sign in using My Custom Auth Provider # <3>
17-
provider: core.auth.my-custom-auth-provider # <4>
14+
# The title for the authentication provider shown above the user's profile image if available
15+
- title: My Custom Auth Provider
16+
# The description of the authentication provider
17+
description: Sign in using My Custom Auth Provider
18+
# The ID of the authentication provider as provided to the `createApiRef` API call.
19+
provider: core.auth.my-custom-auth-provider
1820
----
19-
<1> Specify the plugin package name.
20-
<2> Specify the title for the authentication provider shown above the user's profile image if available.
21-
<3> Specify the description of the authentication provider.
22-
<4> Specify the ID of the authentication provider as provided to the `createApiRef` API call. This value is used to look up the corresponding API factory for the authentication provider to connect the provider's Sign In/Sign Out button.
21+
22+
[NOTE]
23+
====
24+
`provider` looks up the corresponding API factory for the authentication provider to connect the provider's Sign In/Sign Out button.
25+
====

modules/dynamic-plugins/proc-binding-to-existing-plugins.adoc

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[id="proc-binding-to-existing-plugins"]
2-
1+
[id="proc-binding-to-existing-plugins.adoc_{context}"]
32
= Binding to existing plugins
43

54
You can bind to existing plugins and their routes, and declare new targets sourced from dynamic plugins as shown in the following `routeBindings` configuration:
@@ -13,30 +12,26 @@ plugins:
1312
pluginConfig:
1413
dynamicPlugins:
1514
frontend:
16-
my-plugin: # <1>
15+
my-plugin: # The plugin package name
1716
routeBindings:
18-
targets: # <2>
19-
- name: barPlugin # <3>
20-
importName: barPlugin # <4>
21-
module: CustomModule # <5>
17+
targets: # A new bind target
18+
# (Optional): Defaults to importName. Explicit name of the plugin that exposes the bind target.
19+
- name: barPlugin
20+
# (Required): Explicit import name that reference a BackstagePlugin<{}> implementation.
21+
importName: barPlugin
22+
# (Optional): Same as key in `scalprum.exposedModules` key in plugin's `package.json`
23+
module: CustomModule
2224
bindings:
23-
- bindTarget: "barPlugin.externalRoutes" # <6>
24-
bindMap: # <7>
25+
- bindTarget: "barPlugin.externalRoutes" # (Required): One of the supported or imported bind targets
26+
bindMap: # A required map of route bindings similar to `bind` function options
2527
headerLink: "fooPlugin.routes.root"
2628
----
27-
<1> Specify the plugin package name.
28-
<2> Declare a new bind target
29-
<3> (Optional): defaults to importName. Explicit name of the plugin that exposes the bind target.
30-
<4> Required. Explicit import name that reference a BackstagePlugin<{}> implementation.
31-
<5> (Optional): Same as key in `scalprum.exposedModules` key in plugin's `package.json`
32-
<6> (Required): One of the supported or imported bind targets
33-
<7> A required map of route bindings and is similar to `bind` function options
3429

3530
To configure `routeBindings`, complete the following steps:
3631

3732
. Define new targets using `routeBindings.targets`. Set the required `importName` to a `BackstagePlugin<{}>` implementation.
3833

39-
. Declare route bindings using the *routeBindings.bindings* field by setting `bindTarget` to the name of the target to bind to. This can be a dynamic or static target, such as:
34+
. Declare route bindings using the *routeBindings.bindings* field by setting `bindTarget` to the name of the target to bind to. This is a dynamic or static target, such as:
4035
+
4136
** `catalogPlugin.externalRoutes`
4237

modules/dynamic-plugins/proc-customizing-and-extending-entity-tabs.adoc

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[id="proc-customizing-and-extending-entity-tabs"]
1+
[id="proc-customizing-and-extending-entity-tabs.adoc_{context}"]
22

33
= Customizing and extending entity tabs
44

@@ -13,32 +13,28 @@ plugins:
1313
pluginConfig:
1414
dynamicPlugins:
1515
frontend:
16-
my-plugin: # <1>
16+
my-plugin: # The plugin package name
1717
entityTabs:
18-
# <2>
18+
# Specify a new tab
1919
- path: /new-path
2020
title: My New Tab
2121
mountPoint: entity.page.my-new-tab
22-
# <3>
22+
# Change an existing tab's title or mount point
2323
- path: /
2424
title: General
2525
mountPoint: entity.page.overview
26-
- path: "/pr" # <4>
27-
title: "Changed Pull/Merge Requests" # <5>
26+
# Specify the sub-path route in the catalog where this tab is available
27+
- path: "/pr"
28+
title: "Changed Pull/Merge Requests" # Specify the title you want to display
2829
priority: 1
29-
mountPoint: "entity.page.pull-requests" # <6>
30+
# The base mount point name available on the tab. This name expands to create two mount points per tab, with` /context` and with `/cards`
31+
mountPoint: "entity.page.pull-requests"
3032
- path: "/"
3133
title: "Changed Overview"
3234
mountPoint: "entity.page.overview"
33-
priority: -6 # <7>
35+
# Specify the order of tabs. The tabs with higher priority values appear first
36+
priority: -6
3437
----
35-
<1> Specify the plugin package name.
36-
<2> Specify a new tab
37-
<3> Change an existing tab's title or mount point
38-
<4> Specify the sub-path route in the catalog where this tab is available.
39-
<5> Specify the title you want to display.
40-
<6> The base mount point name that is available on the tab. This name is expanded to create two mount points per tab, one appended with` /context` and the second appended with `/cards`.
41-
<7> Specify the order of tabs. The tabs with higher priority values appear first.
4238

4339
You can configure dynamic front-end plugins to target the mount points exposed by the entityTabs configuration. The following are the default catalog entity routes in the default order:
4440

modules/dynamic-plugins/proc-customizing-entity-page.adoc

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[id="proc-customizing-entity-page"]
2-
1+
[id="proc-customizing-entity-page.adoc_{context}"]
32
= Customizing entity page
43

54
You can extend catalog components and additional views.
@@ -119,42 +118,37 @@ plugins:
119118
pluginConfig:
120119
dynamicPlugins:
121120
frontend:
122-
my-plugin: # <1>
123-
mountPoints: # <2>
121+
my-plugin: # The plugin package name
122+
mountPoints: # (Optional): Uses existing mount points
124123
- mountPoint: <mountPointName>/[cards|context]
125124
module: CustomModule
126125
importName: FooPluginPage
127-
config: # <3>
128-
layout: {} # <4>
129-
if: # <5>
126+
config: # (Optional): Allows you to pass additional configuration to the component
127+
layout: {} # Used only in `/cards` type which renders visible content
128+
# Use only in `/cards` type which renders visible content. `if` is passed to `<EntitySwitch.Case if={<here>}`.
129+
if:
130130
allOf|anyOf|oneOf:
131131
- isMyPluginAvailable
132132
- isKind: component
133133
- isType: service
134134
- hasAnnotation: annotationKey
135-
props: {} # <6>
135+
props: {} # Useful when you are passing additional data to the component
136136
----
137-
<1> Specify the plugin package name.
138-
<2> (Optional): Uses existing mount points
139-
<3> (Optional): Allows you to pass additional configuration to the component.
140-
<4> Used only in `/cards` type which renders visible content. You can pass MUI sx properties to the component, which is useful when controlling the layout of the component. `entity.page.*` mount points are rendered as CSS grid, hence with the SX property you can control the grid layout and exact positioning of the rendered component.
141-
<5> Used only in `/cards` type which renders visible content. `if` is passed to `<EntitySwitch.Case if={<here>}`.
142-
<6> Useful when you are passing additional data to the component.
143137

144138
The available conditions include:
145139

146140
* `allOf`: All conditions must be met
147141
* `anyOf`: At least one condition must be met
148142
* `oneOf`: Only one condition must be met
149143

150-
Conditions can be:
144+
Conditions are:
151145

152146
* `isKind`: Accepts a string or a list of string with entity kinds. For example `isKind: component` renders the component only for entity of `kind: Component`.
153147
* `isType`: Accepts a string or a list of string with entity types. For example `isType: service` renders the component only for entities of `spec.type: 'service'`.
154148
* `hasAnnotation`: Accepts a string or a list of string with annotation keys. For example `hasAnnotation: my-annotation` renders the component only for entities that have defined `metadata.annotations['my-annotation']`.
155149
* Condition imported from the plugin's `module`: Must be function name exported from the same `module` within the plugin. For example `isMyPluginAvailable` renders the component only if `isMyPluginAvailable` function returns `true`. The function must have the following signature: `(e: Entity) => boolean`
156150

157-
The entity page also supports adding more items to the context menu at the top right of the page. The exported component should be a form of dialog wrapper component that accepts an `open` boolean property and an `onClose` event handler property as shown in the following example:
151+
The entity page supports adding more items to the context menu at the top right of the page. The exported component is a form of dialog wrapper component that accepts an `open` boolean property and an `onClose` event handler property as shown in the following example:
158152

159153
[source,yaml]
160154
----

0 commit comments

Comments
 (0)