CONSOLE-4837: Always point to canonical model reference
The plural routes have been deprecated for a while, so let's instead redirect users to the referenceForModel routes
@logonoff: This pull request references CONSOLE-4837 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 story to target the "4.21.0" version, but no target version was set.
In 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.
/label px-approved /label docs-approved
@logonoff: This pull request references CONSOLE-4837 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 story to target the "4.21.0" version, but no target version was set.
In response to this:
The plural routes have been deprecated for a while, so let's instead redirect users to the referenceForModel routes
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.
/hold
need to fix e2e
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: logonoff, vojtechszocs
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~frontend/OWNERS~~ [logonoff,vojtechszocs]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
New changes are detected. LGTM label has been removed.
Walkthrough
Resource path construction is refactored across the frontend to use model references with API group/version format (e.g., core~v1~Pod) instead of pluralized resource names (e.g., pods). This affects redirect logic, navigation paths, test URLs, and URL construction utilities.
Changes
| Cohort / File(s) | Summary |
|---|---|
Model reference integration frontend/packages/container-security/src/components/summary.tsx, frontend/public/components/app-contents.tsx |
Added ProjectModel import and updated URL construction to use referenceForModel(ProjectModel) in vulnerability paths and redirects, replacing hardcoded projects path segments. |
Cypress test navigation updates frontend/packages/integration-tests-cypress/support/project.ts, frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts, frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts, frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts |
Updated test navigation paths to use OpenShift Project model reference format (project.openshift.io~v1~Project) instead of generic projects path. |
Cypress dashboard inventory updates frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts, frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts |
Converted inventory card item links from pluralized paths to API group/version format (e.g., Node: /k8s/cluster/nodes โ /k8s/cluster/core~v1~Node; Deployment: /k8s/ns/${testName}/deployments โ /k8s/ns/${testName}/apps~v1~Deployment). |
Resource path construction logic frontend/public/components/utils/resource-link.tsx |
Simplified resourcePathFromModel to always append referenceForModel(model) instead of conditionally using plural or CRD properties, eliminating branching logic. |
Test expectations alignment frontend/public/components/utils/__tests__/resource-link.spec.ts, frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx |
Updated test assertions to expect API group/version resource format in paths (e.g., Pod: core~v1~Pod; ClusterRole: rbac.authorization.k8s.io~v1~ClusterRole). |
Estimated code review effort
๐ฏ 3 (Moderate) | โฑ๏ธ ~20 minutes
frontend/public/components/utils/resource-link.tsx: Verify the simplified logic inresourcePathFromModelcorrectly handles all edge cases (namespaced vs. cluster-scoped, CRD resources) despite removing conditional branches.- Path consistency: Confirm all test assertions and redirect paths use the correct API group/version format across multiple test files and packages.
- Model reference coverage: Ensure all redirects in
app-contents.tsxand security components properly import and apply the ProjectModel reference.
โจ Finishing touches
- [ ] ๐ Generate docstrings
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
๐ Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
๐ฅ Commits
Reviewing files that changed from the base of the PR and between 2243c0611dd1c08b078c8d04cf6cf08fb6a927a0 and 9fada58a5e18f437f0423726b41ffb92f696b1ca.
๐ Files selected for processing (10)
frontend/packages/container-security/src/components/summary.tsx(2 hunks)frontend/packages/integration-tests-cypress/support/project.ts(2 hunks)frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts(1 hunks)frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts(1 hunks)frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts(1 hunks)frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts(3 hunks)frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx(1 hunks)frontend/public/components/app-contents.tsx(2 hunks)frontend/public/components/utils/__tests__/resource-link.spec.ts(1 hunks)frontend/public/components/utils/resource-link.tsx(2 hunks)
๐งฐ 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/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.tsfrontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsxfrontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.tsfrontend/public/components/utils/resource-link.tsxfrontend/packages/integration-tests-cypress/tests/app/overview.cy.tsfrontend/packages/integration-tests-cypress/support/project.tsfrontend/packages/container-security/src/components/summary.tsxfrontend/public/components/utils/__tests__/resource-link.spec.tsfrontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.tsfrontend/public/components/app-contents.tsx
๐งฌ Code graph analysis (4)
frontend/packages/container-security/src/components/summary.tsx (1)
frontend/public/models/index.ts (1)
ProjectModel(432-445)
frontend/public/components/utils/__tests__/resource-link.spec.ts (1)
frontend/public/models/index.ts (1)
ClusterRoleModel(539-552)
frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts (1)
frontend/packages/integration-tests-cypress/support/index.ts (1)
testName(92-95)
frontend/public/components/app-contents.tsx (1)
frontend/public/models/index.ts (1)
ProjectModel(432-445)
๐ Additional comments (11)
frontend/packages/topology/src/components/export-app/__tests__/ExportViewLogButton.spec.tsx (1)
46-54: Export log href expectation updated to canonical Pod referenceThe new expectation (
/k8s/ns/test/core~v1~Pod/test/logs) matches the reference-based routing scheme and keeps the test aligned with the underlying URL construction.frontend/packages/integration-tests-cypress/support/project.ts (1)
20-42: Project Cypress helpers now target ProjectModel canonical pathsVisiting
/k8s/cluster/project.openshift.io~v1~Projectand the corresponding detail URL keeps these commands consistent with the reference-based routing and the generic/k8s/cluster/:pluralroutes.frontend/packages/container-security/src/components/summary.tsx (1)
9-81: Vulnerability URLs aligned with ProjectModel referenceUsing
referenceForModel(ProjectModel)inbaseVulnListUrlbrings project-scoped vulnerability navigation in line with the new canonical cluster project path while preserving existing namespaced vuln details behavior.frontend/public/components/utils/resource-link.tsx (1)
20-42: resourcePathFromModel simplified to use model referenceDropping plural/CRD branching and always using
referenceForModel(model)produces consistent/k8s/(cluster|ns|all-namespaces)/<ref>[ /name ]URLs and matches the updated routing/tests.frontend/public/components/app-contents.tsx (1)
34-35: Status/Overview project redirects normalized to ProjectModel referenceRedirect targets now use
/k8s/cluster/${referenceForModel(ProjectModel)}/${ns}[ /workloads ], which is consistent with the canonical project resource routing and other refactors in this PR.Also applies to: 133-143
frontend/public/components/utils/__tests__/resource-link.spec.ts (1)
24-37: Tests updated to assert reference-based resource pathsThe revised expectations for ClusterRole and Pod now correctly mirror the unified
resourcePathFromModelbehavior (cluster vs. namespaced vs. all-namespaces) using the<group>~<version>~<Kind>reference.frontend/packages/integration-tests-cypress/tests/crud/secrets/key-value.cy.ts (1)
41-47: Secret CRUD tests now select project via canonical ProjectModel URLEnsuring the project context by visiting
/k8s/cluster/project.openshift.io~v1~Project/${testName}aligns this setup step with the new project routing while keeping the existing Workloads > Secrets flow intact.frontend/packages/integration-tests-cypress/tests/app/overview.cy.ts (1)
57-71: Overview tests updated to use canonical project workloads URLNavigating to
/k8s/cluster/project.openshift.io~v1~Project/${testName}/workloads?view=listin both tests matches the new project workloads route and keeps the overview assertions valid.frontend/packages/integration-tests-cypress/tests/dashboards/cluster-dashboard.cy.ts (1)
96-105: LGTM! Consistent migration to canonical model references.All inventory item links have been correctly updated to use the new
{group}~{version}~{Kind}format, with appropriate scope paths (cluster vs all-namespaces).frontend/packages/integration-tests-cypress/tests/dashboards/project-dashboard.cy.ts (2)
39-42: URL assertion updated consistently with navigation changes.The details page URL correctly uses the new canonical model reference format.
12-12: Navigation path verified and correct.The Project resource navigation uses the canonical
project.openshift.io~v1~Projectformat, which is generated byreferenceForModel(ProjectModel)and aligns with the codebase convention. Line 12 and the details URL assertion (lines 39-42) are consistent with this format.
Comment @coderabbitai help to get the list of available commands and usage tips.
@logonoff: The following tests 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 | 9fada58a5e18f437f0423726b41ffb92f696b1ca | link | true | /test e2e-gcp-console |
| ci/prow/frontend | 9fada58a5e18f437f0423726b41ffb92f696b1ca | link | true | /test frontend |
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.