# `MishkaCmsMigrationWeb.Live.Admin.Dashboard.Item.Tree`
[🔗](https://github.com/mishka-group/mishka_cms_migration/blob/v0.0.1/lib/mishka_cms_migration_web/live/admin/dashboard/item/tree.ex#L5)

The Items table's Map view (`MishkaCmsMigration.MigrationItem`'s `switchable_templates`): a Gervaz
table template that draws the items as the source nests them, for deciding where each part of a
site goes before it is imported. The List view is the stock `MishkaGervaz.Table.Templates.Table`,
and the table's template switcher moves between them.

Each kind is a section, in the order the sources walk the kinds, its items a tree by their
`source_parent`, siblings by title: an item under the one the source puts it under, indented, and
a chevron on an item with children that folds them away and back (`Phoenix.LiveView.JS`). An item
whose parent the table has not loaded, or that sits under none, is at the top of its kind, so a
kind that does not nest, such as the tags, is a flat list, and an item in a loop of parents is
drawn once. Each row shows its checkbox, title and source id, its Plan
(`MishkaCmsMigration.MigrationItem.plan_cell/1`, which names the record an item is mapped to),
and its row actions: Dry run this item and Import this item, Map to… for a category or a tag,
Leave out and Bring back.

The tree is drawn from the rows the table has loaded (`keep_loaded_records`), as a LiveView stream
holds no nesting; Load more adds the next page to it. An item whose parent the table has not
loaded, such as one the filters keep out, is drawn under its parents all the same, from what is
read of the items above it with its page (`MishkaCmsMigration.MigrationItem`'s `:ancestors`):
each of them is a lighter node (`data-ghost`), with where it stands
(`MishkaCmsMigration.MigrationItem.standing/1`) and its row actions, and none is picked with the
checkboxes; one the source does not list says Not in the source. An item that waits for its
parent says so under its title (`item-tree-waits`, `MishkaCmsMigration.MigrationItem.waits_for_parent/1`).
The filters, the bulk actions, the switcher, the states and the pagination are Gervaz's own
(`MishkaGervaz.Table.Templates.Shared`).

Every part carries a `data-role` (`item-tree`, `item-tree-kind` with `data-kind`,
`item-tree-node` with `data-item-id`, `data-source-id` and `data-parent`, `item-tree-children`,
`item-tree-fold`), so a test reads the tree without reading its markup.

# `render_bulk_actions`

# `render_empty`

# `render_error`

# `render_filters`

# `render_header`

# `render_item`

One item of the tree, `@node` (`{item, its children's nodes}`), and the items under it, drawn
folded open.

# `render_loading`

# `render_pagination`

# `render_template_switcher`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
