OCPBUGS-79542: populate default values in local ui from infraEnv#3502
Conversation
Signed-off-by: Elay Aharoni <elayaha@gmail.com>
|
@ElayAharoni: This pull request references AGENT-1463 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 bug to target the "4.22.0" version, but no target version was set. 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. |
📝 WalkthroughWalkthroughThe PR extends the cluster details workflow to fetch and propagate infrastructure environment data through the wizard and service layers, enabling the ClusterDetailsService to populate NTP source parameters from infrastructure environment or cluster data during cluster creation and update operations. Changes
Sequence DiagramsequenceDiagram
participant W as NewClusterWizard
participant D as ClusterDetailsForm
participant S as ClusterDetailsService
participant API as Backend
W->>W: Extract clusterId from route
W->>W: Fetch infraEnv via useInfraEnv(clusterId)
W->>D: Pass infraEnv to ClusterDetails step
D->>D: User submits form (create or update)
alt Create Path
D->>S: getClusterCreateParams(values, infraEnv)
S->>S: ntpSourceForCluster(undefined, infraEnv)
S-->>D: Return params with additionalNtpSource
else Update Path
D->>S: getClusterUpdateParams(values, platform, cluster, infraEnv)
S->>S: ntpSourceForCluster(cluster, infraEnv)
S-->>D: Return params with additionalNtpSource
end
D->>API: Send cluster update/create request
API-->>D: Cluster updated/created
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@ElayAharoni: This pull request references AGENT-1463 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 bug to target the "4.22.0" version, but no target version was set. 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. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
libs/ui-lib/lib/ocm/components/clusterWizard/NewClusterWizard.tsx (1)
35-36: Replace hard type assertion with optional typing and guard clause.The route definition includes both
path="~new"(without:clusterId) andpath=":clusterId"in Routes.tsx. When the component is mounted via the~newroute,useParams()will returnclusterIdasundefined, but the hard cast suppresses this at the type level. While the downstreamuseInfraEnvhook will detect the missingclusterIdinInfraEnvIdsCacheService.getInfraEnvId()and return an error, the unsafe cast creates unnecessary coupling to internal error handling.Change:
const { clusterId } = useParams() as { clusterId: string };to:
const { clusterId } = useParams() as { clusterId?: string }; // Add guard: if (!clusterId) return <ErrorUI />; or similarThis makes the constraint explicit and ensures the component only renders when
clusterIdis actually present.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@libs/ui-lib/lib/ocm/components/clusterWizard/NewClusterWizard.tsx` around lines 35 - 36, Replace the unsafe hard-cast of useParams so clusterId is optional and add an explicit guard before calling useInfraEnv: change the typing from useParams() as { clusterId: string } to useParams() as { clusterId?: string } and add a check like if (!clusterId) return an error/placeholder UI (e.g., <ErrorUI /> or null) at the top of NewClusterWizard so you only call useInfraEnv(clusterId, CpuArchitecture.USE_DAY1_ARCHITECTURE) when clusterId is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@libs/ui-lib/lib/ocm/components/clusterWizard/NewClusterWizard.tsx`:
- Around line 35-36: Replace the unsafe hard-cast of useParams so clusterId is
optional and add an explicit guard before calling useInfraEnv: change the typing
from useParams() as { clusterId: string } to useParams() as { clusterId?: string
} and add a check like if (!clusterId) return an error/placeholder UI (e.g.,
<ErrorUI /> or null) at the top of NewClusterWizard so you only call
useInfraEnv(clusterId, CpuArchitecture.USE_DAY1_ARCHITECTURE) when clusterId is
present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 219d11b4-7e68-4a21-9ad3-9d34a0cb34a6
📒 Files selected for processing (4)
libs/ui-lib/lib/ocm/components/clusterWizard/ClusterDetailsForm.tsxlibs/ui-lib/lib/ocm/components/clusterWizard/NewClusterWizard.tsxlibs/ui-lib/lib/ocm/services/ClusterDetailsService.tslibs/ui-lib/lib/ocm/services/types.ts
|
/retitle OCPBUGS-79542: populate default values in local ui from infraEnv |
|
@ElayAharoni: This pull request references Jira Issue OCPBUGS-79542, which is invalid:
Comment 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. |
|
/jira refresh |
|
@pawanpinjarkar: This pull request references Jira Issue OCPBUGS-79542, 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. |
|
@openshift-ci-robot: GitHub didn't allow me to request PR reviews from the following users: bmanzari. Note that only openshift-assisted members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
|
/cherrypick release-4.21 |
|
@ElayAharoni: 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. |
|
@ElayAharoni: This pull request references Jira Issue OCPBUGS-79542, 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. |
|
@openshift-ci-robot: GitHub didn't allow me to request PR reviews from the following users: bmanzari. Note that only openshift-assisted members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ElayAharoni, rawagner 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 |
6ca9368
into
openshift-assisted:master
|
@ElayAharoni: Jira Issue OCPBUGS-79542: Some pull requests linked via external trackers have merged: The following pull request, linked via external tracker, has not merged:
All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-79542 has not been moved to the MODIFIED state. 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. |
|
@ElayAharoni: #3502 failed to apply on top of branch "release-4.21": 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. |
|
@ElayAharoni: Jira Issue OCPBUGS-79542: Some pull requests linked via external trackers have merged: The following pull request, linked via external tracker, has not merged:
All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-79542 has not been moved to the MODIFIED state. 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. |
|
/jira refresh |
|
@ElayAharoni: Jira Issue OCPBUGS-79542: Some pull requests linked via external trackers have merged: The following pull request, linked via external tracker, has not merged:
All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-79542 has not been moved to the MODIFIED state. 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. |
|
Fix included in accepted release 4.22.0-0.nightly-2026-04-03-204456 |
https://redhat.atlassian.net/browse/OCPBUGS-79542
Summary by CodeRabbit
New Features
also changes the way we pass the infraEnv to the wizard in the local disconnected UI, so all other fields could be populated from the infraEnv.