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
No related branches found
No related tags found
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 (
//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
......
......@@ -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).
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment