<commit_before>import React from 'react';
import _ from 'lodash';

export default class ToolList extends React.Component {
  constructor(props) {
    super(props);

    this.renderNode = this.renderNode.bind(this);
  }

  renderNode(node) {
    let cName = 'node';
    if (node.id === this.props.curtool) {
      cName += ' running-node';
    }
    if (node.enabled === false) {
      cName += ' disabled';
    }

    return (
      <ol
        id={node.id}
        type = {node.toolType}
        className={cName}
        onClick={() => this.props.propertyCb(node)}
        onMouseDown={function(e) {
          e.stopPropagation();
          return false;
        }}
        style={{'paddingLeft': '5px'}}
        key={node.id}
      >
        {node.icon}
        <span className="textbox">{node.name} {node.value}</span>
      </ol>
    );
  }

  render() {

    let treeHeight;
    if(this.props.isMobile)
      treeHeight={"height": "100%"};

    return (
      <div className='m-tree' style={treeHeight}>
        {_.values(this.props.tools).map((tool, i) => {
          return <div className='m-node' key={i}>
            {this.renderNode(tool)}
          </div>;
        })}
      </div>
    );
  }
}

ToolList.propTypes = {
  cbMode: React.PropTypes.func.isRequired,
  cbTree: React.PropTypes.func.isRequired,
};
<commit_msg>Display active tools before disabled tools<commit_after>import React from 'react';
import _ from 'lodash';

export default class ToolList extends React.Component {
  constructor(props) {
    super(props);

    this.renderNode = this.renderNode.bind(this);
  }

  renderNode(node) {
    let cName = 'node';
    if (node.id === this.props.curtool) {
      cName += ' running-node';
    }
    if (node.enabled === false) {
      cName += ' disabled';
    }

    return (
      <ol
        id={node.id}
        type = {node.toolType}
        className={cName}
        onClick={() => this.props.propertyCb(node)}
        onMouseDown={function(e) {
          e.stopPropagation();
          return false;
        }}
        style={{'paddingLeft': '5px'}}
        key={node.id}
      >
        {node.icon}
        <span className="textbox">{node.name} {node.value}</span>
      </ol>
    );
  }

  render() {

    let treeHeight;
    if(this.props.isMobile)
      treeHeight={"height": "100%"};

    let tListActive=(_.values(this.props.tools).map((tool, i) => {
          if(tool.enabled === true)
            return (<div className='m-node' key={i}>
              {this.renderNode(tool)}
            </div>);
          else return "";
        }));

    let tListDisabled=(_.values(this.props.tools).map((tool, i) => {
          if(tool.enabled === false)
            return (<div className='m-node' key={i}>
              {this.renderNode(tool)}
            </div>);
          else return "";
        }));

    return (
      <div className='m-tree' style={treeHeight}>
        {tListActive}
        {tListDisabled}
      </div>
    );
  }
}

ToolList.propTypes = {
  cbMode: React.PropTypes.func.isRequired,
  cbTree: React.PropTypes.func.isRequired,
};

{'fraction_non_alphanumeric': 0.16390782213567023, 'fraction_numerical': 0.002596559558584875, 'mean_word_length': 2.1006036217303823, 'pattern_counts': {'":': 2, '<': 21, '<?xml version=': 0, '>': 26, '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': '3303024', 'n_tokens_mistral': 1004, 'n_tokens_neox': 988, 'n_words': 175}