From 95b8d6b318d2093aab3a94e4975a710d9eb20a8f Mon Sep 17 00:00:00 2001 From: Max Topolsky Date: Tue, 25 Nov 2025 13:58:41 -0500 Subject: [PATCH 1/2] make build details and build compare breadcrumb consistent --- .../header/buildCompareHeaderContent.tsx | 28 +++++++++++------ .../header/buildDetailsHeaderContent.tsx | 31 ++----------------- static/app/views/preprod/utils/releasesUrl.ts | 25 +++++++++++++++ 3 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 static/app/views/preprod/utils/releasesUrl.ts diff --git a/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx b/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx index 1a0bc5450fcd2c..39f0a63ad476f6 100644 --- a/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx +++ b/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx @@ -12,7 +12,7 @@ import {Breadcrumbs, type Crumb} from 'sentry/components/breadcrumbs'; import FeedbackButton from 'sentry/components/feedbackButton/feedbackButton'; import {IconCode, IconDownload, IconJson, IconMobile} from 'sentry/icons'; import {t} from 'sentry/locale'; -import useOrganization from 'sentry/utils/useOrganization'; +import ProjectsStore from 'sentry/stores/projectsStore'; import { isSizeInfoCompleted, type BuildDetailsApiResponse, @@ -24,6 +24,7 @@ import { getPlatformIconFromPlatform, getReadablePlatformLabel, } from 'sentry/views/preprod/utils/labelUtils'; +import {makeReleasesUrl} from 'sentry/views/preprod/utils/releasesUrl'; interface BuildCompareHeaderContentProps { buildDetails: BuildDetailsApiResponse; @@ -32,23 +33,30 @@ interface BuildCompareHeaderContentProps { export function BuildCompareHeaderContent(props: BuildCompareHeaderContentProps) { const {buildDetails, projectId} = props; - const organization = useOrganization(); const theme = useTheme(); + const project = ProjectsStore.getBySlug(projectId); const labels = getLabels(buildDetails.app_info?.platform ?? undefined); const breadcrumbs: Crumb[] = [ { - to: '#', + to: makeReleasesUrl(project?.id, {}), label: t('Releases'), }, - { - to: `/organizations/${organization.slug}/preprod/${projectId}/${buildDetails.id}/`, - label: buildDetails.app_info.version ?? t('Build Version'), - }, - { - label: t('Compare'), - }, ]; + if (buildDetails.app_info.version) { + breadcrumbs.push({ + to: makeReleasesUrl(project?.id, { + version: buildDetails.app_info.version, + appId: buildDetails.app_info.app_id ?? undefined, + }), + label: buildDetails.app_info.version, + }); + } + + breadcrumbs.push({ + label: t('Compare'), + }); + return ( diff --git a/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx b/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx index e7e1b3f5cdbb2a..e5ca48c4997f7d 100644 --- a/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx +++ b/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx @@ -29,35 +29,10 @@ import type RequestError from 'sentry/utils/requestError/requestError'; import {useIsSentryEmployee} from 'sentry/utils/useIsSentryEmployee'; import useOrganization from 'sentry/utils/useOrganization'; import type {BuildDetailsApiResponse} from 'sentry/views/preprod/types/buildDetailsTypes'; +import {makeReleasesUrl} from 'sentry/views/preprod/utils/releasesUrl'; import {useBuildDetailsActions} from './useBuildDetailsActions'; -function makeReleasesUrl( - projectId: string | undefined, - query: {appId?: string; version?: string} -): string { - const {appId, version} = query; - - // Not knowing the projectId should be transient. - if (projectId === undefined) { - return '#'; - } - - const params = new URLSearchParams(); - params.set('project', projectId); - const parts = []; - if (appId) { - parts.push(`release.package:${appId}`); - } - if (version) { - parts.push(`release.version:${version}`); - } - if (parts.length) { - params.set('query', parts.join(' ')); - } - return `/explore/releases/?${params}`; -} - interface BuildDetailsHeaderContentProps { artifactId: string; buildDetailsQuery: UseApiQueryResult; @@ -107,9 +82,7 @@ export function BuildDetailsHeaderContent(props: BuildDetailsHeaderContentProps) const breadcrumbs: Crumb[] = [ { - to: makeReleasesUrl(project?.id, { - version: buildDetailsData.app_info.version ?? undefined, - }), + to: makeReleasesUrl(project?.id, {}), label: 'Releases', }, ]; diff --git a/static/app/views/preprod/utils/releasesUrl.ts b/static/app/views/preprod/utils/releasesUrl.ts new file mode 100644 index 00000000000000..7e95dc44b794ff --- /dev/null +++ b/static/app/views/preprod/utils/releasesUrl.ts @@ -0,0 +1,25 @@ +export function makeReleasesUrl( + projectId: string | undefined, + query: {appId?: string; version?: string} +): string { + const {appId, version} = query; + + // Not knowing the projectId should be transient. + if (projectId === undefined) { + return '#'; + } + + const params = new URLSearchParams(); + params.set('project', projectId); + const parts = []; + if (appId) { + parts.push(`release.package:${appId}`); + } + if (version) { + parts.push(`release.version:${version}`); + } + if (parts.length) { + params.set('query', parts.join(' ')); + } + return `/explore/releases/?${params}`; +} From a9ac43f3f3a041390e2afa3cf1873e9c55fccd5c Mon Sep 17 00:00:00 2001 From: Max Topolsky Date: Tue, 25 Nov 2025 14:01:50 -0500 Subject: [PATCH 2/2] filter for app id in releases --- .../buildComparison/header/buildCompareHeaderContent.tsx | 4 +++- .../preprod/buildDetails/header/buildDetailsHeaderContent.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx b/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx index 39f0a63ad476f6..83caa63333bafd 100644 --- a/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx +++ b/static/app/views/preprod/buildComparison/header/buildCompareHeaderContent.tsx @@ -38,7 +38,9 @@ export function BuildCompareHeaderContent(props: BuildCompareHeaderContentProps) const labels = getLabels(buildDetails.app_info?.platform ?? undefined); const breadcrumbs: Crumb[] = [ { - to: makeReleasesUrl(project?.id, {}), + to: makeReleasesUrl(project?.id, { + appId: buildDetails.app_info.app_id ?? undefined, + }), label: t('Releases'), }, ]; diff --git a/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx b/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx index e5ca48c4997f7d..423967ab8318e7 100644 --- a/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx +++ b/static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx @@ -82,7 +82,9 @@ export function BuildDetailsHeaderContent(props: BuildDetailsHeaderContentProps) const breadcrumbs: Crumb[] = [ { - to: makeReleasesUrl(project?.id, {}), + to: makeReleasesUrl(project?.id, { + appId: buildDetailsData.app_info.app_id ?? undefined, + }), label: 'Releases', }, ];