Documentation ¶
Index ¶
- Constants
- Variables
- func Center(p tview.Primitive, width, height int) tview.Primitive
- func Hex(e Element) string
- func Tcell(e Element) tcell.Color
- type Color
- type ColorMode
- type Console
- func (c *Console) DisplayErrorModal(msg string)
- func (c *Console) DisplayFilter(defaultValue string, answerCh chan<- string)
- func (c *Console) DisplayInfoModal(msg string, quitAnimationCh chan struct{}, answerCh chan error)
- func (c *Console) DisplayRate(defaultValue int, answerCh chan<- int)
- func (c *Console) DisplayRetryModal(msg, pageName string, answerCh chan bool)
- func (c *Console) DisplaySearch(defaultValue string, answerCh chan<- string)
- func (c *Console) DisplaySelectList(title string, audiences []*protos.Audience, ...)
- func (c *Console) DisplayTail(pageTail *tview.TextView, tailComponent *types.TailComponent, ...) *tview.TextView
- func (c *Console) DisplayViewOptions(defaultViewOptions *types.ViewOptions, answerCh chan<- *types.ViewOptions)
- func (c *Console) GetInputCapture() func(event *tcell.EventKey) *tcell.EventKey
- func (c *Console) Redraw(f func())
- func (c *Console) SetInputCapture(f func(event *tcell.EventKey) *tcell.EventKey)
- func (c *Console) SetMenuEntryOff(item string)
- func (c *Console) SetMenuEntryOn(item string)
- func (c *Console) Start()
- func (c *Console) Stop()
- func (c *Console) ToggleAllMenuHighlights()
- func (c *Console) ToggleMenuHighlight(regions ...string)
- type Element
- type Options
Constants ¶
const ( PrimitiveInfoModal = "info_modal" PrimitiveRetryModal = "retry_modal" PrimitiveErrorModal = "error_modal" PrimitiveList = "list" PrimitiveTailView = "tail_view" PrimitiveFilter = "filter" PrimitiveSearch = "search" PrimitiveRate = "rate" PageConnectionAttempt = "page_" + PrimitiveInfoModal PageConnectionRetry = "page_" + PrimitiveRetryModal PageSelectComponent = "page_" + PrimitiveList PageTailError = "page_" + PrimitiveErrorModal PageTailView = "page_" + PrimitiveTailView PageFilter = "page_" + PrimitiveFilter PageSearch = "page_" + PrimitiveSearch PageRate = "page_" + PrimitiveRate DefaultViewOptionsPrettyJSON = true DefaultViewOptionsEnableColors = true DefaultViewOptionsDisplayLineNumbers = true DefaultViewOptionsDisplayTimestamp = true )
Variables ¶
var ( ColorMap = map[Element]Color{ TextPrimary: { Name: "white", Hex256: "#FFFFFF", Tcell256: tcell.ColorWhite, Hex24Bit: "#FFFFFF", Tcell24Bit: tcell.ColorWhite, }, TextSecondary: { Name: "light purple", Hex256: fmt.Sprintf("#%X", tcell.Color141.Hex()), Tcell256: tcell.Color141, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(157, 135, 215)), Tcell24Bit: tcell.NewRGBColor(157, 135, 215), }, TextAccent1: { Name: "yellow", Hex256: fmt.Sprintf("#%X", tcell.Color221.Hex()), Tcell256: tcell.Color221, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(255, 204, 85).Hex()), Tcell24Bit: tcell.NewRGBColor(255, 204, 85), }, TextAccent2: { Name: "cyan", Hex256: fmt.Sprintf("#%X", tcell.Color44.Hex()), Tcell256: tcell.Color44, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(33, 196, 199).Hex()), Tcell24Bit: tcell.NewRGBColor(33, 196, 199), }, TextAccent3: { Name: "red", Hex256: fmt.Sprintf("#%X", tcell.Color203.Hex()), Tcell256: tcell.Color203, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(255, 114, 93).Hex()), Tcell24Bit: tcell.NewRGBColor(255, 114, 93), }, ActiveButtonBg: { Name: "red", Hex256: fmt.Sprintf("%X", tcell.Color203.Hex()), Tcell256: tcell.Color203, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(255, 114, 93).Hex()), Tcell24Bit: tcell.NewRGBColor(255, 114, 93), }, ActiveButtonFg: { Name: "white", Hex256: fmt.Sprintf("%X", tcell.ColorWhite.Hex()), Tcell256: tcell.ColorWhite, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(255, 255, 255).Hex()), Tcell24Bit: tcell.ColorWhite, }, InactiveButtonBg: { Name: "dark off-white", Hex256: fmt.Sprintf("#%X", tcell.Color188.Hex()), Tcell256: tcell.Color188, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(217, 217, 217).Hex()), Tcell24Bit: tcell.NewRGBColor(217, 217, 217), }, InactiveButtonFg: { Name: "dark grey", Hex256: fmt.Sprintf("#%X", tcell.Color239.Hex()), Tcell256: tcell.Color239, Hex24Bit: fmt.Sprintf("%X", tcell.Color239.Hex()), Tcell24Bit: tcell.ColorWhite, }, MenuActiveBg: { Name: "light gray", Hex256: fmt.Sprintf("#%X", tcell.Color188.Hex()), Tcell256: tcell.Color188, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(217, 217, 217).Hex()), Tcell24Bit: tcell.NewRGBColor(217, 217, 217), }, MenuInactiveFg: { Name: "", Hex256: fmt.Sprintf("#%X", tcell.Color141.Hex()), Tcell256: tcell.Color141, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(157, 135, 215).Hex()), Tcell24Bit: tcell.NewRGBColor(157, 135, 215), }, InputFieldFg: { Name: "very dark gray", Hex256: fmt.Sprintf("#%X", tcell.Color234.Hex()), Tcell256: tcell.Color234, Hex24Bit: fmt.Sprintf("#%X", tcell.Color234.Hex()), Tcell24Bit: tcell.Color234, }, InputFieldBg: { Name: "light off-white", Hex256: fmt.Sprintf("#%X", tcell.Color254.Hex()), Tcell256: tcell.Color254, Hex24Bit: fmt.Sprintf("#%X", tcell.Color254.Hex()), Tcell24Bit: tcell.Color254, }, WindowBg: { Name: "dark purple", Hex256: fmt.Sprintf("#%X", tcell.Color56.Hex()), Tcell256: tcell.Color56, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(36, 29, 55).Hex()), Tcell24Bit: tcell.NewRGBColor(36, 29, 55), }, CLIBg: { Name: "almost black", Hex256: fmt.Sprintf("#%X", tcell.Color236.Hex()), Tcell256: tcell.Color236, Hex24Bit: fmt.Sprintf("#%X", tcell.NewRGBColor(40, 40, 40).Hex()), Tcell24Bit: tcell.NewRGBColor(40, 40, 40), }, } DefaultColor = Color{ Name: "default white", Hex256: fmt.Sprintf("%X", tcell.ColorWhite.Hex()), Tcell256: tcell.ColorWhite, Hex24Bit: fmt.Sprintf("%X", tcell.ColorWhite.Hex()), Tcell24Bit: tcell.ColorWhite, } TerminalColorMode ColorMode // Set during init() )
var (
MenuString = `[white]Q[-] ["Q"][#9D87D7]Quit[-][""] ` +
`[white]S[-] ["S"][#9D87D7]Select Component[-][""] ` +
`[white]R[-] ["R"][#9D87D7::s]Set Sample Rate[-:-:-][""] ` +
`[white]F[-] ["F"][#9D87D7]Filter[-][""] ` +
`[white]P[-] ["P"][#9D87D7]Pause[-][""] ` +
`[white]O[-] ["O"][#9D87D7]View Options[-][""] ` +
`[white]/[-] ["Search"][#9D87D7]Search[-][""]`
)
Functions ¶
Types ¶
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
func (*Console) DisplayErrorModal ¶
func (*Console) DisplayFilter ¶
func (*Console) DisplayInfoModal ¶
DisplayInfoModal will display an animated modal with the given message. InputCh is used by caller to indicate that the modal can be closed (in this case, it will cause the method to stop the animation goroutine). OutputCh is used by method to inform caller that the user has exited the modal.
func (*Console) DisplayRate ¶
func (*Console) DisplayRetryModal ¶
DisplayRetryModal will display a modal with a given message + retry/quit buttons.
func (*Console) DisplaySearch ¶
func (*Console) DisplaySelectList ¶
func (c *Console) DisplaySelectList(title string, audiences []*protos.Audience, answerCh chan<- *types.TailComponent)
DisplaySelectList will display a list of items and return the select item on the output channel
func (*Console) DisplayTail ¶
func (c *Console) DisplayTail(pageTail *tview.TextView, tailComponent *types.TailComponent, actionCh chan<- *types.Action) *tview.TextView
DisplayTail will display tail + write any actions we receive from the user to the action channel; the action channel is read by the tail() method. Accepts an _optional_ pageTail to facilitate re-use of the tail view. This is needed so that when filter/pause is applied, the tail view retains the data captured within it.
func (*Console) DisplayViewOptions ¶
func (c *Console) DisplayViewOptions(defaultViewOptions *types.ViewOptions, answerCh chan<- *types.ViewOptions)
func (*Console) GetInputCapture ¶
func (c *Console) GetInputCapture() func(event *tcell.EventKey) *tcell.EventKey
func (*Console) SetInputCapture ¶
func (c *Console) SetInputCapture(f func(event *tcell.EventKey) *tcell.EventKey)
func (*Console) SetMenuEntryOff ¶
func (*Console) SetMenuEntryOn ¶
func (*Console) ToggleAllMenuHighlights ¶
func (c *Console) ToggleAllMenuHighlights()