Skip to content
Snippets Groups Projects
Commit 1ed4b802 authored by Malte Bauch's avatar Malte Bauch
Browse files

added GetTitle to some views

parent 505c943b
Branches
Tags
3 merge requests!90Develop,!71Resolve "Stream logger-output to goSDN-tview via gRPC",!53V.0.1.0 Codename Threadbare
Pipeline #53256 passed
This commit is part of merge request !53. Comments created here will be created in the context of that merge request.
...@@ -9,17 +9,19 @@ import ( ...@@ -9,17 +9,19 @@ import (
//CommandListView is an application view to display all the goSDN commands //CommandListView is an application view to display all the goSDN commands
type CommandListView struct { type CommandListView struct {
title string
commandsList *tview.List commandsList *tview.List
} }
//NewCommandListView creates a new CommandListView //NewCommandListView creates a new CommandListView
func NewCommandListView() *CommandListView { func NewCommandListView(title string) *CommandListView {
cv := &CommandListView{ cv := &CommandListView{
title: title,
commandsList: tview.NewList(), commandsList: tview.NewList(),
} }
cv.commandsList. cv.commandsList.
SetBorder(true). SetBorder(true).
SetTitle("Commands") SetTitle(cv.title)
return cv return cv
} }
...@@ -29,6 +31,11 @@ func (cv *CommandListView) GetContent() tview.Primitive { ...@@ -29,6 +31,11 @@ func (cv *CommandListView) GetContent() tview.Primitive {
return cv.commandsList 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 //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 //tview.List items for each one of them. The specific gRPC functions are added
//as tview.Selected() function //as tview.Selected() function
......
...@@ -22,9 +22,6 @@ func NewFooterView(app *app.App, conn *grpc.ClientConn) *FooterView { ...@@ -22,9 +22,6 @@ func NewFooterView(app *app.App, conn *grpc.ClientConn) *FooterView {
databaseStatusView: NewDatabaseStatusView(app), databaseStatusView: NewDatabaseStatusView(app),
gRPCStatusView: NewGRPCStatusView(app, conn), gRPCStatusView: NewGRPCStatusView(app, conn),
} }
fw.footerView.
SetBorder(true).
SetTitle("Status")
fw.footerView. fw.footerView.
AddItem(fw.gRPCStatusView.GetContent(), 0, 1, false). AddItem(fw.gRPCStatusView.GetContent(), 0, 1, false).
......
...@@ -23,7 +23,7 @@ func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView { ...@@ -23,7 +23,7 @@ func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView {
mv := &MainView{ mv := &MainView{
pages: tview.NewPages(), pages: tview.NewPages(),
mainGrid: tview.NewGrid(), mainGrid: tview.NewGrid(),
commandsListView: NewCommandListView(), commandsListView: NewCommandListView("commands"),
headerView: NewHeaderView(), headerView: NewHeaderView(),
footerView: NewFooterView(app, conn), footerView: NewFooterView(app, conn),
} }
...@@ -36,7 +36,8 @@ func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView { ...@@ -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.headerView.GetContent(), 0, 0, 1, 2, 0, 0, false).
AddItem(mv.footerView.GetContent(), 2, 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) AddItem(mv.resultAndInputView.GetContent(), 1, 1, 1, 1, 0, 0, false)
mv.pages.AddPage("main", mv.mainGrid, true, true) mv.pages.AddPage("main", mv.mainGrid, true, true)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment