Skip to content

Commit 77e7dcb

Browse files
committed
fix(nav): Fix another couple links
1 parent fd5ca38 commit 77e7dcb

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

static/app/components/search/sources/apiSource.tsx

+20-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import {singleLineRenderer as markedSingleLine} from 'sentry/utils/marked';
2424
import withLatestContext from 'sentry/utils/withLatestContext';
2525
// eslint-disable-next-line no-restricted-imports
2626
import withSentryRouter from 'sentry/utils/withSentryRouter';
27+
import {makeAlertsPathname} from 'sentry/views/alerts/pathnames';
28+
import {makeProjectsPathname} from 'sentry/views/projects/pathname';
2729

2830
import type {ChildProps, Result, ResultItem} from './types';
2931
import {strGetFn} from './utils';
@@ -61,9 +63,14 @@ async function createOrganizationResults(
6163
}
6264
async function createProjectResults(
6365
projectsPromise: Promise<Project[]>,
64-
orgId?: string
66+
organization?: Organization
6567
): Promise<ResultItem[]> {
6668
const projects = (await projectsPromise) || [];
69+
70+
if (!organization) {
71+
return [];
72+
}
73+
6774
return projects.flatMap(project => {
6875
const projectResults: ResultItem[] = [
6976
{
@@ -72,15 +79,19 @@ async function createProjectResults(
7279
model: project,
7380
sourceType: 'project',
7481
resultType: 'settings',
75-
to: `/settings/${orgId}/projects/${project.slug}/`,
82+
to: `/settings/${organization.slug}/projects/${project.slug}/`,
7683
},
7784
{
7885
title: t('%s Alerts', project.slug),
7986
description: t('List of project alert rules'),
8087
model: project,
8188
sourceType: 'project',
8289
resultType: 'route',
83-
to: `/organizations/${orgId}/alerts/rules/?project=${project.id}`,
90+
to:
91+
makeAlertsPathname({
92+
path: '/rules/',
93+
organization,
94+
}) + `?project=${project.id}`,
8495
},
8596
];
8697

@@ -90,7 +101,11 @@ async function createProjectResults(
90101
model: project,
91102
sourceType: 'project',
92103
resultType: 'route',
93-
to: `/organizations/${orgId}/projects/${project.slug}/?project=${project.id}`,
104+
to:
105+
makeProjectsPathname({
106+
orgSlug: organization.slug,
107+
path: `/${project.slug}/`,
108+
}) + `?project=${project.id}`,
94109
});
95110

96111
return projectResults;
@@ -469,7 +484,7 @@ class ApiSource extends Component<Props, State> {
469484
] = requests;
470485
const searchResults = await Promise.all([
471486
createOrganizationResults(organizations!),
472-
createProjectResults(projects!, orgId),
487+
createProjectResults(projects!, organization),
473488
createTeamResults(teams!, orgId),
474489
createMemberResults(members!, orgId),
475490
createIntegrationResults(integrations!, orgId),

static/app/views/projectDetail/projectDetail.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import useApi from 'sentry/utils/useApi';
3333
import usePageFilters from 'sentry/utils/usePageFilters';
3434
import {useParams} from 'sentry/utils/useParams';
3535
import useProjects from 'sentry/utils/useProjects';
36+
import {makeProjectsPathname} from 'sentry/views/projects/pathname';
3637

3738
import {ERRORS_BASIC_CHART_PERIODS} from './charts/projectErrorsBasicChart';
3839
import ProjectScoreCards from './projectScoreCards/projectScoreCards';
@@ -158,7 +159,7 @@ export default function ProjectDetail({router, location, organization}: Props) {
158159
<Breadcrumbs
159160
crumbs={[
160161
{
161-
to: `/organizations/${params.orgId}/projects/`,
162+
to: makeProjectsPathname({path: '/', orgSlug: organization.slug}),
162163
label: t('Projects'),
163164
},
164165
{label: t('Project Details')},

0 commit comments

Comments
 (0)