Skip to content

Redesign the first-run onboarding wizard (simple + advanced, host-derived name) - #67

Merged
lance0 merged 1 commit into
masterfrom
feat/onboarding-simple-wizard
Jun 23, 2026
Merged

lance0 merged 1 commit into
masterfrom
feat/onboarding-simple-wizard

Conversation

@lance0

@lance0 lance0 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

What

Redesigns the first-run onboarding wizard to the "simple + advanced collapsed" shape, and fixes the root cause of the duplicate-profile gotcha from #66: the wizard hardcoded the profile name to default, so a user who onboarded in the TUI and then nbox profile added a real profile ended up with two.

The wizard now

┌ Welcome to nbox 0.9.0 ──────────────────────────── Esc: quit ┐
│Set up your first NetBox profile.                              │
│                                                              │
│url     https://netbox.acme.com                               │
│name    acme   (suggested)                                    │
│token   paste token to save (optional)                        │
│▸ Ctrl+A  advanced (token_env, auth_scheme, verify_tls)       │
│                                                              │
│Tab: field  Ctrl+A: advanced  Ctrl+T: test  Enter: save       │
└──────────────────────────────────────────────────────────────┘

Press Ctrl+A to reveal token_env / auth_scheme / verify_tls.

  • URL-first, three-field simple screen (url / name / token). The advanced knobs hide behind Ctrl+A.
  • Name derived from the URL host — https://netbox.acme.com → acme (a leading www./netbox. label is dropped; an IP or empty host falls back to prod). Shown live as a placeholder, committed on save only if you left it blank — so no more stray default profile. Type your own name and it's kept verbatim.
  • Tab walks only the visible fields (a hidden token_env is skipped); collapsing pulls focus back off a now-hidden field.

How

The wizard renders its fields individually now (it reorders and hides them), so this adds three small helpers in cheese.rs — TextInput::render_value / TextInput::set_placeholder / FormInput::set_focus. The shared add/edit ProfileForm used by the config editor is untouched — all the new behavior lives in onboarding.rs.

Tests

  • Name derivation (suggest_name_from_url): host-label strip + IP/empty → prod.
  • Ctrl+A toggles the visible field set; Tab skips the hidden token_env; collapsing re-anchors focus.
  • Blank name filled from the URL on save; reverted on a failed save (so the live suggestion returns); a typed name is never overwritten.
  • TestBackend render smoke tests for both simple and advanced modes (assert content + no panic).
  • Existing wizard/persist tests updated for the host-derived name.

Gate

cargo fmt --check, clippy --all-targets --all-features -D warnings, clippy --no-default-features, and cargo test in both feature modes — all green. Visual confirmed via a TestBackend frame dump.

Lead with the url and show a simple three-field screen (url / name / token);
the niche knobs (token_env, auth_scheme, verify_tls) tuck behind a Ctrl+A
"advanced" toggle. Tab walks only the visible fields, so a hidden token_env is
skipped; collapsing the advanced section pulls focus back if it sat on a now-
hidden field.

The profile name is no longer hardcoded to `default`. It's derived from the url
host (netbox.acme.com -> acme; a leading www./netbox. label is dropped; an IP or
empty host falls back to prod), shown live as a placeholder and committed on save
only if the user left it blank. This stops onboarding from planting a stray
`default` profile that duplicates one the user adds later on the CLI.

The wizard now renders its fields individually (it reorders/hides them), so add
small TextInput::render_value / set_placeholder and FormInput::set_focus helpers
in cheese.rs; the shared add/edit form (config editor) is untouched.

Covered by unit tests (name derivation, advanced toggle, focus-skip, blank-name
fill + revert-on-failure) and TestBackend render smoke tests for both modes.
@lance0
lance0 merged commit a63496f into master Jun 23, 2026
4 checks passed
@lance0
lance0 deleted the feat/onboarding-simple-wizard branch June 23, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant