widgets

package
v0.0.0-...-2eb1f2f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnterMenu = Item{
		Name:        "enter",
		Icon:        "enter",
		Description: "Select Row",
	}
	UpArrowMenu = Item{
		Name:        "up_arrow",
		Icon:        "↑",
		Description: "Move UP",
	}
	DownArrowMenu = Item{
		Name:        "down_arrow",
		Icon:        "↓",
		Description: "Move Down",
	}
	EscMenu = Item{
		Name:        "esc",
		Icon:        "esc",
		Description: "Go Back",
	}
	ContextMenu = Item{
		Name:        "region_namespace",
		Icon:        "2",
		Description: "Context",
	}
	CreateJobNMenu = Item{
		Name:        "create_new_jb",
		Icon:        "3",
		Description: "Create New Job",
	}
	LogMenu = Item{
		Name:        "log",
		Icon:        "l",
		Description: "Show Log",
	}
	StdoutMenu = Item{
		Name:        "stdout",
		Icon:        "o",
		Description: "STDOUT Logs",
	}
	StderrMenu = Item{
		Name:        "stderr",
		Icon:        "e",
		Description: "STDERR Logs",
	}
	VersionMenu = Item{
		Name:        "versions",
		Icon:        "v",
		Description: "Show Job Versions",
	}
	RevertMenu = Item{
		Name:        "revert_version",
		Icon:        "ctrl+v",
		Description: "Revert Version",
	}
	RestartTaskMenu = Item{
		Name:        "restart_task",
		Icon:        "ctrl+t",
		Description: "Restart Task",
	}
	StopJobMenu = Item{
		Name:        "stop_job",
		Icon:        "ctrl+q",
		Description: "Stop Job",
	}
	StartJobMenu = Item{
		Name:        "start_job",
		Icon:        "ctrl+s",
		Description: "Start Job",
	}
	NodeMenu = Item{
		Name:        "nodes",
		Icon:        "1",
		Description: "Nodes",
	}
	LogAutoScrollMenu = Item{
		Name:        "log_autoscroll",
		Icon:        "a",
		Description: "Autoscroll",
	}
	DefinitionMenu = Item{
		Name:        "job_definition",
		Icon:        "d",
		Description: "Definition",
	}
	RunJobMenu = Item{
		Name:        "run_job",
		Icon:        "ctrl+j",
		Description: "Run Job",
	}
)
View Source
var DefaultGlobalMenus = []Item{
	NodeMenu,
	ContextMenu,
	CreateJobNMenu,
}

Functions

func MenuExist(menu *Menu, name string) bool

Types

type Flex

type Flex struct {
	*tview.Flex
}

func NewFlex

func NewFlex() *Flex

func (*Flex) AddItemX

func (f *Flex) AddItemX(primitive tview.Primitive, fixedSize, proportion int, focus bool)

func (*Flex) ClearFlex

func (f *Flex) ClearFlex()

func (*Flex) FullScreen

func (f *Flex) FullScreen(on bool)

func (*Flex) SetTitleX

func (f *Flex) SetTitleX(title, a string)

type Item

type Item struct {
	Name        string
	Description string
	Icon        string
}

type MapView

type MapView struct {
	*tview.Table
	Keys   []string
	Values []string
	Size   int
}

func NewMapView

func NewMapView() *MapView

func (*MapView) Clear

func (mv *MapView) Clear()

func (*MapView) DrawMapView

func (mv *MapView) DrawMapView()

func (*MapView) KeyCell

func (mv *MapView) KeyCell(key string) *tview.TableCell

func (*MapView) SetMapKeyValue

func (mv *MapView) SetMapKeyValue(key, value string)

func (*MapView) SetMapKeys

func (mv *MapView) SetMapKeys(keys []string)

func (*MapView) SetMapValues

func (mv *MapView) SetMapValues(values []string)

func (*MapView) ValueCell

func (mv *MapView) ValueCell(value string) *tview.TableCell
type Menu struct {
	*Flex
	Grid1   *MapView
	Grid2   *MapView
	Grid3   *MapView
	Items   []Item
	Default []Item
}

func NewMenu

func NewMenu() *Menu
func (m *Menu) Add(menu Item, refresh bool) *Menu
func (m *Menu) Remove(menu Item)
func (m *Menu) RemoveMenus(menus []Item)
func (m *Menu) Render()
func (m *Menu) RenderGlobalMenus()
func (m *Menu) RenderMenu(menus []Item, addDefaults bool)
func (m *Menu) Replace(item1 Item, item2 Item)
type Modal struct {
	*tview.Modal
	Title   string
	Buttons []string
}

func NewModal

func NewModal() *Modal

