<commit_before>import mixin from 'reactjs-mixin';
import React from 'react';
import {StoreMixin} from 'mesosphere-shared-reactjs';

import {findNestedPropertyInObject} from '../../../../../../src/js/utils/Util';
import {SYSTEM_LOGS} from '../../../../../../src/js/constants/MesosLoggingStrategy';
import ConfigStore from '../../../../../../src/js/stores/ConfigStore';
import Loader from '../../../../../../src/js/components/Loader';
import TaskFileViewer from './TaskFileViewer';
import TaskSystemLogsContainer from './TaskSystemLogsContainer';

class TaskLogsContainer extends mixin(StoreMixin) {
  constructor() {
    super(...arguments);
    this.state = {
      isLoading: true
    };

    this.store_listeners = [{
      name: 'config',
      events: ['success', 'error'],
      listenAlways: false
    }];
  }

  componentWillMount() {
    // We already have a configuration, so stop loading. No need to fetch
    if (this.state.isLoading && ConfigStore.get('config') != null) {
      this.setState({isLoading: false});
    }
  }

  componentDidMount() {
    // We did not already receive the configuration
    if (this.state.isLoading && ConfigStore.get('config') == null) {
      ConfigStore.fetch();
    }
  }

  onConfigStoreSuccess() {
    this.setState({isLoading: false});
  }

  onConfigStoreError() {
    this.setState({isLoading: false});
  }

  render() {
    if (this.state.isLoading) {
      return <Loader />;
    }

    const {
      directory,
      params,
      routes,
      selectedLogFile,
      task
    } = this.props;
    const config = ConfigStore.get('config');
    const loggingStrategy = findNestedPropertyInObject(
      config,
      'uiConfiguration.plugins.mesos.logging-strategy'
    );

    if (loggingStrategy === SYSTEM_LOGS) {
      return <TaskSystemLogsContainer task={task} />;
    }

    return (
      <TaskFileViewer
        directory={directory}
        limitLogFiles={['stdout', 'stderr']}
        params={params}
        routes={routes}
        selectedLogFile={selectedLogFile}
        task={task} />
    );
  }
}

TaskFileViewer.propTypes = {
  directory: React.PropTypes.object,
  selectedLogFile: React.PropTypes.object,
  task: React.PropTypes.object
};

module.exports = TaskLogsContainer;<commit_msg>Assign propTypes to correct component<commit_after>import mixin from 'reactjs-mixin';
import React from 'react';
import {StoreMixin} from 'mesosphere-shared-reactjs';

import ConfigStore from '../../../../../../src/js/stores/ConfigStore';
import Loader from '../../../../../../src/js/components/Loader';
import Task from '../../structs/Task';
import TaskFileViewer from './TaskFileViewer';
import TaskSystemLogsContainer from './TaskSystemLogsContainer';
import {findNestedPropertyInObject} from '../../../../../../src/js/utils/Util';
import {SYSTEM_LOGS} from '../../../../../../src/js/constants/MesosLoggingStrategy';

class TaskLogsContainer extends mixin(StoreMixin) {
  constructor() {
    super(...arguments);
    this.state = {
      isLoading: true
    };

    this.store_listeners = [{
      name: 'config',
      events: ['success', 'error'],
      listenAlways: false
    }];
  }

  componentWillMount() {
    // We already have a configuration, so stop loading. No need to fetch
    if (this.state.isLoading && ConfigStore.get('config') != null) {
      this.setState({isLoading: false});
    }
  }

  componentDidMount() {
    // We did not already receive the configuration
    if (this.state.isLoading && ConfigStore.get('config') == null) {
      ConfigStore.fetch();
    }
  }

  onConfigStoreSuccess() {
    this.setState({isLoading: false});
  }

  onConfigStoreError() {
    this.setState({isLoading: false});
  }

  render() {
    if (this.state.isLoading) {
      return <Loader />;
    }

    const {
      directory,
      params,
      routes,
      selectedLogFile,
      task
    } = this.props;
    const config = ConfigStore.get('config');
    const loggingStrategy = findNestedPropertyInObject(
      config,
      'uiConfiguration.plugins.mesos.logging-strategy'
    );

    if (loggingStrategy === SYSTEM_LOGS) {
      return <TaskSystemLogsContainer task={task} />;
    }

    return (
      <TaskFileViewer
        directory={directory}
        limitLogFiles={['stdout', 'stderr']}
        params={params}
        routes={routes}
        selectedLogFile={selectedLogFile}
        task={task} />
    );
  }
}

TaskLogsContainer.propTypes = {
  directory: React.PropTypes.object,
  params: React.PropTypes.object,
  routes: React.PropTypes.array,
  selectedLogFile: React.PropTypes.object,
  task: React.PropTypes.instanceOf(Task)
};

module.exports = TaskLogsContainer;
{'fraction_non_alphanumeric': 0.15447328899377816, 'fraction_numerical': 0.0, 'mean_word_length': 2.8150572831423895, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3749708', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1384, 'n_words': 281}