Documentation
¶
Index ¶
- type ActionState
- type ResourceView
- func (v *ResourceView) ClearActionState(id string)
- func (v *ResourceView) ConfigureColumns(columns []string, configured bool)
- func (v *ResourceView) DeferRefresh(duration time.Duration)
- func (v *ResourceView) FetchGen() int64
- func (v *ResourceView) GetCurrentColumnFocused() string
- func (v *ResourceView) GetCurrentColumnSorted() string
- func (v *ResourceView) GetSelectedID() (string, error)
- func (v *ResourceView) GetSelectedIDs() ([]string, error)
- func (v *ResourceView) GetSourceHeaders() []string
- func (v *ResourceView) HighlightIDs(ids []string, bg, fg tcell.Color, duration time.Duration)
- func (v *ResourceView) InvalidateFetch()
- func (v *ResourceView) PopRefreshDelay() time.Duration
- func (v *ResourceView) ProjectCells(item dao.Resource) []string
- func (v *ResourceView) Refilter()
- func (v *ResourceView) ReleaseFetch(gen int64)
- func (v *ResourceView) ScheduleHighlight(match func(dao.Resource) bool, bg, fg tcell.Color, duration time.Duration)
- func (v *ResourceView) SetActionState(id, action string, color tcell.Color)
- func (v *ResourceView) SetFilter(filter string)
- func (v *ResourceView) SetKnownHeaders(headers []string)
- func (v *ResourceView) SetLoading(loading bool)
- func (v *ResourceView) SetSourceHeaders(headers []string)
- func (v *ResourceView) TryAcquireFetch() (int64, bool)
- func (v *ResourceView) Update(headers []string, data []dao.Resource)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionState ¶
type ResourceView ¶
type ResourceView struct {
Table *tview.Table
App common.AppController
Title string
Data []dao.Resource // Filtered/Sorted Data for display
RawData []dao.Resource // Original Data from last fetch
Filter string // User Filter (via /)
SortCol int
SortAsc bool
FocusCol int // Focused column for navigation/copy (independent of SortCol)
ColCount int // To avoid out of bound when switching views
SelectedIDs map[string]bool
ActionStates map[string]ActionState // ID -> Action State
Headers []string // Stored for rendering
ColumnWidths []int // Cache for column widths
CurrentScope *common.Scope // Tracks which scope the current data belongs to
IsLoading bool // Navigation lock
// Pinned sort: always applied first (unless user sorts on this column)
PinnedSortColumn string // Column name (e.g. "ANON"), resolved dynamically
PinnedSortAsc bool
InitialSortColumn string
// Optional Overrides
InputHandler func(event *tcell.EventKey) *tcell.EventKey
ShortcutsFunc func() []string
FetchFunc func(app common.AppController, view *ResourceView) ([]dao.Resource, error)
FetchWithHeadersFunc func(app common.AppController, view *ResourceView) ([]dao.Resource, []string, error)
InspectFunc func(app common.AppController, id string)
RemoveFunc func(id string, force bool, app common.AppController) error
PruneFunc func(app common.AppController) error
// contains filtered or unexported fields
}
ResourceView is the generic table view for any resource
func NewResourceView ¶
func NewResourceView(app common.AppController, title string) *ResourceView
func (*ResourceView) ClearActionState ¶
func (v *ResourceView) ClearActionState(id string)
func (*ResourceView) ConfigureColumns ¶ added in v0.49.104
func (v *ResourceView) ConfigureColumns(columns []string, configured bool)
ConfigureColumns sets the optional ordered list of columns to display.
func (*ResourceView) DeferRefresh ¶
func (v *ResourceView) DeferRefresh(duration time.Duration)
func (*ResourceView) FetchGen ¶ added in v0.49.97
func (v *ResourceView) FetchGen() int64
FetchGen returns the current fetch generation. A fetch whose acquired generation no longer matches must discard its results (stale context).
func (*ResourceView) GetCurrentColumnFocused ¶ added in v0.42.75
func (v *ResourceView) GetCurrentColumnFocused() string
GetCurrentColumnFocused returns the name of the column currently focused by the cursor
func (*ResourceView) GetCurrentColumnSorted ¶ added in v0.42.75
func (v *ResourceView) GetCurrentColumnSorted() string
GetCurrentColumnSorted returns the name of the column currently used for sorting
func (*ResourceView) GetSelectedID ¶
func (v *ResourceView) GetSelectedID() (string, error)
func (*ResourceView) GetSelectedIDs ¶
func (v *ResourceView) GetSelectedIDs() ([]string, error)
func (*ResourceView) GetSourceHeaders ¶ added in v0.49.104
func (v *ResourceView) GetSourceHeaders() []string
GetSourceHeaders returns a copy of the complete schema for the current scope.
func (*ResourceView) HighlightIDs ¶
func (*ResourceView) InvalidateFetch ¶ added in v0.49.97
func (v *ResourceView) InvalidateFetch()
InvalidateFetch cancels any in-flight fetch: its results will be dropped and the guard is freed so the new context can fetch immediately instead of waiting for the old (possibly hung) transport.
func (*ResourceView) PopRefreshDelay ¶
func (v *ResourceView) PopRefreshDelay() time.Duration
func (*ResourceView) ProjectCells ¶ added in v0.49.104
func (v *ResourceView) ProjectCells(item dao.Resource) []string
ProjectCells returns the cells visible in the configured order.
func (*ResourceView) Refilter ¶
func (v *ResourceView) Refilter()
Refilter re-applies filter and sort to cached RawData
func (*ResourceView) ReleaseFetch ¶ added in v0.49.95
func (v *ResourceView) ReleaseFetch(gen int64)
ReleaseFetch clears the in-flight guard, unless the fetch was invalidated (context reload) while it was running: in that case the guard now belongs to the new context's fetches.
func (*ResourceView) ScheduleHighlight ¶
func (*ResourceView) SetActionState ¶
func (v *ResourceView) SetActionState(id, action string, color tcell.Color)
func (*ResourceView) SetFilter ¶
func (v *ResourceView) SetFilter(filter string)
func (*ResourceView) SetKnownHeaders ¶ added in v0.49.104
func (v *ResourceView) SetKnownHeaders(headers []string)
SetKnownHeaders records every column a view can expose across scopes.
func (*ResourceView) SetLoading ¶ added in v0.42.75
func (v *ResourceView) SetLoading(loading bool)
SetLoading shows/hides the loading state
func (*ResourceView) SetSourceHeaders ¶ added in v0.49.104
func (v *ResourceView) SetSourceHeaders(headers []string)
SetSourceHeaders records the complete, canonical schema returned by a view. It does not redraw the table; Update applies the configured projection.
func (*ResourceView) TryAcquireFetch ¶ added in v0.49.95
func (v *ResourceView) TryAcquireFetch() (int64, bool)
TryAcquireFetch reports whether a new background fetch may start. It returns false while another fetch for this view is still running, preventing refresh ticks from piling up on slow (SSH) transports. The returned generation must be passed back to ReleaseFetch.