Skip to content

OCPBUGS-78584: Preserve query params in CatalogRedirect#16165

Open
rhamilto wants to merge 1 commit intomainfrom
OCPBUGS-78584
Open

OCPBUGS-78584: Preserve query params in CatalogRedirect#16165
rhamilto wants to merge 1 commit intomainfrom
OCPBUGS-78584

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Mar 17, 2026

Summary

Fixes https://redhat.atlassian.net/browse/OCPBUGS-78584

Updates the CatalogRedirect component to preserve existing query parameters when redirecting from /operatorhub or /catalog routes to /catalog/all-namespaces. This ensures that search filters, keywords, and other URL parameters are maintained when users navigate to the operator catalog.

Changes:

  • Updated CatalogRedirect to use useLocation hook to access current query parameters
  • Merge existing query params with catalogType=operator parameter
  • Expanded route configuration to handle both /operatorhub and /catalog paths

Example behavior:

  • Before: /operatorhub?keyword=mongodb/catalog?catalogType=operator (loses keyword)
  • After: /operatorhub?keyword=mongodb/catalog/all-namespaces?catalogType=operator&keyword=mongodb (preserves keyword)

After

Note OpenShift AI is not available on the cluster I tested with, but will be available in the release.

Screen.Recording.2026-03-17.at.12.39.19.PM.mov

Test plan

  • All existing OLM tests pass (21 test suites, 269 tests)
  • Manual testing: Navigate to /operatorhub?keyword=test and verify query params are preserved
  • Manual testing: Navigate to /catalog?keyword=test and verify catalogType=operator is added

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Operator catalog now supports multiple URL paths for improved accessibility and navigation options.
  • Bug Fixes

    • Fixed catalog redirect to properly preserve existing query parameters and filters when navigating.

Update CatalogRedirect to preserve existing query parameters when
redirecting from /operatorhub or /catalog routes. This ensures that
search filters, keywords, and other URL params are maintained when
users navigate to the operator catalog.

Changes:
- Use useLocation to access current query parameters
- Merge existing params with catalogType=operator
- Expand route to handle both /operatorhub and /catalog paths

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Mar 17, 2026
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-78584, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

Fixes https://redhat.atlassian.net/browse/OCPBUGS-78584

Updates the CatalogRedirect component to preserve existing query parameters when redirecting from /operatorhub or /catalog routes to /catalog/all-namespaces. This ensures that search filters, keywords, and other URL parameters are maintained when users navigate to the operator catalog.

Changes:

  • Updated CatalogRedirect to use useLocation hook to access current query parameters
  • Merge existing query params with catalogType=operator parameter
  • Expanded route configuration to handle both /operatorhub and /catalog paths

Example behavior:

  • Before: /operatorhub?keyword=mongodb/catalog?catalogType=operator (loses keyword)
  • After: /operatorhub?keyword=mongodb/catalog/all-namespaces?catalogType=operator&keyword=mongodb (preserves keyword)

Test plan

  • All existing OLM tests pass (21 test suites, 269 tests)
  • Manual testing: Navigate to /operatorhub?keyword=test and verify query params are preserved
  • Manual testing: Navigate to /catalog?keyword=test and verify catalogType=operator is added

🤖 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 openshift-ci bot requested review from sg00dwin and spadgett March 17, 2026 16:41
@openshift-ci openshift-ci bot added component/olm Related to OLM approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 17, 2026
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This pull request references Jira Issue OCPBUGS-78584, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

Fixes https://redhat.atlassian.net/browse/OCPBUGS-78584

Updates the CatalogRedirect component to preserve existing query parameters when redirecting from /operatorhub or /catalog routes to /catalog/all-namespaces. This ensures that search filters, keywords, and other URL parameters are maintained when users navigate to the operator catalog.

Changes:

  • Updated CatalogRedirect to use useLocation hook to access current query parameters
  • Merge existing query params with catalogType=operator parameter
  • Expanded route configuration to handle both /operatorhub and /catalog paths

Example behavior:

  • Before: /operatorhub?keyword=mongodb/catalog?catalogType=operator (loses keyword)
  • After: /operatorhub?keyword=mongodb/catalog/all-namespaces?catalogType=operator&keyword=mongodb (preserves keyword)

After

Note OpenShift AI is not available on the cluster I tested with, but will be in the release.

Screen.Recording.2026-03-17.at.12.39.19.PM.mov

Test plan

  • All existing OLM tests pass (21 test suites, 269 tests)
  • Manual testing: Navigate to /operatorhub?keyword=test and verify query params are preserved
  • Manual testing: Navigate to /catalog?keyword=test and verify catalogType=operator is added

🤖 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.

@rhamilto
Copy link
Member Author

/assign @TheRealJon
/assign @yanpzhan

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: fadf8911-fd71-4db0-91a4-17748d5d28e6

📥 Commits

Reviewing files that changed from the base of the PR and between 458a8b6 and 6aa7501.

📒 Files selected for processing (2)
  • frontend/packages/operator-lifecycle-manager/console-extensions.json
  • frontend/packages/operator-lifecycle-manager/src/components/catalog-redirect.tsx
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/packages/operator-lifecycle-manager/src/components/catalog-redirect.tsx
  • frontend/packages/operator-lifecycle-manager/console-extensions.json
🧬 Code graph analysis (1)
frontend/packages/operator-lifecycle-manager/src/components/catalog-redirect.tsx (2)
frontend/packages/console-shared/src/hooks/useLocation.ts (1)
  • useLocation (3-3)
frontend/public/components/utils/tile-view-page.jsx (1)
  • searchParams (466-466)
🔇 Additional comments (3)
frontend/packages/operator-lifecycle-manager/console-extensions.json (1)

367-375: LGTM - Route configuration follows established patterns.

The array syntax for multiple paths is consistent with other route definitions in this file (e.g., lines 121-124, 131-134). The exact: true flag appropriately ensures only exact path matches trigger the redirect, avoiding unintended route conflicts.

frontend/packages/operator-lifecycle-manager/src/components/catalog-redirect.tsx (2)

4-10: Clean implementation preserving query params as intended.

The logic correctly:

  1. Reads current query params via location.search
  2. Ensures catalogType=operator is set (overriding any existing value)
  3. Uses replace to prevent back-button navigation loops

One minor consideration: if a user manually navigates to /catalog?catalogType=helm, the redirect will silently override to operator. This appears intentional per the PR objective, but worth confirming this is the desired UX for these legacy routes.


2-2: The useLocation import from react-router is intentional and correct.

The codebase has a separate useLocation hook in console-shared that returns Redux UI state (a string), while this component needs React Router's hook to access the browser's location.search for query parameter manipulation. Other OLM components (operator-hub-subscribe, operand) consistently follow the same pattern.


📝 Walkthrough

Walkthrough

This PR updates the OperatorHub routing configuration to support multiple entry points and refines the redirect logic. The console-extensions manifest now registers the OperatorHub page against both /operatorhub and /catalog routes, consolidating access points. Concurrently, the CatalogRedirect component is enhanced to preserve query parameters from the source location while ensuring the catalogType is explicitly set to 'operator' before redirecting to the consolidated catalog view at /catalog/all-namespaces. This change maintains backward compatibility while establishing a unified routing path.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch OCPBUGS-78584
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 17, 2026

@rhamilto: all tests passed!

Full PR test history. Your PR dashboard.

Details

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.

Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 18, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto, TheRealJon

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

The pull request process is described here

Details 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/olm Related to OLM jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants