Files
weave-scope/client/app/scripts/components/cloud-feature.js
Roland Schilter 702220f2ce Link scope-ui graphs clickable to prometheus queries
scope-app:
- Adds `-app.metrics-graph` cli flag for configuring the base url to
  use for graph links; supports `:orgID` and `:query` placeholders
- Renders `metric_links` in node detail API response

scope-ui:
- Extends `<CloudFeature />` with option `alwaysShow` and adds
  boolean `isCloud` property
- Links metric graphs in the ui's node details view for all k8s
  toplogies; or displays placeholder graph if no metrics available
2017-08-11 16:45:13 +01:00

42 lines
963 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,
isCloud: true
});
}
// also show if not in weave cloud?
if (this.props.alwaysShow) {
return React.cloneElement(React.Children.only(this.props.children), {isCloud: false});
}
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);