Skip to content

Refactor relationship field to new design, reusing AssetPicker filters/search (Edit Contentlet)Β #37192

Description

@erickgonzalez

Description

Refactor the Relationship field in the new Edit Content to follow the new design, reusing as much as possible from the AssetPicker component built for Content Drive (#36702) β€” filters, search, and the same backend endpoint.

🎨 Design: https://claude.ai/design/p/202fc776-9326-4926-b4c6-5996a8be9ea1?via=share&file=Asset+Picker.dc.html
πŸ’¬ Context (Slack): https://dotcms.slack.com/archives/C0893BF7GRJ/p1787232866639669

Reuse goals:

This is the larger design refactor of the relationship field. It is separate from #36155 (smaller relationship-field refinements: chip colors, Locales column, hint, empty state, showFields) β€” cross-referenced, not superseded.

Acceptance Criteria

Design refactor

  • The relationship field is refactored to match the new design (linked above)
  • Relating and unrelating content works with the new design
  • The refactor preserves relationship-field behavior (cardinality, ordering, permissions)
  • The picker is a selection editor: it opens with already-related items checked, checking adds and unchecking removes; confirming leaves the relationship equal to the selection
  • The confirm action is never disabled β€” confirming with an empty selection unrelates every item

Reuse AssetPicker & Content Drive patterns (#36702)

  • Filters are reused from the AssetPicker component (not re-implemented) where applicable
  • The search reuses the AssetPicker/Content Drive search, using the api/v1/drive/search endpoint
  • Shared UI/interaction patterns from the AssetPicker are reused rather than duplicated
  • The picker presents a full-width search bar plus filter chips (site/folder, Locale) β€” no folder-tree sidebar; the folder scope is a chip

Consistency & regressions

  • Existing related content loads and displays correctly after the refactor
  • Saving a contentlet persists relationship changes correctly (no data loss)
  • The picker keeps its own paging (page, prev/next, page size). Only the related-content list in the form loses its paging β€” the two lists are different lists

Relationship component fixes (not picker-related)

Additional fixes to the relationship component shown in the new Edit Content (the list of related content), independent of the picker:

Suggested Tests

Frontend refactor + component fixes (search reuses the existing api/v1/drive/search endpoint β€” no backend change). Unit-first; E2E covers the relate/unrelate + drag-reorder flows that are hard to assert fully in unit. Integration/Postman are not applicable.

Unit (Jest/Spectator) β€” primary coverage

  • The relationship field renders the new design (relate control, related-content rows)
  • Relating content adds it to the model; unrelating removes it
  • The search calls the api/v1/drive/search endpoint with the expected params (reused, not re-implemented)
  • Filters reuse the AssetPicker filter component (assert the shared component is used)
  • The drag handle is hidden by default and shown on row hover
  • The Status column is right-aligned (assert the alignment class/style)
  • With a single-column form, the component honors the single-column max width (see New Edit Content: apply field padding (18px) and form max-width (720px/1000px) guidelinesΒ #36615)
  • No pagination control is rendered in the related-content list; ≀40 items render fully with no Load more, >40 render 40 rows plus Load more, and the withheld items remain in the emitted value

E2E (Playwright) β€” flows hard to unit-cover

  • Open a contentlet with a relationship field β†’ search + relate content β†’ the item appears β†’ save β†’ persists
  • Unrelate an item β†’ save β†’ it is removed
  • Drag-reorder across the full related set (with pagination removed) β†’ new order is saved and reloads correctly

Integration / Postman

  • No tests β€” search reuses the existing api/v1/drive/search endpoint; relationship persistence uses existing content endpoints. No API contract change.

Spec

Spec-driven work (Spec-Kit): specs/37192-relationship-field-assetpicker/spec.md, on branch issue-37192-relationship-field-assetpicker. PR 1 carries the spec alone and must be approved before implementation starts.

Not in scope: the "New content" path (creating related content in place, side panel or dialog per the feature flag) is unchanged β€” only the "Existing content" path is refactored.

Priority

Medium

Additional Context

Part of the new Edit Contentlet work (dotCMS: New Edit Contentlet), Relationship field. Reuses the AssetPicker component (#36702) and the shared api/v1/drive/search endpoint for search/filters. Cross-references #36155 (smaller relationship-field refinements β€” kept separate per scope decision). Product context is in the linked Slack thread.

This issue also bundles fixes to the relationship component (the related-content list) that are independent of the picker: hover-only drag handle, right-aligned Status column, single-column max-width handling (see #36615), and removing pagination so drag-reordering works across the full related set.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions