index.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {Location} from 'history';
  2. import Feature from 'sentry/components/acl/feature';
  3. import Alert from 'sentry/components/alert';
  4. import {t} from 'sentry/locale';
  5. import {PageContent} from 'sentry/styles/organization';
  6. import {Organization} from 'sentry/types';
  7. import {MetricsCardinalityProvider} from 'sentry/utils/performance/contexts/metricsCardinality';
  8. import {MEPSettingProvider} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
  9. import withOrganization from 'sentry/utils/withOrganization';
  10. type Props = {
  11. children: React.ReactChildren;
  12. location: Location;
  13. organization: Organization;
  14. };
  15. function PerformanceContainer({organization, location, children}: Props) {
  16. function renderNoAccess() {
  17. return (
  18. <PageContent>
  19. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  20. </PageContent>
  21. );
  22. }
  23. return (
  24. <Feature
  25. hookName="feature-disabled:performance-page"
  26. features={['performance-view']}
  27. organization={organization}
  28. renderDisabled={renderNoAccess}
  29. >
  30. <MetricsCardinalityProvider location={location} organization={organization}>
  31. <MEPSettingProvider>{children}</MEPSettingProvider>
  32. </MetricsCardinalityProvider>
  33. </Feature>
  34. );
  35. }
  36. export default withOrganization(PerformanceContainer);