Files
weave-scope/client/app/scripts/components/cloud-feature.js
Roland Schilter 8188b7aed2 Append links directly to metrics
The initial idea was to keep it separate since the unattached
links were also to be displayed distinctively from the metrics.
With the new design, unattached links are rendered in the same
list as metrics with attached links.

Therefore, we treat unattached metric links as an empty metric.
2017-08-11 16:45:13 +01:00

41 lines
922 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
});
}
// also show if not in weave cloud?
if (this.props.alwaysShow) {
return React.cloneElement(React.Children.only(this.props.children));
}
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);