Track health graph click in mixpanel (&& cleanup)

This commit is contained in:
Roland Schilter
2017-06-29 16:36:41 +02:00
parent c3118d0397
commit 6b414ee435
3 changed files with 10 additions and 5 deletions

View File

@@ -151,7 +151,7 @@ class NodeDetails extends React.Component {
}
renderDetails() {
const { details, nodeControlStatus, nodeMatches = makeMap() } = this.props;
const { details, nodeControlStatus, nodeMatches = makeMap(), topologyId } = this.props;
const showControls = details.controls && details.controls.length > 0;
const nodeColor = getNodeColorDark(details.rank, details.label, details.pseudo);
const {error, pending} = nodeControlStatus ? nodeControlStatus.toJS() : {};
@@ -204,6 +204,7 @@ class NodeDetails extends React.Component {
metrics={details.metrics}
metricLinks={metricLinks}
unattachedLinks={unattachedLinks}
topologyId={topologyId}
/>
</div>}
{details.metadata && <div className="node-details-content-section">

View File

@@ -1,5 +1,6 @@
import React from 'react';
import { trackMixpanelEvent } from '../../utils/tracking-utils';
import NodeDetailsHealthItem from './node-details-health-item';
export default class NodeDetailsHealthLinkItem extends React.Component {
@@ -15,7 +16,9 @@ export default class NodeDetailsHealthLinkItem extends React.Component {
ev.preventDefault();
if (!href) return;
const {router} = this.props;
const { router, topologyId } = this.props;
trackMixpanelEvent('scope.node.health.click', { topologyId });
if (router && href[0] === '/') {
router.push(href);
} else {
@@ -29,7 +32,7 @@ export default class NodeDetailsHealthLinkItem extends React.Component {
}
render() {
const {links, withoutGraph, id, ...props} = this.props;
const { links, withoutGraph, id, ...props } = this.props;
const href = this.buildHref(links[id] && links[id].url);
if (!href) return <NodeDetailsHealthItem {...props} />;

View File

@@ -21,8 +21,7 @@ export default class NodeDetailsHealth extends React.Component {
}
render() {
const metrics = this.props.metrics || [];
const metricLinks = this.props.metricLinks || {};
const { metrics = [], metricLinks = {}, topologyId } = this.props;
const unattachedLinks = this.props.unattachedLinks || {};
const hasUnattached = Object.keys(unattachedLinks).length > 0;
const primeCutoff = metrics.length > 3 && !this.state.expanded ? 2 : metrics.length;
@@ -40,6 +39,7 @@ export default class NodeDetailsHealth extends React.Component {
<NodeDetailsHealthLinkItem
{...item}
links={metricLinks}
topologyId={topologyId}
/>
</CloudFeature>)}
{showOverflow && <NodeDetailsHealthOverflow
@@ -57,6 +57,7 @@ export default class NodeDetailsHealth extends React.Component {
withoutGraph
{...unattachedLinks[id]}
links={unattachedLinks}
topologyId={topologyId}
/>
</CloudFeature>)}
</div>}