[WIP] OCPBUGS-68332: Improve VAC field on PVC details page
No VAC
VAC modification pending
VAC modification error
1.
2.
VAC modification succeed
Modification progress alert: This info alert will disappear if the modification is success
Successfully modification
@cajieh: This pull request references Jira Issue OCPBUGS-68332, which is invalid:
- expected the bug to target the "4.22.0" version, but no target version was set
Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.
The bug has been updated to refer to the pull request using the external bug tracker.
In response to this:
VAC not applied
![]()
VAC modification pending
![]()
VAC modification error
![]()
VAC modification succeed
![]()
![]()
![]()
![]()
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.
Walkthrough
Adds VolumeAttributesClass (VAC) handling to PVC details: derives VAC error/pending state, shows dismissible danger/info alerts, resets dismissals when the PVC changes, and renders separate "Requested VolumeAttributesClass" and "VolumeAttributesClass" fields. Also adds English localization keys for VAC messages.
Changes
| Cohort / File(s) | Summary |
|---|---|
VAC alert state and UI logic frontend/public/components/persistent-volume-claim.tsx |
Added getVACAlertState() to derive vacErrorCondition and isVacPending from PVC spec/status; injected dismissible danger and info Alerts into PVC details with truncated messages and close buttons; added local dismissal state (isErrorAlertDismissed, isInfoAlertDismissed) and a useEffect to reset them on PVC change; rendered "Requested VolumeAttributesClass" and "VolumeAttributesClass" rows (conditional ResourceLink); updated imports to include Alert, AlertActionCloseButton, and truncateMiddle. |
VAC localization strings frontend/public/locales/en/public.json |
Added translation keys for VAC lifecycle and UI: modification failed title and detail, modification pending title and in-progress message, pending application and modifying-from-to templates, and the "Requested VolumeAttributesClass" label. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- Review
getVACAlertState()for correct condition detection and attribute-name comparison. - Verify alert content, truncation behavior, and dismissal persistence/reset on PVC change.
- Confirm conditional rendering and correct
ResourceLinktargets for requested vs current VAC. - Validate new i18n keys and interpolation placeholders (
{{target}},{{current}}).
✨ 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: Organization 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 922d71e2c8b504c1e8533a00b9bba456181ce534 and eacb9a5200cbcd12f7027ceb6073b43b4a18ca3b.
📒 Files selected for processing (2)
frontend/public/components/persistent-volume-claim.tsx(6 hunks)frontend/public/locales/en/public.json(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/public/locales/en/public.json
🧰 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/public/components/persistent-volume-claim.tsx
🧬 Code graph analysis (1)
frontend/public/components/persistent-volume-claim.tsx (3)
frontend/public/module/k8s/types.ts (1)
PersistentVolumeClaimKind(1131-1159)frontend/public/module/k8s/k8s.ts (1)
referenceFor(50-65)frontend/public/models/index.ts (1)
VolumeAttributesClassModel(810-824)
🔇 Additional comments (3)
frontend/public/components/persistent-volume-claim.tsx (3)
82-104: LGTM! VAC state detection logic is correct.The helper function correctly identifies VAC modification errors and pending states. The logic properly checks for the
ModifyVolumeErrorcondition and determines pending state when the requested VAC differs from the current VAC.Minor question: Should the pending detection (line 100) also handle the removal case where
volumeAttributesClassNameis undefined butcurrentVolumeAttributesClassNameexists? If VAC removal is supported, consider adjusting the logic to:const isVacPending = !vacErrorCondition && (volumeAttributesClassName || currentVolumeAttributesClassName) && volumeAttributesClassName !== currentVolumeAttributesClassName;This would detect pending state for both modification and removal operations.
279-287: LGTM! Alert dismissal state management is correct.The implementation properly tracks dismissed alerts using local state and resets dismissals when the PVC changes (detected via UID). This ensures alerts reappear when navigating to a different PVC, which is the expected behavior.
328-374: LGTM! VAC alert implementation is well-structured.The alert rendering logic appropriately handles both error and pending states:
- Error alert displays the condition message (truncated to 200 chars) with fallback text
- Info alert shows context-appropriate messages for initial application vs. modification
- Both alerts are dismissible and properly scoped to VAC-supported environments
The truncation strategy prevents overly long error messages from disrupting the UI layout.
Comment @coderabbitai help to get the list of available commands and usage tips.
lgtm flow wise.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: cajieh, jhadvig
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~frontend/OWNERS~~ [cajieh,jhadvig]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/jira refresh
@cajieh: This pull request references Jira Issue OCPBUGS-68332, 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)
Requesting review from QA contact: /cc @yapei
In response to this:
/jira refresh
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.
/test images
/verified later @yapei
/retest
@cajieh: This PR has been marked to be verified later by @yapei.
In response to this:
/verified later @yapei
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.
/retest-required
Remaining retests: 0 against base HEAD df5acf5f3f90b6ff34fef67cbb49ae7ee9bd7eae and 2 for PR HEAD eacb9a5200cbcd12f7027ceb6073b43b4a18ca3b in total
@cajieh: 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/okd-scos-images | eacb9a5200cbcd12f7027ceb6073b43b4a18ca3b | link | true | /test okd-scos-images |
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.