Skip to content

promtop/ui: open the web dashboard with w, quit with Q too - #6

Merged
igorrius merged 1 commit into
mainfrom
tui-web-key
Oct 29, 2026
Merged

igorrius merged 1 commit into
mainfrom
tui-web-key

Conversation

@igorrius

@igorrius igorrius commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • w in the terminal UI starts the web dashboard on -web-addr (default: a free localhost port) and opens it in the browser; pressing it again reopens the page. The footer shows the URL, or the error (port taken, no browser).
  • The page is fed by the TUI's scrapes: no second scrape loop against the target, interval changes (+/-) and pause carry over. History starts at the press, seeded with the last scrape. It stops when the TUI exits.
  • q is no longer case sensitive: Q quits, and closes details like q.

Changes

  • internal/web/server.go: Run split into Listen (returns the URL) + Serve; Config.Fed, Ingest, SetInterval; OpenBrowser exported. -web behaves as before.
  • internal/ui: w binding, openWeb, scrapes forwarded to the web server, footer status; Run cancels its context on exit.
  • internal/cli: passes -web-addr to the TUI.
  • README: key table and a note in the web section.

Test plan

  • go test ./..., go test -race ./internal/ui ./internal/web
  • golangci-lint run ./...
  • New tests: TestQuitAnyCase, TestWebKey (serves the API, second w reuses the server, interval reaches the page)
  • Manual: promtop :8080, press w, +, p, Q

🤖 Generated with Claude Code

https://claude.ai/code/session_01US3HyDhtjkx1WRPE6UfeFH

The w key starts the web dashboard next to the terminal UI and opens it in
the browser. It is fed with the terminal's scrapes (no second scrape loop),
so it follows the interval and pause; the footer shows its URL.

web.Server gains Listen/Serve (Run is built on them), a Fed mode with
Ingest and SetInterval, and an exported OpenBrowser.

q is no longer case sensitive: Q quits and closes details as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01US3HyDhtjkx1WRPE6UfeFH
@igorrius igorrius self-assigned this Oct 29, 2026
@igorrius
igorrius merged commit 3b2a9d1 into main Oct 29, 2026
5 checks passed
@igorrius
igorrius deleted the tui-web-key branch October 29, 2026 08:43
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