-
Notifications
You must be signed in to change notification settings - Fork 449
Add a menu to copy the Marker Table as text #5732
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
base: main
Are you sure you want to change the base?
Conversation
canova
left a comment
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.
Nice, I like the idea of being able to copy the table!
One thing I noticed is that it is hanging for a long time if the table is huge and if there is no filtering applied to it. Normally, we virtualize this table, so it might look like we don't have a lot sometimes, but for large profile it might be too many marker lines.
Maybe we can have an upper limit like const MAX_COPY_ROWS = 10000, and show users a warning that the rest is ommitted. What do you think?;
|
|
||
| lines.push([ | ||
| data.start, | ||
| duration.replace(/μ/g, 'u'), |
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.
Why do we replace μ here? Are unicode chars a problem?
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.
Because "μ" is wider than other ASCII characters (at least for me) and that breaks the alignment of the table
| this._getMarkerLabel = getMarkerLabel; | ||
| } | ||
|
|
||
| copyTable = (format: string) => { |
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.
Can we move this function inside src/profile-logic/marker-data.ts. I think this is a function that's worth extracting outside of the react component. (not the copy() call, but the table building logic)
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.
This is heavily tied to the MarkerTree class, which is local to MarkerTable component.
especially the marker handling, zeroAt, the column alignment etc are specific to the file and they depends on the memoization, and also the state map defined there.
So, the entire logic cannot be moved, and splitting a part of the logic will make it harder to follow.
Fixed #5731
This adds a button to the Marker Table settings bar, which shows a context menu that provides the following:
(not sure if Markdown is actually necessary. If not, it can be simplified to just a single button that copies as plain text)
the plain text copies the table in the following style:
the Markdown copies the table in the following style: