import React from 'react'; import PropTypes from 'prop-types'; import { Row } from 'reactstrap'; import Job from './Job'; import { filterJobs } from './helpers'; export default class JobListMetric extends React.PureComponent { render() { const { data, repo, revision, showParentMatches } = this.props; const { name, details } = data; const jobs = filterJobs(details, showParentMatches); const msgForZeroJobs = details.length && !jobs.length ? `All failed ${name} also failed in Parent Push` : `All ${name} passed`; return (
{jobs.length ? ( jobs.map((job) => ( )) ) : (
{msgForZeroJobs}
)}
); } } JobListMetric.propTypes = { data: PropTypes.shape({ name: PropTypes.string.isRequired, result: PropTypes.string.isRequired, details: PropTypes.array.isRequired, }).isRequired, repo: PropTypes.string.isRequired, revision: PropTypes.string.isRequired, showParentMatches: PropTypes.bool.isRequired, };