TUN-3321: Add box around logs on UI

This commit is contained in:
Rachel Williams 2020-08-25 16:51:01 -07:00 committed by Areg Harutyunyan
parent 26fc20d406
commit 02587c1edc
1 changed files with 6 additions and 2 deletions

View File

@ -91,9 +91,13 @@ func (data *uiModel) LaunchUI(ctx context.Context, logger logger.Service, tunnel
grid.AddItem(connTable, 2, 1, 1, 1, 0, 0, false)
grid.AddItem(NewDynamicColorTextView().SetText(fmt.Sprintf("Metrics at [%s::b]%s/metrics", palette.url, data.metricsURL)), 3, 1, 1, 1, 0, 0, false)
// Add TextView to stream logs
// LOGS header is displayed in bold
grid.AddItem(logTextView.SetText("[::b]LOGS:[::-]\n\n").SetChangedFunc(handleNewText(app, logTextView)), 4, 0, 5, 2, 0, 0, false)
// Logs are displayed in a new grid so a border can be set around them
logGrid := tview.NewGrid().SetBorders(true).AddItem(logTextView.SetChangedFunc(handleNewText(app, logTextView)), 0, 0, 5, 2, 0, 0, false)
// LogFrame holds the Logs header as well as the grid with the textView for streamed logs
logFrame := tview.NewFrame(logGrid).AddText("[::b]Logs:[::-]", true, tview.AlignLeft, tcell.ColorWhite).SetBorders(0, 0, 0, 0, 0, 0)
grid.AddItem(logFrame, 4, 0, 5, 2, 0, 0, false)
go func() {
for {