mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
scope-app: * Adds `-app.metrics-graph` cli flag for configuring the base url to use for graph links; supports :orgID and :query placeholders * Assigns query URLs to existing metrics and appends empty metrics if missing scope-ui: * Extends <CloudFeature /> with option alwaysShow * Adds <CloudLink /> to simplify routing when in cloud vs not in cloud * Links metric graphs in the ui's node details view for all k8s toplogies and containers so far * Tracks metric graph click in mixpanel `scope.node.metric.click` * Uses percentages and MB for CPU/Memory urls * Passes timetravel timestamp to cortex in deeplink
41 lines
922 B
JavaScript
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);
|