Documentation ¶
Index ¶
- Constants
- Variables
- func AsPerc(p string) string
- func AsThousands(n int64) string
- func DefaultColorer(ns string, h Header, re RowEvent) tcell.Color
- func Happy(ns string, h Header, r Row) bool
- func IntToStr(p int) string
- func Less(asc, isNumber, isDuration bool, c1, c2 string) bool
- func Pad(s string, width int) string
- func PrintPerc(p int) string
- func Truncate(str string, width int) string
- type Base
- type ColorerFunc
- type DecoratorFunc
- type DeltaRow
- type Fields
- type Header
- func (h Header) Clone() Header
- func (h Header) Columns(wide bool) []string
- func (h Header) Customize(cols []string, wide bool) Header
- func (h Header) Diff(header Header) bool
- func (h Header) Dump()
- func (h Header) HasAge() bool
- func (h Header) HasST() bool
- func (h Header) HasUT() bool
- func (h Header) IndexOf(colName string, includeWide bool) int
- func (h Header) IsMetricsCol(col int) bool
- func (h Header) IsTimeCol(col int) bool
- func (h Header) Labelize(cols []int, labelCol int, rr RowEvents) Header
- func (h Header) MapIndices(cols []string, wide bool) []int
- func (h Header) ValidColIndex() int
- type HeaderColumn
- type IdSorter
- type Namespace
- type Process
- type ResEvent
- type Row
- type RowEvent
- type RowEventSorter
- type RowEvents
- func (r RowEvents) Clear() RowEvents
- func (r RowEvents) Clone() RowEvents
- func (r RowEvents) Customize(cols []int) RowEvents
- func (r RowEvents) Delete(id string) RowEvents
- func (r RowEvents) Diff(re RowEvents, ageCol int) bool
- func (r RowEvents) ExtractHeaderLabels(labelCol int) []string
- func (r RowEvents) FindIndex(id string) (int, bool)
- func (r RowEvents) Labelize(cols []int, labelCol int, labels []string) RowEvents
- func (r RowEvents) Sort(ns string, sortCol int, isDuration, numCol, asc bool)
- func (r RowEvents) Upsert(re RowEvent) RowEvents
- type RowSorter
- type Rows
- type StringSet
- type TableData
- func (t *TableData) Clear()
- func (t *TableData) Clone() TableData
- func (t *TableData) Customize(cols []string, wide bool) TableData
- func (t *TableData) Delete(newKeys map[string]struct{})
- func (t *TableData) Diff(table TableData) bool
- func (t *TableData) IndexOfHeader(h string) int
- func (t *TableData) Labelize(labels []string) TableData
- func (t *TableData) SetHeader(ns string, h Header)
- func (t *TableData) Update(rows Rows)
Constants ¶
const ( // Terminating represents a pod terminating status. Terminating = "Terminating" // Running represents a pod running status. Running = "RUNNING" // Initialized represents a pod initialized status. Initialized = "Initialized" // Completed represents a pod completed status. Completed = "Completed" // ContainerCreating represents a pod container status. ContainerCreating = "ContainerCreating" // PodInitializing represents a pod initializing status. PodInitializing = "PodInitializing" // Pending represents a pod pending status. Pending = "Pending" // Blank represents no value. Blank = "" EXCEPTION = "EXCEPTION" OPEN = "OPEN" CLOSED = "CLOSED" )
const ( // MissingValue indicates an unset value. MissingValue = "<none>" // NAValue indicates a value that does not pertain. NAValue = "n/a" // UnknownValue represents an unknown. UnknownValue = "<unknown>" // UnsetValue represent an unset value. UnsetValue = "" // ZeroValue represents a zero value. ZeroValue = "0" )
const (
// NonResource represents a custom resource.
NonResource = "*"
)
Variables ¶
var ( // ModColor row modified color. ModColor tcell.Color // AddColor row added color. AddColor tcell.Color // PendingColor row added color. PendingColor tcell.Color // ErrColor row err color. ErrColor tcell.Color // StdColor row default color. StdColor tcell.Color // HighlightColor row highlight color. HighlightColor tcell.Color // KillColor row deleted color. KillColor tcell.Color // CompletedColor row completed color. CompletedColor tcell.Color )
var AgeDecorator = func(a string) string {
return toAgeHuman(a)
}
AgeDecorator represents a timestamped as human column.
Functions ¶
func AsThousands ¶
AsThousands prints a number with thousand separator.
func DefaultColorer ¶
DefaultColorer set the default table row colors.
Types ¶
type Base ¶
type Base struct{}
type ColorerFunc ¶
ColorerFunc represents a resource row colorer.
type DeltaRow ¶
type DeltaRow []string
DeltaRow represents a collection of row deltas between old and new row.
func NewDeltaRow ¶
NewDeltaRow computes the delta between 2 rows.
type Fields ¶
type Fields []string
Fields represents a collection of row fields.
type Header ¶
type Header []HeaderColumn
Header represents a table header.
func (Header) IsMetricsCol ¶
IsMetricsCol checks if given column index represents metrics.
func (Header) MapIndices ¶
MapIndices returns a collection of mapped column indices based of the requested columns.
func (Header) ValidColIndex ¶
ValidColIndex returns the valid col index or -1 if none.
type HeaderColumn ¶
type HeaderColumn struct { Name string Align int Decorator DecoratorFunc Hide bool Wide bool MX bool Time bool }
HeaderColumn represent a table header.
type Namespace ¶
type Namespace struct {
Base
}
Namespace renders a K8s Namespace to screen.
func (Namespace) ColorerFunc ¶
func (n Namespace) ColorerFunc() ColorerFunc
ColorerFunc colors a resource row.
type Process ¶
type Process struct {
Base
}
Process renders a K8s Pod to screen.
func (Process) ColorerFunc ¶
func (p Process) ColorerFunc() ColorerFunc
ColorerFunc colors a resource row.
type ResEvent ¶
type ResEvent int
ResEvent represents a resource event.
const ( // EventUnchanged notifies listener resource has not changed. EventUnchanged ResEvent = 1 << iota // EventAdd notifies listener of a resource was added. EventAdd // EventUpdate notifies listener of a resource updated. EventUpdate // EventDelete notifies listener of a resource was deleted. EventDelete // EventClear the stack was reset. EventClear )
type Row ¶
Row represents a collection of columns.
type RowEvent ¶
RowEvent tracks resource instance events.
func NewRowEvent ¶
NewRowEvent returns a new row event.
func NewRowEventWithDeltas ¶
NewRowEventWithDeltas returns a new row event with deltas.
func (RowEvent) ExtractHeaderLabels ¶
ExtractHeaderLabels extract collection of fields into header.
type RowEventSorter ¶
type RowEventSorter struct { Events RowEvents Index int NS string IsNumber bool IsDuration bool Asc bool }
RowEventSorter sorts row events by a given colon.
func (RowEventSorter) Len ¶
func (r RowEventSorter) Len() int
func (RowEventSorter) Less ¶
func (r RowEventSorter) Less(i, j int) bool
func (RowEventSorter) Swap ¶
func (r RowEventSorter) Swap(i, j int)
type RowEvents ¶
type RowEvents []RowEvent
RowEvents a collection of row events.
func (RowEvents) ExtractHeaderLabels ¶
ExtractHeaderLabels extract header labels.
type Rows ¶
type Rows []Row
Rows represents a collection of rows.
type StringSet ¶
type StringSet []string
StringSet represents a collection of unique strings.
type TableData ¶
TableData tracks a K8s resource for tabular display.
func (*TableData) IndexOfHeader ¶
IndexOfHeader return the index of the header.