overview.tsx 42 KB

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