<commit_before>/**
* GenerateEFContainer.jsx
* Created by <NAME> 8/23/16
**/

import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { hashHistory } from 'react-router';

import Q from 'q';

import * as uploadActions from '../../redux/actions/uploadActions.js';
import { kGlobalConstants } from '../../GlobalConstants.js';
import * as GenerateHelper from '../../helpers/generateFilesHelper.js';

import GenerateEFContent from '../../components/generateEF/GenerateEFContent.jsx';
import GenerateEFError from '../../components/generateEF/GenerateEFError.jsx';

const timerDuration = 10;

class GenerateEFContainer extends React.Component {
	constructor(props) {
		super(props);

		this.isUnmounted = false;

		this.state = {
			fullPageError: false,
			fullPageMessage: '',
			isReady: false,
			hasErrors: false,
			e: {},
			f: {}
		};

	}

	componentDidMount() {
		this.isUnmounted = false;
		this.generateFiles();
	}

	componentWillUnmount() {
		this.isUnmounted = true;
	}

	handleResponse(allResponses) {
		if (this.isUnmounted) {
			return;
		}

		const keys = ['e', 'f'];
		const newState = {};
		for (let i = 0; i < keys.length; i++) {
			const response = allResponses[i];
			let data;
			if (response.state == 'fulfilled') {
				data = response.value;

				if (data.status == 'invalid') {
					data.message = 'Prerequisites required to generate this file are incomplete.';
				}
			}
			else {
				data = response.reason;
			}

			newState[keys[i]] = data;
		}

		this.setState(newState, this.parseState);
	}
<commit_msg>Adding a flag to the state so that we can identify if it has not been generated (queuing the generation) or if it is an error. Instead of generating on componentDidMount, do fileStatusCheck instead.<commit_after>/**
* GenerateEFContainer.jsx
* Created by <NAME> 8/23/16
**/

import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { hashHistory } from 'react-router';

import Q from 'q';

import * as uploadActions from '../../redux/actions/uploadActions.js';
import { kGlobalConstants } from '../../GlobalConstants.js';
import * as GenerateHelper from '../../helpers/generateFilesHelper.js';

import GenerateEFContent from '../../components/generateEF/GenerateEFContent.jsx';
import GenerateEFError from '../../components/generateEF/GenerateEFError.jsx';

const timerDuration = 10;

class GenerateEFContainer extends React.Component {
	constructor(props) {
		super(props);

		this.isUnmounted = false;

		this.state = {
			fullPageError: false,
			fullPageMessage: '',
			isReady: false,
			hasErrors: false,
			e: {},
			f: {},
			generated: false
		};

	}

	componentDidMount() {
		this.isUnmounted = false;
		this.checkFileStatus();
	}

	componentWillUnmount() {
		this.isUnmounted = true;
	}

	handleResponse(allResponses) {
		if (this.isUnmounted) {
			return;
		}

		const keys = ['e', 'f'];
		const newState = {};
		for (let i = 0; i < keys.length; i++) {
			const response = allResponses[i];
			let data;
			if (response.state == 'fulfilled') {
				data = response.value;

				if (data.status == 'invalid') {
					if(!this.state.generated){
						this.setState({'generated': true});
						this.generateFiles();
						return;
					}else{
						data.message = 'Prerequisites required to generate this file are incomplete.';
					}
				}
			}
			else {
				data = response.reason;
			}

			newState[keys[i]] = data;
		}

		this.setState(newState, this.parseState);
	}

{'fraction_non_alphanumeric': 0.14293817356778218, 'fraction_numerical': 0.0045377197958026095, 'mean_word_length': 3.419799498746867, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6535987', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1109, 'n_words': 285}