You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/dynamic-plugins/frontend-plugin-wiring.md
+23-19
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,7 @@ plugins:
94
94
menuItem: # optional, allows you to populate main sidebar navigation
95
95
icon: fooIcon # Backstage system icon
96
96
text: Foo Plugin Page # menu item text
97
+
enabled: false # optional, allows you to remove the menu item when set to false
97
98
config:
98
99
props: ... # optional, React props to pass to the component
99
100
```
@@ -106,10 +107,11 @@ Each plugin can expose multiple routes and each route is required to define its
106
107
- `menuItem` - This property allows users to extend the main sidebar navigation and point to their new route. It accepts the following properties:
107
108
- `text`: The label shown to the user
108
109
- `icon`: refers to a Backstage system icon name. See [Backstage system icons](https://backstage.io/docs/getting-started/app-custom-theme/#icons) for the list of default icons and [Extending Icons Library](#extend-internal-library-of-available-icons) to extend this with dynamic plugins.
110
+
- `enabled`: Optional. This property allows user to remove a menuItem from sidebar when it is set to `false`.
109
111
- `importName`: optional name of an exported `SidebarItem` component. The component will receive a `to` property as well as any properties specified in `config.props`
110
112
- `config`- An optional field which is a holder to pass `props` to a custom sidebar item
111
113
112
-
A custom `SidebarItem` offers opportunities to provide a richer user experience such as notification badges. The component should accept the following properties:
114
+
A custom `SidebarItem` offers opportunities to provide a richer user experience such as notification badges. The component should accept the following properties:
113
115
114
116
```typescript
115
117
export type MySidebarItemProps = {
@@ -159,6 +161,7 @@ plugins:
159
161
title: Foo Plugin Page # optional, same as `menuItem.text` in `dynamicRoutes`
160
162
priority: 10# optional, defines the order of menu items in the sidebar
161
163
parent: favorites # optional, defines parent-child relationships for nested menu items
164
+
enabled: false # optional, allows you to remove the menu item when set to false
162
165
```
163
166
164
167
Up to 3 levels of nested menu items are supported.
@@ -176,6 +179,7 @@ Up to 3 levels of nested menu items are supported.
176
179
- `title`- Optional. Specifies the display title of the menu item. This can also be omitted if it has already been defined in the `dynamicRoutes` configuration under `menuItem.text`.
177
180
- `priority`- Optional. Defines the order in which menu items appear. The default priority is `0`, which places the item at the bottom of the list. A higher priority value will position the item higher in the sidebar.
178
181
- `parent`- Optional. Defines the parent menu item to nest the current item under. If specified, the parent menu item must be defined somewhere else in the `menuItems` configuration of any enabled plugin.
182
+
- `enabled`- Optional. This property allows user to remove a menuItem from sidebar when it is set to `false`.
179
183
180
184
```yaml
181
185
# dynamic-plugins-config.yaml
@@ -234,9 +238,9 @@ plugins:
234
238
importName: barPlugin # Required. Explicit import name that reference a BackstagePlugin<{}> implementation.
235
239
module: CustomModule # Optional, same as key in `scalprum.exposedModules` key in plugin's `package.json`
236
240
bindings:
237
-
- bindTarget: 'barPlugin.externalRoutes'# Required. One of the supported or imported bind targets
241
+
- bindTarget: "barPlugin.externalRoutes"# Required. One of the supported or imported bind targets
238
242
bindMap: # Required. Map of bindings, same as the `bind` function options argument in the example above
239
-
headerLink: 'fooPlugin.routes.root'
243
+
headerLink: "fooPlugin.routes.root"
240
244
```
241
245
242
246
This configuration allows you to bind to existing plugins and their routes as well as declare new targets sourced from dynamic plugins:
@@ -341,7 +345,7 @@ Each mount point supports additional configuration:
341
345
- `hasAnnotation`: Accepts a string or a list of string with annotation keys. For example `hasAnnotation: my-annotation` will render the component only for entities that have `metadata.annotations['my-annotation']` defined.
342
346
- Condition imported from the plugin's `module`: Must be function name exported from the same `module` within the plugin. For example `isMyPluginAvailable` will render the component only if `isMyPluginAvailable` function returns `true`. The function must have the following signature: `(e: Entity) => boolean`
343
347
344
-
The entity page also supports adding more items to the context menu at the top right of the page. Components targeting the `entity.context.menu` mount point have some constraints to follow. The exported component should be some form of dialog wrapper component that accepts an `open` boolean property and an `onClose` event handler property, like so:
348
+
The entity page also supports adding more items to the context menu at the top right of the page. Components targeting the `entity.context.menu` mount point have some constraints to follow. The exported component should be some form of dialog wrapper component that accepts an `open` boolean property and an `onClose` event handler property, like so:
345
349
346
350
```typescript
347
351
export type SimpleDialogProps = {
@@ -350,9 +354,9 @@ export type SimpleDialogProps = {
350
354
};
351
355
```
352
356
353
-
The context menu entry can be configured via the `props` configuration entry for the mount point. The `title` and `icon` properties will set the menu item's text and icon. Any system icon or icon added via a dynamic plugin can be used. Here is an example configuration:
357
+
The context menu entry can be configured via the `props` configuration entry for the mount point. The `title` and `icon` properties will set the menu item's text and icon. Any system icon or icon added via a dynamic plugin can be used. Here is an example configuration:
354
358
355
-
```yaml
359
+
```yaml
356
360
# dynamic-plugins-config.yaml
357
361
plugins:
358
362
- plugin: <plugin_path_or_url>
@@ -371,7 +375,7 @@ plugins:
371
375
props:
372
376
title: Open Simple Dialog
373
377
icon: dialogIcon
374
-
```
378
+
```
375
379
376
380
### Adding application header
377
381
@@ -407,7 +411,7 @@ The users can add application listeners using the `application/listener` mount p
407
411
# app-config.yaml
408
412
dynamicPlugins:
409
413
frontend:
410
-
<package_name>: # plugin_package_name same as `scalprum.name` key in plugin's `package.json`
414
+
<package_name>: # plugin_package_name same as `scalprum.name` key in plugin's `package.json`
411
415
mountPoints:
412
416
- mountPoint: application/listener
413
417
importName: <exported listener component>
@@ -423,7 +427,7 @@ The users can add application providers using the `application/provider` mount p
423
427
# app-config.yaml
424
428
dynamicPlugins:
425
429
frontend:
426
-
<package_name>: # plugin_package_name same as `scalprum.name` key in plugin's `package.json`
430
+
<package_name>: # plugin_package_name same as `scalprum.name` key in plugin's `package.json`
427
431
dynamicRoutes:
428
432
- path: /<route>
429
433
importName: Component # Component you want to load on the route
Each entity tab entry requires the following attributes:
@@ -507,9 +511,9 @@ Backstage offers a Utility API mechanism that provide ways for plugins to commun
507
511
- Custom plugin-made API that can be already self-contained within any plugin (including dynamic plugins)
508
512
- [App API implementations and overrides](https://backstage.io/docs/api/utility-apis/#app-apis) which needs to be added separately.
509
513
510
-
and a plugin can potentially expose multiple API Factories. Dynamic plugins allow a couple different ways to take advantage of this functionality.
514
+
and a plugin can potentially expose multiple API Factories. Dynamic plugins allow a couple different ways to take advantage of this functionality.
511
515
512
-
If a dynamic plugin exports the plugin object returned by `createPlugin`, it will be supplied to the `createApp` API and all API factories exported by the plugin will be automatically registered and available in the frontend application. Dynamic plugins that follow this pattern should not use the `apiFactories` configuration. Also, if a dynamic plugin only contains API factories and follows this pattern, it will just be necessary to add an entry to the `dynamicPlugins.frontend` config for the dynamic plugin package name, for example:
516
+
If a dynamic plugin exports the plugin object returned by `createPlugin`, it will be supplied to the `createApp` API and all API factories exported by the plugin will be automatically registered and available in the frontend application. Dynamic plugins that follow this pattern should not use the `apiFactories` configuration. Also, if a dynamic plugin only contains API factories and follows this pattern, it will just be necessary to add an entry to the `dynamicPlugins.frontend` config for the dynamic plugin package name, for example:
@@ -563,7 +567,7 @@ which would override the default `ScmAuth` API factory that Developer Hub defaul
563
567
564
568
## Adding custom authentication provider settings
565
569
566
-
Out of the box the Backstage user settings page supports all of the documented authentication providers, such as "github" or "microsoft". However it is possible to install new authentication providers from a dynamic plugin that either adds additional configuration support for an existing provider or adds a new authentication provider altogether. In either case, these providers are normally listed in the user settings section of the app under the "Authentication Providers" tab. To add entries for an authentication provider from a dynamic plugin, use the `providerSettings` configuration:
570
+
Out of the box the Backstage user settings page supports all of the documented authentication providers, such as "github" or "microsoft". However it is possible to install new authentication providers from a dynamic plugin that either adds additional configuration support for an existing provider or adds a new authentication provider altogether. In either case, these providers are normally listed in the user settings section of the app under the "Authentication Providers" tab. To add entries for an authentication provider from a dynamic plugin, use the `providerSettings` configuration:
567
571
568
572
```yaml
569
573
dynamicPlugins:
@@ -579,11 +583,11 @@ Each provider settings entry should define the following attributes:
579
583
580
584
- `title`: The title for the authentication provider shown above the user's profile image if available.
581
585
- `description`: a short description of the authentication provider.
582
-
- `provider`: 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.
586
+
- `provider`: 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.
583
587
584
588
## Use a custom SignInPage component
585
589
586
-
In a Backstage app the SignInPage component is used to connect one or more authentication providers to the application sign-in process. Out of the box in Developer Hub a static SignInPage is already set up and supports all of the built-in authentication providers already. To use a different authentication provider, for example from a dynamic plugin use the `signInPage` configuration:
590
+
In a Backstage app the SignInPage component is used to connect one or more authentication providers to the application sign-in process. Out of the box in Developer Hub a static SignInPage is already set up and supports all of the built-in authentication providers already. To use a different authentication provider, for example from a dynamic plugin use the `signInPage` configuration:
587
591
588
592
```yaml
589
593
dynamicPlugins:
@@ -605,7 +609,7 @@ The Backstage scaffolder component supports specifying [custom form fields](http
0 commit comments