Skip to content
Snippets Groups Projects
footerView.go 1015 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"
    	"google.golang.org/grpc"
    )
    
    
    //FooterView is an application view to display the footer of the application it
    //consists multiple other application views
    
    Malte Bauch's avatar
    Malte Bauch committed
    type FooterView struct {
    	footerView         *tview.Flex
    	databaseStatusView *DatabaseStatusView
    	gRPCStatusView     *GRPCStatusView
    }
    
    
    //NewFooterView creates a new FooterView
    
    Malte Bauch's avatar
    Malte Bauch committed
    func NewFooterView(app *app.App, conn *grpc.ClientConn) *FooterView {
    
    	fw := &FooterView{
    		footerView:         tview.NewFlex(),
    		databaseStatusView: NewDatabaseStatusView(app),
    		gRPCStatusView:     NewGRPCStatusView(app, conn),
    	}
    	fw.footerView.
    		SetBorder(true).
    		SetTitle("Status")
    
    	fw.footerView.
    		AddItem(fw.gRPCStatusView.GetContent(), 0, 1, false).
    		AddItem(fw.databaseStatusView.GetContent(), 0, 1, false)
    
    	return fw
    }
    
    
    //GetContent returns the tview.Primitive belonging to the FooterView
    
    Malte Bauch's avatar
    Malte Bauch committed
    func (fw *FooterView) GetContent() tview.Primitive {
    	return fw.footerView
    }