Skip to content

fix(tui): align proxy listen port editing with CLI behavior#270

Open
paigeman wants to merge 1 commit into
SaladDay:mainfrom
paigeman:fix/tui-proxy-listen-port-editing
Open

fix(tui): align proxy listen port editing with CLI behavior#270
paigeman wants to merge 1 commit into
SaladDay:mainfrom
paigeman:fix/tui-proxy-listen-port-editing

Conversation

@paigeman

Copy link
Copy Markdown

Summary

The TUI proxy settings blocked editing the listen port whenever the local proxy was running.

This was stricter than the CLI behavior. The CLI already allows changing the selected app's preferred proxy listen port while the proxy is running, as long as that app does not currently have an active proxy worker.

This change brings the TUI behavior in line with the CLI:

  • listen address remains blocked while the local proxy is running
  • listen port is blocked only when the current app has an active proxy route
  • listen port can be edited while other app proxy routes are running

The TUI copy was also split so address and port guidance describe the correct action.

Changes

src-tauri/src/cli/tui/data.rs

  • Add ProxySnapshot::has_active_worker_for(...) to centralize active-worker checks for an app.
  • Reuse the helper from routes_current_app_through_proxy(...).

src-tauri/src/cli/tui/app/content_config.rs

  • Allow opening the listen port editor when the proxy is running but the current app has no active worker.
  • Keep listen address editing blocked while the proxy is running.
  • Show port-specific guidance based on whether the current app has an active worker.

src-tauri/src/cli/tui/app/overlay_handlers/dialogs.rs

  • Apply the same active-worker check when submitting the listen port input.
  • Keep submit-time protection in place if the app route starts after the input overlay was opened.

src-tauri/src/cli/tui/runtime_actions/settings.rs

  • Keep the runtime fallback aligned with the same rule: block port updates only when the selected app has an active worker.
  • Use a port-specific toast when that fallback blocks the update.

src-tauri/src/cli/tui/ui/config.rs

  • Show the edit key for listen port when the proxy is running but the current app is not actively routed.
  • Hide the edit key for listen port when the current app has an active worker.
  • Keep the listen address edit key hidden while the proxy is running.

src-tauri/src/cli/i18n.rs

src-tauri/src/cli/i18n/texts/config_actions.rs

  • Split the previous generic stop-before-edit copy into address-specific and port-specific messages.
  • Update the running-proxy hint so it describes the separate address and port rules.

src-tauri/src/cli/tui/app/tests.rs

src-tauri/src/cli/tui/ui/tests.rs

  • Cover editing listen port while the proxy is running for other apps.
  • Cover blocking listen port editing when the current app has an active worker.
  • Cover submit-time blocking when an active worker appears before confirming the input.
  • Cover the updated key hint and status guidance in the TUI rendering tests.

Closes #269

- allow editing the selected app proxy listen port while the proxy is running for other apps
- keep listen address blocked while the local proxy is running
- add active-worker helper for proxy snapshots and reuse it across TUI views and handlers
- split address and listen-port stop messages for hints, toasts, and runtime fallback
- cover running-proxy editability, active-worker blocking, and submit-time blocking in TUI tests
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.

Align TUI proxy listen port editing with CLI behavior

1 participant