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
+107-3Lines changed: 107 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,7 +168,6 @@ plugins:
168
168
Up to 3 levels of nested menu items are supported.
169
169
170
170
- <menu_item_name> - A unique name in the main sidebar navigation. This can represent either a standalone menu item or a parent menu item. If it represents a plugin menu item, the name must match the corresponding path in `dynamicRoutes`. For example, if `dynamicRoutes` defines `path: /my-plugin`, the `menu_item_name` must be `my-plugin`.
171
-
172
171
- Handling Complex Paths:
173
172
- For simple paths like `path: /my-plugin`, the `menu_item_name` should be `my-plugin`.
174
173
- For more complex paths, such as multi-segment paths like `path: /metrics/users/info`, the `menu_item_name` should represent the full path in dot notation (e.g., `metrics.users.info`).
@@ -334,13 +333,11 @@ Each mount point supports additional configuration:
334
333
- `if`- Used only in `*/cards` type which renders visible content. This is passed to `<EntitySwitch.Case if={<here>}`.
335
334
336
335
The following conditions are available:
337
-
338
336
- `allOf`: All conditions must be met
339
337
- `anyOf`: At least one condition must be met
340
338
- `oneOf`: Only one condition must be met
341
339
342
340
Conditions can be:
343
-
344
341
- `isKind`: Accepts a string or a list of string with entity kinds. For example `isKind: component` will render the component only for entity of `kind: Component`.
345
342
- `isType`: Accepts a string or a list of string with entity types. For example `isType: service` will render the component only for entities of `spec.type: 'service'`.
346
343
- `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.
@@ -439,6 +436,113 @@ dynamicPlugins:
439
436
440
437
Users can configure multiple application providers by adding entries to the `mountPoints` field.
441
438
439
+
### Adding application drawers
440
+
441
+
The application drawer system allows plugins to create persistent side drawers that can be opened and closed independently. Multiple drawer plugins can coexist, with the system automatically managing which drawer is displayed based on priority and open state.
442
+
443
+
#### Architecture Overview
444
+
445
+
The drawer system uses three key mount points:
446
+
447
+
1. **`application/provider`**: Wraps the application with the plugin's context provider that manages drawer state
448
+
2. **`application/drawer-state`**: Exposes the drawer state (open/closed, width) to RHDH without creating dependencies
449
+
3. **`application/drawer-content`**: Provides the actual content to render inside the drawer
450
+
451
+
#### Configuration Example
452
+
453
+
Below is a complete example showing how to configure a drawer plugin:
454
+
455
+
```yaml
456
+
# app-config.yaml
457
+
dynamicPlugins:
458
+
frontend:
459
+
<package_name>: # plugin package name
460
+
mountPoints:
461
+
# 1. Provider: Manages the drawer's internal state
462
+
- mountPoint: application/provider
463
+
importName: MyDrawerProvider
464
+
465
+
# 2. State Exposer: Shares drawer state with RHDH
466
+
- mountPoint: application/drawer-state
467
+
importName: MyDrawerStateExposer
468
+
469
+
# 3. Content: Defines what renders inside the drawer
470
+
- mountPoint: application/drawer-content
471
+
importName: MyDrawerContent
472
+
config:
473
+
id: my-drawer # Unique identifier matching the context id
474
+
priority: 100 # Higher priority renders first (optional, default: 0)
The provider component wraps the application and manages the drawer's full internal state (open/closed, width, toggle methods, etc.). This is a standard React context provider.
483
+
484
+
##### `application/drawer-state`
485
+
486
+
The state exposer component reads from the plugin's context and exposes only the minimal state needed by RHDH to render the drawer. This uses a callback pattern to avoid shared dependencies between plugins and RHDH.
487
+
488
+
**Key Points:**
489
+
490
+
- Component receives `onStateChange` callback from RHDH
491
+
- Only exposes 4 properties: `id`, `isDrawerOpen`, `drawerWidth`, `setDrawerWidth`
492
+
- Does not expose other methods like `toggleDrawer`, `openDrawer`, etc.
493
+
- Returns `null` (doesn't render anything, only acts a bridge)
494
+
495
+
##### `application/drawer-content`
496
+
497
+
The content component defines what renders inside the drawer.
498
+
499
+
**Configuration:**
500
+
501
+
- `id` (required): Unique identifier that must match the `id` in the provider's context
502
+
- `priority` (optional): Number determining render order when multiple drawers are open (higher = rendered first)
503
+
- `resizable` (optional): Boolean enabling a resize handle on the drawer
504
+
505
+
#### Priority System
506
+
507
+
When multiple drawers are open simultaneously, RHDH renders only the highest priority drawer:
508
+
509
+
```yaml
510
+
# Lightspeed drawer (priority: 100) takes precedence when both are open
Enable user-resizable drawers with the `resizable` configuration:
531
+
532
+
```yaml
533
+
- mountPoint: application/drawer-content
534
+
importName: MyDrawerContent
535
+
config:
536
+
id: my-drawer
537
+
resizable: true # Adds a drag handle on the left edge
538
+
```
539
+
540
+
When `resizable: true`, users can:
541
+
542
+
- Drag the left edge of the drawer to resize
543
+
- Changes are managed by the plugin's `setDrawerWidth` function
544
+
- Typically constrained to min/max width limits defined by the plugin
545
+
442
546
## Customizing and Adding Entity tabs
443
547
444
548
Out of the box the frontend system provides an opinionated set of tabs for catalog entity views. This set of tabs can be further customized and extended as needed via the `entityTabs` configuration:
0 commit comments