index.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 {QueryClient, QueryClientProvider} from 'sentry/utils/queryClient';
  7. import useOrganization from 'sentry/utils/useOrganization';
  8. type Props = {
  9. children: React.ReactChildren;
  10. };
  11. const queryClient = new QueryClient();
  12. function StarfishContainer({children}: Props) {
  13. const organization = useOrganization();
  14. return (
  15. <Feature
  16. hookName="feature-disabled:starfish-view"
  17. features="starfish-view"
  18. organization={organization}
  19. renderDisabled={NoAccess}
  20. >
  21. <NoProjectMessage organization={organization}>
  22. <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
  23. </NoProjectMessage>
  24. </Feature>
  25. );
  26. }
  27. function NoAccess() {
  28. return (
  29. <Layout.Page withPadding>
  30. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  31. </Layout.Page>
  32. );
  33. }
  34. export default StarfishContainer;