func (*Modal) SetButtons

func (m *Modal) SetButtons(buttons []string)

func (*Modal) SetDoneFn

func (m *Modal) SetDoneFn(fn func(int, string))

func (*Modal) SetModalTitle

func (m *Modal) SetModalTitle(title string)

type Modal1

type Modal1 struct {
	*tview.Frame
	Content   *tview.TextView
	Title     string
	PageTitle string
	Buttons   []string
}

func NewModal1

func NewModal1() *Modal1

func (*Modal1) GetPageTitle

func (m *Modal1) GetPageTitle() string

func (*Modal1) SetDataX

func (m *Modal1) SetDataX(data string)

func (*Modal1) SetModalInputHandler

func (m *Modal1) SetModalInputHandler(handler func(event *tcell.EventKey) *tcell.EventKey)

func (*Modal1) SetModalTitle

func (m *Modal1) SetModalTitle(title string)

type Pages

type Pages struct {
	*tview.Pages
	ActivePage string
	History    []string
}

func NewPages

func NewPages() *Pages

func (*Pages) AddHistory

func (p *Pages) AddHistory(name string)

func (*Pages) AddPageX

func (p *Pages) AddPageX(name string, item tview.Primitive, resize, visible bool)

func (*Pages) FlushHistory

func (p *Pages) FlushHistory()

func (*Pages) GetActivePage

func (p *Pages) GetActivePage() string

func (*Pages) GoBack

func (p *Pages) GoBack()

func (*Pages) HistoryPop

func (p *Pages) HistoryPop() string

func (*Pages) OpenPage1

func (p *Pages) OpenPage1(name string, addHistory bool)

func (*Pages) OpenPageX

func (p *Pages) OpenPageX(name string, addHistory bool)

func (*Pages) ShowPageX

func (p *Pages) ShowPageX(name string)

type Table

type Table struct {
	*tview.Table
	Title      string
	Data       map[string]string
	Headers    []string
	OnSelectFn func(int, int)
	OnTabPress func()
}

func NewTable

func NewTable(title string) *Table

func (*Table) BindFunctions

func (t *Table) BindFunctions()

func (*Table) BindKeys

func (t *Table) BindKeys()

func (*Table) ClearTable

func (t *Table) ClearTable()

func (*Table) DrawCell

func (t *Table) DrawCell(row, col int, value string, rowColor tcell.Color)

func (*Table) DrawHeader

func (t *Table) DrawHeader()

func (*Table) DrawHeaderLeft

func (t *Table) DrawHeaderLeft()

func (*Table) DrawLeftCell

func (t *Table) DrawLeftCell(row, col int, value string, rowColor tcell.Color)

func (*Table) GetSelectedItem

func (t *Table) GetSelectedItem() map[string]string

func (*Table) SetFocusBorderColor

func (t *Table) SetFocusBorderColor(color tcell.Color)

func (*Table) SetOnSelectFn

func (t *Table) SetOnSelectFn(fn func(int, int))

func (*Table) SetOnTabPressFn

func (t *Table) SetOnTabPressFn(fn func())

func (*Table) SetTableTitle

func (t *Table) SetTableTitle(count int, a, b string)

type TextArea

type TextArea struct {
	*tview.TextArea
	Title string
}

func NewTextArea

func NewTextArea(title string) *TextArea

func (*TextArea) SetBorderX

func (ta *TextArea) SetBorderX(border bool)

func (*TextArea) SetPlaceholderX

func (ta *TextArea) SetPlaceholderX(ph string)

func (*TextArea) SetTitleX

func (ta *TextArea) SetTitleX(title string)

func (*TextArea) WrapLines

func (ta *TextArea) WrapLines(wrap bool)

type TextView

type TextView struct {
	*tview.TextView
	Title string
}

func NewTextView

func NewTextView(title string) *TextView

func (*TextView) ClearX

func (tv *TextView) ClearX()

func (*TextView) SetTextAlignX

func (tv *TextView) SetTextAlignX(align string)

func (*TextView) SetTextVTitle

func (tv *TextView) SetTextVTitle(a, b string)

func (*TextView) SetTextX

func (tv *TextView) SetTextX(text string)

func (*TextView) SetTitleName

func (tv *TextView) SetTitleName(name string)

type UtilGauge

type UtilGauge struct {
	*tvxwidgets.UtilModeGauge
	Label string
}

func NewUtilGauge

func NewUtilGauge(label string) *UtilGauge

func PrimitiveToGauge

func PrimitiveToGauge(primitive tview.Primitive) *UtilGauge

func (*UtilGauge) SetValueX

func (ug *UtilGauge) SetValueX(value float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL