index.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 {DiscoverDatasets} from 'sentry/utils/discover/types';
  6. import useOrganization from 'sentry/utils/useOrganization';
  7. import {SpanTagsProvider} from 'sentry/views/explore/contexts/spanTagsContext';
  8. import WidgetLegendSelectionState from '../widgetLegendSelectionState';
  9. import WidgetBuilder from './widgetBuilder';
  10. interface WidgetBuilderProps extends React.ComponentProps<typeof WidgetBuilder> {}
  11. function WidgetBuilderContainer(props: WidgetBuilderProps) {
  12. const organization = useOrganization();
  13. return (
  14. <Feature
  15. features="dashboards-edit"
  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. <SpanTagsProvider
  24. dataset={DiscoverDatasets.SPANS_EAP}
  25. enabled={organization.features.includes('dashboards-eap')}
  26. >
  27. <WidgetBuilder
  28. {...props}
  29. widgetLegendState={
  30. new WidgetLegendSelectionState({
  31. location: props.location,
  32. organization,
  33. dashboard: props.dashboard,
  34. router: props.router,
  35. })
  36. }
  37. />
  38. </SpanTagsProvider>
  39. </Feature>
  40. );
  41. }
  42. export type {WidgetBuilderProps};
  43. export default WidgetBuilderContainer;