Skip to content

CONSOLE-4988: add resizable column feature to Storage tables#16162

Open
vikram-raj wants to merge 8 commits intoopenshift:mainfrom
vikram-raj:console-4988-3
Open

CONSOLE-4988: add resizable column feature to Storage tables#16162
vikram-raj wants to merge 8 commits intoopenshift:mainfrom
vikram-raj:console-4988-3

Conversation

@vikram-raj
Copy link
Member

@vikram-raj vikram-raj commented Mar 17, 2026

Add a resizable column feature to PersistentVolumes, PersistentVolumeClaims, StorageClasses, VolumeAttributesClasses, VolumeSnapshots, VolumeSnapshotClasses, and VolumeSnapshotContents list pages.

Summary by CodeRabbit

  • New Features
    • Added resizable column support across multiple data tables (Volume Snapshots, Persistent Volumes, Storage Classes, Volume Attributes Classes, and Persistent Volume Claims).
    • Users can now adjust column widths dynamically and reset columns to default widths.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 17, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 17, 2026

@vikram-raj: This pull request references CONSOLE-4988 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 spike to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Add a resizable column feature to PersistentVolumes, PersistentVolumeClaims, StorageClasses, VolumeAttributesClasses, VolumeSnapshots, VolumeSnapshotClasses, and VolumeSnapshotContents list pages.

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 openshift-ci bot requested review from Leo6Leo and spadgett March 17, 2026 13:27
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 17, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vikram-raj

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 openshift-ci bot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 17, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 17, 2026

@vikram-raj: This pull request references CONSOLE-4988 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 spike to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Add a resizable column feature to PersistentVolumes, PersistentVolumeClaims, StorageClasses, VolumeAttributesClasses, VolumeSnapshots, VolumeSnapshotClasses, and VolumeSnapshotContents list pages.

Summary by CodeRabbit

  • New Features
  • Added resizable column support across multiple data tables (Volume Snapshots, Persistent Volumes, Storage Classes, Volume Attributes Classes, and Persistent Volume Claims).
  • Users can now adjust column widths dynamically and reset columns to default widths.

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This pull request introduces resizable column support across seven data table components in the OpenShift Console. Internal column definition hooks are refactored to return objects containing both a columns array and a resetAllColumnWidths function, replacing previous array-only returns. Each column gains resizableProps derived from useColumnWidthSettings, while cell styling transitions from sticky props to nameCellProps and actionsCellProps. The ConsoleDataView component is wired with isResizable and resetAllColumnWidths props to enable interactive column width management. Affected components include PersistentVolumeClaim, PersistentVolume, StorageClass, VolumeAttributesClass, and VolumeSnapshot-related tables.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot.tsx (1)

153-218: Consider extracting a shared helper for column config assembly.

