Skip to content

Commit fd20719

Browse files
authored
feat(explore): Way to go back to trace explorer (#77183)
For convenience, this button takes you back to the old trace explorer. The only way to undo is to remove the `view` query param or click `Traces` in the side bar again. # Screenshot ![image](https://github.com/user-attachments/assets/ce950d2c-12f4-48d4-ace3-9508414ec9e3)
1 parent 9c15063 commit fd20719

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

static/app/views/explore/content.tsx

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
import {useCallback} from 'react';
12
import styled from '@emotion/styled';
23
import type {Location} from 'history';
34

5+
import {Button} from 'sentry/components/button';
6+
import ButtonBar from 'sentry/components/buttonBar';
7+
import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton';
48
import * as Layout from 'sentry/components/layouts/thirds';
59
import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
610
import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
@@ -11,6 +15,8 @@ import {SpanSearchQueryBuilder} from 'sentry/components/performance/spanSearchQu
1115
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
1216
import {t} from 'sentry/locale';
1317
import {space} from 'sentry/styles/space';
18+
import {useLocation} from 'sentry/utils/useLocation';
19+
import {useNavigate} from 'sentry/utils/useNavigate';
1420
import useOrganization from 'sentry/utils/useOrganization';
1521
import usePageFilters from 'sentry/utils/usePageFilters';
1622

@@ -24,6 +30,8 @@ interface ExploreContentProps {
2430
}
2531

2632
export function ExploreContent({}: ExploreContentProps) {
33+
const location = useLocation();
34+
const navigate = useNavigate();
2735
const organization = useOrganization();
2836
const {selection} = usePageFilters();
2937

@@ -33,29 +41,47 @@ export function ExploreContent({}: ExploreContentProps) {
3341
? ['dataset toggle' as const]
3442
: [];
3543

44+
const switchToOldTraceExplorer = useCallback(() => {
45+
navigate({
46+
...location,
47+
query: {
48+
...location.query,
49+
view: 'trace',
50+
},
51+
});
52+
}, [location, navigate]);
53+
3654
return (
3755
<SentryDocumentTitle title={t('Explore')} orgSlug={organization.slug}>
3856
<PageFiltersContainer>
3957
<Layout.Page>
4058
<Layout.Header>
41-
<HeaderContent>
59+
<Layout.HeaderContent>
4260
<Title>{t('Explore')}</Title>
43-
<FilterActions>
44-
<PageFilterBar condensed>
45-
<ProjectPageFilter />
46-
<EnvironmentPageFilter />
47-
<DatePageFilter />
48-
</PageFilterBar>
49-
<SpanSearchQueryBuilder
50-
projects={selection.projects}
51-
initialQuery={userQuery}
52-
onSearch={setUserQuery}
53-
searchSource="explore"
54-
/>
55-
</FilterActions>
56-
</HeaderContent>
61+
</Layout.HeaderContent>
62+
<Layout.HeaderActions>
63+
<ButtonBar gap={1}>
64+
<Button onClick={switchToOldTraceExplorer}>
65+
{t('Switch to old Trace Explore')}
66+
</Button>
67+
<FeedbackWidgetButton />
68+
</ButtonBar>
69+
</Layout.HeaderActions>
5770
</Layout.Header>
5871
<Body>
72+
<FilterActions>
73+
<PageFilterBar condensed>
74+
<ProjectPageFilter />
75+
<EnvironmentPageFilter />
76+
<DatePageFilter />
77+
</PageFilterBar>
78+
<SpanSearchQueryBuilder
79+
projects={selection.projects}
80+
initialQuery={userQuery}
81+
onSearch={setUserQuery}
82+
searchSource="explore"
83+
/>
84+
</FilterActions>
5985
<Side>
6086
<ExploreToolbar extras={toolbarExtras} />
6187
</Side>
@@ -70,15 +96,12 @@ export function ExploreContent({}: ExploreContentProps) {
7096
);
7197
}
7298

73-
const HeaderContent = styled(Layout.HeaderContent)`
74-
overflow: visible;
75-
`;
76-
7799
const Title = styled(Layout.Title)`
78100
margin-bottom: ${space(2)};
79101
`;
80102

81103
const FilterActions = styled('div')`
104+
grid-column: 1 / -1;
82105
display: grid;
83106
gap: ${space(2)};
84107
grid-template-columns: auto;

static/app/views/traces/content.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ const DEFAULT_STATS_PERIOD = '24h';
3737
const DEFAULT_PER_PAGE = 50;
3838

3939
export default function Wrapper(props) {
40+
const location = useLocation();
4041
const organization = useOrganization();
4142

42-
if (organization.features.includes('visibility-explore-view')) {
43+
if (
44+
location.query.view !== 'trace' &&
45+
organization.features.includes('visibility-explore-view')
46+
) {
4347
return <ExploreContent {...props} />;
4448
}
4549

0 commit comments

Comments
 (0)