@@ -12,12 +12,14 @@ import {t} from 'sentry/locale';
12
12
import type { PageFilters } from 'sentry/types/core' ;
13
13
import type { Series } from 'sentry/types/echarts' ;
14
14
import type { Organization , SessionApiResponse } from 'sentry/types/organization' ;
15
+ import type { Project } from 'sentry/types/project' ;
15
16
import type { Release } from 'sentry/types/release' ;
16
17
import { defined , escapeDoubleQuotes } from 'sentry/utils' ;
17
18
import type { TableDataWithTitle } from 'sentry/utils/discover/discoverQuery' ;
18
19
import { stripDerivedMetricsPrefix } from 'sentry/utils/discover/fields' ;
19
20
import { TOP_N } from 'sentry/utils/discover/types' ;
20
21
import { TAG_VALUE_ESCAPE_PATTERN } from 'sentry/utils/queryString' ;
22
+ import withProjects from 'sentry/utils/withProjects' ;
21
23
import { ReleasesConfig } from 'sentry/views/dashboards/datasetConfig/releases' ;
22
24
import type { DashboardFilters , Widget , WidgetQuery } from 'sentry/views/dashboards/types' ;
23
25
import { DEFAULT_TABLE_LIMIT , DisplayType } from 'sentry/views/dashboards/types' ;
@@ -35,10 +37,11 @@ import type {
35
37
} from './genericWidgetQueries' ;
36
38
import GenericWidgetQueries from './genericWidgetQueries' ;
37
39
38
- type Props = {
40
+ export interface ReleaseWidgetQueriesProps {
39
41
api : Client ;
40
42
children : ( props : GenericWidgetQueriesChildrenProps ) => React . JSX . Element ;
41
43
organization : Organization ;
44
+ projects : Project [ ] ;
42
45
selection : PageFilters ;
43
46
widget : Widget ;
44
47
cursor ?: string ;
@@ -49,7 +52,7 @@ type Props = {
49
52
tableResults ?: TableDataWithTitle [ ] ;
50
53
timeseriesResults ?: Series [ ] ;
51
54
} ) => void ;
52
- } ;
55
+ }
53
56
54
57
type State = {
55
58
loading : boolean ;
@@ -142,7 +145,7 @@ export function requiresCustomReleaseSorting(query: WidgetQuery): boolean {
142
145
return useMetricsAPI && rawOrderby === 'release' ;
143
146
}
144
147
145
- class ReleaseWidgetQueries extends Component < Props , State > {
148
+ class ReleaseWidgetQueries extends Component < ReleaseWidgetQueriesProps , State > {
146
149
state : State = {
147
150
loading : false ,
148
151
errorMessage : undefined ,
@@ -157,7 +160,7 @@ class ReleaseWidgetQueries extends Component<Props, State> {
157
160
}
158
161
}
159
162
160
- componentDidUpdate ( prevProps : Readonly < Props > ) : void {
163
+ componentDidUpdate ( prevProps : Readonly < ReleaseWidgetQueriesProps > ) : void {
161
164
if (
162
165
! requiresCustomReleaseSorting ( prevProps . widget . queries [ 0 ] ! ) &&
163
166
requiresCustomReleaseSorting ( this . props . widget . queries [ 0 ] ! ) &&
@@ -317,7 +320,7 @@ class ReleaseWidgetQueries extends Component<Props, State> {
317
320
} ;
318
321
319
322
afterFetchData = ( data : SessionApiResponse ) => {
320
- const { widget} = this . props ;
323
+ const { widget, projects } = this . props ;
321
324
const { releases} = this . state ;
322
325
323
326
const isDescending = widget . queries [ 0 ] ! . orderby . startsWith ( '-' ) ;
@@ -346,6 +349,15 @@ class ReleaseWidgetQueries extends Component<Props, State> {
346
349
} ) ;
347
350
data . groups = data . groups . slice ( 0 , this . limit ) ;
348
351
}
352
+
353
+ data . groups . forEach ( group => {
354
+ // Convert the project ID in the grouping results to the project slug
355
+ // for a more human readable display
356
+ if ( group . by . project ) {
357
+ const project = projects . find ( p => p . id === String ( group . by . project ) ) ;
358
+ group . by . project = project ?. slug ?? group . by . project ;
359
+ }
360
+ } ) ;
349
361
} ;
350
362
351
363
render ( ) {
@@ -395,4 +407,4 @@ class ReleaseWidgetQueries extends Component<Props, State> {
395
407
}
396
408
}
397
409
398
- export default ReleaseWidgetQueries ;
410
+ export default withProjects ( ReleaseWidgetQueries ) ;
0 commit comments