mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-05 14:56:49 +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().
|
AddItem(tview.NewFlex().
|
||||||
// Add the log form.
|
// Add the log form.
|
||||||
AddItem(p.logForm, 0, 1, false),
|
AddItem(p.logForm, 0, 1, false),
|
||||||
0, 2, false)
|
0, 1, false)
|
||||||
|
|
||||||
m := tuiMessage{}
|
m := tuiMessage{}
|
||||||
|
|
||||||
|
@ -687,6 +687,8 @@ func (t *tui) console(app *tview.Application) tview.Primitive {
|
||||||
|
|
||||||
p.selectForm = tview.NewForm()
|
p.selectForm = tview.NewForm()
|
||||||
p.selectForm.SetBorder(true).SetTitle("select").SetTitleAlign(tview.AlignLeft)
|
p.selectForm.SetBorder(true).SetTitle("select").SetTitleAlign(tview.AlignLeft)
|
||||||
|
p.selectForm.SetButtonsAlign(tview.AlignCenter)
|
||||||
|
p.selectForm.SetHorizontal(false)
|
||||||
|
|
||||||
p.outputForm = tview.NewTextView()
|
p.outputForm = tview.NewTextView()
|
||||||
p.outputForm.SetBorder(true).SetTitle("output").SetTitleAlign(tview.AlignLeft)
|
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)
|
p.selectForm.AddFormItem(messageDropdown)
|
||||||
|
|
||||||
// Add button for manually updating dropdown menus.
|
// Add button for manually updating dropdown menus.
|
||||||
p.selectForm.AddButton("update dropdown menus", func() {
|
p.selectForm.AddButton("update", func() {
|
||||||
nodesList, err := getNodeNames("nodeslist.cfg")
|
nodesList, err := getNodeNames("nodeslist.cfg")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(p.outputForm, "error: failed to open nodeslist.cfg file\n")
|
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)
|
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.
|
// Update the dropdown menus when the flex view gets focus.
|
||||||
p.flex.SetFocusFunc(func() {
|
p.flex.SetFocusFunc(func() {
|
||||||
nodesList, err := getNodeNames("nodeslist.cfg")
|
nodesList, err := getNodeNames("nodeslist.cfg")
|
||||||
|
|
Loading…
Add table
Reference in a new issue