package ui¶
Package ui serves a live browser view of an apply run: the plan's step graph drawn as cards that change color as steps start, finish, or fail. The server binds an ephemeral loopback port, serves one embedded page under a random token path so other local users cannot guess the URL, and streams step state changes over server-sent events. It is an observer only: it consumes the same ApplyEvent values the terminal renderer does and never blocks the scheduler.
Functions¶
func OpenBrowser¶
OpenBrowser tries to open url in the operator's browser and reports whether a command appeared to succeed. $BROWSER wins, then the platform opener, then a short list of common browsers.
Types¶
type Config¶
type Config struct {
Factory string
Stack string
Graph []runtime.StepNode
// contains filtered or unexported fields
}
Config names the run a Server displays.
type Server¶
Server is the live run view: an HTTP server plus the step state table it streams from. Create one with Start, feed it with Observe, end the stream with Complete, and shut it down with Close.
func Start¶
Start listens on an ephemeral loopback port and begins serving the run view for cfg.
func (*Server) Close¶
Close shuts the server down, closing any open event streams.
func (*Server) Complete¶
Complete ends the stream: it computes the run totals from the observed events and broadcasts the run-complete frame. message explains a failure that has no failed step, such as an interrupt; it is ignored when ok is true.
func (*Server) Observe¶
Observe records one apply event and forwards it to every connected client. It never blocks on a slow client.
func (*Server) URL¶
URL returns the address of the page, including the token path.
func (*Server) WaitServed¶
WaitServed blocks until some client has received the run-complete frame, or d has passed, and reports which happened. It returns false immediately when Complete has not been called.