<commit_before>import React from 'react';
import moment from 'moment';
import { browserHistory } from 'react-router';
import FaPlay from 'react-icons/lib/fa/play';
import FaStop from 'react-icons/lib/fa/stop';
import FaRefresh from 'react-icons/lib/fa/refresh';
import FaEye from 'react-icons/lib/fa/eye';
import DockerService from '../Service/DockerService';
import style from './Containers.css';

const GREEN_STATUS = /up/i;

const ContainerRow = ({ container, action }) => {
  const isUp = GREEN_STATUS.test(container.Status);

  return (
    <span className={style.row}>
      <pre>{container.Id.substring(0, 12)}</pre>
      <span className={style.fluid}>{container.Image}</span>
      <span className={style.fluid}>{container.Command}</span>
      <span className={style.created}>
        {moment.unix(container.Created).fromNow()}
      </span>
      <span className={style.fluid} style={{ color: isUp ? '#4cae4c' : '#d43f3a' }}>
        {container.Status}
      </span>
      <span className={style.fluid}>{container.Names.join(', ')}</span>
      <button
        key="logs"
        className={`${style.icon} ${style.success}`}
        onClick={() => browserHistory.push(`/containers/${container.Id}`)}
      >
        <FaEye />
      </button>
      {
        isUp && DockerService.isLogged() && [
          <button
            key="restart"
            className={`${style.icon} ${style.primary}`}
            onClick={() => action(DockerService.restart(container.Id))}
          >
            <FaRefresh />
          </button>,
          <button
            key="stop"
            className={`${style.icon} ${style.stop}`}
            onClick={() => action(DockerService.stop(container.Id))}
          >
            <FaStop />
          </button>,
        ]
      }
      {
        !isUp && DockerService.isLogged() &&
          <button
            key="start"
            className={style.icon}
            onClick={() => action(DockerService.start(container.Id))}
          >
            <FaPlay />
          </button>
      }
    </span>
  );
};

ContainerRow.displayName = 'ContainerRow';

ContainerRow.propTypes = {
  action: React.PropTypes.func,
  container: React.PropTypes.shape({
    Image: React.PropTypes.string.isRequired,
    Created: React.PropTypes.number.isRequired,
    Status: React.PropTypes.string.isRequired,<commit_msg>Update ContainerRow.jsx<commit_after>import React from 'react';
import moment from 'moment';
import { browserHistory } from 'react-router';
import FaPlay from 'react-icons/lib/fa/play';
import FaStop from 'react-icons/lib/fa/stop';
import FaRefresh from 'react-icons/lib/fa/refresh';
import FaEye from 'react-icons/lib/fa/eye';
import FaTrashO from 'react-icons/lib/fa/trash-o';
import DockerService from '../Service/DockerService';
import style from './Containers.css';

const GREEN_STATUS = /up/i;

const ContainerRow = ({ container, action }) => {
  const isUp = GREEN_STATUS.test(container.Status);

  return (
    <span className={style.row}>
      <pre>{container.Id.substring(0, 12)}</pre>
      <span className={style.fluid}>{container.Image}</span>
      <span className={style.fluid}>{container.Command}</span>
      <span className={style.created}>
        {moment.unix(container.Created).fromNow()}
      </span>
      <span className={style.fluid} style={{ color: isUp ? '#4cae4c' : '#d43f3a' }}>
        {container.Status}
      </span>
      <span className={style.fluid}>{container.Names.join(', ')}</span>
      <button
        key="logs"
        className={`${style.icon} ${style.success}`}
        onClick={() => browserHistory.push(`/containers/${container.Id}`)}
      >
        <FaEye />
      </button>
      {
        isUp && DockerService.isLogged() && [
          <button
            key="restart"
            className={`${style.icon} ${style.primary}`}
            onClick={() => action(DockerService.restart(container.Id))}
          >
            <FaRefresh />
          </button>,
          <button
            key="stop"
            className={`${style.icon} ${style.stop}`}
            onClick={() => action(DockerService.stop(container.Id))}
          >
            <FaStop />
          </button>,
        ]
      }
      {
        !isUp && DockerService.isLogged() && [
          <button
            key="start"
            className={style.icon}
            onClick={() => action(DockerService.start(container.Id))}
          >
            <FaPlay />
          </button>,
          <button
            key="delete"
            className={style.icon}
            onClick={() => action(DockerService.delete(container.Id))}
          >
            <FaTrash />
          </button>
        ]
      }
    </span>
  );
};

ContainerRow.displayName = 'ContainerRow';

ContainerRow.propTypes = {
  action: React.PropTypes.func,
  container: React.PropTypes.shape({
    Image: React.PropTypes.string.isRequired,
    Created: React.PropTypes.number.isRequired,
    Status: React.PropTypes.string.isRequired,
{'fraction_non_alphanumeric': 0.16288866599799398, 'fraction_numerical': 0.0032096288866599798, 'mean_word_length': 2.3666441593517895, 'pattern_counts': {'":': 0, '<': 58, '<?xml version=': 0, '>': 69, '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': '219176', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1497, 'n_words': 251}