exlab_wizard.ui.components.tree#

Project / equipment tree (Frontend Spec §3.5).

Renders the <equipment>/<project>/<run> hierarchy:

  • Equipment node – equipment ID in heading color.

  • Project node – human name + short_id, with optional archived / deleted-from-LIMS treatment.

  • Run node (experimental) – Run_<DATE> + label.

  • Run node (test) – dimmed styling + TestRun_ prefix in warning-tier color + a “Test” pill.

Run rows also carry a small sync icon to the left of the label:

  • sync_local.svg – run data is still on local disk (any sync status other than cleaned).

  • sync_cloud.svg – run has been synced, verified, and locally cleaned (sync_status == "cleaned"); only the .exlab-wizard/ cache subtree remains on disk (§7.1.10).

.exlab-wizard/ folders are hidden by default (Frontend §13.1) and hidden filtering is the caller’s concern.

The component returns a NiceGUI ui.tree configured with a list of node dicts; tests can assert on the data shape without spinning up NiceGUI.

Functions

build_nodes(*, hierarchy, filters)

Translate a hierarchy into a list of TreeNode.

build_tree(*, hierarchy[, on_select, ...])

Build the project / equipment tree.

filter_project(project, filters)

Return True when project should be rendered.

filter_run(run, filters)

Return True when run should be rendered.

to_nicegui_nodes(nodes)

Convert TreeNode instances to NiceGUI ui.tree dicts.

Classes

EquipmentNode(equipment_id)

ProjectNode(short_id, name[, status])

RunNode(directory_name, run_kind[, label, ...])

TreeFilters([active, archived, test_runs, ...])

Filter chip state passed to the tree (Frontend §3.5.4).

TreeNode(node_id, label, kind[, children, ...])

A renderable tree node (post-filter).

class exlab_wizard.ui.components.tree.EquipmentNode(equipment_id)[source]#

Bases: object

Parameters:

equipment_id (str)

equipment_id: str#
class exlab_wizard.ui.components.tree.ProjectNode(short_id, name, status=TreeProjectStatus.ACTIVE)[source]#

Bases: object

Parameters:
  • short_id (str)

  • name (str)

  • status (TreeProjectStatus)

name: str#
short_id: str#
status: TreeProjectStatus = 'active'#
class exlab_wizard.ui.components.tree.RunNode(directory_name, run_kind, label=None, sync_status=None)[source]#

Bases: object

Parameters:
  • directory_name (str)

  • run_kind (RunKind)

  • label (str | None)

  • sync_status (str | None)

directory_name: str#
label: str | None = None#
run_kind: RunKind#
sync_status: str | None = None#
class exlab_wizard.ui.components.tree.TreeFilters(active=True, archived=False, test_runs=True, search='')[source]#

Bases: object

Filter chip state passed to the tree (Frontend §3.5.4).

Parameters:
active: bool = True#
archived: bool = False#
search: str = ''#
test_runs: bool = True#
class exlab_wizard.ui.components.tree.TreeNode(node_id, label, kind, children=<factory>, badges=<factory>, style_hints=<factory>, sync_status=None)[source]#

Bases: object

A renderable tree node (post-filter).

Parameters:
badges: tuple[str, ...]#
children: tuple[TreeNode, ...]#
kind: str#
label: str#
node_id: str#
style_hints: dict[str, str]#
sync_status: str | None = None#
exlab_wizard.ui.components.tree.build_nodes(*, hierarchy, filters)[source]#

Translate a hierarchy into a list of TreeNode.

Parameters:
Return type:

list[TreeNode]

exlab_wizard.ui.components.tree.build_tree(*, hierarchy, on_select=None, filters=None, expand_all=False)[source]#

Build the project / equipment tree.

Returns the NiceGUI ui.tree element, or the immutable nodes list when called outside of a NiceGUI app context (tests).

expand_all toggles Quasar’s default-expand-all prop – used by e2e tests that need every node visible in the DOM without having to click expand carets.

Parameters:
Return type:

Any

exlab_wizard.ui.components.tree.filter_project(project, filters)[source]#

Return True when project should be rendered.

Active default-on; Archived default-off. Deleted-from-LIMS rows always render (Frontend §3.5.3).

Parameters:
Return type:

bool

exlab_wizard.ui.components.tree.filter_run(run, filters)[source]#

Return True when run should be rendered.

Test runs default-on; toggling the chip off hides them.

Parameters:
Return type:

bool

exlab_wizard.ui.components.tree.to_nicegui_nodes(nodes)[source]#

Convert TreeNode instances to NiceGUI ui.tree dicts.

Run rows additionally carry a sync_icon URL string and a sync_status string used by the default-header scoped-slot template attached in build_tree().

Parameters:

nodes (Iterable[TreeNode])

Return type:

list[dict[str, Any]]