|
@@ -1,31 +1,25 @@
|
|
|
-import {cloneElement, Component, Fragment, isValidElement} from 'react';
|
|
|
+import {cloneElement, Fragment, isValidElement} from 'react';
|
|
|
|
|
|
-import Feature from 'sentry/components/acl/feature';
|
|
|
import {Organization} from 'sentry/types';
|
|
|
import withOrganization from 'sentry/utils/withOrganization';
|
|
|
|
|
|
type Props = {
|
|
|
organization: Organization;
|
|
|
+ children: React.ReactNode;
|
|
|
};
|
|
|
|
|
|
-class AlertsContainer extends Component<Props> {
|
|
|
- render() {
|
|
|
- const {children, organization} = this.props;
|
|
|
- return (
|
|
|
- <Feature organization={organization} features={['incidents']}>
|
|
|
- {({hasFeature: hasMetricAlerts}) => (
|
|
|
- <Fragment>
|
|
|
- {children && isValidElement(children)
|
|
|
- ? cloneElement(children, {
|
|
|
- organization,
|
|
|
- hasMetricAlerts,
|
|
|
- })
|
|
|
- : children}
|
|
|
- </Fragment>
|
|
|
- )}
|
|
|
- </Feature>
|
|
|
- );
|
|
|
- }
|
|
|
+function AlertsContainer({organization, children}: Props) {
|
|
|
+ const hasMetricAlerts = organization.features.includes('incidents');
|
|
|
+
|
|
|
+ const content =
|
|
|
+ children && isValidElement(children)
|
|
|
+ ? cloneElement(children, {
|
|
|
+ organization,
|
|
|
+ hasMetricAlerts,
|
|
|
+ })
|
|
|
+ : children;
|
|
|
+
|
|
|
+ return <Fragment>{content}</Fragment>;
|
|
|
}
|
|
|
|
|
|
export default withOrganization(AlertsContainer);
|