MishkaCmsMigrationWeb.Live.Admin.Dashboard.Item.Branch (Mishka CMS Migration v0.0.1)

Copy Markdown View Source

Where an item sits at the source, drawn in its expanded row on the Items page (MishkaCmsMigrationWeb.Live.Admin.Dashboard.Item.Index): the item under its parents (MishkaCmsMigration.MigrationItem's :ancestors), the top one first, each with where it stands (MishkaCmsMigration.MigrationItem.standing/1): Needs your decision, Import failed (with why, from its last import), Decided: ready to import, Not imported yet, Imported, Connected, Left out by you or Not in the source. A decided item whose last import failed says why under it too. An item with no parent draws nothing.

An item that waits for its parent (MishkaCmsMigration.MigrationItem.waits_for_parent/1) says so first, with what holds it now, read from its parents as they are, not from what its last import said: "Its parent Team (#25) needs your decision: decide it and import it, then this one again.", or "About (#24), above its parent, needs your decision: …" when one higher up holds the branch.

Each item of the branch has what can be done on it there, as buttons the page answers:

And for the branch as a whole:

  • Decide all N: one choice for every item of the branch that waits for the same decision (decide_branch, with their ids), once the admin confirms, the recommended one marked so;
  • Import the branch (import_branch): every item of it not imported yet, parents first, as a job of picked items walks them, offered once nothing in it waits for a decision; while one of its parents does, a line says to decide them first;
  • Import anyway (import_anyway), for the item that waits for its parent: written now without it, at the top level (a page keeps its own address), once the admin confirms; Wait for its parent instead (decide_node on "parent_missing" with "keep") takes that back, once the admin confirms what happens to a record the import already wrote.

While the run's dry run or import runs (busy), the buttons that would start one or change an item are disabled and a line says why. A button that asks first is disabled while its event is in flight (phx-disable-with), so a second click never asks twice.

Every part carries a data-role (item-branch, item-branch-node with data-source-id and data-standing, item-branch-failed, item-branch-decide, item-branch-import, item-branch-show, item-branch-decide-all, item-branch-import-all, item-branch-decide-parents, item-branch-import-anyway, item-branch-busy), so a test reads it without reading its markup.

Summary

Functions

Where @item sits and what can be done on its branch, or nothing for an item with no parent.

Functions

branch(assigns)

Where @item sits and what can be done on its branch, or nothing for an item with no parent.

Attributes

  • item (MishkaCmsMigration.MigrationItem) (required) - the expanded item, with its :ancestors.
  • list_path (:string) (required) - the Items page's address, to show an item in.
  • busy (:boolean) - whether the run's dry run or import runs now. Defaults to false.