Skip to content

Commit d552f4b

Browse files
authored
feat(performance): Use new search bar in web vitals pages (#82440)
1 parent 85c0661 commit d552f4b

File tree

5 files changed

+55
-25
lines changed

5 files changed

+55
-25
lines changed

static/app/components/performance/transactionSearchQueryBuilder.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface TransactionSearchQueryBuilderProps {
3434
filterKeyMenuWidth?: number;
3535
onSearch?: (query: string, state: CallbackSearchState) => void;
3636
placeholder?: string;
37-
projects?: PageFilters['projects'];
37+
projects?: PageFilters['projects'] | Readonly<number[]>;
3838
trailingItems?: React.ReactNode;
3939
}
4040

static/app/views/performance/transactionSummary/transactionVitals/content.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import type {Location} from 'history';
55
import {Alert} from 'sentry/components/alert';
66
import {Button} from 'sentry/components/button';
77
import {CompactSelect} from 'sentry/components/compactSelect';
8-
import SearchBar from 'sentry/components/events/searchBar';
98
import * as Layout from 'sentry/components/layouts/thirds';
109
import ExternalLink from 'sentry/components/links/externalLink';
1110
import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
1211
import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
1312
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
1413
import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
14+
import {TransactionSearchQueryBuilder} from 'sentry/components/performance/transactionSearchQueryBuilder';
1515
import {t, tct} from 'sentry/locale';
1616
import {space} from 'sentry/styles/space';
1717
import type {Organization} from 'sentry/types/organization';
@@ -92,13 +92,14 @@ function VitalsContent(props: Props) {
9292
<EnvironmentPageFilter />
9393
<DatePageFilter />
9494
</PageFilterBar>
95-
<StyledSearchBar
96-
organization={organization}
97-
projectIds={eventView.project}
98-
query={query}
99-
fields={eventView.fields}
100-
onSearch={handleSearch}
101-
/>
95+
<StyledSearchBarWrapper>
96+
<TransactionSearchQueryBuilder
97+
projects={eventView.project}
98+
initialQuery={query}
99+
onSearch={handleSearch}
100+
searchSource="transaction_events"
101+
/>
102+
</StyledSearchBarWrapper>
102103
<CompactSelect
103104
value={activeFilter.value}
104105
options={FILTER_OPTIONS}
@@ -157,10 +158,10 @@ const FilterActions = styled('div')`
157158
}
158159
`;
159160

160-
const StyledSearchBar = styled(SearchBar)`
161+
const StyledSearchBarWrapper = styled('div')`
161162
@media (min-width: ${p => p.theme.breakpoints.small}) {
162163
order: 1;
163-
grid-column: 1/5;
164+
grid-column: 1/6;
164165
}
165166
166167
@media (min-width: ${p => p.theme.breakpoints.xlarge}) {

static/app/views/performance/transactionSummary/transactionVitals/index.spec.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ describe('Performance > Web Vitals', function () {
175175
url: '/organizations/org-slug/replay-count/',
176176
body: {},
177177
});
178+
MockApiClient.addMockResponse({
179+
url: '/organizations/org-slug/recent-searches/',
180+
body: [],
181+
});
178182
});
179183

180184
afterEach(() => {

static/app/views/performance/vitalDetail/index.spec.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import {MetricsFieldFixture} from 'sentry-fixture/metrics';
22
import {OrganizationFixture} from 'sentry-fixture/organization';
33

44
import {initializeOrg} from 'sentry-test/initializeOrg';
5-
import {render, screen, userEvent, within} from 'sentry-test/reactTestingLibrary';
5+
import {
6+
render,
7+
screen,
8+
userEvent,
9+
waitFor,
10+
within,
11+
} from 'sentry-test/reactTestingLibrary';
612
import {textWithMarkupMatcher} from 'sentry-test/utils';
713

814
import ProjectsStore from 'sentry/stores/projectsStore';
@@ -224,7 +230,9 @@ describe('Performance > VitalDetail', function () {
224230
});
225231

226232
// It shows a search bar
227-
expect(await screen.findByLabelText('Search events')).toBeInTheDocument();
233+
expect(
234+
await screen.findByPlaceholderText('Search for events, users, tags, and more')
235+
).toBeInTheDocument();
228236

229237
// It shows the vital card
230238
expect(
@@ -249,12 +257,17 @@ describe('Performance > VitalDetail', function () {
249257
});
250258

251259
// Fill out the search box, and submit it.
252-
await userEvent.click(await screen.findByLabelText('Search events'));
260+
await userEvent.click(
261+
await screen.findByPlaceholderText('Search for events, users, tags, and more')
262+
);
253263
await userEvent.paste('user.email:uhoh*');
254264
await userEvent.keyboard('{enter}');
255265

256266
// Check the navigation.
257-
expect(browserHistory.push).toHaveBeenCalledTimes(1);
267+
await waitFor(() => {
268+
expect(browserHistory.push).toHaveBeenCalledTimes(1);
269+
});
270+
258271
expect(browserHistory.push).toHaveBeenCalledWith({
259272
pathname: undefined,
260273
query: {

static/app/views/performance/vitalDetail/vitalDetailContent.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {getInterval} from 'sentry/components/charts/utils';
1111
import {CreateAlertFromViewButton} from 'sentry/components/createAlertButton';
1212
import type {MenuItemProps} from 'sentry/components/dropdownMenu';
1313
import {DropdownMenu} from 'sentry/components/dropdownMenu';
14-
import SearchBar from 'sentry/components/events/searchBar';
1514
import * as Layout from 'sentry/components/layouts/thirds';
1615
import LoadingIndicator from 'sentry/components/loadingIndicator';
1716
import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
@@ -20,6 +19,7 @@ import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
2019
import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
2120
import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
2221
import * as TeamKeyTransactionManager from 'sentry/components/performance/teamKeyTransactionsManager';
22+
import {TransactionSearchQueryBuilder} from 'sentry/components/performance/transactionSearchQueryBuilder';
2323
import {IconCheckmark, IconClose} from 'sentry/icons';
2424
import {t} from 'sentry/locale';
2525
import {space} from 'sentry/styles/space';
@@ -176,7 +176,7 @@ function VitalDetailContent(props: Props) {
176176
function renderContent(vital: WebVital) {
177177
const {location, organization, eventView, projects} = props;
178178

179-
const {fields, start, end, statsPeriod, environment, project} = eventView;
179+
const {start, end, statsPeriod, environment, project} = eventView;
180180

181181
const query = decodeScalar(location.query.query, '');
182182
const orgSlug = organization.slug;
@@ -197,14 +197,14 @@ function VitalDetailContent(props: Props) {
197197
<EnvironmentPageFilter />
198198
<DatePageFilter />
199199
</PageFilterBar>
200-
<SearchBar
201-
searchSource="performance_vitals"
202-
organization={organization}
203-
projectIds={project}
204-
query={query}
205-
fields={fields}
206-
onSearch={handleSearch}
207-
/>
200+
<StyledSearchBarWrapper>
201+
<TransactionSearchQueryBuilder
202+
projects={project}
203+
initialQuery={query}
204+
onSearch={handleSearch}
205+
searchSource="performance_vitals"
206+
/>
207+
</StyledSearchBarWrapper>
208208
</FilterActions>
209209
<VitalChart
210210
organization={organization}
@@ -331,3 +331,15 @@ const FilterActions = styled('div')`
331331
grid-template-columns: auto 1fr;
332332
}
333333
`;
334+
335+
const StyledSearchBarWrapper = styled('div')`
336+
@media (min-width: ${p => p.theme.breakpoints.small}) {
337+
order: 1;
338+
grid-column: 1/6;
339+
}
340+
341+
@media (min-width: ${p => p.theme.breakpoints.xlarge}) {
342+
order: initial;
343+
grid-column: auto;
344+
}
345+
`;

0 commit comments

Comments
 (0)