ddm.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {useEffect} from 'react';
  2. import * as Sentry from '@sentry/react';
  3. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  4. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  5. import {t} from 'sentry/locale';
  6. import {trackAnalytics} from 'sentry/utils/analytics';
  7. import useOrganization from 'sentry/utils/useOrganization';
  8. import {DDMContextProvider, useDDMContext} from 'sentry/views/ddm/context';
  9. import {DDMLayout} from 'sentry/views/ddm/layout';
  10. function WrappedPageFiltersContainer({children}: {children: React.ReactNode}) {
  11. const {isDefaultQuery} = useDDMContext();
  12. return (
  13. <PageFiltersContainer disablePersistence={isDefaultQuery}>
  14. {' '}
  15. {children}
  16. </PageFiltersContainer>
  17. );
  18. }
  19. function DDM() {
  20. const organization = useOrganization();
  21. useEffect(() => {
  22. trackAnalytics('ddm.page-view', {
  23. organization,
  24. });
  25. Sentry.metrics.increment('ddm.visit');
  26. // eslint-disable-next-line react-hooks/exhaustive-deps
  27. }, []);
  28. return (
  29. <SentryDocumentTitle title={t('Metrics')} orgSlug={organization.slug}>
  30. <DDMContextProvider>
  31. <WrappedPageFiltersContainer>
  32. <DDMLayout />
  33. </WrappedPageFiltersContainer>
  34. </DDMContextProvider>
  35. </SentryDocumentTitle>
  36. );
  37. }
  38. export default DDM;