发布

  • [OPIK-3506] [FE] Additional UX improvements for Dashboard beta (#4509)

    frostbyte_neo 发布于 2025-12-19 15:01:44 +00:00

    • [OPIK-3506] [FE] Move edit title and description above widget preview

    • Revision 2: Fix dashboard utils test - correct title expectation

    The test incorrectly expected config.title to be 'Generated Title' when it should be an empty string. The implementation correctly distinguishes between:

    • title: user-provided custom title (empty by default)
    • generatedTitle: auto-generated title from widget config

    All 369 tests now pass successfully.

    • Revision 3: Improve error validation logic in accordion components

    Enhanced error detection in FiltersAccordionSection and GroupsAccordionSection to check for actual error messages in field properties rather than just checking array length. This ensures the red error highlight only appears when there are real validation errors with messages, not just empty error objects.

    Changes:

    • FiltersAccordionSection: Check for field, operator, value, and key error messages
    • GroupsAccordionSection: Check for field and key error messages
    • Revision 4: Add title fallback to generatedTitle in all widget types

    Fix for PR comment - widgets now fall back to generatedTitle when title is empty, preventing blank headers for widgets using default names.

    Changes:

    • ProjectMetricsWidget: title={widget.title || widget.generatedTitle || ""}
    • ExperimentsFeedbackScoresWidget: title={widget.title || widget.generatedTitle || ""}
    • ProjectStatsCardWidget: title={widget.title || widget.generatedTitle || ""}
    • TextMarkdownWidget: title={widget.title || widget.generatedTitle || ""}

    Addresses: https://github.com/comet-ml/opik/pull/4509#discussion_r2635085854

    • Revision 5: Remove unused UNSET_PROJECT_VALUE handling

    Since we removed the 'None' option from the project selector, we no longer need the code that handles UNSET_PROJECT_VALUE.

    Changes:

    • Removed UNSET_PROJECT_VALUE import
    • Simplified selectedProjectValue fallback to empty string
    • Simplified handleProjectChange to always set [value] without conditional logic
    • Revision 6: Simplify TextMarkdown widget title calculation

    Since we now use generatedTitle field and always return 'Text' as the default title for TextMarkdown widgets, removed the complex markdown parsing logic that tried to extract titles from content.

    This change:

    • Removes unused imports (TextMarkdownWidget, trim, isEmpty, truncate, compact, find)
    • Removes markdown parsing regex patterns and logic
    • Simplifies calculateTextMarkdownTitle to just return DEFAULT_TITLE
    • Makes the code cleaner and easier to maintain

    The old logic tried to extract titles from markdown content (headings, first line, etc), but with the new generatedTitle approach, we just need a simple static default title.

    • Revision 7: Add feedback score name to metrics widget title

    When a feedback score metric type is selected with exactly one feedback
    score, include the score name in the generated title (e.g., "Trace metrics - Accuracy").

    • Revision 8: Fix InlineEditableText truncation and layout
    • Fix text truncation by simplifying DOM structure and adding min-w-0
    • Use hidden/flex instead of opacity for edit icon to allow text to use full width when not hovering
    • Improve group title generation in feedback scores widget
    • Add support for field-based group labeling (e.g., "grouped by Dataset").
    • Refactor logic to handle single-field and multi-field groupings.
    • Use descriptive labels for dataset and metadata group types.
    • Revision 9: Improve experiment widget title generation

    Rework naming to be more intuitive:

    • "Experiment metrics by Dataset" instead of "Experiments grouped by Dataset metrics"
    • Single metric shows name directly: "Accuracy by Dataset"
    • Filtered state: "Filtered metrics by Dataset"
    • Revision 10: Fix title generation for empty metrics and plural form

    Fixed two title generation issues identified by baz-reviewer:

    1. ExperimentsFeedbackScoresWidget: When filters exist but no feedback
      scores are selected, the widget now returns "Experiment metrics"
      instead of the meaningless "Filtered metrics". Added early return
      when metricsLabel === "metrics" to ensure proper default title.

    2. ProjectStatsCardWidget: Changed DEFAULT_TITLE from singular
      "Project statistic" to plural "Project statistics" for consistency
      with other widgets ("Experiment metrics", "Project metrics").

    下载附件