Files
weave-scope/client/app/scripts/components/node-details/node-details-relatives-link.js
Filip Barl 65b9b48b53 Added mixpanel tracking for some basic events (#2462)
* Added mixpanel tracking for bunch of events.

* Changed hitEnter action to pinSearch.

* Moved all the event tracking out of app-actions.js

* Addressed @foot's comment.

* Added more keypress events tracking.

* Disable 'r' keyboard shortcut when Resource View is disabled
2017-04-27 14:26:07 +02:00

48 lines
1.2 KiB
JavaScript

import React from 'react';
import { connect } from 'react-redux';
import { clickRelative } from '../../actions/app-actions';
import { trackMixpanelEvent } from '../../utils/tracking-utils';
import MatchedText from '../matched-text';
class NodeDetailsRelativesLink extends React.Component {
constructor(props, context) {
super(props, context);
this.handleClick = this.handleClick.bind(this);
this.saveNodeRef = this.saveNodeRef.bind(this);
}
handleClick(ev) {
ev.preventDefault();
trackMixpanelEvent('scope.node.relative.click', {
topologyId: this.props.topologyId,
});
this.props.dispatch(clickRelative(
this.props.id,
this.props.topologyId,
this.props.label,
this.node.getBoundingClientRect()
));
}
saveNodeRef(ref) {
this.node = ref;
}
render() {
const title = `View in ${this.props.topologyId}: ${this.props.label}`;
return (
<span
className="node-details-relatives-link" title={title}
onClick={this.handleClick} ref={this.saveNodeRef}>
<MatchedText text={this.props.label} match={this.props.match} />
</span>
);
}
}
// Using this instead of PureComponent because of props.dispatch
export default connect()(NodeDetailsRelativesLink);