Skip to content

CONSOLE-4988: add resizable column feature to tables under workloads option#16152

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

CONSOLE-4988: add resizable column feature to tables under workloads option#16152
vikram-raj wants to merge 8 commits intoopenshift:mainfrom
vikram-raj:console-4988-2

Conversation

@vikram-raj
Copy link
Member

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

Add a resizable column feature to Secrets, ConfigMaps, CronJobs, Jobs, ReplicaSets, PodDisruptionBudgets, HPA, and ReplicationControllers list pages.

Summary by CodeRabbit

  • New Features
    • Enhanced data tables with resizable columns. Users can now adjust column widths dynamically, with preferences automatically saved. Column widths can be reset to defaults.

@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 16, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 16, 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 Secrets, ConfigMaps, CronJobs, Jobs, ReplicaSets, PodDisruptionBudgets, HPA, and ReplicationControllers 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 TheRealJon and rhamilto March 16, 2026 17:33
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Mar 16, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 16, 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 16, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 16, 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 Secrets, ConfigMaps, CronJobs, Jobs, ReplicaSets, PodDisruptionBudgets, HPA, and ReplicationControllers list pages.

Summary by CodeRabbit

  • New Features
  • Enhanced data tables with resizable columns. Users can now adjust column widths dynamically, with preferences automatically saved. Column widths can be reset to defaults.

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 16, 2026

📝 Walkthrough

Walkthrough

This pull request introduces resizable column width functionality across multiple data table components in the OpenShift Console frontend. The changes standardize column management by integrating a useColumnWidthSettings hook that provides column resizing utilities. Each affected table component's column definition hook now returns an object containing both columns and a resetAllColumnWidths function instead of a plain array. Column definitions are updated to include resizableProps, and cell props are refactored to use nameCellProps and actionsCellProps. Consumer components pass isResizable and resetAllColumnWidths to the ConsoleDataView component. This pattern is applied consistently across PodDisruptionBudget, ConfigMap, CronJob, HorizontalPodAutoscaler, Job, ReplicaSet, ReplicationController, and Secret list views.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 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 generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/public/components/configmap.tsx (1)

82-139: Extract the resize-column wiring into a shared helper.

This exact useColumnWidthSettings(model) + getResizableProps(id) + { columns, resetAllColumnWidths } pattern now exists in job.tsx, hpa.tsx, cron-job.tsx, secret.tsx, replicaset.jsx, and replication-controller.jsx too. Centralizing it in the data-view layer would reduce drift the next time the resize contract changes.

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/configmap.tsx` around lines 82 - 139, The repeated
pattern in useConfigMapsColumns (useColumnWidthSettings(ConfigMapModel) +
getResizableProps(id) + returning { columns, resetAllColumnWidths }) should be
extracted into a shared helper in the data-view layer; implement a hook (e.g.,
useResizableColumns or buildResizableColumns) that accepts the Model and a plain
column descriptor array (titles, ids, sorts, props) and returns the final
columns with resizableProps injected and resetAllColumnWidths, then replace
useConfigMapsColumns, job.tsx, hpa.tsx, cron-job.tsx, secret.tsx, replicaset.jsx
and replication-controller.jsx to call the new helper instead of duplicating
getResizableProps and resetAllColumnWidths usage (refer to useConfigMapsColumns,
useColumnWidthSettings, getResizableProps, resetAllColumnWidths, and the local
columns variable to locate where to apply the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/public/components/job.tsx`:
- Around line 242-248: The column width state is shared because both
useJobsColumns and CronJobJobsComponent call useColumnWidthSettings(JobModel)
which uses referenceForModel(JobModel) as the storage key; change the key to be
surface-specific by extending the call to useColumnWidthSettings with a context
identifier (e.g., 'jobs-page' vs 'cronjob-tab') or modify useColumnWidthSettings
to accept an optional namespace param and include that in the derived storage
key, updating useJobsColumns and CronJobJobsComponent to pass distinct
identifiers so each surface persists widths independently.

---

