func draw()

in pkg/display/graph/tree/list.go [95:123]


func draw(ctx context.Context, list *widgets.List, tree *widgets.Tree, detail, help *widgets.Paragraph, data api.TraceBrief,
	_ *api.TraceQueryCondition,
) {
	x, y := ui.TerminalDimensions()

	if len(data.Traces) != 0 {
		showIndex := list.SelectedRow
		traceID := data.Traces[showIndex].TraceIds[0]
		list.Title = fmt.Sprintf("[%s]", traceID)
		nodes, serviceNames := getNodeData(ctx, traceID)
		tree.Title = fmt.Sprintf("[%s]", strings.Join(serviceNames, "->"))
		tree.SetNodes(nodes)
		list.Rows = rows(data, x/4)
		selected := extra[tree.SelectedNode()]
		detail.Text = selected.Detail
	} else {
		noData := "no data"
		list.Title = noData
		tree.Title = noData
		detail.Title = noData
	}

	list.SetRect(0, 0, x, y)
	tree.SetRect(x/5, 0, x, y)
	detail.SetRect(x-x/5, 0, x, y/2)
	help.SetRect(x-x/5, y/2, x, y)
	tree.ExpandAll()
	ui.Render(list, tree, detail, help)
}