Skip to content

Commit 4e4b061

Browse files
edwardgou-sentryandrewshie-sentry
authored andcommitted
feat(explore): Removes breadcrumbs from the all queries view and adds a create query button (#90833)
1 parent ff25588 commit 4e4b061

File tree

5 files changed

+20
-26
lines changed

5 files changed

+20
-26
lines changed

static/app/views/alerts/rules/utils.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('getExploreUrl', () => {
1919
projectId: '1',
2020
});
2121
expect(url).toBe(
22-
'/organizations/slug/traces/?dataset=spansRpc&environment=prod&interval=30m&project=1&query=span.op%3Ahttp.client&statsPeriod=7d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22p75%28span.duration%29%22%5D%7D'
22+
'/organizations/slug/traces/?environment=prod&interval=30m&project=1&query=span.op%3Ahttp.client&statsPeriod=7d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22p75%28span.duration%29%22%5D%7D'
2323
);
2424
});
2525
it('should return the correct url for 9998m', () => {
@@ -36,7 +36,7 @@ describe('getExploreUrl', () => {
3636
projectId: '1',
3737
});
3838
expect(url).toBe(
39-
'/organizations/slug/traces/?dataset=spansRpc&environment=prod&interval=30m&project=1&query=span.op%3Ahttp.client&statsPeriod=7d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22p75%28span.duration%29%22%5D%7D'
39+
'/organizations/slug/traces/?environment=prod&interval=30m&project=1&query=span.op%3Ahttp.client&statsPeriod=7d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22p75%28span.duration%29%22%5D%7D'
4040
);
4141
});
4242
});

static/app/views/dashboards/utils/getWidgetExploreUrl.spec.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('getWidgetExploreUrl', () => {
2828

2929
// Note: for table widgets the mode is set to samples and the fields are propagated
3030
expect(url).toBe(
31-
'/organizations/org-slug/traces/?dataset=spansRpc&groupBy=span.description&interval=30m&mode=aggregate&statsPeriod=14d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D'
31+
'/organizations/org-slug/traces/?groupBy=span.description&interval=30m&mode=aggregate&statsPeriod=14d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D'
3232
);
3333
});
3434

@@ -51,7 +51,7 @@ describe('getWidgetExploreUrl', () => {
5151

5252
// Note: for table widgets the mode is set to samples and the fields are propagated
5353
expect(url).toBe(
54-
'/organizations/org-slug/traces/?dataset=spansRpc&field=span.description&field=span.duration&interval=30m&mode=samples&statsPeriod=14d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%5D%7D'
54+
'/organizations/org-slug/traces/?field=span.description&field=span.duration&interval=30m&mode=samples&statsPeriod=14d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%5D%7D'
5555
);
5656
});
5757

@@ -75,7 +75,7 @@ describe('getWidgetExploreUrl', () => {
7575
// Note: for line widgets the mode is set to aggregate
7676
// The chart type is set to 1 for area charts
7777
expect(url).toBe(
78-
'/organizations/org-slug/traces/?dataset=spansRpc&groupBy=span.description&interval=30m&mode=aggregate&statsPeriod=14d&visualize=%7B%22chartType%22%3A2%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D'
78+
'/organizations/org-slug/traces/?groupBy=span.description&interval=30m&mode=aggregate&statsPeriod=14d&visualize=%7B%22chartType%22%3A2%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D'
7979
);
8080
});
8181

@@ -99,7 +99,7 @@ describe('getWidgetExploreUrl', () => {
9999
// Note: for line widgets the mode is set to aggregate
100100
// The chart type is set to 1 for area charts
101101
expect(url).toBe(
102-
'/organizations/org-slug/traces/?dataset=spansRpc&groupBy=&interval=30m&mode=aggregate&statsPeriod=14d&visualize=%7B%22chartType%22%3A2%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D'
102+
'/organizations/org-slug/traces/?groupBy=&interval=30m&mode=aggregate&statsPeriod=14d&visualize=%7B%22chartType%22%3A2%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D'
103103
);
104104
});
105105

@@ -123,7 +123,7 @@ describe('getWidgetExploreUrl', () => {
123123

124124
// The URL should have the sort and another visualize to plot the sort
125125
expect(url).toBe(
126-
'/organizations/org-slug/traces/?dataset=spansRpc&groupBy=span.description&interval=30m&mode=aggregate&sort=-count%28span.duration%29&statsPeriod=14d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22count%28span.duration%29%22%5D%7D'
126+
'/organizations/org-slug/traces/?groupBy=span.description&interval=30m&mode=aggregate&sort=-count%28span.duration%29&statsPeriod=14d&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22avg%28span.duration%29%22%5D%7D&visualize=%7B%22chartType%22%3A1%2C%22yAxes%22%3A%5B%22count%28span.duration%29%22%5D%7D'
127127
);
128128
});
129129
});

