MishkaCmsMigrationWeb.Flash (Mishka CMS Migration v0.0.1)

Copy Markdown View Source

The flashes of the migration pages, said by what they mean and drawn with the kinds the core has.

  • :success — something is done: Run cancelled, 553 items decided, Import of 2 items: created;
  • :info — something started, was queued, or did not start: Dry run started, a step the run refuses while another run of the site is running;
  • :warning — done, but the admin should look: an import with skipped items or items that wait for a decision, a bulk choice that left some items as they were, a dry run that could not start after the run was saved;
  • :error — failed: a failed import, a run that is not there, a choice the core refused.

The core draws the same four kinds (MishkaCmsCore.Layouts.flash_group/1): success green, info blue, warning amber and error red. put/3 puts each meaning under its own core kind (core_kind/1), so a page and a test ask for the meaning and the admin sees its colour.

result_kind/1 is the meaning of what an item's dry run or import came to.

Summary

Types

What a flash means.

Functions

The kind the core draws a flash of kind with: :success, :info, :warning and :error each have their own colour and icon.

The kinds a flash can mean, from the calmest to the most serious.

Puts message on socket, as the core kind core_kind/1 draws kind with.

What a flash about one item means, by what its dry run or import came to: created and updated are :success, failed is :error, and skipped, waiting for a decision or anything else the admin may want to look at is :warning.

Types

kind()

@type kind() :: :success | :info | :warning | :error

What a flash means.

Functions

core_kind(kind)

@spec core_kind(kind()) :: kind()

The kind the core draws a flash of kind with: :success, :info, :warning and :error each have their own colour and icon.

kinds()

@spec kinds() :: [kind()]

The kinds a flash can mean, from the calmest to the most serious.

put(socket, kind, message)

Puts message on socket, as the core kind core_kind/1 draws kind with.

result_kind(result)

@spec result_kind(atom()) :: kind()

What a flash about one item means, by what its dry run or import came to: created and updated are :success, failed is :error, and skipped, waiting for a decision or anything else the admin may want to look at is :warning.