@@ -17,10 +17,18 @@ import {
17
17
} from 'sentry/components/events/eventDrawer' ;
18
18
import { t , tn } from 'sentry/locale' ;
19
19
import type { PageFilters } from 'sentry/types/core' ;
20
- import type { ReactEchartsRef , SeriesDataUnit } from 'sentry/types/echarts' ;
20
+ import type {
21
+ EChartDataZoomHandler ,
22
+ ReactEchartsRef ,
23
+ SeriesDataUnit ,
24
+ } from 'sentry/types/echarts' ;
25
+ import { getUtcDateString } from 'sentry/utils/dates' ;
26
+ import { useLocation } from 'sentry/utils/useLocation' ;
27
+ import { useNavigate } from 'sentry/utils/useNavigate' ;
21
28
import { useReleaseStats } from 'sentry/utils/useReleaseStats' ;
22
29
import { formatVersion } from 'sentry/utils/versions/formatVersion' ;
23
30
import { EVENT_GRAPH_WIDGET_ID } from 'sentry/views/issueDetails/streamline/eventGraphWidget' ;
31
+ import { ReleasesDrawerFields } from 'sentry/views/releases/drawer/utils' ;
24
32
25
33
import { ReleaseDrawerTable } from './releasesDrawerTable' ;
26
34
@@ -83,7 +91,9 @@ const unhighlightMarkLines = createMarkLineUpdater({});
83
91
* Allows users to view releases of a specific timebucket.
84
92
*/
85
93
export function ReleasesDrawerList ( { chart, pageFilters} : ReleasesDrawerListProps ) {
94
+ const navigate = useNavigate ( ) ;
86
95
const { releases} = useReleaseStats ( pageFilters ) ;
96
+ const location = useLocation ( ) ;
87
97
const chartRef = useRef < ReactEchartsRef | null > ( null ) ;
88
98
const chartHeight = chart === EVENT_GRAPH_WIDGET_ID ? '160px' : '220px' ;
89
99
@@ -118,6 +128,34 @@ export function ReleasesDrawerList({chart, pageFilters}: ReleasesDrawerListProps
118
128
} ,
119
129
] ;
120
130
131
+ const handleDataZoom = useCallback < EChartDataZoomHandler > (
132
+ evt => {
133
+ let { startValue, endValue} = ( evt as any ) . batch [ 0 ] as {
134
+ endValue : number | null ;
135
+ startValue : number | null ;
136
+ } ;
137
+
138
+ // if `rangeStart` and `rangeEnd` are null, then we are going back
139
+ if ( startValue && endValue ) {
140
+ // round off the bounds to the minute
141
+ startValue = Math . floor ( startValue / 60_000 ) * 60_000 ;
142
+ endValue = Math . ceil ( endValue / 60_000 ) * 60_000 ;
143
+
144
+ // ensure the bounds has 1 minute resolution
145
+ startValue = Math . min ( startValue , endValue - 60_000 ) ;
146
+
147
+ navigate ( {
148
+ query : {
149
+ ...location . query ,
150
+ [ ReleasesDrawerFields . START ] : getUtcDateString ( startValue ) ,
151
+ [ ReleasesDrawerFields . END ] : getUtcDateString ( endValue ) ,
152
+ } ,
153
+ } ) ;
154
+ }
155
+ } ,
156
+ [ navigate , location . query ]
157
+ ) ;
158
+
121
159
return (
122
160
< EventDrawerContainer >
123
161
< EventDrawerHeader >
@@ -135,6 +173,7 @@ export function ReleasesDrawerList({chart, pageFilters}: ReleasesDrawerListProps
135
173
pageFilters = { pageFilters }
136
174
showReleaseAs = "line"
137
175
loaderSource = "releases-drawer"
176
+ onZoom = { handleDataZoom }
138
177
/>
139
178
</ div >
140
179
) : null }
0 commit comments