Newer
Older
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
type FooterView struct {
footerView *tview.Flex
databaseStatusView *DatabaseStatusView
gRPCStatusView *GRPCStatusView
}
//NewFooterView creates a new FooterView
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
func (fw *FooterView) GetContent() tview.Primitive {
return fw.footerView
}