aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/list/ListQuery.js
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-15 20:31:53 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-15 20:31:53 +0200
commit1984d4343db770fc2c8e251a81f1ab997a4c4d5e (patch)
treed60630e0d36ea24ee9eaf16653194703f4b46dd8 /webui/src/list/ListQuery.js
parent2530cee1eac225924e1119554cf475cdc46ed7dc (diff)
downloadgit-bug-1984d4343db770fc2c8e251a81f1ab997a4c4d5e.tar.gz
webui: rework of the bug page with a timeline
Diffstat (limited to 'webui/src/list/ListQuery.js')
-rw-r--r--webui/src/list/ListQuery.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/webui/src/list/ListQuery.js b/webui/src/list/ListQuery.js
new file mode 100644
index 00000000..3b57fcc2
--- /dev/null
+++ b/webui/src/list/ListQuery.js
@@ -0,0 +1,44 @@
+// @flow
+import CircularProgress from '@material-ui/core/CircularProgress'
+import gql from 'graphql-tag'
+import React from 'react'
+import { Query } from 'react-apollo'
+import BugRow from './BugRow'
+import List from './List'
+
+const QUERY = gql`
+ query($first: Int = 10, $last: Int, $after: String, $before: String) {
+ defaultRepository {
+ bugs: allBugs(first: $first, last: $last, after: $after, before: $before) {
+ totalCount
+ edges {
+ cursor
+ node {
+ ...BugRow
+ }
+ }
+ pageInfo{
+ hasNextPage
+ hasPreviousPage
+ startCursor
+ endCursor
+ }
+ }
+ }
+ }
+
+
+ ${BugRow.fragment}
+`
+
+const ListQuery = () => (
+ <Query query={QUERY}>
+ {({loading, error, data, fetchMore}) => {
+ if (loading) return <CircularProgress/>
+ if (error) return <p>Error: {error}</p>
+ return <List bugs={data.defaultRepository.bugs} fetchMore={fetchMore}/>
+ }}
+ </Query>
+)
+
+export default ListQuery