frontend: ResourceTable: Add new 'labels' column to all list views to allow searching by label#5035
frontend: ResourceTable: Add new 'labels' column to all list views to allow searching by label#5035sniok wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sniok 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 |
… allow searching by label
There was a problem hiding this comment.
Pull request overview
Adds a new built-in labels column (hidden by default) across resource list views so users can search resources by label selectors (e.g. app=test) using the existing table search.
Changes:
- Extends
ResourceTablecolumn support with a newlabelsColumnType, including default hidden visibility. - Appends
'labels'to the columns list for many list views so label data participates in global search. - Updates the Namespace list storyshot snapshot to reflect the new column behavior.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/components/common/Resource/ResourceTable.tsx | Adds labels to ColumnType, implements the built-in labels column accessor, and hides it by default. |
| frontend/src/components/webhookconfiguration/ValidatingWebhookConfigList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/webhookconfiguration/MutatingWebhookConfigList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/verticalPodAutoscaler/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/storage/VolumeList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/storage/ClassList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/storage/ClaimList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/statefulset/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/serviceaccount/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/service/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/secret/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/runtimeClass/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/role/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/role/BindingList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/resourceQuota/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/replicaset/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/priorityClass/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/podDisruptionBudget/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/pod/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/node/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/networkpolicy/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/namespace/List.tsx | Adds 'labels' to columns (but currently introduces a duplicate labels column id). |
| frontend/src/components/namespace/snapshots/NamespaceList.Regular.stories.storyshot | Updates snapshot output for namespace list table rendering/columns. |
| frontend/src/components/lease/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/job/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/ingress/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/ingress/ClassList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/horizontalPodAutoscaler/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/gateway/ReferenceGrantList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/gateway/HTTPRouteList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/gateway/GatewayList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/gateway/ClassList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/gateway/BackendTrafficPolicyList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/gateway/BackendTLSPolicyList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/endpointSlices/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/endpoints/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/deployments/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/daemonset/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/cronjob/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/crd/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/crd/CustomResourceList.tsx | Adds 'labels' column to enable label searching for CR instances. |
| frontend/src/components/crd/CustomResourceInstancesList.tsx | Adds 'labels' column to enable label searching in this list view. |
| frontend/src/components/configmap/List.tsx | Adds 'labels' column to enable label searching in this list view. |
| render: ns => | ||
| ns.metadata.labels ? <MetadataDictGrid dict={ns.metadata.labels} /> : null, | ||
| }, | ||
| 'labels', |
There was a problem hiding this comment.
The columns array defines a custom column with id: 'labels' and then also includes the built-in 'labels' ColumnType. This results in duplicate column IDs, which can cause the later built-in column to override the custom one (and potentially break sorting/filtering/visibility). Remove the extra 'labels' entry here, or rename the custom column id (and/or set its show to false) so there is only one labels column id in the table.
| 'labels', |
| // Labels column is hidden by default | ||
| if (col === 'labels') { | ||
| visibility[col] = false; | ||
| } |
There was a problem hiding this comment.
This PR introduces a new hidden-by-default labels column intended to make key=value label searches work via the table’s global filter. There’s existing story-based coverage for global search (e.g., NameSearch in ResourceTable.stories.tsx), but nothing that asserts label searches work when the labels column is hidden. Add a story/test case that sets the global filter to a label selector string and verifies the matching row(s) are returned even though the column is not visible.
fixes #2547
This PR adds a new 'labels' column (hidden by default) to all list views
This allows users to search items by label (like
app=test) using the existing search bar in the tableSearch works even if column is hidden, which it is by default
I've chosen the
label=valueformat instead oflabel:valueto keep it in line with kubectl (for examplekubectl get pods -l app=agent-sandbox-controller -A)How to test