index.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
  2. import {Location} from 'history';
  3. import Feature from 'sentry/components/acl/feature';
  4. import Alert from 'sentry/components/alert';
  5. import {t} from 'sentry/locale';
  6. import {PageContent} from 'sentry/styles/organization';
  7. import {Organization} from 'sentry/types';
  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.ReactChildren;
  13. location: Location;
  14. organization: Organization;
  15. };
  16. const queryClient = new QueryClient();
  17. function PerformanceContainer({organization, location, children}: Props) {
  18. function renderNoAccess() {
  19. return (
  20. <PageContent>
  21. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  22. </PageContent>
  23. );
  24. }
  25. return (
  26. <Feature
  27. hookName="feature-disabled:performance-page"
  28. features={['performance-view']}
  29. organization={organization}
  30. renderDisabled={renderNoAccess}
  31. >
  32. <QueryClientProvider client={queryClient}>
  33. <MetricsCardinalityProvider location={location} organization={organization}>
  34. <MEPSettingProvider>{children}</MEPSettingProvider>
  35. </MetricsCardinalityProvider>
  36. </QueryClientProvider>
  37. </Feature>
  38. );
  39. }
  40. export default withOrganization(PerformanceContainer);