-
Notifications
You must be signed in to change notification settings - Fork 112
Refactor Workflow Trace Viewer to have multi window support #1417
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
adbd153
Open selected files in a new window
japplin 5cd6afc
Follow workflow versioning, drop snapshot name for compatability
japplin f8c8a5b
Support adb commands when running from a dmg installation
japplin 405ee05
Use telephoto library for zooming
japplin ebb1539
Improve connection error message
japplin 10a52cf
Automatically open info panel when a node is selected
japplin a40f8a1
Disable proguard in release builds
japplin 84cffb0
Move device polling into DisplayDevices composable
japplin 80ea45f
Apply changes from apiDump
japplin 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
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
74 changes: 74 additions & 0 deletions
74
workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/LandingWindow.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,74 @@ | ||
| package com.squareup.workflow1.traceviewer | ||
|
|
||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.material.MaterialTheme | ||
| import androidx.compose.material.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.produceState | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.text.font.FontWeight | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.compose.ui.unit.sp | ||
| import com.squareup.workflow1.traceviewer.ui.control.DisplayDevices | ||
| import com.squareup.workflow1.traceviewer.ui.control.UploadFile | ||
| import io.github.vinceglb.filekit.PlatformFile | ||
| import kotlinx.coroutines.delay | ||
|
|
||
| /** | ||
| * Main window composable that shows both file upload and device selection options. | ||
| */ | ||
| @Composable | ||
| internal fun LandingWindow( | ||
| modifier: Modifier = Modifier, | ||
| onFileSelected: (PlatformFile) -> Unit, | ||
| onDeviceSelected: (String) -> Unit | ||
| ) { | ||
| Box(modifier = modifier.fillMaxSize()) { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .padding(32.dp), | ||
| horizontalAlignment = Alignment.CenterHorizontally, | ||
| verticalArrangement = Arrangement.Center | ||
| ) { | ||
| Text( | ||
| text = "Workflow Trace Viewer", | ||
| fontSize = 24.sp, | ||
| fontWeight = FontWeight.Bold, | ||
| modifier = Modifier.padding(bottom = 48.dp) | ||
| ) | ||
|
|
||
| // File selection section | ||
| UploadFile( | ||
| resetOnFileSelect = { file -> | ||
| file?.let { onFileSelected(it) } | ||
| } | ||
| ) | ||
|
|
||
| Text( | ||
| text = "— OR —", | ||
| fontSize = 14.sp, | ||
| color = MaterialTheme.colors.onSurface.copy(alpha = 0.6f), | ||
| modifier = Modifier.padding(bottom = 24.dp) | ||
| ) | ||
|
|
||
| // Device selection section | ||
| Text( | ||
| text = "Connect to Device", | ||
| fontSize = 18.sp, | ||
| fontWeight = FontWeight.Medium, | ||
| modifier = Modifier.padding(bottom = 24.dp) | ||
| ) | ||
|
|
||
| DisplayDevices( | ||
| onDeviceSelect = onDeviceSelected, | ||
| ) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
Was this usage via @saket 's suggestion? :). If not, he should know!
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.
Nope, I was just struggling with the zooming code for hours and then remembered his library and gave it a shot. There is still room to improve our implementation by replacing the custom panning code with the zoomable library as well, I briefly tried doing that but it wasn't panning.... out, so I left the hybrid approach for now. Would be great if you were interested in contributed that improvement @saket.
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.
yay, love seeing more usage inside our codebase! 🎉
that might be because compose multiplatform has pretty limited support for zoom events on the JVM :/ last time I checked, I wasn't seeing any trackpad or mouse scroll events. I'll double-check this today. could you share instructions for opening the trace viewer?
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.
If you have the workflow kotlin repo cloned you can launch the trace viewer using ./gradlew :workflow-trace-viewer:run. I'm not sure if we have any sample traces in open source but you can download them from any failed test in ci I'll dm you a link.
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.
taking a look at this right now!
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.
done! #1421