index.tsx 1.2 KB

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