<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { Glyphicon } from 'react-bootstrap';

import { RunRequest } from '../../../actions/api/requests';

import TaskLauncher from '../TaskLauncher';
import FormModal from '../modal/FormModal';

import Messenger from 'messenger';
import Utils from '../../../utils';
import uuid from 'node-uuid';

const LOCAL_STORAGE_AFTER_TRIGGER_VALUE = 'afterRunNowTrigger';
const LOCAL_STORAGE_TAIL_AFTER_TRIGGER_FILENAME = 'taskRunRedirectFilename';

class RunNowModal extends Component {
  static propTypes = {
    requestId: PropTypes.string.isRequired,
    runNow: PropTypes.func.isRequired,
    router: PropTypes.object.isRequired,
    rerun: PropTypes.bool,
    task: PropTypes.object,
    then: PropTypes.func
  };

  static AFTER_TRIGGER = {
    STAY: {label: 'Stay on this page', value: 'STAY'},
    SANDBOX: {label: 'Wait for task to start, then browse its sandbox', value: 'SANDBOX'},
    TAIL: {label: 'Wait for task to start, then start tailing:', value: 'TAIL'}
  };

  defaultCommandLineArgs() {
    return Utils.maybe(this.props.task, ['taskRequest', 'pendingTask', 'cmdLineArgsList']);
  }

  show() {
    this.refs.runNowModal.show();
  }

  handleRunNow(data) {
    localStorage.setItem(LOCAL_STORAGE_AFTER_TRIGGER_VALUE, data.afterTrigger);
    const runId = uuid.v4();<commit_msg>Clone the form data before modifying it<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { Glyphicon } from 'react-bootstrap';

import { RunRequest } from '../../../actions/api/requests';

import TaskLauncher from '../TaskLauncher';
import FormModal from '../modal/FormModal';

import Messenger from 'messenger';
import Utils from '../../../utils';
import uuid from 'node-uuid';

const LOCAL_STORAGE_AFTER_TRIGGER_VALUE = 'afterRunNowTrigger';
const LOCAL_STORAGE_TAIL_AFTER_TRIGGER_FILENAME = 'taskRunRedirectFilename';

class RunNowModal extends Component {
  static propTypes = {
    requestId: PropTypes.string.isRequired,
    runNow: PropTypes.func.isRequired,
    router: PropTypes.object.isRequired,
    rerun: PropTypes.bool,
    task: PropTypes.object,
    then: PropTypes.func
  };

  static AFTER_TRIGGER = {
    STAY: {label: 'Stay on this page', value: 'STAY'},
    SANDBOX: {label: 'Wait for task to start, then browse its sandbox', value: 'SANDBOX'},
    TAIL: {label: 'Wait for task to start, then start tailing:', value: 'TAIL'}
  };

  defaultCommandLineArgs() {
    return Utils.maybe(this.props.task, ['taskRequest', 'pendingTask', 'cmdLineArgsList']);
  }

  show() {
    this.refs.runNowModal.show();
  }

  handleRunNow(dataFromForm) {
    const data = Utils.deepClone(dataFromForm);
    localStorage.setItem(LOCAL_STORAGE_AFTER_TRIGGER_VALUE, data.afterTrigger);
    const runId = uuid.v4();
{'fraction_non_alphanumeric': 0.13187195546276967, 'fraction_numerical': 0.0006958942240779402, 'mean_word_length': 4.3638059701492535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3955592', 'n_tokens_mistral': 933, 'n_tokens_neox': 923, 'n_words': 230}