File tree 7 files changed +64
-14
lines changed
settings/organizationProjects
7 files changed +64
-14
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {space} from 'sentry/styles/space';
23
23
import type { Organization } from 'sentry/types/organization' ;
24
24
import { trackAnalytics } from 'sentry/utils/analytics' ;
25
25
import withApi from 'sentry/utils/withApi' ;
26
+ import { makeProjectsPathname } from 'sentry/views/projects/pathname' ;
26
27
27
28
type Props = ModalRenderProps & {
28
29
api : Client ;
@@ -108,7 +109,11 @@ function SuggestProjectModal(props: Props) {
108
109
category : 'mobile' ,
109
110
} ) ;
110
111
111
- const newProjectLink = `/organizations/${ organization . slug } /projects/new/?${ paramString } ` ;
112
+ const newProjectLink =
113
+ makeProjectsPathname ( {
114
+ path : '/new/' ,
115
+ orgSlug : organization . slug ,
116
+ } ) + `?${ paramString } ` ;
112
117
113
118
return (
114
119
< Fragment >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import {getUtcDateString} from 'sentry/utils/dates';
9
9
import { axisLabelFormatter , tooltipFormatter } from 'sentry/utils/discover/charts' ;
10
10
import { aggregateOutputType } from 'sentry/utils/discover/fields' ;
11
11
import { formatMetricUsingUnit } from 'sentry/utils/number/formatMetricUsingUnit' ;
12
+ import { makeAlertsPathname } from 'sentry/views/alerts/pathnames' ;
12
13
import {
13
14
Dataset ,
14
15
Datasource ,
@@ -166,12 +167,15 @@ export function shouldScaleAlertChart(aggregate: string) {
166
167
}
167
168
168
169
export function alertDetailsLink ( organization : Organization , incident : Incident ) {
169
- return `/organizations/${ organization . slug } /alerts/rules/details/${
170
- incident . alertRule . status === AlertRuleStatus . SNAPSHOT &&
171
- incident . alertRule . originalAlertRuleId
172
- ? incident . alertRule . originalAlertRuleId
173
- : incident . alertRule . id
174
- } /`;
170
+ return makeAlertsPathname ( {
171
+ path : `/rules/details/${
172
+ incident . alertRule . status === AlertRuleStatus . SNAPSHOT &&
173
+ incident . alertRule . originalAlertRuleId
174
+ ? incident . alertRule . originalAlertRuleId
175
+ : incident . alertRule . id
176
+ } /`,
177
+ organization,
178
+ } ) ;
175
179
}
176
180
177
181
/**
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionT
4
4
import { TabList } from 'sentry/components/tabs' ;
5
5
import { t } from 'sentry/locale' ;
6
6
import type { Organization } from 'sentry/types/organization' ;
7
- import normalizeUrl from 'sentry/utils/url/normalizeUrl ' ;
7
+ import { makeStatsPathname } from 'sentry/views/organizationStats/pathname ' ;
8
8
9
9
type Props = {
10
10
activeTab : 'stats' | 'issues' | 'health' ;
@@ -34,19 +34,28 @@ function StatsHeader({organization, activeTab}: Props) {
34
34
< TabList hideBorder >
35
35
< TabList . Item
36
36
key = "stats"
37
- to = { normalizeUrl ( `/organizations/${ organization . slug } /stats/` ) }
37
+ to = { makeStatsPathname ( {
38
+ path : '/' ,
39
+ organization,
40
+ } ) }
38
41
>
39
42
{ t ( 'Usage' ) }
40
43
</ TabList . Item >
41
44
< TabList . Item
42
45
key = "issues"
43
- to = { normalizeUrl ( `/organizations/${ organization . slug } /stats/issues/` ) }
46
+ to = { makeStatsPathname ( {
47
+ path : '/issues/' ,
48
+ organization,
49
+ } ) }
44
50
>
45
51
{ t ( 'Issues' ) }
46
52
</ TabList . Item >
47
53
< TabList . Item
48
54
key = "health"
49
- to = { normalizeUrl ( `/organizations/${ organization . slug } /stats/health/` ) }
55
+ to = { makeStatsPathname ( {
56
+ path : '/health/' ,
57
+ organization,
58
+ } ) }
50
59
>
51
60
{ t ( 'Health' ) }
52
61
</ TabList . Item >
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import withOrganization from 'sentry/utils/withOrganization';
36
36
import withPageFilters from 'sentry/utils/withPageFilters' ;
37
37
import HeaderTabs from 'sentry/views/organizationStats/header' ;
38
38
import { getPerformanceBaseUrl } from 'sentry/views/performance/utils' ;
39
+ import { makeProjectsPathname } from 'sentry/views/projects/pathname' ;
39
40
40
41
import type { ChartDataTransform } from './usageChart' ;
41
42
import { CHART_OPTIONS_DATACATEGORY } from './usageChart' ;
@@ -193,7 +194,10 @@ export class OrganizationStats extends Component<OrganizationStatsProps> {
193
194
} ,
194
195
projectDetail : {
195
196
...nextLocation ,
196
- pathname : `/organizations/${ organization . slug } /projects/${ project . slug } /` ,
197
+ pathname : makeProjectsPathname ( {
198
+ path : `/${ project . slug } /` ,
199
+ orgSlug : organization . slug ,
200
+ } ) ,
197
201
} ,
198
202
issueList : {
199
203
...nextLocation ,
Original file line number Diff line number Diff line change
1
+ import { prefersStackedNav } from 'sentry/components/nav/prefersStackedNav' ;
2
+ import type { Organization } from 'sentry/types/organization' ;
3
+ import normalizeUrl from 'sentry/utils/url/normalizeUrl' ;
4
+
5
+ const LEGACY_STATS_BASE_PATHNAME = 'stats' ;
6
+ const STATS_BASE_PATHNAME = 'settings/stats' ;
7
+
8
+ export function makeStatsPathname ( {
9
+ path,
10
+ organization,
11
+ } : {
12
+ organization : Organization ;
13
+ path : '/' | `/${string } /`;
14
+ } ) {
15
+ return normalizeUrl (
16
+ prefersStackedNav ( )
17
+ ? `/organizations/${ organization . slug } /${ STATS_BASE_PATHNAME } ${ path } `
18
+ : `/organizations/${ organization . slug } /${ LEGACY_STATS_BASE_PATHNAME } ${ path } `
19
+ ) ;
20
+ }
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import {useTeamsById} from 'sentry/utils/useTeamsById';
37
37
import { useUser } from 'sentry/utils/useUser' ;
38
38
import { useUserTeams } from 'sentry/utils/useUserTeams' ;
39
39
import TeamFilter from 'sentry/views/alerts/list/rules/teamFilter' ;
40
+ import { makeProjectsPathname } from 'sentry/views/projects/pathname' ;
40
41
41
42
import ProjectCard from './projectCard' ;
42
43
import Resources from './resources' ;
@@ -205,7 +206,10 @@ function Dashboard() {
205
206
? undefined
206
207
: t ( 'You do not have permission to create projects' )
207
208
}
208
- to = { `/organizations/${ organization . slug } /projects/new/` }
209
+ to = { makeProjectsPathname ( {
210
+ path : '/new/' ,
211
+ orgSlug : organization . slug ,
212
+ } ) }
209
213
icon = { < IconAdd isCircled /> }
210
214
data-test-id = "create-project"
211
215
>
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import {IconAdd} from 'sentry/icons';
3
3
import { t } from 'sentry/locale' ;
4
4
import { useCanCreateProject } from 'sentry/utils/useCanCreateProject' ;
5
5
import useOrganization from 'sentry/utils/useOrganization' ;
6
+ import { makeProjectsPathname } from 'sentry/views/projects/pathname' ;
6
7
7
8
export default function CreateProjectButton ( ) {
8
9
const organization = useOrganization ( ) ;
@@ -18,7 +19,10 @@ export default function CreateProjectButton() {
18
19
? undefined
19
20
: t ( 'You do not have permission to create projects' )
20
21
}
21
- to = { `/organizations/${ organization . slug } /projects/new/` }
22
+ to = { makeProjectsPathname ( {
23
+ path : '/new/' ,
24
+ orgSlug : organization . slug ,
25
+ } ) }
22
26
icon = { < IconAdd isCircled /> }
23
27
>
24
28
{ t ( 'Create Project' ) }
You can’t perform that action at this time.
0 commit comments