Skip to content
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

chore(dashboards): Remove usage of query builder feature flags #78773

Merged
merged 8 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions static/app/views/dashboards/datasetConfig/errors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {doEventsRequest} from 'sentry/actionCreators/events';
import type {Client} from 'sentry/api';
import type {PageFilters} from 'sentry/types/core';
import type {Series} from 'sentry/types/echarts';
import {SavedSearchType, type TagCollection} from 'sentry/types/group';
import type {TagCollection} from 'sentry/types/group';
import type {
EventsStats,
MultiSeriesEventsStats,
Expand Down Expand Up @@ -69,9 +69,7 @@ export const ErrorsConfig: DatasetConfig<
defaultWidgetQuery: DEFAULT_WIDGET_QUERY,
enableEquations: true,
getCustomFieldRenderer: getCustomEventsFieldRenderer,
SearchBar: props => (
<EventsSearchBar savedSearchType={SavedSearchType.ERROR} {...props} />
),
SearchBar: EventsSearchBar,
filterSeriesSortOptions,
filterYAxisAggregateParams,
filterYAxisOptions,
Expand Down
6 changes: 2 additions & 4 deletions static/app/views/dashboards/datasetConfig/transactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {doEventsRequest} from 'sentry/actionCreators/events';
import type {Client} from 'sentry/api';
import type {PageFilters} from 'sentry/types/core';
import type {Series} from 'sentry/types/echarts';
import {SavedSearchType, type TagCollection} from 'sentry/types/group';
import type {TagCollection} from 'sentry/types/group';
import type {
EventsStats,
MultiSeriesEventsStats,
Expand Down Expand Up @@ -73,9 +73,7 @@ export const TransactionsConfig: DatasetConfig<
defaultWidgetQuery: DEFAULT_WIDGET_QUERY,
enableEquations: true,
getCustomFieldRenderer: getCustomEventsFieldRenderer,
SearchBar: props => (
<EventsSearchBar savedSearchType={SavedSearchType.TRANSACTION} {...props} />
),
SearchBar: EventsSearchBar,
filterSeriesSortOptions,
filterYAxisAggregateParams,
filterYAxisOptions,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,49 +1,35 @@
import styled from '@emotion/styled';

import type {SearchBarProps} from 'sentry/components/events/searchBar';
import SearchBar from 'sentry/components/events/searchBar';
import {MAX_QUERY_LENGTH} from 'sentry/constants';
import type {PageFilters} from 'sentry/types/core';
import {SavedSearchType} from 'sentry/types/group';
import type {Organization} from 'sentry/types/organization';
import {generateAggregateFields} from 'sentry/utils/discover/fields';
import type {DiscoverDatasets} from 'sentry/utils/discover/types';
import useCustomMeasurements from 'sentry/utils/useCustomMeasurements';
import type {WidgetQuery} from 'sentry/views/dashboards/types';
import {eventViewFromWidget, hasDatasetSelector} from 'sentry/views/dashboards/utils';
import {
MAX_MENU_HEIGHT,
MAX_SEARCH_ITEMS,
} from 'sentry/views/dashboards/widgetBuilder/utils';
import ResultsSearchQueryBuilder from 'sentry/views/discover/resultsSearchQueryBuilder';

interface Props {
getFilterWarning: SearchBarProps['getFilterWarning'];
onClose: SearchBarProps['onClose'];
organization: Organization;
pageFilters: PageFilters;
widgetQuery: WidgetQuery;
dataset?: DiscoverDatasets;
savedSearchType?: SavedSearchType;
}

export function EventsSearchBar({
organization,
pageFilters,
getFilterWarning,
onClose,
widgetQuery,
dataset,
savedSearchType = SavedSearchType.EVENT,
}: Props) {
const {customMeasurements} = useCustomMeasurements();
const projectIds = pageFilters.projects;
const eventView = eventViewFromWidget('', widgetQuery, pageFilters);
const fields = eventView.hasAggregateField()
? generateAggregateFields(organization, eventView.fields)
: eventView.fields;

return organization.features.includes('search-query-builder-discover') ? (
return (
<ResultsSearchQueryBuilder
projectIds={eventView.project}
query={widgetQuery.conditions}
Expand All @@ -56,27 +42,5 @@ export function EventsSearchBar({
includeTransactions={hasDatasetSelector(organization) ? false : true}
searchSource="widget_builder"
/>
) : (
<Search
searchSource="widget_builder"
organization={organization}
projectIds={projectIds}
query={widgetQuery.conditions}
fields={fields}
onClose={onClose}
getFilterWarning={getFilterWarning}
useFormWrapper={false}
maxQueryLength={MAX_QUERY_LENGTH}
maxSearchItems={MAX_SEARCH_ITEMS}
maxMenuHeight={MAX_MENU_HEIGHT}
savedSearchType={savedSearchType}
customMeasurements={customMeasurements}
dataset={dataset}
includeTransactions={hasDatasetSelector(organization) ? false : true}
/>
);
}

const Search = styled(SearchBar)`
flex-grow: 1;
`;

This file was deleted.

Loading
Loading