index.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 {MEPSettingProvider} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
  6. import withOrganization from 'sentry/utils/withOrganization';
  7. import withProjects from 'sentry/utils/withProjects';
  8. import PageLayout from '../pageLayout';
  9. import Tab from '../tabs';
  10. import AnomaliesContent from './content';
  11. import {generateAnomaliesEventView} from './utils';
  12. type Props = {
  13. location: Location;
  14. organization: Organization;
  15. projects: Project[];
  16. };
  17. function TransactionAnomalies(props: Props) {
  18. const {location, organization, projects} = props;
  19. return (
  20. <MEPSettingProvider>
  21. <PageLayout
  22. location={location}
  23. organization={organization}
  24. projects={projects}
  25. tab={Tab.ANOMALIES}
  26. generateEventView={generateAnomaliesEventView}
  27. getDocumentTitle={getDocumentTitle}
  28. childComponent={AnomaliesContent}
  29. />
  30. </MEPSettingProvider>
  31. );
  32. }
  33. function getDocumentTitle(transactionName: string): string {
  34. const hasTransactionName =
  35. typeof transactionName === 'string' && String(transactionName).trim().length > 0;
  36. if (hasTransactionName) {
  37. return [String(transactionName).trim(), t('Performance')].join(' - ');
  38. }
  39. return [t('Summary'), t('Performance')].join(' - ');
  40. }
  41. export default withProjects(withOrganization(TransactionAnomalies));