index.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.Container>
  21. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  22. </Alert.Container>
  23. </Layout.Page>
  24. );
  25. }
  26. return (
  27. <Feature
  28. hookName="feature-disabled:performance-page"
  29. features="performance-view"
  30. organization={organization}
  31. renderDisabled={renderNoAccess}
  32. >
  33. <NoProjectMessage organization={organization}>
  34. <MetricsCardinalityProvider location={location} organization={organization}>
  35. <MEPSettingProvider>{children}</MEPSettingProvider>
  36. </MetricsCardinalityProvider>
  37. </NoProjectMessage>
  38. </Feature>
  39. );
  40. }
  41. export default withOrganization(PerformanceContainer);