Documentation ¶
Index ¶
- Variables
- func DefaultColorer(ns string, h Header, re *RowEvent) tcell.Color
- func GenericHydrate(ns string, table *metav1.Table, rr Rows, re Renderer) error
- func Hydrate(ns string, oo []runtime.Object, rr Rows, re Renderer) error
- func IsValid(ns string, h Header, r Row) bool
- func Less(isNumber, isDuration, isCapacity bool, id1, id2, v1, v2 string) bool
- type ColorerFunc
- type DecoratorFunc
- type DeltaRow
- type Fields
- type FilterOpts
- type Generic
- type Header
- func (h Header) Clear() Header
- func (h Header) Clone() Header
- func (h Header) ColumnNames(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) IndexOf(colName string, includeWide bool) (int, bool)
- func (h Header) IsCapacityCol(col int) bool
- 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
- type HeaderColumn
- type ReRangeFn
- type Renderer
- type ResEvent
- type Row
- type RowEvent
- type RowEventSorter
- type RowEvents
- func (r *RowEvents) Add(re RowEvent)
- func (r *RowEvents) At(i int) (RowEvent, bool)
- func (r *RowEvents) Clear()
- func (r *RowEvents) Clone() *RowEvents
- func (r *RowEvents) Customize(cols []int) *RowEvents
- func (r *RowEvents) Delete(fqn string) error
- func (r *RowEvents) Diff(re *RowEvents, ageCol int) bool
- func (r *RowEvents) Empty() bool
- func (r *RowEvents) ExtractHeaderLabels(labelCol int) []string
- func (r *RowEvents) FindIndex(id string) (int, bool)
- func (r *RowEvents) Get(id string) (RowEvent, bool)
- func (r *RowEvents) Labelize(cols []int, labelCol int, labels []string) *RowEvents
- func (r *RowEvents) Len() int
- func (r *RowEvents) Range(f ReRangeFn)
- func (r *RowEvents) Set(i int, re RowEvent)
- func (r *RowEvents) Sort(ns string, sortCol int, isDuration, numCol, isCapacity, asc bool)
- func (r *RowEvents) Upsert(re RowEvent)
- type RowSorter
- type Rows
- type SortColumn
- type SortFn
- type TableData
- func (t *TableData) AddRow(re RowEvent)
- func (t *TableData) Clear()
- func (t *TableData) Clone() *TableData
- func (t *TableData) ColumnNames(w bool) []string
- func (t *TableData) Customize(vs *config.ViewSetting, sc SortColumn, manual, wide bool) (*TableData, SortColumn)
- func (t *TableData) Delete(newKeys map[string]struct{})
- func (t *TableData) Diff(t2 *TableData) bool
- func (t *TableData) Empty() bool
- func (t *TableData) Filter(f FilterOpts) *TableData
- func (t *TableData) FindRow(id string) (RowEvent, bool)
- func (t *TableData) GetHeader() Header
- func (t *TableData) GetNamespace() string
- func (t *TableData) GetRowEvents() *RowEvents
- func (t *TableData) HeadCol(n string, w bool) (HeaderColumn, int)
- func (t *TableData) Header() Header
- func (t *TableData) HeaderCount() int
- func (t *TableData) IndexOfHeader(h string) (int, bool)
- func (t *TableData) Labelize(labels []string) *TableData
- func (t *TableData) Reconcile(ctx context.Context, r Renderer, oo []runtime.Object) error
- func (t *TableData) Reset(ns string)
- func (t *TableData) RowAt(idx int) (RowEvent, bool)
- func (t *TableData) RowCount() int
- func (t *TableData) RowsRange(f ReRangeFn)
- func (t *TableData) SetHeader(ns string, h Header)
- func (t *TableData) SetRow(idx int, re RowEvent)
- func (t *TableData) SetRowEvents(re *RowEvents)
- func (t *TableData) Sort(sc SortColumn)
- func (t *TableData) Update(rows Rows)
Constants ¶
This section is empty.
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 )
Functions ¶
func DefaultColorer ¶
DefaultColorer set the default table row colors.
func GenericHydrate ¶
Types ¶
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 FilterOpts ¶
type Generic ¶
type Generic interface { // SetTable sets up the resource tabular definition. SetTable(ns string, table *metav1.Table) // Header returns a resource header. Header(ns string) Header // Render renders the resource. Render(o interface{}, ns string, row *Row) error }
Generic represents a generic resource.
type Header ¶
type Header []HeaderColumn
Header represents a table header.
func (Header) ColumnNames ¶
ColumnNames return header col names
func (Header) IsCapacityCol ¶
IsCapacityCol checks if given column index represents a capacity.
func (Header) IsMetricsCol ¶
IsMetricsCol checks if given column index represents metrics.
type HeaderColumn ¶
type HeaderColumn struct { Name string Align int Decorator DecoratorFunc Wide bool MX bool Time bool Capacity bool VS bool }
HeaderColumn represent a table header.
type Renderer ¶
type Renderer interface { // IsGeneric identifies a generic handler. IsGeneric() bool // Render converts raw resources to tabular data. Render(o interface{}, ns string, row *Row) error // Header returns the resource header. Header(ns string) Header // ColorerFunc returns a row colorer function. ColorerFunc() ColorerFunc }
Renderer represents a resource renderer.
type ResEvent ¶
type ResEvent int
ResEvent represents a resource event.
const ( NAValue = "na" // 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 IsCapacity 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 struct {
// contains filtered or unexported fields
}
RowEvents a collection of row events.
func NewRowEvents ¶
func NewRowEventsWithEvts ¶
func (*RowEvents) ExtractHeaderLabels ¶
ExtractHeaderLabels extract header labels.
type RowSorter ¶
type RowSorter struct { Rows Rows Index int IsNumber bool IsDuration bool IsCapacity bool Asc bool }
RowSorter sorts rows.
type Rows ¶
type Rows []Row
Rows represents a collection of rows.
type SortColumn ¶
SortColumn represents a sortable column.
type SortFn ¶
type SortFn func(rows Rows, sortCol SortColumn)
SortFn represent a function that can sort columnar data.
type TableData ¶
type TableData struct {
// contains filtered or unexported fields
}
TableData tracks a K8s resource for tabular display.
func NewTableDataFromTable ¶
func NewTableDataFull ¶
func NewTableDataWithRows ¶
func (*TableData) ColumnNames ¶
func (*TableData) Customize ¶
func (t *TableData) Customize(vs *config.ViewSetting, sc SortColumn, manual, wide bool) (*TableData, SortColumn)
Customize returns a new model with customized column layout.
func (*TableData) Filter ¶
func (t *TableData) Filter(f FilterOpts) *TableData
func (*TableData) GetNamespace ¶
func (*TableData) GetRowEvents ¶
func (*TableData) HeaderCount ¶
HeaderCount returns the number of header cols.
func (*TableData) IndexOfHeader ¶
IndexOfHeader return the index of the header.
func (*TableData) SetRowEvents ¶
func (*TableData) Sort ¶
func (t *TableData) Sort(sc SortColumn)