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

Copy Markdown View Source

The Items page's Decisions panel (MishkaCmsMigrationWeb.Live.Admin.Dashboard.Item.Index): what waits for a decision no admin has made among the items of the run's source host, grouped, so a whole group is decided in one step instead of item by item. It reads the groups in one query (MishkaCmsMigration.MigrationItem.waiting_groups/3) once the page is connected, and again once after any change to the items it is told of (refresh: true, which the page sends for every item's broadcast): a refresh asked for while one is read, or while a decision is applied, is read once that is done, so a decision over a thousand items reads the groups once more, not a thousand times. Nothing waits, nothing is drawn.

Simple

One card for each conflict, such as "The source does not say its language", with how many items wait for it and of which kinds ("1,668 items: 120 pages, 1,400 posts…"), and its choices in words, the recommended one first and marked so (MishkaCmsMigration.MigrationItem.choice_options/1). A choice asks first, "Answer 1,668 items with “Import it in the site's main language”? …", then decides them all (MishkaCmsMigration.MigrationItem.decide_waiting/5, one update whatever their number); a flash says how many, and the page is told once (:items_decided) to draw the rows again. Show them narrows the table to what waits for a decision (the Plan filter).

Advanced

One rule for each kind and conflict, each with its own choice and a switch to include it, and an optional text that narrows every rule to the items whose title holds it, or whose source id it is. Preview counts reads, in one query, how many items each rule would decide, and shows the rules that are on alone, each with its count, and their total; a rule that is off says so. Apply asks first, then decides each included rule's items with its choice.

A decision holds for every later dry run and import and imports nothing: the panel's foot says that the next import writes them, parents before their children. Every decision runs as the signed-in admin, on the run's site, under the items' own policies and their check that no run of the site is running (MishkaCmsMigration.Resources.Validations.SiteIdle); one refused is said in a flash. While the run's own dry run or import runs, the choices are disabled and the panel says why. A button that asks first is disabled while its event is in flight, so a second click never asks twice. Once nothing waits any more, the panel says so in one line.

choice/1 draws a choice as this panel does, the recommended one starred, marked so and in the primary style, for Where it sits (MishkaCmsMigrationWeb.Live.Admin.Dashboard.Item.Branch) too.

Every part carries a data-role (decisions, decision-group with data-conflict, decision-choice with data-choice and data-recommended, decision-rule with data-key, decision-preview, decision-preview-rule, decision-apply, decisions-busy, decisions-done), so a test reads it without reading its markup.

Summary

Functions

A choice of a decision as a button, the recommended one first starred, marked "(recommended)" and in the primary style, the others in the secondary one; size: :small for a choice beside an item, as Where it sits draws them. Its data-recommended says which it is.

Functions

choice(assigns)

A choice of a decision as a button, the recommended one first starred, marked "(recommended)" and in the primary style, the others in the secondary one; size: :small for a choice beside an item, as Where it sits draws them. Its data-recommended says which it is.

Attributes

  • recommended (:boolean) - the conflict's recommended choice. Defaults to false.
  • size (:atom) - Defaults to :normal. Must be one of :normal, or :small.
  • Global attributes are accepted. Supports all globals plus: ["disabled"].

Slots

  • inner_block (required)