MishkaCmsMigrationWeb. Live. Admin. Dashboard. Home. Index
(Mishka CMS Migration v0.0.1)
Copy Markdown
View Source
The migration's admin page: a card for each installed source (MishkaCmsMigration.Source.all/0),
and under them the runs of the admin's site, every site's for a master, as a Gervaz table (see
MishkaCmsMigration.MigrationRun for its columns and row actions). The table follows the runs'
PubSub notifications, which this page hands on to it.
A card's New import opens the run's Gervaz form for that source in a modal: the page sends the
form defaults: %{source: id}, so its Connection draws the keys that source asks for
(MishkaCmsMigration.Source.form_fields/1), its secret as a masked password input, or, for a
source that reads a file (MishkaCmsMigration.Source.file?/1) such as the WordPress export file,
its Export file upload instead. Another source's New import starts the form over for it; the same
source's opens it as the admin left it, answers and step kept, until a run starts or the admin
presses Start over. The window is Gervaz's wizard of four steps
(MishkaCmsMigrationWeb.Live.Admin.Dashboard.ImportSteps): where from, what to bring, languages,
and a review in plain words. Its Start the dry run, which reads "Checking the source…" while it
runs, creates the run once the source answers, or reads the file, and starts the run's dry run at
once, which writes nothing to the site; a run the site cannot start it for, because another run
of the site is running, stays Connected and a warning says why. The modal then closes and the run
shows in the table. A refusal on an earlier step returns the window there and the form's error
flash names the step ({:put_flash, kind, message}).
Every flash says what it means (MishkaCmsMigrationWeb.Flash): Dry run started and Import started
are info, Run cancelled is a success, a step the run refuses is info, and a run that is not there
is an error.
A run's row
Dry run, Run again, Import and Cancel reach this page as {:row_action, "dry_run" | "import" | "cancel", %{"id" => id}}. The page reads the run as the table does, a master's through
:master_get on any site, a site admin's on their own site alone, and runs
MishkaCmsMigration.start_dry_run/2, MishkaCmsMigration.start_import/2 or
MishkaCmsMigration.cancel_run/2 as the signed-in admin, on the run's site. It says so in a
flash; a run it cannot read, such as another site's id sent by hand, or a step the run refuses,
such as a second dry run while one of the site's runs is running, is said in Gervaz's words for
a failed row action (MishkaGervaz.Errors.format_flash_message/2), and nothing changes.
Items, on a row, is a link to the run's Items page
(MishkaCmsMigrationWeb.Live.Admin.Dashboard.Item.Index).
An expanded row ({:expand_row, id}) shows the run, read the same way, as
MishkaCmsMigrationWeb.Live.Admin.Dashboard.Home.RunDetails draws it: where it is and when it
got there, the warning for users an import created (PasswordNotice), what its last report found kind by kind and its latest items, each with links to its
CMS record, how far a running job is, why a failed run stopped, and what its source said of
itself and the admin chose. The page keeps which row it last expanded and draws it again on each
of that run's notifications, so a dry run moving on, or finishing, shows in it without a reload.
Logs
Logs, beside the table's count, is the core's activity feed
(MishkaCmsCoreWeb.Live.Admin.Components.ActivityFeed, as the runtime pages show theirs) over
the runs' log alone (MishkaCmsMigration.Activity): each step of a run, newest first, in the
sentence the bell says, who took it and on which site. It reads the latest entries the first
time it opens and adds each new one as its broadcast arrives.
Who may open it is the sidebar's declaration (MishkaCmsMigrationWeb.SidebarMenu), which
MishkaCmsCore.Sidebar.PageGuard reads on every mount.
Summary
Functions
Callback implementation for Phoenix.LiveView.render/1.
Functions
Callback implementation for Phoenix.LiveView.render/1.