<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import TreeView from './TreeView';
import { getStackAsFuncArray } from '../profile-data';
import { getCallTree } from '../profile-tree';
import * as Actions from '../actions';

class ProfileTreeView extends Component{
  constructor(props) {
    super(props);
    this._onSelectionChange = this._onSelectionChange.bind(this);
    this._onExpandedNodesChange = this._onExpandedNodesChange.bind(this);
    this._fixedColumns = [
      { propName: 'totalTime', title: 'Running Time' },
      { propName: 'totalTimePercent', title: '' },
      { propName: 'selfTime', title: 'Self' },
    ];
    this._mainColumn = { propName:'name', title: '' };
  }

  _onSelectionChange(newSelectedNodeId) {
    const { dispatch } = this.props;
    dispatch(Actions.changeSelectedFuncStack(this.props.threadIndex,
      getStackAsFuncArray(newSelectedNodeId, this.props.funcStackInfo.funcStackTable)));
  }

  _onExpandedNodesChange(newExpandedNodeIds) {
    const { dispatch } = this.props;
    const newExpandedFuncStacks =
      newExpandedNodeIds.map(nodeId => getStackAsFuncArray(nodeId, this.props.funcStackInfo.funcStackTable));
    dispatch(Actions.changeExpandedFuncStacks(this.props.threadIndex,
      newExpandedFuncStacks));
  }

  componentWillMount() {
    const { thread, interval, funcStackInfo, selectedFuncStack } = this.props;
    this._tree = getCallTree(thread, interval, funcStackInfo);
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.funcStackInfo !== this.props.funcStackInfo) {
      const { thread, interval, funcStackInfo } = nextProps;
      this._tree = getCallTree(thread, interval, funcStackInfo);
    }
  }

  render() {
    return (
      <TreeView tree={this._tree}
                fixedColumns={this._fixedColumns}
                mainColumn={this._mainColumn}
                onSelectionChange={this._onSelectionChange}
                onExpandedNodesChange={this._onExpandedNodesChange}
                selectedNodeId={this.props.selectedFuncStack}
                expandedNodeIds={this.props.expandedFuncStacks} />
    );

  }
}
export default connect()(ProfileTreeView);<commit_msg>Fix eslint failures in ProfileTreeView.js.<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import TreeView from './TreeView';
import { getStackAsFuncArray } from '../profile-data';
import { getCallTree } from '../profile-tree';
import * as Actions from '../actions';

class ProfileTreeView extends Component{
  constructor(props) {
    super(props);
    this._onSelectionChange = this._onSelectionChange.bind(this);
    this._onExpandedNodesChange = this._onExpandedNodesChange.bind(this);
    this._fixedColumns = [
      { propName: 'totalTime', title: 'Running Time' },
      { propName: 'totalTimePercent', title: '' },
      { propName: 'selfTime', title: 'Self' },
    ];
    this._mainColumn = { propName:'name', title: '' };
  }

  _onSelectionChange(newSelectedNodeId) {
    const { dispatch } = this.props;
    dispatch(Actions.changeSelectedFuncStack(this.props.threadIndex,
      getStackAsFuncArray(newSelectedNodeId, this.props.funcStackInfo.funcStackTable)));
  }

  _onExpandedNodesChange(newExpandedNodeIds) {
    const { dispatch } = this.props;
    const newExpandedFuncStacks =
      newExpandedNodeIds.map(nodeId => getStackAsFuncArray(nodeId, this.props.funcStackInfo.funcStackTable));
    dispatch(Actions.changeExpandedFuncStacks(this.props.threadIndex,
      newExpandedFuncStacks));
  }

  componentWillMount() {
    const { thread, interval, funcStackInfo } = this.props;
    this._tree = getCallTree(thread, interval, funcStackInfo);
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.funcStackInfo !== this.props.funcStackInfo) {
      const { thread, interval, funcStackInfo } = nextProps;
      this._tree = getCallTree(thread, interval, funcStackInfo);
    }
  }

  render() {
    return (
      <TreeView tree={this._tree}
                fixedColumns={this._fixedColumns}
                mainColumn={this._mainColumn}
                onSelectionChange={this._onSelectionChange}
                onExpandedNodesChange={this._onExpandedNodesChange}
                selectedNodeId={this.props.selectedFuncStack}
                expandedNodeIds={this.props.expandedFuncStacks} />
    );

  }
}

ProfileTreeView.propTypes = {
  thread: PropTypes.shape({
    samples: PropTypes.object.isRequired,
  }).isRequired,
  threadIndex: PropTypes.number.isRequired,
  interval: PropTypes.number.isRequired,
  funcStackInfo: PropTypes.shape({
    funcStackTable: PropTypes.object.isRequired,
    sampleFuncStacks: PropTypes.array.isRequired,
  }).isRequired,
  selectedFuncStack: PropTypes.number.isRequired,
  expandedFuncStacks: PropTypes.array.isRequired,
  dispatch: PropTypes.func.isRequired,
};

export default connect()(ProfileTreeView);
{'fraction_non_alphanumeric': 0.11660278394190034, 'fraction_numerical': 0.0, 'mean_word_length': 3.84652981427175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6519666', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1420, 'n_words': 241}