Documentation
¶
Index ¶
- Constants
- Variables
- func FormatNumberWithCommas(n int) string
- func GetKeyboardShortcutHelperForPage(page string) string
- func GetStateColorMapping(text string) (color tcell.Color, hasMapping bool)
- func PadSelectorTitle(title string) string
- type App
- func (a *App) ApplyHighlighting(text string) string
- func (a *App) ClearSelectionFromCurrentView()
- func (a *App) CloseCommandModal(commandPageName string, targetPage string, previousFocus tview.Primitive)
- func (a *App) ExecutePluginForShortcut(key tcell.Key, page string, rowId string)
- func (a *App) GetCurrentPage() *tview.Primitive
- func (a *App) GetCurrentPageName() string
- func (a *App) GetCurrentStuiView() *StuiView
- func (a *App) GetProviderForPage(page string) model.DataProvider[*model.TableData]
- func (a *App) HideSearchBox()
- func (a *App) ParsePluginCommand(command string, data map[string]string, page string) string
- func (a *App) RefreshAndRenderCurrentView()
- func (a *App) RefreshAndRenderPage(pageName string)
- func (a *App) RefreshClusterMetadata()
- func (a *App) RenderCurrentView()
- func (a *App) SetHeaderGridInnerContents(content ...tview.Primitive)
- func (a *App) SetupJobStateSelector()
- func (a *App) SetupKeybinds()
- func (a *App) SetupNodeStateSelector()
- func (a *App) SetupPartitionSelector()
- func (a *App) SetupSacctMgrEntitySelector()
- func (a *App) SetupSearchBox()
- func (a *App) SetupSortSelector()
- func (a *App) SetupViews()
- func (a *App) ShowCommandModal(command string, pageName string, executeImmediately bool, ...)
- func (a *App) ShowJobDetails(jobID string)
- func (a *App) ShowModalPopupMinimal(details string)
- func (a *App) ShowModalPopupString(title, details string)
- func (a *App) ShowModalPopupTable(title string, table *tview.Table)
- func (a *App) ShowNodeDetails(nodeName string)
- func (a *App) ShowNotification(text string, after time.Duration)
- func (a *App) ShowSacctJobDetails(jobID string)
- func (a *App) ShowSearchBox(grid *tview.Grid)
- func (a *App) ShowStandardCommandModal(command string, selectedMap map[string]bool, pageName string)
- func (a *App) StartRefresh()
- func (a *App) SwitchToPage(pageName string)
- func (a *App) UpdateAppTitle()
- func (a *App) UpdateHeaderLineOne(v string)
- func (a *App) UpdateHeaderLineTwo(v string)
- type StatePattern
- type StuiView
- type StuiViewInt
Constants ¶
View Source
const ( NODES_PAGE = "nodes" JOBS_PAGE = "jobs" SACCTMGR_PAGE = "sacctmgr" SACCT_PAGE = "sacct" SDIAG_PAGE = "sdiag" COMMAND_PAGE = "command_modal" )
View Source
const ( SORT_NONE = 0 SORT_ASC = 1 SORT_DESC = -1 )
View Source
const ( // These constants make tview code more readable in column/row assignment operations. FRST_ROW = 0 SCND_ROW = 1 THRD_ROW = 2 FRTH_ROW = 3 FFTH_ROW = 4 FRST_COL = 0 SCND_COL = 1 THRD_COL = 2 FRTH_COL = 3 FFTH_COL = 4 )
View Source
const (
NO_KEY_FOUND = -1
)
Variables ¶
View Source
var ( BAD_STATE_COLOR = tcell.ColorRed MID_STATE_COLOR = tcell.ColorOrange SUCCESS_STATE_COLOR = tcell.ColorSpringGreen RESUMING_STATE_COLOR = tcell.ColorLightCyan INACTIVE_STATE_COLOR = tcell.Color248 // Light Gray // StatePriorityList defines the order of precedence for color-coding states. // Earlier entries in the list take priority over later ones. StatePriorityList = []struct { State string Color tcell.Color }{ {"POWERING_UP", RESUMING_STATE_COLOR}, {"RESUMING", RESUMING_STATE_COLOR}, {"REBOOTING", RESUMING_STATE_COLOR}, {"BOOT_FAIL", BAD_STATE_COLOR}, {"CANCELLED", BAD_STATE_COLOR}, {"DEADLINE", BAD_STATE_COLOR}, {"FAILED", BAD_STATE_COLOR}, {"NODE_FAIL", BAD_STATE_COLOR}, {"OUT_OF_MEMORY", BAD_STATE_COLOR}, {"PREEMPTED", BAD_STATE_COLOR}, {"TIMEOUT", BAD_STATE_COLOR}, {"DOWN", BAD_STATE_COLOR}, {"DRAINED", BAD_STATE_COLOR}, {"DRAIN", BAD_STATE_COLOR}, {"UNKNOWN", BAD_STATE_COLOR}, {"UNK", BAD_STATE_COLOR}, {"FAIL", BAD_STATE_COLOR}, {"POWERED_DOWN", INACTIVE_STATE_COLOR}, {"FUTURE", INACTIVE_STATE_COLOR}, {"NO_RESPOND", BAD_STATE_COLOR}, {"NOT_RESPONDING", BAD_STATE_COLOR}, {"SUSPENDED", MID_STATE_COLOR}, {"PENDING", MID_STATE_COLOR}, {"DRAINING", MID_STATE_COLOR}, {"POWERING_DOWN", MID_STATE_COLOR}, {"POWER_DOWN", MID_STATE_COLOR}, {"MAINT", MID_STATE_COLOR}, {"BLOCKED", MID_STATE_COLOR}, {"COMPLETED", SUCCESS_STATE_COLOR}, } StatePatterns []StatePattern )
Functions ¶
func FormatNumberWithCommas ¶
FormatNumberWithCommas adds thousand separators to an integer e.g., 1000 -> "1,000", 1000000 -> "1,000,000"
func GetKeyboardShortcutHelperForPage ¶
Update helper keybinds
func GetStateColorMapping ¶
func PadSelectorTitle ¶
Types ¶
type App ¶
type App struct {
App *tview.Application
Pages *tview.Pages
PagesContainer *tview.Flex // Container for pages with border title
CurrentTableView *tview.Table // Points to current table view
FirstRenderComplete bool
// Base app components
HeaderGrid *tview.Grid
HeaderGridInnerContents *tview.Grid
MainFlex *tview.Flex
// Footer
HeaderLineOne *tview.TextView
HeaderLineTwo *tview.TextView
HeaderLineThree *tview.TextView
// Current tab indicators
TabNodesBox *tview.TextView
TabJobsBox *tview.TextView
TabSchedulerBox *tview.TextView
TabAccountingMgrBox *tview.TextView
TabAccountingBox *tview.TextView
// Dropdown selectors
PartitionSelector *tview.DropDown
SacctMgrEntitySelector *tview.DropDown
NodeStateSelector *tview.DropDown
JobStateSelector *tview.DropDown
SortSelector *tview.DropDown
// Search state
SearchBox *tview.InputField
SearchActive bool
SearchPattern string
// Command modal state
CommandModalOpen bool
// Data and providers
PartitionsData *model.TableData
PartitionsProvider model.DataProvider[*model.TableData]
NodesProvider model.DataProvider[*model.TableData]
JobsProvider model.DataProvider[*model.TableData]
SacctMgrProvider model.DataProvider[*model.TableData]
SacctProvider model.DataProvider[*model.TableData]
SdiagProvider model.DataProvider[*model.TextData]
// New style views
NodesView *StuiView
JobsView *StuiView
SacctMgrView *StuiView
SacctView *StuiView
SchedView *tview.TextView // Special case, text only
// contains filtered or unexported fields
}
func InitializeApplication ¶
func InitializeApplication() *App
Initializes a `stui` instance tview Application using the config module
func (*App) ApplyHighlighting ¶
func (*App) ClearSelectionFromCurrentView ¶
func (a *App) ClearSelectionFromCurrentView()
func (*App) CloseCommandModal ¶
func (*App) ExecutePluginForShortcut ¶
Exec a plugin command when on a particular page
func (*App) GetCurrentPage ¶
func (*App) GetCurrentPageName ¶
func (*App) GetCurrentStuiView ¶
func (*App) GetProviderForPage ¶
func (*App) HideSearchBox ¶
func (a *App) HideSearchBox()
func (*App) ParsePluginCommand ¶
func (*App) RefreshAndRenderCurrentView ¶
func (a *App) RefreshAndRenderCurrentView()
func (*App) RefreshAndRenderPage ¶
func (*App) RefreshClusterMetadata ¶
func (a *App) RefreshClusterMetadata()
func (*App) RenderCurrentView ¶
func (a *App) RenderCurrentView()
func (*App) SetHeaderGridInnerContents ¶
Add each given primitive as a row to the top-left header area.
func (*App) SetupJobStateSelector ¶
func (a *App) SetupJobStateSelector()
func (*App) SetupKeybinds ¶
func (a *App) SetupKeybinds()
func (*App) SetupNodeStateSelector ¶
func (a *App) SetupNodeStateSelector()
func (*App) SetupPartitionSelector ¶
func (a *App) SetupPartitionSelector()
func (*App) SetupSacctMgrEntitySelector ¶
func (a *App) SetupSacctMgrEntitySelector()
func (*App) SetupSearchBox ¶
func (a *App) SetupSearchBox()
func (*App) SetupSortSelector ¶
func (a *App) SetupSortSelector()
func (*App) SetupViews ¶
func (a *App) SetupViews()
func (*App) ShowCommandModal ¶
func (*App) ShowJobDetails ¶
func (*App) ShowModalPopupMinimal ¶
func (*App) ShowModalPopupString ¶
func (*App) ShowModalPopupTable ¶
func (*App) ShowNodeDetails ¶
func (*App) ShowSacctJobDetails ¶
func (*App) ShowSearchBox ¶
func (*App) ShowStandardCommandModal ¶
func (*App) StartRefresh ¶
func (a *App) StartRefresh()
Starts periodic background processes to refresh data
func (*App) SwitchToPage ¶
func (*App) UpdateAppTitle ¶
func (a *App) UpdateAppTitle()
func (*App) UpdateHeaderLineOne ¶
func (*App) UpdateHeaderLineTwo ¶
type StatePattern ¶
type StuiView ¶
type StuiView struct {
// View components
Table *tview.Table
Grid *tview.Grid
Selection map[string]bool
// contains filtered or unexported fields
}
func NewStuiView ¶
func NewStuiView( title string, provider model.DataProvider[*model.TableData], updateTitleFunc func(string) *tview.Box, errorNotifyFunc func(string), dataStateNotifyFunc func(string), cellClickFunction func(string), headerClickFunction func(int) *tview.DropDown, searchStringPointer *string, ) *StuiView
func (*StuiView) FetchAndRender ¶
func (s *StuiView) FetchAndRender()
func (*StuiView) FetchIfStaleAndRender ¶
func (*StuiView) SetSearchEnabled ¶
func (*StuiView) SetTitleHeader ¶
type StuiViewInt ¶
type StuiViewInt interface {
// Renders this component in tview, without affecting underlying data
Render()
// Sets regex filter for rows filtering
SetFilter()
// Sets search status
SetSearchEnabled(bool)
// Updates data from provider and renders the view
FetchAndRender()
}
Click to show internal directories.
Click to hide internal directories.