Skip to content
Snippets Groups Projects
addPNDView.go 823 B
Newer Older
  • Learn to ignore specific revisions
  • Malte Bauch's avatar
    Malte Bauch committed
    package views
    
    import (
    	"code.fbi.h-da.de/cocsn/gosdn/cmd/gosdn-tview/app"
    	"github.com/rivo/tview"
    )
    
    type AddPNDView struct {
    	addPNDView *tview.Form
    }
    
    func NewAddPNDView(app *app.App) *AddPNDView {
    	pndv := &AddPNDView{
    		addPNDView: tview.NewForm(),
    	}
    
    	pndv.addPNDView.
    		SetBorder(true).
    		SetTitle("Add new PND")
    
    
    Malte Bauch's avatar
    Malte Bauch committed
    	pndv.addPNDView.
    		AddInputField("Name", "", 20, nil, nil).
    		AddInputField("description", "", 20, nil, nil).
    		AddDropDown("SI", []string{"Southbound 1", "Southbound 2", "Southbound 3", "Southbound 4"}, 0, nil).
    		AddButton("Send", func() {
    			//TODO: call grpc function here
    		}).
    		AddButton("Abort", func() {
    			app.SwitchPage("main")
    		}).
    		SetCancelFunc(func() {
    			app.SwitchPage("main")
    		})
    
    	return pndv
    }
    
    func (pndv *AddPNDView) GetContent() tview.Primitive {
    	return pndv.addPNDView
    }