Browse Source

feat(dashboards): Only show dataset related recent searches (#34015)

Saving release health searches under the SESSION
saved search type to prevent cross contamination of
recent searches.
Shruthi 2 years ago
parent
commit
8ed43dbf46

+ 1 - 0
static/app/types/group.tsx

@@ -38,6 +38,7 @@ export type SavedSearch = {
 export enum SavedSearchType {
   ISSUE = 0,
   EVENT = 1,
+  SESSION = 2,
 }
 
 // endpoint: /api/0/issues/:issueId/attachments/?limit=50

+ 2 - 1
static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/eventsSearchBar.tsx

@@ -2,7 +2,7 @@ import styled from '@emotion/styled';
 
 import SearchBar, {SearchBarProps} from 'sentry/components/events/searchBar';
 import {MAX_QUERY_LENGTH} from 'sentry/constants';
-import {Organization} from 'sentry/types';
+import {Organization, SavedSearchType} from 'sentry/types';
 import {WidgetQuery} from 'sentry/views/dashboardsV2/types';
 import {
   MAX_MENU_HEIGHT,
@@ -37,6 +37,7 @@ export function EventsSearchBar({
       maxQueryLength={MAX_QUERY_LENGTH}
       maxSearchItems={MAX_SEARCH_ITEMS}
       maxMenuHeight={MAX_MENU_HEIGHT}
+      savedSearchType={SavedSearchType.EVENT}
     />
   );
 }

+ 2 - 1
static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/issuesSearchBar.tsx

@@ -4,7 +4,7 @@ import styled from '@emotion/styled';
 import {fetchTagValues} from 'sentry/actionCreators/tags';
 import {SearchBarProps} from 'sentry/components/events/searchBar';
 import {t} from 'sentry/locale';
-import {Organization, PageFilters, TagCollection} from 'sentry/types';
+import {Organization, PageFilters, SavedSearchType, TagCollection} from 'sentry/types';
 import {getUtcDateString} from 'sentry/utils/dates';
 import useApi from 'sentry/utils/useApi';
 import withIssueTags from 'sentry/utils/withIssueTags';
@@ -63,6 +63,7 @@ function IssuesSearchBarContainer({
           tagValueLoader={tagValueLoader}
           onSidebarToggle={() => undefined}
           maxSearchItems={MAX_SEARCH_ITEMS}
+          savedSearchType={SavedSearchType.ISSUE}
           dropdownClassName={css`
             max-height: ${MAX_MENU_HEIGHT}px;
             overflow-y: auto;

+ 3 - 1
static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/releaseSearchBar.tsx

@@ -7,7 +7,7 @@ import {SearchBarProps} from 'sentry/components/events/searchBar';
 import SmartSearchBar from 'sentry/components/smartSearchBar';
 import {MAX_QUERY_LENGTH, NEGATION_OPERATOR, SEARCH_WILDCARD} from 'sentry/constants';
 import {t} from 'sentry/locale';
-import {Organization, Tag, TagValue} from 'sentry/types';
+import {Organization, SavedSearchType, Tag, TagValue} from 'sentry/types';
 import useApi from 'sentry/utils/useApi';
 import {WidgetQuery} from 'sentry/views/dashboardsV2/types';
 import {
@@ -79,6 +79,8 @@ export function ReleaseSearchBar({orgSlug, query, projectIds, onSearch, onBlur}:
           maxSearchItems={MAX_SEARCH_ITEMS}
           searchSource="widget_builder"
           query={query.conditions}
+          savedSearchType={SavedSearchType.SESSION}
+          hasRecentSearches
         />
       )}
     </ClassNames>