发布

  • [OPIK-6621] [FE] feat: add AND/OR grouping to alert conditions (#6803)

    frostbyte_neo 发布于 2026-05-21 15:51:13 +00:00

    • [OPIK-6621] [FE] feat: add AND/OR grouping to alert conditions

    Group multiple feedback-score conditions: AND within a group, OR between
    groups. Adds group_index on AlertTriggerConfig (BE contract from
    OPIK-6620). Existing single-OR alerts continue to render — each legacy
    condition becomes its own group.

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

    • refactor(alerts): use shared TooltipWrapper for disabled-delete tooltip

    Replaced the hand-rolled Tooltip/TooltipPortal/TooltipTrigger/TooltipContent
    composition with the project's TooltipWrapper component (which already
    encapsulates that exact pattern). The span wrapper that lets the tooltip
    fire on a pointer-events:none disabled button stays — that's the only
    behavior TooltipWrapper alone can't provide.

    • feat(alerts): address PR review — a11y, partial-config load, tests
    • Re-add FormItem wrappers around each FormControl in ConditionRow so
      useFormField() gets a proper FormItemContext (ids + aria-describedby
      hook up correctly). Custom row-level error strip stays — FormItem
      only provides the a11y context, not visual layout.
    • Stop filtering partial feedback-score configs in
      getAllThresholdConditionGroupsFromTriggerConfigs. Existing alerts
      with missing threshold/window/name (legacy data) now load into the
      editor with empty fields instead of being dropped, so users can fix
      • save them. Schema validation flags the missing fields per
        condition.
    • Add Vitest coverage for the new serialization helpers
      (helpers.test.ts, 9 cases): grouped/ungrouped bucketing, legacy
      configs without group_index, partial-config load behavior, operator
      normalization, group_index stamping, partial-condition drop on save,
      full round-trip, non-contiguous group_index compression on save.
    • feat(alerts): address UX feedback — font weight + delete-last-condition
    • Score select and window select dropdowns now render their selected
      value at font-normal (matches the threshold Input). The Button
      primitive applies comet-body-s-accented (font-medium) globally; we
      override per-call to keep the row's text weight uniform.
    • Deleting the only condition in a group now removes the whole group
      (instead of being blocked). The constraint stays at the alert level:
      if it's the only group left, the row delete is disabled and the
      tooltip explains "every alert needs at least one group with at
      least one condition."

    Co-authored-by: Claude Opus 4.7 noreply@anthropic.com

    下载附件