console icon indicating copy to clipboard operation
console copied to clipboard

[WIP] OCPBUGS-68332: Improve VAC field on PVC details page

Open cajieh opened this issue 4 weeks ago • 4 comments

No VAC

Screenshot 2025-12-17 at 11 40 56 AM

VAC modification pending

Screenshot 2025-12-17 at 11 41 15 AM

VAC modification error

1.

Screenshot 2025-12-17 at 11 43 03 AM Screenshot 2025-12-17 at 11 43 14 AM

2.

Screenshot 2025-12-17 at 11 46 22 AM Screenshot 2025-12-17 at 11 46 37 AM Screenshot 2025-12-17 at 11 46 46 AM Screenshot 2025-12-17 at 11 46 59 AM Screenshot 2025-12-17 at 11 47 06 AM

VAC modification succeed

Screenshot 2025-12-17 at 11 32 10 AM Screenshot 2025-12-17 at 11 32 23 AM

Modification progress alert: This info alert will disappear if the modification is success

Screenshot 2025-12-17 at 11 32 29 AM

Successfully modification

Screenshot 2025-12-17 at 11 54 48 AM Screenshot 2025-12-17 at 11 32 36 AM

cajieh avatar Dec 15 '25 19:12 cajieh

@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

Screenshot 2025-12-15 at 2 05 58 PM

VAC modification pending

Screenshot 2025-12-15 at 2 06 26 PM

VAC modification error

Screenshot 2025-12-15 at 2 06 57 PM

VAC modification succeed

Screenshot 2025-12-15 at 2 04 08 PM Screenshot 2025-12-15 at 2 05 00 PM Screenshot 2025-12-15 at 2 05 19 PM Screenshot 2025-12-15 at 2 05 42 PM

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 avatar Dec 15 '25 19:12 openshift-ci-robot

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 ResourceLink targets 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 ModifyVolumeError condition 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 volumeAttributesClassName is undefined but currentVolumeAttributesClassName exists? 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.

coderabbitai[bot] avatar Dec 15 '25 19:12 coderabbitai[bot]

lgtm flow wise.

gnufied avatar Dec 18 '25 23:12 gnufied

[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

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

openshift-ci[bot] avatar Dec 19 '25 13:12 openshift-ci[bot]

/jira refresh

cajieh avatar Dec 19 '25 15:12 cajieh

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

openshift-ci-robot avatar Dec 19 '25 15:12 openshift-ci-robot

/test images

cajieh avatar Dec 19 '25 18:12 cajieh

/verified later @yapei

cajieh avatar Dec 19 '25 18:12 cajieh

/retest

cajieh avatar Dec 19 '25 18:12 cajieh

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

openshift-ci-robot avatar Dec 19 '25 18:12 openshift-ci-robot

/retest-required

Remaining retests: 0 against base HEAD df5acf5f3f90b6ff34fef67cbb49ae7ee9bd7eae and 2 for PR HEAD eacb9a5200cbcd12f7027ceb6073b43b4a18ca3b in total

openshift-ci-robot avatar Dec 19 '25 23:12 openshift-ci-robot

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

openshift-ci[bot] avatar Dec 20 '25 04:12 openshift-ci[bot]