Skip to content

Commit 725a000

Browse files
committed
treesteps: improved depth limiting
We improve the way operations are shown when we limit the operation depth: at the last depth, we show just the result (the last step) of that operation. We also use a better representation for the properties so they don't look like children, and use a vertical ellipsis to indicate hidden children.
1 parent 629ccb2 commit 725a000

File tree

3 files changed

+494
-475
lines changed

3 files changed

+494
-475
lines changed

internal/treesteps/data.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ type Step struct {
3131

3232
// TreeNode is a node in the tree for a step in a recording.
3333
type TreeNode struct {
34-
Name string `json:"name"`
35-
Properties [][2]string `json:"props"`
36-
Ops []string `json:"ops"`
37-
Children []TreeNode `json:"children"`
34+
Name string `json:"name"`
35+
Properties [][2]string `json:"props"`
36+
Ops []string `json:"ops"`
37+
Children []TreeNode `json:"children"`
38+
HasHiddenChildren bool `json:"hasHiddenChildren"`
3839
}
3940

4041
// String returns the steps as a string (using treeprinter).
@@ -69,11 +70,14 @@ func (t *TreeNode) print(parent treeprinter.Node) {
6970
}
7071
n := parent.Child(name)
7172
for _, p := range t.Properties {
72-
n.Childf("%s: %s", p[0], p[1])
73+
n.AddLine(fmt.Sprintf(" %s: %s", p[0], p[1]))
7374
}
7475
for i := range t.Children {
7576
t.Children[i].print(n)
7677
}
78+
if t.HasHiddenChildren {
79+
n.DotDotDot()
80+
}
7781
}
7882

7983
// URL for a visualization of the steps. The URL contains the encoded and

0 commit comments

Comments
 (0)