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

export default class WorkingstepList extends React.Component {
  constructor(props){
    //Create the constructor for the component
    super(props);

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

  setWS(node,self){
    let url = '/v3/nc/state/ws/' + node["id"];
    request
        .get(url)
        .end(function (err, res) {
        });
  }

  getNodeIcon(node){
    if(isNaN(node.number)){
      return;
    }
    return <span className='icon-letter'>{node.number}</span>;
  }

  shouldComponentUpdate(nextProps, nextState) {
    return this.props.ws !== nextProps.ws;
  }

  renderNode(nodeId){
    let node = this.props.workingstepCache[nodeId];
    node.icon = this.getNodeIcon(node);
    let cName = 'node';
    if (node.id == this.props.ws) cName = 'node running-node';
    return <ol
        id={node.id}
        className={cName}
        onClick={this.setWS.bind(this, node)}
        onMouseDown={function(e){e.stopPropagation()}}
        style={{"paddingLeft" : "5px"}}
        key={node.id}>
        {node.icon}
        {node.id === undefined ? <span className="setup-textbox">{node.name}</span> : <span className="textbox">{node.name}</span>}
    </ol>;
  }

  render(){
    return (
      <div className='m-tree'>
        {this.props.workingstepList.map((workingstep, i) => {
          return <div className='m-node' key={i}>
            {this.renderNode(workingstep)}
          </div>;
        })}<commit_msg>Minor change to the way workingstep is set from workingsteplist view<commit_after>import React from 'react';
import _ from 'lodash';
import request from 'superagent';

export default class WorkingstepList extends React.Component {
  constructor(props){
    //Create the constructor for the component
    super(props);

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

  setWS(node){
    let url = '/v3/nc/state/ws/' + node["id"];
    request
        .get(url)
        .end(function (err, res) {
        });
  }

  getNodeIcon(node){
    if(isNaN(node.number)){
      return;
    }
    return <span className='icon-letter'>{node.number}</span>;
  }

  shouldComponentUpdate(nextProps, nextState) {
    return this.props.ws !== nextProps.ws;
  }

  renderNode(nodeId){
    let node = this.props.workingstepCache[nodeId];
    node.icon = this.getNodeIcon(node);
    let cName = 'node';
    if (node.id == this.props.ws) cName = 'node running-node';
    return <ol
        id={node.id}
        className={cName}
        onClick={() => {this.setWS(node);}}
        onMouseDown={function(e){e.stopPropagation()}}
        style={{"paddingLeft" : "5px"}}
        key={node.id}>
        {node.icon}
        {node.id === undefined ? <span className="setup-textbox">{node.name}</span> : <span className="textbox">{node.name}</span>}
    </ol>;
  }

  render(){
    return (
      <div className='m-tree'>
        {this.props.workingstepList.map((workingstep, i) => {
          return <div className='m-node' key={i}>
            {this.renderNode(workingstep)}
          </div>;
        })}
{'fraction_non_alphanumeric': 0.1625, 'fraction_numerical': 0.00125, 'mean_word_length': 2.7703180212014136, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 28, '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': '130429', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1028, 'n_words': 200}