forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-suite-view.js
64 lines (58 loc) · 1.87 KB
/
check-suite-view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, {Fragment} from 'react';
import PropTypes from 'prop-types';
import {graphql, createFragmentContainer} from 'react-relay';
import Octicon from '../atom/octicon';
import CheckRunView from './check-run-view';
import {buildStatusFromCheckResult} from '../models/build-status';
export class BareCheckSuiteView extends React.Component {
static propTypes = {
// Relay
checkSuite: PropTypes.shape({
app: PropTypes.shape({
name: PropTypes.string.isRequired,
}),
status: PropTypes.oneOf([
'QUEUED', 'IN_PROGRESS', 'COMPLETED', 'REQUESTED',
]).isRequired,
conclusion: PropTypes.oneOf([
'ACTION_REQUIRED', 'TIMED_OUT', 'CANCELLED', 'FAILURE', 'SUCCESS', 'NEUTRAL',
]),
}).isRequired,
checkRuns: PropTypes.arrayOf(
PropTypes.shape({id: PropTypes.string.isRequired}),
).isRequired,
// Actions
switchToIssueish: PropTypes.func.isRequired,
};
render() {
const {icon, classSuffix} = buildStatusFromCheckResult(this.props.checkSuite);
return (
<Fragment>
<li className="github-PrStatuses-list-item">
<span className="github-PrStatuses-list-item-icon">
<Octicon icon={icon} className={`github-PrStatuses--${classSuffix}`} />
</span>
{this.props.checkSuite.app && (
<span className="github-PrStatuses-list-item-context">
<strong>{this.props.checkSuite.app.name}</strong>
</span>
)}
</li>
{this.props.checkRuns.map(run => (
<CheckRunView key={run.id} checkRun={run} switchToIssueish={this.props.switchToIssueish} />
))}
</Fragment>
);
}
}
export default createFragmentContainer(BareCheckSuiteView, {
checkSuite: graphql`
fragment checkSuiteView_checkSuite on CheckSuite {
app {
name
}
status
conclusion
}
`,
});