Sha256: cbd61668c539a1c567b76cecf40c3825c450633689729ae75b12da84ada67bdd

Contents?: true

Size: 818 Bytes

Versions: 3

Compression:

Stored size: 818 Bytes

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { capitalize } from 'lodash';

import './StatusCell.scss';

const StatusCell = ({ statuses }) => (
  <td>
    <ul className="status-list">
      {Object.keys(statuses).map(status => {
        let style = '';
        switch (status) {
          case 'failure':
            style = 'label-danger';
            break;
          default:
            style = 'label-info';
        }
        if (!statuses[status]) style = 'label-default';
        return (
          <li key={status}>
            {`${capitalize(status)}: `}
            <span className={`label ${style}`}>{statuses[status]}</span>
          </li>
        );
      })}
    </ul>
  </td>
);

StatusCell.propTypes = {
  statuses: PropTypes.object.isRequired,
};

export default StatusCell;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_host_reports-1.0.2 webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.js
foreman_host_reports-1.0.1 webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.js
foreman_host_reports-1.0.0 webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.js