@@ -8,10 +8,14 @@ import Badge from 'sentry/components/badge';
88import { Button } from 'sentry/components/button' ;
99import ButtonBar from 'sentry/components/buttonBar' ;
1010import MarkLine from 'sentry/components/charts/components/markLine' ;
11+ import TimeSince from 'sentry/components/timeSince' ;
12+ import Version from 'sentry/components/version' ;
13+ import VersionHoverCard from 'sentry/components/versionHoverCard' ;
1114import { IconChevron } from 'sentry/icons' ;
1215import { t } from 'sentry/locale' ;
1316import { space } from 'sentry/styles/space' ;
1417import { Series , SeriesDataUnit } from 'sentry/types/echarts' ;
18+ import useOrganization from 'sentry/utils/useOrganization' ;
1519import usePageFilters from 'sentry/utils/usePageFilters' ;
1620import Chart from 'sentry/views/starfish/components/chart' ;
1721import Detail from 'sentry/views/starfish/components/detailPanel' ;
@@ -21,6 +25,8 @@ import QueryTransactionTable, {
2125} from 'sentry/views/starfish/modules/databaseModule/panel/queryTransactionTable' ;
2226import SimilarQueryView from 'sentry/views/starfish/modules/databaseModule/panel/similarQueryView' ;
2327import {
28+ useQueryExampleTransaction ,
29+ useQueryGetEvent ,
2430 useQueryPanelEventCount ,
2531 useQueryPanelGraph ,
2632 useQueryPanelSparklines ,
@@ -97,6 +103,7 @@ function QueryDetailBody({
97103} : DbQueryDetailProps ) {
98104 const theme = useTheme ( ) ;
99105 const pageFilter = usePageFilters ( ) ;
106+ const organization = useOrganization ( ) ;
100107 const { startTime, endTime} = getDateFilters ( pageFilter ) ;
101108 const isNew = row . newish === 1 ;
102109 const isOld = row . retired === 1 ;
@@ -132,12 +139,25 @@ function QueryDetailBody({
132139 const { isLoading : isEventCountLoading , data : eventCountData } =
133140 useQueryPanelEventCount ( row ) ;
134141
142+ const { isLoading : isExampleLoading , data : exampleTransaction } =
143+ useQueryExampleTransaction ( row ) ;
144+
145+ const { isLoading : isFirstExampleLoading , data : firstSeenExample } = useQueryGetEvent (
146+ exampleTransaction ?. [ 0 ] ?. first
147+ ) ;
148+ const { isLoading : isLastExampleLoading , data : lastSeenExample } = useQueryGetEvent (
149+ exampleTransaction ?. [ 0 ] ?. latest
150+ ) ;
151+
135152 const isDataLoading =
136153 isLoading ||
137154 isTableLoading ||
138155 isEventCountLoading ||
139156 isRowLoading ||
140157 isP75GraphLoading ||
158+ isExampleLoading ||
159+ isFirstExampleLoading ||
160+ isLastExampleLoading ||
141161 isSparklinesLoading ;
142162
143163 const eventCountMap = keyBy ( eventCountData , 'transaction' ) ;
@@ -225,14 +245,48 @@ function QueryDetailBody({
225245 { t ( 'First Seen' ) }
226246 { row . newish === 1 && < Badge type = "new" text = "new" /> }
227247 </ SubHeader >
228- < SubSubHeader > { row . firstSeen } </ SubSubHeader >
248+ { Math . abs ( moment ( row . firstSeen ) . diff ( startTime , 'minutes' ) ) < 360 ? (
249+ < SubSubHeader >
250+ More than < TimeSince date = { row . firstSeen } /> { ' ' }
251+ </ SubSubHeader >
252+ ) : (
253+ < span >
254+ < SubSubHeader >
255+ < TimeSince date = { row . firstSeen } /> { ' ' }
256+ </ SubSubHeader >
257+ { firstSeenExample ?. release && (
258+ < VersionHoverCard
259+ organization = { organization }
260+ projectSlug = "sentry"
261+ releaseVersion = { firstSeenExample . release . version }
262+ showUnderline
263+ underlineColor = "linkUnderline"
264+ >
265+ < Version version = { String ( firstSeenExample . release . version ) } truncate />
266+ </ VersionHoverCard >
267+ ) }
268+ </ span >
269+ ) }
229270 </ FlexRowItem >
230271 < FlexRowItem >
231272 < SubHeader >
232273 { t ( 'Last Seen' ) }
233274 { row . retired === 1 && < Badge type = "warning" text = "old" /> }
234275 </ SubHeader >
235- < SubSubHeader > { row . lastSeen } </ SubSubHeader >
276+ < SubSubHeader >
277+ < TimeSince date = { row . lastSeen } />
278+ </ SubSubHeader >
279+ { lastSeenExample ?. release && (
280+ < VersionHoverCard
281+ organization = { organization }
282+ projectSlug = "sentry"
283+ releaseVersion = { lastSeenExample . release . version }
284+ showUnderline
285+ underlineColor = "linkUnderline"
286+ >
287+ < Version version = { String ( lastSeenExample . release . version ) } truncate />
288+ </ VersionHoverCard >
289+ ) }
236290 </ FlexRowItem >
237291 < FlexRowItem >
238292 < SubHeader > { t ( 'Total Time' ) } </ SubHeader >
0 commit comments