static/app/views/explore/savedQueries/index.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import Breadcrumbs from 'sentry/components/breadcrumbs';
1+
import {LinkButton} from 'sentry/components/core/button';
22
import {ButtonBar} from 'sentry/components/core/button/buttonBar';
33
import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton';
44
import * as Layout from 'sentry/components/layouts/thirds';
55
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
6+
import {IconAdd} from 'sentry/icons/iconAdd';
67
import {t} from 'sentry/locale';
78
import useOrganization from 'sentry/utils/useOrganization';
89
import {SavedQueriesLandingContent} from 'sentry/views/explore/savedQueries/savedQueriesLandingContent';
9-
import {makeTracesPathname} from 'sentry/views/traces/pathnames';
10+
import {getExploreUrl} from 'sentry/views/explore/utils';
1011

1112
export default function SavedQueriesView() {
1213
const organization = useOrganization();
@@ -16,23 +17,19 @@ export default function SavedQueriesView() {
1617
<Layout.Page>
1718
<Layout.Header>
1819
<Layout.HeaderContent>
19-
<Breadcrumbs
20-
crumbs={[
21-
{
22-
label: t('Explore'),
23-
to: makeTracesPathname({organization, path: '/'}),
24-
},
25-
{
26-
label: t('All Queries'),
27-
to: `/organizations/${organization.slug}/explore/saved-queries/`,
28-
},
29-
]}
30-
/>
3120
<Layout.Title>{t('All Queries')}</Layout.Title>
3221
</Layout.HeaderContent>
3322
<Layout.HeaderActions>
3423
<ButtonBar gap={1}>
3524
<FeedbackWidgetButton />
25+
<LinkButton
26+
priority="primary"
27+
icon={<IconAdd />}
28+
size="sm"
29+
to={getExploreUrl({organization, visualize: []})}
30+
>
31+
{t('Create Query')}
32+
</LinkButton>
3633
</ButtonBar>
3734
</Layout.HeaderActions>
3835
</Layout.Header>

static/app/views/explore/savedQueries/savedQueriesTable.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('SavedQueriesTable', () => {
125125
});
126126
expect(await screen.findByText('Query Name')).toHaveAttribute(
127127
'href',
128-
'/organizations/org-slug/traces/?dataset=spansRpc&environment=production&groupBy=&id=1&project=1&title=Query%20Name'
128+
'/organizations/org-slug/traces/?environment=production&groupBy=&id=1&project=1&title=Query%20Name'
129129
);
130130
});
131131

@@ -159,7 +159,7 @@ describe('SavedQueriesTable', () => {
159159
});
160160
expect(await screen.findByText('Query Name')).toHaveAttribute(
161161
'href',
162-
'/organizations/org-slug/explore/traces/compare/?dataset=spansRpc&environment=production&id=1&project=1&queries=%7B%22groupBys%22%3A%5B%5D%2C%22yAxes%22%3A%5B%5D%7D&queries=%7B%22groupBys%22%3A%5B%5D%2C%22yAxes%22%3A%5B%5D%7D&title=Query%20Name'
162+
'/organizations/org-slug/explore/traces/compare/?environment=production&id=1&project=1&queries=%7B%22groupBys%22%3A%5B%5D%2C%22yAxes%22%3A%5B%5D%7D&queries=%7B%22groupBys%22%3A%5B%5D%2C%22yAxes%22%3A%5B%5D%7D&title=Query%20Name'
163163
);
164164
});
165165

static/app/views/explore/utils.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {Project} from 'sentry/types/project';
88
import {defined} from 'sentry/utils';
99
import {dedupeArray} from 'sentry/utils/dedupeArray';
1010
import {encodeSort} from 'sentry/utils/discover/eventView';
11-
import {DiscoverDatasets} from 'sentry/utils/discover/types';
1211
import {decodeSorts} from 'sentry/utils/queryString';
1312
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
1413
import {determineSeriesSampleCountAndIsSampled} from 'sentry/views/alerts/rules/metric/utils/determineSeriesSampleCount';
@@ -53,7 +52,6 @@ export function getExploreUrl({
5352
const {start, end, period: statsPeriod, utc} = selection?.datetime ?? {};
5453
const {environments, projects} = selection ?? {};
5554
const queryParams = {
56-
dataset: DiscoverDatasets.SPANS_EAP_RPC,
5755
project: projects,
5856
environment: environments,
5957
statsPeriod,
@@ -153,7 +151,6 @@ function getExploreMultiQueryUrl({
153151
const {start, end, period: statsPeriod, utc} = selection.datetime;
154152
const {environments, projects} = selection;
155153
const queryParams = {
156-
dataset: DiscoverDatasets.SPANS_EAP_RPC,
157154
project: projects,
158155
environment: environments,
159156
statsPeriod,

0 commit comments

Comments
 (0)