Files
weave-scope/client/app/scripts/components/node-details/node-details-table-node-link.js
David Kaltschmidt 96aae9bc99 Migrate from Flux to Redux
* better state visibility
* pure state changes
* state debug panel (show: crtl-h, move: ctrl-w)
2016-04-27 17:21:46 +02:00

38 lines
992 B
JavaScript

import React from 'react';
import ReactDOM from 'react-dom';
import { connect } from 'react-redux';
import { clickRelative } from '../../actions/app-actions';
class NodeDetailsTableNodeLink extends React.Component {
constructor(props, context) {
super(props, context);
this.handleClick = this.handleClick.bind(this);
}
handleClick(ev) {
ev.preventDefault();
this.props.dispatch(clickRelative(this.props.nodeId, this.props.topologyId,
this.props.label, ReactDOM.findDOMNode(this).getBoundingClientRect()));
}
render() {
if (this.props.linkable) {
return (
<span className="node-details-table-node-link truncate" title={this.props.label}
onClick={this.handleClick}>
{this.props.label}
</span>
);
}
return (
<span className="node-details-table-node truncate" title={this.props.label}>
{this.props.label}
</span>
);
}
}
export default connect()(NodeDetailsTableNodeLink);