Nitpick comments:
In `@frontend/public/components/configmap.tsx`:
- Around line 82-139: The repeated pattern in useConfigMapsColumns
(useColumnWidthSettings(ConfigMapModel) + getResizableProps(id) + returning {
columns, resetAllColumnWidths }) should be extracted into a shared helper in the
data-view layer; implement a hook (e.g., useResizableColumns or
buildResizableColumns) that accepts the Model and a plain column descriptor
array (titles, ids, sorts, props) and returns the final columns with
resizableProps injected and resetAllColumnWidths, then replace
useConfigMapsColumns, job.tsx, hpa.tsx, cron-job.tsx, secret.tsx, replicaset.jsx
and replication-controller.jsx to call the new helper instead of duplicating
getResizableProps and resetAllColumnWidths usage (refer to useConfigMapsColumns,
useColumnWidthSettings, getResizableProps, resetAllColumnWidths, and the local
columns variable to locate where to apply the change).

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: eb272e75-3f62-40a1-8af0-4363f2c66cd8

📥 Commits

Reviewing files that changed from the base of the PR and between 092f737 and d3cb9c5.

📒 Files selected for processing (8)
  • frontend/packages/console-app/src/components/pdb/PDBList.tsx
  • frontend/public/components/configmap.tsx
  • frontend/public/components/cron-job.tsx
  • frontend/public/components/hpa.tsx
  • frontend/public/components/job.tsx
  • frontend/public/components/replicaset.jsx
  • frontend/public/components/replication-controller.jsx
  • frontend/public/components/secret.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/hpa.tsx
  • frontend/public/components/configmap.tsx
  • frontend/packages/console-app/src/components/pdb/PDBList.tsx
  • frontend/public/components/secret.tsx
  • frontend/public/components/job.tsx
  • frontend/public/components/replication-controller.jsx
  • frontend/public/components/cron-job.tsx
  • frontend/public/components/replicaset.jsx
🧬 Code graph analysis (6)
frontend/public/components/hpa.tsx (1)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/packages/console-app/src/components/pdb/PDBList.tsx (3)
frontend/public/components/factory/table.tsx (1)
  • TableColumn (663-670)
frontend/public/components/replicaset.jsx (4)
  • useTranslation (56-56)
  • useTranslation (203-203)
  • useColumnWidthSettings (204-204)
  • props (296-296)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/public/components/secret.tsx (4)
frontend/public/components/factory/table.tsx (1)
  • TableColumn (663-670)
frontend/public/module/k8s/types.ts (1)
  • SecretKind (1035-1039)
frontend/public/models/index.ts (1)
  • SecretModel (509-522)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/public/components/job.tsx (4)
frontend/public/components/factory/table.tsx (1)
  • TableColumn (663-670)
frontend/public/module/k8s/types.ts (1)
  • JobKind (511-522)
frontend/public/models/index.ts (1)
  • JobModel (343-358)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/public/components/replication-controller.jsx (2)
frontend/public/components/replicaset.jsx (4)
  • useColumnWidthSettings (204-204)
  • columns (206-271)
  • tableColumnInfo (142-150)
  • props (296-296)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
frontend/public/components/cron-job.tsx (8)
frontend/public/components/factory/table.tsx (1)
  • TableColumn (663-670)
frontend/packages/console-dynamic-plugin-sdk/src/extensions/console-types.ts (1)
  • TableColumn (309-315)
frontend/public/components/RBAC/role.jsx (13)
  • useTranslation (205-205)
  • useTranslation (247-247)
  • useTranslation (301-301)
  • useTranslation (394-394)
  • useTranslation (424-424)
  • useTranslation (444-444)
  • useTranslation (489-489)
  • columns (248-248)
  • columns (446-446)
  • tableColumnInfo (45-45)
  • props (250-250)
  • props (293-295)
  • props (445-445)
frontend/public/components/replication-controller.jsx (4)
  • useColumnWidthSettings (220-222)
  • columns (224-289)
  • tableColumnInfo (159-167)
  • props (315-315)
