Skip to content

Commit 8bb29a0

Browse files
committed
ref(preprod): Rename projectId to projectSlug
Sentry projects have both ids (numerical) and slugs (string) here we were using slugs but all the variables were named projectId which was confusing.
1 parent 89ee6e7 commit 8bb29a0

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ import {createActionMenuItems} from './buildDetailsActionItems';
1919
import {useBuildDetailsActions} from './useBuildDetailsActions';
2020

2121
function makeReleasesUrl(
22-
projectId: string | undefined,
22+
projectSlug: string | undefined,
2323
query: {appId?: string; version?: string}
2424
): string {
2525
const {appId, version} = query;
2626

27-
// Not knowing the projectId should be transient.
28-
if (projectId === undefined) {
27+
// Not knowing the projectSlug should be transient.
28+
if (projectSlug === undefined) {
2929
return '#';
3030
}
3131

3232
const params = new URLSearchParams();
33-
params.set('project', projectId);
33+
params.set('project', projectSlug);
3434
const parts = [];
3535
if (appId) {
3636
parts.push(`release.package:${appId}`);
@@ -47,16 +47,16 @@ function makeReleasesUrl(
4747
interface BuildDetailsHeaderContentProps {
4848
artifactId: string;
4949
buildDetailsQuery: UseApiQueryResult<BuildDetailsApiResponse, RequestError>;
50-
projectId: string;
50+
projectSlug: string;
5151
}
5252

5353
export function BuildDetailsHeaderContent(props: BuildDetailsHeaderContentProps) {
5454
const organization = useOrganization();
5555
const isSentryEmployee = useIsSentryEmployee();
56-
const {buildDetailsQuery, projectId, artifactId} = props;
56+
const {buildDetailsQuery, projectSlug, artifactId} = props;
5757
const {isDeletingArtifact, handleDeleteAction, handleDownloadAction} =
5858
useBuildDetailsActions({
59-
projectId,
59+
projectSlug,
6060
artifactId,
6161
});
6262

@@ -84,7 +84,7 @@ export function BuildDetailsHeaderContent(props: BuildDetailsHeaderContentProps)
8484
);
8585
}
8686

87-
const project = ProjectsStore.getBySlug(projectId);
87+
const project = ProjectsStore.getBySlug(projectSlug);
8888

8989
const breadcrumbs: Crumb[] = [
9090
{
@@ -124,7 +124,7 @@ export function BuildDetailsHeaderContent(props: BuildDetailsHeaderContentProps)
124124
</Heading>
125125
<Flex align="center" gap="sm" flexShrink={0}>
126126
<Link
127-
to={`/organizations/${organization.slug}/preprod/${projectId}/compare/${buildDetailsData.id}/`}
127+
to={`/organizations/${organization.slug}/preprod/${projectSlug}/compare/${buildDetailsData.id}/`}
128128
>
129129
<Button size="sm" priority="default" icon={<IconTelescope />}>
130130
{t('Compare Build')}

static/app/views/preprod/buildDetails/header/useBuildDetailsActions.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import useOrganization from 'sentry/utils/useOrganization';
99

1010
interface UseBuildDetailsActionsProps {
1111
artifactId: string;
12-
projectId: string;
12+
projectSlug: string;
1313
}
1414

1515
export function useBuildDetailsActions({
16-
projectId,
16+
projectSlug,
1717
artifactId,
1818
}: UseBuildDetailsActionsProps) {
1919
const organization = useOrganization();
@@ -25,14 +25,14 @@ export function useBuildDetailsActions({
2525
>({
2626
mutationFn: () => {
2727
return fetchMutation({
28-
url: `/projects/${organization.slug}/${projectId}/preprodartifacts/${artifactId}/delete/`,
28+
url: `/projects/${organization.slug}/${projectSlug}/preprodartifacts/${artifactId}/delete/`,
2929
method: 'DELETE',
3030
});
3131
},
3232
onSuccess: () => {
3333
addSuccessMessage(t('Build deleted successfully'));
3434
// TODO(preprod): navigate back to the release page once built?
35-
navigate(`/organizations/${organization.slug}/preprod/${projectId}/`);
35+
navigate(`/organizations/${organization.slug}/preprod/${projectSlug}/`);
3636
},
3737
onError: () => {
3838
addErrorMessage(t('Failed to delete build'));
@@ -53,7 +53,7 @@ export function useBuildDetailsActions({
5353
};
5454

5555
const handleDownloadAction = async () => {
56-
const downloadUrl = `/api/0/internal/${organization.slug}/${projectId}/files/preprodartifacts/${artifactId}/`;
56+
const downloadUrl = `/api/0/internal/${organization.slug}/${projectSlug}/files/preprodartifacts/${artifactId}/`;
5757

5858
try {
5959
const response = await fetch(downloadUrl, {

0 commit comments

Comments
 (0)