发布

  • [OPIK-4140] [FE] [BE] improve version selection UX (#5008)

    frostbyte_neo 发布于 2026-02-04 09:46:50 +00:00

    • OPIK-4140: Add version count to datasets and improve version selection UX

    Backend changes:

    • Added versionCount field to Dataset API response
    • Implemented DatasetVersionCount record and DAO method to fetch version counts
    • Updated DatasetService to populate version counts when fetching datasets

    Frontend changes:

    • Refactored DatasetVersionSelectBox to improve user experience
    • Clicking dataset now selects latest version directly
    • Version dropdown chevron only shown when multiple versions exist
    • Improved layout with better spacing and hover states
    • Fixed version selection state management with debounced close logic
    • OPIK-4140: Fix CI failures for dataset version count feature

    Add versionCount to DATASET_IGNORED_FIELDS in backend tests to prevent
    test failures from comparing computed server-side fields. Fix prettier
    formatting for React imports in DatasetVersionSelectBox.

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

    • OPIK-4140: Change versionCount from @Nullable Long to primitive long

    The service always sets versionCount via getOrDefault(id, 0L) and
    the API never emits null, so nullable is unnecessary. This change:

    • Backend: Remove @Nullable and change Long to long in Dataset.java
    • Frontend: Make version_count required in datasets.ts
    • Frontend: Simplify undefined check in DatasetVersionSelectBox.tsx
    • OPIK-4140: Keep @Nullable Long for versionCount due to JDBI constraint

    The Dataset record is used for JDBI row mapping where version_count
    column is not present in the datasets table (it's computed by the
    service layer from dataset_versions table). JDBI requires @Nullable
    to handle missing columns - primitives cannot represent "absent".

    The @Nullable is an internal implementation detail for JDBI compatibility.
    The service layer guarantees version_count is always populated via
    getOrDefault(id, 0L) before any API response, so frontend types
    correctly treat it as required.

    • OPIK-4140: Fix version list popover glitch when hovering away

    Remove selectedDatasetId fallback in useDatasetVersionSelect to prevent
    the popover from briefly showing wrong dataset's versions when closing.
    Now versions are only fetched when actively hovering a dataset.

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

    • OPIK-4140: Restore keepPreviousData for versions query

    Re-add keepPreviousData to prevent breaking the core flow while still
    fixing the popover glitch by only using openDatasetId.

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

    • OPIK-4140: Revert versionCount - always show chevron for all datasets

    Product decided all datasets should have a chevron for consistency,
    even if they only have one version. This reverts the versionCount
    feature and makes the chevron visible for all non-empty datasets.

    Backend changes:

    • Remove versionCount field from Dataset.java
    • Delete DatasetVersionCount.java
    • Remove findVersionCountsByDatasetIds from DAO
    • Remove version count fetching from DatasetService

    Frontend changes:

    • Remove version_count from Dataset type
    • Show chevron for all non-empty datasets (not just multi-version)
    • Add disabled state for empty datasets with info tooltip
    • OPIK-4140: Simplify version list popover - remove DatasetOption, use direct handlers
    • Remove DatasetOption component, inline logic in renderNestedList
    • Remove debounce logic for cleaner hover behavior
    • Wrap only chevron with PopoverTrigger, not entire row
    • Empty datasets show Info icon separately from Popover
    • Code cleanup: function declarations, simplified imports

    Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com


    Co-authored-by: GitHub Actions Bot github-actions@comet.com
    Co-authored-by: Claude Opus 4.5 noreply@anthropic.com

    下载附件