allEventsTable.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import {useState} from 'react';
  2. import {Location} from 'history';
  3. import LoadingError from 'sentry/components/loadingError';
  4. import {t} from 'sentry/locale';
  5. import {Organization} from 'sentry/types';
  6. import EventView, {decodeSorts} from 'sentry/utils/discover/eventView';
  7. import EventsTable from 'sentry/views/performance/transactionSummary/transactionEvents/eventsTable';
  8. export interface Props {
  9. isPerfIssue: boolean;
  10. issueId: string;
  11. location: Location;
  12. organization: Organization;
  13. excludedTags?: string[];
  14. }
  15. const AllEventsTable = (props: Props) => {
  16. const {location, organization, issueId, isPerfIssue, excludedTags} = props;
  17. const [error, setError] = useState<string>('');
  18. const eventView: EventView = EventView.fromLocation(props.location);
  19. eventView.sorts = decodeSorts(location);
  20. eventView.fields = [
  21. {field: 'id'},
  22. {field: 'transaction'},
  23. {field: 'trace'},
  24. {field: 'release'},
  25. {field: 'environment'},
  26. {field: 'user.display'},
  27. ...(isPerfIssue ? [{field: 'transaction.duration'}] : []),
  28. {field: 'timestamp'},
  29. ];
  30. const idQuery = isPerfIssue
  31. ? `performance.issue_ids:${issueId}`
  32. : `issue.id:${issueId}`;
  33. eventView.query = `${idQuery} ${props.location.query.query || ''}`;
  34. const columnTitles: Readonly<string[]> = [
  35. t('event id'),
  36. t('transaction'),
  37. t('trace id'),
  38. t('release'),
  39. t('environment'),
  40. t('user'),
  41. ...(isPerfIssue ? [t('total duration')] : []),
  42. t('timestamp'),
  43. ];
  44. if (error) {
  45. return <LoadingError message={error} />;
  46. }
  47. return (
  48. <EventsTable
  49. eventView={eventView}
  50. location={location}
  51. issueId={issueId}
  52. organization={organization}
  53. excludedTags={excludedTags}
  54. setError={() => {
  55. (msg: string) => setError(msg);
  56. }}
  57. transactionName=""
  58. disablePagination
  59. columnTitles={columnTitles.slice()}
  60. />
  61. );
  62. };
  63. export default AllEventsTable;