index.tsx 895 B

12345678910111213141516171819202122232425262728293031
  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 NoProjectMessage from 'sentry/components/noProjectMessage';
  5. import {t} from 'sentry/locale';
  6. import useOrganization from 'sentry/utils/useOrganization';
  7. type Props = {
  8. children: React.ReactNode;
  9. };
  10. function MetricsContainer({children}: Props) {
  11. const organization = useOrganization();
  12. return (
  13. <Feature
  14. features={['custom-metrics']}
  15. requireAll
  16. organization={organization}
  17. renderDisabled={() => (
  18. <Layout.Page withPadding>
  19. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  20. </Layout.Page>
  21. )}
  22. >
  23. <NoProjectMessage organization={organization}>{children}</NoProjectMessage>
  24. </Feature>
  25. );
  26. }
  27. export default MetricsContainer;