-
[OPIK-6084] [FE] feat: unify select-all pattern in menus (#6547)
发布于
2026-04-29 13:25:40 +00:00 - [OPIK-6084] [FE] feat: unify select-all pattern in menus
Replace the legacy "Show all / Hide all" two-item pattern and the
mixed "Select all / Deselect all" + count-tag controls with a
single unified row showing "N of N selected" plus a checkbox
that supports the indeterminate state when only some items are
selected.Add a small getSelectAllCheckedState helper in lib/utils to map
(selectedCount, totalCount) onto Radix's boolean | "indeterminate"
checked state, so all six call sites share the same logic.Affected components:
- shared/ColumnsContent (menu variant): pass indeterminate state
to the bottom select-all row (impacts every ColumnsButton +
WorkspaceMenuContent menu). - shared/LoadableSelectBox: replace "Select all" label with the
unified count and add indeterminate state (impacts every v2
caller using showSelectAll). - v2/pages-shared/traces/.../SpanDetailsButton: drop the
separate Show all / Hide all items in favor of the unified
row. - v2/pages-shared/datasets/GeneratedSamplesDialog: collapse the
select-all text plus the count Tag into a single unified row. - v2/pages/PlaygroundPage/MetricSelector: render unified count
with indeterminate state on top of the tristate selection
semantics. - v2/pages/CompareExperimentsPage/.../ExperimentDataset: add the
unified select-all row to the Keys dropdown (it had none).
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
- fix(opik-6084): address baz-reviewer feedback
- MetricSelector: derive selectedCount from already-pruned
selectedRules so stale ids in selectedRuleIds (e.g. after
refetch / delete / permission change) cannot make
isAllSelected diverge from the actually-renderable selection. - LoadableSelectBox: memoize selectedValues into a Set and use
Set membership for isSelected, filteredSelectedCount, and the
filtered-deselect branch in handleSelectAll. - lib/utils.test.ts: add coverage for getSelectAllCheckedState
empty / partial / full / overflow cases.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com
下载附件