Skip to content

feat(releases): Use routing for Releases Drawer #88562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3be0469
feat(releases): Use routing for Releases Drawer
billyvg Apr 2, 2025
434090e
subPageFilters -> pageFilters
billyvg Apr 15, 2025
cd7c7eb
double useReleasesDrawer
billyvg Apr 22, 2025
17d2773
update subPageFilters
billyvg Apr 22, 2025
3d5e585
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 22, 2025
6b338a2
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 23, 2025
5943a59
needs to be default exports
billyvg Apr 23, 2025
21880e1
default exports
billyvg Apr 23, 2025
ff4911a
specify height from releasedrawerlist
billyvg Apr 23, 2025
5e727e0
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 24, 2025
a5c94c0
Refactor query parameters handling in the Releases Drawer components …
billyvg Apr 24, 2025
9afb3d8
refactor to use query params enum
billyvg Apr 24, 2025
5c8caa1
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 24, 2025
49ba03a
tweak to clear cursors only
billyvg Apr 24, 2025
c88cfc1
fix wrong query params
billyvg Apr 24, 2025
8268832
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 24, 2025
075711f
temp handle case where we do not have releaseProjectId in URL
billyvg Apr 24, 2025
62f1bc8
check loading state
billyvg Apr 24, 2025
68cba6b
add analytics events for releases drawer
billyvg Apr 24, 2025
4aebd40
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 24, 2025
09f3196
fix lint
billyvg Apr 24, 2025
8b3cc97
fix issues eventgraphwidget
billyvg Apr 24, 2025
adccee3
fix navigation in eventGraph
billyvg Apr 24, 2025
570af0a
more refactoring
billyvg Apr 24, 2025
278c990
Merge branch 'master' into billy/replay-2-releases-drawer-needs-to-ha…
billyvg Apr 25, 2025
35a5d5c
lint
billyvg Apr 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/app/components/globalDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface DrawerOptions {
/**
* If true (default), closes the drawer when the location changes
*/
shouldCloseOnLocationChange?: (newPathname: Location) => boolean;
shouldCloseOnLocationChange?: (nextLocation: Location) => boolean;
//
// Custom framer motion transition for the drawer
//
Expand Down
1 change: 0 additions & 1 deletion static/app/utils/dates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import ConfigStore from 'sentry/stores/configStore';

import type {TableDataRow} from './discover/discoverQuery';

// TODO(billy): Move to TimeRangeSelector specific utils
export const DEFAULT_DAY_START_TIME = '00:00:00';
export const DEFAULT_DAY_END_TIME = '23:59:59';
const DATE_FORMAT_NO_TIMEZONE = 'YYYY/MM/DD HH:mm:ss';
Expand Down
5 changes: 4 additions & 1 deletion static/app/utils/useReleaseStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ interface UseReleaseStatsParams {
*/
export function useReleaseStats(
{datetime, environments, projects, maxPages = 10}: UseReleaseStatsParams,
queryOptions: {staleTime: number} = {staleTime: Infinity}
queryOptions: {enabled?: boolean; staleTime?: number} = {
staleTime: Infinity,
enabled: true,
}
) {
const organization = useOrganization();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {useCallback, useRef} from 'react';
import {useNavigate} from 'react-router-dom';
import {useTheme} from '@emotion/react';
import styled from '@emotion/styled';
import {mergeRefs} from '@react-aria/utils';
Expand Down Expand Up @@ -31,6 +30,8 @@ import {defined} from 'sentry/utils';
import {uniq} from 'sentry/utils/array/uniq';
import type {AggregationOutputType} from 'sentry/utils/discover/fields';
import {type Range, RangeMap} from 'sentry/utils/number/rangeMap';
import {useLocation} from 'sentry/utils/useLocation';
import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import {useWidgetSyncContext} from 'sentry/views/dashboards/contexts/widgetSyncContext';
Expand Down Expand Up @@ -63,12 +64,6 @@ export interface TimeSeriesWidgetVisualizationProps
* An array of `Plottable` objects. This can be any object that implements the `Plottable` interface.
*/
plottables: Plottable[];
/**
/**
* Disables navigating to release details when clicked
* TODO(billy): temporary until we implement route based nav
*/
disableReleaseNavigation?: boolean;
/**
* A mapping of time series field name to boolean. If the value is `false`, the series is hidden from view
*/
Expand Down Expand Up @@ -119,6 +114,7 @@ export function TimeSeriesWidgetVisualization(props: TimeSeriesWidgetVisualizati
const theme = useTheme();
const organization = useOrganization();
const navigate = useNavigate();
const location = useLocation();
const hasReleaseBubbles =
organization.features.includes('release-bubbles-ui') &&
props.showReleaseAs === 'bubble';
Expand All @@ -136,22 +132,7 @@ export function TimeSeriesWidgetVisualization(props: TimeSeriesWidgetVisualizati
releaseBubbleXAxis,
releaseBubbleGrid,
} = useReleaseBubbles({
chartRenderer: ({start: trimStart, end: trimEnd, ref: chartRendererRef}) => {
return (
<DrawerWidgetWrapper>
<TimeSeriesWidgetVisualization
{...props}
ref={chartRendererRef}
disableReleaseNavigation
onZoom={() => {}}
plottables={props.plottables.map(plottable =>
plottable.constrain(trimStart, trimEnd)
)}
showReleaseAs="line"
/>
</DrawerWidgetWrapper>
);
},
chartId: props.id,
minTime: earliestTimeStamp ? new Date(earliestTimeStamp).getTime() : undefined,
maxTime: latestTimeStamp ? new Date(latestTimeStamp).getTime() : undefined,
releases: hasReleaseBubbles
Expand All @@ -166,7 +147,14 @@ export function TimeSeriesWidgetVisualization(props: TimeSeriesWidgetVisualizati
theme,
props.releases,
function onReleaseClick(release: Release) {
if (props.disableReleaseNavigation) {
if (organization.features.includes('release-bubbles-ui')) {
navigate({
query: {
...location.query,
rd: 'show',
rdRelease: release.version,
},
});
return;
}
navigate(
Expand Down Expand Up @@ -683,8 +671,4 @@ const LoadingMask = styled(TransparentLoadingMask)`
background: ${p => p.theme.background};
`;

const DrawerWidgetWrapper = styled('div')`
height: 220px;
`;

TimeSeriesWidgetVisualization.LoadingPlaceholder = LoadingPanel;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {openInsightChartModal} from 'sentry/actionCreators/modal';
import {Button} from 'sentry/components/core/button';
import {IconExpand} from 'sentry/icons';
import {t} from 'sentry/locale';
import type {PageFilters} from 'sentry/types/core';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import {useReleaseStats} from 'sentry/utils/useReleaseStats';
Expand Down Expand Up @@ -47,8 +48,10 @@ export interface InsightsTimeSeriesWidgetProps
interactiveTitle?: () => React.ReactNode;
legendSelection?: LegendSelection | undefined;
onLegendSelectionChange?: ((selection: LegendSelection) => void) | undefined;
pageFilters?: PageFilters;
samples?: Samples;
showLegend?: TimeSeriesWidgetVisualizationProps['showLegend'];
showReleaseAs?: 'line' | 'bubble';
stacked?: boolean;
}

Expand Down
16 changes: 3 additions & 13 deletions static/app/views/issueDetails/streamline/eventGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
import {useReleaseMarkLineSeries} from 'sentry/views/issueDetails/streamline/hooks/useReleaseMarkLineSeries';
import {Tab} from 'sentry/views/issueDetails/types';
import {useGroupDetailsRoute} from 'sentry/views/issueDetails/useGroupDetailsRoute';
import {useReleasesDrawer} from 'sentry/views/releases/drawer/useReleasesDrawer';
import {useReleaseBubbles} from 'sentry/views/releases/releaseBubbles/useReleaseBubbles';

const enum EventGraphSeries {
Expand Down Expand Up @@ -277,19 +278,6 @@ export function EventGraph({
releaseBubbleXAxis,
releaseBubbleGrid,
} = useReleaseBubbles({
chartRenderer: ({ref: chartRef}) => {
return (
<EventGraph
ref={chartRef}
group={group}
event={event}
showSummary={false}
showReleasesAs="line"
disableZoomNavigation
{...styleProps}
/>
);
},
alignInMiddle: true,
legendSelected: legendSelected.Releases,
desiredBuckets: eventSeries.length,
Expand All @@ -308,6 +296,8 @@ export function EventGraph({
},
});

useReleasesDrawer();

const handleConnectRef = useCallback(
(e: ReactEchartsRef | null) => {
connectReleaseBubbleChartRef(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {SecondaryNav} from 'sentry/views/nav/secondary/secondary';
import {PrimaryNavGroup} from 'sentry/views/nav/types';
import {isLinkActive} from 'sentry/views/nav/utils';
import {makeProjectsPathname} from 'sentry/views/projects/pathname';
import {useReleasesDrawer} from 'sentry/views/releases/drawer/useReleasesDrawer';

const platformsUsingOverviewAsProjectDetails: PlatformKey[] = ['php-laravel'];

Expand All @@ -44,9 +45,10 @@ export function InsightsSecondaryNav() {
const location = useLocation();
const baseUrl = `/organizations/${organization.slug}/${DOMAIN_VIEW_BASE_URL}`;
const isLaravelInsightsAvailable = useIsLaravelInsightsAvailable();

const {projects} = useProjects();

useReleasesDrawer();

const [starredProjects, nonStarredProjects] = useMemo(() => {
return partition(projects, project => project.isBookmarked);
}, [projects]);
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/releases/drawer/commitsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function CommitsList({release, releaseRepos, projectSlug}: CommitsProps)
release,
projectSlug,
activeRepository: activeReleaseRepo,
cursor: location.query.commitsCursor,
cursor: location.query.rdCiCursor,
});

const commitsByRepository = getCommitsByRepository(commitList);
Expand Down Expand Up @@ -81,7 +81,7 @@ export function CommitsList({release, releaseRepos, projectSlug}: CommitsProps)
onCursor={(cursor, path, searchQuery) => {
navigate({
pathname: path,
query: {...searchQuery, commitsCursor: cursor},
query: {...searchQuery, rdCiCursor: cursor},
});
}}
/>
Expand Down
Loading
Loading