frontend/public/models/index.ts (1)
  • CronJobModel (777-792)
frontend/public/components/namespace.jsx (4)
  • columns (350-350)
  • columns (704-704)
  • columns (734-734)
  • props (860-860)
frontend/public/components/service-monitor.jsx (2)
  • columns (152-152)
  • props (151-151)
frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx (2)
  • nameCellProps (250-253)
  • actionsCellProps (262-266)
🔇 Additional comments (5)
frontend/packages/console-app/src/components/pdb/PDBList.tsx (5)

1-23: Imports look appropriate for the resizable column feature.

The new imports (nameCellProps, useColumnWidthSettings) align with the established pattern from other list components. Organization and paths are correct.


78-155: Clean implementation following the established resizable column pattern.

The hook structure mirrors other list components (ReplicaSet, ReplicationController), which is good for maintainability and consistency across the console. The explicit return type annotation aids readability.

One minor note: the useMemo depends on getResizableProps (line 152). This is correct assuming useColumnWidthSettings returns a stable reference for getResizableProps. Based on the shared snippets showing identical usage elsewhere, this appears to be the expected contract.


157-175: Component correctly wires the resizable column feature.

The destructuring and prop passing to ConsoleDataView follows the expected pattern. The combination of hideColumnManagement with isResizable provides column resizing without the full column management UI—reasonable for this use case.


35-76: Row data mapping correctly applies cell-level props.

The separation between column-level props (in usePDBColumns) and row-cell props (here using getNameCellProps and actionsCellProps) maintains clean architecture. The sticky behavior for name and actions columns is properly preserved at both levels.


25-33: Column ID definitions are well-structured.

Using a centralized tableColumnInfo array for column IDs prevents typos and ensures consistency between column definitions and row cell mappings. Good pattern.

Comment on lines +242 to +248
const useJobsColumns = (): {
columns: TableColumn<JobKind>[];
resetAllColumnWidths: () => void;
} => {
const { t } = useTranslation();
const columns: TableColumn<JobKind>[] = useMemo(() => {
const { getResizableProps, resetAllColumnWidths } = useColumnWidthSettings(JobModel);

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

hook="$(fd 'useResizableColumnProps' frontend | head -n1)"
if [[ -z "$hook" ]]; then
  echo "useResizableColumnProps file not found" >&2
  exit 1
fi

printf 'Hook file: %s\n\n' "$hook"
rg -n -C5 'useColumnWidthSettings|referenceForModel|useUserSettings|localStorage|sessionStorage|column.?width|resetAllColumnWidths' "$hook"

printf '\nJobsList call sites:\n\n'
rg -n -C3 'useColumnWidthSettings\(JobModel\)|ListComponent=\{JobsList\}' \
  frontend/public/components/job.tsx \
  frontend/public/components/cron-job.tsx

Repository: openshift/console

Length of output: 4843


Column widths are shared between standalone Jobs and the CronJob jobs tab — confirm this is intentional.

Both the full Jobs page (line 247) and the embedded jobs list in CronJobJobsComponent (cron-job.tsx:298) call useColumnWidthSettings(JobModel). Since the storage key is derived solely from referenceForModel(JobModel), resizing columns in one surface reshapes the other. This unintended coupling may confuse users or violate expectation that each surface has independent preferences. Either scope the key distinctly per surface (e.g., add a context identifier) or document the intentional behavior.

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

In `@frontend/public/components/job.tsx` around lines 242 - 248, The column width
state is shared because both useJobsColumns and CronJobJobsComponent call
useColumnWidthSettings(JobModel) which uses referenceForModel(JobModel) as the
storage key; change the key to be surface-specific by extending the call to
useColumnWidthSettings with a context identifier (e.g., 'jobs-page' vs
'cronjob-tab') or modify useColumnWidthSettings to accept an optional namespace
param and include that in the derived storage key, updating useJobsColumns and
CronJobJobsComponent to pass distinct identifiers so each surface persists
widths independently.

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

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