-
Notifications
You must be signed in to change notification settings - Fork 482
Add a transform to filter samples by marker name #4610
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
Changes from all commits
b3c31ba
3aafc3e
382740d
3276a1a
d3361d7
100dcc8
ad5f150
9905613
36a374b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,9 @@ import { | |
| setContextMenuVisibility, | ||
| updatePreviewSelection, | ||
| selectTrackFromTid, | ||
| addTransformToStack, | ||
| } from 'firefox-profiler/actions/profile-view'; | ||
| import { changeSelectedTab } from 'firefox-profiler/actions/app'; | ||
| import { | ||
| getPreviewSelection, | ||
| getCommittedRange, | ||
|
|
@@ -60,7 +62,7 @@ type StateProps = {| | |
| +markerIndex: MarkerIndex, | ||
| +previewSelection: PreviewSelection, | ||
| +committedRange: StartEndRange, | ||
| +thread: Thread | null, | ||
| +thread: Thread, | ||
| +implementationFilter: ImplementationFilter, | ||
| +getMarkerLabelToCopy: (MarkerIndex) => string, | ||
| +profiledThreadIds: Set<Tid>, | ||
|
|
@@ -71,6 +73,8 @@ type DispatchProps = {| | |
| +updatePreviewSelection: typeof updatePreviewSelection, | ||
| +setContextMenuVisibility: typeof setContextMenuVisibility, | ||
| +selectTrackFromTid: typeof selectTrackFromTid, | ||
| +addTransformToStack: typeof addTransformToStack, | ||
| +changeSelectedTab: typeof changeSelectedTab, | ||
| |}; | ||
|
|
||
| type Props = ConnectedProps<OwnProps, StateProps, DispatchProps>; | ||
|
|
@@ -182,6 +186,25 @@ class MarkerContextMenuImpl extends PureComponent<Props> { | |
| copy(getMarkerLabelToCopy(markerIndex)); | ||
| }; | ||
|
|
||
| filterByMarkerName = () => { | ||
| const { | ||
| rightClickedMarkerInfo, | ||
| marker, | ||
| addTransformToStack, | ||
| changeSelectedTab, | ||
| thread, | ||
| } = this.props; | ||
| const { threadsKey } = rightClickedMarkerInfo; | ||
| addTransformToStack(threadsKey, { | ||
| type: 'filter-samples', | ||
| filterType: 'marker', | ||
| filter: thread.stringTable.indexForString(marker.name), | ||
| }); | ||
|
|
||
| // Then change the selected tab to call tree. | ||
| changeSelectedTab('calltree'); | ||
| }; | ||
|
|
||
| copyMarkerCause = () => { | ||
| const { marker } = this.props; | ||
|
|
||
|
|
@@ -479,7 +502,32 @@ class MarkerContextMenuImpl extends PureComponent<Props> { | |
| </> | ||
| )} | ||
|
|
||
| {/* Only show this context menu item for interval markers */} | ||
| {marker.start !== null && marker.end !== null ? ( | ||
| <> | ||
| <div className="react-contextmenu-separator" /> | ||
|
|
||
| <MenuItem onClick={this.filterByMarkerName}> | ||
| <span className="react-contextmenu-icon markerContextMenuIconFilterSamples" /> | ||
| <Localized | ||
| id="MarkerContextMenu--drop-samples-outside-of-marker" | ||
| vars={{ | ||
| markerName: marker.name, | ||
| }} | ||
| elems={{ strong: <strong /> }} | ||
| > | ||
| {/* Using a fragment here so we can have a strong tag inside. */} | ||
| <> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that you're using fragments so that
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's the reason. Added a comment here. |
||
| Drop samples outside of “<strong>{marker.name}</strong>” | ||
| markers | ||
| </> | ||
| </Localized> | ||
| </MenuItem> | ||
| </> | ||
| ) : null} | ||
|
|
||
| <div className="react-contextmenu-separator" /> | ||
|
|
||
| <MenuItem onClick={this.copyMarkerDescription}> | ||
| <span className="react-contextmenu-icon markerContextMenuIconCopyDescription" /> | ||
| <Localized id="MarkerContextMenu--copy-description"> | ||
|
|
@@ -536,6 +584,8 @@ const MarkerContextMenu = explicitConnect<OwnProps, StateProps, DispatchProps>({ | |
| updatePreviewSelection, | ||
| setContextMenuVisibility, | ||
| selectTrackFromTid, | ||
| addTransformToStack, | ||
| changeSelectedTab, | ||
| }, | ||
| component: MarkerContextMenuImpl, | ||
| }); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.