overview.tsx 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. import {Component} from 'react';
  2. import type {RouteComponentProps} from 'react-router';
  3. import {browserHistory} from 'react-router';
  4. import styled from '@emotion/styled';
  5. import {withProfiler} from '@sentry/react';
  6. import * as Sentry from '@sentry/react';
  7. import type {Location} from 'history';
  8. import Cookies from 'js-cookie';
  9. import isEqual from 'lodash/isEqual';
  10. import mapValues from 'lodash/mapValues';
  11. import omit from 'lodash/omit';
  12. import pickBy from 'lodash/pickBy';
  13. import moment from 'moment';
  14. import * as qs from 'query-string';
  15. import {addMessage} from 'sentry/actionCreators/indicator';
  16. import {fetchOrgMembers, indexMembersByProject} from 'sentry/actionCreators/members';
  17. import {fetchTagValues, loadOrganizationTags} from 'sentry/actionCreators/tags';
  18. import type {Client} from 'sentry/api';
  19. import * as Layout from 'sentry/components/layouts/thirds';
  20. import LoadingIndicator from 'sentry/components/loadingIndicator';
  21. import {extractSelectionParameters} from 'sentry/components/organizations/pageFilters/utils';
  22. import type {CursorHandler} from 'sentry/components/pagination';
  23. import Pagination from 'sentry/components/pagination';
  24. import Panel from 'sentry/components/panels/panel';
  25. import PanelBody from 'sentry/components/panels/panelBody';
  26. import QueryCount from 'sentry/components/queryCount';
  27. import ProcessingIssueList from 'sentry/components/stream/processingIssueList';
  28. import {DEFAULT_QUERY, DEFAULT_STATS_PERIOD} from 'sentry/constants';
  29. import {t, tct, tn} from 'sentry/locale';
  30. import GroupStore from 'sentry/stores/groupStore';
  31. import IssueListCacheStore from 'sentry/stores/IssueListCacheStore';
  32. import SelectedGroupStore from 'sentry/stores/selectedGroupStore';
  33. import {space} from 'sentry/styles/space';
  34. import type {
  35. BaseGroup,
  36. Group,
  37. Organization,
  38. PageFilters,
  39. SavedSearch,
  40. TagCollection,
  41. } from 'sentry/types';
  42. import {IssueCategory} from 'sentry/types';
  43. import {defined} from 'sentry/utils';
  44. import {trackAnalytics} from 'sentry/utils/analytics';
  45. import CursorPoller from 'sentry/utils/cursorPoller';
  46. import {getUtcDateString} from 'sentry/utils/dates';
  47. import getCurrentSentryReactTransaction from 'sentry/utils/getCurrentSentryReactTransaction';
  48. import parseApiError from 'sentry/utils/parseApiError';
  49. import parseLinkHeader from 'sentry/utils/parseLinkHeader';
  50. import {
  51. makeIssuesINPObserver,
  52. VisuallyCompleteWithData,
  53. } from 'sentry/utils/performanceForSentry';
  54. import {decodeScalar} from 'sentry/utils/queryString';
  55. import type {WithRouteAnalyticsProps} from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  56. import withRouteAnalytics from 'sentry/utils/routeAnalytics/withRouteAnalytics';
  57. import withApi from 'sentry/utils/withApi';
  58. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  59. import withIssueTags from 'sentry/utils/withIssueTags';
  60. import withOrganization from 'sentry/utils/withOrganization';
  61. import withPageFilters from 'sentry/utils/withPageFilters';
  62. import withSavedSearches from 'sentry/utils/withSavedSearches';
  63. import SavedIssueSearches from 'sentry/views/issueList/savedIssueSearches';
  64. import IssueListActions from './actions';
  65. import IssueListFilters from './filters';
  66. import GroupListBody from './groupListBody';
  67. import IssueListHeader from './header';
  68. import type {QueryCounts} from './utils';
  69. import {
  70. DEFAULT_ISSUE_STREAM_SORT,
  71. FOR_REVIEW_QUERIES,
  72. getTabs,
  73. getTabsWithCounts,
  74. isForReviewQuery,
  75. IssueSortOptions,
  76. Query,
  77. TAB_MAX_COUNT,
  78. } from './utils';
  79. const MAX_ITEMS = 25;
  80. // the default period for the graph in each issue row
  81. const DEFAULT_GRAPH_STATS_PERIOD = '24h';
  82. // the allowed period choices for graph in each issue row
  83. const DYNAMIC_COUNTS_STATS_PERIODS = new Set(['14d', '24h', 'auto']);
  84. const MAX_ISSUES_COUNT = 100;
  85. type Params = {
  86. orgId: string;
  87. };
  88. type Props = {
  89. api: Client;
  90. location: Location;
  91. organization: Organization;
  92. params: Params;
  93. savedSearch: SavedSearch;
  94. savedSearchLoading: boolean;
  95. savedSearches: SavedSearch[];
  96. selectedSearchId: string;
  97. selection: PageFilters;
  98. tags: TagCollection;
  99. } & RouteComponentProps<{searchId?: string}, {}> &
  100. WithRouteAnalyticsProps;
  101. type State = {
  102. actionTaken: boolean;
  103. actionTakenGroupData: Group[];
  104. error: string | null;
  105. groupIds: string[];
  106. issuesLoading: boolean;
  107. itemsRemoved: number;
  108. memberList: ReturnType<typeof indexMembersByProject>;
  109. pageLinks: string;
  110. /**
  111. * Current query total
  112. */
  113. queryCount: number;
  114. /**
  115. * Counts for each inbox tab
  116. */
  117. queryCounts: QueryCounts;
  118. queryMaxCount: number;
  119. realtimeActive: boolean;
  120. selectAllActive: boolean;
  121. undo: boolean;
  122. // Will be set to true if there is valid session data from issue-stats api call
  123. query?: string;
  124. };
  125. interface EndpointParams extends Partial<PageFilters['datetime']> {
  126. environment: string[];
  127. project: number[];
  128. cursor?: string;
  129. groupStatsPeriod?: string | null;
  130. page?: number | string;
  131. query?: string;
  132. sort?: string;
  133. statsPeriod?: string | null;
  134. }
  135. type CountsEndpointParams = Omit<EndpointParams, 'cursor' | 'page' | 'query'> & {
  136. query: string[];
  137. };
  138. type StatEndpointParams = Omit<EndpointParams, 'cursor' | 'page'> & {
  139. groups: string[];
  140. expand?: string | string[];
  141. };
  142. class IssueListOverview extends Component<Props, State> {
  143. state: State = this.getInitialState();
  144. getInitialState() {
  145. const realtimeActiveCookie = Cookies.get('realtimeActive');
  146. const realtimeActive =
  147. typeof realtimeActiveCookie === 'undefined'
  148. ? false
  149. : realtimeActiveCookie === 'true';
  150. return {
  151. groupIds: [],
  152. actionTaken: false,
  153. actionTakenGroupData: [],
  154. undo: false,
  155. selectAllActive: false,
  156. realtimeActive,
  157. pageLinks: '',
  158. itemsRemoved: 0,
  159. queryCount: 0,
  160. queryCounts: {},
  161. queryMaxCount: 0,
  162. error: null,
  163. issuesLoading: true,
  164. memberList: {},
  165. };
  166. }
  167. componentDidMount() {
  168. this._performanceObserver = makeIssuesINPObserver();
  169. this._poller = new CursorPoller({
  170. linkPreviousHref: parseLinkHeader(this.state.pageLinks)?.previous?.href,
  171. success: this.onRealtimePoll,
  172. });
  173. // Wait for saved searches to load so if the user is on a saved search
  174. // or they have a pinned search we load the correct data the first time.
  175. // But if searches are already there, we can go right to fetching issues
  176. if (
  177. !this.props.savedSearchLoading ||
  178. this.props.organization.features.includes('issue-stream-performance')
  179. ) {
  180. const loadedFromCache = this.loadFromCache();
  181. if (!loadedFromCache) {
  182. // It's possible the projects query parameter is not yet ready and this
  183. // request will be repeated in componentDidUpdate
  184. this.fetchData();
  185. }
  186. }
  187. this.fetchTags();
  188. this.fetchMemberList();
  189. // let custom analytics take control
  190. this.props.setDisableRouteAnalytics?.();
  191. }
  192. componentDidUpdate(prevProps: Props, prevState: State) {
  193. if (prevState.realtimeActive !== this.state.realtimeActive) {
  194. // User toggled realtime button
  195. if (this.state.realtimeActive) {
  196. this.resumePolling();
  197. } else {
  198. this._poller.disable();
  199. }
  200. }
  201. // If the project selection has changed reload the member list and tag keys
  202. // allowing autocomplete and tag sidebar to be more accurate.
  203. if (!isEqual(prevProps.selection.projects, this.props.selection.projects)) {
  204. this.loadFromCache();
  205. this.fetchMemberList();
  206. this.fetchTags();
  207. }
  208. const selectionChanged = !isEqual(prevProps.selection, this.props.selection);
  209. // Wait for saved searches to load before we attempt to fetch stream data
  210. // Selection changing could indicate that the projects query parameter has populated
  211. // and we should refetch data.
  212. if (this.props.savedSearchLoading && !selectionChanged) {
  213. return;
  214. }
  215. if (
  216. prevProps.savedSearchLoading &&
  217. !this.props.savedSearchLoading &&
  218. this.props.organization.features.includes('issue-stream-performance')
  219. ) {
  220. return;
  221. }
  222. if (
  223. prevProps.savedSearchLoading &&
  224. !this.props.organization.features.includes('issue-stream-performance')
  225. ) {
  226. const loadedFromCache = this.loadFromCache();
  227. if (!loadedFromCache) {
  228. this.fetchData();
  229. }
  230. return;
  231. }
  232. const prevUrlQuery = prevProps.location.query;
  233. const newUrlQuery = this.props.location.query;
  234. const prevQuery = this.getQueryFromSavedSearchOrLocation({
  235. savedSearch: prevProps.savedSearch,
  236. location: prevProps.location,
  237. });
  238. const newQuery = this.getQuery();
  239. const prevSort = this.getSortFromSavedSearchOrLocation({
  240. savedSearch: prevProps.savedSearch,
  241. location: prevProps.location,
  242. });
  243. const newSort = this.getSort();
  244. // If any important url parameter changed or saved search changed
  245. // reload data.
  246. if (
  247. selectionChanged ||
  248. prevUrlQuery.cursor !== newUrlQuery.cursor ||
  249. prevUrlQuery.statsPeriod !== newUrlQuery.statsPeriod ||
  250. prevUrlQuery.groupStatsPeriod !== newUrlQuery.groupStatsPeriod ||
  251. prevQuery !== newQuery ||
  252. prevSort !== newSort
  253. ) {
  254. this.fetchData(selectionChanged);
  255. } else if (
  256. !this._lastRequest &&
  257. prevState.issuesLoading === false &&
  258. this.state.issuesLoading
  259. ) {
  260. // Reload if we issues are loading or their loading state changed.
  261. // This can happen when transitionTo is called
  262. this.fetchData();
  263. }
  264. }
  265. componentWillUnmount() {
  266. const groups = GroupStore.getState() as Group[];
  267. if (
  268. groups.length > 0 &&
  269. !this.state.issuesLoading &&
  270. !this.state.realtimeActive &&
  271. this.props.organization.features.includes('issue-stream-performance-cache')
  272. ) {
  273. IssueListCacheStore.save(this.getCacheEndpointParams(), {
  274. groups,
  275. queryCount: this.state.queryCount,
  276. queryMaxCount: this.state.queryMaxCount,
  277. pageLinks: this.state.pageLinks,
  278. });
  279. }
  280. if (this._performanceObserver) {
  281. this._performanceObserver.disconnect();
  282. }
  283. this._poller.disable();
  284. SelectedGroupStore.reset();
  285. GroupStore.reset();
  286. this.props.api.clear();
  287. this.listener?.();
  288. }
  289. private _performanceObserver: PerformanceObserver | undefined;
  290. private _poller: any;
  291. private _lastRequest: any;
  292. private _lastStatsRequest: any;
  293. private _lastFetchCountsRequest: any;
  294. getQueryFromSavedSearchOrLocation({
  295. savedSearch,
  296. location,
  297. }: Pick<Props, 'savedSearch' | 'location'>): string {
  298. if (savedSearch) {
  299. return savedSearch.query;
  300. }
  301. const {query} = location.query;
  302. if (query !== undefined) {
  303. return decodeScalar(query, '');
  304. }
  305. return DEFAULT_QUERY;
  306. }
  307. getSortFromSavedSearchOrLocation({
  308. savedSearch,
  309. location,
  310. }: Pick<Props, 'savedSearch' | 'location'>): string {
  311. if (!location.query.sort && savedSearch?.id) {
  312. return savedSearch.sort;
  313. }
  314. if (location.query.sort) {
  315. return location.query.sort as string;
  316. }
  317. return DEFAULT_ISSUE_STREAM_SORT;
  318. }
  319. /**
  320. * Load the previous
  321. * @returns Returns true if the data was loaded from cache
  322. */
  323. loadFromCache(): boolean {
  324. if (!this.props.organization.features.includes('issue-stream-performance-cache')) {
  325. return false;
  326. }
  327. const cache = IssueListCacheStore.getFromCache(this.getCacheEndpointParams());
  328. if (!cache) {
  329. return false;
  330. }
  331. this.setState(
  332. {
  333. issuesLoading: false,
  334. queryCount: cache.queryCount,
  335. queryMaxCount: cache.queryMaxCount,
  336. pageLinks: cache.pageLinks,
  337. },
  338. () => {
  339. // Handle this in the next tick to avoid being overwritten by GroupStore.reset
  340. // Group details clears the GroupStore at the same time this component mounts
  341. GroupStore.add(cache.groups);
  342. // Clear cache after loading
  343. IssueListCacheStore.reset();
  344. }
  345. );
  346. return true;
  347. }
  348. getQuery(): string {
  349. return this.getQueryFromSavedSearchOrLocation({
  350. savedSearch: this.props.savedSearch,
  351. location: this.props.location,
  352. });
  353. }
  354. getSort(): string {
  355. return this.getSortFromSavedSearchOrLocation({
  356. savedSearch: this.props.savedSearch,
  357. location: this.props.location,
  358. });
  359. }
  360. getGroupStatsPeriod(): string {
  361. let currentPeriod: string;
  362. if (typeof this.props.location.query?.groupStatsPeriod === 'string') {
  363. currentPeriod = this.props.location.query.groupStatsPeriod;
  364. } else {
  365. currentPeriod = DEFAULT_GRAPH_STATS_PERIOD;
  366. }
  367. return DYNAMIC_COUNTS_STATS_PERIODS.has(currentPeriod)
  368. ? currentPeriod
  369. : DEFAULT_GRAPH_STATS_PERIOD;
  370. }
  371. getEndpointParams = (): EndpointParams => {
  372. const {selection} = this.props;
  373. const params: EndpointParams = {
  374. project: selection.projects,
  375. environment: selection.environments,
  376. query: this.getQuery(),
  377. ...selection.datetime,
  378. };
  379. if (selection.datetime.period) {
  380. delete params.period;
  381. params.statsPeriod = selection.datetime.period;
  382. }
  383. if (params.end) {
  384. params.end = getUtcDateString(params.end);
  385. }
  386. if (params.start) {
  387. params.start = getUtcDateString(params.start);
  388. }
  389. const sort = this.getSort();
  390. if (sort !== DEFAULT_ISSUE_STREAM_SORT) {
  391. params.sort = sort;
  392. }
  393. const groupStatsPeriod = this.getGroupStatsPeriod();
  394. if (groupStatsPeriod !== DEFAULT_GRAPH_STATS_PERIOD) {
  395. params.groupStatsPeriod = groupStatsPeriod;
  396. }
  397. // only include defined values.
  398. return pickBy(params, v => defined(v)) as EndpointParams;
  399. };
  400. getCacheEndpointParams = (): EndpointParams => {
  401. const cursor = this.props.location.query.cursor;
  402. return {
  403. ...this.getEndpointParams(),
  404. cursor,
  405. };
  406. };
  407. getSelectedProjectIds = (): string[] => {
  408. return this.props.selection.projects.map(projectId => String(projectId));
  409. };
  410. fetchMemberList() {
  411. const projectIds = this.getSelectedProjectIds();
  412. fetchOrgMembers(this.props.api, this.props.organization.slug, projectIds).then(
  413. members => {
  414. this.setState({memberList: indexMembersByProject(members)});
  415. }
  416. );
  417. }
  418. fetchTags() {
  419. const {api, organization, selection} = this.props;
  420. loadOrganizationTags(api, organization.slug, selection);
  421. }
  422. fetchStats = (groups: string[]) => {
  423. // If we have no groups to fetch, just skip stats
  424. if (!groups.length) {
  425. return;
  426. }
  427. const requestParams: StatEndpointParams = {
  428. ...this.getEndpointParams(),
  429. groups,
  430. };
  431. // If no stats period values are set, use default
  432. if (!requestParams.statsPeriod && !requestParams.start) {
  433. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  434. }
  435. this._lastStatsRequest = this.props.api.request(this.groupStatsEndpoint, {
  436. method: 'GET',
  437. data: qs.stringify(requestParams),
  438. success: data => {
  439. if (!data) {
  440. return;
  441. }
  442. GroupStore.onPopulateStats(groups, data);
  443. this.trackTabViewed(groups, data);
  444. },
  445. error: err => {
  446. this.setState({
  447. error: parseApiError(err),
  448. });
  449. },
  450. complete: () => {
  451. this._lastStatsRequest = null;
  452. // End navigation transaction to prevent additional page requests from impacting page metrics.
  453. // Other transactions include stacktrace preview request
  454. const currentTransaction = Sentry.getCurrentHub().getScope()?.getTransaction();
  455. if (currentTransaction?.op === 'navigation') {
  456. currentTransaction.finish();
  457. }
  458. },
  459. });
  460. };
  461. fetchCounts = (currentQueryCount: number, fetchAllCounts: boolean) => {
  462. const {organization} = this.props;
  463. const {queryCounts: _queryCounts} = this.state;
  464. let queryCounts: QueryCounts = {..._queryCounts};
  465. const endpointParams = this.getEndpointParams();
  466. const tabQueriesWithCounts = getTabsWithCounts(organization);
  467. const currentTabQuery = tabQueriesWithCounts.includes(endpointParams.query as Query)
  468. ? endpointParams.query
  469. : null;
  470. // Update the count based on the exact number of issues, these shown as is
  471. if (currentTabQuery) {
  472. queryCounts[currentTabQuery] = {
  473. count: currentQueryCount,
  474. hasMore: false,
  475. };
  476. }
  477. this.setState({queryCounts});
  478. // If all tabs' counts are fetched, skip and only set
  479. if (
  480. fetchAllCounts ||
  481. !tabQueriesWithCounts.every(tabQuery => queryCounts[tabQuery] !== undefined)
  482. ) {
  483. const requestParams: CountsEndpointParams = {
  484. ...omit(endpointParams, 'query'),
  485. // fetch the counts for the tabs whose counts haven't been fetched yet
  486. query: tabQueriesWithCounts.filter(_query => _query !== currentTabQuery),
  487. };
  488. // If no stats period values are set, use default
  489. if (!requestParams.statsPeriod && !requestParams.start) {
  490. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  491. }
  492. this._lastFetchCountsRequest = this.props.api.request(this.groupCountsEndpoint, {
  493. method: 'GET',
  494. data: qs.stringify(requestParams),
  495. success: data => {
  496. if (!data) {
  497. return;
  498. }
  499. // Counts coming from the counts endpoint is limited to 100, for >= 100 we display 99+
  500. queryCounts = {
  501. ...queryCounts,
  502. ...mapValues(data, (count: number) => ({
  503. count,
  504. hasMore: count > TAB_MAX_COUNT,
  505. })),
  506. };
  507. },
  508. error: () => {
  509. this.setState({queryCounts: {}});
  510. },
  511. complete: () => {
  512. this._lastFetchCountsRequest = null;
  513. this.setState({queryCounts});
  514. },
  515. });
  516. }
  517. };
  518. fetchData = (fetchAllCounts = false) => {
  519. const {organization} = this.props;
  520. const query = this.getQuery();
  521. if (!this.state.realtimeActive) {
  522. if (!this.state.actionTaken && !this.state.undo) {
  523. GroupStore.loadInitialData([]);
  524. this.setState({
  525. issuesLoading: true,
  526. queryCount: 0,
  527. itemsRemoved: 0,
  528. error: null,
  529. });
  530. }
  531. } else {
  532. if (!isForReviewQuery(query)) {
  533. GroupStore.loadInitialData([]);
  534. this.setState({
  535. issuesLoading: true,
  536. queryCount: 0,
  537. itemsRemoved: 0,
  538. error: null,
  539. });
  540. }
  541. }
  542. const transaction = getCurrentSentryReactTransaction();
  543. transaction?.setTag('query.sort', this.getSort());
  544. this.setState({
  545. itemsRemoved: 0,
  546. error: null,
  547. });
  548. // Used for Issue Stream Performance project, enabled means we are doing saved search look up in the backend
  549. const savedSearchLookupEnabled = 0;
  550. const savedSearchLookupDisabled = 1;
  551. const requestParams: any = {
  552. ...this.getEndpointParams(),
  553. limit: MAX_ITEMS,
  554. shortIdLookup: 1,
  555. savedSearch: this.props.organization.features.includes('issue-stream-performance')
  556. ? this.props.savedSearchLoading
  557. ? savedSearchLookupEnabled
  558. : savedSearchLookupDisabled
  559. : savedSearchLookupDisabled,
  560. };
  561. if (
  562. this.props.organization.features.includes('issue-stream-performance') &&
  563. this.props.selectedSearchId
  564. ) {
  565. requestParams.searchId = this.props.selectedSearchId;
  566. }
  567. if (
  568. this.props.organization.features.includes('issue-stream-performance') &&
  569. this.props.savedSearchLoading &&
  570. !this.props.location.query.query
  571. ) {
  572. delete requestParams.query;
  573. }
  574. const currentQuery = this.props.location.query || {};
  575. if ('cursor' in currentQuery) {
  576. requestParams.cursor = currentQuery.cursor;
  577. }
  578. // If no stats period values are set, use default
  579. if (!requestParams.statsPeriod && !requestParams.start) {
  580. requestParams.statsPeriod = DEFAULT_STATS_PERIOD;
  581. }
  582. requestParams.expand = ['owners', 'inbox'];
  583. requestParams.collapse = ['stats', 'unhandled'];
  584. if (this._lastRequest) {
  585. this._lastRequest.cancel();
  586. }
  587. if (this._lastStatsRequest) {
  588. this._lastStatsRequest.cancel();
  589. }
  590. if (this._lastFetchCountsRequest) {
  591. this._lastFetchCountsRequest.cancel();
  592. }
  593. this._poller.disable();
  594. this._lastRequest = this.props.api.request(this.groupListEndpoint, {
  595. method: 'GET',
  596. data: qs.stringify(requestParams),
  597. success: (data, _, resp) => {
  598. if (!resp) {
  599. return;
  600. }
  601. // If this is a direct hit, we redirect to the intended result directly.
  602. if (resp.getResponseHeader('X-Sentry-Direct-Hit') === '1') {
  603. let redirect: string;
  604. if (data[0] && data[0].matchingEventId) {
  605. const {id, matchingEventId} = data[0];
  606. redirect = `/organizations/${organization.slug}/issues/${id}/events/${matchingEventId}/`;
  607. } else {
  608. const {id} = data[0];
  609. redirect = `/organizations/${organization.slug}/issues/${id}/`;
  610. }
  611. browserHistory.replace(
  612. normalizeUrl({
  613. pathname: redirect,
  614. query: {
  615. referrer: 'issue-list',
  616. ...extractSelectionParameters(this.props.location.query),
  617. },
  618. })
  619. );
  620. return;
  621. }
  622. if (this.state.undo) {
  623. GroupStore.loadInitialData(data);
  624. }
  625. GroupStore.add(data);
  626. this.fetchStats(data.map((group: BaseGroup) => group.id));
  627. const hits = resp.getResponseHeader('X-Hits');
  628. const queryCount =
  629. typeof hits !== 'undefined' && hits ? parseInt(hits, 10) || 0 : 0;
  630. const maxHits = resp.getResponseHeader('X-Max-Hits');
  631. const queryMaxCount =
  632. typeof maxHits !== 'undefined' && maxHits ? parseInt(maxHits, 10) || 0 : 0;
  633. const pageLinks = resp.getResponseHeader('Link');
  634. this.fetchCounts(queryCount, fetchAllCounts);
  635. this.setState({
  636. error: null,
  637. issuesLoading: false,
  638. queryCount,
  639. queryMaxCount,
  640. pageLinks: pageLinks !== null ? pageLinks : '',
  641. });
  642. if (data.length === 0) {
  643. trackAnalytics('issue_search.empty', {
  644. organization: this.props.organization,
  645. search_type: 'issues',
  646. search_source: 'main_search',
  647. query,
  648. });
  649. }
  650. },
  651. error: err => {
  652. trackAnalytics('issue_search.failed', {
  653. organization: this.props.organization,
  654. search_type: 'issues',
  655. search_source: 'main_search',
  656. error: parseApiError(err),
  657. });
  658. this.setState({
  659. error: parseApiError(err),
  660. issuesLoading: false,
  661. });
  662. },
  663. complete: () => {
  664. this._lastRequest = null;
  665. this.resumePolling();
  666. if (!this.state.realtimeActive) {
  667. this.setState({actionTaken: false, undo: false});
  668. }
  669. },
  670. });
  671. };
  672. resumePolling = () => {
  673. if (!this.state.pageLinks) {
  674. return;
  675. }
  676. // Only resume polling if we're on the first page of results
  677. const links = parseLinkHeader(this.state.pageLinks);
  678. if (links && !links.previous.results && this.state.realtimeActive) {
  679. this._poller.setEndpoint(links?.previous?.href);
  680. this._poller.enable();
  681. }
  682. };
  683. get groupListEndpoint(): string {
  684. const {organization} = this.props;
  685. return `/organizations/${organization.slug}/issues/`;
  686. }
  687. get groupCountsEndpoint(): string {
  688. const {organization} = this.props;
  689. return `/organizations/${organization.slug}/issues-count/`;
  690. }
  691. get groupStatsEndpoint(): string {
  692. const {organization} = this.props;
  693. return `/organizations/${organization.slug}/issues-stats/`;
  694. }
  695. onRealtimeChange = (realtime: boolean) => {
  696. Cookies.set('realtimeActive', realtime.toString());
  697. this.setState({realtimeActive: realtime});
  698. trackAnalytics('issues_stream.realtime_clicked', {
  699. organization: this.props.organization,
  700. enabled: realtime,
  701. });
  702. };
  703. onSelectStatsPeriod = (period: string) => {
  704. const {location} = this.props;
  705. if (period !== this.getGroupStatsPeriod()) {
  706. const cursor = location.query.cursor;
  707. const queryPageInt = parseInt(location.query.page, 10);
  708. const page = isNaN(queryPageInt) || !location.query.cursor ? 0 : queryPageInt;
  709. this.transitionTo({cursor, page, groupStatsPeriod: period});
  710. }
  711. };
  712. onRealtimePoll = (data: any, {queryCount}: {queryCount: number}) => {
  713. // Note: We do not update state with cursors from polling,
  714. // `CursorPoller` updates itself with new cursors
  715. GroupStore.addToFront(data);
  716. this.setState({queryCount});
  717. };
  718. listener = GroupStore.listen(() => this.onGroupChange(), undefined);
  719. onGroupChange() {
  720. const {actionTakenGroupData} = this.state;
  721. const query = this.getQuery();
  722. if (!this.state.realtimeActive && actionTakenGroupData.length > 0) {
  723. const filteredItems = GroupStore.getAllItems().filter(item => {
  724. return actionTakenGroupData.findIndex(data => data.id === item.id) !== -1;
  725. });
  726. const resolvedIds = filteredItems
  727. .filter(item => item.status === 'resolved')
  728. .map(id => id.id);
  729. const ignoredIds = filteredItems
  730. .filter(item => item.status === 'ignored')
  731. .map(i => i.id);
  732. // need to include resolve and ignored statuses because marking as resolved/ignored also
  733. // counts as reviewed
  734. const reviewedIds = filteredItems
  735. .filter(
  736. item => !item.inbox && item.status !== 'resolved' && item.status !== 'ignored'
  737. )
  738. .map(i => i.id);
  739. // Remove Ignored and Resolved group ids from the issue stream if on the All Unresolved,
  740. // For Review, or Ignored tab. Still include on the saved/custom search tab.
  741. if (
  742. resolvedIds.length > 0 &&
  743. (query.includes('is:unresolved') ||
  744. query.includes('is:ignored') ||
  745. isForReviewQuery(query))
  746. ) {
  747. this.onIssueAction(resolvedIds, 'Resolved');
  748. }
  749. if (
  750. ignoredIds.length > 0 &&
  751. (query.includes('is:unresolved') || isForReviewQuery(query))
  752. ) {
  753. this.onIssueAction(ignoredIds, 'Archived');
  754. }
  755. // Remove issues that are marked as Reviewed from the For Review tab, but still include the
  756. // issues if on the All Unresolved tab or saved/custom searches.
  757. if (
  758. reviewedIds.length > 0 &&
  759. (isForReviewQuery(query) || query.includes('is:ignored'))
  760. ) {
  761. this.onIssueAction(reviewedIds, 'Reviewed');
  762. }
  763. }
  764. const groupIds = GroupStore.getAllItems()
  765. .map(item => item.id)
  766. .slice(0, MAX_ISSUES_COUNT);
  767. if (!isEqual(groupIds, this.state.groupIds)) {
  768. this.setState({groupIds});
  769. }
  770. }
  771. trackTabViewed(groups: string[], data: Group[]) {
  772. const {organization, location} = this.props;
  773. const page = location.query.page;
  774. const endpointParams = this.getEndpointParams();
  775. const tabQueriesWithCounts = getTabsWithCounts(organization);
  776. const currentTabQuery = tabQueriesWithCounts.includes(endpointParams.query as Query)
  777. ? endpointParams.query
  778. : null;
  779. const tab = getTabs(organization).find(
  780. ([tabQuery]) => currentTabQuery === tabQuery
  781. )?.[1];
  782. const numPerfIssues = groups.filter(
  783. group => GroupStore.get(group)?.issueCategory === IssueCategory.PERFORMANCE
  784. ).length;
  785. // First and last seen are only available after the group has fetched stats
  786. // Number of issues shown whose first seen is more than 30 days ago
  787. const numOldIssues = data.filter((group: BaseGroup) =>
  788. moment(new Date(group.firstSeen)).isBefore(moment().subtract(30, 'd'))
  789. ).length;
  790. // number of issues shown whose first seen is less than 7 days
  791. const numNewIssues = data.filter((group: BaseGroup) =>
  792. moment(new Date(group.firstSeen)).isAfter(moment().subtract(7, 'd'))
  793. ).length;
  794. trackAnalytics('issues_tab.viewed', {
  795. organization,
  796. tab: tab?.analyticsName,
  797. page: page ? parseInt(page, 10) : 0,
  798. query: this.getQuery(),
  799. num_perf_issues: numPerfIssues,
  800. num_old_issues: numOldIssues,
  801. num_new_issues: numNewIssues,
  802. num_issues: data.length,
  803. sort: this.getSort(),
  804. });
  805. }
  806. onSearch = (query: string) => {
  807. if (query === this.state.query) {
  808. // if query is the same, just re-fetch data
  809. this.fetchData();
  810. } else {
  811. // Clear the saved search as the user wants something else.
  812. this.transitionTo({query}, null);
  813. }
  814. };
  815. onSortChange = (sort: string) => {
  816. trackAnalytics('issues_stream.sort_changed', {
  817. organization: this.props.organization,
  818. sort,
  819. });
  820. this.transitionTo({sort});
  821. };
  822. onCursorChange: CursorHandler = (nextCursor, _path, _query, delta) => {
  823. const queryPageInt = parseInt(this.props.location.query.page, 10);
  824. let nextPage: number | undefined = isNaN(queryPageInt) ? delta : queryPageInt + delta;
  825. let cursor: undefined | string = nextCursor;
  826. // unset cursor and page when we navigate back to the first page
  827. // also reset cursor if somehow the previous button is enabled on
  828. // first page and user attempts to go backwards
  829. if (nextPage <= 0) {
  830. cursor = undefined;
  831. nextPage = undefined;
  832. }
  833. this.transitionTo({cursor, page: nextPage});
  834. };
  835. paginationAnalyticsEvent = (direction: string) => {
  836. trackAnalytics('issues_stream.paginate', {
  837. organization: this.props.organization,
  838. direction,
  839. });
  840. };
  841. /**
  842. * Returns true if all results in the current query are visible/on this page
  843. */
  844. allResultsVisible(): boolean {
  845. if (!this.state.pageLinks) {
  846. return false;
  847. }
  848. const links = parseLinkHeader(this.state.pageLinks);
  849. return links && !links.previous.results && !links.next.results;
  850. }
  851. transitionTo = (
  852. newParams: Partial<EndpointParams> = {},
  853. savedSearch: (SavedSearch & {projectId?: number}) | null = this.props.savedSearch
  854. ) => {
  855. const query = {
  856. ...omit(this.props.location.query, ['page', 'cursor']),
  857. referrer: 'issue-list',
  858. ...this.getEndpointParams(),
  859. ...newParams,
  860. };
  861. const {organization} = this.props;
  862. let path: string;
  863. if (savedSearch && savedSearch.id) {
  864. path = `/organizations/${organization.slug}/issues/searches/${savedSearch.id}/`;
  865. // Remove the query as saved searches bring their own query string.
  866. delete query.query;
  867. // If we aren't going to another page in the same search
  868. // drop the query and replace the current project, with the saved search search project
  869. // if available.
  870. if (!query.cursor && savedSearch.projectId) {
  871. query.project = [savedSearch.projectId];
  872. }
  873. if (!query.cursor && !newParams.sort && savedSearch.sort) {
  874. query.sort = savedSearch.sort;
  875. }
  876. } else {
  877. path = `/organizations/${organization.slug}/issues/`;
  878. }
  879. if (
  880. query.sort === IssueSortOptions.INBOX &&
  881. !FOR_REVIEW_QUERIES.includes(query.query || '')
  882. ) {
  883. delete query.sort;
  884. }
  885. if (
  886. path !== this.props.location.pathname ||
  887. !isEqual(query, this.props.location.query)
  888. ) {
  889. browserHistory.push({
  890. pathname: normalizeUrl(path),
  891. query,
  892. });
  893. this.setState({issuesLoading: true});
  894. }
  895. };
  896. displayReprocessingTab() {
  897. const {organization} = this.props;
  898. const {queryCounts} = this.state;
  899. return (
  900. organization.features.includes('reprocessing-v2') &&
  901. !!queryCounts?.[Query.REPROCESSING]?.count
  902. );
  903. }
  904. displayReprocessingLayout(showReprocessingTab: boolean, query: string) {
  905. return showReprocessingTab && query === Query.REPROCESSING;
  906. }
  907. renderLoading(): React.ReactNode {
  908. return (
  909. <Layout.Page withPadding>
  910. <LoadingIndicator />
  911. </Layout.Page>
  912. );
  913. }
  914. onSavedSearchSelect = (savedSearch: SavedSearch) => {
  915. trackAnalytics('organization_saved_search.selected', {
  916. organization: this.props.organization,
  917. search_type: 'issues',
  918. id: savedSearch.id ? parseInt(savedSearch.id, 10) : -1,
  919. is_global: savedSearch.isGlobal,
  920. query: savedSearch.query,
  921. visibility: savedSearch.visibility,
  922. });
  923. this.setState({issuesLoading: true}, () => this.transitionTo(undefined, savedSearch));
  924. };
  925. onDelete = () => {
  926. this.setState({actionTaken: true});
  927. this.fetchData(true);
  928. };
  929. onUndo = () => {
  930. const {organization, selection} = this.props;
  931. const {actionTakenGroupData} = this.state;
  932. const query = this.getQuery();
  933. const groupIds = actionTakenGroupData.map(data => data.id);
  934. const projectIds = selection?.projects?.map(p => p.toString());
  935. const endpoint = `/organizations/${organization.slug}/issues/`;
  936. if (this._lastRequest) {
  937. this._lastRequest.cancel();
  938. }
  939. if (this._lastStatsRequest) {
  940. this._lastStatsRequest.cancel();
  941. }
  942. if (this._lastFetchCountsRequest) {
  943. this._lastFetchCountsRequest.cancel();
  944. }
  945. this.props.api.request(endpoint, {
  946. method: 'PUT',
  947. data: {
  948. status: 'unresolved',
  949. },
  950. query: {
  951. project: projectIds,
  952. id: groupIds,
  953. },
  954. success: response => {
  955. if (!response) {
  956. return;
  957. }
  958. // If on the Ignore or For Review tab, adding back to the GroupStore will make the issue show up
  959. // on this page for a second and then be removed (will show up on All Unresolved). This is to
  960. // stop this from happening and avoid confusion.
  961. if (!query.includes('is:ignored') && !isForReviewQuery(query)) {
  962. GroupStore.add(actionTakenGroupData);
  963. }
  964. this.setState({undo: true});
  965. },
  966. error: err => {
  967. this.setState({
  968. error: parseApiError(err),
  969. issuesLoading: false,
  970. });
  971. },
  972. complete: () => {
  973. this.setState({actionTakenGroupData: []});
  974. this.fetchData();
  975. },
  976. });
  977. };
  978. onMarkReviewed = (itemIds: string[]) => {
  979. const query = this.getQuery();
  980. if (!isForReviewQuery(query)) {
  981. if (itemIds.length > 1) {
  982. addMessage(
  983. tn('Reviewed %s Issue', 'Reviewed %s Issues', itemIds.length),
  984. 'success',
  985. {duration: 4000}
  986. );
  987. } else {
  988. const shortId = itemIds.map(item => GroupStore.get(item)?.shortId).toString();
  989. addMessage(t('Reviewed %s', shortId), 'success', {duration: 4000});
  990. }
  991. return;
  992. }
  993. const {queryCounts, itemsRemoved} = this.state;
  994. const currentQueryCount = queryCounts[query as Query];
  995. if (itemIds.length && currentQueryCount) {
  996. const inInboxCount = itemIds.filter(id => GroupStore.get(id)?.inbox).length;
  997. currentQueryCount.count -= inInboxCount;
  998. this.setState({
  999. queryCounts: {
  1000. ...queryCounts,
  1001. [query as Query]: currentQueryCount,
  1002. },
  1003. itemsRemoved: itemsRemoved + inInboxCount,
  1004. });
  1005. }
  1006. };
  1007. onActionTaken = (itemIds: string[]) => {
  1008. const actionTakenGroupData = itemIds
  1009. .map(id => GroupStore.get(id) as Group | undefined)
  1010. .filter(defined);
  1011. this.setState({
  1012. actionTakenGroupData,
  1013. });
  1014. };
  1015. onIssueAction = (
  1016. itemIds: string[],
  1017. actionType: 'Reviewed' | 'Resolved' | 'Ignored' | 'Archived'
  1018. ) => {
  1019. if (itemIds.length > 1) {
  1020. addMessage(`${actionType} ${itemIds.length} ${t('Issues')}`, 'success', {
  1021. duration: 4000,
  1022. ...(actionType !== 'Reviewed' && {undo: this.onUndo}),
  1023. });
  1024. } else {
  1025. const shortId = itemIds.map(item => GroupStore.get(item)?.shortId).toString();
  1026. addMessage(`${actionType} ${shortId}`, 'success', {
  1027. duration: 4000,
  1028. ...(actionType !== 'Reviewed' && {undo: this.onUndo}),
  1029. });
  1030. }
  1031. const links = parseLinkHeader(this.state.pageLinks);
  1032. GroupStore.remove(itemIds);
  1033. const queryCount = this.state.queryCount - itemIds.length;
  1034. this.setState({
  1035. actionTaken: true,
  1036. queryCount,
  1037. });
  1038. if (GroupStore.getAllItemIds().length === 0) {
  1039. // If we run out of issues on the last page, navigate back a page to
  1040. // avoid showing an empty state - if not on the last page, just show a spinner
  1041. const shouldGoBackAPage = links?.previous?.results && !links?.next?.results;
  1042. this.transitionTo({cursor: shouldGoBackAPage ? links.previous.cursor : undefined});
  1043. this.fetchCounts(queryCount, true);
  1044. } else {
  1045. this.fetchData(true);
  1046. }
  1047. };
  1048. tagValueLoader = (key: string, search: string) => {
  1049. const {organization} = this.props;
  1050. const projectIds = this.getSelectedProjectIds();
  1051. const endpointParams = this.getEndpointParams();
  1052. return fetchTagValues({
  1053. api: this.props.api,
  1054. orgSlug: organization.slug,
  1055. tagKey: key,
  1056. search,
  1057. projectIds,
  1058. endpointParams: endpointParams as any,
  1059. });
  1060. };
  1061. getPageCounts = () => {
  1062. const {location} = this.props;
  1063. const {pageLinks, queryCount, groupIds} = this.state;
  1064. const links = parseLinkHeader(pageLinks);
  1065. const queryPageInt = parseInt(location.query.page, 10);
  1066. // Cursor must be present for the page number to be used
  1067. const page = isNaN(queryPageInt) || !location.query.cursor ? 0 : queryPageInt;
  1068. let numPreviousIssues = Math.min(page * MAX_ITEMS, queryCount);
  1069. // Because the query param `page` is not tied to the request, we need to
  1070. // validate that it's correct at the first and last page
  1071. if (!links?.next?.results || this.allResultsVisible()) {
  1072. // On last available page
  1073. numPreviousIssues = Math.max(queryCount - groupIds.length, 0);
  1074. } else if (!links?.previous?.results) {
  1075. // On first available page
  1076. numPreviousIssues = 0;
  1077. }
  1078. return {
  1079. numPreviousIssues,
  1080. numIssuesOnPage: groupIds.length,
  1081. };
  1082. };
  1083. render() {
  1084. if (
  1085. this.props.savedSearchLoading &&
  1086. !this.props.organization.features.includes('issue-stream-performance')
  1087. ) {
  1088. return this.renderLoading();
  1089. }
  1090. const {
  1091. pageLinks,
  1092. queryCount,
  1093. queryCounts,
  1094. realtimeActive,
  1095. groupIds,
  1096. queryMaxCount,
  1097. itemsRemoved,
  1098. issuesLoading,
  1099. error,
  1100. } = this.state;
  1101. const {organization, selection, router} = this.props;
  1102. const query = this.getQuery();
  1103. const modifiedQueryCount = Math.max(queryCount - itemsRemoved, 0);
  1104. const projectIds = selection?.projects?.map(p => p.toString());
  1105. const showReprocessingTab = this.displayReprocessingTab();
  1106. const displayReprocessingActions = this.displayReprocessingLayout(
  1107. showReprocessingTab,
  1108. query
  1109. );
  1110. const {numPreviousIssues, numIssuesOnPage} = this.getPageCounts();
  1111. return (
  1112. <Layout.Page>
  1113. <IssueListHeader
  1114. organization={organization}
  1115. query={query}
  1116. sort={this.getSort()}
  1117. queryCount={queryCount}
  1118. queryCounts={queryCounts}
  1119. realtimeActive={realtimeActive}
  1120. onRealtimeChange={this.onRealtimeChange}
  1121. router={router}
  1122. displayReprocessingTab={showReprocessingTab}
  1123. selectedProjectIds={selection.projects}
  1124. />
  1125. <StyledBody>
  1126. <StyledMain>
  1127. <IssueListFilters query={query} onSearch={this.onSearch} />
  1128. <Panel>
  1129. <IssueListActions
  1130. selection={selection}
  1131. query={query}
  1132. queryCount={modifiedQueryCount}
  1133. onSelectStatsPeriod={this.onSelectStatsPeriod}
  1134. onMarkReviewed={this.onMarkReviewed}
  1135. onActionTaken={this.onActionTaken}
  1136. onDelete={this.onDelete}
  1137. statsPeriod={this.getGroupStatsPeriod()}
  1138. groupIds={groupIds}
  1139. allResultsVisible={this.allResultsVisible()}
  1140. displayReprocessingActions={displayReprocessingActions}
  1141. sort={this.getSort()}
  1142. onSortChange={this.onSortChange}
  1143. />
  1144. <PanelBody>
  1145. <ProcessingIssueList
  1146. organization={organization}
  1147. projectIds={projectIds}
  1148. showProject
  1149. />
  1150. <VisuallyCompleteWithData
  1151. hasData={this.state.groupIds.length > 0}
  1152. id="IssueList-Body"
  1153. isLoading={this.state.issuesLoading}
  1154. >
  1155. <GroupListBody
  1156. memberList={this.state.memberList}
  1157. groupStatsPeriod={this.getGroupStatsPeriod()}
  1158. groupIds={groupIds}
  1159. displayReprocessingLayout={displayReprocessingActions}
  1160. query={query}
  1161. selectedProjectIds={selection.projects}
  1162. loading={issuesLoading}
  1163. error={error}
  1164. refetchGroups={this.fetchData}
  1165. />
  1166. </VisuallyCompleteWithData>
  1167. </PanelBody>
  1168. </Panel>
  1169. <StyledPagination
  1170. caption={
  1171. !issuesLoading && modifiedQueryCount > 0
  1172. ? tct('[start]-[end] of [total]', {
  1173. start: numPreviousIssues + 1,
  1174. end: numPreviousIssues + numIssuesOnPage,
  1175. total: (
  1176. <StyledQueryCount
  1177. hideParens
  1178. hideIfEmpty={false}
  1179. count={modifiedQueryCount}
  1180. max={queryMaxCount || 100}
  1181. />
  1182. ),
  1183. })
  1184. : null
  1185. }
  1186. pageLinks={pageLinks}
  1187. onCursor={this.onCursorChange}
  1188. paginationAnalyticsEvent={this.paginationAnalyticsEvent}
  1189. />
  1190. </StyledMain>
  1191. <SavedIssueSearches
  1192. {...{organization, query}}
  1193. onSavedSearchSelect={this.onSavedSearchSelect}
  1194. sort={this.getSort()}
  1195. />
  1196. </StyledBody>
  1197. </Layout.Page>
  1198. );
  1199. }
  1200. }
  1201. export default withRouteAnalytics(
  1202. withApi(
  1203. withPageFilters(
  1204. withSavedSearches(withOrganization(withIssueTags(withProfiler(IssueListOverview))))
  1205. )
  1206. )
  1207. );
  1208. export {IssueListOverview};
  1209. const StyledBody = styled('div')`
  1210. background-color: ${p => p.theme.background};
  1211. flex: 1;
  1212. display: grid;
  1213. gap: 0;
  1214. padding: 0;
  1215. grid-template-rows: 1fr;
  1216. grid-template-columns: minmax(0, 1fr) auto;
  1217. grid-template-areas: 'content saved-searches';
  1218. `;
  1219. const StyledMain = styled('section')`
  1220. grid-area: content;
  1221. padding: ${space(2)};
  1222. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  1223. padding: ${space(3)} ${space(4)};
  1224. }
  1225. `;
  1226. const StyledPagination = styled(Pagination)`
  1227. margin-top: 0;
  1228. `;
  1229. const StyledQueryCount = styled(QueryCount)`
  1230. margin-left: 0;
  1231. `;