-
Notifications
You must be signed in to change notification settings - Fork 108
Improve visualizer usability #1382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wenli-cai
wants to merge
43
commits into
main
Choose a base branch
from
wenli/improve-visualizer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,372
−319
Open
Changes from 17 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
e3b81f3
Complete reset when changing trace files
wenli-cai cbcea20
Fix naming for node current and past state
wenli-cai 9c1fc6a
Enumerate the specific changes for each node and color them accordingly
wenli-cai 25d04a4
Move away from using reflection for accessing node fields
wenli-cai 1ce9943
Change node data being visualized
wenli-cai b5d3b16
Remove unnecessary frame tracking in main composable
wenli-cai 6dddf94
Add legend for the colors used in the frame
wenli-cai 6d2d31b
Group unaffected and affected children separately
wenli-cai e71a870
Separate composable components and change workflow UI pattern
wenli-cai 18c3b6f
Don't apply simple/nested pattern for unaffected children group
wenli-cai 5646d10
Add file dump functionality from live tracing mode
wenli-cai 18f82cd
Fix NPE when enabling live view without a connected device
japplin 07ab5fd
Enable compose hot reload
japplin 58c58a9
Change sample/tutorial module's agp version
wenli-cai 2aaa120
WIP text diff
wenli-cai 5ec8a18
Add text-diff functionality
wenli-cai 82eae8b
Fix compose violations
wenli-cai 1633f4c
Merge branch 'main' into wenli/improve-visualizer
wenli-cai 1e1da90
Apply changes from dependencyGuardBaseline --refresh-dependencies
wenli-cai 8fbeab4
Apply changes from artifactsDump
workflow-pr-fixer[bot] a50f9a5
Fix merge bugs
wenli-cai c4fe05e
Allow device selection
wenli-cai 6687f04
Manual api dump
wenli-cai cdfbc82
Remove compose hot reload changes
wenli-cai 5d3e3f4
Apply changes from dependencyGuardBaseline --refresh-dependencies
wenli-cai fdf2253
Apply changes from apiDump
workflow-pr-fixer[bot] 5280f84
Apply changes from artifactsDump
workflow-pr-fixer[bot] a2c98ae
Clean up
wenli-cai 325b239
Add search box for available nodes in the specified frame
wenli-cai 688688e
Refactor directories
wenli-cai 24fae61
Improve error handling
wenli-cai cc40120
Make app window snap to the specific node when it is being searched.
wenli-cai a9a44e9
Fix zooming for sandbox
wenli-cai 4f9f92b
Replace color legend with tooltip display on node hover
wenli-cai 418abf1
New frame selector format
wenli-cai f2b5169
Fill background of info panel arrow
wenli-cai 7b7b41a
Usage guide gifs
wenli-cai a489f00
Improve readme
wenli-cai 03c505d
Fix reset state
wenli-cai 08f412c
Cleanup code for review
wenli-cai 543258b
Revert dependencies classpath
wenli-cai 4a8d29d
Add remaining internal modifiers
wenli-cai ea48f89
Fix PR comments
wenli-cai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 31 additions & 5 deletions
36
...ow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/model/NodeUpdate.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,38 @@ | ||
package com.squareup.workflow1.traceviewer.model | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
/** | ||
* Represents the difference between the current and previous state of a node in the workflow trace. | ||
* This will be what is passed as a state between UI to display the diff. | ||
* This will be what is passed as a state between UI to display the diff. The states all have an | ||
* associated color | ||
* | ||
* If it's the first node in the frame, [previous] will be null and there is no difference to show. | ||
* If it's the first node in the frame, [past] will be null and there is no difference to show. | ||
*/ | ||
internal class NodeUpdate( | ||
internal data class NodeUpdate( | ||
val current: Node, | ||
val previous: Node?, | ||
) | ||
val past: Node?, | ||
val state: NodeState | ||
) { | ||
companion object { | ||
fun create(current: Node, past: Node?, isAffected: Boolean): NodeUpdate { | ||
val state = when { | ||
!isAffected -> NodeState.UNCHANGED | ||
past == null -> NodeState.NEW | ||
current.props != past.props -> NodeState.PROPS_CHANGED | ||
current.state != past.state -> NodeState.STATE_CHANGED | ||
else -> NodeState.CHILDREN_CHANGED | ||
} | ||
|
||
return NodeUpdate(current, past, state) | ||
} | ||
} | ||
} | ||
|
||
enum class NodeState(val color: Color) { | ||
NEW(Color(0x804CAF50)), // green | ||
STATE_CHANGED(Color(0xFFE57373)), // red | ||
PROPS_CHANGED(Color(0xFFFF8A65)), // orange | ||
CHILDREN_CHANGED(Color(0x802196F3)), // blue | ||
UNCHANGED(Color.Transparent), | ||
} |
62 changes: 62 additions & 0 deletions
62
...flow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/ui/ColorLegend.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.squareup.workflow1.traceviewer.ui | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.font.FontStyle | ||
import androidx.compose.ui.unit.dp | ||
import com.squareup.workflow1.traceviewer.model.NodeState | ||
|
||
/** | ||
* Simple UI displaying the color legend for the different node states in the trace | ||
*/ | ||
@Composable | ||
fun ColorLegend( | ||
modifier: Modifier = Modifier | ||
) { | ||
Box( | ||
modifier = modifier | ||
) { | ||
Column( | ||
verticalArrangement = Arrangement.spacedBy(4.dp), | ||
modifier = Modifier.padding(8.dp) | ||
) { | ||
NodeState.entries.forEach { state -> | ||
Row( | ||
horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
modifier = Modifier.padding(vertical = 2.dp) | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.size(16.dp) | ||
.background( | ||
color = state.color, | ||
) | ||
.then( | ||
if (state.color == Color.Transparent) { | ||
modifier.border(1.dp, Color.Gray) | ||
} else { | ||
modifier | ||
} | ||
) | ||
) | ||
Text( | ||
text = state.name, | ||
fontStyle = FontStyle.Italic, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more idiomatic for this to be an extension fun on
Node
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because I'm interacting directly with a Node object?