func DisplayList()

in pkg/display/graph/tree/list.go [41:91]


func DisplayList(ctx *cli.Context, displayable *d.Displayable) error {
	data := displayable.Data.(api.TraceBrief)
	condition := displayable.Condition.(*api.TraceQueryCondition)
	if err := ui.Init(); err != nil {
		logger.Log.Fatalf("failed to initialize termui: %v", err)
	}
	defer ui.Close()

	list := widgets.NewList()
	list.TitleStyle.Fg = ui.ColorRed
	list.TextStyle = ui.NewStyle(ui.ColorYellow)
	list.WrapText = false
	list.SelectedRowStyle = ui.Style{
		Fg:       ui.ColorBlack,
		Bg:       ui.ColorWhite,
		Modifier: ui.ModifierBold,
	}
	tree := widgets.NewTree()
	tree.TextStyle = ui.NewStyle(ui.ColorYellow)
	tree.WrapText = false
	tree.TitleStyle.Fg = ui.ColorRed
	tree.SelectedRowStyle = ui.Style{
		Fg:       ui.ColorBlack,
		Bg:       ui.ColorWhite,
		Modifier: ui.ModifierBold,
	}

	help := widgets.NewParagraph()
	help.WrapText = false
	help.Title = KeyMap
	help.Text = `[<Left>     ](fg:red,mod:bold) list activated
		[<Right>    ](fg:red,mod:bold) tree activated
		[K or <Up>  ](fg:red,mod:bold) list or tree Scroll Up
		[j or <Down>](fg:red,mod:bold) list or tree Scroll Down
		[<Ctr-b>    ](fg:red,mod:bold) list Page Up
		[<Ctr-f>    ](fg:red,mod:bold) list Page Down
		[p          ](fg:red,mod:bold) list Page Up
		[n          ](fg:red,mod:bold) list Page Down
		[<Home>     ](fg:red,mod:bold) list or tree Scroll to Top
		[<End>      ](fg:red,mod:bold) list or tree Scroll to Bottom
		[q or <Ctr-c>](fg:red,mod:bold) Quit
        `
	detail := widgets.NewParagraph()
	detail.Title = Detail
	detail.WrapText = false

	draw(list, tree, detail, help, data, ctx, condition)
	listenTracesKeyboard(list, tree, data, ctx, detail, help, condition)

	return nil
}