forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpr-timeline-controller.js
62 lines (60 loc) · 1.71 KB
/
pr-timeline-controller.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
import {graphql, createPaginationContainer} from 'react-relay';
import IssueishTimelineView from '../views/issueish-timeline-view';
export default createPaginationContainer(IssueishTimelineView, {
pullRequest: graphql`
fragment prTimelineController_pullRequest on PullRequest
@argumentDefinitions(
timelineCount: {type: "Int!"},
timelineCursor: {type: "String"}
) {
url
...headRefForcePushedEventView_issueish
timelineItems(first: $timelineCount, after: $timelineCursor)
@connection(key: "prTimelineContainer_timelineItems") {
pageInfo { endCursor hasNextPage }
edges {
cursor
node {
__typename
...commitsView_nodes
...issueCommentView_item
...mergedEventView_item
...headRefForcePushedEventView_item
...commitCommentThreadView_item
...crossReferencedEventsView_nodes
}
}
}
}
`,
}, {
direction: 'forward',
getConnectionFromProps(props) {
return props.pullRequest.timeline;
},
getFragmentVariables(prevVars, totalCount) {
return {
...prevVars,
timelineCount: totalCount,
};
},
getVariables(props, {count, cursor}, fragmentVariables) {
return {
url: props.pullRequest.url,
timelineCount: count,
timelineCursor: cursor,
};
},
query: graphql`
query prTimelineControllerQuery($timelineCount: Int!, $timelineCursor: String, $url: URI!) {
resource(url: $url) {
... on PullRequest {
...prTimelineController_pullRequest @arguments(
timelineCount: $timelineCount,
timelineCursor: $timelineCursor
)
}
}
}
`,
});