-
Notifications
You must be signed in to change notification settings - Fork 667
OCPBUGS-72557: Address logonoff review comments on AI documentation #15903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,57 +5,76 @@ | |
| The `console-dynamic-plugin-sdk` is a key part of this repository - it's the public API that enables OpenShift Console's extensibility. | ||
|
|
||
| ## Key Packages & Areas | ||
|
|
||
| **Core Packages:** | ||
| - **console-dynamic-plugin-sdk**: Public API for external plugins (⚠️ breaking changes require careful vetting) | ||
| - **dev-console**: Developer perspective, topology, add flows | ||
| - **pipelines-plugin**: Tekton pipelines integration | ||
| - **knative-plugin**: Serverless/Knative support | ||
| - **helm-plugin**: Helm chart management | ||
| - **topology**: Application topology views | ||
| - **console-app**: Main application that loads all plugins | ||
| - **console-shared**: Shared utilities and components | ||
| - **console-internal**: Core UI and Kubernetes integration | ||
|
|
||
| **Dynamic Plugins:** | ||
| For the complete list of console plugins, see `console-app/package.json` dependencies. Static plugins (built-in) may be deprecated or extracted over time. | ||
|
|
||
| - **Extension Points System**: 25+ extension types (NavItem, Page, ResourceListPage, DashboardsCard, etc.) | ||
| - **Module Federation**: Runtime plugin loading via Webpack Module Federation | ||
| - **Type Safety**: Comprehensive TypeScript definitions for all extension points | ||
| - **Code References**: Lazy loading with `$codeRef` for performance | ||
|
|
||
| ### Key Extension Types (reference) | ||
| ### Extension Types | ||
|
|
||
| OpenShift Console provides 75+ extension types for plugin integration. **For comprehensive documentation, see [frontend/packages/console-dynamic-plugin-sdk/README.md](frontend/packages/console-dynamic-plugin-sdk/README.md).** | ||
|
|
||
| Additional resources: | ||
| - [Extension type reference](frontend/packages/console-dynamic-plugin-sdk/docs/console-extensions.md) - Full type definitions, naming convention (`console.*`), and deprecation notices | ||
| - [API documentation](frontend/packages/console-dynamic-plugin-sdk/docs/api.md) - React components, hooks, and utilities | ||
|
|
||
| | Category | Types | Purpose | | ||
| |----------------|------------------------------------------------------------|----------------------------------| | ||
| | Navigation | NavItem, HrefNavItem, Separator | Sidebar / top nav | | ||
| | Pages | Page, RoutePage, StandaloneRoutePage | Full or nested pages | | ||
| | Resources | ModelDefinition, ResourceListPage, ResourceDetailsPage | CRUD views | | ||
| | Actions | ActionGroup, ResourceActionProvider | Kebab / row menus | | ||
| | Dashboards | DashboardsCard, DashboardsTab | Overview health cards | | ||
| | Catalog | CatalogItemType, CatalogItemProvider | Operator / Helm catalog | | ||
| | Perspectives | Perspective, PerspectiveContext | Top-level views | | ||
| Common categories include navigation, pages, resources, actions, dashboards, catalog, and perspectives. | ||
|
|
||
|
|
||
| ### Plugin Structure | ||
| ```typescript | ||
| // GOOD – Dynamic extensions (runtime-loaded) | ||
| export const plugin: Plugin = [ | ||
|
|
||
| Dynamic plugins define their extensions in a `console-extensions.json` file (JSONC format) located in the plugin package root. Extension types use the naming convention `console.foo/bar`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to point claude to read you may want to reference #15398 for AGENTS.md as well
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #15398 was closed as stale. Added a comment for Sam asking if it will be picked up and merged at some point.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we still point AI to read our existing docs to reduce duplication in our docs? |
||
|
|
||
| **Example `console-extensions.json`:** | ||
| ```json | ||
| [ | ||
| { | ||
| type: 'Page', | ||
| properties: { | ||
| exact: true, | ||
| path: '/my-plugin-page', | ||
| component: { $codeRef: 'MyPluginPage' }, // Lazy-load reference | ||
| }, | ||
| "type": "console.page/route", | ||
| "properties": { | ||
| "exact": true, | ||
| "path": "/my-plugin-page", | ||
| "component": { "$codeRef": "MyPluginPage" } | ||
| } | ||
| }, | ||
| { | ||
| type: 'NavItem', | ||
| properties: { | ||
| section: 'home', | ||
| componentProps: { name: 'My Plugin', href: '/my-plugin-page' }, | ||
| }, | ||
| "type": "console.navigation/href", | ||
| "properties": { | ||
| "id": "my-plugin-nav", | ||
| "name": "My Plugin", | ||
| "href": "/my-plugin-page", | ||
| "section": "home" | ||
| } | ||
| }, | ||
| ]; | ||
|
|
||
| // BAD – Static (avoid—breaks extensibility) | ||
| export const staticPlugin = { extensions: [...] }; | ||
| { | ||
| "type": "console.perspective", | ||
| "properties": { | ||
| "id": "my-perspective", | ||
| "name": "%my-plugin~My Perspective%", | ||
| "icon": { "$codeRef": "perspective.icon" }, | ||
| "landingPageURL": { "$codeRef": "perspective.getLandingPageURL" } | ||
| } | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| **Key Concepts:** | ||
| - **File Location**: `console-extensions.json` in package root (e.g., `frontend/packages/my-plugin/console-extensions.json`) | ||
| - **Type Naming**: `console.*` convention (e.g., `console.page/route`, `console.navigation/href`, `console.dashboards/card`) | ||
| - **Code References**: Use `$codeRef` to lazily load components and functions for performance | ||
| - **i18n**: Use `%namespace~key%` format for translatable strings (e.g., `"%my-plugin~My Label%"`) | ||
|
|
||
| **Real-world examples:** See `console-extensions.json` files in `frontend/packages/dev-console/`, `frontend/packages/helm-plugin/`, etc. | ||
|
|
||
| ### Critical Considerations | ||
| - **⚠️ BREAKING CHANGES REQUIRE EXTREME CARE**: This is a public API consumed by external plugins | ||
| - **Backward Compatibility**: Must maintain compatibility across versions | ||
|
|
@@ -64,37 +83,26 @@ export const staticPlugin = { extensions: [...] }; | |
| - **Type Safety**: Strong TypeScript support prevents runtime errors | ||
|
|
||
| ### ⚠️ Public API Sources - Breaking Change Risk | ||
| The dynamic plugin SDK re-exports APIs from multiple Console packages. **Changing these source modules could inadvertently break the public API**: | ||
|
|
||
| #### APIs Re-exported from `@console/shared` | ||
| - **Dashboard Components**: `ActivityItem`, `ActivityBody`, `RecentEventsBody`, `OngoingActivityBody`, `AlertsBody`, `AlertItem`, `HealthItem`, `HealthBody`, `ResourceInventoryItem`, `UtilizationItem`, `UtilizationBody`, `UtilizationDurationDropdown`, `VirtualizedGrid`, `LazyActionMenu` | ||
| - **UI Components**: `Overview`, `OverviewGrid`, `InventoryItem`, `InventoryItemTitle`, `InventoryItemBody`, `InventoryItemStatus`, `InventoryItemLoading`, `StatusPopupSection`, `StatusPopupItem`, `DocumentTitle`, `Timestamp`, `ActionServiceProvider`, `ErrorBoundaryFallbackPage`, `QueryBrowser` | ||
| - **Hooks**: `useUtilizationDuration`, `useDashboardResources`, `useUserSettings`, `useAnnotationsModal`, `useDeleteModal`, `useLabelsModal`, `useActiveNamespace`, `useQuickStartContext` | ||
| - **Other**: `PaneBody` (via `ListPageBody`) | ||
|
|
||
| #### APIs Re-exported from `@console/internal` | ||
| - **Core UI**: `HorizontalNav`, `VirtualizedTable`, `TableData`, `ListPageHeader`, `ListPageCreate`, `ListPageCreateLink`, `ListPageCreateButton`, `ListPageCreateDropdown`, `ListPageFilter`, `ResourceLink`, `ResourceIcon`, `ResourceEventStream`, `NamespaceBar` | ||
| - **Editors**: `YAMLEditor`, `CodeEditor`, `ResourceYAMLEditor` | ||
| - **Hooks**: `useActiveColumns`, `useListPageFilter`, `usePrometheusPoll`, `useURLPoll` | ||
| - **K8s Utilities**: Redux store access, HTTP utilities | ||
|
|
||
| #### APIs Re-exported from `@console/plugin-sdk` | ||
| - **Extension System**: `useExtensions` (via `useResolvedExtensions`) | ||
| - **Plugin Infrastructure**: Plugin loading, subscription services, store management | ||
| The dynamic plugin SDK re-exports APIs from multiple Console packages: | ||
| - **`@console/shared`** - Dashboard components, UI components, hooks | ||
| - **`@console/internal`** - Core UI, editors, hooks, K8s utilities | ||
| - **`@console/plugin-sdk`** - Extension system, plugin infrastructure | ||
| - **`@console/app`** - Application context | ||
|
Comment on lines
+87
to
+91
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we also export from topology plugin, maybe it's safer to just ask it to check every time..? but may be an unneeded use of tokens |
||
| - **`@console/topology`** - Topology components, data transforms, graph views | ||
|
|
||
| #### APIs Re-exported from `@console/app` | ||
| - **Application Context**: `QuickStartsLoader`, `useLastNamespace` | ||
|
|
||
| **Before modifying any of these source packages, verify impact on the dynamic plugin SDK public API.** | ||
| **BEFORE MODIFYING ANYTHING IN THESE OR OTHER PACKAGES:** Verify SDK re-exports by checking `frontend/packages/console-dynamic-plugin-sdk/src/api/internal-*.ts` files to avoid breaking the public API. | ||
|
|
||
| ### SDK Utilities | ||
| - **Resource Hooks**: `useK8sWatchResource`, `useActivePerspective`, `useActiveNamespace` | ||
| - **Component Utilities**: Navigation helpers, telemetry, validation | ||
| - **Build Integration**: `ConsoleRemotePlugin` for Webpack Module Federation | ||
|
|
||
| ### Development Guidelines | ||
|
|
||
| **SDK-Specific:** | ||
| - Always consider impact on external plugin developers | ||
| - Extensive testing required for any API changes | ||
| - Clear deprecation paths with version-based removal | ||
| - Maintain backward compatibility as it's a public API | ||
| - Comprehensive documentation for all public APIs | ||
| - Performance monitoring for plugin loading | ||
|
|
||
| **For detailed plugin API review guidelines and workflow, see [.claude/commands/plugin-api-review.md](.claude/commands/plugin-api-review.md)** | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.