index.tsx 1.5 KB

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