index.tsx 949 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 {t} from 'sentry/locale';
  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. <Layout.Page withPadding>
  17. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  18. </Layout.Page>
  19. )}
  20. >
  21. <WidgetBuilder {...props} organization={organization} />
  22. </Feature>
  23. );
  24. }
  25. export type {WidgetBuilderProps};
  26. export default WidgetBuilderContainer;