index.tsx 850 B

12345678910111213141516171819202122232425262728293031
  1. import {cloneElement, Component, Fragment, isValidElement} from 'react';
  2. import Feature from 'app/components/acl/feature';
  3. import {Organization} from 'app/types';
  4. import withOrganization from 'app/utils/withOrganization';
  5. type Props = {
  6. organization: Organization;
  7. };
  8. class AlertsContainer extends Component<Props> {
  9. render() {
  10. const {children, organization} = this.props;
  11. return (
  12. <Feature organization={organization} features={['incidents']}>
  13. {({hasFeature: hasMetricAlerts}) => (
  14. <Fragment>
  15. {children && isValidElement(children)
  16. ? cloneElement(children, {
  17. organization,
  18. hasMetricAlerts,
  19. })
  20. : children}
  21. </Fragment>
  22. )}
  23. </Feature>
  24. );
  25. }
  26. }
  27. export default withOrganization(AlertsContainer);