console icon indicating copy to clipboard operation
console copied to clipboard

CONSOLE-4863: Create extension point for plugins to display dynamic alerts in catalogs

Open TheRealJon opened this issue 2 months ago • 3 comments

Summary

This PR introduces a new dynamic plugin extension point (console.catalog/alert) that allows plugins to contribute alert banner components to catalog pages. Plugins can target specific catalogs and catalog item types, and alerts are automatically sorted by priority with higher priority alerts appearing first.

Key Changes

Extension Definition:

  • New console.catalog/alert extension type in the dynamic plugin SDK
  • Properties:
    • catalogId (required) - The catalog to display the alert in
    • type (optional) - Target a specific catalog item type
    • component (required) - React component to render
    • priority (optional) - Sort order (higher priority first, defaults to 0)

Implementation:

  • Added extension type and type guard in catalog.ts
  • Updated useCatalogExtensions hook to resolve and filter alert extensions by catalogId and type
  • Modified CatalogController to render alert components at the top of the catalog (inside StatusBox, before CatalogView)
  • Added automatic sorting by priority
  • Updated CatalogServiceProvider to pass alert extensions through the catalog service
  • Comprehensive test coverage for extension filtering and priority sorting

Use Case: This enables plugins to provide contextual information, warnings, or status updates directly in catalog interfaces without modifying core catalog code. For example, the operator-lifecycle-manager-v1 plugin can show alerts about OLMv1 feature status, version switching options, or important notices to users.

Documentation

SDK documentation has been updated in console-extensions.md with the new extension type definition and property descriptions.

Test Plan

  • [ ] Verify the extension type is properly exported and type guards work
  • [ ] Run unit tests for useCatalogExtensions hook: cd frontend && yarn test useCatalogExtensions.spec.ts
  • [ ] Build the frontend to ensure no TypeScript errors: cd frontend && yarn build:console
  • [ ] Manual testing with a plugin that uses this extension (will be done in follow-up OLMv1 PRs)
  • [ ] Verify alerts render in the correct location (above catalog content)
  • [ ] Verify priority sorting works correctly (higher priority alerts appear first)

🤖 Generated with Claude Code

TheRealJon avatar Nov 07 '25 20:11 TheRealJon

@TheRealJon: This pull request references CONSOLE-4863 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.21.0" version, but no target version was set.

In response to this:

Summary

This PR introduces a new dynamic plugin extension point (console.catalog/alert) that allows plugins to contribute alert banner components to catalog pages. Plugins can target specific catalogs and catalog item types, and alerts are automatically sorted by priority with higher priority alerts appearing first.

Key Changes

Extension Definition:

  • New console.catalog/alert extension type in the dynamic plugin SDK
  • Properties:
  • catalogId (required) - The catalog to display the alert in
  • type (optional) - Target a specific catalog item type
  • component (required) - React component to render
  • priority (optional) - Sort order (higher priority first, defaults to 0)

Implementation:

  • Added extension type and type guard in catalog.ts
  • Updated useCatalogExtensions hook to resolve and filter alert extensions by catalogId and type
  • Modified CatalogController to render alert components at the top of the catalog (inside StatusBox, before CatalogView)
  • Added automatic sorting by priority
  • Updated CatalogServiceProvider to pass alert extensions through the catalog service
  • Comprehensive test coverage for extension filtering and priority sorting

Use Case: This enables plugins to provide contextual information, warnings, or status updates directly in catalog interfaces without modifying core catalog code. For example, the operator-lifecycle-manager-v1 plugin can show alerts about OLMv1 feature status, version switching options, or important notices to users.

Documentation

SDK documentation has been updated in console-extensions.md with the new extension type definition and property descriptions.

Test Plan

  • [ ] Verify the extension type is properly exported and type guards work
  • [ ] Run unit tests for useCatalogExtensions hook: cd frontend && yarn test useCatalogExtensions.spec.ts
  • [ ] Build the frontend to ensure no TypeScript errors: cd frontend && yarn build:console
  • [ ] Manual testing with a plugin that uses this extension (will be done in follow-up OLMv1 PRs)
  • [ ] Verify alerts render in the correct location (above catalog content)
  • [ ] Verify priority sorting works correctly (higher priority alerts appear first)

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

openshift-ci-robot avatar Nov 07 '25 20:11 openshift-ci-robot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TheRealJon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Nov 07 '25 20:11 openshift-ci[bot]

@TheRealJon: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console 1668eb88cb69834adccd4182289c49cc7dbcc07a link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

openshift-ci[bot] avatar Nov 08 '25 01:11 openshift-ci[bot]