Skip to content

Commit bdae91a

Browse files
committed
ref(issue-views): Add visibility and pagination params to issue views hook
1 parent d466ec8 commit bdae91a

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

static/app/components/nav/issueViews/issueViewNavItems.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ export function IssueViewNavItems({
201201
...v,
202202
isAllProjects: isEqual(v.projects, [-1]),
203203
name: v.label,
204+
lastVisited: null,
205+
visibility: 'owner',
204206
}))
205207
);
206208
},
@@ -242,6 +244,8 @@ export function IssueViewNavItems({
242244
...v,
243245
isAllProjects: isEqual(v.projects, [-1]),
244246
name: v.label,
247+
lastVisited: null,
248+
visibility: 'owner',
245249
}))
246250
);
247251
}

static/app/views/issueList/queries/useFetchGroupSearchViews.tsx

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1-
import type {UseApiQueryOptions} from 'sentry/utils/queryClient';
1+
import type {ApiQueryKey, UseApiQueryOptions} from 'sentry/utils/queryClient';
22
import {useApiQuery} from 'sentry/utils/queryClient';
3-
import type {GroupSearchView} from 'sentry/views/issueList/types';
3+
import type {
4+
GroupSearchView,
5+
GroupSearchViewVisibility,
6+
} from 'sentry/views/issueList/types';
47

58
type FetchGroupSearchViewsParameters = {
69
orgSlug: string;
10+
cursor?: string;
11+
limit?: number;
12+
visibility?: GroupSearchViewVisibility;
713
};
814

915
export const makeFetchGroupSearchViewsKey = ({
1016
orgSlug,
11-
}: FetchGroupSearchViewsParameters) =>
12-
[`/organizations/${orgSlug}/group-search-views/`] as const;
17+
visibility,
18+
limit,
19+
cursor,
20+
}: FetchGroupSearchViewsParameters): ApiQueryKey =>
21+
[
22+
`/organizations/${orgSlug}/group-search-views/`,
23+
{
24+
query: {
25+
per_page: limit,
26+
visibility,
27+
cursor,
28+
},
29+
},
30+
] as const;
1331

1432
export const useFetchGroupSearchViews = (
15-
{orgSlug}: FetchGroupSearchViewsParameters,
33+
parameters: FetchGroupSearchViewsParameters,
1634
options: Partial<UseApiQueryOptions<GroupSearchView[]>> = {}
1735
) => {
18-
return useApiQuery<GroupSearchView[]>(makeFetchGroupSearchViewsKey({orgSlug}), {
36+
return useApiQuery<GroupSearchView[]>(makeFetchGroupSearchViewsKey(parameters), {
1937
staleTime: Infinity,
2038
...options,
2139
});

static/app/views/issueList/types.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ export type IssueUpdateData =
1616
| MarkReviewed
1717
| GroupStatusResolution;
1818

19+
export enum GroupSearchViewVisibility {
20+
OWNER = 'owner',
21+
ORGANIZATION = 'organization',
22+
}
23+
1924
export type GroupSearchView = {
2025
environments: string[];
2126
id: string;
27+
lastVisited: string | null;
2228
name: string;
2329
projects: number[];
2430
query: string;
2531
querySort: IssueSortOptions;
2632
timeFilters: PageFilters['datetime'];
33+
visibility: GroupSearchViewVisibility;
2734
};
2835

29-
export interface UpdateGroupSearchViewPayload extends Omit<GroupSearchView, 'id'> {
36+
export interface UpdateGroupSearchViewPayload
37+
extends Omit<GroupSearchView, 'id' | 'lastVisited' | 'visibility'> {
3038
environments: string[];
3139
projects: number[];
3240
timeFilters: PageFilters['datetime'];

0 commit comments

Comments
 (0)