fix(resources): filterable namespace + discoverable filter affordance + header width fixes#751
Merged
Merged
Conversation
…ters Five small consistency fixes to the Resources view's table header behaviour: - Drop the distinct-value cap for the `namespace` filter. Cardinality scales with the cluster, not the kind, so the previous 20-value cap was silently hiding the most-used filter as soon as a kind spanned enough namespaces. - Raise the `node` cap from 50 to 200 for the same reason. - Raise the generic enum cap from 20 to 30 so status enums that have grown (workload status, GitOps phases, Trivy report statuses) still surface a dropdown. - Wire the `containers` column header to be clickable for sorting — `getSortValue` already returned a ready/total ratio, but the header was missing from the sortable allowlist. - Allow events to be filtered by `reason` (removed from SKIP_FILTER_COLUMNS — cardinality is naturally bounded by the cap). All five are pure-widen changes; nothing that filtered or sorted before stops doing so.
…coverable Two themes: Filter funnel visibility — the filter icon was `opacity-0` until you hovered the header, so users had no way to know which columns were filterable. Bump to `opacity-40` at rest. Active-filter and open- dropdown states are unchanged (they already render at full strength with their own colour treatment). Header width tweaks — many column labels truncated at modern laptop widths because the fixed `w-*` Tailwind classes were sized for short cell values, not for label + sort caret + filter funnel. Bumped one or two Tailwind steps across the kinds with the most clearly visible truncation: - Workloads: `Up-to-date` w-24 → w-32, `Available` w-24 → w-28 (deployments, daemonsets, statefulsets) - Jobs: `Completions` w-28 → w-32 - ServiceAccounts: `Automount` w-24 → w-32, `Secrets` w-20 → w-24 - PVC/PV: `Storage Class` w-36 → w-40 - Webhook configs: `Webhooks` w-20 → w-28, `Failure Policy` w-28 → w-36 - Leases: `Last Renewed` w-28 → w-32 - PriorityClasses: `Global Default` w-28 → w-36 - Velero: `Errors` w-16 → w-20 - ESO: `Last Sync` w-24 → w-28 - Knative: `Concurrency` w-24 → w-32 - CNPG: `Instances` w-24 → w-28, `Storage` w-20 → w-28, `Pool Mode` w-28 → w-32, `Suspended` w-20 → w-28 - Crossplane: `Provider Config` w-36 → w-40, Composition `Composite Kind` w-40 → w-44, `Functions` w-24 → w-28 - KubeadmControlPlanes: `Initialized` w-24 → w-28 Each column gains at most 16-32px; the Name column (no fixed width) absorbs the difference, so no other columns get squeezed. Verified visually on Pods, Events, Deployments, ServiceAccounts at 1728x1117 (MBP 16" effective) — labels render in full without ellipsis.
Extract the inline filterable-column cap rule from the filterOptions useMemo into a small exported helper, then pin its contract with vitest. The thresholds (namespace = ∞, node = 200, generic = 30) were just tuned after a customer-visible regression where the namespace filter silently vanished on clusters with more than 20 namespaces — exactly the kind of magic-number config that a future "tidy up" pass would silently regress without a test. Also pins the deliberate `reason` removal from SKIP_FILTER_COLUMNS, so re-adding it would break the Events Reason filter test rather than silently re-killing it. Mirrors the resources-search-sidebar-hint.test.ts pattern (pure extraction + vitest pin, no DOM).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A grab-bag of small consistency fixes to the Resources view's table headers — all pure-widen changes, no behavioural narrowing. Three themes:
1. Filterability detection (was silently hiding the most useful filter)
Today, filter dropdowns are detected only when a column has 2–20 distinct values (cap is 50 for
node). Namespace cardinality scales with the cluster, not the kind enum, so as soon as a kind spanned more than 20 namespaces the namespace filter disappeared.namespaceentirelynodecap 50 → 2002. Newly-filterable / newly-sortable columns
containers(Pods) —getSortValuealready returned the ready/total ratio; the header was missing from the sortable allowlist. Now clickable.reason(Events) — removed fromSKIP_FILTER_COLUMNS. The single most useful event filter (FailedScheduling, BackOff, Killing…).3. Filter affordance discoverability
The filter funnel was
opacity-0at rest and only revealed on hover. Combined with (1) and (2) above making more columns filterable, the lack of discovery hurt more, not less. Bump toopacity-40at rest; active-filter and open-dropdown states are unchanged.4. Column-header width fixes
The fixed
w-*Tailwind classes on many columns were sized for short cell values, not for label + sort caret + filter funnel. Audited every kind at 1728×1117 (MBP 16" effective) using canvas text measurement against header overhead; bumped one or two Tailwind steps on the kinds with clearly visible truncation. ~22 columns across 17 kinds, including:Up-to-date/AvailableContainers/RestartsType/Reason/Count/Last SeenWebhooks/Failure PolicyAutomount/SecretsStorage ClassLast RenewedGlobal DefaultCompletionsErrorsLast SyncConcurrencyInstances/Storage/Pool Mode/SuspendedProvider Config+ CompositionComposite Kind/FunctionsInitializedName column absorbs the extra width (it has no fixed
w-*), so nothing else gets squeezed.Out of scope (deferred)
The audit also surfaced a wider structural opportunity: replacing the global hardcoded sortable allowlist and global filter-skip denylist with per-column
sortable?/filterable?flags on eachColumn. That'd remove a class of key-collision bugs (e.g.rolemeans different things on rolebindings vs machines) and make each kind self-declare its behaviour. Larger refactor; this PR is the safe quick-wins slice.Note
Medium Risk
Changes filter auto-detection thresholds (including uncapping
namespace), which alters visible filtering UI and could impact performance on very large resource sets due to larger distinct-value sets. Otherwise changes are localized to the Resources table UI (sorting/opacity/column widths) with low risk of data correctness issues.Overview
Fixes Resources table column-filter auto-detection so useful filters don’t disappear on larger clusters by extracting the distinct-count logic into
isColumnFilterableByDistinctCount(uncappednamespace, higher caps fornodeand other enum-like columns) and makingSKIP_FILTER_COLUMNSexportable/tested.Also makes Pods
containerssortable, allows Events filtering byreason(removed from the skip denylist), increases the default visibility of the filter funnel icon (opacity tweak), and widens multiple header columns to prevent label/sort/filter truncation. Adds a focused Vitest suite to pin the new filterability rules and guard against regressions.Reviewed by Cursor Bugbot for commit 7a1f9c9. Bugbot is set up for automated code reviews on this repo. Configure here.