This block repeats the same shape across many columns (id, resizableProps, nowrap props), which increases drift risk as more storage tables adopt the pattern. A small helper/factory would improve maintainability and reduce copy/paste regressions.

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot.tsx`
around lines 153 - 218, The columns array in the VolumeSnapshot component
duplicates common configuration (id from tableColumnInfo, resizableProps via
getResizableProps, and standard props like modifier/nowrap) across many entries;
extract a small factory/helper (e.g., buildColumn or createTableColumn) and use
it to produce each TableColumn to reduce duplication. The helper should accept
the unique fields (title, sort, index or tableColumnInfo index, optional props
override, and optional disabled flag like rowData.hideSnapshotContentColumn) and
internally set id = tableColumnInfo[index].id, resizableProps =
getResizableProps(tableColumnInfo[index].id), and merge common props with any
overrides; then replace the inline objects in the columns useMemo (referencing
columns, tableColumnInfo, getResizableProps, nameCellProps, actionsCellProps,
and rowData.hideSnapshotContentColumn) with calls to that helper.
frontend/public/components/storage-class.tsx (1)

133-154: Reduce index-coupling in column ID lookups.

Using tableColumnInfo[0/1/2].id across definitions is fragile; reordering columns can silently desync IDs and width settings. Prefer named column ID constants.

Suggested refactor
+const STORAGE_CLASS_COLUMN_IDS = {
+  name: 'name',
+  provisioner: 'provisioner',
+  reclaimPolicy: 'reclaimPolicy',
+  actions: 'actions',
+} as const;
+
 const tableColumnInfo = [
-  { id: 'name' },
-  { id: 'provisioner' },
-  { id: 'reclaimPolicy' },
-  { id: '' },
+  { id: STORAGE_CLASS_COLUMN_IDS.name },
+  { id: STORAGE_CLASS_COLUMN_IDS.provisioner },
+  { id: STORAGE_CLASS_COLUMN_IDS.reclaimPolicy },
+  { id: STORAGE_CLASS_COLUMN_IDS.actions },
 ];

As per coding guidelines, "**: Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/public/components/storage-class.tsx` around lines 133 - 154, The
column definitions currently index into tableColumnInfo by numeric positions
(tableColumnInfo[0], [1], [2]) which couples IDs to order; change to use named
constants for each column ID (e.g., NAME_COLUMN_ID, PROVISIONER_COLUMN_ID,
RECLAIM_POLICY_COLUMN_ID) and reference those constants in the columns array and
getResizableProps calls instead of numeric indexes; update any uses of
nameCellProps and getResizableProps within the columns definition to call
getResizableProps(NAME_COLUMN_ID) / getResizableProps(PROVISIONER_COLUMN_ID) /
getResizableProps(RECLAIM_POLICY_COLUMN_ID) and set id: NAME_COLUMN_ID etc., and
ensure the constants are exported/declared near the tableColumnInfo definition
so reordering columns won’t desynchronize IDs or widths.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot.tsx`:
- Around line 153-218: The columns array in the VolumeSnapshot component
duplicates common configuration (id from tableColumnInfo, resizableProps via
getResizableProps, and standard props like modifier/nowrap) across many entries;
extract a small factory/helper (e.g., buildColumn or createTableColumn) and use
it to produce each TableColumn to reduce duplication. The helper should accept
the unique fields (title, sort, index or tableColumnInfo index, optional props
override, and optional disabled flag like rowData.hideSnapshotContentColumn) and
internally set id = tableColumnInfo[index].id, resizableProps =
getResizableProps(tableColumnInfo[index].id), and merge common props with any
overrides; then replace the inline objects in the columns useMemo (referencing
columns, tableColumnInfo, getResizableProps, nameCellProps, actionsCellProps,
and rowData.hideSnapshotContentColumn) with calls to that helper.

In `@frontend/public/components/storage-class.tsx`:
- Around line 133-154: The column definitions currently index into
tableColumnInfo by numeric positions (tableColumnInfo[0], [1], [2]) which
couples IDs to order; change to use named constants for each column ID (e.g.,
NAME_COLUMN_ID, PROVISIONER_COLUMN_ID, RECLAIM_POLICY_COLUMN_ID) and reference
those constants in the columns array and getResizableProps calls instead of
numeric indexes; update any uses of nameCellProps and getResizableProps within
the columns definition to call getResizableProps(NAME_COLUMN_ID) /
getResizableProps(PROVISIONER_COLUMN_ID) /
getResizableProps(RECLAIM_POLICY_COLUMN_ID) and set id: NAME_COLUMN_ID etc., and
ensure the constants are exported/declared near the tableColumnInfo definition
so reordering columns won’t desynchronize IDs or widths.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 03bda77a-d252-4860-840c-c31781286997

📥 Commits

Reviewing files that changed from the base of the PR and between 458a8b6 and 3ff6133.

📒 Files selected for processing (7)
  • frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-class.tsx
  • frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-content.tsx
  • frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot.tsx
  • frontend/public/components/persistent-volume-claim.tsx
  • frontend/public/components/persistent-volume.tsx
  • frontend/public/components/storage-class.tsx
  • frontend/public/components/volume-attributes-class.tsx
📜 Review details
🧰 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.tsx
  • frontend/public/components/storage-class.tsx
  • frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-content.tsx
  • frontend/public/components/persistent-volume-claim.tsx
  • frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-class.tsx
  • frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot.tsx
  • frontend/public/components/volume-attributes-class.tsx
🧬 Code graph analysis (3)
frontend/public/components/persistent-volume-claim.tsx (2)
frontend/packages/console-app/src/components/data-view/useResizableColumnProps.ts (1)
  • useColumnWidthSettings (30-97)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-class.tsx (6)
frontend/public/components/factory/table.tsx (1)
  • TableColumn (663-670)
frontend/public/module/k8s/types.ts (1)
  • VolumeSnapshotClassKind (1126-1129)
frontend/packages/console-app/src/components/data-view/useResizableColumnProps.ts (1)
  • useColumnWidthSettings (30-97)
frontend/public/models/index.ts (1)
  • VolumeSnapshotClassModel (1262-1277)
frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-content.tsx (1)
  • tableColumnInfo (38-46)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/public/components/volume-attributes-class.tsx (4)
frontend/public/components/factory/table.tsx (1)
  • TableColumn (663-670)
frontend/public/module/k8s/types.ts (1)
  • VolumeAttributesClassKind (485-490)
frontend/packages/console-app/src/components/data-view/useResizableColumnProps.ts (1)
  • useColumnWidthSettings (30-97)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
🔇 Additional comments (17)
frontend/public/components/volume-attributes-class.tsx (4)

34-37: LGTM on the new imports.

The imports for nameCellProps and useColumnWidthSettings align correctly with the exports shown in ConsoleDataView.tsx and useResizableColumnProps.ts. Clean integration with the existing data-view infrastructure.


49-98: Well-structured hook refactoring.

The hook correctly:

  • Returns { columns, resetAllColumnWidths } object, enabling the consumer to wire up the reset functionality
  • Applies resizableProps only to data columns (Name, Driver name, Parameters) while correctly excluding the action column
  • Includes getResizableProps in the useMemo dependency array, ensuring columns recompute when widths change

The pattern is consistent with the other storage table components in this PR.


64-66: Correct separation of resize and sticky cell behaviors.

Using resizableProps for resize functionality while maintaining nameCellProps and actionsCellProps for sticky positioning is the right approach. This preserves the expected PatternFly table UX where name and action columns remain visible during horizontal scroll.

Also applies to: 91-91


149-149: Clean integration with ConsoleDataView.

The destructuring and prop passing are correct. The resetAllColumnWidths callback is properly memoized upstream in useColumnWidthSettings, so this won't cause unnecessary re-renders. The isResizable boolean enables the feature consistently with other storage table components in this PR.

Also applies to: 164-165

frontend/public/components/persistent-volume.tsx (2)

115-176: LGTM — Resizable columns wired correctly for PersistentVolume table.

The hook refactor to return { columns, resetAllColumnWidths } aligns with the cross-file pattern. resizableProps is correctly applied to data columns and intentionally omitted from the actions column. The useMemo dependency on getResizableProps ensures columns recompute when resize state changes.


258-278: LGTM — ConsoleDataView integration looks good.

isResizable and resetAllColumnWidths are correctly passed through, enabling the column width management feature.

frontend/public/components/persistent-volume-claim.tsx (2)

202-272: LGTM — PVC columns hook correctly refactored for resizable support.

Consistent pattern with PersistentVolume and other storage tables: returns { columns, resetAllColumnWidths }, applies resizableProps to data columns, excludes the actions column, and updates useMemo dependencies appropriately.


526-606: LGTM — PersistentVolumeClaimList integration complete.

The destructured hook return and ConsoleDataView props (isResizable, resetAllColumnWidths) follow the established pattern. No issues with the existing filter logic or metrics handling.

frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-content.tsx (2)

106-169: Strong column-resize hook integration.

The new { columns, resetAllColumnWidths } return shape and per-column resizableProps wiring are clean and consistent for this table.


176-190: ConsoleDataView resize wiring looks correct.

Passing both isResizable and resetAllColumnWidths here completes the feature contract for interactive resize/reset behavior.

frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot.tsx (2)

147-223: Good end-to-end adoption of resizable column state.

The hook return change plus per-column resizableProps integration is consistent and preserves existing conditional column behavior.


287-302: Table-level resize enablement is wired correctly.

isResizable and resetAllColumnWidths are passed through correctly to ConsoleDataView.

frontend/public/components/storage-class.tsx (2)

17-21: Good API migration for DataView resizing primitives.

Switching to nameCellProps and useColumnWidthSettings is consistent with the resizable-column contract and keeps the table config cohesive.


170-185: Resizable behavior is correctly plumbed into ConsoleDataView.

isResizable and resetAllColumnWidths are wired cleanly from the hook output to the view component.

frontend/packages/console-app/src/components/volume-snapshot/volume-snapshot-class.tsx (3)

86-93: Good hook contract upgrade for resizable state management.

Returning { columns, resetAllColumnWidths } from useVolumeSnapshotClassColumns cleanly keeps table wiring and reset behavior together, and matches the new DataView flow.

Also applies to: 127-127


101-115: Resizable props are wired consistently across data columns.

Using getResizableProps per column while keeping nameCellProps / actionsCellProps for sticky behavior is a solid integration pattern here.

Also applies to: 121-124


148-150: Reset column widths is properly accessible regardless of hideColumnManagement.

The reset button (line 203 in ConsoleDataView.tsx) is gated only by isResizable && resetAllColumnWidths, not by hideColumnManagement. Users can reset column widths even when column management UI is hidden—this is correct UX design. No action needed.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 17, 2026

@vikram-raj: 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/e2e-gcp-console 3ff6133 link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Details

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.

@vikram-raj
Copy link
Member Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants