index.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import Feature from 'sentry/components/acl/feature';
  2. import {Alert} from 'sentry/components/alert';
  3. import * as Layout from 'sentry/components/layouts/thirds';
  4. import {useRedirectNavV2Routes} from 'sentry/components/nav/useRedirectNavV2Routes';
  5. import NoProjectMessage from 'sentry/components/noProjectMessage';
  6. import Redirect from 'sentry/components/redirect';
  7. import {t} from 'sentry/locale';
  8. import useOrganization from 'sentry/utils/useOrganization';
  9. const profilingFeature = ['profiling'];
  10. type Props = {
  11. children: React.ReactNode;
  12. };
  13. function ProfilingContainer({children}: Props) {
  14. const organization = useOrganization();
  15. const redirectPath = useRedirectNavV2Routes({
  16. oldPathPrefix: '/profiling/',
  17. newPathPrefix: '/explore/profiling/',
  18. });
  19. if (redirectPath) {
  20. return <Redirect to={redirectPath} />;
  21. }
  22. return (
  23. <Feature
  24. hookName="feature-disabled:profiling-page"
  25. features={profilingFeature}
  26. organization={organization}
  27. renderDisabled={() => (
  28. <Layout.Page withPadding>
  29. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  30. </Layout.Page>
  31. )}
  32. >
  33. <NoProjectMessage organization={organization}>{children}</NoProjectMessage>
  34. </Feature>
  35. );
  36. }
  37. export default ProfilingContainer;