diff --git a/cmd/gosdn-tview/views/commandsListView.go b/cmd/gosdn-tview/views/commandsListView.go index c83a516dd2b723d325c1f10615775e3805c0b127..745fd4523a568c081cf66b37c078ae831d2ec3ca 100644 --- a/cmd/gosdn-tview/views/commandsListView.go +++ b/cmd/gosdn-tview/views/commandsListView.go @@ -9,17 +9,19 @@ import ( //CommandListView is an application view to display all the goSDN commands type CommandListView struct { + title string commandsList *tview.List } //NewCommandListView creates a new CommandListView -func NewCommandListView() *CommandListView { +func NewCommandListView(title string) *CommandListView { cv := &CommandListView{ + title: title, commandsList: tview.NewList(), } cv.commandsList. SetBorder(true). - SetTitle("Commands") + SetTitle(cv.title) return cv } @@ -29,6 +31,11 @@ func (cv *CommandListView) GetContent() tview.Primitive { return cv.commandsList } +//GetTitle returns the title of the specific view +func (cv *CommandListView) GetTitle() string { + return cv.title +} + //GetCommands gets all goSDN commands from a command list and creates new //tview.List items for each one of them. The specific gRPC functions are added //as tview.Selected() function diff --git a/cmd/gosdn-tview/views/footerView.go b/cmd/gosdn-tview/views/footerView.go index 09ff7d7dd0771036655b5291f2a5c278dc6ce72a..b79ce1054a104b24040860d7fa20eef1da42519e 100644 --- a/cmd/gosdn-tview/views/footerView.go +++ b/cmd/gosdn-tview/views/footerView.go @@ -22,9 +22,6 @@ func NewFooterView(app *app.App, conn *grpc.ClientConn) *FooterView { databaseStatusView: NewDatabaseStatusView(app), gRPCStatusView: NewGRPCStatusView(app, conn), } - fw.footerView. - SetBorder(true). - SetTitle("Status") fw.footerView. AddItem(fw.gRPCStatusView.GetContent(), 0, 1, false). diff --git a/cmd/gosdn-tview/views/mainView.go b/cmd/gosdn-tview/views/mainView.go index 51ed950f315aaef30f65e22e2bf6d8ec66c0fed5..22aa23ed911316da10e7a14fd89c199e81513730 100644 --- a/cmd/gosdn-tview/views/mainView.go +++ b/cmd/gosdn-tview/views/mainView.go @@ -23,7 +23,7 @@ func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView { mv := &MainView{ pages: tview.NewPages(), mainGrid: tview.NewGrid(), - commandsListView: NewCommandListView(), + commandsListView: NewCommandListView("commands"), headerView: NewHeaderView(), footerView: NewFooterView(app, conn), } @@ -36,7 +36,8 @@ func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView { AddItem(mv.headerView.GetContent(), 0, 0, 1, 2, 0, 0, false). AddItem(mv.footerView.GetContent(), 2, 0, 1, 2, 0, 0, false) - mv.mainGrid.AddItem(mv.commandsListView.GetContent(), 1, 0, 1, 1, 0, 0, true). + mv.mainGrid. + AddItem(mv.commandsListView.GetContent(), 1, 0, 1, 1, 0, 0, true). AddItem(mv.resultAndInputView.GetContent(), 1, 1, 1, 1, 0, 0, false) mv.pages.AddPage("main", mv.mainGrid, true, true)