Skip to content

Commit 193901d

Browse files
committed
Include a list of trees that pairs with parsed frames
These can be viewed as pairs: for each frame, there is the full workflow tree that is slowly built up with the new nodes. Add a copy method onto Node class to store a current copy of the workflow tree.
1 parent c6264da commit 193901d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/model/Node.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,26 @@ package com.squareup.workflow1.traceviewer.model
99
*/
1010
public class Node(
1111
val name: String,
12-
val id: String,
1312
val parent: String,
14-
val parentId: String,
1513
val props: Any? = null,
1614
val state: Any? = null,
1715
val renderings: Any? = null,
18-
val children: List<Node>,
16+
val children: MutableList<Node>,
17+
val id: String
1918
) {
2019

20+
fun copy(): Node {
21+
return Node(
22+
name = name,
23+
parent = parent,
24+
props = props,
25+
state = state,
26+
rendering = rendering,
27+
children = children.map { it.copy() }.toMutableList(),
28+
id = id
29+
)
30+
}
31+
2132
override fun toString(): String {
2233
return "Node(name='$name', parent='$parent', children=${children})"
2334
}

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/ui/WorkflowInfoPanel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ private fun NodePanelDetails(
9494
val fields = mapOf(
9595
"Name" to node.name,
9696
"ID" to node.id,
97-
"Props" to node.props.toString(),
98-
"State" to node.state.toString(),
99-
"Renderings" to node.renderings.toString()
97+
"Props" to node.props,
98+
"State" to node.state,
99+
"Rendering" to node.rendering
100100
)
101101

102102
fields.forEach { (label, value) ->

0 commit comments

Comments
 (0)