ui

package
v0.8.0-a.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenBrowser

func OpenBrowser(url string) bool

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

type Server struct {
	// contains filtered or unexported fields
}

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

func Start(cfg Config) (*Server, error)

Start listens on an ephemeral loopback port and begins serving the run view for cfg.

func (*Server) Close

func (s *Server) Close()

Close shuts the server down, closing any open event streams.

func (*Server) Complete

func (s *Server) Complete(ok bool, message string)

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

func (s *Server) Observe(ev runtime.ApplyEvent)

Observe records one apply event and forwards it to every connected client. It never blocks on a slow client.

func (*Server) URL

func (s *Server) URL() string

URL returns the address of the page, including the token path.

func (*Server) WaitServed

func (s *Server) WaitServed(d time.Duration) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL