2019-11-22 21:34:57 +03:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-03-27 02:59:38 +03:00
|
|
|
import { Row } from 'reactstrap';
|
2019-11-22 21:34:57 +03:00
|
|
|
|
|
|
|
import Job from './Job';
|
2020-04-04 02:04:31 +03:00
|
|
|
import { filterJobs } from './helpers';
|
2019-11-22 21:34:57 +03:00
|
|
|
|
|
|
|
export default class JobListMetric extends React.PureComponent {
|
|
|
|
render() {
|
2020-07-08 06:30:39 +03:00
|
|
|
const { data, repo, revision, showParentMatches } = this.props;
|
|
|
|
const { name, details } = data;
|
2020-04-04 02:04:31 +03:00
|
|
|
const jobs = filterJobs(details, showParentMatches);
|
|
|
|
const msgForZeroJobs =
|
|
|
|
details.length && !jobs.length
|
|
|
|
? `All failed ${name} also failed in Parent Push`
|
|
|
|
: `All ${name} passed`;
|
2019-11-22 21:34:57 +03:00
|
|
|
|
|
|
|
return (
|
2020-07-08 06:30:39 +03:00
|
|
|
<div>
|
|
|
|
{jobs.length ? (
|
|
|
|
jobs.map((job) => (
|
|
|
|
<Row key={job.id} className="mt-2">
|
|
|
|
<Job job={job} repo={repo} revision={revision} />
|
|
|
|
</Row>
|
|
|
|
))
|
|
|
|
) : (
|
|
|
|
<div>{msgForZeroJobs}</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2019-11-22 21:34:57 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
JobListMetric.propTypes = {
|
2020-04-23 22:19:25 +03:00
|
|
|
data: PropTypes.shape({
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
result: PropTypes.string.isRequired,
|
|
|
|
details: PropTypes.array.isRequired,
|
|
|
|
}).isRequired,
|
2019-11-22 21:34:57 +03:00
|
|
|
repo: PropTypes.string.isRequired,
|
|
|
|
revision: PropTypes.string.isRequired,
|
2020-04-04 02:04:31 +03:00
|
|
|
showParentMatches: PropTypes.bool.isRequired,
|
2019-11-22 21:34:57 +03:00
|
|
|
};
|