<commit_before>/**
 * Created by justin on 9/8/16.
 */

import * as React from 'react';
import * as _ from 'lodash';
import { connect } from 'react-redux';
import { startYarnCluster, uploadEngine, getEngines, getConfig } from '../actions/clusters.actions';
import { bindActionCreators } from 'redux';
import Cell from '../../Projects/components/Cell';
import Row from '../../Projects/components/Row';
import PageHeader from '../../Projects/components/PageHeader';
import Table from '../../Projects/components/Table';
import '../styles/launchcluster.scss';
import { NumericInput } from 'h2oUIKit';

interface Props {
  engines: any,
  config: any
}

interface DispatchProps {
  startYarnCluster: Function,
  uploadEngine: Function,
  getEngines: Function,
  getConfig: Function
}

export class LaunchCluster extends React.Component<Props & DispatchProps, any> {
  refs: {
    [key: string]: (Element);
    engine: (HTMLInputElement)
    clusterForm: (HTMLFormElement)
    engineList: (HTMLSelectElement)
  };

  constructor() {
    super();
    this.state = {
      memorySizeUnit: 'm',
      engineId: null
    };
  }

  componentDidMount() {
    this.props.getEngines();
    this.props.getConfig();
  }

  startCluster(event) {
    event.preventDefault();
    let clusterName = (this.refs.clusterForm.querySelector('input[name="name"]') as HTMLInputElement).value;
    let engineId = this.state.engineId;
    let size = (this.refs.clusterForm.querySelector('input[name="size"]') as HTMLInputElement).value;
    let memory = (this.refs.clusterForm.querySelector('input[name="memory"]') as HTMLInputElement).value;
    let keytab = (this.refs.clusterForm.querySelector('input[name="keytab"]') as HTMLInputElement).value;
    this.props.startYarnCluster(clusterName, parseInt(engineId, 10), parseInt(size, 10), memory + this.state.memorySizeUnit, keytab);
  }

  uploadEngine(event) {<commit_msg>Fixes an issue with retrieving keytab value if no kerberos<commit_after>/**
 * Created by justin on 9/8/16.
 */

import * as React from 'react';
import * as _ from 'lodash';
import { connect } from 'react-redux';
import { startYarnCluster, uploadEngine, getEngines, getConfig } from '../actions/clusters.actions';
import { bindActionCreators } from 'redux';
import Cell from '../../Projects/components/Cell';
import Row from '../../Projects/components/Row';
import PageHeader from '../../Projects/components/PageHeader';
import Table from '../../Projects/components/Table';
import '../styles/launchcluster.scss';
import { NumericInput } from 'h2oUIKit';

interface Props {
  engines: any,
  config: any
}

interface DispatchProps {
  startYarnCluster: Function,
  uploadEngine: Function,
  getEngines: Function,
  getConfig: Function
}

export class LaunchCluster extends React.Component<Props & DispatchProps, any> {
  refs: {
    [key: string]: (Element);
    engine: (HTMLInputElement)
    clusterForm: (HTMLFormElement)
    engineList: (HTMLSelectElement)
  };

  constructor() {
    super();
    this.state = {
      memorySizeUnit: 'm',
      engineId: null
    };
  }

  componentDidMount() {
    this.props.getEngines();
    this.props.getConfig();
  }

  startCluster(event) {
    event.preventDefault();
    let clusterName = (this.refs.clusterForm.querySelector('input[name="name"]') as HTMLInputElement).value;
    let engineId = this.state.engineId;
    let size = (this.refs.clusterForm.querySelector('input[name="size"]') as HTMLInputElement).value;
    let memory = (this.refs.clusterForm.querySelector('input[name="memory"]') as HTMLInputElement).value;
    let keytab = _.get((this.refs.clusterForm.querySelector('input[name="keytab"]') as HTMLInputElement), 'value', '');
    this.props.startYarnCluster(clusterName, parseInt(engineId, 10), parseInt(size, 10), memory + this.state.memorySizeUnit, keytab);
  }

  uploadEngine(event) {
{'fraction_non_alphanumeric': 0.1440083181700026, 'fraction_numerical': 0.004678970626462178, 'mean_word_length': 4.285714285714286, 'pattern_counts': {'":': 0, '<': 5, '<?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': '815859', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1169, 'n_words': 268}