<commit_before>import { Map as IMap } from 'immutable';
import React from 'react';
import SelectionRecord from '../records/selection_record';
import Status from '../components/status';
import View from '../components/view';
import WorkflowRecord from '../records/workflow_record';
import WorkflowSteps from '../components/workflow_steps';
import selectionConstants from '../constants/selection_constants';

require('../../css/workflow.scss');

class Workflow extends React.Component {
  componentDidMount() {
    this.props.initializeWorkflow(this.props.workflowId);
  }

  render() {
    let selectedWorkflowNode;
    if (this.props.selection.type === selectionConstants.WORKFLOW_NODE) {
      selectedWorkflowNode = this.props.workflow.workflowNodes.find(workflowNode =>
        workflowNode.id === this.props.selection.id
      );
    }

    return (
      <div className="workflow">
        <WorkflowSteps
          clickRun={this.props.clickRun}
          clickWorkflowNode={this.props.clickWorkflowNode}
          clickWorkflow={this.props.clickWorkflow}
          onUpload={this.props.onUpload}
          selection={this.props.selection}
          workflow={this.props.workflow}
          workflowStatus={this.props.workflowStatus}
        />
        <Status
          nodes={this.props.nodes}
          selection={this.props.selection}
          workflow={this.props.workflow}
          workflowStatus={this.props.workflowStatus}
        />
        <View
          workflowNode={selectedWorkflowNode}
        />
      </div>
    );
  }
}

Workflow.propTypes = {
  clickRun: React.PropTypes.func.isRequired,
  clickWorkflowNode: React.PropTypes.func.isRequired,
  clickWorkflow: React.PropTypes.func.isRequired,
  initializeWorkflow: React.PropTypes.func.isRequired,
  nodes: React.PropTypes.instanceOf(IMap),
  onUpload: React.PropTypes.func.isRequired,
  workflow: React.PropTypes.instanceOf(WorkflowRecord),
  workflowId: React.PropTypes.string.isRequired,
  workflowStatus: React.PropTypes.string,
  selection: React.PropTypes.instanceOf(SelectionRecord).isRequired,
};

export default Workflow;<commit_msg>Loading state when loading a workflow<commit_after>import { Map as IMap } from 'immutable';
import React from 'react';
import SelectionRecord from '../records/selection_record';
import Status from '../components/status';
import View from '../components/view';
import WorkflowRecord from '../records/workflow_record';
import WorkflowSteps from '../components/workflow_steps';
import selectionConstants from '../constants/selection_constants';

require('../../css/workflow.scss');

class Workflow extends React.Component {
  componentDidMount() {
    this.props.initializeWorkflow(this.props.workflowId);
  }

  render() {
    let selectedWorkflowNode;
    if (this.props.selection.type === selectionConstants.WORKFLOW_NODE) {
      selectedWorkflowNode = this.props.workflow.workflowNodes.find(workflowNode =>
        workflowNode.id === this.props.selection.id
      );
    }

    return (
      <div className="workflow">
        {
          this.props.workflow.fetching ? (
            <h2>Loading!</h2>
          ) : (
            <div>
              <WorkflowSteps
                clickRun={this.props.clickRun}
                clickWorkflowNode={this.props.clickWorkflowNode}
                clickWorkflow={this.props.clickWorkflow}
                onUpload={this.props.onUpload}
                selection={this.props.selection}
                workflow={this.props.workflow}
                workflowStatus={this.props.workflowStatus}
              />
              <Status
                nodes={this.props.nodes}
                selection={this.props.selection}
                workflow={this.props.workflow}
                workflowStatus={this.props.workflowStatus}
              />
              <View
                workflowNode={selectedWorkflowNode}
              />
            </div>
          )
        }
      </div>
    );
  }
}

Workflow.propTypes = {
  clickRun: React.PropTypes.func.isRequired,
  clickWorkflowNode: React.PropTypes.func.isRequired,
  clickWorkflow: React.PropTypes.func.isRequired,
  initializeWorkflow: React.PropTypes.func.isRequired,
  nodes: React.PropTypes.instanceOf(IMap),
  onUpload: React.PropTypes.func.isRequired,
  workflow: React.PropTypes.instanceOf(WorkflowRecord),
  workflowId: React.PropTypes.string.isRequired,
  workflowStatus: React.PropTypes.string,
  selection: React.PropTypes.instanceOf(SelectionRecord).isRequired,
};

export default Workflow;
{'fraction_non_alphanumeric': 0.11533362792752982, 'fraction_numerical': 0.0004418912947414936, 'mean_word_length': 2.879177377892031, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '2125799', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1263, 'n_words': 196}