OCPBUGS-76787: Fix 404 error when viewing CRs with 'All Projects' selected#16154
OCPBUGS-76787: Fix 404 error when viewing CRs with 'All Projects' selected#16154rhamilto wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
@rhamilto: This pull request references Jira Issue OCPBUGS-76787, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhamilto The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@rhamilto: This pull request references Jira Issue OCPBUGS-76787, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**⚙️ CodeRabbit configuration file
Files:
🧬 Code graph analysis (1)frontend/public/components/resource-list.tsx (2)
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThe change updates ResourceListPage and ResourceDetailsPage components to resolve namespace selection with improved fallback logic. The components now import ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
|
/jira refresh |
|
@rhamilto: This pull request references Jira Issue OCPBUGS-76787, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
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. |
|
/cherry-pick release-4.21 |
|
@rhamilto: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
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. |
cde3d05 to
76276ce
Compare
…ected
When navigating to resource lists with "All Projects" selected (e.g.,
/k8s/all-namespaces/certificates), the page was showing a 404 error.
The issue was that ResourceListPage and ResourceDetailsPage components
were not handling the namespace correctly for routes without an explicit
:ns parameter. For routes like /k8s/all-namespaces/:plural, there is no
:ns param in the URL, so these components need to get the namespace from
the active namespace selector.
The fix uses useActiveNamespace() hook as a fallback when the namespace
isn't in the URL params. The components now:
- Use namespace from URL params if present (e.g., /k8s/ns/default/:plural)
- Fall back to active namespace from the selector for all-namespaces routes
- Convert ALL_NAMESPACES_KEY ('#ALL_NS#') to undefined so that underlying
components fetch resources from all namespaces
This matches the pattern used in SearchPage and ensures resource lists
display correctly in all scenarios.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
/retest |
4 similar comments
|
/retest |
|
/retest |
|
/retest |
|
/retest |
|
@rhamilto: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |

Summary
Fixes a bug where navigating to custom resource lists with "All Projects" selected results in a 404 error.
Bug: OCPBUGS-76787
Affected version: 4.21.0
Regression: Yes (worked in 4.20.z)
Problem
When viewing custom resources like Certificates or StorageClusters with the project filter set to "All Projects", users encounter a 404 error. The issue occurs both:
/k8s/all-namespaces/:pluralURLsRoot Cause
The
ResourceListPageandResourceDetailsPagewrapper components were only using the namespace from URL params. For routes like/k8s/all-namespaces/:plural, there is no:nsparameter in the URL, so the namespace was undefined and not being resolved from the namespace selector.Solution
Created a reusable
useNamespaceFromURLhook that encapsulates the logic for determining the correct namespace. The hook:/k8s/ns/:ns/:plural) → uses the URL param/k8s/all-namespaces/:plural) → uses the active namespace from the selector'#ALL_NS#', converts it toundefinedso underlying components fetch from all namespacesThis matches the pattern used by SearchPage and provides a reusable solution for other components that need similar functionality.
Changes
useNamespaceFromURL.ts- Custom hook for namespace resolution with proper ALL_NAMESPACES_KEY handlingResourceListPagewrapper to useuseNamespaceFromURL()hookResourceDetailsPagewrapper to useuseNamespaceFromURL()hookTest plan
/k8s/all-namespaces/certificateswith "All Projects" selected - should display certificates instead of 404/k8s/all-namespaces/certificateswith a specific namespace selected - should display certificates from that namespace/k8s/ns/default/certificates- should continue to work as before (showing only default namespace)🤖 Generated with Claude Code