You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today the admin UI has three separate PrimeNG p-tree implementations for site/folder browsing. They look and behave differently (selection mode, load-more convention, toggler icons, label pipes) and do not reuse each other:
Presentational tree inside Browser Selector (not exported on its own)
Already shared:DotBrowsingService, path-label pipes (FolderNamePipe / DotTruncatePathPipe — near-duplicates), and TreeNodeItem models in @dotcms/dotcms-models.
Not shared: the p-tree shell (default / load-more / toggler templates, selection modes, styling). Content Drive has the richest presentational API; Host Folder Field embeds its own tree; Browser Selector sidebar is the thinnest variant.
Proposal
Extract a presentational folder tree component (e.g. DotFolderTreeComponent) into @dotcms/ui (core-web/libs/ui), export it from libs/ui/src/index.ts, and reuse it in:
Content Drive (dot-tree-folder consumer)
Edit Content Host Folder Field
Browser Selector sidebar (dot-sidebar)
Prefer evolving from DotTreeFolderComponent’s public API (folders, loading, selection, expand/collapse, load-more, toggler modes), with content projection or inputs for node label formatting.
Extend shared tree node models for load-more instead of portlet-only types
Acceptance Criteria
A presentational folder tree component lives under core-web/libs/ui and is exported from @dotcms/ui
The shared component owns the p-tree shell: value, selection (single and multi where needed), loading, expand/collapse outputs, load-more handling, and toggler modes (chevron vs folder icons)
Content Drive sidebar uses the shared @dotcms/ui tree; Content Drive–specific drag/drop and “All folders” behavior remain in the Content Drive consumer
Host Folder Field uses the shared @dotcms/ui tree for its folder panel; overlay, sites list, search, and form CVA remain in edit-content
Browser Selector sidebar uses the same shared tree (replacing or wrapping the current DotSideBarComponent tree)
Observable folder-tree behavior is preserved in all three consumers: lazy expand, node selection, and load-more still work as before
Existing unit tests for the three consumers are updated/passing; the shared component has Spectator/Jest coverage for selection, expand, load-more, and toggler modes
No duplicate inline p-tree folder shell remains in the three adoption sites after migration
Priority
Medium
Additional Context
Suggested adoption order: promote Content Drive’s presentational tree into @dotcms/ui → replace Browser Selector sidebar → wrap Host Folder Field’s right-hand tree while leaving its overlay/store in edit-content.
Related services/pipes already in @dotcms/ui:DotBrowsingService, FolderNamePipe, DotTruncatePathPipe.
Description
Today the admin UI has three separate PrimeNG
p-treeimplementations for site/folder browsing. They look and behave differently (selection mode, load-more convention, toggler icons, label pipes) and do not reuse each other:core-web/libs/portlets/dot-content-drive/ui/src/lib/dot-tree-folder/DotTreeFolderComponentcore-web/libs/edit-content/src/lib/fields/dot-edit-content-host-folder-field/components/host-folder-field/DotHostFolderFieldComponentp-treeinside Host Folder Field overlaycore-web/libs/ui/src/lib/components/dot-browser-selector/components/dot-sidebar/DotSideBarComponentAlready shared:
DotBrowsingService, path-label pipes (FolderNamePipe/DotTruncatePathPipe— near-duplicates), andTreeNodeItemmodels in@dotcms/dotcms-models.Not shared: the
p-treeshell (default / load-more / toggler templates, selection modes, styling). Content Drive has the richest presentational API; Host Folder Field embeds its own tree; Browser Selector sidebar is the thinnest variant.Proposal
Extract a presentational folder tree component (e.g.
DotFolderTreeComponent) into@dotcms/ui(core-web/libs/ui), export it fromlibs/ui/src/index.ts, and reuse it in:dot-tree-folderconsumer)dot-sidebar)Prefer evolving from
DotTreeFolderComponent’s public API (folders, loading, selection, expand/collapse, load-more, toggler modes), with content projection or inputs for node label formatting.Keep consumer-owned (out of the shared leaf):
DotBrowsingServicewhere already used; Content Drive may keep its store wiring)Also consolidate where practical:
type+ typed template, ordata.type)FolderNamePipe/DotTruncatePathPipe)Acceptance Criteria
core-web/libs/uiand is exported from@dotcms/uip-treeshell: value, selection (single and multi where needed), loading, expand/collapse outputs, load-more handling, and toggler modes (chevron vs folder icons)@dotcms/uitree; Content Drive–specific drag/drop and “All folders” behavior remain in the Content Drive consumer@dotcms/uitree for its folder panel; overlay, sites list, search, and form CVA remain in edit-contentDotSideBarComponenttree)p-treefolder shell remains in the three adoption sites after migrationPriority
Medium
Additional Context
Suggested adoption order: promote Content Drive’s presentational tree into
@dotcms/ui→ replace Browser Selector sidebar → wrap Host Folder Field’s right-hand tree while leaving its overlay/store in edit-content.Related services/pipes already in
@dotcms/ui:DotBrowsingService,FolderNamePipe,DotTruncatePathPipe.