<commit_before>import React from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';

import { trackAnalyticsEvent } from '../../utils/tracking-utils';
import { doControl } from '../../actions/app-actions';

class NodeDetailsControlButton extends React.Component {
  constructor(props, context) {
    super(props, context);
    this.handleClick = this.handleClick.bind(this);
  }

  render() {
    const { icon, human } = this.props.control;
    const className = classNames('tour-step-anchor node-control-button', icon, {
      // Old Agent / plugins don't include the 'fa ' prefix, so provide it if they don't.
      fa: icon.startsWith('fa-'),
      'node-control-button-pending': this.props.pending
    });
    return (
      <i className={className} title={human} onClick={this.handleClick} />
    );
  }

  handleClick(ev) {
    ev.preventDefault();
    const { id, human } = this.props.control;
    trackAnalyticsEvent('scope.node.control.click', { id, title: human });
    this.props.dispatch(doControl(this.props.nodeId, this.props.control));
  }
}

// Using this instead of PureComponent because of props.dispatch
export default connect()(NodeDetailsControlButton);<commit_msg>Include the control's id as an attr on the button<commit_after>import React from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';

import { trackAnalyticsEvent } from '../../utils/tracking-utils';
import { doControl } from '../../actions/app-actions';

class NodeDetailsControlButton extends React.Component {
  constructor(props, context) {
    super(props, context);
    this.handleClick = this.handleClick.bind(this);
  }

  render() {
    const { icon, id, human } = this.props.control;
    const className = classNames('tour-step-anchor node-control-button', icon, {
      // Old Agent / plugins don't include the 'fa ' prefix, so provide it if they don't.
      fa: icon.startsWith('fa-'),
      'node-control-button-pending': this.props.pending
    });
    return (
      <i className={className} data-id={id} title={human} onClick={this.handleClick} />
    );
  }

  handleClick(ev) {
    ev.preventDefault();
    const { id, human } = this.props.control;
    trackAnalyticsEvent('scope.node.control.click', { id, title: human });
    this.props.dispatch(doControl(this.props.nodeId, this.props.control));
  }
}

// Using this instead of PureComponent because of props.dispatch
export default connect()(NodeDetailsControlButton);
{'fraction_non_alphanumeric': 0.14199759326113118, 'fraction_numerical': 0.0, 'mean_word_length': 3.7145557655954633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '831354', 'n_tokens_mistral': 726, 'n_tokens_neox': 718, 'n_words': 182}