exlab_wizard.ui.pages.wizard_project#

New Project Wizard (Frontend Spec §4).

Seven steps in a ui.stepper:

  1. LIMS Project picker (Backend §7.2 cache or offline catalogue).

  2. Template Selection.

  3. Equipment Selection.

  4. Variable Form (auto-generated from copier.yml).

  5. README Form (mandatory core fields pinned at top).

  6. Preview (validator gate; Frontend §4 step 6).

  7. Confirm & Create (progress bar, error pane, success card).

The page is split into render-time-only logic (this module) and the controller-side validation, which is delegated to the FastAPI session endpoints. The UI’s per-step validation is for UX immediacy; the backend remains authoritative.

Functions

can_advance(state)

Return True when the active step's preconditions are satisfied.

disk_space_pre_flight_message(state)

Return a copy-ready message when disk space is low; else None.

preview_step_clear(state)

Pre-flight checks for the Preview step (Frontend §10.5.4).

render_project_wizard(*[, state, templates, ...])

Render the seven-step project wizard.

Classes

ProjectWizardState([active_step, ...])

Mutable state for the in-flight wizard.

class exlab_wizard.ui.pages.wizard_project.ProjectWizardState(active_step='lims_project', selected_lims_short_id=None, lims_project_name='', selected_lims_source='manual', selected_template=None, selected_template_path=None, selected_equipment=None, template_variables=<factory>, readme_fields=<factory>, validator_findings=<factory>, free_disk_bytes=None, plugin_host_ok=True, progress=<factory>, progress_refresh=None)[source]#

Bases: object

Mutable state for the in-flight wizard.

Parameters:
active_step: str = 'lims_project'#
free_disk_bytes: int | None = None#
lims_project_name: str = ''#
plugin_host_ok: bool = True#
progress: SessionProgressState#
progress_refresh: Callable[[...], Any] | None = None#
readme_fields: dict[str, str]#
selected_equipment: str | None = None#
selected_lims_short_id: str | None = None#
selected_lims_source: str = 'manual'#
selected_template: str | None = None#
selected_template_path: Path | None = None#
template_variables: dict[str, Any]#
validator_findings: list[dict[str, Any]]#
exlab_wizard.ui.pages.wizard_project.can_advance(state)[source]#

Return True when the active step’s preconditions are satisfied.

Centralised here so the Next button enablement and any Cmd/Ctrl+Enter shortcut share a single rule set.

Parameters:

state (ProjectWizardState)

Return type:

bool

exlab_wizard.ui.pages.wizard_project.disk_space_pre_flight_message(state)[source]#

Return a copy-ready message when disk space is low; else None.

Parameters:

state (ProjectWizardState)

Return type:

str | None

exlab_wizard.ui.pages.wizard_project.preview_step_clear(state)[source]#

Pre-flight checks for the Preview step (Frontend §10.5.4).

Parameters:

state (ProjectWizardState)

Return type:

bool

exlab_wizard.ui.pages.wizard_project.render_project_wizard(*, state=None, templates=None, equipment_ids=None, template_questions=None, template_paths=None, on_resolve=None, lims_projects=None, on_submit=None, on_cancel=None)[source]#

Render the seven-step project wizard.

templates is the list of project-scope template names the operator can pick from; equipment_ids is the configured equipment list; template_questions maps each template name to its parsed copier.yml questions (drives the dynamic Variables step); template_paths maps each name to the resolved absolute source path; lims_projects is the cache / offline-catalogue project list backing the LIMS project picker. Each step binds real inputs into state so the confirm step’s on_submit sees a fully populated ProjectWizardState.

on_resolve enables per-instance template resolution: when supplied, the template step re-resolves the offered project templates from the operator’s chosen equipment, so a per-equipment project template shadows a same-named global one. It is called with (equipment_id) and returns a TemplateChoices. Because the equipment step (step 3) follows the template step (step 2), the template panel re-resolves whenever equipment changes (and reflects it on a step-back). When on_resolve is None the static templates list is used unchanged (the pre-resolver behaviour).

Returns the NiceGUI dialog (or, in tests, a payload describing the rendered steps).

Parameters:
Return type:

Any