Skip to content

Sandbox TUI page with create wizard #781

@mathiasbourgoin

Description

@mathiasbourgoin

Summary

Dedicated TUI page for sandbox management. TUI-first design with list view, detail panel, and action keys. Includes a Form_builder-based create wizard.

Blocked by: #779 (sandbox orchestration library)

Design

Page layout

╭─ Sandbox ─────────────────────────────────────────────────────────╮
│                                                                    │
│  ● sandbox-mainnet     mainnet    ● node ● baker    head: 7234601 │
│    sandbox-ghostnet    ghostnet   ○ node ○ baker    —             │
│                                                                    │
│  ┌─ Details ──────────────────────────────────────────────────┐   │
│  │  Name:       sandbox-mainnet                               │   │
│  │  Network:    mainnet (isolated, no peers)                  │   │
│  │  Node:       sandbox-mainnet-node     ● running            │   │
│  │  Baker:      sandbox-mainnet-baker    ● running            │   │
│  │  Head:       7,234,601                                     │   │
│  │  Delegates:  20 (top by staking power)                     │   │
│  │  RPC:        http://127.0.0.1:8732                         │   │
│  │  Wallet:     ~/.octez-manager/sandbox/sandbox-mainnet/...  │   │
│  └────────────────────────────────────────────────────────────┘   │
│                                                                    │
│  c:Create  s:Start  S:Stop  d:Destroy  a:Add Account  r:RPC      │
╰────────────────────────────────────────────────────────────────────╯

Actions (keyboard-driven)

Key Action UX
c Create sandbox Navigate to sandbox create form (Form_builder wizard)
s Start sandbox Job_manager.submitLifecycle.start_group → toast
S Stop sandbox Job_manager.submitLifecycle.stop_group → toast
d Destroy sandbox Modal_helpers.confirm_modalJob_manager.submitSandbox.destroy → toast
a Add account Modal_helpers.prompt_validated_text_modal for tz address → Job_manager.submitYes_wallet.add_account → toast
r Open RPC browser Context.navigate to RPC page with sandbox node instance
Enter Toggle details Expand/collapse detail panel

Changes

6a. Sandbox list page

  • File: src/ui/pages/sandbox_page.ml
  • State: list of sandbox groups + selected index + expanded details
  • Layout: Flex column (header / sandbox list / detail panel / footer)
  • Detail panel: Description_list with sandbox info (name, network, node/baker status, head, delegates, RPC, wallet path)
  • Data access:
    • Sandbox list: Group_registry.list_sandboxes() — called in refresh, NOT in view. Cache in state, refresh every ~5s or on dirty flag.
    • Node/baker status: existing Data cache (service status)
    • Head level: Rpc_scheduler cache for the sandbox node instance
  • Use Themed_page.Make wrapper

6b. Create form (Form_builder wizard)

  • File: src/ui/pages/sandbox_create_form.ml
  • Uses Form_builder.Make pattern (like install_node_form_v3.ml)
  • Fields:
    • Network: choice field (dynamic list from Network_config)
    • Snapshot: custom field — choice between Auto (tzinit), File path (file browser modal), or URL (text input)
    • Name: text field, auto-filled as sandbox-<network>, editable, validated for duplicates + safe chars
    • RPC Address: validated text, default 127.0.0.1:8732
    • Max Delegates: validated number, default 20
  • on_submit: Job_manager.submit calling Sandbox.create with ~on_progress logging via append_log

6c. Registration

  • File: src/ui/pages/manager_app.ml — register Sandbox_page and Sandbox_create_form
  • Add navigation entry (keyboard shortcut or menu item from instances page)

6d. Dependencies

  • File: src/ui/dune — add octez_manager_sandbox dependency

Key TUI patterns to follow

  • NO I/O in view functions — all data from caches/schedulers
  • Job_manager.submit for background operations
  • Modal_helpers.* for confirmations and text input
  • Context.toast_* for feedback
  • Context.mark_instances_dirty() after mutations
  • Description_list for the detail panel
  • Flex_layout for responsive page structure

Reference files

  • src/ui/pages/instances.ml — list page pattern
  • src/ui/pages/install_node_form_v3.ml — Form_builder wizard
  • src/ui/job_manager.ml — background operation API
  • src/ui/modal_helpers.mli — modal dialogs API
  • src/ui/context.mli — toasts, navigation, dirty flags

Verification

  • TUI: Sandbox page shows sandbox list with status
  • TUI: c opens create wizard with all fields
  • TUI: Create submits via Job_manager, shows progress, toast on completion
  • TUI: Start/Stop/Destroy actions work with toast feedback
  • TUI: Add Account prompts for address and adds to wallet
  • TUI: RPC key navigates to RPC page with correct instance

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsandboxSandbox mode: isolated chain with yes_crypto

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions