groupEvents.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import {useCallback} from 'react';
  2. import {browserHistory, RouteComponentProps} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import EventSearchBar from 'sentry/components/events/searchBar';
  5. import * as Layout from 'sentry/components/layouts/thirds';
  6. import {space} from 'sentry/styles/space';
  7. import {Group} from 'sentry/types';
  8. import useCleanQueryParamsOnRouteLeave from 'sentry/utils/useCleanQueryParamsOnRouteLeave';
  9. import useOrganization from 'sentry/utils/useOrganization';
  10. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  11. import AllEventsTable from './allEventsTable';
  12. interface Props extends RouteComponentProps<{groupId: string}, {}> {
  13. group: Group;
  14. }
  15. const excludedTags = [
  16. 'environment',
  17. 'issue',
  18. 'issue.id',
  19. 'performance.issue_ids',
  20. 'transaction.op',
  21. 'transaction.status',
  22. ];
  23. function GroupEvents({params, location, group}: Props) {
  24. const organization = useOrganization();
  25. const {groupId} = params;
  26. useCleanQueryParamsOnRouteLeave({fieldsToClean: ['cursor', 'query']});
  27. const handleSearch = useCallback(
  28. (query: string) =>
  29. browserHistory.push(
  30. normalizeUrl({
  31. pathname: `/organizations/${organization.slug}/issues/${groupId}/events/`,
  32. query: {...location.query, query},
  33. })
  34. ),
  35. [location, organization, groupId]
  36. );
  37. return (
  38. <Layout.Body>
  39. <Layout.Main fullWidth>
  40. <AllEventsFilters>
  41. <EventSearchBar
  42. organization={organization}
  43. defaultQuery=""
  44. onSearch={handleSearch}
  45. excludedTags={excludedTags}
  46. query={location.query?.query ?? ''}
  47. hasRecentSearches={false}
  48. />
  49. </AllEventsFilters>
  50. <AllEventsTable
  51. issueId={group.id}
  52. location={location}
  53. organization={organization}
  54. group={group}
  55. excludedTags={excludedTags}
  56. />
  57. </Layout.Main>
  58. </Layout.Body>
  59. );
  60. }
  61. const AllEventsFilters = styled('div')`
  62. margin-bottom: ${space(2)};
  63. `;
  64. export default GroupEvents;