Browse Source

ref(replay/feedback): remove flag checks for GA'd search bars (#78415)

Ref https://github.com/getsentry/sentry/issues/75008
https://github.com/getsentry/sentry/issues/75006
Andrew Liu 5 months ago
parent
commit
a4cee267d5

+ 11 - 45
static/app/components/feedback/feedbackSearch.tsx

@@ -1,12 +1,9 @@
-import type {CSSProperties} from 'react';
 import {useCallback, useMemo} from 'react';
-import styled from '@emotion/styled';
 import orderBy from 'lodash/orderBy';
 
 import {fetchTagValues, useFetchOrganizationTags} from 'sentry/actionCreators/tags';
 import {SearchQueryBuilder} from 'sentry/components/searchQueryBuilder';
 import type {FilterKeySection} from 'sentry/components/searchQueryBuilder/types';
-import SmartSearchBar from 'sentry/components/smartSearchBar';
 import {t} from 'sentry/locale';
 import type {Tag, TagCollection, TagValue} from 'sentry/types/group';
 import type {Organization} from 'sentry/types/organization';
@@ -121,12 +118,7 @@ const getFilterKeySections = (
   ];
 };
 
-interface Props {
-  className?: string;
-  style?: CSSProperties;
-}
-
-export default function FeedbackSearch({className, style}: Props) {
+export default function FeedbackSearch() {
   const {selection: pageFilters} = usePageFilters();
   const projectIds = pageFilters.projects;
   const {pathname, query: locationQuery} = useLocation();
@@ -218,42 +210,16 @@ export default function FeedbackSearch({className, style}: Props) {
     [navigate, pathname, locationQuery]
   );
 
-  if (organization.features.includes('search-query-builder-user-feedback')) {
-    return (
-      <SearchQueryBuilder
-        initialQuery={decodeScalar(locationQuery.query, '')}
-        filterKeys={filterKeys}
-        filterKeySections={filterKeySections}
-        getTagValues={getTagValues}
-        onSearch={onSearch}
-        searchSource={'feedback-list'}
-        placeholder={t('Search Feedback')}
-        showUnsubmittedIndicator
-      />
-    );
-  }
-
   return (
-    <SearchContainer className={className} style={style}>
-      <SmartSearchBar
-        hasRecentSearches
-        projectIds={projectIds}
-        placeholder={t('Search Feedback')}
-        organization={organization}
-        onGetTagValues={getTagValues}
-        supportedTags={filterKeys}
-        excludedTags={EXCLUDED_TAGS}
-        fieldDefinitionGetter={getFeedbackFieldDefinition}
-        maxMenuHeight={500}
-        defaultQuery=""
-        query={decodeScalar(locationQuery.query, '')}
-        onSearch={onSearch}
-      />
-    </SearchContainer>
+    <SearchQueryBuilder
+      initialQuery={decodeScalar(locationQuery.query, '')}
+      filterKeys={filterKeys}
+      filterKeySections={filterKeySections}
+      getTagValues={getTagValues}
+      onSearch={onSearch}
+      searchSource={'feedback-list'}
+      placeholder={t('Search Feedback')}
+      showUnsubmittedIndicator
+    />
   );
 }
-
-const SearchContainer = styled('div')`
-  display: grid;
-  width: 100%;
-`;

+ 1 - 1
static/app/views/feedback/feedbackListPage.tsx

@@ -88,7 +88,7 @@ export default function FeedbackListPage({}: Props) {
                     <Container style={{gridArea: 'list'}}>
                       <FeedbackList />
                     </Container>
-                    <FeedbackSearch style={{gridArea: 'search'}} />
+                    <FeedbackSearch />
                     <Container style={{gridArea: 'details'}}>
                       <FeedbackItemLoader />
                     </Container>

+ 6 - 0
static/app/views/replays/list/listContent.spec.tsx

@@ -64,6 +64,12 @@ describe('ReplayList', () => {
       url: `/organizations/org-slug/replays/`,
       body: {},
     });
+    // Request made by SearchQueryBuilder:
+    MockApiClient.addMockResponse({
+      url: '/organizations/org-slug/recent-searches/',
+      method: 'GET',
+      body: [],
+    });
   });
 
   it('should render the onboarding panel when the org is on AM1', async () => {

+ 14 - 54
static/app/views/replays/list/replaySearchBar.tsx

@@ -4,8 +4,7 @@ import orderBy from 'lodash/orderBy';
 import {fetchTagValues, useFetchOrganizationTags} from 'sentry/actionCreators/tags';
 import {SearchQueryBuilder} from 'sentry/components/searchQueryBuilder';
 import type {FilterKeySection} from 'sentry/components/searchQueryBuilder/types';
-import SmartSearchBar from 'sentry/components/smartSearchBar';
-import {MAX_QUERY_LENGTH, NEGATION_OPERATOR, SEARCH_WILDCARD} from 'sentry/constants';
+import type SmartSearchBar from 'sentry/components/smartSearchBar';
 import {t} from 'sentry/locale';
 import type {PageFilters} from 'sentry/types/core';
 import type {Tag, TagCollection, TagValue} from 'sentry/types/group';
@@ -24,17 +23,6 @@ import {MutableSearch} from 'sentry/utils/tokenizeSearch';
 import useApi from 'sentry/utils/useApi';
 import {Dataset} from 'sentry/views/alerts/rules/metric/types';
 
-const SEARCH_SPECIAL_CHARS_REGEXP = new RegExp(
-  `^${NEGATION_OPERATOR}|\\${SEARCH_WILDCARD}`,
-  'g'
-);
-
-/**
- * Prepare query string (e.g. strip special characters like negation operator)
- */
-function prepareQuery(searchQuery: string) {
-  return searchQuery.replace(SEARCH_SPECIAL_CHARS_REGEXP, '');
-}
 const getReplayFieldDefinition = (key: string) => getFieldDefinition(key, 'replay');
 
 function fieldDefinitionsToTagCollection(fieldKeys: string[]): TagCollection {
@@ -216,53 +204,25 @@ function ReplaySearchBar(props: Props) {
     [onSearch, organization]
   );
 
-  if (organization.features.includes('search-query-builder-replays')) {
-    return (
-      <SearchQueryBuilder
-        {...props}
-        onChange={undefined} // not implemented and different type from SmartSearchBar
-        disallowLogicalOperators={undefined} // ^
-        className={props.className}
-        fieldDefinitionGetter={getReplayFieldDefinition}
-        filterKeys={filterKeys}
-        filterKeySections={filterKeySections}
-        getTagValues={getTagValues}
-        initialQuery={props.query ?? props.defaultQuery ?? ''}
-        onSearch={onSearchWithAnalytics}
-        searchSource={props.searchSource ?? 'replay_index'}
-        placeholder={
-          props.placeholder ??
-          t('Search for users, duration, clicked elements, count_errors, and more')
-        }
-        recentSearches={SavedSearchType.REPLAY}
-        showUnsubmittedIndicator
-      />
-    );
-  }
-
   return (
-    <SmartSearchBar
+    <SearchQueryBuilder
       {...props}
-      onGetTagValues={getTagValues}
-      supportedTags={filterKeys}
+      onChange={undefined} // not implemented and different type from SmartSearchBar
+      disallowLogicalOperators={undefined} // ^
+      className={props.className}
+      fieldDefinitionGetter={getReplayFieldDefinition}
+      filterKeys={filterKeys}
+      filterKeySections={filterKeySections}
+      getTagValues={getTagValues}
+      initialQuery={props.query ?? props.defaultQuery ?? ''}
+      onSearch={onSearchWithAnalytics}
+      searchSource={props.searchSource ?? 'replay_index'}
       placeholder={
         props.placeholder ??
         t('Search for users, duration, clicked elements, count_errors, and more')
       }
-      prepareQuery={prepareQuery}
-      maxQueryLength={MAX_QUERY_LENGTH}
-      searchSource={props.searchSource ?? 'replay_index'}
-      savedSearchType={SavedSearchType.REPLAY}
-      maxMenuHeight={500}
-      hasRecentSearches
-      projectIds={projectIds}
-      fieldDefinitionGetter={getReplayFieldDefinition}
-      mergeSearchGroupWith={{
-        click: {
-          documentation: t('Search by click selector. (Requires SDK version >= 7.44.0)'),
-        },
-      }}
-      onSearch={onSearchWithAnalytics}
+      recentSearches={SavedSearchType.REPLAY}
+      showUnsubmittedIndicator
     />
   );
 }