File tree Expand file tree Collapse file tree 5 files changed +11
-11
lines changed
views/performance/newTraceDetails/traceDrawer/details Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ import {
46
46
} from 'sentry/utils/discover/fields' ;
47
47
import type { DiscoverDatasets } from 'sentry/utils/discover/types' ;
48
48
import { decodeList , decodeScalar } from 'sentry/utils/queryString' ;
49
+ import { ellipsize } from 'sentry/utils/string/ellipsize' ;
49
50
50
51
import EventsRequest from './eventsRequest' ;
51
52
@@ -553,11 +554,8 @@ class EventsChart extends Component<EventsChartProps> {
553
554
const forceChartType = decodeScalar ( location . query . forceChartType ) ;
554
555
const yAxisArray = decodeList ( yAxis ) ;
555
556
const yAxisSeriesNames = yAxisArray . map ( name => {
556
- let yAxisLabel = name && isEquation ( name ) ? getEquation ( name ) : name ;
557
- if ( yAxisLabel && yAxisLabel . length > 60 ) {
558
- yAxisLabel = yAxisLabel . substring ( 0 , 60 ) + '...' ;
559
- }
560
- return yAxisLabel ;
557
+ const yAxisLabel = name && isEquation ( name ) ? getEquation ( name ) : name ;
558
+ return ellipsize ( yAxisLabel , 60 ) ;
561
559
} ) ;
562
560
563
561
const previousSeriesNames = previousName
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {trackAnalytics} from 'sentry/utils/analytics';
20
20
import { singleLineRenderer } from 'sentry/utils/marked/marked' ;
21
21
import { MarkedText } from 'sentry/utils/marked/markedText' ;
22
22
import { useMutation , useQueryClient } from 'sentry/utils/queryClient' ;
23
+ import { ellipsize } from 'sentry/utils/string/ellipsize' ;
23
24
import useApi from 'sentry/utils/useApi' ;
24
25
import useOrganization from 'sentry/utils/useOrganization' ;
25
26
@@ -87,7 +88,7 @@ function AutofixInsightCard({
87
88
const truncatedTitleHtml = useMemo ( ( ) => {
88
89
let truncatedTitle = displayedInsightTitle ;
89
90
if ( newlineIndex !== - 1 && newlineIndex < displayedInsightTitle . length - 1 ) {
90
- truncatedTitle = displayedInsightTitle . substring ( 0 , newlineIndex ) + '...' ;
91
+ truncatedTitle = ellipsize ( truncatedTitle , newlineIndex ) ;
91
92
}
92
93
return {
93
94
__html : singleLineRenderer ( truncatedTitle ) ,
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {t} from 'sentry/locale';
19
19
import { space } from 'sentry/styles/space' ;
20
20
import { defined } from 'sentry/utils' ;
21
21
import { MarkedText } from 'sentry/utils/marked/markedText' ;
22
+ import { ellipsize } from 'sentry/utils/string/ellipsize' ;
22
23
import { SectionKey } from 'sentry/views/issueDetails/streamline/context' ;
23
24
24
25
interface AutofixInsightSourcesProps {
@@ -63,7 +64,7 @@ function getCodeSourceName(url: string): string {
63
64
// Fallback if URL parsing fails or path is simple
64
65
}
65
66
// Fallback to a truncated version of the URL
66
- return url . length > 30 ? url . substring ( 0 , 27 ) + '...' : url ;
67
+ return ellipsize ( url , 30 ) ;
67
68
}
68
69
69
70
function AutofixInsightSources ( { sources, title, codeUrls} : AutofixInsightSourcesProps ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {trackAnalytics} from 'sentry/utils/analytics';
14
14
import type { RenderFunctionBaggage } from 'sentry/utils/discover/fieldRenderers' ;
15
15
import { FieldKey } from 'sentry/utils/fields' ;
16
16
import { generateProfileFlamechartRoute } from 'sentry/utils/profiling/routes' ;
17
+ import { ellipsize } from 'sentry/utils/string/ellipsize' ;
17
18
import { looksLikeAJSONArray } from 'sentry/utils/string/looksLikeAJSONArray' ;
18
19
import { useIsSentryEmployee } from 'sentry/utils/useIsSentryEmployee' ;
19
20
import type { AttributesFieldRendererProps } from 'sentry/views/explore/components/traceItemAttributes/attributesTree' ;
@@ -75,9 +76,7 @@ const truncatedTextRenderer = (props: CustomRenderersProps) => {
75
76
if ( typeof props . item . value !== 'string' ) {
76
77
return props . item . value ;
77
78
}
78
- return props . item . value . length > 100
79
- ? props . item . value . slice ( 0 , 100 ) + '...'
80
- : props . item . value ;
79
+ return ellipsize ( props . item . value , 100 ) ;
81
80
} ;
82
81
83
82
export function Attributes ( {
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ import type {Organization} from 'sentry/types/organization';
47
47
import type { Project } from 'sentry/types/project' ;
48
48
import { trackAnalytics } from 'sentry/utils/analytics' ;
49
49
import getDuration from 'sentry/utils/duration/getDuration' ;
50
+ import { ellipsize } from 'sentry/utils/string/ellipsize' ;
50
51
import type { Color , ColorOrAlias } from 'sentry/utils/theme' ;
51
52
import { useLocation } from 'sentry/utils/useLocation' ;
52
53
import useOrganization from 'sentry/utils/useOrganization' ;
@@ -1288,7 +1289,7 @@ function MultilineText({children}: {children: string}) {
1288
1289
{ isExpanded || ! needsTruncation ? (
1289
1290
children
1290
1291
) : (
1291
- < Fragment > { children . slice ( 0 , truncatePosition ) + '...' } </ Fragment >
1292
+ < Fragment > { ellipsize ( children , truncatePosition ) } </ Fragment >
1292
1293
) }
1293
1294
{ needsTruncation ? (
1294
1295
< Flex style = { { justifyContent : 'center' , paddingTop : space ( 1 ) } } >
You can’t perform that action at this time.
0 commit comments