@@ -21,7 +21,6 @@ import UserBadge from 'sentry/components/idBadge/userBadge';
21
21
import ExternalLink from 'sentry/components/links/externalLink' ;
22
22
import { RowRectangle } from 'sentry/components/performance/waterfall/rowBar' ;
23
23
import { pickBarColor } from 'sentry/components/performance/waterfall/utils' ;
24
- import TimeSince from 'sentry/components/timeSince' ;
25
24
import UserMisery from 'sentry/components/userMisery' ;
26
25
import Version from 'sentry/components/version' ;
27
26
import { IconDownload } from 'sentry/icons' ;
@@ -153,7 +152,7 @@ const missingUserMisery = tct(
153
152
}
154
153
) ;
155
154
const userAgentLocking = t (
156
- 'This OS locks newer versions to this version in the user-agent HTTP header. The exact OS version is unknown.'
155
+ 'This operating system does not provide detailed version information in the User-Agent HTTP header. The exact operating system version is unknown.'
157
156
) ;
158
157
159
158
export function nullableValue ( value : string | null ) : string | React . ReactElement {
@@ -498,25 +497,15 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
498
497
'span.description' : {
499
498
sortField : 'span.description' ,
500
499
renderFunc : data => {
501
- const value = data [ 'span.description' ] ;
502
- const op : string = data [ 'span.op' ] ;
500
+ const value = data [ SpanFields . SPAN_DESCRIPTION ] ;
501
+ const op : string = data [ SpanFields . SPAN_OP ] ;
503
502
const projectId =
504
- typeof data . project_id === 'number'
505
- ? data . project_id
506
- : parseInt ( data . project_id , 10 ) || - 1 ;
507
- const spanGroup : string | undefined = data [ 'span.group' ] ;
503
+ typeof data [ SpanFields . PROJECT_ID ] === 'number'
504
+ ? data [ SpanFields . PROJECT_ID ]
505
+ : parseInt ( data [ SpanFields . PROJECT_ID ] , 10 ) || - 1 ;
506
+ const spanGroup : string | undefined = data [ SpanFields . SPAN_GROUP ] ;
508
507
509
- if ( op === ModuleName . DB ) {
510
- return (
511
- < SpanDescriptionCell
512
- description = { value }
513
- moduleName = { op }
514
- projectId = { projectId }
515
- group = { spanGroup }
516
- />
517
- ) ;
518
- }
519
- if ( op === ModuleName . RESOURCE ) {
508
+ if ( op === ModuleName . DB || op === ModuleName . RESOURCE ) {
520
509
return (
521
510
< SpanDescriptionCell
522
511
description = { value }
@@ -526,6 +515,7 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
526
515
/>
527
516
) ;
528
517
}
518
+
529
519
return (
530
520
< Tooltip
531
521
title = { value }
@@ -670,27 +660,16 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
670
660
} ,
671
661
project_id : {
672
662
sortField : 'project_id' ,
673
- renderFunc : ( data , { organization } ) => {
663
+ renderFunc : ( data , baggage ) => {
674
664
const projectId = data . project_id ;
675
- // TODO: add projects to baggage to avoid using deprecated component
676
- return (
677
- < NumberContainer >
678
- < Projects orgId = { organization . slug } slugs = { [ ] } projectIds = { [ projectId ] } >
679
- { ( { projects} ) => {
680
- const project = projects . find ( p => p . id === projectId ?. toString ( ) ) ;
681
- if ( ! project ) {
682
- return emptyValue ;
683
- }
684
- const target = makeProjectsPathname ( {
685
- path : `/${ project ?. slug } /?project=${ projectId } /` ,
686
- organization,
687
- } ) ;
688
-
689
- return < Link to = { target } > { projectId } </ Link > ;
690
- } }
691
- </ Projects >
692
- </ NumberContainer >
693
- ) ;
665
+ return getProjectIdLink ( projectId , baggage ) ;
666
+ } ,
667
+ } ,
668
+ 'project.id' : {
669
+ sortField : 'project.id' ,
670
+ renderFunc : ( data , baggage ) => {
671
+ const projectId = data [ 'project.id' ] ;
672
+ return getProjectIdLink ( projectId , baggage ) ;
694
673
} ,
695
674
} ,
696
675
user : {
@@ -849,7 +828,9 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
849
828
const date = new Date ( data . timestamp ) ;
850
829
return (
851
830
< Container >
852
- < TimeSince unitStyle = "extraShort" date = { date } tooltipShowSeconds />
831
+ < Tooltip title = { timestamp } >
832
+ < FieldDateTime date = { date } seconds year timeZone />
833
+ </ Tooltip >
853
834
</ Container >
854
835
) ;
855
836
} ,
@@ -910,10 +891,9 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
910
891
return < Container > { emptyStringValue } </ Container > ;
911
892
}
912
893
913
- const formattedName = browserName . split ( ' ' ) . join ( '-' ) . toLocaleLowerCase ( ) ;
914
894
return (
915
895
< IconContainer >
916
- < ContextIcon name = { formattedName } size = "md" />
896
+ { getContextIcon ( browserName , false ) }
917
897
{ browserName }
918
898
</ IconContainer >
919
899
) ;
@@ -927,13 +907,9 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
927
907
return < Container > { emptyStringValue } </ Container > ;
928
908
}
929
909
930
- const broswerArray = browser . split ( ' ' ) ;
931
- broswerArray . pop ( ) ;
932
- const formattedName = broswerArray . join ( '-' ) . toLocaleLowerCase ( ) ;
933
-
934
910
return (
935
911
< IconContainer >
936
- < ContextIcon name = { formattedName } size = "md" />
912
+ { getContextIcon ( browser , true ) }
937
913
{ browser }
938
914
</ IconContainer >
939
915
) ;
@@ -947,10 +923,9 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
947
923
return < Container > { emptyStringValue } </ Container > ;
948
924
}
949
925
950
- const formattedName = osName . split ( ' ' ) . join ( '-' ) . toLocaleLowerCase ( ) ;
951
926
return (
952
927
< IconContainer >
953
- < ContextIcon name = { formattedName } size = "md" />
928
+ { getContextIcon ( osName , false ) }
954
929
{ osName }
955
930
</ IconContainer >
956
931
) ;
@@ -964,14 +939,11 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
964
939
return < Container > { emptyStringValue } </ Container > ;
965
940
}
966
941
967
- const osArray = os . split ( ' ' ) ;
968
- const hasUserAgentLocking = osArray [ osArray . length - 1 ] ?. includes ( '>=' ) ;
969
- osArray . pop ( ) ;
970
- const formattedName = osArray . join ( '-' ) . toLocaleLowerCase ( ) ;
942
+ const hasUserAgentLocking = os . includes ( '>=' ) ;
971
943
972
944
return (
973
945
< IconContainer >
974
- < ContextIcon name = { formattedName } size = "md" />
946
+ { getContextIcon ( os , true ) }
975
947
{ hasUserAgentLocking ? (
976
948
< Tooltip title = { userAgentLocking } showUnderline >
977
949
{ os }
@@ -985,6 +957,53 @@ const SPECIAL_FIELDS: Record<string, SpecialField> = {
985
957
} ,
986
958
} ;
987
959
960
+ /**
961
+ * Returns an icon component for fields that use logo icons
962
+ * @param value the text to map to an icon
963
+ * @param dropVersion drops the last part of the value (the version)
964
+ */
965
+ const getContextIcon = ( value : string , dropVersion ?: boolean ) => {
966
+ const valueArray = value . split ( ' ' ) ;
967
+
968
+ // Some fields have the number version attached, so it needs to be removed
969
+ if ( dropVersion ) {
970
+ valueArray . pop ( ) ;
971
+ }
972
+
973
+ const formattedValue = valueArray . join ( '-' ) . toLocaleLowerCase ( ) ;
974
+
975
+ return < ContextIcon name = { formattedValue } size = "md" /> ;
976
+ } ;
977
+
978
+ const getProjectIdLink = (
979
+ projectId : number | string | undefined ,
980
+ { organization} : RenderFunctionBaggage
981
+ ) => {
982
+ if ( ! projectId ) {
983
+ return < NumberContainer > { emptyValue } </ NumberContainer > ;
984
+ }
985
+ const parsedId = typeof projectId === 'string' ? parseInt ( projectId , 10 ) : projectId ;
986
+ // TODO: Component has been deprecated in favour of hook, need to refactor this later
987
+ return (
988
+ < NumberContainer >
989
+ < Projects orgId = { organization . slug } slugs = { [ ] } projectIds = { [ parsedId ] } >
990
+ { ( { projects} ) => {
991
+ const project = projects . find ( p => p . id === parsedId ?. toString ( ) ) ;
992
+ if ( ! project ) {
993
+ return emptyValue ;
994
+ }
995
+ const target = makeProjectsPathname ( {
996
+ path : `/${ project ?. slug } /?project=${ parsedId } /` ,
997
+ organization,
998
+ } ) ;
999
+
1000
+ return < Link to = { target } > { parsedId } </ Link > ;
1001
+ } }
1002
+ </ Projects >
1003
+ </ NumberContainer >
1004
+ ) ;
1005
+ } ;
1006
+
988
1007
type SpecialFunctionFieldRenderer = (
989
1008
fieldName : string
990
1009
) => ( data : EventData , baggage : RenderFunctionBaggage ) => React . ReactNode ;
0 commit comments