mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
* Use prop-types library to fix the deprecation warning. * Updated weaveworks-ui-components version.
36 lines
767 B
JavaScript
36 lines
767 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { connect } from 'react-redux';
|
|
|
|
class CloudFeature extends React.Component {
|
|
getChildContext() {
|
|
return {
|
|
store: this.context.serviceStore || this.context.store
|
|
};
|
|
}
|
|
|
|
render() {
|
|
if (process.env.WEAVE_CLOUD) {
|
|
return React.cloneElement(React.Children.only(this.props.children), {
|
|
params: this.context.router.params,
|
|
router: this.context.router
|
|
});
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
CloudFeature.contextTypes = {
|
|
store: PropTypes.object.isRequired,
|
|
router: PropTypes.object,
|
|
serviceStore: PropTypes.object
|
|
};
|
|
|
|
CloudFeature.childContextTypes = {
|
|
store: PropTypes.object,
|
|
router: PropTypes.object
|
|
};
|
|
|
|
export default connect()(CloudFeature);
|