<commit_before>import React, { Component, PropTypes } from "react"
import { Card, CardTitle, CardText } from "material-ui/Card"
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from "../Table"
import { connect } from "react-redux"
import JobLink from "../JobLink/JobLink"
import ClientLink from "../ClientLink/ClientLink"
import MetaPayload from "../MetaPayload/MetaPayload"
import FormatTime from "../FormatTime/FormatTime"
import { WATCH_NODES, UNWATCH_NODES } from "../../sagas/event"

const allocProps = ["ID", "Name", "ClientStatus", "ClientDescription", "DesiredStatus", "DesiredDescription"]

class AllocationInfo extends Component {
  componentWillMount() {
    this.props.dispatch({ type: WATCH_NODES })
  }

  componentWillUnmount() {
    this.props.dispatch({ type: UNWATCH_NODES })
  }

  static taskState(allocation, name, states) {
    const title = (
      <h3>
        Task state history for {allocation.JobID}.{allocation.TaskGroup}.{name}{" "}
        (final state: {states.State})
      </h3>
    )

    let lastEventTime = null

    return (
      <Card>
        <CardTitle title={title} />
        <CardText>
          <Table selectable={false} showCheckboxes={false}>
            <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
              <TableRow>
                <TableHeaderColumn style={{ width: 180 }}>
                  When
                </TableHeaderColumn>
                <TableHeaderColumn style={{ width: 180 }}>
                  Duration
                </TableHeaderColumn>
                <TableHeaderColumn style={{ width: 180 }}>
                  Type
                </TableHeaderColumn>
                <TableHeaderColumn>Message / Reason</TableHeaderColumn>
                <TableHeaderColumn style={{ width: 75 }}>
                  Signal
                </TableHeaderColumn>
                <TableHeaderColumn style={{ width: 50 }}>
                  Code
                </TableHeaderColumn>
              </TableRow>
            </TableHeader>
            <TableBody preScanRows={false} displayRowCheckbox={false} showRowHover>
              {states.Events.map((element, index) => {
                if (!lastEventTime) {
                  lastEventTime = element.Time
                }

                const output = (
                  <TableRow key={index}>
                    <TableRowColumn style={{ width: 180 }}>
                      <FormatTime time={element.Time} identifier={`${allocation.ID}-${element.Time}`} />
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 180 }}>
                      <FormatTime
                        time={element.Time}
                        now={lastEventTime}
                        identifier={`${allocation.ID}-${element.Time}`}
                        durationInterval="ms"
                        durationFormat="h [hour] m [min] s [seconds]"
                      />
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 180 }}>
                      {element.Type}
                    </TableRowColumn>
                    <TableRowColumn>
                      {element.Message ||
                        element.SetupError ||
                        element.DriverError ||
                        element.KillError ||
                        element.DownloadError ||
                        element.ValidationError ||
                        element.VaultError ||
                        element.RestartReason ||
                        element.KillReason ||
                        element.TaskSignalReason}
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 75 }}>
                      {element.Signal || element.TaskSignal}
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 50 }}>
                      {element.ExitCode}
                    </TableRowColumn>
                  </TableRow>
                )

                lastEventTime = element.Time
                return output
              })}
            </TableBody>
          </Table>
        </CardText>
      </Card>
    )
  }

  render() {
    const allocation = this.props.allocation
    const jobId = allocation.JobID
    const nodeId = allocation.NodeID<commit_msg>Add missing event message fields<commit_after>import React, { Component, PropTypes } from "react"
import { Card, CardTitle, CardText } from "material-ui/Card"
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from "../Table"
import { connect } from "react-redux"
import JobLink from "../JobLink/JobLink"
import ClientLink from "../ClientLink/ClientLink"
import MetaPayload from "../MetaPayload/MetaPayload"
import FormatTime from "../FormatTime/FormatTime"
import { WATCH_NODES, UNWATCH_NODES } from "../../sagas/event"

const allocProps = ["ID", "Name", "ClientStatus", "ClientDescription", "DesiredStatus", "DesiredDescription"]

class AllocationInfo extends Component {
  componentWillMount() {
    this.props.dispatch({ type: WATCH_NODES })
  }

  componentWillUnmount() {
    this.props.dispatch({ type: UNWATCH_NODES })
  }

  static taskState(allocation, name, states) {
    const title = (
      <h3>
        Task state history for {allocation.JobID}.{allocation.TaskGroup}.{name}{" "}
        (final state: {states.State})
      </h3>
    )

    let lastEventTime = null

    return (
      <Card>
        <CardTitle title={title} />
        <CardText>
          <Table selectable={false} showCheckboxes={false}>
            <TableHeader displaySelectAll={false} adjustForCheckbox={false}>
              <TableRow>
                <TableHeaderColumn style={{ width: 180 }}>
                  When
                </TableHeaderColumn>
                <TableHeaderColumn style={{ width: 180 }}>
                  Duration
                </TableHeaderColumn>
                <TableHeaderColumn style={{ width: 180 }}>
                  Type
                </TableHeaderColumn>
                <TableHeaderColumn>Message / Reason</TableHeaderColumn>
                <TableHeaderColumn style={{ width: 75 }}>
                  Signal
                </TableHeaderColumn>
                <TableHeaderColumn style={{ width: 50 }}>
                  Code
                </TableHeaderColumn>
              </TableRow>
            </TableHeader>
            <TableBody preScanRows={false} displayRowCheckbox={false} showRowHover>
              {states.Events.map((element, index) => {
                if (!lastEventTime) {
                  lastEventTime = element.Time
                }

                const output = (
                  <TableRow key={index}>
                    <TableRowColumn style={{ width: 180 }}>
                      <FormatTime time={element.Time} identifier={`${allocation.ID}-${element.Time}`} />
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 180 }}>
                      <FormatTime
                        time={element.Time}
                        now={lastEventTime}
                        identifier={`${allocation.ID}-${element.Time}`}
                        durationInterval="ms"
                        durationFormat="h [hour] m [min] s [seconds]"
                      />
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 180 }}>
                      {element.Type}
                    </TableRowColumn>
                    <TableRowColumn>
                      {element.Message ||
                        element.SetupError ||
                        element.DriverError ||
                        element.DriverMessage ||
                        element.FailedSibling ||
                        element.KillError ||
                        element.DownloadError ||
                        element.TaskSignal ||
                        element.ValidationError ||
                        element.VaultError ||
                        element.RestartReason ||
                        element.KillReason ||
                        element.TaskSignalReason}
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 75 }}>
                      {element.Signal || element.TaskSignal}
                    </TableRowColumn>
                    <TableRowColumn style={{ width: 50 }}>
                      {element.ExitCode}
                    </TableRowColumn>
                  </TableRow>
                )

                lastEventTime = element.Time
                return output
              })}
            </TableBody>
          </Table>
        </CardText>
      </Card>
    )
  }

  render() {
    const allocation = this.props.allocation
    const jobId = allocation.JobID
    const nodeId = allocation.NodeID
{'fraction_non_alphanumeric': 0.10627747097937564, 'fraction_numerical': 0.0063112814155302606, 'mean_word_length': 1.4446280991735536, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2400117', 'n_tokens_mistral': 2220, 'n_tokens_neox': 2057, 'n_words': 444}