mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
tui, added clear button for output
This commit is contained in:
parent
1d15eeb8da
commit
87ee71c274
1 changed files with 9 additions and 2 deletions
11
tui.go
11
tui.go
|
@ -448,7 +448,7 @@ func (t *tui) messageSlide(app *tview.Application) tview.Primitive {
|
|||
AddItem(tview.NewFlex().
|
||||
// Add the log form.
|
||||
AddItem(p.logForm, 0, 1, false),
|
||||
0, 2, false)
|
||||
0, 1, false)
|
||||
|
||||
m := tuiMessage{}
|
||||
|
||||
|
@ -687,6 +687,8 @@ func (t *tui) console(app *tview.Application) tview.Primitive {
|
|||
|
||||
p.selectForm = tview.NewForm()
|
||||
p.selectForm.SetBorder(true).SetTitle("select").SetTitleAlign(tview.AlignLeft)
|
||||
p.selectForm.SetButtonsAlign(tview.AlignCenter)
|
||||
p.selectForm.SetHorizontal(false)
|
||||
|
||||
p.outputForm = tview.NewTextView()
|
||||
p.outputForm.SetBorder(true).SetTitle("output").SetTitleAlign(tview.AlignLeft)
|
||||
|
@ -731,7 +733,7 @@ func (t *tui) console(app *tview.Application) tview.Primitive {
|
|||
p.selectForm.AddFormItem(messageDropdown)
|
||||
|
||||
// Add button for manually updating dropdown menus.
|
||||
p.selectForm.AddButton("update dropdown menus", func() {
|
||||
p.selectForm.AddButton("update", func() {
|
||||
nodesList, err := getNodeNames("nodeslist.cfg")
|
||||
if err != nil {
|
||||
fmt.Fprintf(p.outputForm, "error: failed to open nodeslist.cfg file\n")
|
||||
|
@ -742,6 +744,11 @@ func (t *tui) console(app *tview.Application) tview.Primitive {
|
|||
messageDropdown.SetLabel("message").SetOptions(msgsValues, nil)
|
||||
})
|
||||
|
||||
// Add button for clearing the output form.
|
||||
p.selectForm.AddButton("clear", func() {
|
||||
p.outputForm.Clear()
|
||||
})
|
||||
|
||||
// Update the dropdown menus when the flex view gets focus.
|
||||
p.flex.SetFocusFunc(func() {
|
||||
nodesList, err := getNodeNames("nodeslist.cfg")
|
||||
|
|
Loading…
Reference in a new issue