1
1
import { Fragment , useMemo } from 'react' ;
2
- import { useTheme } from '@emotion/react' ;
2
+ import { useTheme , type Theme } from '@emotion/react' ;
3
3
import styled from '@emotion/styled' ;
4
4
import * as qs from 'query-string' ;
5
5
@@ -33,11 +33,13 @@ import {appendReleaseFilters} from 'sentry/views/insights/common/utils/releaseCo
33
33
import { useModuleURL } from 'sentry/views/insights/common/utils/useModuleURL' ;
34
34
import { QueryParameterNames } from 'sentry/views/insights/common/views/queryParameters' ;
35
35
import useCrossPlatformProject from 'sentry/views/insights/mobile/common/queries/useCrossPlatformProject' ;
36
+ import { AffectSelector } from 'sentry/views/insights/mobile/screenload/components/affectSelector' ;
36
37
import {
37
38
SpanOpSelector ,
38
39
TTID_CONTRIBUTING_SPAN_OPS ,
39
40
} from 'sentry/views/insights/mobile/screenload/components/spanOpSelector' ;
40
41
import { MobileCursors } from 'sentry/views/insights/mobile/screenload/constants' ;
42
+ import { useAffectsSelection } from 'sentry/views/insights/mobile/screenload/data/useAffectsSelection' ;
41
43
import { MODULE_DOC_LINK } from 'sentry/views/insights/mobile/screenload/settings' ;
42
44
import { ModuleName , SpanFields } from 'sentry/views/insights/types' ;
43
45
@@ -64,6 +66,7 @@ export function ScreenLoadSpansTable({
64
66
const location = useLocation ( ) ;
65
67
const cursor = decodeScalar ( location . query ?. [ MobileCursors . SPANS_TABLE ] ) ;
66
68
const { isProjectCrossPlatform, selectedPlatform} = useCrossPlatformProject ( ) ;
69
+ const { value : affects } = useAffectsSelection ( ) ;
67
70
68
71
const spanOp = decodeScalar ( location . query [ SpanFields . SPAN_OP ] ) ?? '' ;
69
72
const { hasTTFD, isPending : hasTTFDLoading } = useTTFDConfigured ( [
@@ -84,6 +87,15 @@ export function ScreenLoadSpansTable({
84
87
searchQuery . addFilterValue ( 'os.name' , selectedPlatform ) ;
85
88
}
86
89
90
+ if ( affects === 'NONE' ) {
91
+ searchQuery . addFilterValue ( `!${ SpanFields . TTFD } ` , 'ttfd' ) ;
92
+ searchQuery . addFilterValue ( `!${ SpanFields . TTID } ` , 'ttid' ) ;
93
+ } else if ( affects === 'TTFD' ) {
94
+ searchQuery . addFilterValue ( SpanFields . TTFD , 'ttfd' ) ;
95
+ } else if ( affects === 'TTID' ) {
96
+ searchQuery . addFilterValue ( SpanFields . TTID , 'ttid' ) ;
97
+ }
98
+
87
99
return appendReleaseFilters ( searchQuery , primaryRelease , secondaryRelease ) ;
88
100
} , [
89
101
isProjectCrossPlatform ,
@@ -92,6 +104,7 @@ export function ScreenLoadSpansTable({
92
104
selectedPlatform ,
93
105
spanOp ,
94
106
transaction ,
107
+ affects ,
95
108
] ) ;
96
109
97
110
const sort = decodeSorts ( location . query [ QueryParameterNames . SPANS_SORT ] ) [ 0 ] ?? {
@@ -361,11 +374,14 @@ export function ScreenLoadSpansTable({
361
374
362
375
return (
363
376
< Fragment >
364
- < SpanOpSelector
365
- primaryRelease = { primaryRelease }
366
- transaction = { transaction }
367
- secondaryRelease = { secondaryRelease }
368
- />
377
+ < ButtonContainer theme = { theme } >
378
+ < SpanOpSelector
379
+ primaryRelease = { primaryRelease }
380
+ transaction = { transaction }
381
+ secondaryRelease = { secondaryRelease }
382
+ />
383
+ < AffectSelector transaction = { transaction } />
384
+ </ ButtonContainer >
369
385
< GridEditable
370
386
isLoading = { isPending || hasTTFDLoading }
371
387
data = { data }
@@ -386,3 +402,8 @@ const Container = styled('div')`
386
402
${ p => p . theme . overflowEllipsis } ;
387
403
text-align: right;
388
404
` ;
405
+
406
+ const ButtonContainer = styled ( 'div' ) < { theme : Theme } > `
407
+ display: flex;
408
+ gap: ${ p => p . theme . space . md } ;
409
+ ` ;
0 commit comments