Skip to content

Commit 939cedd

Browse files
[WIP]: Fixing filter button in marker hover panel
1 parent 5dd4c64 commit 939cedd

8 files changed

Lines changed: 30 additions & 30 deletions

File tree

src/components/marker-chart/Canvas.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ class MarkerChartCanvasImpl extends React.PureComponent<Props> {
915915
marker={marker}
916916
threadsKey={this.props.threadsKey}
917917
restrictHeightWidth={true}
918+
showFilterButton={true}
918919
onStackFrameClick={this._onStackFrameClick}
919920
/>
920921
);

src/components/timeline/Markers.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ class TimelineMarkers extends React.PureComponent<Props, State> {
497497
marker={hoveredMarker}
498498
threadsKey={threadsKey}
499499
restrictHeightWidth={true}
500+
showFilterButton={false}
500501
/>
501502
</Tooltip>
502503
) : null}

src/components/timeline/TrackCustomMarkerGraph.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ class TrackCustomMarkerGraphImpl extends React.PureComponent<Props, State> {
471471
marker={marker}
472472
threadsKey={threadIndex}
473473
restrictHeightWidth={true}
474+
showFilterButton={false}
474475
/>
475476
</Tooltip>
476477
);

src/components/timeline/TrackNetwork.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ class Network extends PureComponent<Props, State> {
409409
marker={hoveredMarker}
410410
threadsKey={threadIndex}
411411
restrictHeightWidth={true}
412+
showFilterButton={false}
412413
/>
413414
</Tooltip>
414415
) : null}

src/components/tooltip/Marker.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ type OwnProps = {
8383
readonly marker: Marker;
8484
readonly threadsKey: ThreadsKey;
8585
readonly className?: string;
86+
readonly showFilterButton?: boolean;
8687
// In tooltips it can be awkward for really long and tall things to force
8788
// the layout to be huge. This option when set to true will restrict the
8889
// height of things like stacks, and the width of long things like URLs.
@@ -519,8 +520,13 @@ class MarkerTooltipContents extends React.PureComponent<Props> {
519520
* a short list of rendering strategies, in the order they appear.
520521
*/
521522
override render() {
522-
const { className, markerIndex, getMarkerLabel, getMarkerSearchTerm } =
523-
this.props;
523+
const {
524+
className,
525+
markerIndex,
526+
getMarkerLabel,
527+
getMarkerSearchTerm,
528+
showFilterButton = true,
529+
} = this.props;
524530
const markerLabel = getMarkerLabel(markerIndex);
525531
const searchTerm = getMarkerSearchTerm(markerIndex);
526532
return (
@@ -530,19 +536,21 @@ class MarkerTooltipContents extends React.PureComponent<Props> {
530536
{this._maybeRenderMarkerDuration()}
531537
<div className="tooltipTitle">
532538
<span className="tooltipTitleText">{markerLabel}</span>
533-
<Localized
534-
id="MarkerTooltip--filter-button-tooltip"
535-
vars={{ filter: searchTerm }}
536-
attrs={{ title: true, 'aria-label': true }}
537-
>
538-
<button
539-
className="tooltipTitleFilterButton"
540-
type="button"
541-
title={`Only show markers matching: “${searchTerm}”`}
542-
aria-label={`Only show markers matching: “${searchTerm}”`}
543-
onClick={this._onFilterButtonClick}
544-
/>
545-
</Localized>
539+
{showFilterButton ? (
540+
<Localized
541+
id="MarkerTooltip--filter-button-tooltip"
542+
vars={{ filter: searchTerm }}
543+
attrs={{ title: true, 'aria-label': true }}
544+
>
545+
<button
546+
className="tooltipTitleFilterButton"
547+
type="button"
548+
title={`Only show markers matching: “${searchTerm}”`}
549+
aria-label={`Only show markers matching: “${searchTerm}”`}
550+
onClick={this._onFilterButtonClick}
551+
/>
552+
</Localized>
553+
) : null}
546554
</div>
547555
</div>
548556
</div>

src/test/components/__snapshots__/MenuButtons.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ exports[`app/MenuButtons <Publish> matches the snapshot for the menu buttons and
21872187
class="menuButtonsDownloadSize"
21882188
>
21892189
(
2190-
1.58 kB
2190+
1.59 kB
21912191
)
21922192
</span>
21932193
</a>
@@ -2305,7 +2305,7 @@ exports[`app/MenuButtons <Publish> matches the snapshot for the opened panel for
23052305
class="menuButtonsDownloadSize"
23062306
>
23072307
(
2308-
1.56 kB
2308+
1.57 kB
23092309
)
23102310
</span>
23112311
</a>
@@ -2418,7 +2418,7 @@ exports[`app/MenuButtons <Publish> matches the snapshot for the opened panel for
24182418
class="menuButtonsDownloadSize"
24192419
>
24202420
(
2421-
1.58 kB
2421+
1.59 kB
24222422
)
24232423
</span>
24242424
</a>

src/test/components/__snapshots__/TrackCustomMarker.test.tsx.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ exports[`TrackCustomMarker has a tooltip that matches the snapshot 1`] = `
3030
>
3131
Marker
3232
</span>
33-
<button
34-
aria-label="Only show markers matching: “⁨Marker⁩”"
35-
class="tooltipTitleFilterButton"
36-
title="Only show markers matching: “⁨Marker⁩”"
37-
type="button"
38-
/>
3933
</div>
4034
</div>
4135
</div>

src/test/components/__snapshots__/TrackNetwork.test.tsx.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ exports[`timeline/TrackNetwork draws differently a request and displays a toolti
6161
>
6262
Load 0: https://mozilla.org
6363
</span>
64-
<button
65-
aria-label="Only show markers matching: “⁨Load 0: https://mozilla.org⁩”"
66-
class="tooltipTitleFilterButton"
67-
title="Only show markers matching: “⁨Load 0: https://mozilla.org⁩”"
68-
type="button"
69-
/>
7064
</div>
7165
</div>
7266
</div>

0 commit comments

Comments
 (0)