index.tsx 1.4 KB

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