Fix the click origin of the details panel in the table mode. (#2423)

This commit is contained in:
Filip Barl
2017-04-05 16:27:42 +02:00
committed by GitHub
parent b0624e7f58
commit 60629d3325
2 changed files with 4 additions and 12 deletions

View File

@@ -84,12 +84,12 @@ class NodesGrid extends React.Component {
this.onSortChange = this.onSortChange.bind(this);
}
onClickRow(ev, node, el) {
onClickRow(ev, node) {
// TODO: do this better
if (ev.target.className === 'node-details-table-node-link') {
return;
}
this.props.clickNode(node.id, node.label, el.getBoundingClientRect());
this.props.clickNode(node.id, node.label, ev.target.getBoundingClientRect());
}
onSortChange(sortedBy, sortedDesc) {

View File

@@ -79,17 +79,12 @@ export default class NodeDetailsTableRow extends React.Component {
this.state = { focused: false };
this.mouseDragOrigin = [0, 0];
this.saveLabelElementRef = this.saveLabelElementRef.bind(this);
this.onMouseDown = this.onMouseDown.bind(this);
this.onMouseUp = this.onMouseUp.bind(this);
this.onMouseEnter = this.onMouseEnter.bind(this);
this.onMouseLeave = this.onMouseLeave.bind(this);
}
saveLabelElementRef(ref) {
this.labelElement = ref;
}
onMouseEnter() {
this.setState({ focused: true });
if (this.props.onMouseEnter) {
@@ -121,8 +116,7 @@ export default class NodeDetailsTableRow extends React.Component {
return;
}
const { node, onClick } = this.props;
onClick(ev, node, this.labelElement);
this.props.onClick(ev, this.props.node);
}
render() {
@@ -143,9 +137,7 @@ export default class NodeDetailsTableRow extends React.Component {
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}
className={className}>
<td
className="node-details-table-node-label truncate"
ref={this.saveLabelElementRef} style={firstColumnStyle}>
<td className="node-details-table-node-label truncate" style={firstColumnStyle}>
{this.props.renderIdCell(Object.assign(node, {topologyId, nodeId}))}
</td>
{values}