index.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import type {Location} from 'history';
  2. import {t} from 'sentry/locale';
  3. import type {Organization} from 'sentry/types/organization';
  4. import type {Project} from 'sentry/types/project';
  5. import withOrganization from 'sentry/utils/withOrganization';
  6. import withProjects from 'sentry/utils/withProjects';
  7. import PageLayout from '../pageLayout';
  8. import Tab from '../tabs';
  9. import SpansContent from './content';
  10. import {generateSpansEventView} from './utils';
  11. type Props = {
  12. location: Location;
  13. organization: Organization;
  14. projects: Project[];
  15. };
  16. function TransactionSpans(props: Props) {
  17. const {location, organization, projects} = props;
  18. return (
  19. <PageLayout
  20. location={location}
  21. organization={organization}
  22. projects={projects}
  23. tab={Tab.SPANS}
  24. getDocumentTitle={getDocumentTitle}
  25. generateEventView={generateSpansEventView}
  26. childComponent={SpansContent}
  27. />
  28. );
  29. }
  30. function getDocumentTitle(transactionName: string): string {
  31. const hasTransactionName =
  32. typeof transactionName === 'string' && String(transactionName).trim().length > 0;
  33. if (hasTransactionName) {
  34. return [String(transactionName).trim(), t('Performance')].join(' - ');
  35. }
  36. return [t('Summary'), t('Performance')].join(' - ');
  37. }
  38. export default withProjects(withOrganization(TransactionSpans));