index.tsx 930 B

12345678910111213141516171819202122232425262728293031
  1. import Feature from 'sentry/components/acl/feature';
  2. import Alert from 'sentry/components/alert';
  3. import {t} from 'sentry/locale';
  4. import {PageContent} from 'sentry/styles/organization';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. import WidgetBuilder from './widgetBuilder';
  7. interface WidgetBuilderProps
  8. extends Omit<React.ComponentProps<typeof WidgetBuilder>, 'organization'> {}
  9. function WidgetBuilderContainer(props: WidgetBuilderProps) {
  10. const organization = useOrganization();
  11. return (
  12. <Feature
  13. features={['dashboards-edit']}
  14. organization={organization}
  15. renderDisabled={() => (
  16. <PageContent>
  17. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  18. </PageContent>
  19. )}
  20. >
  21. <WidgetBuilder {...props} organization={organization} />
  22. </Feature>
  23. );
  24. }
  25. export {WidgetBuilderProps};
  26. export default WidgetBuilderContainer;