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
feat: migrating widgets to patternfly/widgetized-dashboard (#273)
* feat: migrating widgets to patternfly/widgetized-dashboard
* adding tests and updating functionality
* adding currentDropInItemAtom back as removing it broke the drop on functionality
Copy file name to clipboardExpand all lines: docs/components/custom-widgets.md
+40-21Lines changed: 40 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Overview
4
4
5
-
Custom widgets are React components that integrate with the Widget Layout system through federated modules. They are loaded dynamically via ScalprumComponent and displayed within GridTile containers that provide drag-and-drop functionality.
5
+
Custom widgets are React components that integrate with the Widget Layout system through federated modules. They are loaded dynamically via ScalprumComponent and displayed within widget cards provided by `@patternfly/widgetized-dashboard`, which handles drag-and-drop functionality.
6
6
7
7
## Widget System Architecture
8
8
@@ -12,7 +12,7 @@ Widgets are loaded through a multi-step process:
12
12
13
13
1.**Widget Mapping**: The backend provides widget configuration via `/api/chrome-service/v1/dashboard-templates/widget-mapping`
14
14
2.**Module Federation**: Widgets are loaded as federated modules using ScalprumComponent (configured via `fec.config.js`)
15
-
3.**Grid Integration**: Each widget is wrapped in a GridTile that provides layout and interaction capabilities
15
+
3.**Grid Integration**: The PatternFly GridLayout component renders each widget within a Card component that provides layout and interaction capabilities
16
16
17
17
*Note: Module federation is handled by the Red Hat Cloud Services frontend tooling. You don't need to configure webpack directly.*
18
18
@@ -77,7 +77,7 @@ export type WidgetPermission = {
77
77
78
78
### Step 1: Create the Widget Component
79
79
80
-
Your widget is a standard React component that provides content for the CardBody wrapper. **Note**: The Card wrapper (including header, title, and actions) is automatically provided by the GridTile component - your widget should only provide the content.
80
+
Your widget is a standard React component that provides content for the CardBody wrapper. **Note**: The Card wrapper (including header, title, and actions) is automatically provided by the PatternFly GridLayout component - your widget should only provide the content.
81
81
82
82
```tsx
83
83
// MyCustomWidget.tsx
@@ -163,9 +163,9 @@ The widget mapping must be provided by the backend API at `/api/chrome-service/v
163
163
164
164
## Widget Integration Details
165
165
166
-
### GridTile Integration
166
+
### PatternFly GridLayout Integration
167
167
168
-
Your widget is automatically wrapped in a GridTile component that provides:
168
+
Your widget is automatically wrapped in a widget card by the `@patternfly/widgetized-dashboard` GridLayout component that provides:
169
169
170
170
-**Drag and Drop**: Move widgets around the grid
171
171
-**Resize Handles**: Resize widgets within min/max constraints
@@ -174,26 +174,45 @@ Your widget is automatically wrapped in a GridTile component that provides:
174
174
175
175
### Widget Container Structure
176
176
177
-
Your custom widget content is automatically wrapped in a Card structure by the GridTile component:
177
+
Your custom widget content is automatically wrapped in a Card structure by the PatternFly GridLayout component. The component internally manages widget cards with:
178
+
179
+
-**Card Header**: Contains the widget title, icon, and action menu
180
+
-**Card Body**: Your custom widget component renders here
181
+
182
+
Widget rendering is handled through the widget mapping configuration:
178
183
179
184
```tsx
180
-
// From src/Components/DnDLayout/GridTile.tsx - Simplified structure
**Important**: Your widget should **NOT** include Card, CardHeader, or CardTitle components as these are provided by the GridTile wrapper.
215
+
**Important**: Your widget should **NOT** include Card, CardHeader, or CardTitle components as these are provided by the PatternFly GridLayout component wrapper.
0 commit comments